I had the same problem as in LINK. The question is about using \endgroup somewhere. If I use the following code



\draw[step=1cm,very thin] (0,0) grid (13,8);
\noindent \lipsum[1]


it would look like this picture Test1

However, if I add an empty line after \lipsum[1]

(... like above)
\noindent \lipsum[1]



it would look like this picture Test2

Why is there a difference in the code? If I replace this empty line with \\, \newline or even \hfill \break, none changes. What does this ''empty line'' in grouping mean? Is there other way to fill this empty line to make the code work as in the second picture?

  • You should not use wrapfig in a group or if you do, as you show, make sure the paragraph ends before the group ends. Nov 20, 2022 at 21:41
  • @DavidCarlisle The only reason I used group is \setlength\intextsep{0pt} to move the figure a little bit up, only for this figure without affecting other future figures. I followed similar method in link about grouping
    – UnknownW
    Nov 20, 2022 at 21:44
  • just us a vspace, wrapfig says If you put a wrapfigure in a parbox or a minipage, or any other type of grouping, the text wrapping should end before the group does. So if you have the group you must end the paragraph with blank line before endgroup, and even then it may not work ` Nov 20, 2022 at 21:46
  • @DavidCarlisle Sorry, I don't understand what you meant by vspace. Where should I write it? If I remove begingroup and endgroup, and move the \setlength\intextsep{0pt} in the premable, everything works as I wanted. But it would mean that all other figures would be affected by this code as well
    – UnknownW
    Nov 20, 2022 at 21:52
  • begin{wrapfigure}{r}{0pt}\vspace{-10pt}\begin{tik... Nov 20, 2022 at 21:56


You must log in to answer this question.

Browse other questions tagged .