Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

In this answer the following code appears. The idea is that the initial table sets up the column widths used by the subsequent tables. The initial table itself is not supposed to be shown. Its only there to set up the widths which \usetabu retrieves. Unresolved from that post is whether there is any way to generate the first table but not have it visible or take up any space.

\documentclass{article}
\usepackage{tabu}
\begin{document}

\begin{center}
\begin{tabu} spread 0pt  {|X[-1]|X[-1]|}\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}

Output (this shows the three tables but what is desired is that only the last two are shown and the first runs so that it sets up the column widths but is not visible).

enter image description here

share|improve this question

1 Answer 1

up vote 10 down vote accepted

Put it in a box, but don't use the box.

\documentclass{article}
\usepackage{tabu}
\newbox\mybox %New
\begin{document}

\sbox\mybox{ %New
\begin{tabu} spread 0pt  {|X[-1]|X[-1]|}\savetabu{mytabu2}
1 & 2 \\
3 & 4 \\
abcdefghijklmnopqrstuvwxyz & 10 \\
5 & 6 \\
\end{tabu}
}

\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}
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.