# How to modify table recipe to get a right-justified column?

I'm trying to modify the recipe given in an earlier reply so that the right-most column (of two) is right-justified.

Here's a toy example of what I'm working with:

\documentclass{letter}
\begin{document}\vspace*{-1.5in}
\noindent

\begin{tabular*}{\linewidth}{@{}l@{\extracolsep{\fill}} p{5cm}@{}}
foo &         frobozz \\
bar &            quux \\
baz & yabba-dabba-doo \\
\end{tabular*}

\end{document}


Note that, contrary to the cited answer, this code uses \documentclass{letter}, not \documentclass{article}. (The document is meant to be a résumé. The table here is meant to hold address, telephone, email, etc. info. I need to squeeze the whole thing into two pages, and I'm hoping that putting this information in two columns will give me a precious extra couple of lines.)

Also, the \vspace*{-1.5in} at the top is my ignorant hack to reduce the amount of space at the top of the page.

The recipe above works fine for me, except that the rightmost column is left-justified. What must I do to get it to right-justify the text in the right-most column (only)?

I don't fully understand how this recipe works, but usually this is not a problem, because I can search for salient keywords in what I don't understand, and figure it out. In this case, however, I don't know what to search for, largely because much of what I don't understand consists of unsearchable symbols (e.g. @{}).

• You should really read an introduction to LaTeX. – TeXnician Jun 1 '18 at 16:35
• @TeXnician: I read this book cover-to-cover books.google.com/books?id=MxVUAAAAMAAJ decades ago, but I no longer use LaTeX often enough to remember it. Even when I was using LaTeX a lot (in grad school I wrote all my papers, and my dissertation with it), it still made zero sense, a hodge-podge of syntax without rhyme or reason, so I don't find it too surprising that I can't remember it... But yeah, I should relearn it, since there's nothing better in the horizon. – kjo Jun 1 '18 at 18:29
• Maybe you like ConTeXt more (clearer syntax…) – TeXnician Jun 1 '18 at 21:01

\begin{document}\vspace*{-1.5in}


You're right, this is not a good solution. Just use geometry if you want to change margins (but really, if you use the letter class spacing should be treated carefully; which does not say that using letter for a resume is the best idea).

\begin{tabular*}{\linewidth}{@{}l@{\extracolsep{\fill}} p{5cm}@{}}


So you are defining two columns: one left-aligned l column and one fixed-width (justified) p column. The @{} part just removes the small horizontal extra space inserted before and after a line. The @{\extracolsep{\fill}} just flushes the second column to the right.

For making the second column right-aligned you have three basic options:

• use a r-column (if you do not need line breaks)
• use the array package and specify >{\raggedleft\arraybackslash}p{5cm}
• use the array package (up-to-date version) and a simple wr{5cm}