我使用的是双栏纸张格式,并且有以下两个要求。首先,我需要表格横跨整个文档的宽度,而不仅仅是一栏。其次,如果表格的长度超过页面高度,则应正确拆分。
请帮忙。
\documentclass[5p,times,authoryear]{elsarticle}
\usepackage{ecrc_RIAI}
\usepackage[spanish]{babel} % Idioma
\addto\captionsspanish{%
\def\tablename{Tabla}%
}
\usepackage[latin1]{inputenc
\usepackage{amsmath}
\usepackage{epstopdf}
\usepackage{flushend}
\usepackage{amssymb}
\usepackage[figuresright]{rotating}
\usepackage{longtable}
\usepackage{supertabular,booktabs}
\usepackage{geometry}
\usepackage{cuted, ragged2e}
\usepackage{lipsum, array, booktabs, multirow, caption, float,xtab}
\usepackage[table]{xcolor}
\usepackage{makecell}
\renewcommand\theadalign{lc}
\renewcommand\theadfont{\bfseries}
\renewcommand\cellalign{lc}
\setcellgapes{3pt}
\usepackage{cellspace}
\setlength\cellspacetoplimit{5pt}
\setlength\cellspacebottomlimit{5pt}
\cellset{\color{red}}
\begin{document}
\begin{center}
\begin{xtabular}{l l l l l l l}
Controller Name & Language & Developer organization & Version & Open Source & Overview & Reference \\\hline
POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & ~\cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & ~\cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & NTT,OSRG group & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & ~\cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
Controller Name & Language & Developer organization & Version & Open Source & Overview & Reference \\\hline
POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & ~\cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & ~\cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & NTT,OSRG group & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & ~\cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
Controller Name & Language & Developer organization & Version & Open Source & Overview & Reference \\\hline
POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & ~\cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & ~\cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & NTT,OSRG group & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & ~\cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
Controller Name & Language & Developer organization & Version & Open Source & Overview & Reference \\\hline
POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & ~\cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & ~\cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & NTT,OSRG group & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & ~\cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
Controller Name & Language & Developer organization & Version & Open Source & Overview & Reference \\\hline
POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & ~\cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & ~\cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & NTT,OSRG group & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & ~\cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
Controller Name & Language & Developer organization & Version & Open Source & Overview & Reference \\\hline
POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & ~\cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & ~\cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & NTT,OSRG group & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & ~\cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
\hline
\end{xtabular}
\end{center}
\bibliographystyle{elsarticle-harv}
\bibliography{References.bib}
\end{document}
答案1
到目前为止,我已经能够将您的表格变成下一个形式:
为了实现这一目标,我做了以下工作:
- 从序言中删除所有编写表格不需要的包(有些包加载了两次……你真的需要所有这些包吗?
- 使用
X
列类型(来自包tabularx
)作为包含长文本的单元格的列,否则这些文本会溢出页面 - 使用包中的宏
\thead
使列标题更短(使用两行),并且使第三列中的一些单元格更短makecell
makecell
- 使用
\small
字体大小使多行单元格中的文本在单元格中更好地显示
通过这种测量方法,表格(如您在上图中所见)与文本宽度紧密贴合,并放置在一页上。
\documentclass[5p,times,authoryear]{elsarticle}
\usepackage{geometry}
\usepackage[spanish]{babel} % Idioma
\usepackage{caption}
\usepackage{booktabs, makecell, tabularx}
\usepackage[table]{xcolor}
\renewcommand\theadalign{bc}
\renewcommand\theadfont{\small\bfseries}
\renewcommand\theadgape{}
\setcellgapes{3pt}
\renewcommand\cellalign{tl}
\begin{document}
\begin{table*}
\caption{My huge table ...}
\label{fig:myhugetable}
\small
\begin{tabularx}{\linewidth}{@{} ll ll l X l @{}}
\toprule
\thead{Controller\\ Name}
& \thead{Language}
& \thead{Developer\\ organization}
& \thead{Version}
& \thead{Open\\ Source}
& \thead{Overview}
& \thead{Reference} \\
\midrule
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
POX & Python & Nicira & 1.0 & Yes
& An Open Flow controller is being supported via SDN controller in general.
& \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\
NOX & C++/Python & Nicira & 1.0 & Yes
& It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python.
& \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\
RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes
& It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN.
& \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\
\bottomrule
\end{tabularx}
\end{table*}
%\bibliographystyle{elsarticle-harv}
%\bibliography{References.bib}
\end{document}
编辑: 如果实际表格比上面考虑的更长,那么我建议如下:
- 手动将表拆分为两部分
- 使用包
\ContinuedFloat
中的宏caption
在两个表格部分中保留相同的标题编号。 stfloats
使用能够将表定位在插入到的同一包的底部的包:\documentclass[5p,times,authoryear]{elsarticle} \usepackage{geometry} \usepackage[spanish]{babel} \usepackage{caption} \usepackage{booktabs, makecell, tabularx} \usepackage[table]{xcolor} \renewcommand\theadalign{bc} \renewcommand\theadfont{\small\bfseries} \renewcommand\theadgape{} \setcellgapes{3pt} \renewcommand\cellalign{tl} \usepackage{stfloats} \usepackage{lipsum} % for dummy text \begin{document} \lipsum[1-4] \begin{table*}[b] % <--- \makegapedcells % <--- \caption{My huge table ... (first part)} \label{fig:myhugetable} \small \begin{tabularx}{\linewidth}{@{} ll ll l X l @{}} \toprule \thead{Controller\\ Name} & \thead{Language} & \thead{Developer\\ organization} & \thead{Version} & \thead{Open\\ Source} & \thead{Overview} & \thead{Reference} \\ \midrule POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\ NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\ RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\ % ... \bottomrule \end{tabularx} \end{table*} \begin{table*}[t] % <--- \ContinuedFloat % <--- \makegapedcells \caption{My huge table ... (second part)} \label{fig:myhugetable} \small \begin{tabularx}{\linewidth}{@{} ll ll l X l @{}} \toprule \thead{Controller\\ Name} & \thead{Language} & \thead{Developer\\ organization} & \thead{Version} & \thead{Open\\ Source} & \thead{Overview} & \thead{Reference} \\ \midrule POX & Python & Nicira & 1.0 & Yes & An Open Flow controller is being supported via SDN controller in general. & \cite{masoudi_software_2016,noauthor_mccauley_nodate}[20],[29]\\ NOX & C++/Python & Nicira & 1.0 & Yes & It is open flow controller. Current NOX is written in C++ and Classic NOX is written in C++ and Python. & \cite{masoudi_software_2016,gude_nox:_2008} [20],[30]\\ RYU & Python & \makecell{NTT,\\OSRG group} & 1.5 & Yes & It is SDN OS which provides the centralized control logically. The open Flow v1.0, v1.2 and v1.3 are supported by component RYU that is based on framework of SDN. & \cite{masoudi_software_2016,noauthor_ryu_nodate} [20],[31]\\ % ... \bottomrule \end{tabularx} \end{table*} \lipsum[5-15] \end{document}