Cancellation of species
To elaborate on Canageek's answer, yes, you can use the cancel
package with mhchem
, however it's a bit tricky. Specifically, using cancel inside the \ce{}
environment will break the automagic formatting of mhchem
, 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)
\documentclass[a4paper]{article}
\usepackage[version=3]{mhchem}
\usepackage{cmbright}
\usepackage{cancel}
\begin{document}
Standard:
\ce{HCOOH_{(aq)} + H2O_{(l)} <=> H3O^{+}_{(aq)} + HCOO^{-}_{(aq)}}\\
\texttt{$\backslash{}$cancel} inside \texttt{$\backslash{}$ce}:
\ce{\cancel{HCOOH_{(aq)}} + H2O_{(l)} <=> H3O^{+}_{(aq)} + \cancel{HCOO^{-}_{(aq)}}}\\
\texttt{$\backslash{}$mathrm} inside \texttt{$\backslash{}$cancel} inside \texttt{$\backslash{}$ce}:
\ce{\cancel{\mathrm{HCOOH_{(aq)}}} + H2O_{(l)} <=> H3O^{+}_{(aq)} + \cancel{\mathrm{HCOO^{-}_{(aq)}}}}\\
\texttt{$\backslash{}$cancel} outside \texttt{$\backslash{}$ce}:
$\cancel{\ce{HCOOH_{(aq)}}}$ \ce{+ H2O_{(l)} <=> H3O^{+}_{(aq)} +} $\cancel{\ce{HCOO^{-}_{(aq)}}}$
\end{document}
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 than mhchem
, but mhchem
has the \cee
environment, which acts like a the \ce
environment but allows you to use &
as an alignment point in an align
environment. It seems fairly simple.
Putting it all together:
With the following code:
\documentclass[a4paper]{article}
\usepackage[version=3]{mhchem}
\usepackage{cmbright}
\usepackage{cancel}
\begin{document}
\begin{align*}
\centering
\cee{\cancel{\mathrm{HCOOH_{(aq)}}} + H2O_{(l)} &<=> H3O^{+}_{(aq)} + \cancel{\mathrm{HCOO^{-}_{(aq)}}}}\\
\cee{\cancel{\mathrm{HCOO^{-}_{(aq)}}} + H2O_{(l)} &<=> \cancel{\mathrm{HCOOH_{(aq)}}} + OH^{-}_{(aq)}}\\
\hline{}
\cee{H2O_{(l)} + H2O_{(l)} &<=> H3O^{+} + OH^{-}_{(aq)}}
\end{align*}
\end{document}
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.
Wouldn't it be easier to use a chemistry package like mhchem
(together with the already proposed amsmath
) instead of tensor
? mhchem
's \ce
macro is defined especially for use in alignment environments like {align}
.
For text between aligned equations one can use amsmath
's \intertext{}
.
\documentclass{book}
\usepackage[version=4]{mhchem}
\usepackage{amsmath}
\begin{document}
\begin{align*}
\ce{^{14}_7N + n &-> ^{11}_5B + ^4_2H}
\intertext{Some text in between that is not aligned or anything.}
\ce{
^{14}_7N + n &-> ^{12}_6C + ^3_1H \\
^{16}_8O + n &-> ^{10}_4Be + ^7_4Be
}
\end{align*}
\end{document}
Edit: In order to get the first equation numbered but not the second and third you have basically two options:
- Use
{align}
(without the star!) and suppress the numbers of the second and third equation via \notag
or \nonumber
.
- Use
{align*}
and add the number for the first manually by saying \tag{\refstepcounter{equation}\theequation}
Personally I prefer the first variant. BTW: if you haven't read it yet you might want to have a look at “Math Mode” by Herbert Voß.
\documentclass{book}
\usepackage[version=4]{mhchem}
\usepackage{amsmath}
\begin{document}
\begin{align}
\ce{^{14}_7N + n &-> ^{11}_5B + ^4_2H}
\intertext{Some text in between that is not aligned or anything.}
\ce{
^{14}_7N + n &-> ^{12}_6C + ^3_1H \nonumber \\
^{16}_8O + n &-> ^{10}_4Be + ^7_4Be \notag
}
\end{align}
\begin{align*}
\ce{
^{14}_7N + n &-> ^{11}_5B + ^4_2H \tag{\refstepcounter{equation}\theequation}
}
\intertext{Some text in between that is not aligned or anything.}
\ce{
^{14}_7N + n &-> ^{12}_6C + ^3_1H \\
^{16}_8O + n &-> ^{10}_4Be + ^7_4Be
}
\end{align*}
\end{document}
Best Answer
You can get equal length central arrows by deciding which one is the widest:
With another trick you can center the header above the arrows:
I insert the text in the column with the arrows, but inside
\makebox[0pt]{...}
which makes the text occupy no width (from the point of view of TeX) and stick on either side of this zero width box. Of course this can work only because the neighboring columns are wide enough.