2

I am using "normal" table, sidewaystable and sideways figures. In my code I put per \renewcommand the captions of the tables (inclusive table numbering) in bold. But this does not work for the sideways tables and figures.

So I tried to to "bold" the captions directly with \textbf{}. But then the problem appears that the entries for these specific figures and tables are bold as well.

I try to reduce my code a little bit. (Note that I am using dcolumn as well as siunitx for my tables.)

%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}}

note the renewcommand for \sidewaystable is not working (it causes an error, therefore I put it as a comment

\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}

thank you very much

EDIT: this is how the figure looks like: figure bold subcaptions

1 Answer 1

5

You can give three option for fonts:

  1. font = <options> → affects whole caption
  2. labelfont = <options> → affects only the caption label and separator and
  3. textfont = <options> → affects only the caption text

What you need is font = bf (instead of labelfont=bf) in

\usepackage[labelsep=newline,% line break after label
   justification=centering,
   singlelinecheck=off, font=bf]{caption}

Code:

%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}

enter image description here

7
  • Dear Harish, Thank you for your answer. Changing to label=bf causes the subcaption of my subfigures to become bold as well. Would it be possible to keep them in non-bold?
    – eternity1
    Commented Aug 16, 2014 at 8:18
  • @eternity1 - To get captions of subfigures and subtables that use a non-bold font face, load the subcaption package with the option labelfont=md. This will override the labelfont=bf option that was set when the caption package was loaded.
    – Mico
    Commented Aug 16, 2014 at 8:33
  • Dear Mico, Thank you for your answer. I tried \usepackage[labelfont=md]{subcaption} but the subcaptions of the figure are still the same (my figures are load with \subfloat). Moreover, I tried \captionsetup directly before the figure but the subcaptions are still bold.
    – eternity1
    Commented Aug 16, 2014 at 8:43
  • @eternity1 If I run the above code as such I can't reproduce it: i.sstatic.net/1rd16.png.
    – user11232
    Commented Aug 16, 2014 at 9:50
  • @Harish: I edited my question by posting the page of the figure how it looks like when I run the code. Could the reason be the "Journal Conventions"? (I just copy & paste it from a website of the university).
    – eternity1
    Commented Aug 16, 2014 at 13:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .