[Tex/LaTex] Vertical position of punctuation following fractions in display-style equations

best practicesmath-modepunctuationtypographyvertical alignment

Assuming that one wants punctuation in equations, what is the best way to adjusting the vertical position of the punctuation if it follows a fraction? I am using Palatino and Euler here (which I generally really like). The problem is especially apparent with commas, which end up looking like primes on elements in the denominator (without a prime close by, the first equation looks an awful lot like it has a B' in the denominator):

Output of MWE showing various options.

Adding some space before the punctuation (second example) helps slightly, but still looks strange to me. It seems that, when following a fraction, the comma (and maybe the period) should be raised by a small amount (third example).

Questions

  1. What is the best typographic practice for including punctuation in these cases?
  2. Is there a robust way of doing this? I.e. one that somehow uses font information to work well in all sizes and fonts.

Obviously raising of punctuation should only occur in specific cases such as the fractions shown here. Perhaps there is a way of inserting something at the end of fractions that will trigger this behaviour, then reset it if the following text is not punctuation?

Here is the MWE I used to make the output above:

\documentclass{minimal}
\usepackage{mathpazo}                      % To get Palatino
\linespread{1.05}                          % See question 31064
\usepackage[small, euler-digits]{eulervm}  % and now Euler

\begin{document}
Here are two equations that look awfully similar:
\begin{equation}
  a = \frac{1}{A+B}, \qquad b = \frac{1}{A+B'}.
\end{equation}
\begin{equation}
  a = \frac{1}{A+B}\,, \qquad b = \frac{1}{A+B'}\,.
\end{equation}

\newcommand\raisepunct[1]{\,\mathpunct{\raisebox{0.5ex}{#1}}}
\begin{equation}
  a = \frac{1}{A+B}\raisepunct{,} 
  \qquad b = \frac{1}{A+B'}\raisepunct{.}
\end{equation}
\end{document}

Related Questions

Several questions have addressed punctuation in equations, but most discuss only whether or not to include it, or if a thin horizontal space should be included:

Best Answer

The typography as displayed by LaTeX is the correct one. A comma needs to be placed at the baseline.

If you need to make any adjustments rather place the fraction within brackets. Agreed that the comma can be mistaken as a prime, but remember that mathematics is read in context, i.e., if no primes are used on the variables it is highly unlikely that a mathematically inclined reader will mix it up.

I have checked the above with a couple of books and always the comma is as shown by LaTeX.

enter image description here

\documentclass{article}
\usepackage{amsmath}
\usepackage{mathpazo}                      % To get Palatino
\linespread{1.05}                          % See question 31064
\usepackage[small, euler-digits]{eulervm}  % and now Euler
\begin{document}
If the number of independent variable is~$n$, we must have
\[
p = - \frac{n-2}{2}, \quad \text{or} \quad -\left(\frac{n-2}{2} + 1\right), \quad -\left(\frac{n-2}{2} + 2\right),\quad \left(\frac{n-2}{2+a}\right), \quad \dots.
\]
\end{document}

Your suggestion of raising the comma can lead to other problems such as $(a,b)\frac{a}{b}, resulting in the commas not lining up.