# Align start of paragraph and images

To give some context, I am working with a fairly big document, that contains some concatenated outputs from chained curl requests to a forum-like webpage, formatted afterwards with a bunch of regular expressions (it is as bad as it sounds). Thing is, the amount of text is so big that going through all paragraphs and modifying them one by one seems like a never-ending task.

With that in mind, the appearance of my output would be something like:

(...)
\begin{wrapfigure}[9]{l}{1in}
\centering
\includegraphics[width=1in]{my_image_1}
\caption*{a caption}
\end{wrapfigure}

This is some text.\par

\begin{wrapfigure}[9]{l}{1in}
\centering
\includegraphics[width=1in]{my_image_2}
\caption*{another caption}
\end{wrapfigure}

This is another text.\par
And this time there are two paragraphs!\par
(...)


That, times infinity.

So, the idea is that the first paragraph for each "block" appears aligned to the picture, that is, both start at the same line. This happens whenever the text is big enough to go over the figure height, but not when it is the other way around (text starts when the previous one ended, but picture needs to go down to avoid clashing with the previous one, so you got something like:

=======|  This is some text.
First  |
Picture|  This is another text.                   <==== This should not go here
=======|
And this time there are two paragraphs!
=======|                                          <==== It should appear here
Second |
Picture|
=======|


Is there a way to achieve this without adding line breaks manually for each of the blocks?

PS: I guess there is a case to be made for tables here. Not really that familiar with Latex yet, but having a two cell table for each "block", with left cell containing the picture and right cell containing the text, and invisible borders, would probably achieve what I want. Problem there would be that large texts would not wrap the image, which is a desired effect...

\usepackage{picinpar} and figwindow fixed the problem... More or less. Wrapfigure was not the best idea

\usepackage{picinpar}
\begin{figwindow}[0,l,\includegraphics[width=1in]{my_image_1},*{A Caption}]
Some text.\par
\end{figwindow}
\begin{figwindow}[0,l,\includegraphics[width=1in]{my_image_2},*{Another Caption}]
Other text.\par
\end{figwindow}

• This does not provide an answer to the question. To critique or request clarification from an author, leave a comment below their post. - From Review Nov 13 '18 at 15:19
• Can you add a short example to your answer how to use \usepackage{picinpar} and figwindow? This would make the answer more helpful for future users with the same problem. Nov 13 '18 at 15:56
• @samcarter Edited to add the example Nov 14 '18 at 18:35
• @Bobyandbob It is not exactly an answer to the question, but is a solution to the problem I had to begin with. I just wanted to share it with the community, but I am ok with it being deleted. Nov 14 '18 at 18:37
• @Kyra_W Great! Thank you for sharing your solution with us! Nov 14 '18 at 20:58

I would recommend the use of geometry or memoir AND marginpar. Here is an example to allow for 1in figures.

\documentclass[11pt,letterpaper]{report}

\usepackage{lipsum}
\usepackage{geometry,graphicx}

\geometry{
hmargin={1in,2in}
}

\newcommand{\putmfig}[1]{%
\marginpar{
\vfill

\includegraphics[width=1in]{#1}
}
}

\begin{document}

\putmfig{my_image_1}
\lipsum[1]

\putmfig{my_image_2}
\lipsum[2]

\end{document}


This does not WRAP content around the figures. I have a sense however that you do not need the text to wrap as compared to fixing the alignment of picture and text.

• Thanks for the answer! I do need the text to wrap, though. It is a tricky one :) Nov 16 '18 at 9:21