1

AFAIK, line-breaking around \begin{document}, \end{document}, or \begin{section} doesn't change the results as follows.

\documentclass{article}
                        % INSERTING OR DELETING THIS LINE DOESN'T AFFECT THE OUTCOME
\begin{document}
                        % INSERTING OR DELETING THIS LINE DOESN'T AFFECT THE OUTCOME
Hello, world!
                        % INSERTING OR DELETING THIS LINE DOESN'T AFFECT THE OUTCOME
\end{document}

I wonder if this is the same for \clearpage. I think there are seven possible spots for \clearpage that seemingly produce the same output. Do they have no logical difference from one another?

Spot 1: The spot right after the first paragraph.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.\clearpage

This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

Spot 2: The spot right below the first paragraph.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\clearpage

This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

Spot 3: Two lines away from both the first and second paragraphs.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.

\clearpage

This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

Spot 4: The spot right above the second paragraph.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.

\clearpage
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

Spot 5: The spot right before the second paragraph.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.

\clearpage This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

Spot 6: In the middle of the two paragraphs with no additional line break.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\clearpage
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

Spot 7: Just at the beginning of the second paragraph with no line break.

\documentclass{article}
\begin{document}
This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\clearpage This is a sentence. This is a sentence. This is a sentence. This is a sentence. This is a sentence.
\end{document}

I think either Spot 1 or Spot 3 is more readable than others, and Spot 7 is the shortest code among all the candidates with the same outcome. I wonder if pursuing easy-reading (or space-saving sometimes) coding practice unexpectedly influences the results.

2
  • Why should there be a difference? I don't think there is. LaTeX puts every paragraph in a box, then typesets the boxes vertically one after the other. \clearpage creates a new page in which the next box will be printed, the spaces don't matter much. I would use 1 or 3 for readability, but really, it's up to you.
    – Elad Den
    Oct 12, 2020 at 8:35
  • 1
    @EladDen paragraphs are not boxed: (try your reasoning with \pagebreak instead of \clearpage :-) Oct 12, 2020 at 8:55

1 Answer 1

3

Unlike \pagebreak, \clearpage (via \newpage) inserts a \par before processing, and after processing is consequently already in vertical mode. this means that putting a blank line (\par) before or after makes no difference. However a blank line is the standard document markup for paragraph breaks so I would always add a blank line between paragraphs (doesn't really matter whether that is before or after the clearpage) rather than rely on the technical detail that \clearpage ends the current paragraph.

If you try your examples with \pagebreak instead of \clearpage you will see a big difference between the cases with the versions with no blank line being set as a single paragraph, not two.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.