表头统计表

表头统计表

关于在此表中添加标题的任何建议,我想要三个代表因变量、自变量和控制变量的面板我的代码:

\documentclass{article}
\usepackage[margin=2cm,a4paper]{geometry} % set page parameters suitably
\usepackage{bbm}
\usepackage{amsthm}
\usepackage{amsfonts}
\usepackage{dcolumn}
\usepackage[english]{babel}         
\usepackage[T1]{fontenc}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{xurl}
\usepackage{enumitem}
\usepackage[normalem]{ulem}
\usepackage{blindtext}
\usepackage{newpxtext,newpxmath}
\usepackage{setspace}
\usepackage{longtable}
\usepackage{threeparttable}  
\usepackage{booktabs}


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\newcommand{\RenewableCapacity}{\mathop{\textnormal{\slshape Renewable Capacity}}\nolimits}
\newcommand{\NonrenewableCapacity}{\mathop{\textnormal{\slshape Non-renewable Capacity }}\nolimits}
\newcommand{\RDsubsidies}{\mathop{\textnormal{\slshape R\&D subsidies }}\nolimits} 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\begin{document}
\begin{table}[H]
\centering
\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}
\caption{Summary Statistics\label{rrtable1}}
\begin{tabular}{l*{1}{cccc}}
\toprule
                    
                    &\multicolumn{4}{c}{}                                            \\
                                                      &        mean&          sd&         min&         max\\
\midrule
%------------------------------------------------dependant variables------------------%----------------------------------------------------------------------------------------
\Delta \RenewableCapacity                         &        0.46&        1.02&       -3.94&        9.36\\
\Delta \NonrenewableCapacity                      &        3.07&        2.52 &      -0.70&        9.20\\

%------------------------------------------------Indepedant variables------------------%----------------------------------------------------------------------------------------

$\Delta$ Traditional Electricity Share (TES)          &        0.55&        0.30&        0.00&        0.99\\
Oil Prices (USD) (log)                                &      3.60  &        0.43&        2.87&       4.58\\
climate mitigation finance(log)                       &      6.78  &        2.75&       0.004&   13.12 \\
$\RDsubsidies$ (log)                                  &        0.59&        0.36&       0.03 &  1.49\\
Green innovation(GI) (log)                            &        2.43&        0.41&       0.672&   4.53  \\
Energy Intensity (EI)(log)                            &       1.74&         0.44&       0.732&    3.13\\
%------------------------------------------------control variables------------------%----------------------------------------------------------------------------------------
Economic Growth                                       &      10.04 &        0.47&        8.619&   10.84\\
Income Growth                                         &      0.02  &        0.03&       -0.13&        0.13\\
$CO_{2}$emissions (log)                               &       1.40 &         0.99&       0.020&   3.46 \\
Greenhouse gasses emission(GE)                        &        0.42&        0.30&        0.00&    1.00\\
Environmental tax (ET)(log)                           &        0.59&        0.47&         0  &1.63 \\
%----------------------------------------------------------------------------------------%----------------------------------------------------------------------------------------
Trade openness per capita (RGDTO) (log)               &      0.014 &       0.041&       0.00 &       0.25\\
Investment Share of Real GDP per capita (RGDIS) (log) &       3.13 &         0.20&       2.43&    3.88 \\
Government Share of Real GDP per capita (RGDPL) (log) &        2.28&        0.29&       1.27 &   2.97\\\\
\bottomrule
\end{tabular}
\end{table}
\end{document}

我的输出:

他

答案1

实现格式化目标的方法肯定有很多。下面是一个可能的解决方案,即自动缩进第 1 列中的非标题单元格。

请注意,我还会将四个数​​据列中的数字与各自的小数点对齐。一种方法是加载包siunitx并使用其S列类型。

在此处输入图片描述

\documentclass{article}
\usepackage[margin=2cm,a4paper]{geometry} 
\usepackage{bbm}
\usepackage{amsthm}
\usepackage{amssymb} %{amsfonts}
\usepackage{dcolumn}
\usepackage[english]{babel}         
\usepackage[T1]{fontenc}
\usepackage{pdflscape}
\usepackage{tabularx}
\usepackage{xurl}
\usepackage{enumitem}
\usepackage[normalem]{ulem}
\usepackage{blindtext}
\usepackage{newpxtext,newpxmath}
\usepackage{setspace}
\usepackage{longtable}
\usepackage{threeparttable}  
\usepackage{booktabs}

% Q: Does newpxtext package furnish *slanted* (non-italic) glyphs?? 
\newcommand{\RenewableCapacity}{\textit{Renewable Capacity}}
\newcommand{\NonrenewableCapacity}{\textit{Non-renewable Capacity}}
\newcommand{\RDsubsidies}{\textit{R\&D subsidies}}

\def\sym#1{\ifmmode^{#1}\else\(^{#1}\)\fi}

%% new code:
\usepackage{mhchem}  % for '\ce' macro
\usepackage{siunitx} % for 'S' column type

\begin{document}

\begin{table}[h]

\centering
\caption{Summary Statistics} \label{rrtable1}

\begin{tabular}{@{} >{\quad}l % automatic indentation
     S[table-format= 2.3] S[table-format=1.3] 
     S[table-format=-1.3] S[table-format=2.2]@{}}
\toprule
& {mean} & {sd} & {min} & {max} \\
\midrule

\multicolumn{1}{@{}l}{Dependent variables} \\ % override automatic indentation
$\Delta$\RenewableCapacity                            &   0.46 & 1.02 & -3.94 &  9.36 \\
$\Delta$\NonrenewableCapacity                         &   3.07 & 2.52 & -0.70 &  9.20 \\

\addlinespace
\multicolumn{1}{@{}l}{Independent variables} \\ % override automatic indentation
$\Delta$Traditional Electricity Share (TES)           &   0.55 & 0.30 &  0.00 &  0.99 \\
Oil Prices (USD) (log)                                &   3.60 & 0.43 &  2.87 &  4.58 \\
Climate mitigation finance(log)                       &   6.78 & 2.75 &  0.004& 13.12 \\
\RDsubsidies\ (log)                                   &   0.59 & 0.36 &  0.03 &  1.49 \\
Green innovation (GI) (log)                           &   2.43 & 0.41 &  0.672&  4.53 \\
Energy Intensity (EI)(log)                            &   1.74 & 0.44 &  0.732&  3.13 \\

\addlinespace
\multicolumn{1}{@{}l}{Control variables} \\ % override automatic indentation
Economic Growth                                       &  10.04 & 0.47 &  8.619& 10.84 \\
Income Growth                                         &   0.02 & 0.03 & -0.13 &  0.13 \\
\ce{CO2} emissions (log)                              &   1.40 & 0.99 &  0.020&  3.46 \\
Greenhouse gas emissions (GE)                         &   0.42 & 0.30 &  0.00 &  1.00 \\
Environmental tax (ET) (log)                          &   0.59 & 0.47 &  0    &  1.63 \\
Trade openness per capita (RGDTO) (log)               &   0.014& 0.041&  0.00 &  0.25 \\
Investment Share of Real GDP per capita (RGDIS) (log) &   3.13 & 0.20 &  2.43 &  3.88 \\
Government Share of Real GDP per capita (RGDPL) (log) &   2.28 & 0.29 &  1.27 &  2.97 \\
\bottomrule

\end{tabular}

\end{table}

\end{document}

相关内容