2

I'm trying to make a table with a column of a certain width. Using basic {tabular} and the p parameter creates column of the given width plus some extra millimeters (for example p{50mm} leads to width of about 55 mm when printed). When I try {tabularx} and add a specific width for the whole table, it works just fine, without any added width on print (so I guess the problem probably isn’t in printer settings).

\documentclass{article}
\usepackage[czech]{babel}
\usepackage[utf8]{inputenc}

\begin{document}
    \begin{tabular}{|p{50mm}|c|c|c|c|}
        \hline
        1&2&3&4&5\\
        \hline
        1&2&3&4&5\\
        \hline
        1&2&3&4&5\\
        \hline
    \end{tabular}
\end{document}

Thanks.

0

1 Answer 1

1

You have to subtract the column separator from your length.

column separator

\documentclass{article}
\usepackage[czech]{babel}
\usepackage[utf8]{inputenc}

\begin{document}
    \begin{tabular}{|p{\dimexpr 50mm-2\tabcolsep}|c|c|c|c|}
        \hline
        1&2&3&4&5\\
        \hline
        1&2&3&4&5\\
        \hline
        1&2&3&4&5\\
        \hline
    \end{tabular}
\end{document}

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .