我使用以下代码创建了一个带有垂直列名的大表格。但是,表格与我的文本重叠。我需要在整个页面上都有一个表格。我很感激任何有关这方面的帮助,因为我正在写论文。
\documentclass[compsoc]{IEEEtran}
\usepackage{array}
\usepackage{booktabs}
\usepackage{rotating}
\newcolumntype{P}[2]{%
>{\begin{turn}{#1}\begin{minipage}{#2}\small\raggedright\hspace{0pt}}l%
<{\end{minipage}\end{turn}}%
}
\begin{document}
\begin{table}
% \centering
\caption{Some properties}
\label{tab:test1}
\begin{tabular}{@{}rcccccccccccccccccc@{}}
\toprule
& \multicolumn{1}{P{90}{1.6cm}}{Feedback} &
\multicolumn{1}{P{90}{1.6cm}}{Adaptation} &
\multicolumn{1}{P{90}{1.6cm}@{}}{Previous Knowledge Construction}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Challenging Assessment Methods}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Collaborative Learning}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Authentic \& Challenging Goals}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Inquiry-Based LEarning}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Use of Multimedia}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Multi vs. Single users}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Visibilitiy of System Status}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Sense of Presence}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Matching with Real-world}&
\multicolumn{1}{P{90}{1.6cm}@{}}{User Control \& Freedom}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Consistency \& Standards}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Error Prevention}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Previous Knowledge Construction}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Recognition Rather than Recall}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Flexible and ease of use}&
\multicolumn{1}{P{90}{1.6cm}@{}}{High Representational Fidelity}\\
\midrule
Babich et al.\cite{Babich2004} & N & N & N & N & N & N& N & X & X & N & N & N & N& X & N & N & N & N\\
% System 2 & X & X & X \\
% System 3 & X & & X \\
\bottomrule
\end{tabular}
\end{table}
\end{document}
答案1
只要您为列标题设置较大的高度,为 设置较小的值\tabcolsep
,并使用table*
环境,您的表格将完美地适合纵向方向。我使用\rothead
from 命令来做到这一点makecell
,因为它的语法简单得多。最后,我使用了环境tabularx
和X
第一列的类型;
\documentclass[compsoc]{IEEEtran}
\usepackage{tabularx, makecell}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{lipsum}
\begin{document}
\begin{table*}
\centering
\setlength{\tabcolsep}{3.5pt}
\setlength\rotheadsize{3.2cm}
\renewcommand{\theadfont}{\small}
\caption{Some properties}
\label{tab:test1}
\begin{tabularx}{\linewidth}{@{}X*{19}{c}@{}}
\toprule
& \rothead{Feedback} &
\rothead{Adaptation} &
\rothead{Previous Knowledge Construction}&
\rothead{Challenging Assessment Methods}&
\rothead{Collaborative Learning}&
\rothead{Authentic \& Challenging Goals}&
\rothead{Inquiry-Based LEarning}&
\rothead{Use of Multimedia}&
\rothead{Multi vs. Single users}&
\rothead{Visibilitiy of System Status}&
\rothead{Sense of Presence}&
\rothead{Matching with Real-world}&
\rothead{User Control \& Freedom}&
\rothead{Consistency \& Standards}&
\rothead{Error Prevention}&
\rothead{Previous Knowledge Construction}&
\rothead{Recognition Rather than Recall}&
\rothead{Flexible and ease\\ of use}&
\rothead{High Representational Fidelity}\\
\midrule
Babich et al.\cite{Babich2004} & N & N & N & N & N & N& N & X & X & N & N & N & N& X & N & N & N & N\\
% System 2 & X & X & X \\
% System 3 & X & & X \\
\bottomrule
\end{tabularx}
\end{table*}
\lipsum[1-25]
\end{document}
答案2
在下面的例子中,我添加了缺少的列说明符,并将其替换为,table
以table*
防止表格与文本重叠,并使用更高的标题行与略微降低的组合,\tabcolsep
以使表格足够窄以适合页面:
\documentclass[compsoc]{IEEEtran}
\usepackage{array}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{lipsum}
\newcolumntype{P}[2]{%
>{\begin{turn}{90}\begin{minipage}{#2}\small\raggedright\hspace{0pt}}l%
<{\end{minipage}\end{turn}}%
}
\newcommand{\myrothead}{\multicolumn{1}{P{90}{3.25cm}}}
\begin{document}
\lipsum\lipsum \lipsum
\begin{table*}
\setlength{\tabcolsep}{4.9pt}
\caption{Some properties}
\label{tab:test1}
\begin{tabular}{@{}r*{19}{c}@{}}
\toprule
& \myrothead{Feedback} &
\myrothead{Adaptation} &
\myrothead{Previous Knowledge Construction}&
\myrothead{Challenging Assessment Methods}&
\myrothead{Collaborative Learning}&
\myrothead{Authentic \& Challenging Goals}&
\myrothead{Inquiry-Based LEarning}&
\myrothead{Use of Multimedia}&
\myrothead{Multi vs. Single users}&
\myrothead{Visibilitiy of System Status}&
\myrothead{Sense of Presence}&
\myrothead{Matching with Real-world}&
\myrothead{User Control \& Freedom}&
\myrothead{Consistency \& Standards}&
\myrothead{Error Prevention}&
\myrothead{Previous Knowledge Construction}&
\myrothead{Recognition Rather than Recall}&
\myrothead{Flexible and ease of use}&
\myrothead{High Representational Fidelity}\\
\midrule
Babich et al.\cite{Babich2004} & N & N & N & N & N & N& N & X & X & N & N & N & N& X & N & N & N & N\\
% System 2 & X & X & X \\
% System 3 & X & & X \\
\bottomrule
\end{tabular}
\end{table*}
\lipsum
\end{document}
根据最终表格所包含的条目数(行数),您还可以考虑转置表格。这可能会使相当长的列标题更易于阅读。
答案3
我找到了解决方案。正如@leandriis 在评论中提到的,表格的宽度很大,所以我需要将方向改为横向。最后,代码如下所示:
\documentclass[compsoc]{IEEEtran}
\usepackage{array}
\usepackage{booktabs}
\usepackage{rotating}
\usepackage{lscape}
\newcolumntype{P}[2]{%
>{\begin{turn}{#1}\begin{minipage}{#2}\small\raggedright\hspace{0pt}}l%
<{\end{minipage}\end{turn}}%
}
\begin{document}
\begin{landscape}
\begin{table}
% \centering
\caption{Some properties}
\label{tab:test1}
\begin{tabular}{@{}rcccccccccccccccccc@{}}
\toprule
& \multicolumn{1}{P{90}{1.6cm}}{Feedback} &
\multicolumn{1}{P{90}{1.6cm}}{Adaptation} &
\multicolumn{1}{P{90}{1.6cm}@{}}{Previous Knowledge Construction}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Challenging Assessment Methods}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Collaborative Learning}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Authentic \& Challenging Goals}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Inquiry-Based LEarning}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Use of Multimedia}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Multi vs. Single users}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Visibilitiy of System Status}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Sense of Presence}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Matching with Real-world}&
\multicolumn{1}{P{90}{1.6cm}@{}}{User Control \& Freedom}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Consistency \& Standards}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Error Prevention}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Previous Knowledge Construction}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Recognition Rather than Recall}&
\multicolumn{1}{P{90}{1.6cm}@{}}{Flexible and ease of use}&
\multicolumn{1}{P{90}{1.6cm}@{}}{High Representational Fidelity}\\
\midrule
Babich et al.\cite{Babich2004} & N & N & N & N & N & N& N & X & X & N & N & N & N& X & N & N & N & N\\
% System 2 & X & X & X \\
% System 3 & X & & X \\
\bottomrule
\end{tabular}
\end{table}
\end{landscape}
\end{document}