2

I want to create a tabular in LaTeX that has following layout:

|-1cm-|-remaining size / 3-|-remaining size / 3-|-remaining size / 3-|

The first column has to be small (like 1 cm). The other three columns should all have the same size. I don't want to hard-code the width of these columns. The width shall be automatically adapted based on the width of the whole table.

I haven't found a solution so far. I think it could work by defining a custom column type with the array package but I could not find enough documentation.

Can anyone tell me how to do this and also provide a link or a short explanation?

Thanks

1 Answer 1

2

Depending on the width of the table, tabularx is your friend here, using X columntype.

The first column can be done with p{1cm} for example, if left alignment in cells is required.

The X columntype will distribute the remaining space equally

I left the vertical lines for demonstration only.

\documentclass{article}

\usepackage{tabularx}

\begin{document}

\begin{tabularx}{\linewidth}{|p{1cm}|*{3}{X|}}
\hline
Foo & Foobar & Foobar & Foobar \tabularnewline
\hline
\end{tabularx}

\end{document}

Please note that due to the \tabcolsep width, there is an extra spacing of 2\tabcolsep for each column, if not specified otherwise!

If this is not wanted, use @{}p{1cm}@{} instead of p{1cm}, for example!

enter image description here

You must log in to answer this question.

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