[OS X TeX] Where is the mistake?
Gewitterbukk
gewitterbukk at me.com
Wed Apr 15 16:54:49 CEST 2009
Howdy!
I'd like to design an environment to match the captionwidth to the tablewidth. The caption should be above the table. Here the code.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newlength{\Tabellenbreite}
\newcommand{\Tabelle}[3]{%
\settowidth{\Tabellenbreite}{#3}%
\setcapwidth[c]{\Tabellenbreite}%
\caption[#1]{#2}%
#3%
}
\newsavebox{\Tabellenbox}
\newsavebox{\ParA}
\newsavebox{\ParB}
\newenvironment{TabelleSetztCaptionBreite}[2]{%
\sbox{\ParA}{#1}%
\sbox{\ParB}{#2}%
\begin{lrbox}{\Tabellenbox}%
}{%
\end{lrbox}%
\global\setbox\Tabellenbox=\box\Tabellenbox%
\aftergroup\SetzeTabellenbox{\usebox{\ParA}}{\usebox{\ParB}}%
}
\newcommand{\SetzeTabellenbox}[2]{%
\Tabelle{#1}{#2}{\usebox{\Tabellenbox}}}
\begin{table}
\centering
\begin{TabelleSetztCaptionBreite}{Caption-Eintrag}{Dies ist eine Tabelle und so weiter und so weiter und so weiter \dots}
\begin{tabular}{*{10}{l}}
1 & 2 & 3 & 4 & 6 & 7 & 8 & 9 & 10\\
1 & 2 & 3 & 4 & 6 & 7 & 8 & 9 & 10\\
1 & 2 & 3 & 4 & 6 & 7 & 8 & 9 & 10\\
\end{tabular}
\end{TabelleSetztCaptionBreite}
\end{table}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Ideas?
The error message is
! Incomplete \iffalse; all text was ignored after line 107.
! Emergency stop.
! ==> Fatal error occurred, no output PDF file produced!
Thanks a lot!
More information about the macostex-archives
mailing list