在表格中添加第四列

在表格中添加第四列

我知道这个问题之前有人问过,但我在解决这个问题时遇到了麻烦。我有一张表格,我只想添加第三列来显示第三个方程的回归输出。我在 LaTeX wikibook 中查看了“定义多列”,但我没有从那里推断出多少运气。你能帮忙吗?

梅威瑟:

\documentclass[twocolumn]{article}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage[lite]{mtpro2}

\usepackage{amsmath,geometry,siunitx,booktabs, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
%\usepackage[lite]{mtpro2}

\usepackage{amsmath,geometry,siunitx,booktabs, tabularx}
\newcolumntype{C}{>{\centering\arraybackslash}X}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}

\newcommand\mC[1]{\multicolumn{1}{C@{}}{#1}} % handy shortcut macro

\sisetup{group-separator={,}, group-minimum-digits=4}
\usepackage[skip=1ex]{caption}
\captionsetup[table]{font=small, labelfont=bf, singlelinecheck=no}


\usepackage{%booktabs, 
            makecell, %tabularx
            }
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{upquote}
\usepackage{balance}
\usepackage{wasysym}
\usepackage{footmisc}
\usepackage{float}
\floatstyle{boxed} 
\restylefloat{figure}

\title{\LARGE \bf ECON 425 Term Paper}

\author{}

\begin{document}
    \begin{table*}[!htb]
\caption{Estimates of pay-performance sensitivity.}
\label{tab:table1}
OLS regressions of CEO salary and CEO total compensation on change in shareholder wealth. Standard errors in parentheses.

    \medskip
    \setlength\tabcolsep{4pt}
    \small
    \makegapedcells
\begin{tabularx}{\textwidth}{@{}L ll@{}}
    \toprule
\thead[l]{Dependent\\ variable}
            &  \thead[l]{CEO\\
                         salary\\
                         (eq. \ref{eqn:first})}
                                    & \thead[l]{CEO total\\
                                            compensation\\
                                            (eq. \ref{eqn:second})} \\


    \midrule
Return       &  -0.320 (0.083)        & 2.213 (1.545)                    \\
Logbonus
                & -5.269 (1.38)   & ---          \\
    \addlinespace
Return*Volume   & 0.00 (0.000)       & ---                        \\
Stock Awards    & $0.036^*$ (0.000)    & ---                    \\
Option Awards    & 0.023 (0.000)        & ---                         \\
Other Compensation & 0.028 (0.00) & ---
    \\
Age & 33.387 (4.567) & 913.016 (84.768)
    \\
agesq & -0.217 (0.039) & -7.435 (0.733)
    \\
male & -2.601 (18.079) & -465.612 (337.631)
    \\
outdoors & -173.761 (77.902) & -4268.128 (1453.675) 
    \\
mining & -178.289 (26.792) & -972.327 (499.369)
    \\
utilities & -199.853 (34.906) & -4217.222 (651.127)
    \\
construction & -102.424 (33.259 & -3572.244 (620.558)
    \\
wholesale & -193.954 (28.814) & -3827.542 (537.382)
    \\
information & -218.414 (24.494) & -618.642 (456.968)
    \\
finance & -160.005 (23.320) & -3078.595 (434.591)
    \\
realestate & -303.096 (25.248) & -3410.482 (470.966)  
    \\
professional & -238.323 (27.486) & -3776.246 (512.813)
    \\
waste  & -186.965 (31.766) & -3365.898 (592.813)
    \\
education & -287.113 (50.956) & -5770.548 (950.712)
    \\
healthcare & -153.385 (32.953) & -2123.471 (615.121) 
    \\
arts & 178.082 (56.622) & -2303.748 (1056.786)
    \\
food & -34.24 (31.091) & -2656.446 (579.849)
    \\
other & -109.691 (61.642) & -3786.196 (1150.511)
    \\
manufacturing & -193.729 (22.394) & -2540.859 (417.698)
    \\
transportation & -313.349 (29.509) & -3678.069 (551.778)
    \\
retail &  $\underset{(25.756)}{-80.145}$ & -2295.232 (480.656)
    \\
    \bottomrule
\end{tabularx}

\smallskip
$^{*}$ Significant at the 1\% level.
    \end{table*}

\end{document}

目前的情况如下:

在此处输入图片描述

一如既往地感谢!

跟进@SAMCARTER

我该如何解决第 4 列的问题?我希望它看起来和其他列一样。

在此处输入图片描述

答案1

添加一个具有所需对齐方式的附加列,例如,l@{}L lll@{}每行末尾添加一个附加数字。

无关:

  • 请不要使用已弃用的字体命令,例如\bf

  • 请不要多次加载同一个包


\documentclass[twocolumn]{article}

\usepackage[T1]{fontenc}
\usepackage{amsmath,geometry,siunitx,booktabs, tabularx}
\usepackage[skip=1ex]{caption}
\captionsetup[table]{font=small, labelfont=bf, singlelinecheck=no}
\usepackage{makecell}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\usepackage[referable]{threeparttablex}
\usepackage{float}
\floatstyle{boxed} 
\restylefloat{figure}

\title{\LARGE \textbf{ECON 425 Term Paper}}

\author{}

\begin{document}

\begin{table*}[!htb]
    \caption{Estimates of pay-performance sensitivity.}
    \label{tab:table1}
    OLS regressions of CEO salary and CEO total compensation on change in shareholder wealth. Standard errors in parentheses.

    \medskip
    \setlength\tabcolsep{4pt}
    \small
    \makegapedcells
    \begin{tabularx}{\textwidth}{@{}L lll@{}}
        \toprule
        \thead[l]{Dependent\\ variable} &  \thead[l]{CEO\\ salary\\ (eq. \ref{eqn:first})} & \thead[l]{CEO total\\ compensation\\ (eq. \ref{eqn:second})} & 4th column \\
        \midrule
        Return &  \num{-0.320} (\num{0.083}) & \num{2.213} (\num{1.545}) & \num{42}\\
        Logbonus & \num{-5.269} (\num{1.38}) & {---} & \num{42}\\
        \bottomrule
    \end{tabularx}

    \smallskip
    $^{*}$ Significant at the 1\% level.
\end{table*}

\end{document}

相关内容