Is there a package that supports the addition or subtraction of chemical equations, perhaps with automatic tabbing and a alignment. Whilst it is obvious I could set up tables or use mathmode's align feature, it seems so much more efficient to have a package handle the tabbing automatically, since it is rather predictable in this application. mhchem
does not seem to have such a feature…
Another advantage is you could maintain the readability of your equations and you would not have the added clutter associated with tables, especially tabs &
, which diminish the readability of your .tex document. And of course, the line should be automatically inserted before the last row.
Best Answer
Cancellation of species
To elaborate on Canageek's answer, yes, you can use the
cancel
package withmhchem
, however it's a bit tricky. Specifically, using cancel inside the\ce{}
environment will break the automagic formatting ofmhchem
, turning your species italic.There are two ways around this:
You can wrap your species in
\mathrm
and then wrap that in\cancel{}
(the easiest way)You can break your equation into multiple
\ce{}
environments, and place the relevant species in$\cancel{}$
(\cancel{}
is supposed to be used in mathmode). This is not a good solution as it makes your equation discontiguous and messes up spacing.which means that you need to wrap each cancelled species in its own
\ce{}
and then place that inside a\cancel{}
.Here's what each option looks like:
Here's the code (please excuse the non-mwe nature of the code)
As you can see, this diminishes readability profoundly :(
You can change the colour of the cancellation line via
\renewcommand{\CancelColor}
, which is a bit of a pain.Alignment
I was not sure if your reference to align in mathmode meant that you were using mathmode in
align
to manually set chemical equations, rather thanmhchem
, butmhchem
has the\cee
environment, which acts like a the\ce
environment but allows you to use&
as an alignment point in analign
environment. It seems fairly simple.Putting it all together:
With the following code:
Getting the
\hline
to a more sensible length and adjusting the spacing between formulae is left as an exercise to the interested reader (I don't know, but someone else probably does. It's a start.)Hope this is of some use.