On Fri, Feb 22, 2008 at 9:23 AM, Peter Münster wrote:
On Thu, Feb 21 2008, Mojca Miklavec wrote:
On Thu, Feb 21, 2008 at 11:23 PM, Peter Münster wrote:
The following test-file produces an error:
% engine=luatex \usemodule[chemic] \starttext \chemical{CO_2} \stoptext
The issue probably needs to be solved, but I happily use Taco's macro for that purpose (works better in titles). See \molecule on http://wiki.contextgarden.net/Chemistry.
Hello Mojca,
did you try it? Here, I get this error:
I didn't claim that it works in mkiv, I still mostly use mkii (except for non-trivial documents).
! LuaTeX error ...TeX-live/texmf-context/tex/context/base/syst-con.lua:21: bad argument #1 to 'char' (invalid value). \rawcharacter ...verters.rawcharacter(\number #1)}
<to be read again> ...awcharacter {\recurselevel } } \@@ar@@1 ...hchem \rawcharacter {\recurselevel }}}
\redostepwiserecurse ->\expandrecursecontent \dodostepwiserecurse <to be read again> { <inserted text> 66 ... l.39 \molecule {HSO_4^{-}} ?
Interesting - here it works, but \molecule{A_2} only produces lowered 2, while A is lost. ConTeXt ver: 2008.02.13 23:49 MKIV fmt: 2008.2.19 int: english/english This is LuaTeX, Version snapshot-0.22.0-2008021722 Mojca ---------- \newbox\chemlowbox \def\chemlow#1% {\setbox\chemlowbox\hbox{{\switchtobodyfont[small]#1}}} \def\chemhigh#1% {\ifvoid\chemlowbox \high{{\switchtobodyfont[small]#1}}% \else \/\lohi{\box\chemlowbox}{{\switchtobodyfont[small]#1}}\fi } \def\finishchem% {\ifvoid\chemlowbox \else \iffluor \fluorfalse \kern-.1em \fi\low{\box\chemlowbox}\fi} % for "kerning" after F \newif\iffluor \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}}}}% \uccode `\~=`\F \uppercase{\def~{\finishchem F\fluortrue}}% \catcode`\-=\active \uccode`\~=`\- \uppercase{\def~{--}}% \loggingall \domolecule }% \def\domolecule#1% {\expandafter\scantokens\expandafter {\detokenize{#1\finishchem}}\egroup} \starttext \molecule{CO_2}\molecule{HSO_4^{-}} \stoptext