5

I am trying to create a table that fits on the page and is not wider even though the contens are. So I used tabularx:

\begin{table}[H]
\centering    
\begin{tabularx}{\textwidth}{cccX}
    1 & 2 & 3 &    4 \\ \hline      
    from & INOUT & Wavelength & very long text very long text very long text very long text very long text very long text very long text very long text                 
\end{tabularx}
\end{table}

This works but now the table is always as wide as my page even when the content would allow a smaller table. So I would like to set the maximum table width and not a constant width. Is there something that can do this?

Regards

1
  • 2
    tabulary and use L or S instead of X does exactly that. Jan 16, 2017 at 13:16

1 Answer 1

5

If you use tabulary instead of tabularx and use L or S instead of X, then it will do exactly this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .