0

As default font, I want to have a serif font (MinionPro in my case). But for figure and table captions I like to use a sans-serif font (MyriadPro in my case). If I want to give a mass in electron masses in the caption using siunitx, I encountered that it does not work. I am using the detect-all option for siunitx to let it recognize the font.

(M)WE:

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

\sisetup{detect-all}
\DeclareSIUnit{\Electronmass}{\text{\ensuremath{m_{\text{0}}}}} % My own definition

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

\begin{document}

Normal text in MinionPro.

\begin{table}[b]
    \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{Captions in MyriadPro. siunitx problem: $E=\SI{2}{\electronvolt}$ (works), $m=\SI{14}{\electronmass}$ (does not work), $m=\SI{14}{\Electronmass}$ (does not work either).}
\end{table}

\end{document}
2

EDIT:

I am somewhat confused by the way siunitx acts here. I get the correct result if I take the definition of \electronmass from siunitx and put it through LaTeX.

\documentclass[11pt]{scrbook}
\usepackage[utf8]{inputenc}
\usepackage[minionint]{MinionPro}
\usepackage[sansmath]{MyriadPro}
\usepackage[detect-all]{siunitx}

\begin{document}

Normal text in MinionPro.

{\sffamily\mathversion{sans}%
  Sans serif text $\text {\ensuremath{m_{\text {e}}}}$
  vs. $m=\SI{14}{\electronmass}$ }
\end{document}

Joseph Wright is in this forum, maybe he has an idea.

  • Sorry, I forgot to delete the MinionPro package. However, in my document I use MinionPro as default serif and MyriadPro as default sans serif. I also want to be able to switch the math from serif (which is default) to sans serif (e.g. in captions). So loading MyriadPro with the math option is not what I want. – DaPhil May 14 '15 at 16:31
  • @DaPhil - I suggest you rephrase your question and add a real MWE with your needs (e.g., what you mean with captions). It will make it easier for people to help. – Arash Esbati May 14 '15 at 19:34
  • I rephrased the question. – DaPhil May 14 '15 at 20:28

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.