50

I have seen several cases of people using the \tab command to insert a specific amount of space between objects (as opposed to the \hfill command which uses any remaining space). However, I have never been able to get \tab to work. Are there any specific packages or environments that are supposed to accompany \tab?

  • 1
    I am not familiar with \tab, but there is a tabto package that can come in quite handy. – Steven B. Segletes Aug 29 '14 at 1:04
  • I would use \hspace*{<length>} -- without the * the full space may not be inserted. – Andrew Aug 29 '14 at 4:20
  • May be \let\tab\quad? – Manuel Aug 29 '14 at 6:27
51

The command \tab exists, but it produces quite a large space. It also requires the use of the package tabto.

Alternative options are \quad and \qquad; the space produced is probably more what you are looking to create. These commands do not require extra packages and can be stacked (e.g. Stuff Over Here \quad \quad \quad More Stuff Over Here) if needed.

You might also want to try using either $\>$ or $\-$. Neither command requires any extra packages, but both must be in math mode. Although neither command by itself gives a large space like \tab does, the space produced is small. However, you can stack the commands in order to get the spacing you want.

Hope this helps.

  • @Manuel You are correct; I could define a term like Herbert wanted. But that doesn't really solve the problem or answer the question. The objective is to find a command that will put space between objects and defining a new command doesn't really do that. Besides, it's bad form to define a new command in each document. – Mathematician Oct 23 '14 at 22:24
  • Oh, I see what you're saying. But, as I mentioned previously, the objective is to FIND a command that will put space between objects and defining a new command doesn't really do that. There is no point in creating a command if one already exists, making it unnecessary (what I term "bad form") to define a new command in each document. – Mathematician Oct 23 '14 at 23:00
26

define your own command:

\documentclass{article}
\newcommand\tab[1][1cm]{\hspace*{#1}}
\begin{document}
foo\tab bar\tab[2cm]baz

\tab foo\tab bar\tab[2cm]baz

\rule{1cm}{1pt}foo\rule{1cm}{1pt}bar\rule{2cm}{1pt}baz

\end{document}

enter image description here

  • 8
    Which is not what \t does. Tab also aligns the text. – Denys Vitali Jan 24 '17 at 19:17
10

Instead of \tab, you may use \hspace{10mm} which gives a 10mm space similar to using \tab.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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