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.

Here's a simplified version of the code I'm having trouble with.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{center}\underline{First set of identities.}\end{center}
\[x+x = x\]

\begin{center}\underline{Second set.}\end{center} \begin{gather*}
    0+x = x, \quad x+0 = 0 \\
    (x+y)+z = x+(y+z)
\end{gather*}
\end{document}

Basically, the gather* command is creating more space than the usual [\ \]. Why is gather* doing this, and what can we do about it?

share|improve this question

3 Answers 3

up vote 1 down vote accepted

It's the center environment not playing well with gather*:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{center}
    \underline{First set of identities.}
    \[x+x = x\]
\end{center}%
\begin{center}
    \underline{Second set.}
    \begin{gather*}
        0+x = x, \quad x+0 = 0 \\
        (x+y)+z = x+(y+z)
    \end{gather*}
\end{center}
\end{document}

Alternatively, since there seem to be a duplication of skips, you can do an \unskip after the problematic center environment:

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{center}
    \underline{First set of identities.}
\end{center}%
    \[x+x = x\]
\begin{center}
    \underline{Second set.}
\end{center}\unskip
    \begin{gather*}
        0+x = x, \quad x+0 = 0 \\
        (x+y)+z = x+(y+z)
    \end{gather*}
\end{document}
share|improve this answer

I'll present two possible solutions.

  1. Don't close the center environment

  2. “Abuse” the gather* environment

At the top is the rendering with your input. Note that I removed underlining, which is frowned upon by typographers. Instead of \textbf you can also use \textit.

\documentclass{article}
\usepackage{amsmath}
\begin{document}
\begin{center}\underline{First set of identities.}\end{center}
\[x+x = x\]

\begin{center}\underline{Second set.}\end{center} \begin{gather*}
    0+x = x, \quad x+0 = 0 \\
    (x+y)+z = x+(y+z)
\end{gather*}

\bigskip
\hrule
\bigskip

\begin{center}\textbf{First set of identities.}
\[x+x = x\]
\textbf{Second set.}
\begin{gather*}
    0+x = x, \quad x+0 = 0 \\
    (x+y)+z = x+(y+z)
\end{gather*}
\end{center}

\bigskip
\hrule
\bigskip

\begin{gather*}
\textbf{First set of identities.}\\
x+x = x \\[2ex]
\textbf{Second set.}\\
0+x = x, \quad x+0 = 0 \\
(x+y)+z = x+(y+z)
\end{gather*}
\end{document}

enter image description here

share|improve this answer

You can load the nccmath package. I tried, thinking of using its \useshortskip command and discovered that just loading it works. Note that it loads amsmath, so that you can load it instead of amsmath. It doesn't load mathtools (recommended extension of amsmath), though:

\documentclass{article}

\usepackage{mathtools}
\usepackage{nccmath}

\begin{document}
\begin{center}\underline{First set of identities.}\end{center}
\[x+x = x\]

\begin{center}\underline{Second set.}\end{center} %
\begin{gather*}
    0+x = x, \quad x+0 = 0 \\
    (x+y)+z = x+(y+z)
\end{gather*}

\end{document}

enter image description here

share|improve this answer
    
Interesting. So it seems that the amsmath gather command has a bug. –  goblin Jun 27 at 10:49
    
It's not the first one since mathtools, by default, fixes two bugs of amsmath. Note that nccmath also has problems under certain circumstances that I don't remember at the moment (never met those problems myself). –  Bernard Jun 27 at 11:23

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.