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.

Possible Duplicate:
How to fit landscape multi-page table to textwidth

I am trying to fit a longtable in a page with the following specifications:

\documentclass{article}
\usepackage[letterpaper]{geometry}
\geometry{tmargin=2cm,bmargin=2.5cm,lmargin=2.5cm,rmargin=2.7cm}
\usepackage{array}
\usepackage{longtable}
\begin{document}
\begin{longtable}{|c|>{\raggedright}p{4.5in}|p{0.85in}|}
\hline
\textbf{Week} & \textbf{Content} & \textbf{Assessments}\tabularnewline
\hline
\endfirsthead
\hline
\hline
\textbf{Week} & \textbf{Content} & \textbf{Assessments}\tabularnewline
\hline
\hline
\endhead
\hline
Week 1 & Unit 1
&HW, Q, T\tabularnewline
\hline
Week 2 & Unit 2
&HW, Q, T\tabularnewline
\hline
\end{longtable}
\end{document}

Note that to the naked eye, the table seems to be perfect, but I know that one can make the long table to span through the entire text width. I am looking for improvements and how to achieve the above effect (use of the text width.) If a similar question has been asked please redirect me.

share|improve this question
    
I'm not sure what your question is: longtable always uses the full text width by default. There is (as always with latex tables) a tabcolsep at either side which you could remove by putting @{} at the start an end of the column specification. Or is your question that you want the p column widths to be automatic, like tabularx X columns in which case you might look at ltxtable or perhaps tabu –  David Carlisle Jun 28 '12 at 15:26
add comment

marked as duplicate by Mico, egreg, percusse, Marco Daniel, Martin Schröder Aug 15 '12 at 17:00

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

1 Answer

Page 7 of the user guide of the longtable package suggests issuing the commands

\setlength\LTleft{0pt}
\setlength\LTright{0pt}
...
\begin{longtable}{@{\extracolsep{\fill}}...} % replace "..." with actual column specifiers

to get a longtable that's automatically as wide as \textwidth. For the case of your table, you'd either issue the two \setlength commands in the preamble (to make them apply to all longtable environments) or localize them in a TeX group (so that they only apply to the longtable(s) within that group). Then, you'd use the command

\begin{longtable}{@{\extracolsep{\fill}}|c|>{\raggedright}p{4.5in}|p{0.85in}|}

to force this particular longtable to occupy the entire width of the text block.

Addendum: After posting this answer, I came across this question which deals, in essence, with the very same topic. I should have remembered this earlier, given that I was one of the persons who posted an answer...

share|improve this answer
    
If it is a duplicate, please close. :-) –  azetina Jun 28 '12 at 19:10
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.