4

I ran across this problem and fail to find an answer even after thorough searching:

I use

\usepackage[bf]{caption}  

in my LaTeX document, as I want the "Figure 1"-Part of the caption to appear bold. Unfortunately, the following caption is indented starting on the second line, so that the "Figure 1" part is alone:

Figure 1: blabla, bla-  
          blablabla
          blabal
          blablabla

I'd prefer sth like this (the other variant looks really stupid for narrow floats and wastes space):

Figure 1: blabla, bla-
blablabla blabla blabla

Has anyone found a solution for this?

3
  • Welcome to TeX.sx! Your question was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other, otherwise you won't be able to comment on or accept answers or edit your question.
    – Werner
    Jan 5 '12 at 18:10
  • 4
    The caption documentation (available e.g. with texdoc caption) has a section on formatting. You should really read it. Jan 5 '12 at 18:38
  • Thanks for the tip, I looked this up in a far older version of the documentation which didn't list the below-mentioned way to solve the problem. Jan 5 '12 at 20:34
11

The package caption provides different styles via option. To set one of the predefined styles use format=.

Here an example

\documentclass{scrartcl}
\usepackage[bf]{caption} 
\def\exampletext{Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Ut purus elit,
vestibulum ut, placerat ac, adipiscing vitae, felis. Curabitur dictum gravida
mauris. Nam arcu libero, nonummy eget, consectetuer id, vulputate a,
magna.
}
\begin{document}
\begin{figure}[!ht]
\centering
\rule{7cm}{1cm}
\caption{\exampletext}
\end{figure}

\begin{figure}[!ht]
\captionsetup{format=plain}
\centering
\rule{7cm}{1cm}
\caption{\exampletext}
\end{figure}

\begin{figure}[!ht]
\captionsetup{format=hang}
\centering
\rule{7cm}{1cm}
\caption{\exampletext}
\end{figure}
\end{document}

enter image description here

1
  • Thank you, solves it for my images. Unfortunately, on first glance, this doesn't seem to work with ctable. Let's see if I find a solution for that. Jan 5 '12 at 20:56
3

If including the line \usepackage[bf]{caption} is causing the captions to be formatted "hanging" while they do not without this line, then this is clearly a bug in my caption package. Please give me a Minimal Working Example (MWE) so I can fix this.

Unless this is fixed by me I would avoid usage of my caption package since there is a compatibility problem here which influence can't be estimated - it could cause serious other problems.

7
  • 4
    Shouldn't this rather be a comment to the OP's question?
    – lockstep
    Jan 5 '12 at 19:24
  • 1
    It fails with KOMA classes, probably redefined internally somewhere, but you right a MWE is always a must. Jan 5 '12 at 19:35
  • 1
    I just added a solution to my answer (avoiding my caption package) - and IMHO this is the right solution, I would clearly not recommended "fixing" this by other caption package settings like format=plain. At least unless we know what the real problem is.
    – user2574
    Jan 5 '12 at 19:38
  • 2
    Seems I was completely misleaded by your phrase "bold numbering indents caption text". It seems the real answer is simply: No, this is not true, the bold numbering does not indents caption text. (As already stated it would be a bug otherwise.)
    – user2574
    Jan 5 '12 at 21:16
  • 1
    Sorry for that, I had the impression that this issue arose after adding the caption package - my bad. Thank you for providing the package, I really appreciate the help and work that ppl invest into latex and guys like me :) Jan 5 '12 at 21:41

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.