Hallo
Ich habe mir eine Tabellendarstellung gebastelt, die es ermöglicht, eine Tabelle fortlaufend zeilenweise als Teiltabelle auszugeben. Sie kann dabei unterbrochen werden und an beliebiger Stelle fortgeführt werden..
Dazu brauche ich derzeit eine Tabellenpräamble, welche die Daten im Befehl \def\cell{...} auflistet, um sie später im Text abzurufen.
Den dazu verwendeten Befehl
Code:
\cb[1,1,0]{\thetable,\thetabcols,\thetablines}
(Die Zahlenwerte sind hier nur Platzhalter) würde ich gerne vereinfachen, sodaß man nicht immer die Werte [1,1,0] selbst eingeben muß. Hat jemand dazu eine Idee?
Weiterführend soll es möglich sein, mehrere Tabellen vorzudefinieren und später im Text abzurufen, zum Beispiel, um Teilabschnitte und Auszüge verschiedener Tabellen miteinander zu vergleichen.
tablenumbers.sty
Code:
\RequirePackage{longtable}
\newcounter{tablines}%
\newcounter{tabcols}%
\newcounter{tabpage}%
\newcounter{maxcols}%
\setcounter{maxcols}{3}
\newdimen\colwidth \colwidth=1em%
\newcommand{\thehead}{}%
\newcommand{\tabend}{ \end{longtable}}
\parindent=0pt%
\def\cb[#1,#2,#3]#4{\ifnum\thetable=#1\ifnum\thetabcols=#2\ifnum\thetablines=#3
{#4}\else \fi\fi\fi}%
\def\cell{}%
\def\numbercol{r}
\newcommand{\tabhead}{\begin{longtable}[l]{{\numbercol}*{\themaxcols}{p{\colwidth}}}\setcounter{table}{1}\\\caption{Fortlaufende
Tabelle }\\\thehead \endfirsthead \thehead\endhead \setcounter{tabcols}{0}%
}%
\def\tabline{\thetablines
&\cell&\cell&\cell&\cell
\setcounter{tabcols}{0}\stepcounter{tablines}\\}
\def\tabliner[#1]{
\ifnum #1>0 \tabline \else \fi
\ifnum #1>1 \tabline \else \fi
\ifnum #1>2 \tabline \else \fi
\ifnum #1>3 \tabline \else \fi
\ifnum #1>4 \tabline \else \fi
\ifnum #1>5 \tabline \else \fi
\ifnum #1>6 \tabline \else \fi
\ifnum #1>7 \tabline \else \fi
\ifnum #1>8 \tabline \else \fi
\ifnum #1>9 \tabline \else \fi
\ifnum #1>10 \tabline \else \fi
\ifnum #1>11 \tabline \else \fi
\ifnum #1>12 \tabline \else \fi
\ifnum #1>13 \tabline \else \fi}
%
tablenumbers.tex
Code:
\documentclass[a4paper]{article}%
\usepackage[utf8]{inputenc}%
\usepackage[ngerman]{babel}%
\usepackage{tablenumbers,longtable,blindtext}%
\setcounter{maxcols}{4}
\colwidth=2cm
\def\cell{%
\cb[1,1,0]{\thetable,\thetabcols,\thetablines}\cb[1,2,0]{\thetable,\thetabcols,\thetablines}\cb[1,3,0]{\thetable,\thetabcols,\thetablines}%
\cb[1,1,1]{\thetable,\thetabcols,\thetablines}\cb[1,2,1]{\thetable,\thetabcols,\thetablines}%
\cb[1,1,2]{\thetable,\thetabcols,\thetablines}\cb[1,2,2]{\thetable,\thetabcols,\thetablines}%
\cb[1,1,3]{\thetable,\thetabcols,\thetablines}\cb[1,2,3]{\thetable,\thetabcols,\thetablines}%
\cb[1,1,4]{\thetable,\thetabcols,\thetablines}\cb[1,2,4]{\thetable,\thetabcols,\thetablines}%
\cb[1,1,5]{\thetable,\thetabcols,\thetablines}\cb[1,2,5]{\thetable,\thetabcols,\thetablines}%
\stepcounter{tabcols}}
\begin{document}%
\blindtext
\tabhead%
\tabliner[2]
\tabend
\blindtext
\tabhead%
\tabliner[2]
\tabend
\tabhead%
\tabliner[2]
\tabend
\listoftables
\end{document}%
Lesezeichen