23 Feb
2009
23 Feb
'09
4:52 p.m.
Am 23.02.2009 um 17:21 schrieb Mojca Miklavec:
Hello,
I did not try to analyze how the following macros work (they are too complex), but they somehow fail in mkiv. (I don't need the "F" kerning, so that portion of code may go away, but the macro itself is very very handy.)
All I want is to have a macro that "converts" _{...} into \low{...} and ^{...} into \high{...} (or possibly enable using both at the same time).
\startluacode thirddata = thirddata or { } function thirddata.molecule(text) text = string.gsub(text,"_","\\low") text = string.gsub(text,"%^","\\high") tex.sprint(text) end \stopluacode \def\molecule#1{\ctxlua{thirddata.molecule('#1')}} \starttext \molecule{H_2SO_4} \molecule{H_2^+} \stoptext Wolfgang