title: automatically adjust the size of a minipage
body: <p>I'm trying to get a way to automatically adjust the size of a minipage.</p>
  
  <p>I am creating a report which will have several "paragraphs" that have a floating image on the left and some text on the right of that image and eventually below it if there is enough text. The both of them ( image + text ) make together a "semantic block".</p>
  
  <p>First I did that :</p>
  
  <pre><code>\begin{wrapfigure}{L}{0.15\textwidth}
      \centering
      \includegraphics[width=0.1\textwidth]{image}\\
      \emph{image caption with no "figure1"}
  \end{wrapfigure}
  Text related to this image\\
  Text related to this image\\
  Text not related to this image\\
  </code></pre>
  
  <p>and of course the text not related to the image was considered like the other lines of text, printing on the right of the image.</p>
  
  <p>So i tried to wrap it all :</p>
  
  <pre><code>\begin{minipage}[c][10cm]{20cm}
  \begin{wrapfigure}{L}{0.15\textwidth}
      \centering
      \includegraphics[width=0.1\textwidth]{image}\\
      \emph{image caption with no "figure1"}
  \end{wrapfigure}
  Text related to this image\\
  Text related to this image\\
  \end{minipage}
  Text not related to this image\\
  </code></pre>
  
  <p>but it really isn't convenient and the height is fixed.</p>
  
  <p>If there is a better way to do it not using minipage that would be great too.
  In the end i plan to make it into a \newenvironment taking 2 parameters : image name and text so I can use it easily in the article.</p>
  
  <p>EDIT: fixed a typo in 2nd code</p>