1

I don't know if this complies with the specification, but I'd like the subcaption has the same size as the caption.

So I tried to define like this way:

\usepackage[font=small]{caption}
\usepackage[font=small]{subcaption}

While the font size of subcaption I got was smaller than caption size.

Strange still, I found that if I changed the option of subcaption from 'font=small' to 'font=normalsize', like this:

\usepackage[font=small]{caption}
\usepackage[font=normalsize]{subcaption}

Then I got the fontsize of subcaption was 'small'.

I know I've got what I want. But it's so weird, isn't it?

Here is my code for the sub-figure using the package caption and subcaption.

\documentclass{book}

\usepackage{graphicx}
\usepackage[font=small]{caption}
\usepackage[font=small]{subcaption}
\def\showFontSize{\csname f@size\endcsname pt}


\begin{document}

\begin{figure}
    \centering
    \subcaptionbox{AAAAA~\showFontSize }{\includegraphics[width=0.48\textwidth]{a.JPG}}%
    \hfill
    \subcaptionbox{BBBBB~\showFontSize}{\includegraphics[width=0.48\textwidth]{a.JPG}}%
    \caption{CCCCC~\showFontSize }
\end{figure}

fontsize\showFontSize

\end{document}

And here is the screenshot of my document.

enter image description here

8
  • 1
    In your example, all the three captions are typeset in 9pt. You can check by adding \showFontSize which is defined to be \def\showFontSize{\csname f@size\endcsname pt} (relying the fact that the current unit-less font size is stored in \f@size). Dec 20 '20 at 3:04
  • Thanks for your code. But i found the problem still exists.
    – go go
    Dec 20 '20 at 3:33
  • I got "9, 9, 9, and 10". What's the version of your LaTeX, and all the included packages? Add \listfiles before \begin{document}, compile, and you can find version info near the end of log file. Dec 20 '20 at 4:20
  • 1
    According to the doc of subcaption, it initially sets font+=smaller. Use \usepackage[font=small,font+=larger]{subcaption} works. Investigating why that behavior changed. Dec 20 '20 at 4:32
  • 2
    I've reported to caption, see gitlab.com/axelsommerfeldt/caption/-/issues/109. Dec 20 '20 at 5:35
1

According to the reply from Axel Sommerfeldt, author and current maintainer of caption package bundle,

  • the behavior of latest release (CTAN 2020-10-28) is the correct one, and
  • you can either upgrade or use \usepackage[size=small]{subcaption} to achieve the expected behavior (9pt in both subcaption and caption).
2
  • +1: Thanks for the effort including to contact the package author. Dec 20 '20 at 17:16
  • Thanks for your efforts!
    – go go
    Dec 21 '20 at 0:24

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.