4

I am trying to create a uniform spacing between three lines, the middle of which has a different font size. However, when I try as follows, the spacing above the middle line is different from the one below.

\documentclass{article}
\begin{document}
One

\vspace{\baselineskip}
{\Huge Two\par}

\vspace{\baselineskip}
Three
\end{document}

This is what the generated PDF looks like:

Screenshot of the PDF generated by LaTeX

I have tried \parboxes and \minipages, but so far have not been able to create uniform spacing.

Can anyone explain why the vertical spacing generated by the above code is different and how uniform spacing could be achieved?

2
  • 2
    Get rid of the \par in {\Huge Two\par}. Then, while the text will still be \Huge, the line spacing will not act according to \Huge. It will help to see this even better if the \Huge line contains a descender like g. May 21, 2022 at 20:44
  • This indeed leads to the desired result in the above example, but I forgot to mention that I inserted the \par on purpose to achieve a "normal" line height when the text is wrapped in the second paragraph (say if it consisted of 20 "Two"s or so). If I omit the \par, the result will be very close lines.
    – alex
    May 21, 2022 at 20:59

3 Answers 3

2

It's difficult to even define “uniform spacing”, but here's a possibility.

\documentclass{article}
\usepackage{lipsum}

\begin{document}

\lipsum*[1][1-4]\par
\prevdepth=\maxdimen
\medskip

{\Large \lipsum*[2][1-3]\par}
\prevdepth=\maxdimen
\medskip

\lipsum[3][1-4]

\end{document}

Stating \prevdepth=\maxdimen will make TeX use the \lineskip between the two lines (default value 1pt) and we can add whatever vertical space we prefer.

enter image description here

1
  • Thank you! With your solution, the spacing is even more, i.e. exactly "uniform" (by which I meant the vertical space between the lower and upper edges of two consecutive paragraphs' letters), compared to the solution mentioned by @steven using a \parbox (using a \parbox, there was still a very small difference in the vertical spacing, which was especially apparent when using the setspace package's onehalfspacing option and \Large instead of \Huge).
    – alex
    May 22, 2022 at 13:40
3

While I suggested that the \par in {\Huge Two\par} made the lines between One and Two get set with \Huge line spacing and advocated the removal of the \par, the OP replied that if the "Two" content exceeded a line width, then it would not be set with appropriate spacing within the paragraph.

An alternate approach to removing the \par, if the "Two" content exceeds a line, is to set it separately as \Huge within its own \parbox, as shown below.

\documentclass{article}
\begin{document}
One

\vspace{\baselineskip}
\noindent\parbox[t]{\textwidth}{\Huge Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g)
 Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g) Two(g)}

\vspace{\baselineskip}
Three
\end{document}

enter image description here

1
  • Thank you very much for your quick responses. I must have done something wrong in my \parbox attempts.
    – alex
    May 21, 2022 at 22:05
2

You are seeing the difference between \Huge and \normalsize \baselinskip so simplest is just to add one and remove the other.

Dots addd to show the spacing

enter image description here

\documentclass{article}
\begin{document}
One\dotfill

\vspace{2\baselineskip}
{\Huge\vspace{-\baselineskip} Two{\normalsize\dotfill}\par}

\vspace{\baselineskip}
Three\dotfill
\end{document}
3
  • Thank you very much for your answer. Perhaps I should not have chosen \baselineskip as the \vspace amount in my example, but instead a height like 1cm. Your solution seems to provide an even spacing between the baselines when using \baselineskip as \vspace amount, if I see and understand it correctly. However, my problem was the different spacing between the bottom and top edges of the letters. It could be solved by the solution suggested by @steven using a \parbox.
    – alex
    May 21, 2022 at 22:23
  • @alex no you can use this version use \vspace{1cm}\vspace{\baselineskip} \Huge\vspace{-\baselineskip} (instead of the 2) Using a parbox you will find it (very) hard to get the space right afer the paragraph \parbox[t] gives you conrol over he firs lie but loses all informaion a he boom of the box May 21, 2022 at 23:33
  • Thank your for your explanation regarding the \parbox as well as how to add further spacing in your solution! My formulation "uniform spacing" was probably too ambiguous. Your solution does indeed result in exact spacing between the baselines of the first and last lines of successive paragraphs. However, my goal was to produce equal spacing between the bottom and top edges of the letters of successive paragraphs.
    – alex
    May 22, 2022 at 14:21

You must log in to answer this question.

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