为什么我的标题顶部规则、中间规则和底部规则超出了文本主体的限制?我该怎么做才能使这些行/规则与主体文本限制完美对齐?
谢谢。
% PREAMBLE
\documentclass[a4paper,oneside,centered,noparindent,noparskip]{bookest}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{nicefrac}
\usepackage{palatino} % Font for document
\usepackage{hyperref} % Hyperlinks
\usepackage{titletoc} % Customization of TOC LOF LOT
\usepackage{tocloft} % Customization of TOC LOF LOT
\usepackage[table,xcdraw]{xcolor} % For shading in tables
\usepackage{color}
\usepackage{pdfcolmk}
\usepackage{multirow}
\usepackage{ltxtable} % Instead of Longtable package %\caption package is offered with \Longtable
\usepackage{textcomp}
\usepackage{array} % For long tables, to define width of columns
\usepackage{booktabs} % Nicer spacing in columns
\usepackage{siunitx} % To write Celsius, etc.
\usepackage{enumitem} % To create item lists
\usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
\usepackage{blindtext}
\usepackage{caption} % To change way captions are labelled
\usepackage{etoolbox} % To make table footnote font smaller
\appto\TPTnoteSettings{\footnotesize}
\usepackage{showframe}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
{\small
\begin{longtable}{r>{\raggedright\arraybackslash}p{4.5cm}p{2.1cm}>{\raggedright\arraybackslash}p{7.3cm}}
\caption{wegergegeg} \label{Rulers} \\
\toprule
No. & Name \& Title & Dates & Events \\
\midrule
\endfirsthead
\caption*{\autoref{Rulers} (\textit{Continued})} \\
\toprule
No. & Name \& Title & Dates & Events \\
\midrule
\endhead
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\ \bottomrule
\end{longtable}
}
\end{document}
答案1
我建议用 的版本longtable
进行替换,并将最后的列类型替换为。tabularx
ltablex
X
p{7.3cm}
\keepXColumns
如果已经使用了该命令,这将使用完整的线宽。
手动调整列宽容易出错而且很繁琐。
\documentclass[a4paper,oneside,centered,noparindent,noparskip]{bookest}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{nicefrac}
\usepackage{palatino} % Font for document
\usepackage{hyperref} % Hyperlinks
\usepackage{titletoc} % Customization of TOC LOF LOT
\usepackage{tocloft} % Customization of TOC LOF LOT
\usepackage[table,xcdraw]{xcolor} % For shading in tables
\usepackage{color}
\usepackage{pdfcolmk}
\usepackage{multirow}
\usepackage{ltablex}
\usepackage{ltxtable} % Instead of Longtable package %\caption package is offered with \Longtable
\usepackage{textcomp}
\usepackage{array} % For long tables, to define width of columns
\usepackage{booktabs} % Nicer spacing in columns
\usepackage{siunitx} % To write Celsius, etc.
\usepackage{enumitem} % To create item lists
\usepackage{threeparttable} % For table notes + To allow footnote material to stay with the tabular environment
\usepackage{blindtext}
\usepackage{caption} % To change way captions are labelled
\usepackage{etoolbox} % To make table footnote font smaller
\appto\TPTnoteSettings{\footnotesize}
\usepackage{showframe}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\keepXColumns
\begin{document}
{\small
\begin{tabularx}{\linewidth}{r>{\raggedright\arraybackslash}p{4.5cm}p{2.1cm}X}
\caption{wegergegeg} \label{Rulers} \\
\toprule
No. & Name \& Title & Dates & Events \\
\midrule
\endfirsthead
\caption*{\autoref{Rulers} (\textit{Continued})} \\
\toprule
No. & Name \& Title & Dates & Events \\
\midrule
\endhead
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\
1& eytwety & etwet & etwt \\ \bottomrule
\end{tabularx}
}
\end{document}