# Beamer: \llap produces new line if at the beginning of the line

If you use \llap in beamer at the beginning of a line, a new line appears between the \llaped text and the following text:

Is there a way to fix this?

MWE:

\documentclass{beamer}

\begin{document}
\begin{frame}
\llap{X}X
\end{frame}
\end{document}


Adding something before the \llap command and then \llaping past it produces the right sort of result, but doesn't seem like good practice if there's a better way to do it:

This is produced by the following:

\documentclass{beamer}

\begin{document}
\begin{frame}
X\llap{A\phantom{X}}
\end{frame}
\end{document}


The LaTeX savvy way to do it is

\makebox[0pt][r]{X}


The analog for \rlap is

\makebox[0pt][l]{X}


If you want to know the reason why \llap “fails”, you have to look how \llap is defined:

% latex.ltx, line 5162:
\def\llap#1{\hb@xt@\z@{\hss#1}}


and \hb@xt@\z@ is the same as \hbox to 0pt. The primitive \hbox doesn't start horizontal mode, so if found between paragraphs it makes a line of its own.

The \llap command doesn't appear in the official LaTeX manual, so who wants to use it should know the details of TeX. Be careful when you copy code from the net.

You must use \llap and \rlap in horizontal mode. A way to do this is obviously leave the vertical mode:

\documentclass{beamer}
\begin{document}
\begin{frame}
\leavevmode\llap{X}X
\end{frame}
\end{document}


But as you discover, you can enter also in horizontal mode in several other ways, for instance, writing some text before or some other commands as \indent or \noindent or \mbox{},

IMHO there are nothing wrong with any method as long as you obtain the desired result and nothing else (i.e., worth the truism: do not use \noindent if you want maintain the default indentation) ;-) ... but you really need start a paragraph with \llap? May be with a MWE more close to you final goal someone could offer a different approach:

• Oh, you were faster than me, I'll delete my answer :) – nox Sep 24 at 17:35