1

today I'm having a problem with one of the chapters of my Thesis. My plan was to define different types of robot arms with a figure in each subsection ( or in my case subsubsection) I wanted the figures to be on left then right then back to left as I go through the subsubsections

\begin{wrapfigure}{r}{0.3\textwidth}
\includegraphics[width=1\linewidth]{Image_directory.png} 
\captionsetup{justification=centering,margin=0.1cm}
\caption{Needed_Caption}
\label{fig:wrapfig}
\end{wrapfigure}

The only difference is basically the image file location and caption and {r} or {l} depending on the subsection. but this is what I got. Image1 Image2 Image3 Image4

Everything is messed up and unreadable and it's giving me old Ms word vibes. anyone can Tell me what I did wrong and nudge me in the right way to fix it? I'm new with Latex so I'm still learning . Thank you for your time and understanding

  • 1
    wrapfig is rather complicated and fragile and quite often needs some fine tuning, e.g. forced page breaks. Consider if you really want to use it. Often is it easier to use two minipages side by side. Unrelated: don't use \newline like this. If you want to insert vertical space use \vspace. – Ulrike Fischer Feb 03 '22 at 14:43
  • I don't need the \newline I just thought maybe they would fix the figures. Eventually, if the figures are fixed I will remove them. Thank you though – Nebrass Ibrahimi Feb 03 '22 at 14:45
  • As is Ulrike Fischer said, wrapfigure is fragile and is just like 'Tight' mode in MS Word. You have to either change the contents manually (of course it is hard work) or give up wrapfigure where you cannot handle it. Just a normal figure environment will do. – Teddy van Jerry Feb 03 '22 at 15:32
  • 1
    no you need to move the \newline first as there is no chance to get an error free layout with them there. But it is impossible to debug code shown as an image, please always try to provide a complete small test document as text in a code block so answers can be tested (you can use example-image as the image as it is available for tests) – David Carlisle Feb 03 '22 at 16:10
  • 1
    See https://tex.stackexchange.com/questions/555036/wrapfig-environment-doesnt-wrap. These days I prefer using paracol (see https://tex.stackexchange.com/questions/611977/floating-wrapfigure-leaves-whole-article-text-wrapped-if-unnumbered-sections-are). – John Kormylo Feb 03 '22 at 18:36
  • Thank you guys, for some reason adding \WFclear at the end of each subsubsection, seemed to fix my problem. now everything is showing the way it is supposed to be. – Nebrass Ibrahimi Feb 04 '22 at 08:50

0 Answers0