我使用的是“普通”表格、侧向表格和侧向图形。在我的代码中,我使用 \renewcommand 将表格标题(包括表格编号)设置为粗体。但这不适用于侧向表格和图形。
所以我尝试直接使用 \textbf{} 将标题“加粗”。但随后出现问题,这些特定图表的条目也加粗了。
我尝试稍微减少代码。(请注意,我在表格中使用了 dcolumn 和 siunitx。)
%General Layout
\documentclass[a4paper, 12pt]{article}
\usepackage[left=3cm, right=2cm, top=3cm, bottom=4cm]{geometry}
%Font encoding
\usepackage[T1]{fontenc}
%Font
\usepackage[utf8]{inputenc}
%Language
\usepackage[english]{babel}
%Mathematics
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textgreek}
\usepackage{rotating}
\usepackage{tikz}
\usepackage[outdir=./]{epstopdf}
\usepackage{graphicx}
\usepackage{float}
\usepackage{pdfpages}
%Tables
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{fixltx2e}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage{pdflscape, longtable}
\usepackage[labelsep=newline,% line break after label
justification=centering,
singlelinecheck=off, labelfont=bf]{caption}
\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{etoolbox}
\robustify\bfseries
\sisetup{detect-weight=true,detect-inline-weight=math}
\usepackage{fancybox}
\usepackage{array}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\usepackage{colortbl}
\makeatletter% Set distance from top of page to first float
\setlength{\@fptop}{5pt}
\makeatother
%Writing
\usepackage{txfonts}
\usepackage[doublespacing]{setspace}
%% Some Conventions I have to use
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\thetable}{\Roman{table}}
\renewcommand{\abstractname}{\textsc{ABSTRACT}}
\makeatletter
% we need a period (.) after sectioning numbers, but not in cites thereto.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.\hspace{0.5em}}
\long\def\@makefigcaption#1#2{%
\vskip\abovecaptionskip
%#1\\\footnotesize#2
%\sbox\@tempboxa{\footnotesize\bf#1.\footnotesize#2}%
%\sbox\@tempboxa{\footnotesize{\textbf{#1.}} footnotesize#2}%
%\sbox\@tempboxa{\textbf{#1.} footnotesize#2}%
%\sbox\@tempboxa
\footnotesize\textbf{#1.} \footnotesize#2
\ifdim \wd\@tempboxa >\hsize
\textbf{#1.} #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\renewcommand{\figure}{\let\@makecaption\@makefigcaption\@float{figure}}
\long\def\@maketblcaption#1#2{%
\vskip\abovecaptionskip %Same size for Numbering and Caption of Tables
\begin{center}\normalsize\bf#1\\\normalsize#2\end{center}
% \sbox\@tempboxa{\textbf{#1.} #2}%
% \global \@minipagefalse
% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\vskip\belowcaptionskip}
\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
%\renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}
请注意 \sidewaystable 的 renewcommand 不起作用(它会导致错误,因此我将其作为注释
\makeatother
\begin{document}
\listoffigures
\listoftables
\begin{table}[ht!]
\setlength\tabcolsep{0.1pt} % default value: 6.0pt
\begin{threeparttable}
\caption{Summary Statistics}
\label{tab:SummaryStatistics}
\footnotesize
\begin{tabular*}{\textwidth}%
{ @{\extracolsep{\fill}} l d{5.0} *{7}{d{2.3}} }
\toprule
Variables\tnote{a}
& \mc{\hphantom{$-$}N$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Mean$\hphantom{^{**}}$} & \mc{\hphantom{$-$}St.\,Dev.$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Min.$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Q1$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Median$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Q3$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Max.} \\ [0.5ex]
\midrule
\multicolumn{9}{l}{\itshape Earnings Surprise} \\ [0.5ex]
SUE1
& \mc{\hphantom{$-$}14070$\hphantom{^{**}}$} & \mc{$-$0.001$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.182$\hphantom{^{**}}$} & \mc{$-$7.450$\hphantom{^{**}}$} &\mc{$-$0.003$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.001$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.005$\hphantom{^{**}}$} & \mc{\hphantom{$-$}6.240} \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\footnotesize
\item[a] A table-specific footnote
test test test test test test test test test test test test test test test test
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{sidewaystable}[htp!]
\robustify\bfseries
\robustify\itshape
\footnotesize
\sisetup{group-separator={}}
\caption{Pearson and Spearman Rank Correlation Matrix}
\begin{threeparttable}
\begin{minipage}{\textwidth}
test test test test test test test test test test test test test test test test
\\
\end{minipage}
\begin{tabular*}{\textwidth}
{
@{\extracolsep{\fill}}
l
*{11}{S[table-format=-1.3]}
@{}
}
\toprule
& {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)} & {(7)} & {(8)} & {(9)} & {(10)} & {(11)}\\
\midrule
(1) (D)SUE1
& & \textbf{\hphantom{$-$}0.877} & \textbf{\hphantom{$-$}0.257} & -0.005 & \textbf{$-$0.095} & \textbf{$-$0.101} & \textbf{$-$0.093} & 0.000 & \textbf{$-$0.061} & \textbf{\hphantom{$-$}0.089} & -0.001 \\
(2) (D)SUE2
& \textbf{\hphantom{$-$}0.858} & & \textbf{\hphantom{$-$}0.286} & -0.008 & \textbf{$-$0.093} & \textbf{$-$0.101} & \textbf{$-$0.088} & -0.004 & \textbf{$-$0.062} & \textbf{\hphantom{$-$}0.095} & -0.005 \\
(3) (D)SUE3
& \textbf{\hphantom{$-$}0.256} & \textbf{\hphantom{$-$}0.295} & & 0.010 & 0.008 & \textbf{$-$0.144} & \textbf{$-$0.076} & 0.006 & \textbf{$-$0.043} & \textbf{\hphantom{$-$}0.165} & \textbf{$-$0.083} \\ [1ex]
\bottomrule
\end{tabular*}
\begin{tablenotes}
\item[a] A subtable-specific footnote
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\centering
\begin{sidewaysfigure}
\caption{\textbf{Cumulated Average Index-Adjusted CDS Return for Extreme Earnings Decile Portfolios} \label{fig:CASC}}
\begin{minipage}{\textheight}
\footnotesize test test test testtest test test testtest test test testtest test
\bigskip
\end{minipage}
\subfloat[DSUE1 $-$ Full Sample]{\includegraphics[width=0.31\textheight]{aasc_full_dsue1.eps}\label{fig:fullDSUE1}} \quad \bigskip
\subfloat[DSUE2 $-$ Full Sample]{\includegraphics[width=0.31\textheight]{aasc_full_dsue2.eps}\label{fig:fullDSUE2}}\quad
\subfloat[DSUE3 $-$ Full Sample]{\includegraphics[width=0.31\textheight]{aasc_full_dsue3.eps}\label{fig:fullDSUE3}} \quad
\end{sidewaysfigure}
\end{document}
非常感谢
编辑:该图如下所示:
答案1
您可以为字体提供三种选项:
font = <options>
→ 影响整个标题labelfont = <options>
→ 仅影响标题标签和分隔符,以及textfont = <options>
→ 仅影响标题文本
你需要的是font = bf
(而不是labelfont=bf
)
\usepackage[labelsep=newline,% line break after label
justification=centering,
singlelinecheck=off, font=bf]{caption}
代码:
%General Layout
\documentclass[a4paper, 12pt]{article}
\usepackage[left=3cm, right=2cm, top=3cm, bottom=4cm]{geometry}
%Font encoding
\usepackage[T1]{fontenc}
%Font
\usepackage[utf8]{inputenc}
%Language
\usepackage[english]{babel}
%Mathematics
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{textgreek}
\usepackage{rotating}
\usepackage{tikz}
\usepackage[outdir=./]{epstopdf}
\usepackage{graphicx}
\usepackage{float}
\usepackage{pdfpages}
\usepackage{subfig}
%Tables
\usepackage{multirow}
\usepackage{longtable}
\usepackage{booktabs}
\usepackage{tabulary}
\usepackage{tabularx}
\usepackage{fixltx2e}
\usepackage{threeparttable}
\usepackage{threeparttablex}
\usepackage{pdflscape, longtable}
\usepackage[labelsep=newline,% line break after label
justification=centering,
singlelinecheck=off, font=bf]{caption}
%\usepackage{subcaption}
\usepackage{siunitx}
\usepackage{etoolbox}
\robustify\bfseries
\sisetup{detect-weight=true,detect-inline-weight=math}
\usepackage{fancybox}
\usepackage{array}
\usepackage{dcolumn}
\newcolumntype{d}[1]{D{.}{.}{#1}}
\newcommand\mc[1]{\multicolumn{1}{c}{#1}}
\usepackage{colortbl}
\makeatletter% Set distance from top of page to first float
\setlength{\@fptop}{5pt}
\makeatother
%Writing
\usepackage{txfonts}
\usepackage[doublespacing]{setspace}
%% Some Conventions I have to use
\renewcommand{\thesection}{\Roman{section}}
\renewcommand{\thesubsection}{\Alph{subsection}}
\renewcommand{\thetable}{\Roman{table}}
\renewcommand{\abstractname}{\textsc{ABSTRACT}}
\makeatletter
% we need a period (.) after sectioning numbers, but not in cites thereto.
\renewcommand{\@seccntformat}[1]{{\csname the#1\endcsname}.\hspace{0.5em}}
\long\def\@makefigcaption#1#2{%
\vskip\abovecaptionskip
%#1\\\footnotesize#2
%\sbox\@tempboxa{\footnotesize\bf#1.\footnotesize#2}%
%\sbox\@tempboxa{\footnotesize{\textbf{#1.}} footnotesize#2}%
%\sbox\@tempboxa{\textbf{#1.} footnotesize#2}%
%\sbox\@tempboxa
\footnotesize\textbf{#1.} \footnotesize#2
\ifdim \wd\@tempboxa >\hsize
\textbf{#1.} #2\par
\else
\global \@minipagefalse
\hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\fi
\vskip\belowcaptionskip}
\renewcommand{\figure}{\let\@makecaption\@makefigcaption\@float{figure}}
\long\def\@maketblcaption#1#2{%
\vskip\abovecaptionskip %Same size for Numbering and Caption of Tables
\begin{center}\normalsize\bf#1\\\normalsize#2\end{center}
% \sbox\@tempboxa{\textbf{#1.} #2}%
% \global \@minipagefalse
% \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
\vskip\belowcaptionskip}
\renewcommand{\table}{\let\@makecaption\@maketblcaption\@float{table}}
%\renewcommand{\sidewaystable}{\let\@makecaption\@maketblcaption\@float{sidewaystable}}
\makeatother
\begin{document}
\listoffigures
\listoftables
\begin{table}[ht!]
\setlength\tabcolsep{0.1pt} % default value: 6.0pt
\begin{threeparttable}
\caption{Summary Statistics}
\label{tab:SummaryStatistics}
\footnotesize
\begin{tabular*}{\textwidth}%
{ @{\extracolsep{\fill}} l d{5.0} *{7}{d{2.3}} }
\toprule
Variables\tnote{a}
& \mc{\hphantom{$-$}N$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Mean$\hphantom{^{**}}$} & \mc{\hphantom{$-$}St.\,Dev.$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Min.$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Q1$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Median$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Q3$\hphantom{^{**}}$} & \mc{\hphantom{$-$}Max.} \\ [0.5ex]
\midrule
\multicolumn{9}{l}{\itshape Earnings Surprise} \\ [0.5ex]
SUE1
& \mc{\hphantom{$-$}14070$\hphantom{^{**}}$} & \mc{$-$0.001$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.182$\hphantom{^{**}}$} & \mc{$-$7.450$\hphantom{^{**}}$} &\mc{$-$0.003$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.001$\hphantom{^{**}}$} & \mc{\hphantom{$-$}0.005$\hphantom{^{**}}$} & \mc{\hphantom{$-$}6.240} \\
\bottomrule
\end{tabular*}
\begin{tablenotes}
\footnotesize
\item[a] A table-specific footnote
test test test test test test test test test test test test test test test test
\end{tablenotes}
\end{threeparttable}
\end{table}
\begin{sidewaystable}[htp!]
\robustify\bfseries
\robustify\itshape
\footnotesize
\sisetup{group-separator={}}
\caption{Pearson and Spearman Rank Correlation Matrix}
\begin{threeparttable}
\begin{minipage}{\textwidth}
test test test test test test test test test test test test test test test test
\\
\end{minipage}
\begin{tabular*}{\textwidth}
{
@{\extracolsep{\fill}}
l
*{11}{S[table-format=-1.3]}
@{}
}
\toprule
& {(1)} & {(2)} & {(3)} & {(4)} & {(5)} & {(6)} & {(7)} & {(8)} & {(9)} & {(10)} & {(11)}\\
\midrule
(1) (D)SUE1
& & \textbf{\hphantom{$-$}0.877} & \textbf{\hphantom{$-$}0.257} & -0.005 & \textbf{$-$0.095} & \textbf{$-$0.101} & \textbf{$-$0.093} & 0.000 & \textbf{$-$0.061} & \textbf{\hphantom{$-$}0.089} & -0.001 \\
(2) (D)SUE2
& \textbf{\hphantom{$-$}0.858} & & \textbf{\hphantom{$-$}0.286} & -0.008 & \textbf{$-$0.093} & \textbf{$-$0.101} & \textbf{$-$0.088} & -0.004 & \textbf{$-$0.062} & \textbf{\hphantom{$-$}0.095} & -0.005 \\
(3) (D)SUE3
& \textbf{\hphantom{$-$}0.256} & \textbf{\hphantom{$-$}0.295} & & 0.010 & 0.008 & \textbf{$-$0.144} & \textbf{$-$0.076} & 0.006 & \textbf{$-$0.043} & \textbf{\hphantom{$-$}0.165} & \textbf{$-$0.083} \\ [1ex]
\bottomrule
\end{tabular*}
\begin{tablenotes}
\item[a] A subtable-specific footnote
\end{tablenotes}
\end{threeparttable}
\end{sidewaystable}
\centering
\begin{sidewaysfigure}
\caption{Cumulated Average Index-Adjusted CDS Return for Extreme Earnings Decile Portfolios \label{fig:CASC}}
\begin{minipage}{\textheight}
\footnotesize test test test testtest test test testtest test test testtest test
\bigskip
\end{minipage}
\subfloat[DSUE1 $-$ Full Sample]{\includegraphics[width=0.31\textheight]{aasc_full_dsue1.eps}\label{fig:fullDSUE1}} \quad \bigskip
\subfloat[DSUE2 $-$ Full Sample]{\includegraphics[width=0.31\textheight]{aasc_full_dsue2.eps}\label{fig:fullDSUE2}}\quad
\subfloat[DSUE3 $-$ Full Sample]{\includegraphics[width=0.31\textheight]{aasc_full_dsue3.eps}\label{fig:fullDSUE3}} \quad
\end{sidewaysfigure}
\end{document}