3

I have the following code :

    \begin{wrapfigure}{r}{0.3 \textwidth}
    \includegraphics[scale=0.9]{tulipmatlab.png}
    \caption{Synthesis tools}
    \end{wrapfigure}

Which gives an output of :

enter image description here

I would like the text to fit better than how it looks now. Maybe remove justification ? How can I do this ?

1 Answer 1

6

One option would be to use justification=raggedright, from the caption package:

\documentclass{article}      
\usepackage{caption}
\usepackage{wrapfig}
\usepackage{graphicx}

\begin{document}

\begin{wrapfigure}{r}{0.3 \textwidth}
\captionsetup{justification=raggedright}
\includegraphics[scale=0.9]{tulipmatlab.png}
\caption{Synthesis tools}
\end{wrapfigure}

\end{document}

To have this setting for all wrapfigure environments, instead of using \captionsetup{justification=raggedright} inside each wrapfigure environment, it's enough to add

\captionsetup[wrapfigure]{justification=raggedright}

to the preamble.

4
  • Also, is there a way to push it a bit to the right ? Or is the caption location fixed ?
    – Razor
    Apr 16, 2013 at 16:21
  • @NLed you could use margin=20pt (or any other length) inside \captionsetup: \captionsetup{justification=raggedright,margin=20pt} Is something like that what you need? Apr 16, 2013 at 16:24
  • If you don't want to repeat \captionsetup{justification=raggedright} for every wrapfigure you could use \captionsetup[wrapfigure]{justification=raggedright} within your document preamble instead. (See caption doc, section "wrapfig")
    – user2574
    Apr 16, 2013 at 17:44
  • @AxelSommerfeldt Yes, I forgot to mention that. I'll add your suggestion to my answer. Apr 16, 2013 at 18:11

You must log in to answer this question.

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