Text FormattingSpacing - Invisible text

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
egan
Posts: 4
Joined: Sun Jul 19, 2009 7:40 am

Spacing - Invisible text

Post by egan »

Since text is made up of boxes, and that is how LaTeX figures out the typesetting, I was wondering if there was a way to create spacing that would be the same size as a piece of text.

I.e.:

\foo{text} would create space the same size as "text" in the current typeface.
\foo{\texttt text} would create the space the same size as "text" in the current size and in the typewriter face.

Thanks for any suggestions.
Last edited by egan on Sun Aug 15, 2010 9:33 pm, edited 1 time in total.

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
Stefan Kottwitz
Site Admin
Posts: 10322
Joined: Mon Mar 10, 2008 9:44 pm

Re: Spacing - Invisible text

Post by Stefan Kottwitz »

Hi egan,

use \phantom{text}. There are variations like \hphantom and \vphantom for horizontal respectively vertical spacing.

Stefan
LaTeX.org admin
Post Reply