Anzeige:
Ergebnis 1 bis 7 von 7

Thema: Caption bei einer Longtable untendrunter

  1. #1
    Registrierter Benutzer
    Registriert seit
    23.06.2010
    Beiträge
    142

    Caption bei einer Longtable untendrunter

    Ich weis, es ist unüblich, aber ich habe bei mir die Tabellenbeschriftungen
    unterhalb der Tabellen. Das ist auch kein Problem, sofern die Tabelle nicht
    über mehrere Seiten geht.
    Nun möchte ich in einer longtable-Umgebung die Beschriftung
    auf der ersten Seite unterhalb der Tabelle anbringen.
    Hat jemand eine Idee?
    Hier mein Beispiel, die Beschriftung erscheint zwar wie ich es möchte,
    aber im Tabellenverzeichnis taucht die Tabelle zweimal auf:

    Code:
    \documentclass[12pt,a5paper,ngerman]{article}
    \usepackage{babel}
    \usepackage[latin1]{inputenc}
    \usepackage[T1]{fontenc}        %% enable EC-Fonts (extended cork)
    \usepackage{longtable}          %% for long tables
    \usepackage{booktabs}           % table enhancements (excel2latex tool use it)
    \usepackage{caption}            %% for long tables
    %% ---
    \begin{document}
    \listoftables
    
    \section{Frage}
    \label{sec:uberschrift}
    Wie bekomme ich bei einer mehrseitigen Tabelle den zweiten Tabelleneintrag aus dem 
    Tabellenverzeichnis raus?
    Bzw. wie kriege ich die erste Tabellenbeschriftung unter den Tabellenteil auf 
    der ersten Tabellenseite
    \vspace{2cm}
    \begin{longtable}[l]{lll} 
    \captionsetup{position=bottom}
    \toprule
    eins & zwei & drei \tabularnewline
    \midrule
    \endfirsthead
    \caption*{Fortsetzung}\tabularnewline
    \addlinespace
    \toprule
    eins & zwei & drei \tabularnewline
    \midrule
    \endhead
    \midrule
    \caption{Beschriftung}\tabularnewline
    \endfoot
    % --- Begin lastfoot
    \addlinespace
    \bottomrule
    \caption*{\tablename \arabic{table}: Beschriftung}\tabularnewline
    \endlastfoot
    % ---
    %% --- Begin Table body --- ###########################################################################################
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    \end{longtable}
    \end{document}
    Geändert von ellocco (07-12-2010 um 16:52 Uhr)

  2. #2
    Registrierter Benutzer Avatar von voss
    Registriert seit
    10.04.2005
    Beiträge
    5.045
    Zitat Zitat von ellocco Beitrag anzeigen
    Ich weis, es ist unüblich, aber ich habe bei mir die Tabellenbeschriftungen
    unterhalb der Tabellen. Das ist auch kein Problem, sofern die Tabelle nicht
    über mehrere Seiten geht.
    Nun möchte ich in einer longtable-Umgebung die Beschriftung
    auf der ersten Seite unterhalb der Tabelle anbringen.
    wo soll denn der Sinn sein, sie nur auf der ersten Seite haben zu wollen?
    Und gewöhne dir bitte mal an, überflüssiges Zeug bei den Beispielen wegzulassen.

    Code:
    \documentclass[a5paper]{article}
    \usepackage{longtable}
    \usepackage{booktabs}
    
    \newif\ifcap \captrue
    
    \begin{document}
    \listoftables
    
    \begin{longtable}[l]{lll} \toprule
    eins & zwei & drei \tabularnewline
    \midrule
    \endhead
    \midrule
    \ifcap\caption{Beschriftung}\global\capfalse\fi
    \tabularnewline
    \endfoot
    \bottomrule
    \endlastfoot
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    \end{longtable}
    
    \end{document}
    HErbert

  3. #3
    Registrierter Benutzer
    Registriert seit
    23.06.2010
    Beiträge
    142
    Zitat Zitat von voss Beitrag anzeigen
    wo soll denn der Sinn sein, sie nur auf der ersten Seite haben zu wollen?
    Und gewöhne dir bitte mal an, überflüssiges Zeug bei den Beispielen wegzulassen.
    HErbert
    Hallo Herbert!
    Danke für Dein Beispiel!
    Ich finde es auch besser, wenn die Beschriftung auch auf den anderen Seiten
    erscheint, so war es ja auch in meinem Beispiel. Bloß im Inhaltsverzeichnis
    soll sie nur einmal erscheinen.
    Ich hatte auch gleich an eine IF-Struktur gedacht, aber mit \ifthenelse
    aus dem Paket ifthen habe ich es nicht hinbekommen.
    Und nun versuche ich gerade Dein Beispiel zu erweitern, aber meine
    TeX-Kenntnisse reichen nicht aus. Hier die veränderte Zeile:
    Code:
    \ifcap\caption{Beschriftung}\global\capfalse \else \caption*{\tablename{} \arabic{table}: Beschriftung mitte} \fi
    Aber leider klappt es nicht, es sind nach wie vor mehrere Einträge
    vorhanden :-(

    Zitat Zitat von voss Beitrag anzeigen
    Und gewöhne dir bitte mal an, überflüssiges Zeug bei den Beispielen wegzulassen.
    HErbert
    Du bist aber streng. Ich fand es schon ziemlich geschrumpft.

  4. #4
    Registrierter Benutzer Avatar von mechanicus
    Registriert seit
    10.07.2008
    Ort
    Hamburg
    Beiträge
    3.944
    Hi,

    ein einfaches endlastfoot genügt, wenn es nur über zwei Seiten geht.

    Gruß
    Marco

    Code:
    \documentclass[a5paper]{article}
    \usepackage{longtable}
    \usepackage{booktabs}
    
    \newif\ifcap \captrue
    
    \begin{document}
    \listoftables
    
    \begin{longtable}[l]{lll} \toprule
    eins & zwei & drei \tabularnewline
    \midrule
    \endhead
    \midrule
    \caption{Beschriftung}
    \tabularnewline
    \endfoot
    %tabularnewline
    \endlastfoot
    \bottomrule
    \endlastfoot
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    \end{longtable}
    
    \end{document}

  5. #5
    Registrierter Benutzer
    Registriert seit
    23.06.2010
    Beiträge
    142
    Zitat Zitat von mechanicus Beitrag anzeigen
    Hi,

    ein einfaches endlastfoot genügt, wenn es nur über zwei Seiten geht.

    Gruß
    Marco
    Mein Beispiel ging absichtlich über drei Seiten und bis auf den doppelten
    Tabellenverzeichniseintrag sieht es auch so aus wie ich es mir vorstelle.

  6. #6
    Registrierter Benutzer Avatar von sommerfee
    Registriert seit
    02.07.2006
    Beiträge
    1.603
    Zitat Zitat von ellocco Beitrag anzeigen
    Ich finde es auch besser, wenn die Beschriftung auch auf den anderen Seiten
    erscheint, so war es ja auch in meinem Beispiel. Bloß im Inhaltsverzeichnis
    soll sie nur einmal erscheinen.
    Exakt dieser Anwendungsfall wird in der Dokumentation zum caption-Paket bei den Erläuterungen zu \captionlistentry behandelt.

    Kurzform: Man nimmt im Fuß \caption[]{...}, damit kein Eintrag im Tabellenverzeichnis gesetzt wird. Den setzt man stattdessen einfach mit \captionlistentry einmalig selber, direkt vor der ersten Tabellenzeile.

    Dein Beispiel entsprechend umgemodelt (und das umständliche \caption*{\tablename{} \arabic{table}: Beschriftung} durch \caption[]{Beschriftung} ersetzt):

    Code:
    \documentclass[12pt,a5paper,ngerman]{article}
    \usepackage{babel}
    \usepackage[latin1]{inputenc}
    \usepackage[T1]{fontenc}        %% enable EC-Fonts (extended cork)
    \usepackage{longtable}          %% for long tables
    \usepackage{booktabs}           % table enhancements (excel2latex tool use it)
    \usepackage{caption}            %% for long tables
    %% ---
    \begin{document}
    \listoftables
    
    \section{Frage}
    \label{sec:uberschrift}
    Wie bekomme ich bei einer mehrseitigen Tabelle den zweiten Tabelleneintrag aus dem 
    Tabellenverzeichnis raus?
    Bzw. wie kriege ich die erste Tabellenbeschriftung unter den Tabellenteil auf 
    der ersten Tabellenseite
    \vspace{2cm}
    \begin{longtable}[l]{lll} 
    \captionsetup{position=bottom}
    \toprule
    eins & zwei & drei \tabularnewline
    \midrule
    \endfirsthead
    \caption*{Fortsetzung}\tabularnewline
    \addlinespace
    \toprule
    eins & zwei & drei \tabularnewline
    \midrule
    \endhead
    \midrule
    \caption[]{Beschriftung}\tabularnewline
    \endfoot
    % --- Begin lastfoot
    \addlinespace
    \bottomrule
    \caption[]{Beschriftung}\tabularnewline
    \endlastfoot
    % ---
    %% --- Begin Table body --- ###########################################################################################
    \captionlistentry{Beschriftung}
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    1 & 2 & 3 \tabularnewline  
    \end{longtable}
    \end{document}
    Liebe Grüße,
    Axel
    Geändert von sommerfee (07-12-2010 um 19:12 Uhr) Grund: Beispiel ergänzt

  7. #7
    Registrierter Benutzer
    Registriert seit
    23.06.2010
    Beiträge
    142
    Zitat Zitat von sommerfee Beitrag anzeigen
    Exakt dieser Anwendungsfall wird in der Dokumentation zum caption-Paket bei den Erläuterungen zu \captionlistentry behandelt.
    ...
    Liebe Grüße,
    Axel
    Irgendsowas hatte ich auch im Hinterkopf und habe auch die Doku studiert,
    aber ich war offensichtlich zu ungeduldig und habe es überlesen.

    Danke für die schnelle Hilfe :-)

    P.S.:
    Das Paket caption hat mir gleich von Anfang an gut gefallen, ich finde, es ist ist eins
    der wichtigsten 20 Pakete für LaTeX.
    Geändert von ellocco (07-12-2010 um 22:08 Uhr)

Lesezeichen

Berechtigungen

  • Neue Themen erstellen: Nein
  • Themen beantworten: Nein
  • Anhänge hochladen: Nein
  • Beiträge bearbeiten: Nein
  •