列标题太长

列标题太长

之前有人帮助我解决过这个问题,但我无法从已有的代码中进行推断。基本上,我希望第四列标题看起来与其他标题一样。看一看:

在此处输入图片描述

梅威瑟:

\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 lll@{}}
    \toprule
\thead[l]{Dependent\\ variable}
            &  \thead[l]{CEO\\
                         salary\\
                         (eq. \ref{eqn:first})}


                                            & \thead[l]{CEO total\\
                                            compensation\\
                                            (eq. \ref{eqn:second})}

& CEO salary \\ (not controlling for industry) \\


    \midrule

\end{document}

任何帮助都将不胜感激!

答案1

在下面的 MWE 中,我使用了包\thead提供的命令makecell,以便在第四列的列标题中引入换行符,类似于其他列中的换行符:

\documentclass[twocolumn]{article}
\usepackage{tabularx}
\usepackage{booktabs}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{makecell}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}


\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})}
      & \thead[l]{CEO salary \\ (not controlling \\ for industry)} \\
      \midrule
   \end{tabularx}
  \end{table*}
\end{document}

相关内容