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.

Is there any way to achieve the same result in LaTeX as done with tabulators in other Word Processors?

  • The difference to tables is that the text is not limited to cells but can flow across there boarders.
  • and I can define the tabulators per paragraph

It should also work with other languages (from right to left and left to right) like in this question: Hebrew vs. German/English translation side-by-side

the first paragraph with tabulators the second paragraph with tabulators

share|improve this question
    
meanwhile I have also fount the package tabto but it doesn't work with Hebrew either. Does anybody know a tabbing/tabto/tabulator environment for bi-directional text? –  white_gecko May 27 '12 at 22:50
    
If you use bidi package in xelatex, then you can get perfect bidi tabular. –  Vafa Khalighi Jun 11 '12 at 6:03
add comment

2 Answers

You can use the tabbing environment; below there are some examples (the example is in Spanish, but that's not so relevant) of the use of this environment and a brief description of its main commands:

\documentclass{article}

\begin{document}

\begin{tabbing}
Programa\quad \= : \= \TeX \\
Autor \> : \> Donald Knuth \\
Manuales \> : \\
\qquad\= The Advanced \TeX\ Book\quad\= David Salomon\quad\=
Springer-Verlag\kill \\
\>\textsf{T\a'itulo} \>\textsf{Autor} \>\textsf{Editorial}\\
\>The \TeX Book \>Donald Knuth \>Addison-Wesley\\
\>The Advanced \TeX\ Book \>David Salomon \>Springer-Verlag
\end{tabbing}

\begin{tabbing}
Fila 1 Columna 1\hspace{2cm}\= Fila 1 Columna 2 \\
\> Fila 2 Columna 2\hspace{1.8cm}\= Fila 2 Columna 3 \+\+ \\
Fila 3 Columna 3 \- \\
Fila 4 Columna 2 \> Fila 4 Columna 3 \\
\< Fila 5 Columna 1 \> Fila 5 Columna 2 \> Fila 5 Columna 3 \\
Fila 6 Columna 2 \> Fila 6 Columna 3 \- \\
Fila 7 Columna 1 \> Fila 7 Columna 2 \> Fila 7 Columna 3 \\
Fila 8 Columna 1 \' Derecha \\
Fila 9 Columna 1 \> y \' Fila 9 Columna 2 \\
\pushtabs
\quad\= Fila 10 Columna nueva 1\hspace{2.5cm}\= Fila 10
Columna nueva 2 \\
\> Fila 11 Columna nueva 2
\> Fila 11 Columna nueva 2 \\
\poptabs
Fila 12 Columna antig\"ua 1 \> Fila 12 Columna antig\"ua 2
\end{tabbing}

\end{document}

enter image description here

And now a brief description of the commands:

  • \= set tab.

  • \> advance to next tab stop.

  • \< used at the beginning of a line, it anhilates the effect of a \+ for that particular line.

  • \+ Used at the end of a line, it causes all following lines to begin at the first tab stop; using \+\+ at the end of a line, following lines will begin at the second tab stop, etc.

  • \- Used at the end of a line, it anhilates the effect of a \+.

  • \' causes the following text to be placed at the next tab stop; the preceding text will be written just before, with a separation controlled by the length \tabbingsep.

  • \\ end of line; newline.

  • \kill ignore preceding text; use only for spacing.

  • \pushtabs removes the current tabbing scheme (saving it before) allowing for a new tabbing scheme.

  • \poptabs it reactivates a previously saved tabbing scheme.

Inside the tabbing environment, the commands \=, and \' are redefined; in this environment it is possible to get the accents by using \a=, and \a', respectively.

I don't know if this will work with right-to-left languages.

share|improve this answer
    
thank you for this answer. But it doesn't solve my problem, because it doesn't work with right to left languages :-( –  white_gecko May 18 '12 at 20:28
    
Just add \usepackage[RTLdocument]{bidi} and it should work. –  Vafa Khalighi Jun 7 '12 at 6:43
add comment

This is just a modification of the user Gonzalo Medino's answer. To get bidi tabbing, just use bidi package and instead running pdflatex or latex, run xelatex on your document:

\documentclass{article}
\usepackage{bidi}
\begin{document}
\setRTL % to typeset tabbing in RTL mode
\begin{tabbing}
Programa\quad \= : \= \TeX \\
Autor \> : \> Donald Knuth \\
Manuales \> : \\
\qquad\= The Advanced \TeX\ Book\quad\= David Salomon\quad\=
Springer-Verlag\kill \\
\>\textsf{T\a'itulo} \>\textsf{Autor} \>\textsf{Editorial}\\
\>The \TeX Book \>Donald Knuth \>Addison-Wesley\\
\>The Advanced \TeX\ Book \>David Salomon \>Springer-Verlag
\end{tabbing}

\begin{tabbing}
Fila 1 Columna 1\hspace{2cm}\= Fila 1 Columna 2 \\
\> Fila 2 Columna 2\hspace{1.8cm}\= Fila 2 Columna 3 \+\+ \\
Fila 3 Columna 3 \- \\
Fila 4 Columna 2 \> Fila 4 Columna 3 \\
\< Fila 5 Columna 1 \> Fila 5 Columna 2 \> Fila 5 Columna 3 \\
Fila 6 Columna 2 \> Fila 6 Columna 3 \- \\
Fila 7 Columna 1 \> Fila 7 Columna 2 \> Fila 7 Columna 3 \\
Fila 8 Columna 1 \' Derecha \\
Fila 9 Columna 1 \> y \' Fila 9 Columna 2 \\
\pushtabs
\quad\= Fila 10 Columna nueva 1\hspace{2.5cm}\= Fila 10
Columna nueva 2 \\
\> Fila 11 Columna nueva 2
\> Fila 11 Columna nueva 2 \\
\poptabs
Fila 12 Columna antig\"ua 1 \> Fila 12 Columna antig\"ua 2
\end{tabbing}

\end{document}

As you can see, the output is perfect for RTL:

enter image description here

Even if you want to use tabu package, that package also work perfectly with bidi package. Try:

\documentclass{article}
\usepackage{xcolor}
\usepackage{tabu}
\usepackage{bidi}
\thispagestyle{empty}
\begin{document}
\setRTL % to typeset tabu environment in RTL mode
\taburulecolor |gray!50|{red}\arrayrulewidth=1pt
{
   \taburulecolor|yellow|{blue}\tabulinesep=1mm
      \begin{tabu}{|X|X|} \hline
      Here the lines & are drawn in blue        \\ \taburulecolor{green} \hline
      But starting from here & they are green coloured !                \\ \hline
      And now a nested \textsf{tabu} & \begin{tabu}{|X|} \firsthline\hline
                                guess what colour \\ \hline
                                is used for rules ?\\ \lasthline\hline
                              \end{tabu} \\ \hline
      \end{tabu}
}
\end{document}

and here is the perfect bidi tabu:

enter image description here

share|improve this answer
    
But aren't you only giving examples of "align beginning of text to this point" tabs? –  einpoklum Apr 17 '13 at 13:34
add comment

Your Answer

 
discard

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.