1

MWE:

\documentclass{article}

\usepackage{amsmath}
\usepackage[onehalfspacing]{setspace}

\usepackage{lipsum}
\setlength{\lineskip}{2em}

\begin{document}

\lipsum[2]
\begin{equation*}
    a + b + \frac{1}{2}
\end{equation*}
\lipsum[2]

\end{document}

The output:

enter image description here

The spacing before and after the equation is inconsistent.

6
  • setting \lineskip is a rather odd thing to do in a document, what is the intention of \setlength{\lineskip}{2em} ? \lineskip is only used in error recovery situations where normal baseline spacing can not be achieved and it is normally very small. Aug 10, 2022 at 14:26
  • @DavidCarlisle In my document I'd like to have larger space around equations when, for example, large operators are typed. Here setting it to 2em is just for illustration.
    – Siwei Feng
    Aug 10, 2022 at 14:33
  • but \lineskip is an "emergency" setting: you are saying if you have an inline fraction that makes a line slightly taller than the baseline space, add an additional 2em (!!!!) between lines of the paragraph just before the tall entry, leavig other lines in the paragraph with standard space. Aug 10, 2022 at 14:37
  • did you intend to set \abovedisplayskip ? I have used latex for over 30 years and don't think I have ever set \lineskip in a document. Aug 10, 2022 at 14:41
  • @DavidCarlisle My intention was indeed to set \lineskip. I think the default \abovedisplayskip is too large when the equation is of low height, so I decreased \abovedisplayskip. Then I found the space is not large enough when there are big symbols in the equation, so I decided to change \lineskip. Here 2em is just for emphasizing the inconsistency before and after the equation. However as you said this is not a good practice so I will not change this.
    – Siwei Feng
    Aug 10, 2022 at 16:06

1 Answer 1

1

enter image description here

You almost certainly want to set the display skips not \lineskip, and you need to delay the settings until after setspace settings.

\documentclass{article}

\usepackage{amsmath}
\usepackage[onehalfspacing]{setspace}

\usepackage{lipsum}
% No!!!\setlength{\lineskip}{2em}

\AtBeginDocument{
\setlength{\abovedisplayskip}{2em plus .2em minus .2em}
\setlength{\abovedisplayshortskip}{1em plus .2em minus .2em}
\setlength{\belowdisplayskip}{2em plus .2em minus .2em}
\setlength{\belowdisplayshortskip}{1.5em plus .2em minus .2em}
}
\begin{document}

\lipsum[2]
\begin{equation*}
    a + b + \frac{1}{2}
\end{equation*}
\lipsum[2]

\end{document}

\lineskip is not directly related to equations and setting it makes a line that is slightly too big suddenly generate massive space, see the example below.

enter image description here

\documentclass{article}

\begin{document}


One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One {\large \^X}xxx 
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.

\bigskip\hrule\bigskip
\setlength\lineskip{2em}

One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One {\large \^X}xxx 
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.
One two three four five six seven eight.

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .