From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/38239 Path: news.gmane.org!not-for-mail From: "Mojca Miklavec" Newsgroups: gmane.comp.tex.context Subject: Re: Chemistry in lists Date: Mon, 24 Dec 2007 00:06:16 +0100 Message-ID: <6faad9f00712231506o15617410h9c43d83a28b6cf7a@mail.gmail.com> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1198451313 25362 80.91.229.12 (23 Dec 2007 23:08:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 23 Dec 2007 23:08:33 +0000 (UTC) To: "mailing list for ConTeXt users" Original-X-From: ntg-context-bounces@ntg.nl Mon Dec 24 00:08:44 2007 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from ronja.vet.uu.nl ([131.211.172.88] helo=ronja.ntg.nl) by lo.gmane.org with esmtp (Exim 4.50) id 1J6Zw3-0001pH-TU for gctc-ntg-context-518@m.gmane.org; Mon, 24 Dec 2007 00:08:43 +0100 Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 1D4C11FB1F; Mon, 24 Dec 2007 00:07:39 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24582-02; Mon, 24 Dec 2007 00:07:00 +0100 (CET) Original-Received: from ronja.vet.uu.nl (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id 9C9F51FADF; Mon, 24 Dec 2007 00:07:00 +0100 (CET) Original-Received: from localhost (localhost [127.0.0.1]) by ronja.ntg.nl (Postfix) with ESMTP id B346F1FADF for ; Mon, 24 Dec 2007 00:06:58 +0100 (CET) Original-Received: from ronja.ntg.nl ([127.0.0.1]) by localhost (smtp.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 24685-01-5 for ; Mon, 24 Dec 2007 00:06:22 +0100 (CET) Original-Received: from rv-out-0910.google.com (rv-out-0910.google.com [209.85.198.191]) by ronja.ntg.nl (Postfix) with ESMTP id D6C641FA86 for ; Mon, 24 Dec 2007 00:06:21 +0100 (CET) Original-Received: by rv-out-0910.google.com with SMTP id k15so890807rvb.14 for ; Sun, 23 Dec 2007 15:06:16 -0800 (PST) Original-Received: by 10.142.232.20 with SMTP id e20mr1290966wfh.198.1198451176616; Sun, 23 Dec 2007 15:06:16 -0800 (PST) Original-Received: by 10.143.40.7 with HTTP; Sun, 23 Dec 2007 15:06:16 -0800 (PST) In-Reply-To: Content-Disposition: inline X-Virus-Scanned: amavisd-new at ntg.nl X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.9 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: ntg-context-bounces@ntg.nl Errors-To: ntg-context-bounces@ntg.nl X-Virus-Scanned: amavisd-new at ntg.nl Xref: news.gmane.org gmane.comp.tex.context:38239 Archived-At: On Dec 22, 2007 9:10 AM, Shen Chen wrote: > Hi all, > > > I have some chemical formulae in chapter heading and figure captions, > typeset with the chemic module. The chemic module always uses roman font as > desired. > > When I include them in table of contents and list of figures, the chemical > formulae appears in math italic font instead of roman font. See the > following code for example. Chemic Manual mentioned using \rm but it doesn't > seem to be the case. $\rm H_2O$ works fine in the list, but not > \chemical{H_2O}. Any suggestions? Thank you. > > \usemodule[chemic] > \starttext > > \writetolist[chapter]{}{ABC} > \writetolist[chapter]{}{$H_2O$} > \writetolist[chapter]{}{$\rm H_2O$} > \writetolist[chapter]{}{\chemical{H_2O}} > \completecontent > > \stoptext The code is too complex for me to be able to understand what's going on (but it seems like a problem which should be fixed, I agree). I'm using an "ugly" piece of code from the wiki instead of the module http://wiki.contextgarden.net/Chemistry (bottom of the page) when I need to typeset simple chemistry. I also needed a formula to apear in titiles and it worked really nice. Mojca % by Taco \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} \molecule{H_2O} ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : https://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________