1

I have this code

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry} % showframe
\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{bm}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage[skip=0.33\baselineskip]{caption}

\captionsetup[table]{
    font=bf,
    size=normalsize,
    justification=centerlast,
    labelsep=newline
    }
\renewcommand\thetable{\Roman{table}}

\begin{document}
\listoftables
\pagenumbering{roman}
\pagenumbering{arabic}
\setcounter{page}{1}
\vspace{10ex}
\def\arraystretch{1.5}
\begin{table}[h]
\centering
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.2, group-separator={,}, group-minimum-digits=4}
\caption{\large{Header that includes math like this: $\bm{t(\alpha)}$}}
\label{table:fundsummary}
\parbox{\linewidth}{\small{This table presents some very interesting and very fancy data, which I expect will provide me with at least two Nobel prizes.}\vspace{2ex}}
\medskip\small\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                l
                S[table-format=-2.2]
           *{6}{S}
                }
\toprule
\multicolumn{1}{c}{\multirow{2}{*}{Description}}&
\multicolumn{1}{c}{\multirow{2}{*}{Variable}}&
\multicolumn{5}{c}{Averages}\\\cmidrule{3-7}
\multicolumn{2}{c}{}&{Factor 1}&{Factor 2}&{Factor 3}&{Factor 4}&{Factor 5}\\\midrule
Section 1       &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\\midrule
Section 2\\
Section 2.2     &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\
Section 2.3     &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\
Section 2.4     &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}

which produces this output

Table

My table header is in bold font, so for the tables I have, where math is included, I use the \bm package. However, I just noticed that the math symbol also appears as bold in the table of contents. Is there a way to keep the math symbol in bold font in the table header, but then set it to a normal font in the table of contents?

I have read this question, but the solution seems to only work with the memoir class.

Thanks in advance!

2
  • 1
    Off-topic: I believe it should be *{5}{S}, not *{6}{S}, in the definition of the columns of the tabular* environment.
    – Mico
    Commented May 24, 2018 at 19:18
  • @Mico: Noted, I'll get it changed.
    – Andreas
    Commented May 25, 2018 at 7:34

2 Answers 2

2

Just use the optional argument of \caption to contain the text that's supposed to show up in the table of contents (ToC). I.e., change

\caption{\large{Header that includes math like this: $\bm{t(\alpha)}$}}

to

\captionsetup{font={large,bf}} % repeat 'bf' from an earlier '\captionsetup' call
\caption[Header that includes math like this: $t(\alpha)$]% % optional arg. for ToC
        {Header that includes math like this: $\bm{t(\alpha)}$}

and recompile twice.

Note that since you're loading the caption package, it's better to change the caption's font size via a \captionsetup directive. Do also note that \large is a switch, i.e., it doesn't take an argument.


A full MWE (minimum working example):

enter image description here

enter image description here

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry} 
\usepackage{booktabs}
\usepackage{bm}
\usepackage{mathtools}
\usepackage{siunitx}

\usepackage{caption}
\captionsetup[table]{font=bf,size=normalsize,
    justification=centerlast,labelsep=newline}
\renewcommand\thetable{\Roman{table}}

\begin{document}
\pagenumbering{roman}
\listoftables

\clearpage
\pagenumbering{arabic}

\begin{table}[h]
\def\arraystretch{1.5}
\captionsetup{skip=0.33\baselineskip,font={large,bf}}
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.2, group-separator={,}, 
         group-minimum-digits=4}
\caption[Header that includes math like this: $t(\alpha)$]
   {Header that includes math like this: $\bm{t(\alpha)}$}
\label{table:fundsummary}

\small 
This table presents some very interesting and very fancy data, 
which I expect will provide me with at least two Nobel prizes.

\medskip
\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
        l S[table-format=-2.2] *{5}{S} }
\toprule
Description & {Variable} & \multicolumn{5}{c}{Averages}\\
\cmidrule{3-7}
&&{Factor 1}&{Factor 2}&{Factor 3}&{Factor 4}&{Factor 5}\\
\midrule
Section 1  &-11.11 &22.22 &33.33 &44.44 &55.55 &66.66\\
\addlinespace
Section 2 \\
Section 2.2&-11.11 &22.22 &33.33 &44.44 &55.55 &66.66\\
Section 2.3&-11.11 &22.22 &33.33 &44.44 &55.55 &66.66\\
Section 2.4&-11.11 &22.22 &33.33 &44.44 &55.55 &66.66\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
1
  • Thank you very much for your answer, it solves it perfectly! I'll also look into the caption setup for the font size. Have a great weekend.
    – Andreas
    Commented May 25, 2018 at 7:32
2

While I prefer Mico's answer, one can also redefine \bm for the LOT. Since \bm is protected, it will not be expanded in the aux or lot files.

BTW, for the MWE all you needed was the \caption, not the tabular.

\documentclass[11pt]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[english]{babel}
\usepackage[margin=2.5cm]{geometry} % showframe
\usepackage{multirow}
\usepackage{multicol}
\usepackage{tabularx}
\usepackage{caption}
\usepackage{booktabs}
\usepackage{bm}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{siunitx}
\usepackage[skip=0.33\baselineskip]{caption}

\captionsetup[table]{
    font=bf,
    size=normalsize,
    justification=centerlast,
    labelsep=newline
    }
\renewcommand\thetable{\Roman{table}}

\begin{document}
\bgroup
  \def\bm{}
  \listoftables
\egroup
\pagenumbering{roman}
\pagenumbering{arabic}
\setcounter{page}{1}
\vspace{10ex}
\def\arraystretch{1.5}
\begin{table}[h]
\centering
\setlength\tabcolsep{0pt}
\sisetup{table-format=2.2, group-separator={,}, group-minimum-digits=4}
\caption{\large{Header that includes math like this: $\bm{t(\alpha)}$}}
\label{table:fundsummary}
\parbox{\linewidth}{\small{This table presents some very interesting and very fancy data, which I expect will provide me with at least two Nobel prizes.}\vspace{2ex}}
\medskip\small\begin{tabular*}{\linewidth}{@{\extracolsep{\fill}}
                l
                S[table-format=-2.2]
           *{6}{S}
                }
\toprule
\multicolumn{1}{c}{\multirow{2}{*}{Description}}&
\multicolumn{1}{c}{\multirow{2}{*}{Variable}}&
\multicolumn{5}{c}{Averages}\\\cmidrule{3-7}
\multicolumn{2}{c}{}&{Factor 1}&{Factor 2}&{Factor 3}&{Factor 4}&{Factor 5}\\\midrule
Section 1       &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\\midrule
Section 2\\
Section 2.2     &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\
Section 2.3     &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\
Section 2.4     &11.11 &22.22 &33.33   &44.44   &55.55  &66.66\\
\bottomrule
\end{tabular*}
\end{table}
\end{document}
1
  • Mr @JohnKormylo. Thank you very much for your answer as well.
    – Andreas
    Commented May 25, 2018 at 7:33

You must log in to answer this question.

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