调整表格以适合页面(代码来自tablesgenerator.com)

调整表格以适合页面(代码来自tablesgenerator.com)

我正在使用 tablesgenerator 网站创建一个有 5 列和 ~40 行的表格:

在此处输入图片描述

我得到以下 LaTeX 代码:

% Please add the following required packages to your document preamble:
% \usepackage{lscape}
% \usepackage{longtable}
% Note: It may be necessary to compile the document several times to get a multi-page table to line up properly
\begin{landscape}
\begin{longtable}[c]{lllll}
\caption{xxxxxxxxx xxxxxxxxx xxxxx xxx xxxxx xxxxxxx}
\label{tab:my-table}\\
\hline
\textbf{xxxxxxxxx} & \textbf{xxxx xxxxx} & \textbf{xxxx xxxxxx} & \textbf{xxxx xxxx xxxxxxxxxx} & \textbf{xxxxxx} \\ \hline
\endfirsthead
%
\multicolumn{5}{c}%
{{\bfseries Table \thetable\ continued from previous page}} \\
\hline
\textbf{xxxxxxxxx} & \textbf{xxxx xxxxx} & \textbf{xxxx xxxxxx} & \textbf{xxxx xxxx xxxxxxxxxx} & \textbf{xxxxxx} \\ \hline
\endhead
%
\hline
\endfoot
%
\endlastfoot
%
\textbf{xxxxxxxxxxx} &  &  &  &  \\
xxxxxxxxxx xxxxxxxxxx xxxx xxxxx xxxxxxxx xxxxxxxxxxxx xxxxxxxx xxxxxx xxxx & Individual & Day & 30th June 2000 & xxxxx \\
xxxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxx xxxxx xxxxx xx & Individual & Day & 30th June 2000 & xxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxx & Individual & Day & 30th June 2000 & xxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx & Organisation & Year & 2017 & xxxxxxxx xxxxxx xxx \\
\textbf{xxxxxxxxxxx} &  &  &  &  \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxx & Organisation & Month & 30th June 2000 & xxxxxxxx xxxxxxx xxxx xxxxx xxxxxxx \\
\textbf{xxxxxxxxxxxx} &  &  &  &  \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxx & Organisation & Month & 1st July 2010 & xxxx xxxxx xxxx xxxxxxxxxx xxxxxxxx xxxxxxxxxxx \\
xxxxxx xxxxxx xxxxxxxxxx xxxxxxx & Organisation & Month & 1st July 2010 & xxxx xxxx xxxxxx xxxxxxxxxxxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxx & Organisation & Year & 30th June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxx & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xx & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30th June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30th June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx x & Organisation & xxxxxxx/xxx xxxxxxxx & 30th June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxx & Geography & xxxxxxx/xxx xxxxxxxx & 30th June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxx & Geography & xxx/xx xxxxxxxxx xxxx & 30th June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxx & Geography & xxxxxxx xxxxxx & 2011 & xxxxxxxx \\
xxxxxxx xxxxxx xxx & Organisation & Quarter & February 2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxx & Organisation & Month & 1st July 2010 & xxxx xxxx xxxxxx xxxxxxxxxxxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxxxx & Organisation & Month & 1st July 2010 & xxxx xxxx xxxxxx xxxxxxxxxxxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxxxxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxxxxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxxxxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxx & Organisation & Day & 30th June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xx & Individual & Day & 30th June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxx & Individual & xxxxxxx xxxxx xxx & 1999 & xxxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxxxxxxxx xxxxxxxxxx xxxxxxxxxxxxx xx'sxxxxxx xxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\ \hline
\end{longtable}
\end{landscape}

但是,这是我的文档中的结果:

在此处输入图片描述

在此处输入图片描述

有人知道如何调整表格以使其适合页面并同时允许文档的边距吗?

另外,有谁知道如何从第二页的标题中删除粗体并将其更改为具有相同标题但带有继续的标题,如下所示“xxxxxxxxx xxxxxxxxx xxxxx xxxxx xxxxxxx(继续)”

我的序言:

\documentclass[12pt, a4paper, twoside]{report} 
\usepackage{graphicx}
\usepackage{blindtext}
\usepackage[margin=2cm] {geometry}
\usepackage{setspace}
\linespread{1.5}
\usepackage[round]{natbib}
\usepackage{acronym}
\usepackage{rotating}
\usepackage{comment}
\usepackage{url}
\usepackage{tikz}
\usetikzlibrary{arrows}
\usepackage{tcolorbox}
\usepackage{ragged2e}
\usepackage{booktabs}
\usepackage[normalem]{ulem}
\useunder{\uline}{\ul}{}
\usepackage{lscape}
\usepackage{longtable}
\graphicspath {{./Sect1-Figures/} {./Sect2-Figures/}}
\setcounter{tocdepth}{4}
\setcounter{secnumdepth}{5}

编辑 我的代码基于@Mico 的代码:

\begin{landscape}

%\begin{sidewaystable}

\renewcommand\baselinestretch{1}\selectfont
\small


%\rowcolors{2}{white}{gray!10}
\begin{xltabular}{\mylen}{@{} LlllL @{}} % automatic line-breaking in cols 1 and 5

\caption{xxxxxxxxx xxxxxxxxx xxxxx xxx xxxxx xxxxxxx}
\label{tab:my-table}\\
\toprule
\textbf{xxxxxxxxx} & \textbf{xxxx xxxxx} & \textbf{xxxx xxxxxx} & \textbf{xxxx xxxx xxxxxx} & \textbf{xxxxxx} \\ 
\midrule
\endfirsthead

\multicolumn{5}{@{}l}%
{\normalsize{\textbf{Table \thetable:} xxxxxxxxx xxxxxxxxx xxxxx xxx xxxxx xxxxxxx (Continued)}} \\[0.5ex]
\toprule
\textbf{xxxxxxxxx} & \textbf{xxxx xxxxx} & \textbf{xxxx xxxxxx} & \textbf{xxxx xxxx xxxxxx} & \textbf{xxxxxx} \\ 
\midrule
\endhead

\midrule
\multicolumn{5}{r@{}}{\footnotesize(continued on next page)}
\endfoot

\bottomrule
\endlastfoot

%% body of table
\multicolumn{5}{@{}l}{\textbf{xxxxxxxxxxx}} \\[0.25ex]
xxxxxxxxxx xxxxxxxxxx xxxx xxxxx xxxxxxxx xxxxxxxxxxxx xxxxxxxx xxxxxx xxxx & Individual & Day & 30 June 2000 & xxxxx \\
xxxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxx xxxxx xxxxx xx & Individual & Day & 30 June 2000 & xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxx & Individual & Day & 30 June 2000 & xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx & Organisation & Year & 2017 & xxxxxxxx xxxxxx xxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxx & Organisation & Mon & 30 June 2000 & xxxxxxxx xxxxxxx xxxx xxxxx xxxxxxx \\

\addlinespace 
\multicolumn{5}{@{}l}{\textbf{xxxxxxxxxxxx}} \\[0.25ex]
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxxx xxxx xxxxxxxxxx xxxxxxxx xxxxxxxxxxx \\
xxxxxx xxxxxx xxxxxxxxxx xxxxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxx & Organisation & Year & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xx & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx x & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx & Geography & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Geography & xxx/xx xxxxxxxxx xxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx & Geography & xxxxxxx xxxxxx & 2011 & xxxxxxxx \\
xxxxxxx xxxxxx xxx & Organisation & Quarter & February 2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxx & Organisation & Day & 30 June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xx & Individual & Day & 30 June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxx & Individual & xxxxxxx xxxxx xxx & 1999 & xxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xx'sxxxxxx xxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\ 
%\hline
\end{xltabular}
\end{landscape}

%\end{sidewaystable}

我得到:

在此处输入图片描述

问题 1:我怎样才能将标题从第二页移至页面的中心?

问题2:我不能使用横向页面,因为我需要打印此文档。如果我替换landscape为,sidewaystable我会得到下面的结果。你知道如何解决这个问题吗?

在此处输入图片描述

答案1

我的主要建议是您 (a) 从 a 切换longtablexltabular环境并且 (b) 在第 1 列和第 5 列中启用自动换行。在第 1 列和第 5 列中启用自动悬挂缩进会增加不错的效果。

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

\documentclass{article} % or some other suitable document class
\usepackage[letterpaper,margin=2.5cm]{geometry} % set page parameters suitably
\usepackage{pdflscape}
\usepackage{xltabular} % instead of 'longtable'
\usepackage{ragged2e}  % for '\RaggedRight' macro
\newcolumntype{L}{>{\RaggedRight\hangafter1\hangindent1em}X}
\usepackage{booktabs} % for well-spaced horizontal rules (instead of \hline)
\newlength\mylen
\setlength\mylen{\textheight} % save value of '\textheight' param.

\begin{document}


\begin{landscape}

\begin{xltabular}{\mylen}{@{} LlllL @{}} % automatic line-breaking in cols 1 and 5

\caption{xxxxxxxxx xxxxxxxxx xxxxx xxx xxxxx xxxxxxx}
\label{tab:my-table}\\
\toprule
\textbf{xxxxxxxxx} & \textbf{xxxx xxxxx} & \textbf{xxxx xxxxxx} & \textbf{xxxx xxxx xxxxxx} & \textbf{xxxxxx} \\ 
\midrule
\endfirsthead

\multicolumn{5}{@{}l}%
{Table \thetable, continued from previous page} \\[0.5ex]
\toprule
\textbf{xxxxxxxxx} & \textbf{xxxx xxxxx} & \textbf{xxxx xxxxxx} & \textbf{xxxx xxxx xxxxxx} & \textbf{xxxxxx} \\ 
\midrule
\endhead

\midrule
\multicolumn{5}{r@{}}{\footnotesize(cont'd on next page)}
\endfoot

\bottomrule
\endlastfoot

%% body of table
\multicolumn{5}{@{}l}{\textbf{xxxxxxxxxxx}} \\[0.25ex]
xxxxxxxxxx xxxxxxxxxx xxxx xxxxx xxxxxxxx xxxxxxxxxxxx xxxxxxxx xxxxxx xxxx & Individual & Day & 30 June 2000 & xxxxx \\
xxxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxx xxxxx xxxxx xx & Individual & Day & 30 June 2000 & xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxx & Individual & Day & 30 June 2000 & xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx & Organisation & Year & 2017 & xxxxxxxx xxxxxx xxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxx & Organisation & Mon & 30 June 2000 & xxxxxxxx xxxxxxx xxxx xxxxx xxxxxxx \\

\addlinespace 
\multicolumn{5}{@{}l}{\textbf{xxxxxxxxxxxx}} \\[0.25ex]
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxxx xxxx xxxxxxxxxx xxxxxxxx xxxxxxxxxxx \\
xxxxxx xxxxxx xxxxxxxxxx xxxxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxx & Organisation & Year & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xx & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx x & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx & Geography & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Geography & xxx/xx xxxxxxxxx xxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx & Geography & xxxxxxx xxxxxx & 2011 & xxxxxxxx \\
xxxxxxx xxxxxx xxx & Organisation & Quarter & February 2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxx & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxxxx & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxx & Organisation & Day & 30 June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xx & Individual & Day & 30 June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxx & Individual & xxxxxxx xxxxx xxx & 1999 & xxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xx'sxxxxxx xxx & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\ 
%\hline
\end{xltabular}
\end{landscape}

\end{document}

附录回答 OP 的后续问题,标记为“Q1”和“Q2”。

问题 1:如何将标题从第二页开始移动到页面的中心?

群内\endhead\multicolumn{5}{@{}l}改成\multicolumn{5}{c}

Q2:我不能使用横向页面,因为我需要打印此文档。如果我将横向页面替换为横向页面,则会出现以下情况。您知道如何解决这个问题吗?

横向格式的页面将自动正确打印。您无需执行任何特殊操作。它们显示的事实在屏幕上嗯,横向格式不会影响它们在纸上的打印方式。

答案2

我宁愿longtable使用tabularay包。它提供了其他功能,包括用于编写长表的简单代码...

\documentclass{article}  
\usepackage{geometry}  
\usepackage{pdflscape}
\usepackage{ragged2e} 
\usepackage{xcolor}  
\usepackage{tabularray} % instead of 'longtable'
\UseTblrLibrary{booktabs} 
\NewTableCommand\subtitle[1][0pt]{%
        \SetRow{abovesep+=#1}
        \SetCell[c=4]{l, font=\small\itshape\bfseries}
                                  }
\SetTblrStyle{contfoot-text}{font=\footnotesize\itshape}
                            
\begin{document}
    \begin{landscape}
\begin{longtblr}[
caption = {xxxxxxxxx xxxxxxxxx xxxxx xxx xxxxx xxxxxxx},
  label = {tab:my-table}
                ]{colspec = {@{} X[l, font=\linespread{0.84}\selectfont,
                                      cmd=\RaggedRight\hangafter1\hangindent1em]
                                 ll
                                 X[0.5, l] 
                                 X[l, font=\linespread{0.84}\selectfont,
                                      cmd=\RaggedRight\hangafter1\hangindent1em] 
                             @{}},
                  row{1}  = {font=\bfseries},
                  row{2}  = {belowsep=0.5pt},
                  row{3-Y} = {rowsep=0pt},
                  row{even[4]} = {abovesep=1ex},
                  rowhead = 1} 
    \toprule
xxxxxxxxx   & xxxx xxxxx    & xxxx xxxxxx   & xxxx xxxx xxxxx  & xxxxxx    \\
    \midrule
%% body of table
\subtitle  xxxxxxxxxxxx
            &               &               &               &           \\
xxxxxxxxxx xxxxxxxxxx xxxx xxxxx xxxxxxxx xxxxxxxxxxxx xxxxxxxx xxxxxx xxxx 
            & Individual    & Day           & 30 June 2000  & xxxxx     \\
xxxxxxx xxxxxxxx xxxxxx xxxxxx xxxxxx xxxxx xxxxx xx 
            & Individual    & Day           & 30 June 2000  & xxxxx     \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxx 
            & Individual    & Day           & 30 June 2000  & xxxxx     \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx 
            & Organisation & Year & 2017 & xxxxxxxx xxxxxx xxx \\
%%%%
\subtitle[5pt]  xxxxxxxxxxxx
            &               &               &               &           \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxx 
            & Organisation & Mon & 30 June 2000 & xxxxxxxx xxxxxxx xxxx xxxxx xxxxxxx \\
%%%%
\subtitle[5pt]  xxxxxxxxxxxx    
            &               &               &               &           \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxx 
            & Organisation & Mon & 1 July 2010 & xxxx xxxxx xxxx xxxxxxxxxx xxxxxxxx xxxxxxxxxxx \\
xxxxxx xxxxxx xxxxxxxxxx xxxxxxx 
            & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxx & Organisation 
            & Year & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx 
            & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xx 
            & Organisation & Year & 1999/2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx 
            & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx x 
            & Organisation & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx 
            & Geography & xxxxxxx/xxx xxxxxxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx 
            & Geography & xxx/xx xxxxxxxxx xxxx & 30 June 2000 & xxxx xxxxxx xxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx 
            & Geography & xxxxxxx xxxxxx & 2011 & xxxxxxxx \\
xxxxxxx xxxxxx xxx 
            & Organisation & Quarter & February 2000 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xxxxxxxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxx 
            & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx 
            & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxx 
            & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxx 
            & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxx 
            & Organisation & Quarter & 2011/2012 Q3 & xxxxx xxxxxxxx xxxxxx xxxxxx xxxxxxx xx \\
xxxxxxx xxxxxx xxxxxxxxxxxx 
            & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxxxx 
            & Organisation & Mon & 1 July 2010 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xx 
            & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx 
            & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxx 
            & Organisation & Quarter & 2011/2012 Q4 & xxxx xxxx xxxxxx xxxxxxxxx xxxxxxxxx x xxxxxxx xxxxxxxxxx xxxxxxxxxx xxxxxxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxx 
            & Organisation & Day & 30 June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xx 
            & Individual & Day & 30 June 2000 & xxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxx 
            & Individual & xxxxxxx xxxxx xxx & 1999 & xxxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxx 
            & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxx 
            & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xxxxxxxxxx xxxxxxx 
            & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
xxxxxxx xxxxxx xxxxxxxxx xxxxxx xxxxxxxxxx xxxxxxxxxxxxx xx'sxxxxxx xxx 
            & Individual & Year & 1999 & xxxxxx xxxx xxxxx \\
    \bottomrule
\end{longtblr}
    \end{landscape}
\end{document}

在此处输入图片描述

在此处输入图片描述

在此处输入图片描述

相关内容