我正在尝试创建一个长表并将其水平放置。我想调整表格以使其适合页面(水平)。目前是这样的:
我想让它看起来像这样:
另外,有没有办法(如第二张图片所示)将页码放在该位置(居中)。请注意,此表占很多页,以下是代码:
\usepackage{rotating}
\usepackage{longtable}
\usepackage{pdflscape}
\begin{landscape}
\scriptsize
\begin{longtable}{*{8}{|c|} }
\hline
Item Number & Item Description & Quantity & Capacity & Operating
Conditions & Design Conditions & Construction Materials & Special
Requirements \\
\hline
TK-100 & Feed 1 Storage Tank & 1 & 8147.6 m\textsuperscript{3} & 25
bar, 25°C & 31.25 bar, 31.25°C & Steel & Spherical \\
\hline
TK-101 & Feed 2 Storage Tank& 1 & 37728.7 m\textsuperscript{3} & 25
bar, 25°C & 31.25 bar, 31.25°C & Steel & Spherical\\
\hline
...
\end{longtable}
\end{landscape}
任何帮助,将不胜感激!
答案1
尝试:
\documentclass{article}
\usepackage{ltablex, makecell}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand\theadfont{\footnotesize}
\renewcommand\theadgape{}
\setcellgapes{3pt}
\usepackage{siunitx}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\footnotesize
\makegapedcells
\begin{tabularx}{\linewidth}{|*{4}{c|} *{4}{X|} }% in case that you like to havew centered cells' content, use "C" instead of "X"
\hline
\thead{Item\\ Number}
& \thead{Item\\ Description}
& \thead{Quantity}
& \thead{Capacity}
& \thead{Operating\\ Conditions}
& \thead{Design\\ Conditions}
& \thead{Construction\\ Materials}
& \thead{Special\\ Requirements} \\
\endfirsthead
\hline
\thead{Item\\ Number}
& \thead{Item\\ Description}
& \thead{Quantity}
& \thead{Capacity}
& \thead{Operating\\ Conditions}
& \thead{Design\\ Conditions}
& \thead{Construction\\ Materials}
& \thead{Special\\ Requirements} \\
\endhead
\hline
TK-100 & Feed 1 Storage Tank & 1 & \SI{8147.6}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
\hline
TK-101 & Feed 2 Storage Tank & 1 & \SI{37728.7}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
\hline
... & & & & & & & \\
\hline
\end{tabularx}
\end{landscape}
\end{document}
包ltablex
结合longtable
和tabularx
。对于单位我建议使用siunitx
。对于列标题使用\thead
包中的宏makecell
我不会使用垂直线,并且将水平线的使用量减少到最低限度。相反,我\hline
宁愿使用包中的规则booktabs
(\toprule
,,以及在每个适合行之后插入):midrule
bottomrule
\addlinespace
\documentclass{article}
\usepackage{booktabs, ltablex, makecell}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\renewcommand\theadfont{\footnotesize}
\renewcommand\theadgape{}
\setcellgapes{3pt}
\usepackage{siunitx}
\usepackage{pdflscape}
\begin{document}
\begin{landscape}
\footnotesize
\makegapedcells
\begin{tabularx}{\linewidth}{@{}
*{4}{c}
*{4}{X} }
\toprule
\thead{Item\\ Number}
& \thead{Item\\ Description}
& \thead{Quantity}
& \thead{Capacity}
& \thead{Operating\\ Conditions}
& \thead{Design\\ Conditions}
& \thead{Construction\\ Materials}
& \thead{Special\\ Requirements} \\
\midrule
\endfirsthead
\toprule
\thead{Item\\ Number}
& \thead{Item\\ Description}
& \thead{Quantity}
& \thead{Capacity}
& \thead{Operating\\ Conditions}
& \thead{Design\\ Conditions}
& \thead{Construction\\ Materials}
& \thead{Special\\ Requirements} \\
\midrule
\endhead
TK-100 & Feed 1 Storage Tank & 1 & \SI{8147.6}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
TK-101 & Feed 2 Storage Tank & 1 & \SI{37728.7}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
TK-100 & Feed 1 Storage Tank & 1 & \SI{8147.6}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
TK-101 & Feed 2 Storage Tank & 1 & \SI{37728.7}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
TK-100 & Feed 1 Storage Tank & 1 & \SI{8147.6}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
\addlinespace
TK-101 & Feed 2 Storage Tank & 1 & \SI{37728.7}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
TK-100 & Feed 1 Storage Tank & 1 & \SI{8147.6}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
TK-101 & Feed 2 Storage Tank & 1 & \SI{37728.7}{\metre\cubic} & \SI{25}{\bar}, \SI{25}{\celsius} & \SI{31.25}{\bar}, \SI{31.25}{\celsius} & Steel & Spherical \\
... & & & & & & & \\
\bottomrule
\end{tabularx}
\end{landscape}
\end{document}