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

share|improve this question
    
Welcome to TeX.SE. –  Peter Grill Oct 2 '12 at 19:34

2 Answers 2

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

enter image description here

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

share|improve this answer
    
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.

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.