Equal cell width in Latex tables

By thurnherr

Latex will automatically adjust the width of a cell in a table. If you wish to have a table where each cell in a row has the same width, you would use the p option instead of l, c or r for left, centre or right alignment.

Example:
\begin{table}[ht]
\centering
\begin{tabular}{|p{1cm}|p{1cm}|}
\hline
a&bbb\\
\hline
a&bbb\\
a&bbb\\
\hline
\end{tabular}
\end{table}

Tags: , ,

7 Responses to “Equal cell width in Latex tables”

  1. dector Says:

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

  2. Fwd: Equal cell width right and centre aligned content « Blog on Latex Matters Says:

    [...] Fwd: Equal cell width right and centre aligned content One of my last posts was on how to define the width of a column in a table (see here). [...]

  3. thurnherr Says:

    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

  4. jayeeta Says:

    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.

  5. jackie Says:

    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!

    • thurnherr Says:

      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.

  6. Braamstruik Says:

    Cool! Thank you very much

Leave a Reply