我的桌子有点狭窄

我的桌子有点狭窄

我的桌子有点小。你能帮我吗?也许我只需要减小字体大小?提前谢谢!

这是我的 MWE:

\documentclass[twocolumn]{article}

\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath,geometry}
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}
\usepackage{upquote}
\usepackage{balance}
\usepackage[lite]{mtpro2} % Times Roman math font
\usepackage{float}
\usepackage{wasysym}
\usepackage{footmisc}
\captionsetup[table]{font=small,
                     labelfont=bf,
                     singlelinecheck=no}

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

\begin{document}

\begin{table}
\caption{Summary Statistics}
\label{tab:table2}
    \raggedright
    CEO Compensation, 2010-2017
    \medskip

    \setlength\tabcolsep{3pt}
    \small
    \makegapedcells
\begin{tabularx}{\columnwidth}{@{}Lllll@{}}
    \toprule
   &  \thead[l]{Salary} 
   &  \thead[l]{Bonus}
   &  \thead[l]{Stock \\Awards}
   &  \thead[l]{Total \\Compensation}
   \\
    \midrule
    N        & 12,727     &  12,727  & 12,727  & 12,717  \\
    Mean     & 826.36     & 185.17   & 2,583.90  & 6441.41  \\
   \addlinespace
    Median   & 785.00     & 0.00   & 1,495.12   & 4,515.53  \\
    Min      & 0.00     &  -8.72  & -655.00  & 0.00  \\
    Max      & 8,100     & 27,549.88   & 131,939.70  & 156,077.91  \\
    \bottomrule
\end{tabularx}

\smallskip
\end{table}

\end{document}

伯纳德的更新(为什么@符号不起作用?):当我尝试您的代码时,我得到了有趣的结果。

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc} 
\usepackage[showframe]{geometry} 
\usepackage[table, svgnames]{xcolor} 
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath}
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}
\usepackage{upquote}
\usepackage{balance}
%\usepackage[lite]{mtpro2} % Times Roman math font
\usepackage{mathptmx} 
\usepackage{float}
\usepackage{wasysym}
\usepackage{footmisc}
\captionsetup[table]{font=small,
                     labelfont=bf,
                     singlelinecheck=no}

%for a border
\usepackage{float}
\floatstyle{boxed} 
\restylefloat{figure}

\begin{document}

\section{INTRODUCTION}
In this paper I estimate the link between shareholder wealth and CEO salary. There has been much interest in this topic for almost a century, albeit mixed empirical results. In firm theory, optimal contracting views executive compensation as designed to minimize the agency costs that exist between executives and shareholders. The so called principle-agent problem arises when executives, the agents, act out of self interest and engage in activities that do not benefit the shareholders, or principles. Estimating the pay-performance sensitivity is fundamental to anyone questioning the size of CEO paychecks or wondering if they are paid enough. 

\end{document}

在此处输入图片描述

对于 MICO(在实现您的代码时遇到问题):

\documentclass[twocolumn]{article}

\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath,geometry}
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}
\usepackage{upquote}
\usepackage{balance}
\usepackage[lite]{mtpro2} % Times Roman math font
\usepackage{float}
\usepackage{wasysym}
\usepackage{footmisc}
\captionsetup[table]{font=small,
                     labelfont=bf,
                     singlelinecheck=no}

%MICO's CODE:
\usepackage[T1]{fontenc}
\usepackage{newtxtext}
\usepackage[lite]{mtpro2}

\usepackage{amsmath,geometry,siunitx,booktabs, tabularx}
\newcolumntype{C}{>{\centering\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}


%for borders on figures
\usepackage{float}
\floatstyle{boxed} 
\restylefloat{figure}

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

\author{}

\begin{document}

\begin{table}
\setlength\tabcolsep{3pt}
\small
\caption{Summary Statistics} \label{tab:table2}

CEO Compensation, 2010--2017

\medskip
\begin{tabularx}{\columnwidth}{@{}
   l S[table-format=4.2] S[table-format=5.2]
   *{2}{S[table-format=6.2]} @{}}
\toprule
& \mC{Salary} & \mC{Bonus} & \mC{Stock Awards} & \mC{Total Comp.} \\
\midrule
$N$    & {12,727} & {12,727} & {12,727} & {12,717}  \\
\addlinespace
Mean   & 826.36   & 185.17   & 2583.90   & 6441.41  \\ 
Median & 785.00   & 0.00     & 1495.12   & 4515.53  \\
Min    & 0.00     &  -8.72   & -655.00   & 0.00     \\
Max    & 8100.00  & 27549.88 & 131939.70 & 156077.91\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

答案1

这是一个解决方案,可将数字的小数点对齐。希望这能让表格内容更易于阅读。

在此处输入图片描述

关于 tabularx 代码:左列的列具有类型l,四个数据列具有类型S(由包定义siunitx)。为了使其在框架内“工作” tabularx,数据列上的四个标题为(已修改)类型X

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

\usepackage{amsmath,geometry,siunitx,booktabs, tabularx}
\newcolumntype{C}{>{\centering\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}

\begin{document}

\begin{table}
\setlength\tabcolsep{3pt}
\small
\caption{Summary Statistics} \label{tab:table2}

CEO Compensation, 2010--2017

\medskip
\begin{tabularx}{\columnwidth}{@{}
   l S[table-format=4.2] S[table-format=5.2]
   *{2}{S[table-format=6.2]} @{}}
\toprule
& \mC{Salary} & \mC{Bonus} & \mC{Stock Awards} & \mC{Total Comp.} \\
\midrule
$N$    & {12,727} & {12,727} & {12,727} & {12,717}  \\
\addlinespace
Mean   & 826.36   & 185.17   & 2583.90   & 6441.41  \\ 
Median & 785.00   & 0.00     & 1495.12   & 4515.53  \\
Min    & 0.00     &  -8.72   & -655.00   & 0.00     \\
Max    & 8100.00  & 27549.88 & 131939.70 & 156077.91\\
\bottomrule
\end{tabularx}
\end{table}

\end{document}

附录为了解决 OP 的评论,即把他的序言和我的序言结合起来会产生一个选项类:将你标记为“Mico 的代码”的内容移动到前面,并注意不要多次加载包,这样可以消除所有冲突:

\documentclass[twocolumn]{article}
% "MICO's CODE"
\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}

%% Remaining Code: Be sure not to reload any already-loaded packages

\usepackage{%booktabs, 
            makecell, %tabularx
            }
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
%\usepackage{amsmath,geometry}
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
%\usepackage{siunitx}
%\usepackage[skip=1ex]{caption}
\usepackage{upquote}
\usepackage{balance}
%\usepackage[lite]{mtpro2} % Times Roman math font
%\usepackage{float}
\usepackage{wasysym}
\usepackage{footmisc}
%\captionsetup[table]{font=small,
%                     labelfont=bf,
%                     singlelinecheck=no}

%for borders on figures
\usepackage{float}
\floatstyle{boxed} 
\restylefloat{figure}

答案2

这个怎么样?

\documentclass[twocolumn]{article}
\usepackage[utf8]{inputenc} 
\usepackage[showframe]{geometry} 
\usepackage[table, svgnames]{xcolor} 
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath}
\usepackage{rotating}
\usepackage[referable]{threeparttablex}
\usepackage{siunitx}
\usepackage[skip=1ex]{caption}
\usepackage{upquote}
\usepackage{balance}
%\usepackage[lite]{mtpro2} % Times Roman math font
\usepackage{mathptmx} 
\usepackage{float}
\usepackage{wasysym}
\usepackage{footmisc}
\captionsetup[table]{font=small,
                     labelfont=bf,
                     singlelinecheck=no}

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

\begin{document}

\begin{table}
\caption{Summary Statistics}
\label{tab:table2}
    \raggedright
    \small\renewcommand{\theadfont}{\small}
    CEO Compensation, 2010-2017
    \medskip

    \small\renewcommand{\theadfont}{\small}
\setlength{\extrarowheight}{2pt}
   \setlength\tabcolsep{4pt}
\rowcolors{4}{Gainsboro!60!Lavender}{WhiteSmoke!75!Lavender}
\begin{tabularx}{\columnwidth}{Lllll}
    \toprule
\rowcolor{white} & \thead[l]{Salary}
   & \thead[l]{Bonus}
   & \thead[l]{Stock \\Awards}
   & \thead[l]{Total \\Compen.}
   \\
    \specialrule{\lightrulewidth}{\aboverulesep}{0pt}
    N & 12,727 & 12,727 & 12,727 & 12,717 \\
    Mean & 826.36 & 185.17 & 2,583.90 & 6441.41 \\[0.5ex]
  % \addlinespace
    Median & 785.00 & 0.00 & 1,495.12 & 4,515.53 \\
    Min & 0.00 & -8.72 & -655.00 & 0.00 \\
    Max & 8,100 & 27,549.88 & 131,939.70 & 156,077.91 \\[\aboverulesep]
    \specialrule{\heavyrulewidth}{0pt}{0pt}
\end{tabularx}

\smallskip
\end{table}

\end{document}

在此处输入图片描述

相关内容