228

I cannot remember how to create an invisible character in LaTeX, i.e. I want to put a space that has the width of a particular character, say `M'. I know there is a command for this, and this is a really dumb question, but my Google-fu has failed me.

305

You already found the answer, but let me expand a bit. There are three phantom commands. They each take a single argument.

  1. \hphantom (horizontal phantom) inserts an empty box that has zero height, zero depth, but the width of its argument.
  2. \vphantom (vertical phantom) inserts an empty box that has the height and depth of the argument, but zero width.
  3. \phantom inserts an empty box with the same dimensions (horizontal as well as vertical) as the argument.
38

Ok, this has already been answered so I just want to contribute with the usage of the \phantom command.

\begin{document}
    This text will be visible. \\
    \phantom{This text will be invisible} \\
    \fbox{\phantom{This text will be invisible too, but a box will be printed arround it.}}
\end{document}

LaTeX output.

  • 10
    As I said, I just wanted to contribute with HOW to use it ;) – Christian Rodriguez Jun 29 '16 at 17:02
  • 2
    Thanks @ChristianRodriguez , I was hunting around as to what the actual format was, and then saw your answer. – abeverley Apr 19 '17 at 10:52
31

OK, I finally found it. The command is \phantom.

protected by Community Nov 23 '14 at 7:26

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

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