I'm trying to set up captions in my document to all have a certain format, as can be seen in the screenshot:

enter image description here

I'm doing this through the caption package, as can be seen in this MWE:



\usepackage[margin=10pt,font={footnotesize, sf},labelfont=bf, labelsep=space]{caption}


        \caption[paragraph]{\textbf{This is my test caption} \\[5pt]
        Look, it is always the width of the page, \\ rather than the width of the figure, can \\ I change this?



The issue is, that the width of the minipage in the caption, and therefore the width of the whole caption, is set by the linewidth rather than by the figurewidth. Is there some way that I can fix this? Am I going to have to do the caption formatting individually for each figure rather than using caption?

I'm sorry if this is something that's been asked before, if it has I couldn't find it.

Thanks in advance!

  • Have you considered \linewidth i stead of \textwidth, text width never changes, linewidth does – daleif Apr 15 at 11:07
  • Thanks very much! This solved the issue for me. Do you want to submit it as a solution so I can accept it? – Noah Sprent Apr 15 at 12:38

In your configuration, use \linewidth instead of \textwidth. In most latex constructions, \linewidth is changed according to the current configuration. On the other hand \textwidth is constant.

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.