5

I use \rlap and \smash to put a little something into the left margin. Works fine unless at the beginning of a new paragraph. Then the par break happens after, not before my lap&smash construct:

Last line of paragraph.\par
\rlap{\smash{\hspace{-4em}Margin!}}This line should have the margin to its left.

enter image description here

Why this happens?

I can work around by putting \strut in front of \rlap. Is there a more elegant way to achieve the same?

1 Answer 1

8

Neither \rlap nor \llap start a paragraph: they ultimately expand to

\hbox ...

and \hbox doesn't start a paragraph.

Better using

\makebox[0pt][l]{...}
\makebox[0pt][r]{...}

respectively for \rlap and \llap.

Beware that also \smash doesn't start a paragraph.

4
  • The surprise for me is that not even \par starts a paragraph.
    – Joachim W
    Commented Nov 17, 2017 at 9:48
  • @JoachimWuttke Indeed, \par ends a paragraph. It's not like <p> in HTML, but rather like </p>.
    – egreg
    Commented Nov 17, 2017 at 9:52
  • why not use \leavevmode? Commented Nov 20, 2017 at 2:13
  • @barbarabeeton Because it’s not in the manual.
    – egreg
    Commented Nov 20, 2017 at 6:59

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .