Graphics, Figures & TablesWrapfigures beneath section headings

Information and discussion about graphics, figures & tables in LaTeX documents.
Post Reply
jtyler
Posts: 3
Joined: Thu Apr 21, 2011 6:36 pm

Wrapfigures beneath section headings

Post by jtyler »

I had a few problems with non-floating wrapfigures placed directly beneath section headings (yes, I kind of need it like this, I'm writing the experimental section of a chemistry thesis, and each procedure has the compound structure drawn at the top, text wrapping around it) -- namely that when one happens close to the bottom of the page, the package seems incapable of figuring out when it is out of space, and the image invariably hangs over the bottom of the first page, nonetheless creating pointless whitespace around which the text wraps on the second page.

As a partial solution I changed to floating figures (which are not really ideal for what I want), but now I have difficulty with LaTeX breaking pages between the section heading and the wrapfigure/text that ensues. I'd much rather a bad pagebreak than this... does anyone have a simple solution? I tried needspace and it works, but its very ad hoc since when I tried to preface every section heading with needspace{1in} (intending that needspace could just be a substitute for wrapfigures lack of space intuition) I learned that when the break isn't actually inserted, needspace inserts whitespace! Looking at the documentation there doesn't seem to be a way to stop this. I assume it happens because needspace doesn't contemplate a section heading being the following line? Not sure. In any event it's not a general solution, just one that if desperate I could use the day before I submit my thesis, for example, to fix all the bad breaks visible on that compile...

Any help would be greatly appreciated.

Recommended reading 2024:

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

Learn LaTeX easily with newest books:

The LaTeX Beginner's Guide: 2nd edition and perfect for students writing a thesis

The LaTeX Cookbook: 2nd edition full of practical examples for mathematics, physics, chemistry, and more

LaTeX Graphics with TikZ: the first book about TikZ for perfect drawings in your LaTeX thesis

User avatar
localghost
Site Moderator
Posts: 9202
Joined: Fri Feb 02, 2007 12:06 pm

Wrapfigures beneath section headings

Post by localghost »

Present your recent efforts by a minimal example that shows the problem clearly.


Best regards and welcome to the board
Thorsten
jtyler
Posts: 3
Joined: Thu Apr 21, 2011 6:36 pm

Wrapfigures beneath section headings

Post by jtyler »

When the figure is allowed to float:

Code: Select all

\documentclass{book}

\usepackage{color,graphicx}
\usepackage{float}
\usepackage{wrapfig}

\title{Thesis}
\author{}

\begin{document}

\chapter{Experimental}

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff.

\subsection{Toluenesulfonic acid 2-azidoethyl ester}

\begin{wrapfigure}{L}{0.18\textwidth}
    \includegraphics[scale=0.65]{img.eps}
\end{wrapfigure}

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.  In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

\subsection{Toluenesulfonic acid 2-azidoethyl ester}

\begin{wrapfigure}{L}{0.18\textwidth}
    \includegraphics[scale=0.65]{img.eps}
\end{wrapfigure}

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.  In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

\end{document}
When the figure is not allowed to float:

Code: Select all

\documentclass{book}

\usepackage{color,graphicx}
\usepackage{float}
\usepackage{wrapfig}

\title{Thesis}
\author{}

\begin{document}

\chapter{Experimental}

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

\subsection{Toluenesulfonic acid 2-azidoethyl ester}

\begin{wrapfigure}{l}{0.18\textwidth}
    \includegraphics[scale=0.65]{img.eps}
\end{wrapfigure}

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.  In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

\subsection{Toluenesulfonic acid 2-azidoethyl ester}

\begin{wrapfigure}{L}{0.18\textwidth}
    \includegraphics[scale=0.65]{img.eps}
\end{wrapfigure}

In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.  In our previous papers, we reported the palladium-catalyzed cross-coupling reaction of stuff. The compounds are readily accessible by hydroboration of alkenes and alkynes, the stereochemistry of 1-alkenyl groups both on boron and halides are completely retained in the products, many functional groups including ester, ketone, and aldehyde are tolerated, and high turnovers of the palladium catalysts are observed.

\end{document}
Have stripped it down as much as possible. With a float: whenever there isn't enough space to place the float on the page it seems to shift itself (because the next paragraph on the next page is usually a different compound, so it overlaps with the image there). When non-floating: hangs over the end of the page and creates pointless white space on the next page.

I've had several private messages from people having the same problem so any help would be greatly appreciated.
Attachments
img.eps
(14.6 KiB) Downloaded 345 times
User avatar
Stefan Kottwitz
Site Admin
Posts: 10348
Joined: Mon Mar 10, 2008 9:44 pm

Wrapfigures beneath section headings

Post by Stefan Kottwitz »

Hi jtyler,

welcome to the board!

If you post a question to several boards or forums (crossposting), please always mention that with a link, to prevent double work such as if people still try to help and it's already been solved in another forum.

Here's that topic with an answer: Wrapfigures beneath section headings misbehave.

Stefan
LaTeX.org admin
jtyler
Posts: 3
Joined: Thu Apr 21, 2011 6:36 pm

Re: Wrapfigures beneath section headings

Post by jtyler »

Sorry, yeah, that's also my post. Quick response too. It doesn't really get to the root of the problem though...
Post Reply