Eigene Frage mit eigener Antwort. Ich möchte in longtable die Funktionen der sections(part bis subparagraph) nutzen und pro Tabelle eine Inhaltsverzeichnis ausgeben. Wie geht das?

gefragt 06 Mai '14, 03:00

ctansearch's gravatar image

ctansearch
(ausgesetzt)
Akzeptiert-Rate: 18%

bearbeitet 07 Mai '14, 02:06


Open in writeLaTeX
    \documentclass[10pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage{longtable,array}
\usepackage[ngerman]{babel}
\usepackage{longtable}
\newwrite\thetabcontents
\immediate\openout\thetabcontents=\jobname.tcon
\newcounter {tabpart}
\newcounter {tabsection}
\newcounter {tabsubsection}[tabsection]
\newcounter {tabsubsubsection}[tabsubsection]
\newcounter {tabparagraph}[tabsubsubsection]
\newcounter {tabsubparagraph}[tabparagraph]
\makeatletter
\renewcommand\thetabpart {\@Roman\c@tabpart}
\renewcommand\thetabsection{\@arabic\c@tabsection}
\renewcommand\thetabsubsection{\thetabsection.\@arabic\c@tabsubsection}
\renewcommand\thetabsubsubsection{\thetabsubsection.\@arabic\c@tabsubsubsection}
\newcommand{\thetabcontent}{\textbf{\tablename\ \thetable}\par \immediate\closeout\thetabcontents
\input\jobname.tcon \setcounter{tabpart}{0}}
\makeatother
\newcommand\tabpart[1]{\refstepcounter{tabpart}\setcounter{tabsection}{0}\vskip0.5\baselineskip\huge{\textsl{\thetabpart. #1}}\vskip0.5\baselineskip
  \immediate\write\thetabcontents{\thetabpart. #1 \hfill \par}\normalsize}
\newcommand\tabsection[1]{\refstepcounter{tabsection}\vskip0.5\baselineskip\Large{\textsl{\thetabsection. #1}}\vskip0.5\baselineskip
  \immediate\write\thetabcontents{\thetabsection. #1 \hfill \par}\normalsize}
\newcommand\tabsubsection[1]{\refstepcounter{tabsubsection}\vskip0.5\baselineskip\large{\textsl{\thetabsubsection. #1}}\vskip0.5\baselineskip
  \immediate\write\thetabcontents{\thetabsubsection. #1 \hfill \par}\normalsize}
\newcommand\tabsubsubsection[1]{\refstepcounter{tabsubsubsection}\vskip0.5\baselineskip\normalsize{\textsl{\thetabsubsubsection. #1}}\vskip0.5\baselineskip
  \immediate\write\thetabcontents{\thetabsubsubsection. #1 \hfill \par}\normalsize}
\newcommand\tabparagraph[1]{\vskip0.5\baselineskip\normalsize{\textsl{#1 }}
\normalsize}
\newcommand\tabsubparagraph[1]{\vskip0.5\baselineskip\normalsize{\textsl{#1 }}\normalsize}
\begin{document}
\begin{longtable}{|p{4cm}|p{4cm}|p{4cm}|}\caption{Longtable mit Sections}\\
\tabpart{Part} Erster Teil
\tabsection{Tabsection}Some Text. 
\tabsubsection{Tabsubsection}Some Text. Some Text.
\tabsubsubsection{Tabsubsubsection}Some Text. Some Text. Some Text. Some Text. Some Text.
\tabparagraph{Tabparagraph}Some Text. Some Text.
\tabsubparagraph{Tabsubparagraph}Some Text. Some Text. Some Text. Some Text. Some Text.&
\tabpart{Part}Zweiter Teil
\tabsection{Tabsection}Some Text. Some Text.
\tabsubsection{Tabsubsection}Some Text. Some Text. Some Text. Some Text. Some Text.
\tabsubsubsection{Tabsubsubsection}Some Text. Some Text.
\tabparagraph{Tabparagraph}Some Text.
\tabsubparagraph{Tabsubparagraph}Some Text. Some Text.&
\tabpart{Part}Dritter Teil
\tabsection{Tabsection}Some Text.Some Text.
\tabsubsection{Tabsubsection}Some Text. Some Text.
\tabsubsubsection{Tabsubsubsection}Some Text. Some Text.
\tabparagraph{Tabparagraph}Some Text. Some Text. Some Text. Some Text.
\tabsubparagraph{Tabsubparagraph}Some Text. Some Text. Some Text. Some Text. Some Text.\\
\end{longtable}
\thetabcontent \newpage
\end{document}
Permanenter link

beantwortet 06 Mai '14, 03:01

ctansearch's gravatar image

ctansearch
(ausgesetzt)
Akzeptiert-Rate: 18%

bearbeitet 06 Mai '14, 19:18

Deine Antwort
Vorschau umschalten

Folgen dieser Frage

Per E-Mail:

Wenn sie sich anmelden, kommen Sie für alle Updates hier in Frage

Per RSS:

Antworten

Antworten und Kommentare

Markdown-Grundlagen

  • *kursiv* oder _kursiv_
  • **Fett** oder __Fett__
  • Link:[Text](http://url.com/ "Titel")
  • Bild?![alt Text](/path/img.jpg "Titel")
  • nummerierte Liste: 1. Foo 2. Bar
  • zum Hinzufügen ein Zeilenumbruchs fügen Sie einfach zwei Leerzeichen an die Stelle an der die neue Linie sein soll.
  • grundlegende HTML-Tags werden ebenfalls unterstützt

Frage-Themen:

×117
×57
×39

gestellte Frage: 06 Mai '14, 03:00

Frage wurde gesehen: 6,959 Mal

zuletzt geändert: 07 Mai '14, 02:06