0

I would like to see the caption font (and caption label too) with size that is smaller than in whole document.

I`ve tried some solutions from SE (Font size of Figure Caption Header), e.g.:

\usepackage[font=small]{caption}

and

\usepackage{caption}
...
\captionsetup[figure]{font=small}

but is doesn`t work in my case.

I think it may be caused by one of this conditions or both:

  1. I`m using extarticle document class (because I need 14pt text size);
  2. I have the following lines in my code (that centering captions of figures):
\makeatletter
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \hbox to\textwidth{\hfill\parbox{1\textwidth}{\begin{center}#1: #2\end{center}}\hfill}
  \vskip\belowcaptionskip}
\makeatother

Can you give me some advices about my problem? In addition, how can I manually derive caption font size (for example 12pt or 13pt)?

Update. here is the MWE of my problem (I hope it`s actualy "M"inimal):

\documentclass[14pt,a4paper]{extarticle}

\usepackage{graphicx}
\graphicspath{ {pictures/} }

\makeatletter
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  \hbox to\textwidth{\hfill\parbox{1\textwidth}{\begin{center}#1: #2\end{center}}\hfill}
  \vskip\belowcaptionskip}
\makeatother

\begin{document}

Picture:
\begin{figure}[ht]
   \includegraphics[width=0.5\linewidth]{levels.png}
    \caption{Here is a big picture. Caption are centered but it has the same font size as in whole document.}
\end{figure}

\end{document}
2
  • Have you tried to insert the desired fontsize in your definition of the caption? It is easier to help you, if you provide for an MWE.
    – C. Peters
    Commented Jun 2, 2021 at 5:53
  • @C.Peters, please, take a look at the updated version of my question with MWE
    – Alexander
    Commented Jun 4, 2021 at 3:27

1 Answer 1

3

Since you're already redefining \@makecaption, you can set the size there (and that's likely why you're finding that the caption package isn't working as expected).

I'd also note that your definition can be improved a bit. The nested \hbox to\textwidth and \parbox are redundant and you can actually get rid of both. You probably want to also not use the center environment as that adds a bit of vertical space above and below since it's implemented using a trivlist.

Instead I would do this:

\makeatletter
\long\def\@makecaption#1#2{%
  \vskip\abovecaptionskip
  {
   \centering
   \small % or whatever your desired size is
   #1: #2
   \par % otherwise the centering will go away before it gets applied to the caption
  }
  \vskip\belowcaptionskip}
\makeatother
3
  • Thank you very much for your helpfull suggestions! However, I have one unanswered question: is there a way to set font size in caption manually in points (pt) instead of commands like \small etc.?
    – Alexander
    Commented Jun 6, 2021 at 1:52
  • Yes. In fact the sizing commands are a relic of the earliest era of LaTeX where fonts were typically only available at a limited set of (idiosyncratic) sizes. The command \fontsize{9pt){11pt}\selectfont will, for example, set the size to be 9pt on an 11pt baseline. Note that \small also adjusts some other parameters but they shouldn't come into play in the context of a caption.
    – Don Hosek
    Commented Jun 6, 2021 at 2:34
  • I leave here a note: do not forget to remove [fontsize=small] while including package caption. I've missed it and lost some time figuring it out.
    – Alexander
    Commented Jun 7, 2021 at 19:31

You must log in to answer this question.

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