[dev-context] Determining the current text style?

Brooks Moses bmoses at stanford.edu
Sun Sep 11 23:48:49 CEST 2005


I'd like to write some macros that do different things depending on the 
style of the current font.  That is, \mymacro in this example

   \mymacro {\bf \mymacro} {\it \mymacro}

should be able to do something different in each of those three cases.  I 
remember seeing a bit of clever code in a recent message that could test 
whether or not it was being used in a region of typewriter font and adjust 
accordingly; are there similar tests that can be used for \bf, \it, and so 
forth?  If so, what are they?  (And how reliable are they?)

(For those who are curious, I'm thinking about this for the 
LaTeX-compatiblity code I'm writing.  LaTeX's \itshape command will select 
\it in normal font, but \bi in boldface font.  LaTeX handles this by 
defining extra flags to keep track of the current style, but I'd like to 
avoid doing that if I don't need to.)

- Brooks

More information about the dev-context mailing list