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.
3 Answers
You already found the answer, but let me expand a bit. There are three phantom commands. They each take a single argument.
\hphantom
(horizontal phantom) inserts an empty box that has zero height, zero depth, but the width of its argument.\vphantom
(vertical phantom) inserts an empty box that has the height and depth of the argument, but zero width.\phantom
inserts an empty box with the same dimensions (horizontal as well as vertical) as the argument.
-
58
-
100Height is the length above the baseline, depth is the length below. So a character such as "X" will have a height but zero depth, and "g" has (a smaller) height as well as depth. Commented Oct 25, 2010 at 3:44
-
10@Kit: You might also want to see the illustration in the question tex.stackexchange.com/q/151584/25077– strpeterCommented May 27, 2014 at 15:00
-
2Also Alexander R. Perlis' article in TUGboat, Volume 22 (2001), No. 4, p.350ff., might be of interest (especially the illustrations).– StephenCommented Jun 26, 2015 at 17:07
-
3
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}