3

Here's a minimal LaTeX code showing my troubles:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage{amsmath}
%\setlength{\jot}{\baselineskip}

\begin{document}

Blabla:
    \begin{gather}
        x^2 - \frac{1}{2} \, x = 3, \\
        \frac{a^2}{b^3} \, y + 2 x \, y = y^2, \\
        a - b = c.      
    \end{gather}
Bla:
    \begin{gather}
        x^2 - \frac{1}{2} \, x = 3, \\[11pt]
        \frac{a^2}{b^3} \, y + 2 x \, y = y^2, \\[11pt]
        a - b = c.      
    \end{gather}
Blabla:
    \begin{gather}
        x^2 - \frac{1}{2} \, x = 3, \\[1ex]
        \frac{a^2}{b^3} \, y + 2 x \, y = y^2, \\[1ex]
        a - b = c.      
    \end{gather}

\end{document}

Here's a preview of what that code is doing. I've shown in red what I dislike:

enter image description here

As you can see from the equation numbers on this preview, the vertical spacing is variable, and I hate that! The global display is really ugly!!

I would like to define some small macros to replace \\ and \\[11pt] and the likes to something that would adjust with the font size (11pt here), and that makes the vertical spacing between the equal sign to be the same. I don't want LaTeX to make variable vertical spacings between equations. Is that possible?

To solve the issue before, I was using some dirty hack: smash all the offending fractions and summation signs in equations and use \\[11pt], or \\[22pt] to adjust the spacing according to the equations. Or I could add a vphantom{\frac{}{}} of some fraction to get something similar to the other equations. This is certainly not a good way of doing things in LaTeX!

Cham
  • 2,304
  • This is a good question. It taught me a problem I didn't know I had, but now I cannot unsee it and it does not let me sleep at night. I hope someone provides an answer. – brunosalcedo Apr 11 '20 at 16:36
  • If you dislike the fact that the = signs aren't aligned, you should be using align rather than gather. – barbara beeton Jun 05 '22 at 14:35

1 Answers1

2

Using the medium-sized fractions from nccmath for fractional numeric coefficients (~80% of \displaystyle size), combined with \addlinespace from booktabs at the relevant places results in a spacing difference of only 1pt, which is acceptable:

\documentclass[11pt,letterpaper,twoside]{book}
\usepackage{lmodern}
\usepackage{nccmath, amsmath}
\usepackage{booktabs}

\begin{document}

    Blabla:
    \begin{gather}
        x^2 - \mfrac{1}{2} \, x = 3, \\
        \frac{a^2}{b^3} \, y + 2 x \, y = y^2, \\
    \addlinespace
        a - b = c.
    \end{gather}

\end{document} 

enter image description here

Bernard
  • 271,350
  • Is there another way? This imply to use the commands depending on the equations to be displayed, a bit like the hack I was using before. Is there a way to fix the vertical spacing by using something else than \ ? – Cham Nov 30 '19 at 21:29
  • Also, the first fraction (1/2) is just an example here. It could be a derivative or a fraction with symbols. The spacing would then be different. – Cham Nov 30 '19 at 21:34
  • You can try the spreadlines environment from mathtools which changes locally the value of jot. The spacings between the equation numbers won't be equal, but to the eye, it will be more acceptable. I think there can be no general solution, as it's a matter of appreciation from the eye, and two groups of equations will not have the same optical effect. I any case, I recommend the use of \mfrac for numerical fractions, it will help. – Bernard Nov 30 '19 at 21:45
  • For your other comment, yes, but the problem from the typographical -psychological point of view is different in my opinion: the reader tends to think that numerical coefficients do not have the same importance than fractions which could be formulæ on their own, and will find differences between spacings uglier in the first case than in the latter case. – Bernard Nov 30 '19 at 21:52
  • So you say there's no way to fix the vertical spacing in the gather and align environments? – Cham Nov 30 '19 at 22:21
  • 1
    It is fixed by the value of \jot, but this does not make the spacings equal if there is a difference in the heights of the formulæ in each line. It can only make the difference acceptable to the eye (and the mind) of the reader. – Bernard Nov 30 '19 at 22:26
  • In the preamble, what code line of jot would you recommend? – Cham Nov 30 '19 at 22:28
  • 1
    I don't think it is sensible to do that for all multiline equations. It's better to do that locally for and equation or a group of equations for which it is necessary. That is what the spreadlines environment is for (it works somewhat like the subequations environment). – Bernard Nov 30 '19 at 22:35