1

I have two vboxes and I want space between two vbox be exactly same as space between two line of paragraph.

\documentclass{report}
\usepackage{lipsum}
\setlength\parindent{0pt}
\linespread{2}
\begin{document}
    \setbox0=\vbox{\lipsum[1]}
    \setbox1=\vbox{\lipsum[2]}
    \unvbox0
    \unvbox1
\end{document}

Output:

Image

  • \addvspace{\baselineskip} – yannisl Jun 26 '18 at 15:30
  • related https://tex.stackexchange.com/questions/34971/how-to-keep-a-constant-baselineskip-when-using-minipages-or-parboxes – touhami Jun 26 '18 at 15:31
  • @YiannisLazarides no:-) (see the link touhami gives) – David Carlisle Jun 26 '18 at 15:57
  • actually your question is confusing, you ask about the space between two vbox but your example unboxes them, different issues arise in getting the space between two unboxed lists and between two boxes, so you should clarify which you want. – David Carlisle Jun 26 '18 at 15:59
  • Can you please give more details about why you'd like to do such a thing? – egreg Jun 26 '18 at 17:13
  • @YiannisLazarides this add extra space more than distance between two line. Thanks – mojtaba baghban Jun 26 '18 at 17:22
  • @DavidCarlisle I dint know difference between \box and \unvbox. I will ask this in another question. Thanks. https://tex.stackexchange.com/questions/438099 – mojtaba baghban Jun 26 '18 at 17:25
  • By use of this link https://tex.stackexchange.com/questions/438099 I could set space between two vbox exactly equal to \baselineskip. But How set space between two unvbox to be exactly equal to \baselineskip. Thanks – mojtaba baghban Jun 26 '18 at 21:06

1 Answers1

3

When lists are unboxed, TeX does not re-calculate baseline-to-baseline spacing, the contents of the boxes are simply added directly to the current list.

So (when feasible) it is simplest to arrange that the list being unboxed have the correct spacing. In this case the main controlling parameter is \prevdepth, if you force the paragraph to end before ending the first box, you can save \prevdepth and then set \prevdepth at the start of the second box to force the correct baselineskip calculation for the first line,

enter image description here

\documentclass{report}
\usepackage{lipsum}
\setlength\parindent{0pt}
\linespread{2}
\begin{document}
    \setbox0=\vbox{\lipsum[1]\par\global\dimen1=\prevdepth}
    \setbox2=\vbox{\prevdepth=\dimen1 \lipsum[2]}
    \unvbox0
    \unvbox2
\end{document}
David Carlisle
  • 757,742