3

I use the wrapfigure package for placing images in my text at the right side.

Now my problem is, that my image is really small and my caption is larger then the image. Instead of a line break at the end of the line it adds the chars below each other. This looks like the following:

Error on wrapfigure package

So is it possible to add a line break after "Abbildung 4.3:" with the content of \caption?

My code looks like this:

\begin{wrapfigure}{R}{2,76cm}
\includegraphics[]{./bilder/mockup-endtimeError}
\caption{Error Start- Endzeit}
\label{mockup-endtime-error}
\end{wrapfigure}

BR & Thanks, mybecks

5

You can use the caption package to format the way the captions are displayed. Yo can also use the ragged2e package to set your caption as ragged right to avoid bad hyphenations.

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}
\usepackage{caption}
\usepackage{lipsum}
\usepackage{ragged2e}
\DeclareCaptionFormat{myformat}{#1#2\\#3}
\captionsetup[wrapfigure]{name=Figure, justification=RaggedRight, format=myformat}
\begin{document}
\begin{wrapfigure}{R}{2,76cm}
\rule{3cm}{5cm}
\caption{Error Start- Endzeit}
\label{mockup-endtime-error}
\end{wrapfigure}

\lipsum

\end{document}

For such small images, I would recommend you use Fig. rather than the full Figure or the equivalent in German. For more details see the caption manual Section 4.1 Further examples.

1

You can also set the caption text separate from the actual \caption:

enter image description here

\documentclass{article}

\usepackage{wrapfig,graphicx}
\usepackage{lipsum}

\begin{document}

\begin{wrapfigure}[12]{r}{50mm}
  \centering
  \includegraphics[width=40mm]{example-image}
  \caption[Lorem ipsum]{\unskip}

  Lorem ipsum lorem ipsum lorem ipsum lorem ipsum
\end{wrapfigure}
\lipsum[1]

\end{document}

\unskip removes the space between the usual caption label and text, while the optional argument ensure the proper content makes its way into the LoF.

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.