4

I want to have a title for frontpage and control the line break manually. When I add \\ to bring new line, I get extra space between first and second line, but second and last line seems to be fine. Why this happens and how can I fix it?

\documentclass[12pt,twoside,a4paper]{book}
\usepackage{setspace}
\begin{document}
\begin{center}
  \onehalfspacing
  \thispagestyle{empty}

\textsf{\LARGE{what is going on\\why this linespacing?\\why vertical space is so screwed?}}

\end{center}
\end{document}

enter image description here

8
  • 4
    You need to end the paragraph before switching back to normalsize. Use \Large\sffamily .... (assuming that you are in a center environment). Commented May 18, 2023 at 8:27
  • 1
    also you should remove the {...} after \LARGE size commands do not take an argument Commented May 18, 2023 at 10:19
  • I am actually unable to replicate the problem behavior you've encountered when using the article document class and an up-to-date TeX distribution. Do please tell us which document class you employ, which TeX distribution you use, and when you last updated your TeX distribution.
    – Mico
    Commented May 18, 2023 at 11:20
  • Please, make a small example from \documentclass to \end{document} that shows how you're producing the front page. It will be easier to debug and also to give further advice.
    – egreg
    Commented May 18, 2023 at 12:55
  • @Mico Thanks, I added the reproduceable code
    – Dumbo
    Commented May 18, 2023 at 14:43

3 Answers 3

4

You asked: What is going on, why this linespacing? An answer is here.

Your code is

\textsf{\LARGE{what is going on\\why this linespacing?\\why vertical space is so screwed?}}

The LaTeX macro \textsf{parameter} opens TeX group, selects required font and typesets parameter. Then it closes TeX group.

The LaTeX macro \LARGE selects required font and sets bigger value to the \baselineskip register. Then you have { which opens second TeX group, then you have text and then the second TeX group is closed by }. If you remove this irrelevant braces pair the result is the same:

\textsf{\LARGE what is going on\\why this linespacing?\\why vertical space is so screwed?}

Now, why this linespacing? The LaTeX macro \\ runs \par TeX primitive in this context. So, your example is equivalent to:

\textsf{\LARGE what is going on\endgraf why this linespacing?\endgraf why vertical space is so screwed?}

The first \endgraf (i.e. \par) creates one-line paragraph. The second \endgraf creates second one line paragraph and when it is distributed to the main vertical list, the \baselineskip register has bigger value due to \LARGE macro. So, these two paragraphs are with bigger line-skip between them.

Next: the third paragraph why vertical ... is opened, i.e. the horizontal mode is opened. Then the parameter of \textsf is finalized and the \textsf macro closes TeX group. This means that \baselineskip returns to its previous smaller value which was valid when \textsf macro started. Then the empty line after mentioned code is scanned by token-processor and it creates \par here. This \par finalizes the third paragraph and it is concatenated to previous two to the vertical list, but \baselineskip is smaller now, so there is smaller interline-skip.

2

You're missing a trailing \\, but there are better ways to accomplish your task.

\documentclass[12pt,twoside,a4paper]{book}

\begin{document}

% set up the front page
\thispagestyle{empty}

%the author
\begin{center}
\sffamily\large

Dumbo

\end{center}

\addvspace{5cm}

\begin{center}
\linespread{1.25} % or \onehalfspacing if you're using setspace
\sffamily\LARGE

what is going on\\
why this linespacing?\\
why vertical space is so screwed?

\end{center}

\end{document}

enter image description here

1

Your code should be as:

\documentclass[12pt,twoside,a4paper]{book}
\usepackage{setspace}
\begin{document}
\begin{center}
  \onehalfspacing
  \thispagestyle{empty}

\LARGE{
\textsf{what is going on\\why this linespacing?\\why vertical
space is so screwed?}\par}

\end{center}
\end{document}

enter image description here

2
  • 3
    Why the brace after \LARGE? It's a declaration that doesn't take an argument.
    – egreg
    Commented May 18, 2023 at 15:12
  • 3
    Better place the { before \LARGE so as to avoid that it also changes text coming afterwards. Commented May 18, 2023 at 15:48

You must log in to answer this question.

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