## Wednesday, May 4, 2011

### Latex: how to control the column width of a table

Latex will automatically adjust the width of a cell in a table, but it will not consider the width of the page, so sometimes parts of the table are out of the page. If you want to control the column width of a table, you may want to use p option instead of l, c or r for left, center or right alignment.

For example:

\begin{table}[ht]\centering\begin{tabular}{|c|p{2cm}|p{1cm}|}\hlinea & bb & c\\\hline\end{tabular}\end{table}Good luck!

#### 12 comments:

Anonymous said...

Many thanks for your post. Saved my day^^

Manjunath Prasad's said...

Thank you for the post. this is very useful for me

Manjunath Prasad's said...
This comment has been removed by the author.
Anonymous said...

Doesnt work!

Anonymous said...

Thanks! It works.

Nikolas Kleanthous said...

Thank you!

Anonymous said...

Thanks a lot

Nitin Pasumarthy said...

https://en.wikibooks.org/wiki/LaTeX/Tables

Unknown said...

Wow, thanks so much. That saved my life today!!
Thanks!

Anonymous said...

Thanks! Saved me so much time!!!

melificious said...

It was a great help! thanks!

Nikolay ebardeev said...

You made some first rate factors there. I seemed on the internet for the problem and found most individuals will go along with with your website. gsn casino