如何使标题的第二行居中?
\documentclass[twocolumn]{article}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath,geometry}
\usepackage{rotating}
\usepackage{booktabs, makecell}
\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}
\title{\LARGE \bf ECON 425 Term Paper}
\begin{document}
%TABLE:
\begin{table}[H]
\caption{Difference in Means}
\label{tab:table1}
\raggedright
Male and Female CEOs, 2010-2017
\medskip
\setlength\tabcolsep{4pt}
\small
\makegapedcells
\begin{tabularx}{\columnwidth}{@{}Lll @{}}
\toprule
\thead[l]{\\}
& \thead[l]{Male}
& \thead[l]{Female\\} \\
\midrule
N & 528 & 13150 \\
Mean salary (thousands)
& 873.5 (14.244) & 824.4 (3.7423) \\
\addlinespace
Standard deviation & 327.3 & 429.1 \\
t Value & 2.60$^{*}$ & 3.33 $^{*}$ \\
\bottomrule
\end{tabularx}
\smallskip
$^{*}$ Significant at the 1\% level.
\end{table}
\end{document}
SamCarter,你能帮我处理一下这个表格吗?为了保持一致性。我无法使用 \centering 命令获取标题的第一行,其中显示“表格 2:等”。
\documentclass[twocolumn]{article}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath,geometry}
\usepackage{rotating}
\usepackage{booktabs, makecell}
\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}
\title{\LARGE \bf ECON 425 Term Paper}
\begin{document}
%TABLE:
\begin{table}[H]
\centering
\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}{\columnwidth}{@{}Lll @{}}
\toprule
\thead[l]{Dependent\\ variable}
& \thead[l]{CEO\\salary (\ref{eqn:first})}
& \thead[l]{CEO total\\compensation (\ref{eqn:second})} \\
\midrule
Intercept & 434.319 & 6250.899 \\
Change in Shareholder Wealth (\%~Change)
& -0.304 (.083) & -2.638 (1.551) \\
\addlinespace
Adj R-squared & 0.255 & 0.062 \\
F-statistic & 142.13$^{*}$ & 34.10$^{*}$ \\
Sample Size & 11537 & 11529 \\
\bottomrule
\end{tabularx}
\smallskip
$^{*}$ Significant at the 1\% level.
\end{table}
\结束{文档}
答案1
对于你的第二个问题(在编辑第一个问题时后来添加的)不清楚问题是什么。使用你的代码进行很小的更改后我得到了以下结果:
\documentclass[twocolumn]{article}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\title{\LARGE \textbf{ECON 425 Term Paper}}
\begin{document}
%TABLE:
\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}{\columnwidth}{@{}L ll@{}}
\toprule
\thead[l]{Dependent\\ variable}
& \thead[l]{CEO\\
salary\\
(\ref{eqn:first})}
& \thead[l]{CEO total\\
compensation\\
(\ref{eqn:second})} \\
\midrule
Intercept & 434.319 & 6250.899 \\
Change in Shareholder Wealth (\%~Change)
& $-0.304$ (.083) & $-2.638$ (1.551) \\
\addlinespace
Adj R-squared & 0.255 & 0.062 \\
F-statistic & $142.13^*$ & $34.10^*$ \\
Sample Size & 11537 & 11529 \\
\bottomrule
\end{tabularx}
\smallskip
$^{*}$ Significant at the 1\% level.
\end{table}
\end{document}
注意:仅加载一次包就足够了 -:)
编辑:
阳离子的格式/外观与图形/表格的定位无关。包caption
由控制\captionsetup
。
- 默认设置如下:
- 如果标题文本比列宽(在两列文档中)或文本宽度(在一列文档中)窄,则标题文本将居中
- 如果文本较宽,则将其格式化为标准段落
如果您希望将单个标题的文本也左对齐,则应执行以下操作:
- 如果您的文档中需要所有标题,则请按如下方式加载标题:
\usepackage[singlelinecheck=false]{caption}
- 如果只需要在一个表格/图形中使用,则在之后
\begin{table}
或`begin{figure}添加
\captionsetup{singlelinecheck=false}
- 在这种情况下,此设置仅对所有表格有效(而不对图形有效),您应该在文档的前缀中添加
\captionsetup[table]{singlelinecheck=false}
在上述两种情况下,如果标题文本长度超过列/文本宽度,则将被格式化为标准段落。
如果您喜欢在这种情况下将
caption's text, than you need add to caption options
centerlast的最后一行居中对于所有可能的字幕设置,您应该阅读包文档。它是您的 latex 安装的一部分
假设您希望所有标题 (i) 标题字体大小较小,(ii) 标题标签字体粗体,(iii) 仅一行文本左对齐且较长的标题文本格式化为标准段落,那么您可以将标题加载为:
\usepackage[font=small,
labelfont=bf,
singlelinecheck=no]{caption}
您的标题将如下所示:
以及更长的标题文字:
修订后的mwe考虑上述描述可以是:
\documentclass[twocolumn]{article}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\captionsetup[table]{font=small,
labelfont=bf,
singlelinecheck=no}
\begin{document}
\begin{equation}\label{eqn:first}
2+2=4
\end{equation}
and
\begin{equation}\label{eqn:second}
2-2\ne4
\end{equation}
%TABLE:
\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}{\columnwidth}{@{}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
Intercept & 434.319 & 6250.899 \\
Change in Shareholder Wealth (\%~Change)
& $-0.304$ (.083) & $-2.638$ (1.551) \\
\addlinespace
Adj R-squared & 0.255 & 0.062 \\
F-statistic & $142.13^*$ & $34.10^*$ \\
Sample Size & 11537 & 11529 \\
\bottomrule
\end{tabularx}
\smallskip
$^{*}$ Significant at the 1\% level.
\end{table}
\end{document}
答案2
要使第二行文本居中,请\raggedright
用替换\centering
。
离题:你不应该使用\bf
,请参阅我使用 \textit 或 \it、\bfseries 或 \bf 等有关系吗
\documentclass[twocolumn]{article}
\usepackage{booktabs, makecell, tabularx}
\renewcommand\theadfont{\normalsize}
\renewcommand\theadgape{}
\setcellgapes{2pt}
\newcolumntype{L}{>{\raggedright\arraybackslash}X}
\usepackage{caption}
\usepackage{textcomp}
\usepackage{graphicx}
\raggedbottom
\usepackage{amsmath,geometry}
\usepackage{rotating}
\usepackage{booktabs, makecell}
\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}
\title{\LARGE \textbf{ECON 425 Term Paper}}
\begin{document}
%TABLE:
\begin{table}[H]
\caption{Difference in Means}
\label{tab:table1}
% \raggedright
\centering
Male and Female CEOs, 2010-2017
\medskip
\setlength\tabcolsep{4pt}
\small
\makegapedcells
\begin{tabularx}{\columnwidth}{@{}Lll @{}}
\toprule
\thead[l]{\\}
& \thead[l]{Male}
& \thead[l]{Female\\} \\
\midrule
N & 528 & 13150 \\
Mean salary (thousands)
& 873.5 (14.244) & 824.4 (3.7423) \\
\addlinespace
Standard deviation & 327.3 & 429.1 \\
t Value & 2.60$^{*}$ & 3.33 $^{*}$ \\
\bottomrule
\end{tabularx}
\smallskip
$^{*}$ Significant at the 1\% level.
\end{table}
\end{document}