6

I'm trying to add a caption which less wide than the size of the figure. I want the caption to be right-aligned and maybe like half the size it is now.

Here is my code:

\begin{wrapfigure}{r}{0\textwidth}
\includegraphics[width=11cm, height=8cm]{1}
\caption{some text}
\label{schildklier}
\end{wrapfigure}
Some more text which will be wrapped around the image.

Here 1 is the name of the image. Can this be fixed in a convenient way? Right now the wrapping is fine, but the caption is as wide as the figure, and I want to decrease its width. Any help is much appreciated.

A full working example:

\documentclass[11pt]{article}
\usepackage[left=1.5cm, right=1.5cm, top=3cm, bottom=3cm]{geometry}
\usepackage[font=scriptsize]{caption}
\usepackage{graphicx}
\usepackage{wrapfig}

\begin{document}

\subsection{subsection}
\begin{wrapfigure}{r}{0\textwidth}
\includegraphics[width=11cm, height=8cm]{example-image.pdf}
\caption{This wide caption is much too wide and will not shrink when I tell him to shrink}
\label{Im a label}
\end{wrapfigure}
Much text you are not interested in.

\end{document}
1
  • Should the caption be as wide as the image file?
    – Mico
    Nov 15, 2015 at 12:00

2 Answers 2

1

Is that what you want? I took the liberty to slightly simplify your preamble:

\documentclass[11pt]{article}
\usepackage[hmargin=1.5cm, vmargin=3cm]{geometry}
\usepackage[font=scriptsize, labelfont=sc]{caption}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}

\begin{document}

\subsection{subsection}
\begin{wrapfigure}{r}{11cm}
  \captionsetup{singlelinecheck=off, margin={3.67cm, 0cm}, justification=raggedleft, format=hang}
  \includegraphics[width=11cm, height=8cm]{1}
  \caption{This wide caption is much too wide and will not shrink when I tell him to shrink}
  \label{Im a label}
\end{wrapfigure}
Much text you are not interested in.

\end{document}

enter image description here

0
3
\usepackage{wrapfig}
\usepackage{caption}
\captionsetup[wrapfigure]{margin=1cm}

see documentation of package caption for more examples.

4
  • This is nice but I have tried this, and for some reason it doesn't do anything. Nov 15, 2015 at 10:55
  • 2
    that's not a useful comment. Give a full working example which shows that it doesn't work.
    – user2478
    Nov 15, 2015 at 10:56
  • I have added the full example (without your suggestions, but I have tried them, to no avail. Nov 15, 2015 at 11:04
  • see edited answer
    – user2478
    Nov 15, 2015 at 11:13

You must log in to answer this question.

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