# [texhax] \rlap at the beginning of a \parbox

jfbu jfbu at free.fr
Wed Feb 26 15:57:59 CET 2014

le 26/02/2014 15:37 selon jfbu:
> le 26/02/2014 11:59 selon Michael Rutter:
>> I am confused as to the behaviour of \rlap (or a \makebox of zero width}
>> at the beginning of a parbox. It seems to force a new line, whereas it
>> behaves differently if preceded by an \hspace*{0pt}. Could someone explain
>> to me the output of the following LaTeX which illustrates this issue? (It
>> was an attempt to produce a dollar sign with the same width as a pounds
>> sign, for neater tables of mixed currencies.)
>>
>> \documentclass{article}
>>
>> \newcommand{\dollars}{\rlap{\$}\hphantom{\pounds}} >> \parindent 0pt >> \begin{document} >> >> \parbox{3in}{\pounds{}6} >> >> \parbox{3in}{\hspace*{0pt}\dollars{}6} >> >> \parbox{3in}{\dollars{}6} >> >> \end{document} >> >> Regards, >> >> Michael Rutter >> > > \rlap uses \hbox not the LaTeX \makebox or \mbox, > hence when in vertical mode at the beginning of the > \parbox, its use will result in a full (empty) line. sorry I didn't mean to say "empty" line. The \$ stands
on a line (no extra vertical space above it) then
for some reason presumably from the \parbox code
I didn't look at there is an empty line and then
the line containing the 6. The whole thing is vertically centered
as is the default with a \parbox
as you can see by adding some characters before and after the \parbox

>
> \leavevmode\rlap fixes the problem.
>

by the way you said "or a \makebox of zero width" but there is no issue
then
\parbox{3in}{\makebox[0pt][l]{\\$}\hphantom{\pounds}{}6}

Best

> Best,
>
> Jean-Francois
>
> _______________________________________________
> TeX FAQ: http://www.tex.ac.uk/faq
> Mailing list archives: http://tug.org/pipermail/texhax/