4

When I enclose text with line breaks within a center environment, there is extra space after the first line, but only if the font size has been changed.

The following working example prints the same block of text with line breaks four times, covering all combinations of whether the center environment \Large are used. Only when both center and \Large are used does it produce incorrect line spacing:

\documentclass{article}

\begin{document}

\newcommand{\mytext}{First Line \\ Second Line \\ Third Line \\}

First Line \\ Second Line \\ Third Line

{\Large First Line \\ Second Line \\ Third Line}

\begin{center} 
  First Line \\ Second Line \\ Third Line

  {\Large First Line \\ Second Line \\ Third Line}
\end{center}

\end{document}

Any thoughts on what's going on to produce this unexpected behavior?

1 Answer 1

8

Whenever you have a font size change, ensure that the end of paragraph (\par or a blank line or the end of a display environment) is in the scope of the larger font. Tex uses the settings at the end of the paragraph for the whole paragraph, so you have larger text set on a normalsize baseline. the definition of \\ used in center uses \par internally so in fact you get large (correct) spacing for all but the last line in that case. the markup should be:

\documentclass{article}

\begin{document}

\newcommand{\mytext}{First Line \\ Second Line \\ Third Line \\}

First Line \\ Second Line \\ Third Line

{\Large First Line \\ Second Line \\ Third Line\par}

\begin{center} 
  First Line \\ Second Line \\ Third Line

  \Large First Line \\ Second Line \\ Third Line
\end{center}

\end{document}

You must log in to answer this question.

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