Graphics, Figures & TablesIssue with image floats

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
badinsults
Posts: 3
Joined: Wed Dec 29, 2010 12:34 pm

Issue with image floats

Post by badinsults »

Hi there, I am trying to get text to float around an image, and something is not working correctly. If I try something like this:

Code: Select all

\documentclass[10pt,twoside,a4paper]{article}

\usepackage{graphicx}
\usepackage{wrapfig}


\begin{document}

\begin{wrapfigure}{r}{3cm}
  \centering
    \includegraphics[width=3cm]{images/EGM.jpg}
\end{wrapfigure}

\subsection*{Electronic Gaming Monthly}

Electronic Gaming Monthly (EGM) is another granddaddy of video game magazines.  Starting in 1988, this magazine
provided more in-depth news and analysis than competitor, Gamepro.  This contrast led it to become the choice
for older gamers.  In general, reviews were done by three or four editors with one paragraph each, while a 
more in-depth overview of the game was given near the end.  After a few rocky years where EGM eventually stopped
publication, it resumed in 2010.
Electronic Gaming Monthly (EGM) is another granddaddy of video game magazines.  Starting in 1988, this magazine
provided more in-depth news and analysis than competitor, Gamepro.  This contrast led it to become the choice
for older gamers.  In general, reviews were done by three or four editors with one paragraph each, while a 
more in-depth overview of the game was given near the end.  After a few rocky years where EGM eventually stopped
publication, it resumed in 2010.


\end{document}
The text correctly wraps below the image. However, if I want to make a paragraph break like this:

Code: Select all

\documentclass[10pt,twoside,a4paper]{article}

\usepackage{graphicx}
\usepackage{wrapfig}


\begin{document}

\begin{wrapfigure}{r}{3cm}
  \centering
    \includegraphics[width=3cm]{images/EGM.jpg}
\end{wrapfigure}

\subsection*{Electronic Gaming Monthly}

Electronic Gaming Monthly (EGM) is another granddaddy of video game magazines.  Starting in 1988, this magazine
provided more in-depth news and analysis than competitor, Gamepro.  This contrast led it to become the choice
for older gamers.  In general, reviews were done by three or four editors with one paragraph each, while a 
more in-depth overview of the game was given near the end.  After a few rocky years where EGM eventually stopped
publication, it resumed in 2010.

Electronic Gaming Monthly (EGM) is another granddaddy of video game magazines.  Starting in 1988, this magazine
provided more in-depth news and analysis than competitor, Gamepro.  This contrast led it to become the choice
for older gamers.  In general, reviews were done by three or four editors with one paragraph each, while a 
more in-depth overview of the game was given near the end.  After a few rocky years where EGM eventually stopped
publication, it resumed in 2010.


\end{document}
The wrap not only fails, but any paragraph below the image does not correctly extend to the right margin of the page (as though the image block continues downwards forever). The issue goes away if the paragraph after the image float is long enough to get below the image, but there is no guarantee in my document that this is what will happen. Any hints?

Recommended reading 2024:

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

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

frabjous
Posts: 2064
Joined: Fri Mar 06, 2009 12:20 am

Issue with image floats

Post by frabjous »

As near as I can tell the problem seems to have more to do with the \subsection* command than with anything else. If you replicate look of that without using that command, everything seems to be OK:

Code: Select all

\documentclass[10pt,twoside,a4paper]{article}

\usepackage{graphicx}
\usepackage{wrapfig}

\begin{document}

\begin{wrapfigure}[4]{r}{3cm}
\includegraphics[width=3cm]{images/EGM.jpg}
\end{wrapfigure}


\noindent \textbf{\large Electronic Gaming Monthly}


\medskip\noindent Electronic Gaming Monthly (EGM) is another granddaddy of video game magazines.  Starting in 1988, this magazine
provided more in-depth news and analysis than competitor, Gamepro.  This contrast led it to become the choice
for older gamers.  In general, reviews were done by three or four editors with one paragraph each, while a
more in-depth overview of the game was given near the end.  After a few rocky years where EGM eventually stopped
publication, it resumed in 2010.

Electronic Gaming Monthly (EGM) is another granddaddy of video game magazines.  Starting in 1988, this magazine
provided more in-depth news and analysis than competitor, Gamepro.  This contrast led it to become the choice
for older gamers.  In general, reviews were done by three or four editors with one paragraph each, while a
more in-depth overview of the game was given near the end.  After a few rocky years where EGM eventually stopped
publication, it resumed in 2010.

\end{document}
That's not a great solution, I admit, but I'm not sure what other options there are. The wrapfig package does suggest only wrapping plain text around the image, not section titles, but I'm not sure what alternatives you may have.

Fiddling around with titlesec and changing how subsection titles work generally might help, though it might lead to other problems.
badinsults
Posts: 3
Joined: Wed Dec 29, 2010 12:34 pm

Re: Issue with image floats

Post by badinsults »

What a pain. I put the image below the section headers, but because all my section paragraphs are smaller than the height of the image, it is causing the layout to go all screwy. I ended up having to decrease the size of the image to prevent this. Not really the solution I was hoping for. I'm guessing the floats started to conflict with each other (I was going right-left-right).
User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Issue with image floats

Post by localghost »

If the problem is solved in some way, please be so kind and mark the topic (not the last post) accordingly as clearly written in the Board Rules (to be read before posting). Otherwise please tell us what is missing. Please keep that in mind for the future so that further reminders will not be necessary.


Best regards and welcome to the Board
Thorsten
Post Reply