4

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

  • 2
    tabulary and use L or S instead of X does exactly that. – David Carlisle Jan 16 '17 at 13:16
4

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.