12

The spacing I'm getting with the \prescript command from the mathtools package seems wrong. Here is a MWE:

\documentclass{article}
\usepackage{amsmath,mathtools}
\begin{document}
$\prescript{14}{2}{\mathbf{C}}^{5+}_{2}$
\end{document}

which produces this (red line added to make difference clearer):

enter image description here

I suspect it's just a problem with the command itself - if so, is there a known fix? If not, what should I be doing differently? (Of course, regardless of whose fault it is, one solution is just to use a different package for this purpose.)

13

A concise solution in this instance is presented via the tensor package:

enter image description here

$\tensor*[^{14}_2]{\mathbf{C}}{^{5+}_2}$

Not sure about the extent of your usage, but the following also corrects this in your specific case:

enter image description here

\documentclass{article}
\usepackage{mathtools,leftidx}% http://ctan.org/pkg/{mathtools,leftidx}
\begin{document}
$\prescript{14\phantom{+}}{2}{\mathbf{C}}^{5+}_{2}$ \quad
$\leftidx{^{14\vphantom{+}}_2}{\mathbf{C}}{^{5+}_2}$ \quad
$\vphantom{\mathbf{C}}^{14\vphantom{+}}_{\phantom{14}\mathllap{2}}\mathbf{C}^{5+}_2$
\end{document}

The leftidx package provides \leftidx{<left>}{<base>}{<right>} prints <base> with a left index <left> and right index <right>. However, it also suffers from the same problem by default. The alternative is to set <base> twice, first only as a \vphantom. The use of \vphantom{+} is to also improve the adjustment vertically. Horizontal alignment for the left index is achieved via \phantom{14}\mathllap{2}.

| improve this answer | |
  • BTW: which tool gives us such a thin (red) ruler? – Przemysław Scherwentke Apr 20 '13 at 1:48
  • 2
    @PrzemysławScherwentke: \par\vspace*{-0.70\baselineskip}{\color{red}\hrulefill} – Werner Apr 20 '13 at 1:58
  • Thank you! Only TeX! I thought that it is a ruler from some graphic tool. – Przemysław Scherwentke Apr 20 '13 at 2:02
3

For what it's worth: for ions like this the chemmacros package (or rather it's sub-package chemformula that in a yet to come v4.0 will be usable stand-alone but until then itself would load chemmacros) aligns all subscripts (and superscripts). It also takes care of the IUPAC recommendation for staggered sub- and superscripts (see IUPAC Green Book) which could be prevented using an option, though.

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{chemmacros}

\begin{document}

\ch{^{14}2\textbf{C}2^{5+}}

\end{document}

enter image description here

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage{chemmacros}
\chemsetup[chemformula]{charge-hshift=0pt}
\begin{document}

\ch{^{14}2\textbf{C}2^{5+}}

\end{document}

enter image description here

| improve this answer | |
  • Thanks, I appreciate the suggestion! Even though I will not be writing any chemistry expressions myself (I probably should have explained that I was only using this because it's an example presented in the mathtools documentation), it's useful to know that the chemmacros / chemformula package can be used as an alternative by setting the option you mentioned. Hopefully chemists are using these superior packages already and don't have to worry about issues with \prescript :) – Zev Chonoles Apr 20 '13 at 19:37
  • @ZevChonoles Well, I don't know about “superior” but you're right: they're specifically taylored for chemists… – cgnieder Apr 20 '13 at 22:12
  • I certainly knew that; I think whatever I was trying to say with my last sentence made much more sense in my head at the time. At any rate, thanks again :) – Zev Chonoles Apr 21 '13 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.