Paragraph indentation incorrect with picinpar package

I am using the picinpar package and don't know why the paragraph indentation is not working. The problem words are highlighted:

Notes:

• I am not stuck to using the picinpar package, but want to avoid having to specify the width of the figure at the point it is inserted. The example provided uses \includegraphics to keep the MWE simpler, but my figures are tikz figures so I use \input instead of \includegraphicsin my real use case. I tried the other solutions at the references question, and foundpicinpar` the easiest to use.
• I thought perhaps the problem was that \parskip and \parindent were being rest within the window environment as in Why is \parskip zero inside a minipage?, but that solution (commented out) had no effect.
• This work fine if the parskip pacakge is used, but I am trying to have the recommended indented paragraphs.

Code:

\documentclass{article}
%\usepackage{parskip}% Works great with this.
\usepackage[demo]{graphicx}
\usepackage{picinpar}
\usepackage{showframe}
\usepackage{lipsum}
\usepackage{xcolor}% To highlight problem text

\newlength{\currentparskip}
\newlength{\currentparindent}
\newcommand{\MyWrapFig}[3][]{%
% #1 = options: number of lines, align
% #2= figure content
% #3= text content
%
%\setlength{\currentparskip}{\parskip}% save the value
%\setlength{\currentparindent}{\parindent}% save the value
%
\begin{window}[#1, #2,]
%\setlength{\parskip}{\currentparskip}% restore the value
%\setlength{\parindent}{\currentparindent}% restore the value
#3%
\end{window}
}%

\newcommand{\SomeMoreText}{Some text. Some more text.}%
\newcommand{\Text}{%
\SomeMoreText   \SomeMoreText   \SomeMoreText
\SomeMoreText   \SomeMoreText   \SomeMoreText
}%

\begin{document}
\section{First Section}
\MyWrapFig[1,r]{%
\includegraphics[height=1cm]{MyFigure}
}{%
\textcolor{red}{Here} is a paragraph that should \emph{not} be indented without parskip.
\SomeMoreText

\textcolor{red}{This} is the second paragraph which \emph{should} be indented without parskip.
\SomeMoreText \SomeMoreText \SomeMoreText

\textcolor{red}{Last} paragraph that \emph{should} also be indented without parskip.
\Text
}

\MyWrapFig[1,r]{%
\includegraphics[width=3cm]{MyFigure}
}{%
Here is a paragraph that should be indented without parskip.
\SomeMoreText

\textcolor{red}{This} is the second paragraph which \emph{should} be indented without parskip.
\SomeMoreText

\textcolor{red}{Last} paragraph that \emph{should} also be indented without parskip.
\Text
}
\end{document}
• picinpar is a latex 2.09 package; it's remarkable that it works at all, broken results or not. note that the catalogue entry for it says “Users should note that Piet van Oostrum (in a published review of packages of this sort) does not recommend this package; picins is recommended instead.” – wasteofspace Jun 17 '13 at 11:04
• @wasteofspace Do you want to write up an answer here? – Johannes_B Dec 18 '14 at 9:35
• @Johannes_B picins is also a 2.09 package, isn't it? (And the licence prevents distribution so it is not in TL.) – cfr Jul 5 '15 at 1:52

This is not a complete solution but perhaps it is helpful. What it does achieve:

• paragraphs which should be indented are indented automatically;
• you do not need to specify the width of the inserted thing.

What it does not achieve:

• the first paragraph following a sectional division must be marked with \noindent if it is to be wrapped around an inserted thing;

There was a problem with some words overspilling, creating overfull boxes. Thanks to Peter Grill's comment for noting that the power of microtype solves this.

With the addition of \noindent, I get this output automatically:

Code:

\documentclass{article}
\usepackage[demo]{graphicx}
\usepackage{showframe}
\usepackage{lipsum}
\usepackage{xcolor}% To highlight problem text
\newcommand{\SomeMoreText}{Some text. Some more text.}%
\newcommand{\Text}{%
\SomeMoreText   \SomeMoreText   \SomeMoreText
\SomeMoreText   \SomeMoreText   \SomeMoreText
}
\usepackage{microtype}
\input{insbox}

\begin{document}
\section{First Section}
\InsertBoxR{1}{\includegraphics[height=1cm]{MyFigure}}
\noindent\textcolor{red}{Here} is a paragraph that should \emph{not} be indented without parskip.
\SomeMoreText

\textcolor{red}{This} is the second paragraph which \emph{should} be indented without parskip.
\SomeMoreText \SomeMoreText \SomeMoreText

\textcolor{red}{Last} paragraph that \emph{should} also be indented without parskip.
\Text

\InsertBoxR{1}{\includegraphics[width=3cm]{MyFigure}}
Here is a paragraph that should be indented without parskip.
\SomeMoreText

\textcolor{red}{This} is the second paragraph which \emph{should} be indented without parskip.
\SomeMoreText

\textcolor{red}{Last} paragraph that \emph{should} also be indented without parskip.
\Text

\end{document}
• dammit! All the pictures have disappeared again even ones which displayed fine a second ago. – cfr Jul 5 '15 at 2:06
• insbox looks promising. – Peter Grill Jul 5 '15 at 18:25
• @PeterGrill Do you have any idea how to solve the problem with the 'should'? I mean, other than by hand. – cfr Jul 5 '15 at 19:30
• If you referring to the indentation of the first para, I don't know how to automate that. – Peter Grill Jul 5 '15 at 20:42
• @PeterGrill I meant more the fact that the emphasised 'should' isn't pushed to the next line. – cfr Jul 5 '15 at 21:44