[Tex/LaTex] How to create an invisible character

macrosspacing

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.

Best Answer

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.
Related Question