Sunday, February 21, 2010

Programmer - Getting two tables in LaTeX to have the same (right-aligned) column width

Programmer Question

I have two very short and consecutive sections (for a CV), each containing a small table:



\section{Work Experience}

\begin{tabular}{r|p{11cm}}
Current & Your job at Your Company, Town \\
Jan 2009 & What your company does \\
& A description of what you do\\
\multicolumn{2}{c}{}\
\end{tabular}

\section{Education}

\begin{tabular}{r|p{11cm}}
Slightly wider first column & University, Town \\
Jan 2009 & Thesis subject \\
& A description of what you did\\
\multicolumn{2}{c}{}\
\end{tabular}


So each table has two columns: The first containing the period, aligned to the right. The second: some more info with a certain width, top (and left) aligned.



The problem is that the width of the left column in the two tables is different, and doesn't look nice since the sections (therefore tables) are consecutive and in one page. I cannot give r a width like p:



\begin{tabular}{r{11cm}|p{11cm}}


Does not work. How can I get the widths of the first columns of the two tables the same length while also having them right aligned?



EDIT Thanks for the answers guys, they all work for me so I upvoted all of them, and accepted the one that appealed to me the most (and most upvoted), since you don't have to specify the \hfill in each row. However if you don't want to use the array package for any reason then the other solutions are also great.

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails