5

I have a thin, page-long figure I want to place on the left-side of a specific page containing a reference to that figure. My current approach is to make this a wrapfigure, but it seems like wrapfigure only wants to place this figure after a paragraph. I.e. if the specific page on which I want to place this figure doesn't start with a paragraph break, the figure will either be placed just after the first paragraph break on the page, or on some other convenient page.

To illustrate, I want this (blue and red are used to distinguish between paragraphs): enter image description here

And currently I am getting something like this (note the figure running over the pageborder): enter image description here

Is there anything I can do to accomplish this?

Here is a minimum working example (note I want the figure to somehow be on page two):

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum}
\usepackage{mwe}

\begin{document}
\lipsum[1] 
\begin{wrapfigure}{L}{0.25\textwidth}%[h!]%[t!]
        \centering
        \includegraphics[width=0.23\textwidth, height=18.2cm]{example-image}
       \caption{foobar}
\end{wrapfigure}
\lipsum[7-8] \lipsum[1-18]
\end{document}

enter image description here

[EDIT] Furthermore, I tried to add a synthetic paragraph-break as suggested by David Carlisle in the comments, but for some reason the figure still doesn't end up on the page I want. I have also tried to place the figure's code before the paragraph (that is where the original paragraph started), with the result of the figure being placed right there where the code is if passing {L} to wrapfigure, and again the page after the the one I want if passing {l} to wrapfigure:

enter image description here

  • 3
    you will need to make a "fake" paragraph break after the point where tex breaks the page, starting the text to go on the top of the page with .. blank line ... wrapfig ... \noindent first word at top of page. – David Carlisle Dec 4 '15 at 13:46
  • Okay, this might work, but it seems like quite a static process. And how can I justify the line just before the fake paragraph break? – Simon Streicher Dec 4 '15 at 13:50
  • 1
    sorry {\parfillskip=0pt\par} is the usual trick to force the paragraph to end full width. It is less than ideal but tex's page and line breaking are disconnected: the previous paragraph is already broken into lines of full width before the page break is decided, so there is no way to re-wrap that part of the paragraph to a shorter line width. This has been a "well known" deficiency in tex since some time last century, but it is what it is.... – David Carlisle Dec 4 '15 at 13:55
  • Wow, so it seems like wrapfigure doesn't want to insert a figure before a enumerated list. And, lucky me, this is exactly how my page start. I ended up reshaping my previous figure to push one line onto the next page, and then used the {\parfillskip=0pt\par} ...blank line... \wrapfigure... \noindent on the overflown line. – Simon Streicher Dec 4 '15 at 14:48
1

You can set the paragraph at the page break with an hangafter. But as the suggestion in the comments it is rather manual and so you should do it only at the last moment. (I had to adjust the height of the image a bit. It was too large).

\documentclass{article}
\usepackage{wrapfig}
\usepackage{lipsum,tikz}
\usepackage{mwe}

\begin{document}
\lipsum[1] \lipsum[7-8] \lipsum[1]

\hangindent=\dimexpr0.25\textwidth+\columnsep\relax
\hangafter= 5 \lipsum*[1]

\begin{wrapfigure}{L}{0.25\textwidth}%[h!]%[t!]
 \centering
        \raisebox{0pt}[\dimexpr\height-10\baselineskip]{%
        \includegraphics[width=0.23\textwidth, height=0.9\textheight]{example-image}}
       \caption{foobar}
\end{wrapfigure}
\lipsum[2-18]
\end{document}

enter image description here

  • I am slightly confused by hangindent and hangafter and ended up doing something else. Thanks though. – Simon Streicher Dec 4 '15 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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