Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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:

share|improve this question
    
Related Question: comma like \cdot which shows how to adjust the position of the comma. –  Peter Grill Mar 31 '12 at 2:23
1  
As for your second question: it shouldn't be difficult to redefine \frac (and \dfrac) to look ahead and if the next token is a comma, then gobble it and put one itself, raised a bit. But man, this is a good question. I'd upvote it twice if that were possible... –  mbork Mar 31 '12 at 2:33
    
@PeterGrill Thanks: I missed that one (I will add it to my list of related questions.): \mathpunct could be used but still requires tweaking (though 0.22em should be 0.5ex as in your solution... doh). Do you know if there is a way of increasing the default spacing provided by \mathpunct? @mbork I suspect you are right, but I worry about if there are any situations where this might cause problems (or incompatibility issues). I should probably look through the ams classes. –  mforbes Mar 31 '12 at 3:26
1  
@mforbes The third option indeed looks better, but if, for whatever reason, anyone needs a letter after the comma, it will look most ugly. Try putting it inline, for instance… So, you might need to limit the modification to environments such as equation. Perhaps a raised variant to Will Robertson's answer could be a semantic solution to your problem. –  ienissei Mar 31 '12 at 6:56
2  
I endorse proper punctuation in math displays (I usually put commas at the end of cases lines, for example), but not at all costs: if the punctuation can lead to ambiguity, some remedy has to be taken. Raising the sign is out of the question, I'd probably look for a way to avoid it or I'd put an additional thick space. –  egreg Mar 31 '12 at 9:28

1 Answer 1

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.

share|improve this answer
    
Good point about using parentheses to avoid confusion. As for context helping: probably not enough given that I was made aware of this issue by a confused, but mathematically inclined, colleague. I am still not convinced though: I think that shifting all punctuation up a bit looks better (at least with the Palatino comma). Maybe I should use the Euler comma in equations? There is no confusing that with a prime! \DeclareMathSymbol{,}{\mathpunct}{letters}{59} –  mforbes Apr 2 '12 at 4:40
    
@mforbes Lots of people including myself sometimes find some of the palatino characters unusual for example quotation marks don't look curly enough, but it grows on you. It is a great font. –  Yiannis Lazarides Apr 2 '12 at 18:15
    
I am definitely sold on the Palatino/Euler combination of the available font options for standard LaTeX. Just trying to work out a few quirks. –  mforbes Apr 4 '12 at 5:13
    
@mforbes Good please post an update with your solution when you are finished. –  Yiannis Lazarides Apr 5 '12 at 11:50

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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