我的论文中有一张表格,需要横跨多页,最好使用threeparttable
。我发现threeparttablex
可以使用longtable
,所以我改用了 。当前代码有两个问题:
(1)当我使用landscape
(来自pdflscape
)时,该页面的边距变得混乱。 (2)不会longtable
跨页。
\documentclass{article} % use "amsart" instead of "article" for AMSLaTeX format
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{a4paper} % ... or a4paper or a5paper or ...
%\geometry{landscape} % Activate for for rotated page geometry
\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx} % Use pdf, png, jpg, or epsß with pdflatex; use eps in DVI mode
% TeX will automatically convert eps --> pdf in pdflatex
\usepackage{booktabs}
\usepackage{multirow} % Allows rows in tables to be combined.
\usepackage{threeparttable} % Allows for three part tables with a specified notes section.
\usepackage{threeparttablex} % Lets threeparttable work with longtable
\usepackage{longtable} % Allows tables to break across pages
\newcommand{\head}[1]{\textsf{\textbf{#1}}}
\renewcommand{\arraystretch}{1.3}
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\usepackage{tabulary}
\usepackage{rotate}
\usepackage{rotating}
\usepackage{pdflscape} %landscape single pages
%\usepackage{lscape}
\usepackage{fontspec,microtype}
\defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase}
\setmainfont[SmallCapsFeatures={LetterSpace=6}, Numbers={Proportional,OldStyle}]{Palatino}
\setsansfont[LetterSpace=3, Numbers={Proportional,OldStyle}]{Myriad Pro}
\usepackage{floatrow}
\floatsetup[table]{capposition = top, font = sf} % Sets table to sans serif font and puts the caption on the top
\usepackage{caption}
\captionsetup[table] {font=sf,justification=justified, singlelinecheck=false}
\usepackage{amssymb}
\title{Dissertation}
\author{Test}
%\date{} % Activate to display a given date or no date
\begin{document}
\maketitle
%\section{}
%\subsection{}
This is a test and I really hope I can get Tex to work for me.
For diversity, I use the Shannon-Weiner diversity index (SWDI) which is calculated as: \[SWDI = - \Sigma p_i *\! \ln(p_i)\] \label{SWDI} where $p_i = $ the share of the primary energy source $i$ in the TPES.
\begin{landscape}
\begin{table*}
\begin{ThreePartTable}
\caption{Indicators of energy security in long-term energy transformation scenarios}
\begin{longtable}{p{2.2cm} p{2.5cm} p{1cm} p{2.5cm} p{3.7cm} p{2cm} p{3cm} p{2cm}}
\toprule
\head{Test} & \centering{\head{Concern(s)}} &\centering{ \head{Unit}} & \centering{\head{Definition}} & \centering{\head{Formula}} & \centering{\head{Geography}} & \centering{\head{Sector}} & \head{References}\\
\midrule
\multicolumn{8}{c}{\head{\centering Sovereignty Indicators}} \\
\midrule
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\raggedright{\head{Test}} & \raggedright{Test} & \centering Test & \raggedright{Test Test Test Test Test Test} & $Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test & \centering{Test} & \raggedright{\head{Test Test Test Test Test Test Test}, Test Test Test Test} & \cite{Test}\\
\bottomrule
\end{longtable}
\begin{tablenotes}
\small
\item Notes: \item[a] This thesis uses the Shannon Wiener diversity index (see the equation for the \ref{SWDI}) for all diversity calculations.
\item[b] Neff \cite{*Neff:1997tk} and Lefevre \cite{*Lefevre:2007wg} use the Herfindahl-Hirschmann index. Costantini \cite{*Costantini:2007hx} use both the SWDI and HHI. Figures in italics show the ratios of the projected extraction volumes to the last column: Reserves and Resources estimates from the Global Energy Assessment \cite{Rogner:2012uq}. These estimates exclude gas hydrates and additional occurrences which are highly uncertain technologically and economically. Models have their own resource availability and cost curves which are not reported in this article but which are discussed in \cite{McCollum:wi}.
\end{tablenotes}
\end{ThreePartTable}
\end{table*}
\end{landscape}
\end{document}
答案1
Atable
或table*
环境是不可破坏的,所以它是罪魁祸首。
这是一个工作版本,它纠正了您输入中的一些错误。
\documentclass{article} % use "amsart" instead of "article" for AMSLaTeX format
\usepackage{geometry} % See geometry.pdf to learn the layout options. There are lots.
\geometry{a4paper} % ... or a4paper or a5paper or ...
%\geometry{landscape} % Activate for for rotated page geometry
\usepackage[parfill]{parskip} % Activate to begin paragraphs with an empty line rather than an indent
\usepackage{graphicx} % Use pdf, png, jpg, or epsß with pdflatex; use eps in DVI mode
% TeX will automatically convert eps --> pdf in pdflatex
\usepackage{booktabs}
\usepackage{multirow} % Allows rows in tables to be combined.
\usepackage{threeparttable} % Allows for three part tables with a specified notes section.
\usepackage{threeparttablex} % Lets threeparttable work with longtable
\usepackage{longtable} % Allows tables to break across pages
\newcommand{\head}[1]{\textsf{\textbf{#1}}}
\renewcommand{\arraystretch}{1.3}
\usepackage{array}
\newcolumntype{P}[1]{>{\raggedright\arraybackslash}p{#1}}
\newcolumntype{C}[1]{>{\centering\arraybackslash}p{#1}}
\usepackage{tabulary}
\usepackage{rotate}
\usepackage{rotating}
\usepackage{pdflscape} %landscape single pages
\usepackage{fontspec,microtype}
\defaultfontfeatures{Ligatures=TeX, Scale=MatchLowercase}
\setmainfont[SmallCapsFeatures={LetterSpace=6}, Numbers={Proportional,OldStyle}]{Palatino}
\setsansfont[LetterSpace=3, Numbers={Proportional,OldStyle}]{Myriad Pro}
\usepackage{floatrow}
\floatsetup[table]{capposition = top, font = sf} % Sets table to sans serif font and puts the caption on the top
\usepackage{caption}
\captionsetup[table] {font=sf,justification=justified, singlelinecheck=false}
\usepackage{amssymb}
\title{Dissertation}
\author{Test}
%\date{} % Activate to display a given date or no date
\begin{document}
\maketitle
%\section{}
%\subsection{}
This is a test and I really hope I can get Tex to work for me. For diversity, I use the Shannon-Weiner diversity
index (SWDI) which is calculated as: \[SWDI = - \Sigma p_i *\! \ln(p_i)\] \label{SWDI} where $p_i = $ the share
of the primary energy source $i$ in the TPES.
\begin{landscape}
\begin{ThreePartTable}
\begin{longtable}{P{2.2cm} P{2.5cm} C{1cm} P{2.5cm} p{3.7cm} C{2cm} p{3cm} p{2cm}}
\caption{Indicators of energy security in long-term energy transformation scenarios}\\
\toprule
\head{Test} & \centering\head{Concern(s)} &\centering\head{Unit} &
\centering\head{Definition} & \centering\head{Formula} &
\centering\head{Geography} & \centering\head{Sector} & \head{References}\\
\midrule
\multicolumn{8}{c}{\head{Sovereignty Indicators}} \\
\midrule
\endfirsthead
\toprule
\head{Test} & \centering\head{Concern(s)} &\centering\head{Unit} &
\centering\head{Definition} & \centering\head{Formula} &
\centering\head{Geography} & \centering\head{Sector} & \head{References}\\
\midrule
\multicolumn{8}{c}{\head{Sovereignty Indicators}} \\
\midrule
\endhead
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\head{Test} & Test & Test & Test Test Test Test Test Test &
$Trade_i = \Sigma s_i$ where $s_i $ Test Test Test Test Test Test Test Test Test Test Test Test &
Test & \head{Test Test Test Test Test Test Test}, Test Test Test Test & Test \\
\bottomrule
\end{longtable}
\begin{tablenotes}
\small
\item Notes:
\item[a] This thesis uses the Shannon Wiener diversity index (see the equation for the \ref{SWDI}) for all
diversity calculations.
\item[b] Neff \cite{*Neff:1997tk} and Lefevre \cite{*Lefevre:2007wg} use the Herfindahl-Hirschmann index.
Costantini \cite{*Costantini:2007hx} use both the SWDI and HHI. Figures in italics show the ratios of the
projected extraction volumes to the last column: Reserves and Resources estimates from the Global Energy
Assessment \cite{Rogner:2012uq}. These estimates exclude gas hydrates and additional occurrences which are
highly uncertain technologically and economically. Models have their own resource availability and cost curves
which are not reported in this article but which are discussed in \cite{McCollum:wi}.
\end{tablenotes}
\end{ThreePartTable}
\end{landscape}
\end{document}