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.

The following tabular environment has 3 columns. Each column has a width of \textwidth/3, but somehow the table is wider than \textwidth.

\documentclass{article}

\usepackage{calc,lipsum}
\begin{document}

\begin{tabular}{||p{\textwidth/3}||p{\textwidth/3}|p{\textwidth/3}||}
aaaaaaa&bbbbbbbb&cccccccccc\\
\end{tabular}

\lipsum
\end{document}

What might the problem be?

share|improve this question
    
You are not allowing for the inter-column separation. Do you want to remove this entirely or to allow for it? –  Joseph Wright Oct 29 '12 at 11:53
    
@JosephWright There won't be any space betweeen the columns. –  nrs Oct 29 '12 at 11:55
1  
If you remove the vertical rules (that are bad typography anyway), just saying p{\textwidth/3 - 2\tabcolsep} will do. –  egreg Oct 29 '12 at 11:59
    
Adding - 2\tabcolsep fixed the problem. Thanks ^^ –  nrs Oct 29 '12 at 12:01
add comment

1 Answer

up vote 3 down vote accepted

using tabularx makes more sense in this special case

\documentclass{article}

\usepackage{tabularx,lipsum}
\begin{document}
\noindent
\begin{tabularx}{\linewidth}{|| X || X | X ||}
aaaaaaa&bbbbbbbb&cccccccccc\\
\end{tabularx}

\lipsum
\end{document}
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.