Generaltabulary and textwidth

LaTeX specific issues not fitting into one of the other forums of this category.
Post Reply
jpreisser
Posts: 3
Joined: Thu Apr 17, 2008 2:09 am

tabulary and textwidth

Post by jpreisser »

For some reason, I can use the /textwidth argument with tabularx but no with tabulary. In fact, it doesn't seem as if the <length> argument makes any difference when I use tabulary. Anybody have an idea why?

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

User avatar
gmedina
Posts: 2313
Joined: Wed Jul 11, 2007 11:45 pm

tabulary and textwidth

Post by gmedina »

The following example shows that, at least for me, it makes a difference:

Code: Select all

\documentclass{article}
\usepackage{tabulary}

\begin{document}

\begin{table}[!ht]
  \centering
  \begin{tabulary}{5cm}{JJ}
    \hline
    test text test text test text test text  test text test text & 
    test text test text test text test text  test text test text \\ \hline
  \end{tabulary}
\end{table}

\vspace{1cm}

\begin{table}[!ht]
  \centering
  \begin{tabulary}{\textwidth}{JJ}
    \hline
    test text test text test text test text  test text test text & 
    test text test text test text test text  test text test text \\ \hline
  \end{tabulary}
\end{table}

\end{document}
I would venture to say that maybe the length of the contents of the columns of your table is responsible for your undesired behavior. The tabulary package calculates the column widths based on the contents of the table.

However, posting a minimal working example showing this undesired behaviour could help us to give more effective advise.
1,1,2,3,5,8,13,21,34,55,89,144,233,...
ggretton
Posts: 3
Joined: Wed Jan 09, 2008 6:37 pm

tabulary and textwidth

Post by ggretton »

I've also just been finding that tabulary doesn't quite behave as I expect. To take up the previous example (upper table in example below), everything seems to work just fine. But delete "text test text" from the end of each cell and suddenly the table doesn't seem to observe the intended width (bottom table in example).

Code: Select all

\documentclass{article}
\usepackage{tabulary}

\begin{document}

\begin{table}[!ht]
  \centering
  \begin{tabulary}{5cm}{JJ}
    \hline
    test text test text test text test text  test text test text & test text test text test text test text  test text test text \\ \hline
  \end{tabulary}
\end{table}

\begin{table}[!ht]
  \centering
  \begin{tabulary}{5cm}{JJ}
    \hline
    test text test text test text test text  test & test text test text test text test text  test \\ \hline
  \end{tabulary}
\end{table}

\end{document}
ggretton
Posts: 3
Joined: Wed Jan 09, 2008 6:37 pm

Re: tabulary and textwidth

Post by ggretton »

Sorry, just realised that tabulary works just fine in the example I've just posted with the basic article class. Unfortunately it doesn't in the documentclass that I'm using.
Post Reply