标签对齐

标签对齐

我有以下 MWE:

\documentclass[11pt]{article}
\usepackage{rotating}
\usepackage{longtable}
\usepackage[labelfont=bf, labelsep=newline, justification=centering, textfont=it]{caption}
\usepackage{adjustbox}
\usepackage{graphicx}
\usepackage{booktabs, makecell, siunitx}
\usepackage{eqparbox}
\pagenumbering{gobble}
\usepackage{booktabs}
\usepackage[referable,para]{threeparttablex}
\usepackage[scale=1,textheight=27cm, textwidth=15cm, margin=2.5cm]{geometry}
\usepackage{multirow}
\usepackage{pdflscape}
\usepackage{interval}
\usepackage{pbox}
\sisetup{group-separator={,}, table-format=1.3, table-space-text-post=***, 
table-number-alignment =center}
\newcommand*{\MyIndent}
{\hspace*{1.5cm}}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro

\begin{document}

\begin{sidewaystable}[p] %table 1
\setlength{\tabcolsep}{18pt}
\centering
\normalsize
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\begin{threeparttable}
\caption{Summary Statistics\label{sumstat}}
\begin{tabular}{l*{8}{d{2.3}}}
\toprule \toprule

&\multicolumn{3}{c}{\textbf{Dem}} & \multicolumn{3}{c}{\textbf{No Dem.}} & \mc{\multirow{2}[1]{*}{Test for difference in means}}\\ 
\cmidrule(lr){2-4}\cmidrule(lr){5-7}
Variable                                                                                                                    &\mc{Obs.}          &\mc{Mean}          &\mc{S.D.}          &\mc{Obs.}          &\mc{Mean}          &\mc{S.D.} & \\ 
\midrule
$(ln)y_{i,t}$                                                                                               &\mc{9.31}          &\mc{8.79}          &\mc{9.56}          &\mc{-0.77}         &\mc{\phantom{-}-8.20} & & \mc{2.3}\\[1.5ex]
$PC_{i,t}$                                                                                                  &\mc{6.35}          &\mc{1.71}          &\mc{8.62}          &\mc{-6.91}             &\mc{-69.72} &&\\[1.5ex]
$(ln)s_{i,t}$                                                                                               &\mc{1.01}          &\mc{0.85}          &\mc{1.08}          &\mc{-0.23}             &\mc{\phantom{-}-5.86}  & &\\[1.5ex]
$(ln)(n+\delta+g_{T}+g_{GB})_{i,t}$ &&&&&&&\\
\bottomrule \bottomrule
\end{tabular}
\begin{tablenotes}
\small
      \item[]{\textit{Notes}: In column (a) we report the means of the main variables used in our analysis. In columns (b) and (c) we differentiate between countries with $PC\leq 5$ and those with $PC>5$. In column (d) we report the difference between the means for those two groups of countries, while in column (e) we display the t--test for the null hypothesis that the previous difference is equal to 0. Our sample consists of 119 countries spanning over the time period 1980--2010 (819 country--year observations). The panel is unbalanced. The countries included in our sample are: Albania, Algeria, Angola, Argentina, Australia, Austria, Bahrain, Bangladesh, Belgium, Benin, Bolivia, Botswana, Brazil, Bulgaria, Burkina Faso, Burundi, Cambodia, Cameroon, Canada, Central African Republic, Chad, Chile, China, Colombia, Congo, Dem. Rep., Congo, Republic Of, Costa Rica, Cote d'Ivoire, Cyprus, Czech Republic, Denmark, Dominican Republic, Ecuador, Egypt, El Salvador, Ethiopia, Fiji, Finland, France, Gabon, Germany, Ghana, Greece, Guatemala, Guinea-Bissau, Guyana, Haiti, Honduras, Hungary, India, Indonesia, Iran, Ireland, Israel, Italy, Jamaica, Japan, Jordan, Kenya, Korea, Republic of, Kuwait, Lesotho, Madagascar, Malawi, Malaysia, Mali, Mauritania, Mauritius, Mexico, Mongolia, Morocco, Mozambique, Namibia, Nepal, Netherlands, New Zealand, Nicaragua, Niger, Nigeria, Norway, Oman, Pakistan, Panama, Papua New Guinea, Paraguay, Peru, Philippines, Poland, Portugal, Qatar, Romania, Russia, Rwanda, Saudi Arabia, Senegal, Sierra Leone, Singapore, South Africa, Spain, Sri Lanka, Sweden, Switzerland, Syria, Taiwan, Tanzania, Thailand, Togo, Trinidad \& Tobago, Tunisia, Turkey, Uganda, United Arab Emirates, United KingdomUnited States, Uruguay, Venezuela, Vietnam, Zambia, Zimbabwe.}
      \end{tablenotes}
\end{threeparttable}
\end{sidewaystable}

\end{document}

我想在最后一列的两行上添加“均值差异检验”。我试过了,\mintab但没有成功。

有什么建议吗?提前谢谢

答案1

类似这样的内容?请注意,我删除了大部分\mc“包装”。还请注意,我为原本极其冗长(而且,我敢说,极其乏味)的tablenotes材料提供了更多结构。

在此处输入图片描述

\documentclass[11pt]{article}
\usepackage{rotating}
\usepackage[labelfont=bf, labelsep=newline, 
            justification=centering, 
            textfont=it]{caption}
\usepackage{booktabs, makecell, siunitx}
\pagenumbering{gobble}
\usepackage[referable,para,flushleft]{threeparttablex}
\usepackage[a4paper, margin=2.5cm]{geometry}
\usepackage{amsmath,ragged2e} % <-- new
\usepackage{interval,pbox}
\newcommand*{\MyIndent}{\hspace*{1.5cm}}
\usepackage{array,dcolumn}
\newcolumntype{d}[1]{D..{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}} % handy shortcut macro
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\newcommand\mytab[1]{%
   \smash[b]{\begin{tabular}[t]{@{}c@{}}#1\end{tabular}}}
\hyphenation{bur-kina} % not "burk-ina"...

\begin{document}

\begin{sidewaystable} %table 1

\centering
\normalsize

\begin{threeparttable}
\caption{Summary Statistics\label{sumstat}}
\begin{tabular}{@{} l *{3}{d{1.2}} *{3}{d{2.2}} d{1.1} @{}}
\toprule

Variable & \multicolumn{3}{c}{\textbf{Dem.}} 
         & \multicolumn{3}{c}{\textbf{No Dem.}} 
         & \multicolumn{1}{c@{}}{%
             \mytab{Test for \\diff.\ in means}}\\ 
\cmidrule(lr){2-4}\cmidrule(lr){5-7} 
& \mc{Obs.} & \mc{Mean} & \mc{S.D.} 
& \mc{Obs.} & \mc{Mean} & \mc{S.D.}\\ 
\midrule
$\ln y_{i,t}$ & 9.31 & 8.79 & 9.56 & -0.77 & -8.20 & & 2.3 \\[1.5ex]
$PC_{i,t}$ & 6.35 & 1.71 & 8.62 & -6.91 & -69.72 &         \\[1.5ex]
$\ln s_{i,t}$ & 1.01 & 0.85 & 1.08 & -0.23 & -5.86 &       \\[1.5ex]
$\ln (n+\delta+g_{T}+g_{GB})_{i,t}$ &&&&&&\\
\bottomrule
\end{tabular}

\small\RaggedRight
\begin{tablenotes}
\item\textit{Notes}: In column (a) we report the means of the main 
variables used in our analysis. 

In columns (b) and (c)~we differentiate between countries with 
\mbox{$PC\leq5$} and those with \mbox{$PC>5$}. 

In column~(d) we report the difference between the means for those 
two groups of countries, while in column~(e) we display the $t$-test 
for the null hypothesis that the previous difference is equal to~0. 

Our sample consists of 119 countries spanning the time period from 
1980 to 2010 (819 country-year observations). The panel is unbalanced. 

The countries included in our sample are: Albania, Algeria, Angola, 
Argentina, Australia, Austria, Bahrain, Bangladesh, Belgium, Benin, 
Bolivia, Botswana, Brazil, Bulgaria, Burkina Faso, Burundi, Cambodia, 
Cameroon, Canada, Central African Republic, Chad, Chile, China, Colombia, 
Congo, Dem.\ Rep.; Congo, Republic of; Costa Rica, Cote d'Ivoire, Cyprus, 
Czech Republic, Denmark, Dominican Republic, Ecuador, Egypt, El Salvador, 
Ethiopia, Fiji, Finland, France, Gabon, Germany, Ghana, Greece, Guatemala, 
Guinea-Bissau, Guyana, Haiti, Honduras, Hungary, India, Indonesia, Iran, 
Ireland, Israel, Italy, Jamaica, Japan, Jordan, Kenya; Korea, Republic of; 
Kuwait, Lesotho, Madagascar, Malawi, Malaysia, Mali, Mauritania, Mauritius, 
Mexico, Mongolia, Morocco, Mozambique, Namibia, Nepal, Netherlands, 
New Zealand, Nicaragua, Niger, Nigeria, Norway, Oman, Pakistan, Panama, 
Papua New Guinea, Paraguay, Peru, Philippines, Poland, Portugal, Qatar, 
Romania, Russia, Rwanda, Saudi Arabia, Senegal, Sierra Leone, Singapore, 
South Africa, Spain, Sri Lanka, Sweden, Switzerland, Syria, Taiwan, 
Tanzania, Thailand, Togo, Trinidad \& Tobago, Tunisia, Turkey, Uganda, 
United Arab Emirates, United Kingdom, United States, Uruguay, Venezuela,
Vietnam, Zambia, Zimbabwe.
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}

\end{document}

相关内容