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 am trying to create a very simple, one row table that spans the linewidth. When I use the following command:

\begin{tabular*}{\linewidth}{l@{\extracolsep{\fill}}r}
Entry 1 & Entry 2
\end{tabular*}

the first entry is slightly indented and the second entry entends past the linewidth. How do I make it so that the first entry is aligned with the left margin and the second entry is aligned with the right margin?

share|improve this question
2  
Why not just use \noindent Entry 1 \hfill Entry 2? –  Werner Apr 11 '12 at 18:22
    
That is much simpler. I just didn't think of that. Thanks! –  richtera Apr 11 '12 at 18:25
2  
@Werner Indeed. Related question: tex.stackexchange.com/questions/6440/… –  lockstep Apr 11 '12 at 18:29

1 Answer 1

up vote 5 down vote accepted

Add \noindent before \begin{tabular*} if you use the tabular* environment outside a table float.

EDIT: As Werner points out, you may also remove the \tabcolsep before the first and after the last column (using @{}).

\documentclass{article}

\usepackage{lipsum}

\begin{document}

\lipsum[1]

\bigskip

\noindent
\begin{tabular*}{\linewidth}{@{}l@{\extracolsep{\fill}}r@{}}
Entry 1 & Entry 2
\end{tabular*}

\end{document}

enter image description here

share|improve this answer

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.