2

This question is related to this one:

I have this code:

\documentclass[11pt]{article}
\pagestyle{empty}

\usepackage{blindtext}

\renewcommand{\baselinestretch}{1.1}
\usepackage{amsmath}

\makeatletter
\def\newmaketag{%
  \def\maketag@@@##1{\hbox{\m@th\normalfont\normalsize##1}}%
  }
\makeatother

\begin{document}
\flushbottom
\section{Section}

\blindtext
{\small%
\newmaketag\begin{equation}
\frac{2 x_{1} + 2 x_{2} + 2 x_{3} + 2 x_{4} + 2 x_{5} + 2 x_{6} + 2 x_{7} + 2 x_{8} + 2 x_{9} + 2 x_{10} + 2 x_{11} + 2 x_{12} + 2 x_{13} }{z}
\end{equation}}\relax

\end{document}

As you can see in the screenshot:

enter image description here

the baselinestretch of the last line of the paragraph above the equation is wrong. How can I fix it?

Note. Please, please, really please! Don't waste your time (and mine) telling me I shouldn't use \small to resize an equation (or suggesting me others techniques to resize equations). I do have my own reasons to do that (in some cases).

  • 1
    As I see it, there is nothing wrong. It just seems that way, because for a few centimeters there are only low height letters (the height of an x, no l, f, i or similar) in the last line and no letters with parts going below the baseline (like p or g) in the line above. If you enlarge it in a pdf viewer and measure it, you'll see that the baselines all have the same distance. – Mike Jul 23 '17 at 16:53
  • if the font size of a display is made smaller, the baselines in the preceding paragraph can be affected as well, but all baselines in that paragraph will be affected, not just the last one. what you have here is an optical illusion, correctly explained by @Mike. – barbara beeton Jul 23 '17 at 17:45
  • @egreg I think this is not a duplicate. This topic is the part of another articulated question that has not been answered. So I decided to isolate it. – Gabriele Nicolardi Jul 23 '17 at 18:53
  • @barbarabeeton This is not an optical illusion (as egreg showed in his answer). It's strange to me that you said that, because in a related post you said "I do have a workaround for the baselines..." and in this question I adopt the solution you proposed. – Gabriele Nicolardi Jul 23 '17 at 19:00
  • you didn't read what i said. i said that if the baselines are affected, it affects the whole paragraph, not just the space between the last two lines. that is what was implied by the example shown in your question i will have to look back at the answer i proposed to see where i went wrong. however the answer given by @egreg does give a robust and dependable solution. – barbara beeton Jul 23 '17 at 19:45
3

The reason should be clear: when a math display is started, TeX typesets the paragraph so far and this happens when the \small declaration has already been executed, so the baseline skip is the one pertaining to \small. Since all you want is to typeset the formula in \small size, do it in a box.

Here's my suggestion (I used \footnotesize in order to magnify the effect):

\documentclass[11pt]{article}
\usepackage{amsmath}

\usepackage{lipsum}

\makeatletter
\def\newmaketag{%
  \def\maketag@@@##1{\hbox{\m@th\normalfont\normalsize##1}}%
  }
\makeatother

\begin{document}

\section{Section}

\lipsum*[1]
{\footnotesize\newmaketag
\begin{equation}
  \frac{2 x_{1} + 2 x_{2} + 2 x_{3} + 2 x_{4} + 2 x_{5}
        + 2 x_{6} + 2 x_{7} + 2 x_{8} + 2 x_{9} + 2 x_{10}
        + 2 x_{11} + 2 x_{12} + 2 x_{13} }
       {z}
\end{equation}}
\lipsum*[1]
\begin{equation}
\mbox{\footnotesize$\displaystyle
  \frac{2 x_{1} + 2 x_{2} + 2 x_{3} + 2 x_{4} + 2 x_{5}
        + 2 x_{6} + 2 x_{7} + 2 x_{8} + 2 x_{9} + 2 x_{10}
        + 2 x_{11} + 2 x_{12} + 2 x_{13} }
       {z}
$}
\end{equation}

\end{document}

enter image description here

If you love living dangerously, here's how you can do with alignment displays:

\documentclass[11pt]{article}
\usepackage{amsmath}

\usepackage{lipsum}

\makeatletter
\newenvironment{smalleralign}[1][\small]
 {\par\nopagebreak\leavevmode\vspace*{-\baselineskip}%
  \skip0=\abovedisplayskip
  #1%
  \def\maketag@@@##1{\hbox{\m@th\normalfont\normalsize##1}}%
  \abovedisplayskip=\skip0
  \align}
 {\endalign\ignorespacesafterend}
\makeatother

\begin{document}

\section{Section}

\lipsum*[1]
\begin{smalleralign}[\footnotesize]
  a+b+c&=aaaaaaa+bbbbbbbbb+ccccccccc+ddddddddd \\
  a+b+c&=aaaaaaa+bbbbbbbbb+ccccccccc+ddddddddd \\
  a+b+c&=aaaaaaa+bbbbbbbbb+ccccccccc+ddddddddd \\
  a+b+c&=aaaaaaa+bbbbbbbbb+ccccccccc+ddddddddd
\end{smalleralign}
\lipsum*[1]

\end{document}

picture

  • Ok, my foult... Your answer is correct (and I will use it) but I'm yet waiting for a solution that works with long aligned equations. Thank you very much (but not for your "duplicate" comment ;-) ). – Gabriele Nicolardi Jul 23 '17 at 19:11
  • @GabrieleNicolardi I added some other code. But the usual warning applies: this is as ugly as it could be. – egreg Jul 23 '17 at 19:20
  • You missed a % or a \relax after \end{align}}... ;-) I know you don't like it but this is not my choice. I have guidelines to follow. – Gabriele Nicolardi Jul 23 '17 at 19:25
  • @GabrieleNicolardi Fixed, with less barbaric code. I understand your position, but cannot justify it. ;-) – egreg Jul 23 '17 at 19:31
  • nice. equation numbers (which remain the "default" size) can be referenced reliably with \label and \eqref; that's something i wasn't sure about without testing. you might want to add an example of that to your example. – barbara beeton Jul 23 '17 at 19:43
1

I would like to expand on Zarko's deleted answer: you have a solution with nccmath, which has not only an \mfrac command, but a whole bunch of similar commands and environments (\mbinom, \mint, \medint, \medop, mmatrix, and more globally, \medmat and medsize).

Another solution, more specific to the present formula, is the \splitfrac from mathtools, combined with fleqn environment, from nccmath again, which to have a group of equations to be left-aligned.

Demo:

\documentclass[11pt]{article}
\pagestyle{empty}

\usepackage{blindtext}

\renewcommand{\baselinestretch}{1.1}
\usepackage{amsmath}

\makeatletter
\def\newmaketag{%
  \def\maketag@@@##1{\hbox{\m@th\normalfont\normalsize##1}}%
  }
\makeatother

\begin{document}
\flushbottom
\section{Section}

\blindtext
{\small%
\newmaketag\begin{equation}
\frac{2 x_{1} + 2 x_{2} + 2 x_{3} + 2 x_{4} + 2 x_{5} + 2 x_{6} + 2 x_{7} + 2 x_{8} + 2 x_{9} + 2 x_{10} + 2 x_{11} + 2 x_{12} + 2 x_{13} }{z}
\end{equation}}\relax

\end{document}

enter image description here

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.