[Tex/LaTex] longtable spanning textwidth

longtable

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.

Best 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...

Related Question