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

jfbu jfbu at free.fr
Wed Feb 26 15:37:01 CET 2014


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.

\leavevmode\rlap fixes the problem.

Best,

Jean-Francois



More information about the texhax mailing list