# How can I made the final column in a table paragraph formatted (line breaks), while still being constrained by the total table width?

I have a table that will have substantial amounts of text in the final 2 columns, and I can't figure out how to define the columns in a way that works for that. My original attempt was as follows:

\begin{tabulary}{\textwidth}{ | c | c | c | c | p{2.5 in} | l | }


This has the result of making the final column not break, and extend well past the edge of the page (does not conform to \textwidth). I could do something like this:

\begin{tabulary}{\textwidth}{ | c | c | c | c | p{2.5 in} | p{2.5 in} | }


I dislike that, because then the original \textwidth definition is being totally overridden, meaning I need to hard code widths for the first 4 columns as well, and I miss out on LaTeX's ability to juggle widths dynamically to make stuff look nice. For reference, leaving all widths undefined and using "L" for both of the final columns crushes the second to last column down in a way that looks awkward, because the final column has a lot more text in it.

-
–  Peter Grill Oct 2 '12 at 19:34

## 2 Answers

You can use tabularx to have a "flexible width" column (type X) for your last column, say:

\documentclass{article}
\usepackage[margin=1cm]{geometry}% http://ctan.org/pkg/geometry
\usepackage{tabularx}% http://ctan.org/pkg/tabularx
\usepackage{lipsum}% http://ctan.org/pkg/lipsum
\begin{document}
\noindent\begin{tabularx}{\textwidth}{|*{4}{c|}p{2.5in}|X|}
Here & is & some & text & \lipsum[1-3] & \lipsum[2-4]
\end{tabularx}
\end{document}​


This will not break over the page boundary.

geometry and lipsum was only loaded for this example.

-
Brilliant, that did the trick. Thanks! –  Eric Oct 2 '12 at 19:35
personally I prefer tabulary to tabularx:-) –  David Carlisle Oct 2 '12 at 19:58

If you want to stick with tabulary, you might like to try tuning the column widths by setting the last two to 'L' and tweaking the lengths \tymin and \tymax. I'm not exactly sure how this works (I've only just read it in the tabulary manual).

Try something like:

\tymax=2.5in


and see what happens.

-