Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I included a figure using the figure environment with a rather long caption. The width of the caption is the same as the page width, which doesn't look so nice. Is there any way to reduce the width of the caption frame?

share|improve this question
add comment

2 Answers 2

up vote 10 down vote accepted

Her's one possibility using the caption package; using the width key you can assign a predefined width (0.8\textwidth in my example):

\documentclass{article}
\usepackage{caption}
\usepackage{lipsum}

\begin{document}

\lipsum[2]
\begin{figure}
\captionsetup{width=0.8\textwidth}
\centering
A Figure
\caption{\protect\lipsum[4]}
\end{figure}

\end{document}

enter image description here

You can also make this a global setting using \captionsetup in the preamble.

Another option is to use the floatrow package; here's a little example using \FBwidth to make the caption width equal to the figure width:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{floatrow}
\usepackage{lipsum}

\begin{document}

\lipsum[2]
\begin{figure}
\ffigbox[\FBwidth]
  {\caption{\protect\lipsum[4]}}
  {\includegraphics{image}}
\end{figure}

\end{document}

enter image description here

The demo option for graphicx simply replaces actual figures with black rectangles; do not use that option in your actual document.

share|improve this answer
add comment

The boxhandler package is set to define different captioning options. Below is a screenshot from the package manual. By default, it makes the caption width the figure width, but you can set upper and lower bounds on caption width as well as define specific widths. You also see in the image below different caption styles

enter image description here

And in this second image, you can see some of the parameters over which it gives you control.

enter image description here

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.