From ConTeXt wiki
Jump to: navigation, search

< Math, XML, Graphics, MetaPost >

ConTeXt comes with the extensive chemistry module PPCHTeX which allows the drawing of chemical structures and the typesetting of reactions.

PPCHTeX works with plain TeX, LaTeX and - of course - with ConTeXt.

Some other PPCHTeX links:

Some other links about chemistry in ConTeXt:

Formulae with chemic module



Simple Formulae in Text Mode

An alternative to using the chemistry module or mathmode for typesetting simple formulae are the three ConTeXt commands \high, \low and \lohi. This might be useful if you want to typset the formula with the same font as the surrounding text (in titles or slanted fonts, although that might not be desired in all situations).

\ss H\low{2}O also consists of H\high{+} and OH\high{--}.
There are two main carbon isotopes: \lohi{6}{12}C and \lohi[left]{6}{13}C.

Taco's macros implement this approach [1]:


  {\ifvoid\chemlowbox \high{{\switchtobodyfont[small]#1}}%
   \else \/\lohi{\box\chemlowbox}{{\switchtobodyfont[small]#1}}\fi }

   {\ifvoid\chemlowbox \else
     \iffluor \fluorfalse \kern-.1em \fi\low{\box\chemlowbox}\fi}

% for "kerning" after F

   \catcode`\_=\active \uccode`\~=`\_ \uppercase{\let~\chemlow}%
   \catcode`\^=\active \uccode`\~=`\^ \uppercase{\let~\chemhigh}%
   \dostepwiserecurse {65}{90}{1}
      {\catcode \recurselevel = \active
   \uccode `\~=`\F \uppercase{\def~{\finishchem F\fluortrue}}%
   \catcode`\-=\active \uccode`\~=`\- \uppercase{\def~{--}}%
   \domolecule }%

\bs Bold slanted molecules: \molecule{HSO_4^-} and \molecule{SF_6}

The main difference with the official chemic module is that the \modlecule from this example uses the same font as the one in surrounding text, while the official module always uses roman font (which is probably the proper way if you're writing dozens of formulas). Hans's module is also more powerful (can do much more trickery than a simple conversion of subscripts and superscripts). See the manuals listed above.

Alternatively one can setup the style parameter used for chemical formulas manually:


Chemical structures

(see also PPCHTeX structure database)





Chemistry example1.png





chemistry example2.png

To draw this structure horizontally:


\def\RotR{\rotate[rotation=270]{\ix R}}




chemistry example3.png

An example of an amino acid: Histidine (Ace-His-Nme). The rest of the amino acids are shown in TT4Sci


\chemical[PB:Z2,ONE,SB37,Z03,PE][\SL{C^{\alpha}},H^{\alpha 1}]



Personal tools
External Help