# Table where last column has width so the whole table not bigger than line [duplicate]

This question already has an answer here:

I want to have table, for instance with 3 columns, where the first two columns will have natural width, so the text doesn't wrap and the last column will wrap if the whole table will be bigger than text width. Is it possible in latex?

--------------------------------------- // line
| a | asfafasf | asfasfasff           |
| b | saf      | asafasfsafasfasfasfs |
| c | safasf   | asasffsaf asfasf     |
|   |          | asasfsafaf           |


## marked as duplicate by Alenanno, Mico tables StackExchange.ready(function() { if (StackExchange.options.isMobile) return; $('.dupe-hammer-message-hover:not(.hover-bound)').each(function() { var$hover = $(this).addClass('hover-bound'),$msg = $hover.siblings('.dupe-hammer-message');$hover.hover( function() { $hover.showInfoMessage('', { messageElement:$msg.clone().show(), transient: false, position: { my: 'bottom left', at: 'top center', offsetTop: -7 }, dismissable: false, relativeToBody: true }); }, function() { StackExchange.helpers.removeMessages(); } ); }); }); May 2 '15 at 10:03

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

• tabular* and tabularx take a width argument. But maybe a p-column might be more suited. Always hard to say, when the example contains just random strings of letters. – Johannes_B May 2 '15 at 9:28

## 1 Answer

tabularx can do this job with its X column. I have added \raggedright so the complex words don't trouble.

\documentclass{article}
\usepackage{tabularx}
\begin{document}
\noindent
\begin{tabularx}{\textwidth}{ll>{\raggedright\arraybackslash}X}
a & asfafasf & asfasfasff          \\
b & saf      & asafasfsafasfasfasfs \\
c  & safasf   & asasffsaf asfasf asasfsafaf   asasfsafaf   asasfsafaf   asasfsafaf   asasfsafaf   asasfsafaf   asasfsafaf   asasfsafaf        \\
\end{tabularx}
\end{document}