Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I have a problem adding tabs and I can't use a tabular environments (like tabular or tabbing) because I can't mix it with enumerate environments.

Is there a way to add a simgle tab like in any text editor? I use MathType to make equations writing much easier and there you can insert tabs, so when you export the code you see MathType uses & for that, but when you compile that code, LaTeX complains with:

Misplaced alignment tab character &.

So somehow LaTeX knows that I'm trying to add a tab and it's driving me crazy.

I thought to create my own "tab" macro or command: the idea is to tell LaTeX to go back to the left (or right) margin with \hspace and the move to the "tab" with another \hspace, something like:

Hi everybody. \hspace{-len_to_left_margin} \hspace{tab_value} My name is Agustin.

Is that posible?

share|improve this question
you can not do what you want with spaces (or not without great difficulty) as word space is not fixed so you would have to arrange for your negative hspace to stretch and shrink by the same amount, which is highly variable as tex optimises white space stretching and line breaking over the while paragraph. Your editor is inserting & so is expecting the expressions to be in tabular or align or similar environments. –  David Carlisle Sep 19 '12 at 23:14
And is there a way to tell LaTeX to move to a certain position inside the line? Something like: "\moveto{5cm}" –  Agustin Sep 19 '12 at 23:19
@Agustin There is a similar question I want to indent the next line by an exactly specified position –  Qrrbrbirlbel Sep 19 '12 at 23:28
you can go blank line to start a paragraph and \noindent\hspace*{5cm} but really this is all wrong you shouldn't be doing this. Only in very rare exceptional cases should you ever see explicit spacing commands in a document, it goes against the whole point of latex. –  David Carlisle Sep 19 '12 at 23:30
Why can't you use tabbing? Can you add some code to your question showing the problems you have using tabbing? –  Gonzalo Medina Sep 20 '12 at 1:50
add comment

2 Answers

up vote 5 down vote accepted

If I understand correctly, you are looking for something like this: enter image description here




\item \itab{Format:}  \tab{$math$ formula}
      \tab{is} \tab{(the real number)}
\item \itab{Example:} \tab{$\pi$} 
      \tab{is (first digits)} \tab{3.141593}    
\item \itab{Ome more:} \tab{$log_{10}(\pi)$} 
      \tab{is} \tab{1.14473}    

The problem is that the text inside \tab cannot exceed the set width (20% of the text width in this MWE). I suppose it would be possible to determine in the macro when this happens and then double the width, but I have little experience with conditionals in LaTeX.

share|improve this answer
Really nice, thank. That's what I was looking for. –  Agustin Sep 21 '12 at 14:37
add comment

Here is an option that mimics Heiko's answer in I want to indent the next line by an exactly specified position:

enter image description here

%\usepackage{showframe}% http://ctan.org/pkg/showframe
\usepackage[savepos]{zref}% http://ctan.org/pkg/zref
% \zsaveposx is defined since 2011/12/05 v2.23 of zref-savepos
\newcommand*{\tab}[2]{% \tab{<len>}{<stuff>}
\setlength{\parindent}{0pt}% Just for this example

\makebox[25ex][l]{\texttt{25ex}\hrulefill} \par
\makebox[\linewidth][l]{\texttt{\string\linewidth}\hrulefill} \par
Text1 \tab{5em}{Text2} \tab{25ex}{Text3} \tab{\linewidth}{Text4}


It allows you to specify a tab position relative to the left margin of the text block using \tab{<len>}{<stuff>}. Positioning is managed via zref's savepos module to mark the PDF location/length (in scaled points) and then perform the horizontal jumping around via \kerning.

In the image provided, the horizontal tab stops are identified via markers to accentuate the positioning.

share|improve this answer
add comment

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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