Graphics, Figures & TablesDistribute width of 3 column table evenly

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
bgreen
Posts: 34
Joined: Wed Nov 22, 2023 11:02 am

Distribute width of 3 column table evenly

Post by bgreen »

Hello,

I have found my first foray into tables a challenge. I'm hoping for advice on what hopefully is a simple task. Below is a 3 column table. I want the the three columns to have the same width. Any assistance is appreciated.

Code: Select all

\documentclass{article}
\usepackage{hyperref}
\usepackage{tabulary,booktabs}
\setlength{\belowcaptionskip}{1ex}
\begin{document}

\begin{table}[hbp!]
\caption{Board Specifications. \label{tabLabel}}
\footnotesize    
\begin{tabulary}{\linewidth}{@{}lLL@{}}\toprule
Parameter & 4'6" 3-fin Bonzer & 5'0" 5-fin Bonzer  \\\midrule
Widest point      & 21-1/2"     & 21-1/2" \\
Nose             & 20-1/4"     & 20-1/4" \\
Tail             & 20-1/8"     & 20"     \\
Tailblock(pod)   & 16-3/4"     & 17"     \\
Thickness        & 1-1/2 to 1-11/16th" max  & 1-1/2 to 1-11/16th" max   \\
Center fin (fin box)  & 6-inch True Ames Bonzer center fin     & 6-inch True Ames Bonzer center fin \\
Bonzer keel runner side fins (glassed on) & 10-inch length at base x 2-1/2 inch high trailing edge & Front fins: 5-1/2 inch base x 2 inch trailing edge
Aft fins: 6 inch base x 2-1/2 inch trailing edge
\\
 \\\bottomrule
\end{tabulary}
\end{table}
\end{document}

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org
LaTeX books
bgreen
Posts: 34
Joined: Wed Nov 22, 2023 11:02 am

Distribute width of 3 column table evenly

Post by bgreen »

Oddly, when I compiled this code in a small file, the columns were not evenly distributed.

When I copied the code into a much larger document, it compiled as I hoped.

For my learning, any advice on enhancing the code I supplied, would be helpful.
User avatar
Stefan Kottwitz
Site Admin
Posts: 10311
Joined: Mon Mar 10, 2008 9:44 pm

Distribute width of 3 column table evenly

Post by Stefan Kottwitz »

I recommend to use tabularx instead of tabulary:

Code: Select all

\documentclass{article}
\usepackage{hyperref}
\usepackage{tabularx,booktabs}
\setlength{\belowcaptionskip}{1ex}
\begin{document}

\begin{table}[hbp!]
\caption{Board Specifications. \label{tabLabel}}
\footnotesize    
\begin{tabularx}{\linewidth}{@{}XXX@{}}\toprule
Parameter & 4'6" 3-fin Bonzer & 5'0" 5-fin Bonzer  \\\midrule
Widest point      & 21-1/2"     & 21-1/2" \\
Nose             & 20-1/4"     & 20-1/4" \\
Tail             & 20-1/8"     & 20"     \\
Tailblock(pod)   & 16-3/4"     & 17"     \\
Thickness        & 1-1/2 to 1-11/16th" max  & 1-1/2 to 1-11/16th" max   \\
Center fin (fin box)  & 6-inch True Ames Bonzer center fin     & 6-inch True Ames Bonzer center fin \\
Bonzer keel runner side fins (glassed on) & 10-inch length at base x 2-1/2 inch high trailing edge & Front fins: 5-1/2 inch base x 2 inch trailing edge
Aft fins: 6 inch base x 2-1/2 inch trailing edge
\\
 \\\bottomrule
\end{tabularx}
\end{table}
\end{document}
tabularx distributes the widths evenly, while tabulary makes it proportional to the natural with of the widest item in a column.

Szefan
LaTeX.org admin
Post Reply