5

As you can see in the example below, the itemize environment is the same whether or not there is a line break before the \begin{itemize}. However, the align environment has significantly more space if one puts in a line break. First, why is this the case? Second, is there a way to make the align environment behave like itemize -- or is there an alternative package to align with the same functionality that I could use?

\documentclass{article}
\usepackage{amsmath}

\begin{document}
Here are some items without a line break:
\begin{itemize}
\item A
\item B
\item C
\end{itemize}

Here are some items with a line break:

\begin{itemize}
\item A
\item B
\item C
\end{itemize}

Here is an equation without a line break:
\begin{align}
X = 2
\end{align}

Here is an equation with a line break

\begin{align}
X = 2
\end{align}

\end{document}

enter image description here

jII
  • 497

2 Answers2

4

Your assumption is incorrect: itemize does behave differently if preceded by a blank line. Here's a proof:

\documentclass{article}
\usepackage{amsmath}

\setlength{\partopsep}{40pt} % very large value to emphasize the effect

\begin{document}
Here are some items without a line break:
\begin{itemize}
\item A
\item B
\item C
\end{itemize}

Here are some items with a line break:

\begin{itemize}
\item A
\item B
\item C
\end{itemize}

Here is an equation without a line break:
\begin{align}
X = 2
\end{align}

Here is an equation with a line break

\begin{align}
X = 2
\end{align}

\end{document}

The effect is emphasized by giving a very large value to \partopsep, which is the parameter storing the amount of vertical space that's added to \topsep before and after a list environment (itemize, enumerate or description). Its default value in the standard classes is 2pt plus 1pt minus 1pt, so quite small but noticeable.

On the other hand, LaTeX and amsmath start from the assumption that a math display should never start a paragraph. It's a consequence of the implementation that doing so adds an empty line.

enter image description here

egreg
  • 1,121,712
0

(Too long for a comment, hence posted as an answer. Please do not up-vote.)

Your assertion that

the itemize environment is the same whether or not there is a line break before the \begin{itemize}

isn't quite correct, as the following example demonstrates. It uses a two-column document layout. Observe that the two \hrules don't quite line up. (Incidentally, I interpreted your term "line break" as "blank line".)

enter image description here

The difference is quite obviously not as glaring as with the align case, but it's definitely non-zero.

It's also worth noting that the two \hrules do line up perfectly if the line that precedes the itemize environment is terminated with an explicit \par statement.

\documentclass[twocolumn]{article}
\setlength\parindent{0pt}

\begin{document}
\verb+itemize+ environment not preceded by a blank line
\begin{itemize}
\item A
\item B
\item C
\end{itemize}
\hrule

\newpage% force a column break
\verb+itemize+ environment preceded by a blank line

\begin{itemize}
\item A
\item B
\item C
\end{itemize}
\hrule
\end{document}
Mico
  • 506,678
  • 5
    good demonstration. to note the obvious, a blank line is interpreted by latex as \par, so it's no surprise that those behave identically. – barbara beeton Jul 02 '16 at 17:04