0

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} – Yiannis Lazarides Jun 26 '18 at 15:30
  • related tex.stackexchange.com/questions/34971/… – 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
1

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}

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.