I am trying to align the columns of multiple tables. I know I can use p column format to fix column widths but I would prefer that TeX automatically figure out the widths for me. I was hoping to:
- output one table with all rows of each subsequent table so that the column widths of the combined table would be automatically good for all the subsequent tables
- then output each subsequent table using the same settings and
- figure out some way in which the first combined table could be generated but not visible.
Here is my attempt. The first combined table uses \savetabu to save the settings and then each subsequent table uses \usetabu to retrieve them. Unfortunately this does not work as I had hoped. The columns do not line up as the output below (after the code) shows. Does anyone have a method of accomplishing this?
\documentclass{article}
\usepackage{tabu}
\begin{document}
Output both tables together as one table and then output each
individual table. We had hoped that this would cause the subsequent
tables to be the same width as the first since the first contains all
columns of the subsequent tables but it seems that that does not work.
\begin{center}
\begin{tabu}{ll}\savetabu{mytabu2}
1 & 2 \\
3 & 4 \\
abcdefghijklmnopqrstuvwxyz & 10 \\
5 & 6 \\
\end{tabu}
\end{center}
\begin{center}
\begin{tabu}{\usetabu{mytabu2}}
1 & 2 \\
3 & 4 \\
\end{tabu}
\end{center}
\begin{center}
\begin{tabu}{\usetabu{mytabu2}}
abcdefghijklmnopqrstuvwxyz & 10 \\
5 & 6 \\
\end{tabu}
\end{center}
\end{document}
Here is the output:



p{<len>}specifier for the first column; for the numeric columns you might use theScolumn type of thesiunitxpackage, possibly with a prespecifiedtable-formatproviso. Without more specific information about the broad structure of the table(s), it's going to be quite difficult to provide specific advice. – Mico Jul 16 '12 at 18:24