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.

I want to make a table with a bigger than default column width for the first column. The text in this column should be left aligned. Here is my code.

\begin{tabular}{llll|l}
Address1    &&&& Mobile: 888-000-0000 \\
Address2    &&&& Fax: 888-000-0000 \\
\end{tabular}

The first column (Address1, Address2) should have a larger width so that the second column (Mobile, Fax) is close to the right margin of the page. Now I just add in a lot of invisible columns so that there are more spaces between them. I wonder if there is a way to control the width of the first column.

share|improve this question
add comment

3 Answers

up vote 3 down vote accepted

There are quite a few ways to achieve your objective. One of them would be to use a tabular* environment instead of a tabular environment:

\begin{tabular*}{\textwidth}{l @{\extracolsep{\fill}} l}
Address1    & Mobile: 888-000-0000 \\
Address2    & Fax: 888-000-0000 \\
\end{tabular*}

The somewhat intimidating-looking contruct @{\extracolsep{\fill}} serves to push the table's columns maximally far apart (while making the entire table still fit into a text block of width \textwidth).

share|improve this answer
add comment

Here's a quick-and-dirty solution with tabularx:

\usepackage{tabularx}
...
\begin{tabularx}{\textwidth}{X|l}
Address1 & Mobile: 888-000-0000 \\
Address2 & Fax: 888-000-0000 \\
\end{tabularx}

But bear in mind that it's prettier without the vertical bar.

share|improve this answer
    
Note that doing this with tabularx rather than tabular* makes TeX work 10000000 times harder. It maybe that with today's machine speeds you don't care anymore, but.... –  David Carlisle Oct 1 '12 at 12:13
    
@DavidCarlisle : My guess was that OP might be a relative beginner; while I agree that my answer is not, technically, the best possible, I certainly think it's the least scary (for a beginner, anyway). –  Brent.Longborough Oct 1 '12 at 12:49
1  
I get scared every time anyone uses tabularx –  David Carlisle Oct 1 '12 at 13:13
add comment

You can use the package tabu. You adjust the width of each column by changing the value 5 and 2.5 inside the brackets. You may also change the alignment from left to right or centred, by changing lto r(or c). Here is your table:

\documentclass{standalone}
\usepackage{tabu}
\begin{document}
\begin{tabu} to \linewidth {X[5,l]|X[2.5,l]}
Address1    & Mobile: 888-000-0000 \\
Address2    & Fax: 888-000-0000 \\
\end{tabu}
\end{document}

This gives:

enter image description here

share|improve this answer
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.