26

Is it possible to set tab stops in some sort of initial formatting declaration, abstractly?

The code examples I see around town all show tabs being set by example, with \= in the first line of actual text within the tabbing environment. But I would like to avoid that; my first line will never have enough text in it to fill out up to the place where the tab is to be set.

3 Answers 3

30

You can set the tabs using a line with, for example, \hspace{<length>} and ending the line with the \kill command:

\documentclass{article}
\begin{document}

\begin{tabbing}
\hspace*{2cm}\=\hspace*{3cm}\= \kill
column1a \> column2a \> column3a \\
column1b \> column2b \> column3b 
\end{tabbing}

\end{document}
13

You can also make a custom command if you are reusing the same tabstops

\newcommand\mytabs{\hspace*{2\parindent}\=\hspace{2cm}\=\hspace{2cm}}
\newenvironment{mytabbing}[1][\mytabs]
  {\begin{tabbing}#1\kill}
  {\end{tabbing}}

which you can use as

\begin{mytabbing}
  \>aa \>bb\\
\end{mytabbing}

or

\begin{mytabbing}[\hspace*{2\parindent}\=aa~\=]
  \>aa \>bb\\
\end{mytabbing}
3

In two words: texdoc tabto

\documentclass[a4paper]{article}
\usepackage[showframe,margin=3cm]{geometry}
\usepackage{tabto}
\parindent0em\parskip1em
\begin{document}
\TabPositions{2cm,5cm,6.5cm,12cm}
xxx  \tab{xxx}  \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx}
\tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx}

\NumTabs{8}
xxx  \tab{xxx}  \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx}
\tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx} \tab{xxx}

\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .