Can two \vtop boxes exist side by side?
What you need to know for doing a "box arithmetic" is
TeX changes vertical to horizontal mode at some places and returns back at others places.
\vbox
or\vtop
has its width given as most wider element in it. If this is whole paragraph then the width is\hsize
. So it is typical to set a width of\vbox
or\vtop
by\vtop{\hsize= something ...}
When TeX is in vertical mode, then \vbox{...}\vbox{...}
places boxes one above second. But when TeX is in horizontal mode then \vbox{...}\vbox{...}
places boxes at the same line. For example:
\leavevmode \vtop{...}\vtop{...} % they are at one line
% in the paragraph started by \leavevmode
\hbox{\vtop{...}\vtop{...}} % they are at one line in the \hbox.
I wrote about TeX modes and boxes in detail in TeXbook naruby, sections 3.4 and 3.5.
IMHO, the "box arithmetic" principles and vertical/horizontal modes are basic knowledges of each TeX users. Unfortunately, LaTeX manuals hides them. LaTeX provides only a complicated construct like \begin{minipage}...\end{minipage}
.
You can use standard \parbox
and \makebox
commands.
There is a subtle point that you seem to be overlooking: the baselineskip might be not uniform with a \vtop
(or \parbox[t]
, which is the same) approach.
\documentclass[fontsize=13pt,letterpaper]{scrartcl}
\usepackage[textwidth=5in,showframe]{geometry}
\usepackage{fontspec}
\setmainfont{Alegreya}[SmallCapsFont=Alegreya SC]
\setlength{\parindent}{0pt}
\newsavebox{\feldA}\newsavebox{\feldB}
\newcommand{\Lcv}[2]{%
\par
\hspace*{-1.3in}%
\makebox[2in][r]{\itshape #1}%
\hspace*{0.5in}%
\makebox[3in][l]{#2}%
\par
}
\newcommand{\Lup}[2]{%
\sbox\feldA{\parbox[t]{2in}{\itshape#1\par\xdef\tpdA{\the\prevdepth}}}%
\sbox\feldB{\parbox[t]{3in}{#2\par\xdef\tpdB{\the\prevdepth}}}%
\ifdim\dp\feldA=\dp\feldB
\ifdim\tpdA>\tpdB\let\tpdF\tpdA\else\let\tpdF\tpdB\fi
\else
\ifdim\dp\feldA>\dp\feldB
\let\tpdF\tpdA
\else
\let\tpdF\tpdB
\fi
\fi
\Lcv{\usebox{\feldA}}{\usebox{\feldB}}\par
\prevdepth\tpdF
}
\begin{document}
\Lup{Hello this is your Crazy Uncle Unnamed ddd ddd ddd}
{Who joined the mob to feel good about himself}
Hello and \\ Welcome to {\itshape my} World!!
\Lup{Hello this is your Crazy Uncle Harry yyy yyy yyy yyy}
{Who joined the mob to feel good about himself}
Hello and \\ Welcome to {\itshape my} World!!
\end{document}
It's easy to see what goes wrong without the fuss with \prevdepth
: just comment the line \prevdepth=\tpdF
and you'll get