14 Comments

  1. dector

    This is true, but the p{} command implies left alignment.
    What if you want a fixed width column _and_ center (or right) alignment?

  2. Hi Dector,

    Thanks for your comment, you are perfectly right. As this is not an easy thing to do and it is best explained with some pieces of latex code, let me write a new post on that issue.

    Hope you don’t mind,
    Tom

  3. jayeeta

    Hi,
    I found a round-about way. I used {c c c c} but for the first row I inserted \hspace {1cm} on either side of each entry. This way I could introduce space as much I wished to, and also had the text centered. Once done for the first row u do not need to repeat it for the following rows.

  4. jackie

    Hi,

    I was wondering, is there was a way to define an overall table width without affect text sizes? Any info would help immensely, thanks!

    • Hey Jackie,

      If I understand your question correctly, you can use a fixed cell width to produce a fixed table width, where the text size will not influence the size as described in the post.

      Ok?
      Tom.

  5. Yuko Aihara

    Hi,
    You can use array package and do as follows:

    \newcolumntype{C}{>{\centering\arraybackslash}m{2.5cm}<{}}
    \begin{tabular}{|*{3}{C|}}
    	\hline
    	I & love & you. \\ \hline
    	You & love & me too. \\ \hline
    \end{tabular}

    Thank you

    • Hi Gideon,

      Nice, I didn’t know that, thanks! There seems to be a slight difference though. Setting tabcolsep keeps the cell width flexible. In other words, when the content takes more space, the width is automatically adjusted. With p{width} however, the cell width will not change, no matter what.

      Best, Tom.

  6. Hi Gideon,

    Hi Gideon,
    Thanks a lot. I struggled half a day to change column width.Once again thanks.
    C

Leave a Reply