我正在排版一份页边距很窄的文档。当我必须输入表格时,我会使用\begin{adjustwidth}
该changepage
软件包中的表格,使其在右侧突出显示。
在下面的 MWE 中,我使用tabularx
排版表 1,将允许的文本宽度增加 20%,并从左边距增加相同的厘米数。
但是,我有一张很长的表格,将跨越 2 页,我必须使用该longtable
包来排版它,但是这个adjustwidth
技巧对这张表格(表 2)不起作用。
有什么想法可以做到这一点吗?我尝试使用ltxpackage
,它允许X
在 longtables 上使用列说明符,但我得到了相同的结果。
以下是 MWE:
\documentclass[11pt]{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tabularx, longtable, ctable, changepage, geometry}
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=3.5cm, % Inner margin
outer=4.8cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
marginpar=3.8cm,
%showframe, % Uncomment to show how the type block is set on the page
}
\begin{document}
\blindtext\\
TABLE 1
\begin{table}[htb]
\begin{adjustwidth}{-2.361474cm}{0cm}
\begin{tabularx}{1.2\textwidth}{r>{\raggedright}X>{\raggedright}X} \FL
a & b & c \ML
a & b & c \NN
a & b & c \LL
\end{tabularx}
\end{adjustwidth}
\end{table}
TABLE 2
\begin{table}[htb]
\begin{adjustwidth}{-2.361474cm}{0cm}
\begin{longtable}{p{1.5cm}p{2.5cm}p{2.5cm}p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}}
\multicolumn{7}{l}{Table continued} \\
\endhead
\\
a & b & c & d & e & f & g \ML
\endfirsthead
\multicolumn{7}{r}{\textit{(continued on the next page)}}
\endfoot
a & b & c & d & e & f & g \NN
a & b & c & d & e & f & g \LL
\end{longtable}
\end{adjustwidth}
\end{table}
\end{document}
非常感谢
答案1
\documentclass[11pt]{book}
\usepackage[english]{babel}
\usepackage{blindtext}
\usepackage{tabularx, longtable, ctable, changepage, geometry}
\geometry{
paper=a4paper, % Change to letterpaper for US letter
inner=3.5cm, % Inner margin
outer=4.8cm, % Outer margin
bindingoffset=.5cm, % Binding offset
top=1.5cm, % Top margin
bottom=1.5cm, % Bottom margin
marginpar=3.8cm,
showframe, % Uncomment to show how the type block is set on the page
}
\begin{document}
\blindtext% never put \\ at the end of a paragraph
% never put longtable in a table\begin{table}[htb]
% \begin{adjustwidth}{-2.361474cm}{0cm}
\setlength\LTleft{-2.5cm}% 2.5cm into the left margin
\setlength\LTright{0pt plus 1fill minus 1fill}% whatever is needed at the right
\begin{longtable}{p{1.5cm}p{2.5cm}p{2.5cm}p{2cm}p{1.5cm}p{1.5cm}p{1.5cm}}
\multicolumn{7}{l}{Table continued} \\
\endhead
\\
a & b & c & d & e & f & g \ML
\endfirsthead
\multicolumn{7}{r}{\textit{(continued on the next page)}}
\endfoot
a & b & c & d & e & f & g \NN
a & b & c & d & e & f & g \LL
\end{longtable}
%\end{adjustwidth}
%\end{table}
\end{document}