As the following minimal sample shows, a text wrapping around a picture starts wrapping with the first line. Including the wrapfigure
in the text leads to strange paragraph breaks.
%----
\documentclass[bibliography=totoc,listof=totoc,12pt,a4paper,oneside]{scrbook}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage{wrapfig}
%----
\begin{document}
\begin{wrapfigure}[]{l}{0pt}
\vspace{-30pt}
\includegraphics{test}
\end{wrapfigure}
\textbf{Lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr (1)}. Now starts text \lipsum[1]
\end{document}
Any suggestions how to avoid the first line form wrapping around a picture like in the following scheme?
Edit:
I have found a way to solve the problem for a minimal example using picinpar
and a window
environment.
\begin{window}[<number of lines>, <align>, \includegraphics[]{<file>}, {<caption-text>}]
%---
\documentclass[bibliography=totoc,listof=totoc,12pt,a4paper,oneside]{scrbook}
\usepackage{lipsum}
\usepackage[demo]{graphicx}
\usepackage{picinpar}
%---
\begin{document}
\begin{window}[1, l, \includegraphics[]{test}, {}]
\textbf{Lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr (1)}.
Now starts text \lipsum[1]
\end{window}
\end{document}
But still I want to use schemeref
to add numbering within a picture and therefore I need a figure
environment and no such solution with window
.
Any ideas regarding that?
Best Answer
Kind of a hack as a solution would be to push down the image a little and use a negative indentation for the first line like below. I put the code into the macro
\parwithleftwrapfig
because it's important to correctly end paragraphs before and after the figure and reset the original indentation...Note that you have to explicitly specify the width of the wrapfigure for this macro to work...
EDIT: I inserted an optional parameter to show that you can still use arbitrary code.
EDIT2: Adapted solution to access internal
wrapfig
-var to allow for automatic width adjustment. Note that internal vars of packages may change on updates without notice.