如何避免 latex longtable 使用整个页面的宽度?

如何避免 latex longtable 使用整个页面的宽度?

当我使用具有少量列的 longtable 时,它​​会使用整个页面的宽度来显示表格。

这是包含三列的结果:

在此处输入图片描述

我的目标是让表格仅使用足以容纳三列的空间。有人知道如何做到这一点吗?

这是我使用的代码:

\documentclass[12pt,]{article}
\usepackage{lmodern}
\usepackage{amssymb,amsmath}
\usepackage{ifxetex,ifluatex}
\usepackage{fixltx2e} % provides \textsubscript
\ifnum 0\ifxetex 1\fi\ifluatex 1\fi=0 % if pdftex
  \usepackage[T1]{fontenc}
  \usepackage[utf8]{inputenc}
\else % if luatex or xelatex
  \ifxetex
    \usepackage{mathspec}
    \usepackage{xltxtra,xunicode}
  \else
    \usepackage{fontspec}
  \fi
  \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
  \newcommand{\euro}{€}
    \setmainfont{Calibri Light}
\fi
% use upquote if available, for straight quotes in verbatim environments
\IfFileExists{upquote.sty}{\usepackage{upquote}}{}
% use microtype if available
\IfFileExists{microtype.sty}{%
\usepackage{microtype}
\UseMicrotypeSet[protrusion]{basicmath} % disable protrusion for tt fonts
}{}
\usepackage[margin=1in]{geometry}
\usepackage{graphicx}
\makeatletter
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth\else\Gin@nat@width\fi}
\def\maxheight{\ifdim\Gin@nat@height>\textheight\textheight\else\Gin@nat@height\fi}
\makeatother
% Scale images if necessary, so that they will not overflow the page
% margins by default, and it is still possible to overwrite the defaults
% using explicit options in \includegraphics[width, height, ...]{}
\setkeys{Gin}{width=\maxwidth,height=\maxheight,keepaspectratio}
\ifxetex
  \usepackage[setpagesize=false, % page size defined by xetex
              unicode=false, % unicode breaks when used with xetex
              xetex]{hyperref}
\else
  \usepackage[unicode=true]{hyperref}
\fi
\hypersetup{breaklinks=true,
            bookmarks=true,
            pdfauthor={test,test,test},
            pdftitle={TEST},
            colorlinks=true,
            citecolor=blue,
            urlcolor=blue,
            linkcolor=blue,
            pdfborder={0 0 0}}
\urlstyle{same}  % don't use monospace font for urls
\setlength{\parindent}{0pt}
\setlength{\parskip}{6pt plus 2pt minus 1pt}
\setlength{\emergencystretch}{3em}  % prevent overfull lines
\setcounter{secnumdepth}{5}

%%% Use protect on footnotes to avoid problems with footnotes in titles
\let\rmarkdownfootnote\footnote%
\def\footnote{\protect\rmarkdownfootnote}

%%% Change title format to be more compact
\usepackage{titling}

% Create subtitle command for use in maketitle
\newcommand{\subtitle}[1]{
  \posttitle{
    \begin{center}\large#1\end{center}
    }
}

\setlength{\droptitle}{-2em}
  \title{TEST}
  \pretitle{\vspace{\droptitle}\centering\huge}
  \posttitle{\par}
\subtitle{A test document}
  \author{test,test,test}
  \preauthor{\centering\large\emph}
  \postauthor{\par}
  \date{}
  \predate{}\postdate{}

\usepackage[utf8]{inputenc}
\usepackage[dutch]{babel}
\usepackage{fancyhdr}
\pagestyle{fancy}
\fancyfoot[LE,RO]{test document}
\usepackage{dcolumn}
\usepackage{here}
\usepackage{longtable}
\usepackage{makecell}
\usepackage{caption}
\captionsetup{labelfont=bf,skip=2pt,labelsep=space,justification=justified,singlelinecheck=off}
\usepackage{chngcntr}
\counterwithin{table}{section}
\counterwithin{figure}{section}
\raggedbottom


\begin{document}

\maketitle


\section{start}\label{start}

\hyperref[section]{sec}

\ref{section}

\section{second}\label{second}

\setlongtables{\small
\begin{longtable}{lrrr}\caption{title} \tabularnewline
\hline
\multicolumn{1}{l}{}&\multicolumn{1}{l}{col1}&\multicolumn{1}{l}{col2}&\multicolumn{1}{l}{col3}\tabularnewline
\hline
\endfirsthead\caption[]{\em (continued)} \tabularnewline
\hline
\multicolumn{1}{l}{}&\multicolumn{1}{l}{col1}&\multicolumn{1}{l}{col2}&\multicolumn{1}{l}{col3}\tabularnewline
\hline
\endhead
\hline
\multicolumn{4}{p{\linewidth}}{note}\tabularnewline
\endfoot
\label{}
1&$  1$&$  1$&$  1$\tabularnewline
2&$  2$&$  2$&$  2$\tabularnewline
3&$  3$&$  3$&$  3$\tabularnewline
4&$  4$&$  4$&$  4$\tabularnewline
5&$  5$&$  5$&$  5$\tabularnewline
6&$  6$&$  6$&$  6$\tabularnewline
7&$  7$&$  7$&$  7$\tabularnewline
8&$  8$&$  8$&$  8$\tabularnewline
9&$  9$&$  9$&$  9$\tabularnewline
10&$ 10$&$ 10$&$ 10$\tabularnewline
11&$ 11$&$ 11$&$ 11$\tabularnewline
12&$ 12$&$ 12$&$ 12$\tabularnewline
13&$ 13$&$ 13$&$ 13$\tabularnewline
14&$ 14$&$ 14$&$ 14$\tabularnewline
15&$ 15$&$ 15$&$ 15$\tabularnewline
16&$ 16$&$ 16$&$ 16$\tabularnewline
17&$ 17$&$ 17$&$ 17$\tabularnewline
18&$ 18$&$ 18$&$ 18$\tabularnewline
19&$ 19$&$ 19$&$ 19$\tabularnewline
20&$ 20$&$ 20$&$ 20$\tabularnewline
21&$ 21$&$ 21$&$ 21$\tabularnewline
22&$ 22$&$ 22$&$ 22$\tabularnewline
23&$ 23$&$ 23$&$ 23$\tabularnewline
24&$ 24$&$ 24$&$ 24$\tabularnewline
25&$ 25$&$ 25$&$ 25$\tabularnewline
26&$ 26$&$ 26$&$ 26$\tabularnewline
27&$ 27$&$ 27$&$ 27$\tabularnewline
28&$ 28$&$ 28$&$ 28$\tabularnewline
29&$ 29$&$ 29$&$ 29$\tabularnewline
30&$ 30$&$ 30$&$ 30$\tabularnewline
31&$ 31$&$ 31$&$ 31$\tabularnewline
32&$ 32$&$ 32$&$ 32$\tabularnewline
33&$ 33$&$ 33$&$ 33$\tabularnewline
34&$ 34$&$ 34$&$ 34$\tabularnewline
35&$ 35$&$ 35$&$ 35$\tabularnewline
36&$ 36$&$ 36$&$ 36$\tabularnewline
37&$ 37$&$ 37$&$ 37$\tabularnewline
38&$ 38$&$ 38$&$ 38$\tabularnewline
39&$ 39$&$ 39$&$ 39$\tabularnewline
40&$ 40$&$ 40$&$ 40$\tabularnewline
41&$ 41$&$ 41$&$ 41$\tabularnewline
42&$ 42$&$ 42$&$ 42$\tabularnewline
43&$ 43$&$ 43$&$ 43$\tabularnewline
44&$ 44$&$ 44$&$ 44$\tabularnewline
45&$ 45$&$ 45$&$ 45$\tabularnewline
46&$ 46$&$ 46$&$ 46$\tabularnewline
47&$ 47$&$ 47$&$ 47$\tabularnewline
48&$ 48$&$ 48$&$ 48$\tabularnewline
49&$ 49$&$ 49$&$ 49$\tabularnewline
50&$ 50$&$ 50$&$ 50$\tabularnewline
51&$ 51$&$ 51$&$ 51$\tabularnewline
52&$ 52$&$ 52$&$ 52$\tabularnewline
53&$ 53$&$ 53$&$ 53$\tabularnewline
54&$ 54$&$ 54$&$ 54$\tabularnewline
55&$ 55$&$ 55$&$ 55$\tabularnewline
56&$ 56$&$ 56$&$ 56$\tabularnewline
57&$ 57$&$ 57$&$ 57$\tabularnewline
58&$ 58$&$ 58$&$ 58$\tabularnewline
59&$ 59$&$ 59$&$ 59$\tabularnewline
60&$ 60$&$ 60$&$ 60$\tabularnewline
61&$ 61$&$ 61$&$ 61$\tabularnewline
62&$ 62$&$ 62$&$ 62$\tabularnewline
63&$ 63$&$ 63$&$ 63$\tabularnewline
64&$ 64$&$ 64$&$ 64$\tabularnewline
65&$ 65$&$ 65$&$ 65$\tabularnewline
66&$ 66$&$ 66$&$ 66$\tabularnewline
67&$ 67$&$ 67$&$ 67$\tabularnewline
68&$ 68$&$ 68$&$ 68$\tabularnewline
69&$ 69$&$ 69$&$ 69$\tabularnewline
70&$ 70$&$ 70$&$ 70$\tabularnewline
71&$ 71$&$ 71$&$ 71$\tabularnewline
72&$ 72$&$ 72$&$ 72$\tabularnewline
73&$ 73$&$ 73$&$ 73$\tabularnewline
74&$ 74$&$ 74$&$ 74$\tabularnewline
75&$ 75$&$ 75$&$ 75$\tabularnewline
76&$ 76$&$ 76$&$ 76$\tabularnewline
77&$ 77$&$ 77$&$ 77$\tabularnewline
78&$ 78$&$ 78$&$ 78$\tabularnewline
79&$ 79$&$ 79$&$ 79$\tabularnewline
80&$ 80$&$ 80$&$ 80$\tabularnewline
81&$ 81$&$ 81$&$ 81$\tabularnewline
82&$ 82$&$ 82$&$ 82$\tabularnewline
83&$ 83$&$ 83$&$ 83$\tabularnewline
84&$ 84$&$ 84$&$ 84$\tabularnewline
85&$ 85$&$ 85$&$ 85$\tabularnewline
86&$ 86$&$ 86$&$ 86$\tabularnewline
87&$ 87$&$ 87$&$ 87$\tabularnewline
88&$ 88$&$ 88$&$ 88$\tabularnewline
89&$ 89$&$ 89$&$ 89$\tabularnewline
90&$ 90$&$ 90$&$ 90$\tabularnewline
91&$ 91$&$ 91$&$ 91$\tabularnewline
92&$ 92$&$ 92$&$ 92$\tabularnewline
93&$ 93$&$ 93$&$ 93$\tabularnewline
94&$ 94$&$ 94$&$ 94$\tabularnewline
95&$ 95$&$ 95$&$ 95$\tabularnewline
96&$ 96$&$ 96$&$ 96$\tabularnewline
97&$ 97$&$ 97$&$ 97$\tabularnewline
98&$ 98$&$ 98$&$ 98$\tabularnewline
99&$ 99$&$ 99$&$ 99$\tabularnewline
100&$100$&$100$&$100$\tabularnewline
101&$101$&$101$&$101$\tabularnewline
102&$102$&$102$&$102$\tabularnewline
103&$103$&$103$&$103$\tabularnewline
104&$104$&$104$&$104$\tabularnewline
105&$105$&$105$&$105$\tabularnewline
106&$106$&$106$&$106$\tabularnewline
107&$107$&$107$&$107$\tabularnewline
108&$108$&$108$&$108$\tabularnewline
109&$109$&$109$&$109$\tabularnewline
110&$110$&$110$&$110$\tabularnewline
111&$111$&$111$&$111$\tabularnewline
112&$112$&$112$&$112$\tabularnewline
113&$113$&$113$&$113$\tabularnewline
114&$114$&$114$&$114$\tabularnewline
115&$115$&$115$&$115$\tabularnewline
116&$116$&$116$&$116$\tabularnewline
117&$117$&$117$&$117$\tabularnewline
118&$118$&$118$&$118$\tabularnewline
119&$119$&$119$&$119$\tabularnewline
120&$120$&$120$&$120$\tabularnewline
121&$121$&$121$&$121$\tabularnewline
122&$122$&$122$&$122$\tabularnewline
123&$123$&$123$&$123$\tabularnewline
124&$124$&$124$&$124$\tabularnewline
125&$125$&$125$&$125$\tabularnewline
126&$126$&$126$&$126$\tabularnewline
127&$127$&$127$&$127$\tabularnewline
128&$128$&$128$&$128$\tabularnewline
129&$129$&$129$&$129$\tabularnewline
130&$130$&$130$&$130$\tabularnewline
131&$131$&$131$&$131$\tabularnewline
132&$132$&$132$&$132$\tabularnewline
133&$133$&$133$&$133$\tabularnewline
134&$134$&$134$&$134$\tabularnewline
135&$135$&$135$&$135$\tabularnewline
136&$136$&$136$&$136$\tabularnewline
137&$137$&$137$&$137$\tabularnewline
138&$138$&$138$&$138$\tabularnewline
139&$139$&$139$&$139$\tabularnewline
140&$140$&$140$&$140$\tabularnewline
141&$141$&$141$&$141$\tabularnewline
142&$142$&$142$&$142$\tabularnewline
143&$143$&$143$&$143$\tabularnewline
144&$144$&$144$&$144$\tabularnewline
145&$145$&$145$&$145$\tabularnewline
146&$146$&$146$&$146$\tabularnewline
147&$147$&$147$&$147$\tabularnewline
148&$148$&$148$&$148$\tabularnewline
149&$149$&$149$&$149$\tabularnewline
150&$150$&$150$&$150$\tabularnewline
151&$151$&$151$&$151$\tabularnewline
152&$152$&$152$&$152$\tabularnewline
153&$153$&$153$&$153$\tabularnewline
154&$154$&$154$&$154$\tabularnewline
155&$155$&$155$&$155$\tabularnewline
156&$156$&$156$&$156$\tabularnewline
157&$157$&$157$&$157$\tabularnewline
158&$158$&$158$&$158$\tabularnewline
159&$159$&$159$&$159$\tabularnewline
160&$160$&$160$&$160$\tabularnewline
161&$161$&$161$&$161$\tabularnewline
162&$162$&$162$&$162$\tabularnewline
163&$163$&$163$&$163$\tabularnewline
164&$164$&$164$&$164$\tabularnewline
165&$165$&$165$&$165$\tabularnewline
166&$166$&$166$&$166$\tabularnewline
167&$167$&$167$&$167$\tabularnewline
168&$168$&$168$&$168$\tabularnewline
169&$169$&$169$&$169$\tabularnewline
170&$170$&$170$&$170$\tabularnewline
171&$171$&$171$&$171$\tabularnewline
172&$172$&$172$&$172$\tabularnewline
173&$173$&$173$&$173$\tabularnewline
174&$174$&$174$&$174$\tabularnewline
175&$175$&$175$&$175$\tabularnewline
176&$176$&$176$&$176$\tabularnewline
177&$177$&$177$&$177$\tabularnewline
178&$178$&$178$&$178$\tabularnewline
179&$179$&$179$&$179$\tabularnewline
180&$180$&$180$&$180$\tabularnewline
181&$181$&$181$&$181$\tabularnewline
182&$182$&$182$&$182$\tabularnewline
183&$183$&$183$&$183$\tabularnewline
184&$184$&$184$&$184$\tabularnewline
185&$185$&$185$&$185$\tabularnewline
186&$186$&$186$&$186$\tabularnewline
187&$187$&$187$&$187$\tabularnewline
188&$188$&$188$&$188$\tabularnewline
189&$189$&$189$&$189$\tabularnewline
190&$190$&$190$&$190$\tabularnewline
191&$191$&$191$&$191$\tabularnewline
192&$192$&$192$&$192$\tabularnewline
193&$193$&$193$&$193$\tabularnewline
194&$194$&$194$&$194$\tabularnewline
195&$195$&$195$&$195$\tabularnewline
196&$196$&$196$&$196$\tabularnewline
197&$197$&$197$&$197$\tabularnewline
198&$198$&$198$&$198$\tabularnewline
199&$199$&$199$&$199$\tabularnewline
200&$200$&$200$&$200$\tabularnewline
201&$201$&$201$&$201$\tabularnewline
202&$202$&$202$&$202$\tabularnewline
203&$203$&$203$&$203$\tabularnewline
204&$204$&$204$&$204$\tabularnewline
205&$205$&$205$&$205$\tabularnewline
206&$206$&$206$&$206$\tabularnewline
207&$207$&$207$&$207$\tabularnewline
208&$208$&$208$&$208$\tabularnewline
209&$209$&$209$&$209$\tabularnewline
210&$210$&$210$&$210$\tabularnewline
211&$211$&$211$&$211$\tabularnewline
212&$212$&$212$&$212$\tabularnewline
213&$213$&$213$&$213$\tabularnewline
214&$214$&$214$&$214$\tabularnewline
215&$215$&$215$&$215$\tabularnewline
216&$216$&$216$&$216$\tabularnewline
217&$217$&$217$&$217$\tabularnewline
218&$218$&$218$&$218$\tabularnewline
219&$219$&$219$&$219$\tabularnewline
220&$220$&$220$&$220$\tabularnewline
221&$221$&$221$&$221$\tabularnewline
222&$222$&$222$&$222$\tabularnewline
223&$223$&$223$&$223$\tabularnewline
224&$224$&$224$&$224$\tabularnewline
225&$225$&$225$&$225$\tabularnewline
226&$226$&$226$&$226$\tabularnewline
227&$227$&$227$&$227$\tabularnewline
228&$228$&$228$&$228$\tabularnewline
229&$229$&$229$&$229$\tabularnewline
230&$230$&$230$&$230$\tabularnewline
231&$231$&$231$&$231$\tabularnewline
232&$232$&$232$&$232$\tabularnewline
233&$233$&$233$&$233$\tabularnewline
234&$234$&$234$&$234$\tabularnewline
235&$235$&$235$&$235$\tabularnewline
236&$236$&$236$&$236$\tabularnewline
237&$237$&$237$&$237$\tabularnewline
238&$238$&$238$&$238$\tabularnewline
239&$239$&$239$&$239$\tabularnewline
240&$240$&$240$&$240$\tabularnewline
241&$241$&$241$&$241$\tabularnewline
242&$242$&$242$&$242$\tabularnewline
243&$243$&$243$&$243$\tabularnewline
244&$244$&$244$&$244$\tabularnewline
245&$245$&$245$&$245$\tabularnewline
246&$246$&$246$&$246$\tabularnewline
247&$247$&$247$&$247$\tabularnewline
248&$248$&$248$&$248$\tabularnewline
249&$249$&$249$&$249$\tabularnewline
250&$250$&$250$&$250$\tabularnewline
251&$251$&$251$&$251$\tabularnewline
252&$252$&$252$&$252$\tabularnewline
253&$253$&$253$&$253$\tabularnewline
254&$254$&$254$&$254$\tabularnewline
255&$255$&$255$&$255$\tabularnewline
256&$256$&$256$&$256$\tabularnewline
257&$257$&$257$&$257$\tabularnewline
258&$258$&$258$&$258$\tabularnewline
259&$259$&$259$&$259$\tabularnewline
260&$260$&$260$&$260$\tabularnewline
261&$261$&$261$&$261$\tabularnewline
262&$262$&$262$&$262$\tabularnewline
263&$263$&$263$&$263$\tabularnewline
264&$264$&$264$&$264$\tabularnewline
265&$265$&$265$&$265$\tabularnewline
266&$266$&$266$&$266$\tabularnewline
267&$267$&$267$&$267$\tabularnewline
268&$268$&$268$&$268$\tabularnewline
269&$269$&$269$&$269$\tabularnewline
270&$270$&$270$&$270$\tabularnewline
271&$271$&$271$&$271$\tabularnewline
272&$272$&$272$&$272$\tabularnewline
273&$273$&$273$&$273$\tabularnewline
274&$274$&$274$&$274$\tabularnewline
275&$275$&$275$&$275$\tabularnewline
276&$276$&$276$&$276$\tabularnewline
277&$277$&$277$&$277$\tabularnewline
278&$278$&$278$&$278$\tabularnewline
279&$279$&$279$&$279$\tabularnewline
280&$280$&$280$&$280$\tabularnewline
281&$281$&$281$&$281$\tabularnewline
282&$282$&$282$&$282$\tabularnewline
283&$283$&$283$&$283$\tabularnewline
284&$284$&$284$&$284$\tabularnewline
285&$285$&$285$&$285$\tabularnewline
286&$286$&$286$&$286$\tabularnewline
287&$287$&$287$&$287$\tabularnewline
288&$288$&$288$&$288$\tabularnewline
289&$289$&$289$&$289$\tabularnewline
290&$290$&$290$&$290$\tabularnewline
291&$291$&$291$&$291$\tabularnewline
292&$292$&$292$&$292$\tabularnewline
293&$293$&$293$&$293$\tabularnewline
294&$294$&$294$&$294$\tabularnewline
295&$295$&$295$&$295$\tabularnewline
296&$296$&$296$&$296$\tabularnewline
297&$297$&$297$&$297$\tabularnewline
298&$298$&$298$&$298$\tabularnewline
299&$299$&$299$&$299$\tabularnewline
300&$300$&$300$&$300$\tabularnewline
301&$301$&$301$&$301$\tabularnewline
302&$302$&$302$&$302$\tabularnewline
303&$303$&$303$&$303$\tabularnewline
304&$304$&$304$&$304$\tabularnewline
305&$305$&$305$&$305$\tabularnewline
306&$306$&$306$&$306$\tabularnewline
307&$307$&$307$&$307$\tabularnewline
308&$308$&$308$&$308$\tabularnewline
309&$309$&$309$&$309$\tabularnewline
310&$310$&$310$&$310$\tabularnewline
311&$311$&$311$&$311$\tabularnewline
312&$312$&$312$&$312$\tabularnewline
313&$313$&$313$&$313$\tabularnewline
314&$314$&$314$&$314$\tabularnewline
315&$315$&$315$&$315$\tabularnewline
316&$316$&$316$&$316$\tabularnewline
317&$317$&$317$&$317$\tabularnewline
318&$318$&$318$&$318$\tabularnewline
319&$319$&$319$&$319$\tabularnewline
320&$320$&$320$&$320$\tabularnewline
321&$321$&$321$&$321$\tabularnewline
322&$322$&$322$&$322$\tabularnewline
323&$323$&$323$&$323$\tabularnewline
324&$324$&$324$&$324$\tabularnewline
325&$325$&$325$&$325$\tabularnewline
326&$326$&$326$&$326$\tabularnewline
327&$327$&$327$&$327$\tabularnewline
328&$328$&$328$&$328$\tabularnewline
329&$329$&$329$&$329$\tabularnewline
330&$330$&$330$&$330$\tabularnewline
331&$331$&$331$&$331$\tabularnewline
332&$332$&$332$&$332$\tabularnewline
333&$333$&$333$&$333$\tabularnewline
334&$334$&$334$&$334$\tabularnewline
335&$335$&$335$&$335$\tabularnewline
336&$336$&$336$&$336$\tabularnewline
337&$337$&$337$&$337$\tabularnewline
338&$338$&$338$&$338$\tabularnewline
339&$339$&$339$&$339$\tabularnewline
340&$340$&$340$&$340$\tabularnewline
341&$341$&$341$&$341$\tabularnewline
342&$342$&$342$&$342$\tabularnewline
343&$343$&$343$&$343$\tabularnewline
344&$344$&$344$&$344$\tabularnewline
345&$345$&$345$&$345$\tabularnewline
346&$346$&$346$&$346$\tabularnewline
347&$347$&$347$&$347$\tabularnewline
348&$348$&$348$&$348$\tabularnewline
349&$349$&$349$&$349$\tabularnewline
350&$350$&$350$&$350$\tabularnewline
351&$351$&$351$&$351$\tabularnewline
352&$352$&$352$&$352$\tabularnewline
353&$353$&$353$&$353$\tabularnewline
354&$354$&$354$&$354$\tabularnewline
355&$355$&$355$&$355$\tabularnewline
356&$356$&$356$&$356$\tabularnewline
357&$357$&$357$&$357$\tabularnewline
358&$358$&$358$&$358$\tabularnewline
359&$359$&$359$&$359$\tabularnewline
360&$360$&$360$&$360$\tabularnewline
361&$361$&$361$&$361$\tabularnewline
362&$362$&$362$&$362$\tabularnewline
363&$363$&$363$&$363$\tabularnewline
364&$364$&$364$&$364$\tabularnewline
365&$365$&$365$&$365$\tabularnewline
366&$366$&$366$&$366$\tabularnewline
367&$367$&$367$&$367$\tabularnewline
368&$368$&$368$&$368$\tabularnewline
369&$369$&$369$&$369$\tabularnewline
370&$370$&$370$&$370$\tabularnewline
371&$371$&$371$&$371$\tabularnewline
372&$372$&$372$&$372$\tabularnewline
373&$373$&$373$&$373$\tabularnewline
374&$374$&$374$&$374$\tabularnewline
375&$375$&$375$&$375$\tabularnewline
376&$376$&$376$&$376$\tabularnewline
377&$377$&$377$&$377$\tabularnewline
378&$378$&$378$&$378$\tabularnewline
379&$379$&$379$&$379$\tabularnewline
380&$380$&$380$&$380$\tabularnewline
381&$381$&$381$&$381$\tabularnewline
382&$382$&$382$&$382$\tabularnewline
383&$383$&$383$&$383$\tabularnewline
384&$384$&$384$&$384$\tabularnewline
385&$385$&$385$&$385$\tabularnewline
386&$386$&$386$&$386$\tabularnewline
387&$387$&$387$&$387$\tabularnewline
388&$388$&$388$&$388$\tabularnewline
389&$389$&$389$&$389$\tabularnewline
390&$390$&$390$&$390$\tabularnewline
391&$391$&$391$&$391$\tabularnewline
392&$392$&$392$&$392$\tabularnewline
393&$393$&$393$&$393$\tabularnewline
394&$394$&$394$&$394$\tabularnewline
395&$395$&$395$&$395$\tabularnewline
396&$396$&$396$&$396$\tabularnewline
397&$397$&$397$&$397$\tabularnewline
398&$398$&$398$&$398$\tabularnewline
399&$399$&$399$&$399$\tabularnewline
400&$400$&$400$&$400$\tabularnewline
\hline
\end{longtable}}

\hyperdef{}{section}{\subsection{section}\label{section}}

\end{document}

答案1

线路

\multicolumn{4}{p{\linewidth}}{note}\tabularnewline

请求表格的完整行宽。否则列会很小,空间必须放在某处,而 LaTeX 将其放在最后一列。

有几种方法可以解决这个问题,例如:

  • 额外的第五列,占据剩余的空间

  • 纸币的宽度较小。

  • 通过 设置不对齐的音符\noalign{...}

下面是一个计算表格宽度以供注释使用的示例:

\documentclass[a5paper]{article}% a5paper to get a smaller image
\usepackage{longtable}

\makeatletter
\newcommand*{\LongTableWidth}{%
  \dimexpr 0pt\expandafter\LTW@parse\LT@save@row{}{}{}\relax
}
\def\LTW@parse#1#2#3{%
  \ifx\\#1#2#3\\%
    \expandafter\@gobble
  \else
    +#3%
  \fi
  \LTW@parse
}
\makeatother

\begin{document}
\begin{longtable}{lrrr}
\caption{title} \tabularnewline
\hline
\multicolumn{1}{l}{}
&\multicolumn{1}{l}{col1}
&\multicolumn{1}{l}{col2}
&\multicolumn{1}{l}{col3}\tabularnewline
\hline
\endfirsthead
\caption[]{\em (continued)} \tabularnewline
\hline
\multicolumn{1}{l}{}
&\multicolumn{1}{l}{col1}
&\multicolumn{1}{l}{col2}
&\multicolumn{1}{l}{col3}\tabularnewline
\hline
\endhead
\hline
\multicolumn{4}{%
  p{\dimexpr\LongTableWidth-2\tabcolsep\relax}%
}{note}\tabularnewline
\endfoot
1&$  1$&$  1$&$  1$\tabularnewline
2&$  2$&$  2$&$  2$\tabularnewline
3&$  3$&$  3$&$  3$\tabularnewline
4&$  4$&$  4$&$  4$\tabularnewline
5&$  5$&$  5$&$  5$\tabularnewline
6&$  6$&$  6$&$  6$\tabularnewline
7&$  7$&$  7$&$  7$\tabularnewline
8&$  8$&$  8$&$  8$\tabularnewline
9&$  9$&$  9$&$  9$\tabularnewline
10&$ 10$&$ 10$&$ 10$\tabularnewline
11&$ 11$&$ 11$&$ 11$\tabularnewline
12&$ 12$&$ 12$&$ 12$\tabularnewline
13&$ 13$&$ 13$&$ 13$\tabularnewline
14&$ 14$&$ 14$&$ 14$\tabularnewline
15&$ 15$&$ 15$&$ 15$\tabularnewline
16&$ 16$&$ 16$&$ 16$\tabularnewline
17&$ 17$&$ 17$&$ 17$\tabularnewline
18&$ 18$&$ 18$&$ 18$\tabularnewline
19&$ 19$&$ 19$&$ 19$\tabularnewline
20&$ 20$&$ 20$&$ 20$\tabularnewline
21&$ 21$&$ 21$&$ 21$\tabularnewline
22&$ 22$&$ 22$&$ 22$\tabularnewline
23&$ 23$&$ 23$&$ 23$\tabularnewline
24&$ 24$&$ 24$&$ 24$\tabularnewline
25&$ 25$&$ 25$&$ 25$\tabularnewline
26&$ 26$&$ 26$&$ 26$\tabularnewline
27&$ 27$&$ 27$&$ 27$\tabularnewline
28&$ 28$&$ 28$&$ 28$\tabularnewline
29&$ 29$&$ 29$&$ 29$\tabularnewline
30&$ 30$&$ 30$&$ 30$\tabularnewline
31&$ 31$&$ 31$&$ 31$\tabularnewline
32&$ 32$&$ 32$&$ 32$\tabularnewline
33&$ 33$&$ 33$&$ 33$\tabularnewline
34&$ 34$&$ 34$&$ 34$\tabularnewline
35&$ 35$&$ 35$&$ 35$\tabularnewline
36&$ 36$&$ 36$&$ 36$\tabularnewline
37&$ 37$&$ 37$&$ 37$\tabularnewline
38&$ 38$&$ 38$&$ 38$\tabularnewline
39&$ 39$&$ 39$&$ 39$\tabularnewline
40&$ 40$&$ 40$&$ 40$\tabularnewline
41&$ 41$&$ 41$&$ 41$\tabularnewline
42&$ 42$&$ 42$&$ 42$\tabularnewline
43&$ 43$&$ 43$&$ 43$\tabularnewline
44&$ 44$&$ 44$&$ 44$\tabularnewline
45&$ 45$&$ 45$&$ 45$\tabularnewline
46&$ 46$&$ 46$&$ 46$\tabularnewline
47&$ 47$&$ 47$&$ 47$\tabularnewline
48&$ 48$&$ 48$&$ 48$\tabularnewline
49&$ 49$&$ 49$&$ 49$\tabularnewline
50&$ 50$&$ 50$&$ 50$\tabularnewline
\end{longtable}
\end{document}

结果,第一页

用于注释的固定宽度的虚拟列

\documentclass[a5paper]{article}
\usepackage{booktabs}
\usepackage{longtable}
\usepackage{lipsum}

\begin{document}
\begin{longtable}{lrrrl}% dummy column at the end
\caption{title} \tabularnewline
\toprule
\multicolumn{1}{l}{}
&\multicolumn{1}{l}{col1}
&\multicolumn{1}{l}{col2}
&\multicolumn{1}{l}{col3}\tabularnewline
\midrule
\endfirsthead
\caption[]{\em (continued)} \tabularnewline
\midrule
\multicolumn{1}{l}{}
&\multicolumn{1}{l}{col1}
&\multicolumn{1}{l}{col2}
&\multicolumn{1}{l}{col3}\tabularnewline
\midrule
\endhead
% \midrule
\bottomrule\noalign{\vskip\belowrulesep}
\multicolumn{5}{p{.5\linewidth}}{\lipsum[101]}\tabularnewline
\endfoot
1&$  1$&$  1$&$  1$\tabularnewline
2&$  2$&$  2$&$  2$\tabularnewline
3&$  3$&$  3$&$  3$\tabularnewline
4&$  4$&$  4$&$  4$\tabularnewline
5&$  5$&$  5$&$  5$\tabularnewline
6&$  6$&$  6$&$  6$\tabularnewline
7&$  7$&$  7$&$  7$\tabularnewline
8&$  8$&$  8$&$  8$\tabularnewline
9&$  9$&$  9$&$  9$\tabularnewline
10&$ 10$&$ 10$&$ 10$\tabularnewline
11&$ 11$&$ 11$&$ 11$\tabularnewline
12&$ 12$&$ 12$&$ 12$\tabularnewline
13&$ 13$&$ 13$&$ 13$\tabularnewline
14&$ 14$&$ 14$&$ 14$\tabularnewline
15&$ 15$&$ 15$&$ 15$\tabularnewline
16&$ 16$&$ 16$&$ 16$\tabularnewline
17&$ 17$&$ 17$&$ 17$\tabularnewline
18&$ 18$&$ 18$&$ 18$\tabularnewline
19&$ 19$&$ 19$&$ 19$\tabularnewline
20&$ 20$&$ 20$&$ 20$\tabularnewline
21&$ 21$&$ 21$&$ 21$\tabularnewline
22&$ 22$&$ 22$&$ 22$\tabularnewline
23&$ 23$&$ 23$&$ 23$\tabularnewline
24&$ 24$&$ 24$&$ 24$\tabularnewline
25&$ 25$&$ 25$&$ 25$\tabularnewline
26&$ 26$&$ 26$&$ 26$\tabularnewline
27&$ 27$&$ 27$&$ 27$\tabularnewline
28&$ 28$&$ 28$&$ 28$\tabularnewline
29&$ 29$&$ 29$&$ 29$\tabularnewline
30&$ 30$&$ 30$&$ 30$\tabularnewline
31&$ 31$&$ 31$&$ 31$\tabularnewline
32&$ 32$&$ 32$&$ 32$\tabularnewline
33&$ 33$&$ 33$&$ 33$\tabularnewline
34&$ 34$&$ 34$&$ 34$\tabularnewline
35&$ 35$&$ 35$&$ 35$\tabularnewline
36&$ 36$&$ 36$&$ 36$\tabularnewline
37&$ 37$&$ 37$&$ 37$\tabularnewline
38&$ 38$&$ 38$&$ 38$\tabularnewline
39&$ 39$&$ 39$&$ 39$\tabularnewline
40&$ 40$&$ 40$&$ 40$\tabularnewline
41&$ 41$&$ 41$&$ 41$\tabularnewline
42&$ 42$&$ 42$&$ 42$\tabularnewline
43&$ 43$&$ 43$&$ 43$\tabularnewline
44&$ 44$&$ 44$&$ 44$\tabularnewline
45&$ 45$&$ 45$&$ 45$\tabularnewline
46&$ 46$&$ 46$&$ 46$\tabularnewline
47&$ 47$&$ 47$&$ 47$\tabularnewline
48&$ 48$&$ 48$&$ 48$\tabularnewline
49&$ 49$&$ 49$&$ 49$\tabularnewline
50&$ 50$&$ 50$&$ 50$\tabularnewline
\end{longtable}
\end{document}

结果,第一页

相关内容