24

If I use a \llap{text} command at the beginning of an indented paragraph, the text is not indented and is put on the line above the paragraph.

\documentclass{article}
\begin{document}

\parindent=2cm

\llap{x}Hello

H\llap{x}ello

\end{document}

Using the code above, I get the x above and far too the left, relative to the H in the first case, but I get the correct result in the second case (the x is just to the left of the e).

Screenshot of the above code

How can I get the x just to the left of the H?

I tried putting a vphantom{X} just before the \llap to force the paragraph to start, but that didn't change the result at all.

  • 3
    you need \leavevmode as \llap is \hbox not \mbox The supported LaTeX syntax is \makebox[0pt][l]{...} which does not have this surprise. – David Carlisle Nov 20 '13 at 22:12
  • 1
    You can also do \hspace*{0pt}\llap{x}Hello. – user11232 Nov 20 '13 at 22:23
  • 1
    @DavidCarlisle: Except \makebox[0pt][l]{...} is \rlap, while \makebox[0pt][r]{...} is \llap. – Dan Nov 21 '13 at 22:07
29

\llap is not a LaTeX box command and does not start a paragraph.

\documentclass{article}
\begin{document}

\parindent=2cm

\makebox[0pt][r]{x}Hello

H\makebox[0pt][r]{x}ello

\end{document}

enter image description here

9

You can also use

\indent\llap{x}Hello

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.