Text FormattingTabbing, alignment

Information and discussion about LaTeX's general text formatting features (e.g. bold, italic, enumerations, ...)
Post Reply
danmaker
Posts: 6
Joined: Sun Mar 07, 2010 7:24 pm

Tabbing, alignment

Post by danmaker »

Hello,

is there any way to set a right aligment of text in the tabbing environment?
The first tab has left alignment, but I need the next tab to have the text aligned to the right.

Thanks in advance

Recommended reading 2024:

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

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

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

Tabbing, alignment

Post by gmedina »

Hi,

can't you use a tabular environment?

Code: Select all

\documentclass{article}
      
\begin{document}

\begin{tabular}{lr}
  column1 & column2\\
  text & text
\end{tabular}

\end{document}
1,1,2,3,5,8,13,21,34,55,89,144,233,...
danmaker
Posts: 6
Joined: Sun Mar 07, 2010 7:24 pm

Re: Tabbing, alignment

Post by danmaker »

hi,

tried that out, but can´t make the left column to align with the left side of the page, it sets the table in the vertical center
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Tabbing, alignment

Post by localghost »

danmaker wrote:[...] tried that out, but can´t make the left column to align with the left side of the page, it sets the table in the vertical center
Please explain what the (horizontal) alignment to the left has to do with the alleged vertical centering.


Best regards
Thorsten
danmaker
Posts: 6
Joined: Sun Mar 07, 2010 7:24 pm

Re: Tabbing, alignment

Post by danmaker »

right, sorry about the confusion.. when I set the tabular environment, the left column doesn´t align to the left as the rest of the text in the document does
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Tabbing, alignment

Post by localghost »

Code: Select all

\documentclass{article}

\begin{document}
  \begin{tabular}{@{}lr@{}}
    column1 & column2\\
    text & text
  \end{tabular}
\end{document}
danmaker
Posts: 6
Joined: Sun Mar 07, 2010 7:24 pm

Re: Tabbing, alignment

Post by danmaker »

great, thanks a lot!
User avatar
frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Tabbing, alignment

Post by frabjous »

For the record, you can right align in a tabbing environment using the \` command, which will push the text right aligned up to the next tab stop, or the end of the line if there are no more assigned.

Code: Select all

\documentclass{article}
\begin{document}
\begin{tabbing}
left \` right\\
gauche \` droit\\
links \` rechts\\
\end{tabbing}
\end{document}
Post Reply