The chemmacros bundle

Now that the chemmacros bundle is out for a little while and the first bugs are fixed I’d like to give a brief overview of the new features.

I’ll focus on the »chemformula« part first. This package is an alternative approach for the creation of chemical formulæ and reactions to mhchem. I wrote it focussing on two things:

  1. better integration with the »chemmacros« part
  2. flexibility on the user side

The first point is mostly one behind the scenes but not entirely. More on that later.

Let’s see a first example:

\ch{H+ + OH- <=>> H2O}


This seems pretty familiar. But the flexibility thing shows the differences. chemmacros’ options are fully recognized:

\chemsetup[option]{circled=all}
\ch{H+ + OH- <=>> H2O
}


And you have some possibilities to customize the arrow:

\chemsetup[chemformula]{arrow-offset=2.5ex,arrow-ratio=.3}
\ch{H+ + OH- <=>> H2O
}

Besides from lots of other customization possibilities (adjustment of sub- and superscripts, extra font, fraction types, adjustment of spacing…) there are more arrow types like

\ch{A -/> B} \ch{A <o> B}


and a command which lets you define own arrow types:

\DeclareChemArrow{.>}{\draw[-cf,dotted,red] (cf_arrow_start) -- (cf_arrow_end);}
\DeclareChemArrow{n>}{\draw[-cf] (cf_arrow_start) .. controls ([yshift=3ex]cf_arrow_mid) .. (cf_arrow_end);}
\DeclareChemArrow{==}{
  \draw ([yshift=.2ex]cf_arrow_mid_start) -- ([yshift=.2ex]cf_arrow_mid_end);
  \draw ([yshift=-.2ex]cf_arrow_mid_start) -- ([yshift=-.2ex]cf_arrow_mid_end);
}
\ch{A .> B} \ch{A .>[a][b] B} \ch{A n> B} \ch{A == B
}

There have also been some changes to the »chemmacros« part. This part is the original package which provides a bunch of macros to make the typesetting easier. What’s new is this, basically:

  • better IUPAC naming support
  • easier particle macros customization and definition
  • IUPAC compliant states of aggregation
  • some additional macros like \listofreactions
  • and so on

The first three points have similar user commands:

\DeclareChemIUPAC{<cmd>}{<definition>}
\DeclareChemParticle{<cmd>}{<definition>}
\DeclareChemPhase{<cmd>}{<definition>
}

With each of these commands macros are defined which obey global package options. The naming commands for instance can be restricted to be defined only inside \iupac{}. This allows general macro names like \R or \D without overwriting essential document commands.

The particles defined via \DeclareChemParticle behave like the predifined particles and are consistent with »chemformula« formulæ.

Similar things are true for \DeclareChemPhase.

Let’s take a look at some examples:

\documentclass{article}
\usepackage{chemmacros,textgreek}

\DeclareChemParticle\sulfate{SO4^2-}
\DeclareChemParticle\positron{\textbeta+}
\DeclareChemIUPAC\hapto{\texteta}
\DeclareChemPhase\aqi{aq,$\infty$}

\begin{document}

\sulfate\ \positron

Ferrocene = \iupac{bis(\hapto\^5\-cyclo\|penta\|dienyl)iron}

NaOH\aqi

\chemsetup[phases]{pos=sub}NaOH\aqi
\end{document
}

The third part is a package which let’s you insert GHS statements and pictograms.

\documentclass{article}
\usepackage{chemmacros}
\begin{document}
\ghs{h}{203}

\ghs{p}{331}

\ghspic{acid}
\end{document
}

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>