TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.




\textbf{Lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr (1)}. Now starts text \lipsum[1]


Any suggestions how to avoid the first line form wrapping around a picture like in the following scheme?

enter image description here


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>}]



\begin{window}[1, l, \includegraphics[]{test}, {}]
\textbf{Lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr (1)}. 
Now starts text \lipsum[1]


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?

share|improve this question
adding the wrapfigure environment between the heading line and the text doesn't work for you? (I'd recommend you used a paragraph break between them too) – henrique Mar 13 '12 at 13:27
actually no, i tried to do it that way, but especially with long "heading lines" it's not working. inline \textbf{(\textit{R})-2-methoxy-2-oxo-1-phenylethyl 3,6-dimethoxy-2-(2-methoxynaphthalen-1-yl)-benzoate (15)}. Now starts text \begin{wrapfigure}[]{l}{0pt} \vspace{-30pt} \includegraphics{test} \end{wrapfigure} \lipsum[1] <br/> Question is here, where to include the wrapfigure and i can't see a good way to do it like that, you agree? – JMR Mar 13 '12 at 13:39
The first line starts to the right of the figure for me, without any changes to your MWE. So perhaps you have some older libraries. Is that what you want, or do you want the output as produced by @Stefan's answer? – Peter Grill Mar 13 '12 at 15:09
@PeterGrill. The MWE's first line starts right of the picture indeed and i am looking for a solution to have a left-aligned headline. Stefans Answer works pretty good, and it looks exactly how it should. Except the schemeref-functionality, i still need that. – JMR Mar 13 '12 at 15:22
Can you incorporate schemeref into your MWE to show the problem? – Peter Grill Mar 13 '12 at 15:33
up vote 3 down vote accepted

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.


{ %
    \par %
    \begin{wrapfigure}{l}{#2} %
        \vspace*{\baselineskip} %
        \includegraphics{#3} %
        #1 %
    \end{wrapfigure}    %
    \setlength{\oldparindent}{\parindent} %
% %  To allow automatic width adjustment we access internal spacing var of package wrapfig:
    \addtolength{\parindent}{-\wd\WF@box} %
% %  instead of using the provided width:
%    \addtolength{\parindent}{-#2} %
    \addtolength{\parindent}{-\columnsep} %
    #4 \par %
    \setlength{\parindent}{\oldparindent} %
    \par %


\textbf{First paragraph}. \lipsum[1]
\parwithleftwrapfig[{\caption{This is a figure.}\label{fig:afigure}}]{0\textwidth}{test}
    {\textbf{Lorem-ipsum-dolor-sit-amet-consetetur-sadipscing-elitr (1)}. Now starts text with references to figure \ref{fig:afigure}. \lipsum[1]}

\textbf{Another paragraph}. \lipsum[1]

share|improve this answer
nice. it works fine for the minimal example. – JMR Mar 13 '12 at 15:02
It gets problematic, when used in a real life example for my thesis. Because there, I am using schemeref for adding numbers within pictures/let latex do it and therefore i need the figure-environment to be still able to have the \schemeref functionality. I don't know if such options are still possible in your hack solution. – JMR Mar 13 '12 at 15:06
hm, and it's a pitty that the automatic specification of size doesn't work for this solution. – JMR Mar 13 '12 at 15:28
Hey @JMR, in my example I wrapped the code into a macro because this is easier to use and makes sure that the reset of parindent is not forgotten. You can still put anything you want into the wrapfigure environment, either with additional parameters or by manually inserting the macro code. To show what I mean I added a new optional parameter to the example. – Stefan Mar 13 '12 at 15:59
As to the auto-width problem: There certainly is a possibility to modify the macro to adjust dynamically to the width, but that's a different question because one would need access to the generated boxes. Maybe start a new question if nobody find's it here. – Stefan Mar 13 '12 at 16:04

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.