![将长表放入多个水平页面](https://linux22.com/image/362989/%E5%B0%86%E9%95%BF%E8%A1%A8%E6%94%BE%E5%85%A5%E5%A4%9A%E4%B8%AA%E6%B0%B4%E5%B9%B3%E9%A1%B5%E9%9D%A2.png)
我希望您能帮我将长表格放入多个水平页面。非常感谢您的时间和帮助。由于字数限制,我无法在此处发布整个表格。以下是代码:
\documentclass{article}
\usepackage{longtable}
\usepackage[demo]{graphicx}
\usepackage{rotating}
\usepackage{multirow}
\begin{document}
\begin{sidewaystable}
%\centering
\caption{Table 3 (a). Courier....}
\label{my-label}
\scriptsize
\begin{longtable}{|l|l|l|l|l|l|l|}
\hline
\multicolumn{1}{|c|}{\multirow{2}{*}{\textbf{Variables}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{Unit}}} & \multicolumn{1}{c|}{\multirow{2}{*}{\textbf{\begin{tabular}[c]{@{}c@{}}Min/ Max or \\ Values*\end{tabular}}}} & \multicolumn{4}{c|}{\textbf{Percentages or Distribution*}} \\ \cline{4-7}
\multicolumn{1}{|c|}{} & \multicolumn{1}{c|}{} & \multicolumn{1}{c|}{} & \multicolumn{2}{c|}{\textbf{US (n1 = n11+ n12 = 549)}} & \multicolumn{2}{c|}{\textbf{VN ( n2 = n21+ n22 = 415)}} \\ \hline
Experience: Sending package/ purchase online. & NA & 1/2 & \multicolumn{2}{c|}{38.25/ 61.75} & \multicolumn{2}{c|}{23.86/ 76.14} \\ \hline
\begin{tabular}[c]{@{}l@{}}I, III: Sending package\\ II, IV: Purchase online\end{tabular} & & & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}I.\\ (n11 = 210)\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}II.\\ (n12 = 339)\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}III.\\ (n21 = 99)\end{tabular}} & \multicolumn{1}{c|}{\begin{tabular}[c]{@{}c@{}}IV.\\ (n22 = 316)\end{tabular}} \\ \hline
\begin{tabular}[c]{@{}l@{}}What have you sent to someone else/ you bought (multiple\\ choices): Dry cleaning, fast foods, lunch, dinner, birthday \\ \\ \\ cake, etc (immediate delivery)\textasciicircum 1/ Groceries\textasciicircum 2/ Beverage, dry \\ foods\textasciicircum 3/ Personal health, medicine\textasciicircum 4/ Apparel\textasciicircum 5/ Books,\\ \\ \\ Music, Videos\textasciicircum 6/ Consumer electronics\textasciicircum 7/ Others\textasciicircum 8.\end{tabular} \begin{tabular}[c]{@{}l@{}}(I, III, IV) 1/3;\\ (II) 1/5\end{tabular} & \begin{tabular}[c]{@{}l@{}}74.90/ 13.30/\\ 11.80\end{tabular} & \begin{tabular}[c]{@{}l@{}}6.20\textasciicircum 1/ 71.00\textasciicircum 2/ \\ 1.00\textasciicircum 3/ 0.50\textasciicircum 4/ \\ 21.40\textasciicircum 5\end{tabular} & \begin{tabular}[c]{@{}l@{}}41.40/ 34.30/ \\ 24.20\end{tabular} & \begin{tabular}[c]{@{}l@{}}3.20/ 75.00/ \\ \\ 21.80\end{tabular} \\ \hline & \begin{tabular}[c]{@{}l@{}}-\textasciicircum 1/ 3.30\textasciicircum 2/ \\ -\textasciicircum 3/ -\textasciicircum 4/\\ 21.00\textasciicircum 5/\\ 44.80\textasciicircum 6/ \\ 31.00\textasciicircum 7/ -\textasciicircum 8\end{tabular} & \begin{tabular}[c]{@{}l@{}}4.00\textasciicircum 1/ \\ 3.00\textasciicircum 2/ \\ 37.50\textasciicircum 3/ \\ 50.50\textasciicircum 4/ \\ 3.00\textasciicircum 5/ \\ 2.00\textasciicircum 6\end{tabular} & \begin{tabular}[c]{@{}l@{}}61.40\textasciicircum 1/ 7.90\textasciicircum 2/\\ 3.20\textasciicircum 3/ 0.90\textasciicircum 4/\\ 3.20\textasciicircum 5/ 0.30\textasciicircum 6/ \\ 22.80\textasciicircum 7/ 0.30\textasciicircum 8\end{tabular} \\ \hline
Time for deliver. & Hours & \begin{tabular}[c]{@{}l@{}}(I) 0.75/23; \\ \\ \\ (II) 0.5/ 19; \\ (III) 0.5/12; \\ (IV) 0.33/ 18\end{tabular} & 7.65/ 1.27 & 4.25/ 2.01 & 3.73/ 0.36 & 4.39/ 0.28 \\ \hline
Time for deliver. & Days & \begin{tabular}[c]{@{}l@{}}(I) 1/28; \\ \\ \\ \\ (II) 1/18; \\ (III) 1/14; \\ (IV) 1/30\end{tabular} & 3.22/ 0.09 & 3.46/ 0.13 & 2.75/ 0.24 & 2.64/ 0.13 \\ \hline
Satisfaction with the delivery time: No/ Yes. & NA & 0/1 & 5.90/94.10 & 9.00/ 91.00 & 13.10/ 86.90 & 13.00/ 87.00 \\ \hline
\begin{tabular}[c]{@{}l@{}}Able to track and trace the item online: Yes, I could track via \\ carrier’s website (and/or app)/ Yes, I could track by calling \\ courier’s cellphone / No, I could not track it.\end{tabular} & NA & \begin{tabular}[c]{@{}l@{}}(I, II) 1/2; \\ (III, IV) 1/3\end{tabular} & 94.40/ -/ 5.60 & 91.90/ -/ 8.10 & \begin{tabular}[c]{@{}l@{}}33.30/ 31.30/ \\ 35.40\end{tabular} & \begin{tabular}[c]{@{}l@{}}27.20/ 25.60/\\ 47.20\end{tabular} \\ \hline
\begin{tabular}[c]{@{}l@{}}Satisfaction with electronic delivery notification: Yes, I was \\ satisfied with the service/ No, the service was not good/ No, \\ they did not provide the service.\end{tabular} & NA & 1/3 & \begin{tabular}[c]{@{}l@{}}82.60/ 3.80/ \\ 13.60\end{tabular} & \begin{tabular}[c]{@{}l@{}}84.30/ 4.80/\\ 11.00\end{tabular} & \begin{tabular}[c]{@{}l@{}}61.60/ 10.10/ \\ 28.30\end{tabular} & \begin{tabular}[c]{@{}l@{}}68.00/ 8.50/ \\ 23.40\end{tabular} \\ \hline
\begin{tabular}[c]{@{}l@{}}Choose the pickup (I, III)/delivery (II, IV) time window: Yes, \\ I could, and I used that service/ Yes, I could, but I did not use\\ that service/ No, I could not. The carrier did not offer that \\ service.\end{tabular} & NA & 1/3 & \begin{tabular}[c]{@{}l@{}}19.50/ 36.60/ \\ 44.00\end{tabular} & \begin{tabular}[c]{@{}l@{}}30.00/ 20.50/ \\ 49.50\end{tabular} & \begin{tabular}[c]{@{}l@{}}41.40/ 17.20/ \\ 41.40\end{tabular} & \begin{tabular}[c]{@{}l@{}}56.60/ 24.40/ \\ 19.00\end{tabular} \\ \hline
\begin{tabular}[c]{@{}l@{}}Carriers offer pickup at home (I, III)/ provide convenient\\ \\ drop-off location (II, IV): Yes, \\ \\ \\ but I have never used the \\ service\textasciicircum 1/ Yes, the service is excellent\textasciicircum 2/ Yes, the service is \\ good\textasciicircum 3/ No, the service is bad\textasciicircum 4/ I have no idea about the \\ service\textasciicircum 5.\end{tabular} & NA & 1/5 & \\ \hline
Did you tip the delivery person: No/ Yes. & NA & 0/1 & 92.90/ 7.10 & 97.60/ 2.40 & - & - \\ \hline
\begin{tabular}[c]{@{}l@{}}Number of times did: (I, II) you \\ use the service of the carrier \\ per year; (II, IV) you shop \\ \\ \\ in the same website/shop per year.\end{tabular} & Numbers & \begin{tabular}[c]{@{}l@{}}(I, II) 1/300; \\ (III) 1/ 550;\\ (IV) 1/500.\end{tabular} & 18.41/ 35.92 & 19.23/ 27.98 & 25.05/ 73.87 & 7.07/ 31.01 \\ \hline
\end{longtable}
\end{sidewaystable}
\end{document}
答案1
我怀疑你喜欢实现这样的目标:
但我不确定。正如我在评论中提到的,使用landscape
环境可以longtable
在更多页面上使用。
我必须承认我迷失了你的表格代码。我尝试清理它,但可能在此过程中在表格内容中引入了一些错误。我做了以下事情:
- 添加包
pdflcscape
,makecell
然后siunitx
- 使用
\makecell
宏我替换所有嵌套表格 - 与
siunitx i tray to use for constructs as is
其他人\textasciicircum 8, where i didn't figured out, what this circle means. so left them as you use in your *mwe*, but afer numbers i replace them with for example
\SI{2.00}{\degree}` - 在表格中我添加了许多缺失的“&”符号......
如果知道表的上下文,则可以进一步改进代码(例如,l
最好使用p{...}
列类型而不是磁带,甚至使用tabularx
和ltablex
包...
\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{rotating}
\usepackage{pdflscape}
\usepackage{makecell, % added
multirow, longtable}
\setcellgapes{3pt}
\usepackage{siunitx} % added
\begin{document}
\begin{landscape}
\scriptsize
\makegapedcells
\begin{longtable}{|p{55mm}|l|l |l|l|l|l|}
\caption{Table 3 (a). Courier \dots}
\label{my-label} \\
\hline
\multirow{2}{=}{\thead{Variables}}
& \multirow{2}{*}{\thead{Unit}}
& \multirow{2}{*}{\thead{Min/ Max or \\ Values*}}
& \multicolumn{4}{c|}{\thead{Percentages or Distribution*}} \\
\cline{4-7}
& & & \multicolumn{2}{c|}{\thead{US $(n1 = n11+ n12 = 549)$}}
& \multicolumn{2}{c|}{\thead{VN $(n2 = n21+ n22 = 415)$}} \\
\hline
\makecell[l]{Experience:\\ Sending package/purchase online.}
& NA
& 1/2
& \multicolumn{2}{c|}{38.25/ 61.75}
& \multicolumn{2}{c|}{23.86/ 76.14} \\
\hline
\endfirsthead
\caption{Table 3 (a). Courier \dots (cont.)} \\
\hline
\multirow{2}{*}{\thead{Variables}}
& \multirow{2}{*}{\thead{Unit}}
& \multirow{2}{*}{\thead{Min/ Max or \\ Values*}}
& \multicolumn{4}{c|}{\thead{Percentages or Distribution*}} \\
\cline{4-7}
& & & \multicolumn{2}{c|}{\thead{US $(n1 = n11+ n12 = 549)$}}
& \multicolumn{2}{c|}{\thead{VN $(n2 = n21+ n22 = 415)$}} \\
\hline
\makecell[l]{Experience:\\ Sending package/purchase online.}
& NA
& 1/2
& \multicolumn{2}{c|}{38.25/ 61.75}
& \multicolumn{2}{c|}{23.86/ 76.14} \\
\hline
\endhead
\multicolumn{7}{r}{\textit{continuation on the next page}}
\endfoot
\endlastfoot
I, III: Sending package\newline
II, IV: Purchase online
& & & \makecell[t]{I.\\ $(n11 = 210)$}
& \makecell[t]{II.\\ $(n12 = 339)$}
& \makecell[t]{III.\\ (n21 = 99)}
& \makecell[t]{IV.\\ (n22 = 316)} \\
\hline
What have you sent to someone else/ you bought (multiple choices): Dry cleaning, fast foods, lunch, dinner, birthday cake, etc (immediate delivery)\textasciicircum 1/ Groceries\textasciicircum 2/ Beverage, dry foods\textasciicircum 3/ Personal health, medicine\textasciicircum 4/ Apparel\textasciicircum 5/ Books, Music, Videos\textasciicircum 6/ Consumer electronics\textasciicircum 7/ Others\textasciicircum 8.
& \makecell[t]{(I, III, IV) 1/3;\\ (II) 1/5}
& \makecell[t]{74.90/ 13.30/\\ 11.80}
& \makecell[t]{\SI{6.20}{\degree} 1/ \SI{71.00}{\degree} 2/ \\
\SI{1.00}{\degree} 3/ \SI{0.50}{\degree} 4/ \\
\SI{21.40}{\degree} 5}
& \makecell[t]{41.40/ 34.30/ \\ 24.20}
& \makecell[t]{3.20/ 75.00/ \\[3ex]
21.80}
& \\
\hline
& \makecell[t]{-\textasciicircum 1/ \SI{3.30}{\degree} 2/ \\
-\textasciicircum 3/ -\textasciicircum 4/ \\
\SI{21.00}{\degree} 5/ \\
\SI{44.80}{\degree} 6/ \\
\SI{31.00}{\degree} 7/ -\textasciicircum 8}
& \makecell[t]{\SI{4.00}{\degree} 1/ \\
\SI{3.00}{\degree} 2/ \\
\SI{37.50}{\degree} 3/ \\
\SI{50.50}{\degree} 4/ \\
\SI{3.00}{\degree} 5/ \\
\SI{2.00}{\degree} 6}
& \makecell[t]{\SI{61.40}{\degree} 1/ \SI{7.90}{\degree} 2/\\
\SI{3.20}{\degree} 3/ \SI{0.90}{\degree} 4/ \\
\SI{3.20}{\degree} 5/ \SI{0.30}{\degree} 6/ \\
\SI{22.80}{\degree} 7/ \SI{0.30}{\degree} 8}
& & & \\
\hline
Time for deliver.
& Hours
& \makecell[t]{(I) 0.75/23; \\ \\ \\ (II) 0.5/ 19; \\
(III) 0.5/12; \\ (IV) 0.33/ 18}
& 7.65/ 1.27
& 4.25/ 2.01
& 3.73/ 0.36
& 4.39/ 0.28 \\
\hline
Time for deliver.
& Days
& \makecell[t]{1/28; \\ \\ \\ \\
(II) 1/18; \\
(III) 1/14; \\
(IV) 1/30}
& 3.22/ 0.09
& 3.46/ 0.13
& 2.75/ 0.24
& 2.64/ 0.13 \\
\hline
Satisfaction with the delivery time: No/ Yes.
& NA
& 0/1
& 5.90/94.10
& 9.00/ 91.00
& 13.10/ 86.90
& 13.00/ 87.00 \\
\hline
Able to track and trace the item online: Yes, I could track via
carrier’s website (and/or app)/ Yes, I could track by calling
courier’s cellphone / No, I could not track it.
& NA
& \makecell[t]{(I, II) 1/2; \\ (III, IV) 1/3}
& 94.40/ -/ 5.60
& 91.90/ -/ 8.10
& \makecell[t]{33.30/ 31.30/ \\ 35.40}
& \makecell[t]{27.20/ 25.60/\\ 47.20} \\
\hline
Satisfaction with electronic delivery notification: Yes, I was satisfied with the service/ No, the service was not good/ No, they did not provide the service.
& NA
& 1/3
& \makecell[t]{82.60/ 3.80/ \\ 13.60}
& \makecell[t]{84.30/ 4.80/\\ 11.00}
& \makecell[t]{61.60/ 10.10/ \\ 28.30}
& \makecell[t]{68.00/ 8.50/ \\ 23.40} \\
\hline
Choose the pickup (I, III)/delivery (II, IV) time window: Yes, I could, and I used that service/ Yes, I could, but I did not use that service/ No, I could not. The carrier did not offer that service.
& NA
& 1/3
& \makecell[t]{19.50/ 36.60/ \\ 44.00}
& \makecell[t]{30.00/ 20.50/ \\ 49.50}
& \makecell[t]{41.40/ 17.20/ \\ 41.40}
& \makecell[t]{56.60/ 24.40/ \\ 19.00} \\
\hline
Carriers offer pickup at home (I, III)/ provide convenient drop-off location (II, IV): Yes, but I have never used the service\textasciicircum 1/ Yes, the service is excellent\textasciicircum 2/ Yes, the service is good\textasciicircum 3/ No, the service is bad\textasciicircum 4/ I have no idea about the service\textasciicircum 5.
& NA
& 1/5
& & & & \\
\hline
Did you tip the delivery person: No/ Yes.
& NA
& 0/1
& 92.90/ 7.10
& 97.60/ 2.40
& -
& - \\
\hline
Number of times did: (I, II) you use the service of the carrier per year; (II, IV) you shop in the same website/shop per year.
& Numbers
& \makecell[t]{(I, II) 1/300; \\ (III) 1/ 550;\\ (IV) 1/500.}
& 18.41/ 35.92
& 19.23/ 27.98
& 25.05/ 73.87
& 7.07/ 31.01 \\
\hline
\end{longtable}
\end{landscape}
\end{document}