Wie kann man diese Tabelle seitenumbrechbar machen?

Wie kann man diese Tabelle seitenumbrechbar machen?

Ich habe derzeit eine Tabelle, die etwas gewachsen ist und nicht mehr in den vorgesehenen Bereich passt. Da ich davon ausgehe, dass diese Tabelle in Zukunft weiter wachsen wird, muss ich sie seitenumbrechbar machen, ohne dabei ihren aktuellen Stil zu verlieren. Es gibt viele Beiträge darüber, wie man seitenumbrechbare Tabellen erstellt, aber ich konnte keine der Lösungen verwenden, die ich gefunden habe, weil ich entweder Fehler bekam, die ich nicht verstehen konnte, oder die endgültige Ausgabe nicht wie beabsichtigt aussah.

Ich teile unten ein MWE, das meine aktuelle (nicht zerstörbare) Tabelle sowie einen Screenshot der von ihr erzeugten Ausgabe zeigt. Das MWE erstellt eine Listenumgebung, die ich dann bei Bedarf aufrufe. Mein Ziel istum diese Ausgabe zu replizieren, aber sicherzustellen, dass die Tabelle korrekt umbricht (anstatt zu springen), wenn sie einen Seitenumbruch erreicht.

\documentclass[a4paper]{article}

\begin{document}

\newenvironment{entrylist}{%
  \noindent
  \begin{tabular*}{\textwidth}{@{\extracolsep{\fill}}rl}
}{%
  \end{tabular*}
}
\newcommand{\entry}[4]{%
    \parbox[t]{1.75cm}{#1\raggedleft}&\parbox[t]{\dimexpr\textwidth-2\tabcolsep-1.75cm}{\strut%
    \textbf{#2}%
    \hfill%
    {\footnotesize #3\par\strut}%
    #4\vspace{\parsep}%
  }\\}

\begin{entrylist}

  \entry
    {XXXX}
    {Fancy stuff 1}
    {Fancy stuff 1}
    {Fancy stuff 1}

  \entry
    {YYYY}
    {Fancy stuff 2}
    {Fancy stuff 2}
    {Fancy stuff 2}

  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {Fancy stuff 3}
    
\end{entrylist}

\end{document}

Bildbeschreibung hier eingeben

Vielen Dank an alle für Ihre Zeit.

Antwort1

Sie müssen nicht das ganze Zeug in eine tabellarische Umgebung kapseln. Sie können das Format jedes einzelnen \entrydurch Ihre Makros definieren. Das \smallskipFolgende \hboxist natürlich seitenumbruchfähig.

\newdimen\colsep \colsep=1em
\def\topbox#1#2{\vtop{\parindent=0pt \hsize=\dimexpr#1\relax #2}}
\def\entry#1#2#3#4{\par
   \hbox{\topbox{1.75cm}{#1\raggedleft}\kern\colsep
         \topbox{\hsize-2\colsep-1.75cm}{{\bf#2}\hfill {\footnotesize#3}\endgraf#4\strut}}
   \smallskip
}

  \entry
    {XXXX}
    {Fancy stuff 1}
    {Fancy stuff 1}
    {Fancy stuff 1}

  \entry
    {YYYY}
    {Fancy stuff 2}
    {Fancy stuff 2}
    {Fancy stuff 2}

  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {Fancy stuff 3}

Antwort2

Ich denke, alles was Sie tun müssen, ist

  • das Paket laden longtableund die Anweisungen erteilen \setlength\LTleft{0pt}und \setlength\LTright{0pt}in der Präambel und

  • Ersetzen Sie in der Definition der Umgebung \begin{tabular*}{\textwidth}„mit \begin{longtable}“ und „ \end{tabular*}mit“ .\end{longtable}entrylist

Optional können Sie die \noindentDirektive am Anfang der Umgebungsdefinition löschen entrylist.

longtableWeitere Informationen zu den Längenparametern finden Sie \LTleftin Abschnitt 5 „Anpassung“ des Benutzerhandbuchs \LTright.

Antwort3

Verwenden longtable.

\documentclass[a4paper]{article}
\usepackage{longtable,array}

\usepackage{lipsum} % for nonsense text
\usepackage{showframe} % for showing the page boundaries

\newlength{\entrylistwidth}
\setlength{\entrylistwidth}{1.75cm}
\newenvironment{entrylist}{%
  \begin{longtable}{
    @{}
    w{l}{\entrylistwidth}
    p{\dimexpr\textwidth-2\tabcolsep-\entrylistwidth}
    @{}
  }
}{\end{longtable}}

\newcommand{\entry}[4]{%
  #1 & \textbf{#2}\hfill{\footnotesize #3\par}#4\\\noalign{\vspace{\parsep}}%
}

\begin{document}

\begin{entrylist}

  \entry
    {XXXX}
    {Fancy stuff 1}
    {Fancy stuff 1}
    {\lipsum[1][1-3]}

  \entry
    {YYYY}
    {Fancy stuff 2}
    {Fancy stuff 2}
    {\lipsum[2][1-3]}

  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
  \entry
    {ZZZZ}
    {Fancy stuff 3}
    {Fancy stuff 3}
    {\lipsum[3][1-3]}
    
\end{entrylist}

\end{document}

Bildbeschreibung hier eingeben

verwandte Informationen