最佳实践是在横向模式下在整个页面宽度上制作一个表格和一个长表格

最佳实践是在横向模式下在整个页面宽度上制作一个表格和一个长表格

我想知道在横向模式下通过自动调整列大小在整个页面宽度上制作表格和长表格的最佳做法是什么。

的确:

  1. 如果有几行,我想使用表格

  1. 例如,当我有很多行时,我想将表格正确地分成两页。

评估了几种解决方案后,我并没有得到我想要的结果。

例如,使用上面的代码,我的表被拆分了,我看不到最后一列:

\documentclass[%
paper=A4,                   % paper size --> A4 is default in Germany
twoside=true,               % onesite or twoside printing
openright,                  % doublepage cleaning ends up right side
parskip=full,               % spacing value / method for paragraphs
chapterprefix=true,         % prefix for chapter marks
12pt,                       % font size
headings=normal,            % size of headings
bibliography=totoc,         % include bib in toc
listof=totoc,               % include listof entries in toc
titlepage=on,               % own page for each title page
captions=tableabove,        % display table captions above the float 
draft=false,                % value for draft version
]{scrbook}%

\begin{document}

\chapter{TEST}

\begin{landscape}
\begin{table}[!h]
\small  % Switch from 12pt to 11pt; otherwise, table won't fit
\setlength\LTleft{0pt}            % default: \parindent
\setlength\LTright{0pt}           % default: \fill
\begin{longtable}{@{\extracolsep{\fill}}c*{6}{c}}
\toprule
{\bfseries Column 1 Text Text Text} &  {\bfseries Column 2 Text} &  
{\bfseries 
Column 3 Text} &  {\bfseries Column 4} &  {\bfseries Column 5 Text} &  

{\bfseries Column 6Text Text} &  {\bfseries Column 7 Text Text}\\
\midrule
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text 
Text Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text 
Text Text Text& Text & Text Text & Text \\
\bottomrule  
\end{longtable}
\caption{}
\label{table:chap2}
\end{table}        
\end{landscape}
\end{document}

结果

还有很多线条

在此处输入图片描述

答案1

使用 longtable

\documentclass[%
twoside=true,               % onesite or twoside printing
openright,                  % doublepage cleaning ends up right side
parskip=full,               % spacing value / method for paragraphs
chapterprefix=true,         % prefix for chapter marks
12pt,                       % font size
headings=normal,            % size of headings
bibliography=totoc,         % include bib in toc
listof=totoc,               % include listof entries in toc
titlepage=on,               % own page for each title page
captions=tableabove,        % display table captions above the float
draft=false,                % value for draft version
]{scrbook}%
%----------------------
\usepackage[top=2.5cm,bottom=2.5cm,left=2.5cm,right=2cm,headsep=15pt,footskip=27pt,a4paper]{geometry}
\usepackage{hyperref}
\usepackage{pdflscape}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{makecell}
\renewcommand\theadfont{\bfseries}
%----------------------
\begin{document}

\chapter{TEST}
In table \ref{table:chap2}...

\begin{landscape}
\begin{longtable}{ccccccc}
  \caption{Caption for longtable}\label{table:chap2}\\
  \toprule
{\bfseries Column 1 Text} &  {\bfseries Column 2} & {\bfseries Column 3 Text Text} & {\bfseries Column 4 Text} &  {\bfseries Column 5} & {\bfseries Column 6} &  {\bfseries Column 7}\\
  \midrule
  \endfirsthead
  \toprule
{\bfseries Column 1 Text} &  {\bfseries Column 2} & {\bfseries Column 3 Text Text} & {\bfseries Column 4 Text} &  {\bfseries Column 5} & {\bfseries Column 6} &  {\bfseries Column 7}\\
  \midrule
  \endhead
  \bottomrule
  \endfoot
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text
Text Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text
Text Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text
Text Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text
Text Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
Text Text Text & Text Text& Text Text Text  Text Text Text& Text Text
Text Text Text& Text & Text Text & Text \\
\end{longtable}
\end{landscape}

\end{document}

结果

长表结果

相关内容