8

I need also in the figures and tables caption, the title be in bold not the description of them. I mean "Figure 3" in bold but the description "this is a new and beautiful image for every one like that....." ordinary font. I use these commands, it works when the caption is not too long,

\usepackage[compatibility=false,labelfont=it,textfont={bf,it}]{caption}
\captionsetup{labelfont=bf,textfont=bf}
1
  • 3
    Welcome to TeX.SX! Please provide a compilable document, not just fragments
    – user31729
    Aug 13, 2016 at 8:21

2 Answers 2

6

For "the title [of the caption to] be in bold [but] not the description of them", i.e., if an upright font shape needs to be employed, you should issue the instruction

\usepackage[labelfont=bf,textfont=md]{caption}

and not issue a \captionsetup directive.

If the caption title should be in bold italics and the caption text in ordinary italics, you should state

\usepackage[labelfont={bf,it},textfont=it]{caption}

Don't use the compatbility=false option. The package's user guide states that "this option is neither recommended nor supported since unwanted side-effects or even errors could occur afterwards."

2
  • And how do you change the font in the referenced text? I would like to see Figure 1 italiced
    – skan
    Nov 9, 2017 at 10:31
  • @skan -- Please clarify: Are you asking a question about the appearance of the material that shows up in a cross-reference to a figure or table, or is the question about the appearance of the captions of the figures and tables?
    – Mico
    Nov 9, 2017 at 11:18
4

From your question, I gather that you want two things for your caption: Label should be in bold, text should be normal text.

From your code, I gather that you haven't quite decided on what you want. As pointed out by Mico, you don't need to use both \captionsetup{} and optional arguments when loading the package. Placed in the preamble like this, they would do the exact same thing. You could of course use \captionsetup{} later on in your document, to change how the caption should be for a single float, like figure or tabular.

Besides, you seem to be setting both the labelfont and textfont, when relly you just want the labelfont changed. If you want to remove changes that was put in earlier, and go back to the ordinary font, use normalfont. Example:

I also don't see why you overide the compatibility check. It is not recommended. From the documentation of caption, section 6, Package support you will find the following:

You can override this compatibility mode by specifying the option

compatibility=false

when loading the caption package. But please note that using this option is neither recommended nor supported since unwanted side-effects or even errors could occur afterwards. (For that reason you will get a warning about this.)

Output

enter image description here

Code

\documentclass[11pt]{article}
\usepackage[labelfont=bf]{caption}
\captionsetup{labelfont=bf}
\begin{document}

\begin{figure}[hbt]
\centering
  \rule{1cm}{1cm}
  \caption{A short caption}
\end{figure}

\begin{figure}[hbt]
\centering
  \rule{1cm}{1cm}
  \caption{A longer caption, just because sometimes, well, you're kind of stuck with them, even though you really shouldn't.}
\end{figure}

\begin{figure}[hbt]
\captionsetup{labelfont=normalfont}
\centering
  \rule{1cm}{1cm}
  \caption{A short caption, no bold label}
\end{figure}

\end{document}
4
  • Minor quibble - "I also don't see why you remove the compatibility-check." -- Should that be "... provide ..."? :-)
    – Mico
    Aug 13, 2016 at 9:31
  • thank you @Mico, I changed the wording to reflect that package-documentation. I agree, it could be misunderstood.
    – Runar
    Aug 13, 2016 at 9:35
  • 1
    @Mico we just keep stealing each others answers :P
    – Runar
    Aug 13, 2016 at 12:26
  • And how do you change the font in the referenced text? I would like to see Figure 1 italiced.
    – skan
    Nov 9, 2017 at 10:31

You must log in to answer this question.

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