I am trying to change a caption format with the caption package within a float environment (in this case figure). However, \captionsetup[figure]{} is not working within the \begin{figure} ... \end{figure} which is definitely possible and described on pg. 4 of the caption documentation, namely:

It’s good to know that \captionsetup has an effect on the current environment only. So if you want to change settings for the current figure or table only, just place the \captionsetup command inside the figure or table right before the \caption command. For example \begin{figure} . . . \captionsetup{singlelinecheck=off} \caption{. . .} \end{figure} switches the single-line-check off, but only for this figure, so all the other captions remain untouched.

I cannot recall having issues with this before, can anybody reproduce this issue or provide guidance on how to fix it so the local \captionsetup is used? I think I am calling the commands correctly although a simple error on my end is likely too.

The log file (with \showfiles):

This is pdfTeX, Version 3.141592653-2.6-1.40.24 (TeX Live 2022) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
LaTeX2e <2022-11-01> patch level 1
L3 programming layer <2023-02-22>
Document Class: book 2022/07/02 v1.4n Standard LaTeX document class
No file test.aux.

Caption Info: Option list on `figure'
Caption Data: {position=bottom,labelfont={Large,it}, labelsep=period} on input 
line 27.

Package caption Warning: Unused \captionsetup[figure] on input line 25.
See the caption package documentation for explanation.

[1{c:/texlive/2022/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] (./test.aux)

 *File List*
    book.cls    2022/07/02 v1.4n Standard LaTeX document class
    bk10.clo    2022/07/02 v1.4n Standard LaTeX file (size option)
 caption.sty    2022/03/01 v3.6b Customizing captions (AR)
caption3.sty    2022/03/17 v2.3b caption3 kernel (AR)
  keyval.sty    2022/05/29 v1.15 key=value parser (DPC)
subcaption.sty    2022/01/07 v1.5 Sub-captions (AR)
l3backend-pdftex.def    2023-01-16 L3 backend support: PDF output (pdfTeX)

Output written on test.pdf (1 page, 30235 bytes).
Transcript written on test.log.




\captionsetup[figure]{position=bottom,labelfont={bf, small}, textfont={small}}


\caption{Bold and small}

\captionsetup[figure]{position=bottom,labelfont={Large,it}, labelsep=period}
\caption{Large and italic}

How it currently looks:

enter image description here

  • Quite curiously, the warning disappears if another figure follows, but the caption style doesn't change.
    – egreg
    Feb 27, 2023 at 18:36
  • @egreg When I remove the [figure] then the code compiles but in my main document, I have \captionsetup[subfigure] which meant I wanted to not affect subcaptions too by changing a local definition "global" when I \input other files. Just requires careful management but it is not mentioned in the documentation not to use it within a float, I am not sure why it won't work though it is puzzling.
    – JamesT
    Feb 27, 2023 at 18:57
  • How about reporting your problem to the maintainer of the package? Feb 27, 2023 at 19:03
  • @PeterWilson I will do that now on GitLab, was just checking that this wasn't me making a mistake or if it was already a known "bug" to the frequenters here.
    – JamesT
    Feb 27, 2023 at 19:07
  • 1
    Thank you. It's a long time since I had anything to do with any packages I might have produced. My intellectual capabilities have faded, but not as fast as my memory. Don't trust me. --- Peter W. --- GOM Feb 27, 2023 at 19:22

1 Answer 1


Per @Peter Wilson's comment, I contacted the caption maintainer on their issue tracker on GitLab here and I appreciate the maintainer responding so quickly with:

Options given via \captionsetup[x]{...} will be applied at the beginning of the environment x (and not at the \caption within the environment x), and therefore the \captionsetup[figure]{...} is "too late" to be applied because \captionsetup[figure]{...} adds the given options to the "list of options applied at the beginning of the figure environment" only. It was implemented this way because otherwise something like \captionsetup{...} within a figure would not overwrite options given with \captionsetup[figure]{...} at the preamble, and otherwise it would make the order of utilization of options to sub-captions even more complicated.

The maintainer has said that they will update the caption documentation in a new release to make it clearer that \captionsetup["float"]{...} is applied at the beginning of the environment and is not suitable to be used within a "float" environment. I was unaware of this after going through the caption documentation pdf so maybe this will help others who might face the same issue prior to its release.

  • \captionsetup inside figure changes the figure caption localy, not the subfigure caption nor future figures. Feb 27, 2023 at 23:15

You must log in to answer this question.

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