0

The memoir class has built-in macros for styling the font of captions, including both the caption itself and the prefix (i.e. "Figure 1"), with \captiontitlefont{} and \captionnamefont{}.

The class also has built-in subcaption capabilities, removing the need for the caption package (TeX will yell at you if you try to use memoir and caption at the same time).

However, there doesn't seem to be a way to change the font for subcaptions in memoir—there's no \subcaptiontitlefont{}.

For example, this MWE…

\documentclass[12pt]{memoir}
\usepackage[demo]{graphicx}

% Enable \subtop and \subbottom in figures
\newsubfloat{figure}

% Change caption fonts
\captiontitlefont{\scriptsize\sffamily}
\captionnamefont{\scriptsize\sffamily}

\begin{document}

\begin{figure}
  \centering
  \subtop[Thing 1]{\includegraphics[width=0.75\textwidth]{}}\\
  \subbottom[Thing 2]{\includegraphics[width=0.75\textwidth]{}}\\
  \caption{Two subfigures}
\end{figure}

\end{document}

…creates this, with a sans serif main caption and seriffed subcaptions:

MWE result

There are ways to use the caption package regardless of memoir's warning (such as this), overriding memoir's built-in caption styling settings like so:

\usepackage{subfig}
\usepackage{caption}
\captionsetup[figure]{labelfont={sf,scriptsize},textfont={sf,scriptsize}}
\captionsetup[subfloat]{labelfont={sf,scriptsize},textfont={sf,scriptsize}}

However, this still does not style the subfloat captions correctly (and it overwrites all of memoir's caption defaults).

What's the best/correct way to set the font for memoir-supported subcaptions?

2

Ugh, never mind. There is a built-in memoir way—it just doesn't follow the same naming conventions as \captiontitlefont so it was trickier to find in the manual. Subcaptions are controlled by three macros, with the following defaults:

\subcaptionsize{\footnotesize}
\subcaptionlabelfont{\normalfont}
\subcaptionfont{\normalfont}

So this example…

\documentclass[12pt]{memoir}
\usepackage[demo]{graphicx}

% Enable \subtop and \subbottom in figures
\newsubfloat{figure}

% Change caption fonts
\captiontitlefont{\scriptsize\sffamily}
\captionnamefont{\scriptsize\sffamily}

\subcaptionsize{\scriptsize}
\subcaptionlabelfont{\sffamily}
\subcaptionfont{\sffamily}

\begin{document}

\begin{figure}
  \centering
  \subtop[Thing 1]{\includegraphics[width=0.75\textwidth]{}}\\
  \subbottom[Thing 2]{\includegraphics[width=0.75\textwidth]{}}\\
  \caption{Two subfigures}
\end{figure}


\end{document}

… now yields this correctly styled output:

Correct output

| improve this answer | |

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.