Taco Hoekwater wrote:
Sorry, messed up something. New version followws:
\newbox\chemlowbox \def\chemlow#1% {\setbox\chemlowbox\hbox{{\switchtobodyfont[small]#1}}}
\def\chemhigh#1% {\ifvoid\chemlowbox \high{{\switchtobodyfont[small]#1}}% \else \lohi[left]{\box\chemlowbox}{{\switchtobodyfont[small]#1}}\fi }
\def\finishchem{\ifvoid\chemlowbox \else \low{\box\chemlowbox}\fi}
\unexpanded\def\molecule% {\bgroup \catcode`\_=\active \uccode`\~=`\_ \uppercase{\let~\chemlow}% \catcode`\^=\active \uccode`\~=`\^ \uppercase{\let~\chemhigh}% \dostepwiserecurse {65}{90}{1} {\catcode \recurselevel = \active \uccode`\~=\recurselevel \uppercase{\edef~{\noexpand\finishchem \rawcharacter{\recurselevel}}}}% \catcode`\-=\active \uccode`\~=`\- \uppercase{\def~{--}}% \domolecule }%
\def\domolecule#1{#1\finishchem\egroup}
\starttext {\bf A test \variant[Caps] in small caps}
\molecule{HSO_4^{-}} \molecule{H_2SO_4}
{\bfa A story about \molecule{SF_6}} {\scx A story about \molecule{sf_6}} {\bsb A story about \molecule{SF_6}}
i didt follow this thread, so i may be wrong, but doesn't the ppchtex (see manuals) module does that kind of stuff? Hans -- ----------------------------------------------------------------- Hans Hagen | PRAGMA ADE Ridderstraat 27 | 8061 GH Hasselt | The Netherlands tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com | www.pragma-pod.nl -----------------------------------------------------------------