Graphics, Figures & TablesWrapfig within minipage environment: an unwanted effect

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
sergioro
Posts: 2
Joined: Wed Feb 13, 2013 1:03 am

Wrapfig within minipage environment: an unwanted effect

Post by sergioro »

Hello all,

The package wrapfig is used within the minipage environment as a workaround to wrap text around a figure in the enumerate environment.

Unfortunately, for some strange reason the text formatting in this case do not spam the full width of the page after the first enumerated text. Only half of the page is filled with text (see the attached pdf generate via the the source of the minimal example also attached).

I would appreciate any help to fix this.

Thanks in advance,

Sergio
Attachments
minimal.pdf
(66.46 KiB) Downloaded 562 times
minimal.tex
(2.93 KiB) Downloaded 440 times

Recommended reading 2024:

LaTeXguide.org • LaTeX-Cookbook.net • TikZ.org

NEW: TikZ book now 40% off at Amazon.com for a short time.

And: Currently, Packt sells ebooks for $4.99 each if you buy 5 of their over 1000 ebooks. If you choose only a single one, $9.99. How about combining 3 LaTeX books with Python, gnuplot, mathplotlib, Matlab, ChatGPT or other AI books? Epub and PDF. Bundle (3 books, add more for higher discount): https://packt.link/MDH5p

svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Wrapfig within minipage environment: an unwanted effect

Post by svend_tveskaeg »

Your example is far from minimal. After a quick look at your code, I can get the same output with the following:

Code: Select all

\documentclass{memoir}

\usepackage{wrapfig}

\newcommand*{\testA}{text text text text text }
\newcommand*{\testB}{This text does spam the full page. }
\newcommand*{\testC}{
This text does not spam the full page.
This text does not spam the full page.
This text does not spam the full page.
This text does not spam the full page.}

\begin{document}

\begin{enumerate}
\item 
\begin{minipage}[t]{\linewidth}
\vskip-.9\ht\strutbox
\begin{wrapfigure}{r}{0.4\textwidth}
\begin{framed}
[\testA \testA \testA \testA \testA \testA \testA \testA]
\end{framed}
\hrulefill
\end{wrapfigure}

\setlength{\intextsep}{4pt}

Here it is shown an unwanted effect when using the package \textsf{wrapfig} 
within a \textsf{minipage} environment, and I am looking for some help to fix it.

The package \textsf{wrapfig} is used within the \textsf{minipage} environment 
as a workaround to wrap text around a figure in the \textsf{enumerate} environment.

Unfortunately, for some strange reason the text formatting in this case 
do not spam the full width of the page after the first enumerated text.
Only half of the page is filled with text (see the attached pdf generate
via the the source of the minimal example also attached).

\begin{enumerate}
\item
\testB \testB \testB \testB \testB \testB \testB \testB \testB \testB \testB
\item
\testC
\item
\testC
\end{enumerate}

\end{minipage}
\testC \testC
\end{enumerate}

\end{document}
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
sergioro
Posts: 2
Joined: Wed Feb 13, 2013 1:03 am

Re: Wrapfig within minipage environment: an unwanted effect

Post by sergioro »

I am not sure what's your definition of minimal[*], but
in this case I can see that wrapfig requires the figure no to take space from the first itemize section. This is not a nice feature but one can live with that.

Sergio
[*] For me all the relevant packages should be included
in the minimal to rule out the possibility the reported behaviour is because of conflicting interest among packages or the order they are called. Apparently neither is the case here.
User avatar
svend_tveskaeg
Posts: 478
Joined: Sun Jul 12, 2009 5:31 am

Wrapfig within minipage environment: an unwanted effect

Post by svend_tveskaeg »

sergioro wrote:For me all the relevant packages should be included in the minimal to rule out the possibility the reported behaviour is because of conflicting interest among packages or the order they are called.
All the relevant packages are included if you build a Infominimal working example.
``In the game of chess, you can never let your adversary see your pieces.''
-- Zapp Brannigan, Futurama (season 1, episode 4)
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Wrapfig within minipage environment: an unwanted effect

Post by localghost »

Depending on the circumstances, lists like {enumerate} are always problematic with wrapfig (see its manual).


Remarks:
  • You should use the features of memoir to set up the page geometry.

Thorsten
Post Reply