22

That's what I use

\usepackage{caption}
\usepackage{subcaption}

The template I'm using is from a university and uses the Koma Script When adding figures or graphs I do this:

\begin{figure}[h!]
\begin{subfigure}[normal]{0.40\textwidth} 
\includegraphics[width=\textwidth]{figures/Fig1}
\caption{Caption of Fig1}
\label{Label of Fig1}
\end{subfigure}
\begin{subfigure}[normal]{0.40\textwidth}
\includegraphics[width=\textwidth]{figures/Fig2}
\caption{Caption of Fig2}
\label{Label of Fig2}
\end{subfigure}
\caption{This is the caption for whole graphic}
\label{This is the label for the whole graphic}
\end{figure}

what I want to know is how to simply adjust different font styles for the captions of the subfigures and figure.

I want especially the captions fonts of the subfigures to be smaller than the captions fonts of the figures.

As far as I googled the problem, I could do this with a Koma script command or by addressing the caption package.

I tried the following:

\captionsetup{font=small,labelfont={bf,sf}}

this affects all captions but how can I adjust the captions of subfigures separately?

I don't understand the difference in the approaches between the komaScript and the captionpackages So I simply want to adjust the Font sizes of the different Caption types separately and uniquely for the whole document and I would like to adjust the space between the captions and the subfigures .....

1
  • 2
    BTW: [normal] is not a valid position specifier for the minipage and subfigure environment.
    – user2574
    Commented Dec 16, 2015 at 8:53

2 Answers 2

28

You can use the [sub] optional parameter of \captionsetup, e.g.

\captionsetup{font=normalsize,labelfont={bf,sf}}
\captionsetup[sub]{font=small,labelfont={bf,sf}}

BTW, I would add a \centering in your figure environment.

5
  • This doesn't work for me for figures created with figure*. If I manually put \captionsetup{...} within a specificfigure* environment, it works - but I'd like to do it once at the beginning of the document, so that when you put it at the start, it works not only for figure, but also figure*. Any help with that?
    – Ela782
    Commented May 9, 2017 at 17:33
  • @Ela782 I've just tried and it works for me with figure* too. I suggest you ask a new question and provide a couple of details. You can link to this question in order ot provide some background.
    – campa
    Commented May 10, 2017 at 8:00
  • I see, thanks for trying! It is my particular setup then. I will proceed as you suggest. Thank you :)
    – Ela782
    Commented May 10, 2017 at 18:39
  • Don't you have to do \usepackage{caption} first? Commented Feb 23, 2018 at 9:40
  • @tommy.carstensen Wow, I didn't remember I wrote this answer. Anyway yes, the subcaption package is required, but this is clear from the question setup so I wrote only the relevant snippet.
    – campa
    Commented Feb 23, 2018 at 10:03
1

When I was Googling, I first thought that the title was complaining about the behavior and not trying to reach the behavior. Since some people might understand the question the same as I understood, I will add a way of putting the same font size for both: caption and subcaption. Depending on your LaTeX configuration, you will not be able to get smaller fonts with the same size for the figure and subfigures (I had such a behavior in my thesis). To reach the desired font size for the figure environment, just put in the preamble:

\usepackage{caption}
\usepackage{subcaption}
\captionsetup[figure]{font=footnotesize}

For the subfigure's caption size to be taken into account, just change the command figure from

\begin{figure}[h!]

to

\begin{figure}[h!]\captionsetup[subfigure]{font=footnotesize}

The footnotesize in font=footnotesize can be changed only by the following sizes:

* \Huge
* \huge
* \LARGE
* \Large
* \large
* \normalsize
* \small
* \footnotesize
* \scriptsize
* \tiny

P.S.: You can use the \captionsetup command in the preamble as well.

You must log in to answer this question.

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