# Align columns of text

So basically what I am trying to achieve is something like the following...

Mobile      :  +12 111 111 111      Email     :  something@something.com
Phone       :  +12 111 111          Website   :  http://www.something.com
Nationality :  Somenationality      Birthdate :  xx/xx/xxxx


keeping the blocks of text together for every line. I don't really know how to tackle that problem. The trick is to keep the : together in a row, keep the same spacing between Mobile Information and the Email title for example and keep that space for the three lines. What would be the right solution to get this nicely together...

so far I solved it like this but it doesn't really work that great

  \begin{center}
{\LARGE \textbf{My Name}}\\
\textnormal{xx, rue du XX \ \ X-XXXX XXXXXX} \\[3mm]
\par\noindent\parbox{1.3cm}{Mobile}\parbox{0.2cm}{:} \parbox{3.5cm}{+122 111 111 111} \hspace{0.01cm} \parbox{1.3cm}{Email}   \parbox{0.2cm}{:} \parbox{3.5cm}{something@something.com}\\
\par\noindent\parbox{1.3cm}{Phone} \parbox{0.2cm}{:} \parbox{3.5cm}{+122 111 111}     \hspace{0.01cm} \parbox{1.3cm}{Website} \parbox{0.2cm}{:} \parbox{3.5cm}{http://www.something.com}\\
\par\noindent\parbox{1.3cm}{Nat.}  \parbox{0.2cm}{:} \parbox{3.5cm}{Somenationality}    \hspace{0.01cm} \parbox{1.3cm}{Birthdate}\parbox{0.2cm}{:} \parbox{3.5cm}{xx.xx.xxxx}\\
\end{center}

-
Have you considered just using a table? – Peter Grill Nov 12 '11 at 18:05
Yes kinda, I tried multicols but couldn't really get it to work like i wanted to do you have any examples maybe? Thanks – latz Nov 12 '11 at 18:07
For formatting purposes, perhaps you might be interested in using the url package for typesetting websites or emails. – Werner Nov 12 '11 at 19:33

I would recommend using a tabular environment as below. The @{} removes the inter column spacing.

\documentclass[border=5pt]{standalone}
\begin{document}
\noindent
\begin{tabular}{l@{}cll@{}cl}
Mobile     &:&+12 111 111 111 &Email    &:&something@something.com\\
Phone      &:&+12 111 111     &Website  &:&http://www.something.com\\
Nationality&:&Somenationality &Birthdate&:&xx/xx/xxxx
\end{tabular}
\end{document}


As @cmhughes mentions, there is also a tabularx environment that will help with column stretching, but that might be overkill for this particular problem.

Alternatively, you could use something similar to what you were doing but use \makebox instead. Here I define a \LeftBox for the text on the left, and a separate \RightBox for text on the right, each of which takes two parameters. You could of course define just one command that takes four parameters, but this should get you started:

\documentclass[border=5pt]{standalone}
\begin{document}
\newcommand{\ColonSep}{\makebox[0.2cm][l]{:}}%
\newcommand{\LeftBox}[2]{\par\noindent\makebox[1.3cm][l]{#1}\ColonSep\makebox[3.5cm][l]{#2}}%
\newcommand{\RightBox}[2]{\hspace{0.5cm}\makebox[1.5cm][l]{#1}\ColonSep\makebox[3.5cm][l]{#2}}%
\begin{center}
{\LARGE \textbf{My Name}}\\
\textnormal{xx, rue du XX \ \ X-XXXX XXXXXX} \\[3mm]
\LeftBox{Mobile}{+122 111 111 111}  \RightBox{Email}{something@something.com}\\
\LeftBox{Phone}{+122 111 111}       \RightBox{Website}{http://www.something.com}\\
\LeftBox{Nat.}{Somenationality}     \RightBox{Birthdate}{xx.xx.xxxx}\\
\end{center}
\end{document}

-
Or you could use @{:} instead of a whole column for the :. It might also be worth mentioning the tabularx environment. I would post the answer, but it would be too similar. It's probably worth putting in a detailed explanation as this is a beginner's problem – cmhughes Nov 12 '11 at 18:14
Thanks for help guys really appreciated! – latz Nov 12 '11 at 21:15

You can also use a tabbing environment:

\documentclass{article}

\begin{document}

\begin{tabbing}
\>Mobile          \>:  \>+12 111 111 111   \> Email         \>:  \> something@something.com \\
\>Phone            \>:  \>+12 111 111            \>Website   \>:  \>http://www.something.com \\
\>Nationality \>:  \>Somenationality \>Birthdate \>:  \>xx/xx/xxxx
\end{tabbing}

\end{document}


A brief description of the basic commands commands used:

• \= sets a tab stop at the current position.
• \> advances to the next tab stop.
• \kill sets tab stops without producing text. Works just like \\ except that it throws away the current line instead of producing output for it. The effect of any \= commands in that line remain in effect.
-
Thanks a lot for your answer :) – latz Nov 12 '11 at 21:15