TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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.