Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Why is it that the file

\documentclass{beamer}
\begin{document}
  \begin{frame}
    a\\
    \hphantom{ }b
  \end{frame}
\end{document}

produces an a and a b vertically aligned with a line skip in between whereas the same file with \\ replaced by \newline produces the expected: an a, then a b on the next line, indented by one space?

Is that a bug in Beamer (in documentclass Article, both versions have the same, expected effect)?

Thanks!

share|improve this question

1 Answer 1

I'd call this a feature of how beamer redefines \\. After it TeX is in vertical mode, so the \hphantom, which ultimately does \box2 doesn't start horizontal mode.

Use

\leavevmode\hphantom{ }

Note that standard LaTeX doesn't start vertical mode after \\.

share|improve this answer
    
That's a strange vision of a 'feature' but ok, it makes sense. Thanks! –  mqtthiqs Sep 4 '12 at 12:33
    
@mqtthiqs Well, our beloved moderator Joseph, who has taken over maintenance of beamer, is looking. :) –  egreg Sep 4 '12 at 12:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.