TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I cannot remember how to create an invisible character in LaTeX, i.e. I want to put a space the 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.

share|improve this question
Please accept either your or TH.s answer to conclude this question. Thank you. – Martin Scharrer May 9 '11 at 18:27
@MattLeifer: Please accept an answer, as Martin told you years ago ;-) – Tobi Oct 11 '13 at 7:49
Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – Jubobs Oct 11 '13 at 8:25
-1: Is there any reason not to accept one of the answers? – math Apr 4 '14 at 8:33
@math Take a look at his profile; he hasn't been on in three years. These things happen; that's why there is a voting system. – Sean Allred Nov 23 '14 at 4:45

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.
share|improve this answer
Why is there height, width and depth? 3D in typesetting? – Kit Oct 25 '10 at 2:32
Height 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. – Will Robertson Oct 25 '10 at 3:44
@Kit: You might also want to see the illustration in the question tex.stackexchange.com/q/151584/25077 – strpeter May 27 '14 at 15:00
Also Alexander R. Perlis' article in TUGboat, Volume 22 (2001), No. 4, p.350ff., might be of interest (especially the illustrations). – Stephen Jun 26 '15 at 17:07

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

share|improve this answer
This isn't a dumb question. The answer would be better if it gave an example of its use, or referenced some resource that explained the command. – Charles Stewart Oct 24 '10 at 21:08

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

    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.}}

LaTeX output.

share|improve this answer
Both existing answers already mention the use of \phantom, so this doesn't add anything new. – Werner Jun 28 at 21:12
As I said, I just wanted to contribute with HOW to use it ;) – Christian Rodriguez Jun 29 at 17:02

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.