0

I use a serif font for my document (koma-script document class scrbook) but a sans-serif font for captions. If I reference, e.g. an equation, within my caption, this number is printed in serif, not sans-serif. How can I change that?

MWE using MinionPro (serif) and MyriadPro (sans-serif):

\documentclass[11pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[minionint]{MinionPro}
\usepackage[sansmath]{MyriadPro}
\usepackage{array}

\setkomafont{captionlabel}{\sffamily\bfseries}
\setkomafont{caption}{\sffamily}

\begin{document}

An equation:
\begin{align}
\label{eq:eq1}
E=\hbar\omega \, .
\end{align}

\begin{table}
    \centering\sffamily\mathversion{sans}
    \begin{tabular}{ c >{\centering}m{6.0cm} c }
    \multicolumn{3}{c}{} \\
    Band & Angular Momentum Eigenstate & Basis Set \\
    \multicolumn{3}{c}{} \\
    \hline
    \multicolumn{3}{c}{} \\
    a & b & c \\
  \end{tabular}
  \caption{Values computed by Eq.~\eqref{eq:eq1} (0.1).}
\end{table}

\end{document}
2
  • \eqref tries quite hard to set the font to \normalfont. Why don't you use Eq.~\ref{eq:eq1}? May 13, 2015 at 13:55
  • @UlrikeFischer Thanks, didn't know that \eqref tries so hard... Just is my usual workflow to spare the braces.
    – DaPhil
    May 13, 2015 at 14:21

1 Answer 1

2

I think you can go either of two routes:

  • Add the instruction

    \renewcommand\familydefault\sfdefault
    

after the start of the table environment. As @UlrikeFischer has pointed out in a comment, \eqref sets its argument in normalfont, requiring the change in the "default font family" to get the desired font when using \eqref.

  • Don't use \eqref in the first place. I suggest you load the cleveref package (with the option capitalize, if you prefer) and write the caption as

    \caption{Values computed by \cref{eq:eq1}.}
    

(I would like to provide the output of an MWE. Unfortunately, my TeX distribution doesn't seem to feature the MinionPro and MyriadPro packages featured in the OP's example.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.