0

I often use classicthesis. However, now I'm facing with a problem I haven't seen before. Whenever I include a wrapfigure, the image appears without wrap at the end of the text block. This is the code that LyX creates:

\clearpage{}

\begin{addmargin}[-11mm]{-31mm}

\begin{wrapfigure}{l}{0.3\columnwidth}%
\includegraphics{../test}
\end{wrapfigure}%

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\end{addmargin}

This is a screenshot of the PDF that is created: enter image description here

The function works great with a common article (standard class). Therefore, I assume that this is due to the addmargin. If so, how could I avoid that misbehavior and yet use the addmargin in here. Or: How to solve this?

\documentclass{scrartcl}

\usepackage{wrapfig,graphicx}
\begin{document}

\begin{addmargin}[-11mm]{-31mm}

\begin{wrapfigure}{l}{0.3\columnwidth}%
\includegraphics[width=.25\columnwidth]{example-image}
\end{wrapfigure}%

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\end{addmargin}
\end{document}
5
  • I added a test file, note that you get the warnings Package wrapfig Warning: wrapfigure used inside a conflicting environment on input line 8. and Package wrapfig Warning: Stationary wrapfigure forced to float on input line 12. so it simply isn't supported to use addmargin here (which is a one item list internally) Jun 22, 2021 at 7:05
  • @DavidCarlisle: Ok - thx. But as mentioned above, I use classicthesis for Lyx. There the wrapfig package is already included and I don't get any error messages when executing ... funny.
    – Anti
    Jun 22, 2021 at 8:26
  • It is not an error, but a warning, I assume classicthesis is defining addmargin in essentially the same way (as you didn't provide a testable example) but in general wrapfig doesn't work inside lists or display enviornments. Jun 22, 2021 at 10:55
  • @DavidCarlisle: Ah, ok. Understand. Thx for clarification!
    – Anti
    Jun 22, 2021 at 11:31
  • BTW, wrapfig has a built in overhang option that acts sort of like addmargin, at least on one side. Jun 22, 2021 at 12:47

1 Answer 1

0

This solution uses negative \hspace and a minipage instead of \addmargin. It won't break across pages, but it doesn't confuse so many packages either.

BTW, I assume the -31mm was a typo as it extends off the page.

\documentclass{scrartcl}
\usepackage{wrapfig,graphicx}
\usepackage{showframe}% MWE only

\begin{document}

\noindent\hspace{-11mm}\begin{minipage}{\dimexpr \textwidth+22mm}

\begin{wrapfigure}{l}{0.3\columnwidth}%
\includegraphics[width=.25\columnwidth]{example-image}
\end{wrapfigure}%

text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text 

\end{minipage}\hspace{-11mm}

\end{document}

You must log in to answer this question.

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