这里广泛讨论了横向或纵向格式的 Latex 表格。我几乎尝试了这里介绍的所有解决方案。但是,我仍然面临一个问题。我有一个包含 40 多行(最低 40 行)的表格。我有两个选择
1)在多个页面上垂直显示整个表格或
2)制作横向布局,并沿多页水平分部分移动表格。
我已经尝试了所有解决方案,例如minipage
,longtable
(它适用于单列文章,不适用于双列文章)、、、、' landscape
afterpage ' 等。sidewaystables
rotatebox
这是我尝试过的 MWE 之一
\documentclass[10pt,a4paper,twocolumn]{article}
\usepackage{lipsum}
\usepackage{ltablex}
\begin{document}
\lipsum[1-2]
\begin{table}
\rotatebox{90}{
\begin{minipage}{\textheight}
%\begin{table}
\centering
\caption{Caption}
\label{my-label}
\begin{tabular}{p{4cm}p{3cm}p{3cm}lp{6cm}}
\textbf{Author} & \textbf{Type} & \textbf{Artifact} & \textbf{Method} & \textbf{Task} \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
\end{tabular}
\end{minipage}}
\end{table}
\lipsum[3-7]
\end{document}
答案1
这个表好像没什么特别的吧?只是在横向环境下 longtable 好像就满足要求了。
\documentclass[12pt,twocolumn]{article}
\usepackage{lipsum}
\usepackage{pdflscape,longtable,array}
\begin{document}
\lipsum[1-2]
\onecolumn
\begin{landscape}
\begin{longtable}{p{4cm}p{3cm}p{3cm}lp{6cm}}
\caption{Caption\label{my-label}}\\
\textbf{Author} & \textbf{Type} & \textbf{Artifact} & \textbf{Method} & \textbf{Task} \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\\\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
Haiduc et al. & Extractive & C+M & IR & Program Comprehension \\
\end{longtable}
\end{landscape}
\twocolumn
\lipsum[3-7]
\end{document}