我正在尝试使以下两个表格适合页面宽度,但我不想使用环境sidewaystable
。我需要两个表格都在landscape
。还有其他选择吗?
\documentclass[12pt]{article}
\addtolength{\parskip}{\baselineskip}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage[fleqn]{amsmath}
\usepackage{mathtools}
\usepackage{siunitx}
%Tables preamble
\usepackage[none]{hyphenat}
\usepackage{array}
\usepackage[thinlines]{easytable}
\usepackage{longtable}
\usepackage{array,
booktabs, makecell, multirow}
\renewcommand\theadfont{\bfseries\small}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
\usepackage{pdflscape}
\usepackage{afterpage}
\begin{document}
\afterpage{\clearpage}
\thispagestyle{empty}
\begin{landscape}
\begin{table}[ht] \centering
\caption{Oaxaca Blinder Decomposition results}
\begin{tabular}{ l*{6}{S[table-format=2.2]} } \toprule
\label{tab:oaxaca}
\thead[b]{Terms of \\ decomposition} & \multicolumn{3}{c}{2011-12} & \multicolumn{3}{c}{2004-05} \\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){5-7}
\midrule
& \textbf{women ws} & \textbf{male ws} & \textbf{pooled ws} & \textbf{women ws} & \textbf{male ws} & \textbf{pooled ws} \\ \hline
\\
{Difference} & 0.39 & 0.39 & 0.39 & 0.48 & 0.48 & 0.48 \\ \hdashline
{Explained} & -0.02 & 0.00 & -0.01 & 0.07 & 0.10 & 0.09 \\ \hdashline
{Unexplained} & 0.48 & 0.39 & 0.40 & 0.41 & 0.37 & 0.38 \\ \hline
\textbf{Percent unexplained} & 102.95 & 98.42 & 99.62 & 85.42 & 78.88 & 79.49 \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}[ht] \centering
\caption{MMM Decomposition results}
\begin{tabular}{ l*{9}{S[table-format=2.2]} }\toprule
\textbf{Deciles} & \textbf{Men} & \textbf{Women} & \textbf{Difference} & \multicolumn{3}{c}{Returns to women} & \multicolumn{3}{c}{Returns to men} \\
\cmidrule(lr){5-7}\cmidrule(lr){8-10}
\midrule
& & & & {CF1} & {Charac} & {Coeff} & {CF2} & {Charac} & {Coeff} \\ \midrule
{Panel A: 2011-12} \\ \hline
{1} & 1.806 & 2.402 & 0.596 & 2.361 & 0.409 & 0.555 & 1.791 & 0.014 & -0.610 \\ \hdashline
{2} & 2.131 & 2.655 & 0.524 & 2.609 & 0.046 & 0.478 & 2.156 & -0.025 & -0.500 \\ \hdashline
{3} & 2.368 & 2.854 & 0.485 & 2.815 & 0.039 & 0.446 & 2.412 & -0.043 & -0.442 \\ \hdashline
\bottomrule
\end{tabular}
\end{table}
\end{landscape}
\end{document}
答案1
我不明白为什么这些表格应该是横向的,因为机器人很容易设置为纵向(只需对表格设计进行微小的改动):
\documentclass[12pt]{article}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage{array,
booktabs, makecell, multirow, tabularx}
\renewcommand\theadfont{\bfseries\small}
\usepackage{dcolumn}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{showframe}
\begin{document}
\thispagestyle{empty}
\begin{table}[ht]
\centering
\caption{Oaxaca Blinder Decomposition results}
\begin{tabular*}{\linewidth}
{@{\extracolsep{\fill}}
l*{6}{S[table-format=-2.2]} }
\toprule
\label{tab:oaxaca}
& \multicolumn{3}{c}{2011-12} & \multicolumn{3}{c}{2004-05} \\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){5-7}
\thead[b]{Terms of \\ decomposition}
& {\thead[b]{women\\ ws}} & {\thead[b]{male\\ ws}} & {\thead[b]{pooled\\ ws}}
& {\thead[b]{women\\ ws}} & {\thead[b]{male\\ ws}} & {\thead[b]{pooled\\ ws}} \\ \midrule
Difference & 0.39 & 0.39 & 0.39 & 0.48 & 0.48 & 0.48 \\ \hdashline
Explained & -0.02 & 0.00 & -0.01 & 0.07 & 0.10 & 0.09 \\ \hdashline
Unexplained & 0.48 & 0.39 & 0.40 & 0.41 & 0.37 & 0.38 \\
\midrule
\textbf{Unexplained} (\%)
& 102.95 & 98.42& 99.62 & 85.42 & 78.88 & 79.49 \\
\bottomrule
\end{tabular*}
\end{table}
or
\begin{table}[ht] \centering
\caption{Oaxaca Blinder Decomposition results}
\begin{tabular}{l*{6}{S[table-format=-1.2]} }
\toprule
\label{tab:oaxaca}
\multirow{2}{*}{\thead[b]{Terms of \\ decomposition}}
& \multicolumn{3}{c}{2011-12} & \multicolumn{3}{c}{2004-05} \\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){5-7}
& \textbf{women} & \textbf{male} & \textbf{pooled}
& \textbf{women} & \textbf{male} & \textbf{pooled} \\ \midrule
Difference & 0.39 & 0.39 & 0.39 & 0.48 & 0.48 & 0.48 \\ \hdashline
Explained & -0.02 & 0.00 & -0.01 & 0.07 & 0.10 & 0.09 \\ \hdashline
Unexplained & 0.48 & 0.39 & 0.40 & 0.41 & 0.37 & 0.38 \\
\midrule
\textbf{Unexplained} (\%)
& 102.95 & 98.42& 99.62 & 85.42 & 78.88 & 79.49 \\
\bottomrule
\end{tabular}
\end{table}
\begin{table}[ht]
\centering
\setlength\tabcolsep{0pt}
\caption{MMM Decomposition results}
\begin{tabular*}{ \linewidth}{@{\extracolsep{\fill}}
l*{9}{S[table-format=-1.3]}
}
\toprule
\textbf{Deciles} & \textbf{Men} & \textbf{Women} & \textbf{Diff.} & \multicolumn{3}{c}{Returns to women} & \multicolumn{3}{c}{Returns to men} \\
\cmidrule(lr){5-7}\cmidrule(lr){8-10}
& & & & {CF1} & {Charac} & {Coeff} & {CF2} & {Charac} & {Coeff} \\
\midrule
\multicolumn{10}{l}{Panel A: 2011-12} \\
\midrule
{1} & 1.806 & 2.402 & 0.596 & 2.361 & 0.409 & 0.555 & 1.791 & 0.014 & -0.610 \\ \hdashline
{2} & 2.131 & 2.655 & 0.524 & 2.609 & 0.046 & 0.478 & 2.156 & -0.025 & -0.500 \\ \hdashline
{3} & 2.368 & 2.854 & 0.485 & 2.815 & 0.039 & 0.446 & 2.412 & -0.043 & -0.442 \\ \bottomrule
\end{tabular*}
\end{table}
%\end{landscape}
\end{document}
笔记:的意思韋斯在第一个表格中我不知道。我会删除它们(如表格的第二个示例所示)并在文本或表格标题中解释其含义。
附录: 如下面 op 评论所示,表格必须是横向的,并且应该与这个方向上的文本宽度相同...
\documentclass[12pt]{article}
\usepackage[margin=1in,includefoot]{geometry}
\usepackage{pdflscape}
\usepackage{afterpage}
\usepackage{siunitx}
\usepackage{booktabs, makecell, multirow}
\renewcommand\theadfont{\bfseries\small}
\begin{document}
\thispagestyle{empty}
\afterpage{\clearpage}
\begin{landscape}
\noindent%
\verb+x - - -+ \hfill \verb+- - -+ indicate text width in landscape orientation \verb+- - -+ \hfill \verb+- - - x+
\begin{table}[ht]
\centering
\caption{Oaxaca Blinder Decomposition results}
\begin{tabular*}{\linewidth}
{@{\extracolsep{\fill}}
l*{6}{S[table-format=-2.2]} }
\toprule
\label{tab:oaxaca}
& \multicolumn{3}{c}{2011-12} & \multicolumn{3}{c}{2004-05} \\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){5-7}
\thead[b]{Terms of decomposition}
& {\thead[b]{women ws}} & {\thead[b]{male ws}} & {\thead[b]{pooled ws}}
& {\thead[b]{women ws}} & {\thead[b]{male ws}} & {\thead[b]{pooled ws}} \\ \midrule
Difference & 0.39 & 0.39 & 0.39 & 0.48 & 0.48 & 0.48 \\
Explained & -0.02 & 0.00 & -0.01 & 0.07 & 0.10 & 0.09 \\
Unexplained & 0.48 & 0.39 & 0.40 & 0.41 & 0.37 & 0.38 \\
\midrule
\textbf{Unexplained} (\%)
& 102.95 & 98.42& 99.62 & 85.42 & 78.88 & 79.49 \\
\bottomrule
\end{tabular*}
\end{table}
\begin{table}[ht]
\centering
\setlength\tabcolsep{0pt}
\caption{MMM Decomposition results}
\begin{tabular*}{ \linewidth}{@{\extracolsep{\fill}}
l*{9}{S[table-format=-1.3]}
}
\toprule
\textbf{Deciles} & {\textbf{Men}} & {\textbf{Women}} & {\textbf{Difference}} & \multicolumn{3}{c}{Returns to women} & \multicolumn{3}{c}{Returns to men} \\
\cmidrule(l){5-7}\cmidrule(l){8-10}
& & & & {CF1} & {Charac} & {Coeff} & {CF2} & {Charac} & {Coeff} \\
\midrule
Panel A: 2011-12 & \multicolumn{9}{c}{} \\
\midrule
{1} & 1.806 & 2.402 & 0.596 & 2.361 & 0.409 & 0.555 & 1.791 & 0.014 & -0.610 \\
{2} & 2.131 & 2.655 & 0.524 & 2.609 & 0.046 & 0.478 & 2.156 & -0.025 & -0.500 \\
{3} & 2.368 & 2.854 & 0.485 & 2.815 & 0.039 & 0.446 & 2.412 & -0.043 & -0.442 \\ \bottomrule
\end{tabular*}
\end{table}
\end{landscape}
\end{document}
答案2
您还可以尝试tabularx
:
\begin{tabularx}{\hsize}{<column specs>}
...
\end{tabularx}
以下是使用此方法的完整示例:
\documentclass[12pt]{article}
\usepackage[margin=1in]{geometry}
\usepackage[fleqn]{amsmath}
\usepackage{mathtools}
\usepackage{siunitx}
%Tables preamble
\usepackage[none]{hyphenat}
\usepackage[thinlines]{easytable}
\usepackage{tabularx,array,booktabs,makecell,multirow}
\renewcommand*\theadfont{\bfseries\small}
\usepackage{arydshln}
\setlength\dashlinedash{0.2pt}
\setlength\dashlinegap{1.5pt}
\setlength\arrayrulewidth{0.3pt}
\usepackage{pdflscape}
\addtolength{\parskip}{\baselineskip}
\begin{document}
\begin{landscape}
\begin{table}[ht] \centering
\caption{Oaxaca Blinder Decomposition results}
\begin{tabularx}{\hsize}{ Xl*{5}{S[table-format=2.2]} }
\toprule
\label{tab:oaxaca}
\thead[b]{Terms of \\ decomposition} & \multicolumn{3}{c}{2011-12} & \multicolumn{3}{c}{2004-05} \\
\cmidrule(lr){2-4}\cmidrule(lr){5-7}\cmidrule(lr){5-7}
\midrule
& \textbf{women ws} & \textbf{male ws} & \textbf{pooled ws} & \textbf{women ws} & \textbf{male ws} & \textbf{pooled ws} \\ \hline
\\
{Difference} & 0.39 & 0.39 & 0.39 & 0.48 & 0.48 & 0.48 \\ \hdashline
{Explained} & -0.02 & 0.00 & -0.01 & 0.07 & 0.10 & 0.09 \\ \hdashline
{Unexplained} & 0.48 & 0.39 & 0.40 & 0.41 & 0.37 & 0.38 \\ \hline
\textbf{Percent unexplained} & 102.95 & 98.42 & 99.62 & 85.42 & 78.88 & 79.49 \\
\bottomrule
\end{tabularx}
\end{table}
%\clearpage
\begin{table}[ht] \centering
\caption{MMM Decomposition results}
\begin{tabularx}{\hsize}{ Xl*{8}{S[table-format=2.2]} }
\toprule
\textbf{Deciles} & \textbf{Men} & \textbf{Women} & \textbf{Difference} & \multicolumn{3}{c}{Returns to women} & \multicolumn{3}{c}{Returns to men} \\
\cmidrule(lr){5-7}\cmidrule(lr){8-10}
\midrule
& & & & {CF1} & {Charac} & {Coeff} & {CF2} & {Charac} & {Coeff} \\ \midrule
{Panel A: 2011-12} \\ \hline
{1} & 1.806 & 2.402 & 0.596 & 2.361 & 0.409 & 0.555 & 1.791 & 0.014 & -0.610 \\ \hdashline
{2} & 2.131 & 2.655 & 0.524 & 2.609 & 0.046 & 0.478 & 2.156 & -0.025 & -0.500 \\ \hdashline
{3} & 2.368 & 2.854 & 0.485 & 2.815 & 0.039 & 0.446 & 2.412 & -0.043 & -0.442 \\ \hdashline
\bottomrule
\end{tabularx}
\end{table}
\end{landscape}
\end{document}