4

Is \usepackage{wrapfig} compatible with \usepackage{chemescheme}?

I'm using chemescheme to number my compounds, but need to wrap the text around some schemes.

Suggestions?

e.g. (but this doesn't work):

\subsection{Compound Name (\compound{XXX})}

\begin{wrapfigure}{L}[\sind]{.2\textwidth}
   \begin{scheme}[h]
      \schemeref{KAB35} 
      \includegraphics[scale=0.7]{XXX.eps}
   \end{scheme}
\end{wrapfigure}    
6

It is not possible to use a floating environment like scheme inside a wrapfigure. However, the wrapfig package provides the means to extend the wrapping features to other floats: The wrapfloat environment which has a first (mandatory) argument the name of the corresponding float:

\begin{wrapfloat}{<float>}{...}{...}
  ...
\end{wrapfloat}

Both wrapfigure and wraptable are defined through this generic environment.

This means you can simply use

\begin{wrapfloat}{scheme}{...}{...}
  ...
\end{wrapfloat}

in your document.

If you plan to use this more than once it might be worth considering to define an own environment for this,wrapscheme say:

\newenvironment{wrapscheme}{\wrapfloat{scheme}}{\endwrapfloat}

This can then be used the same way as wrapfigure:

\begin{wrapscheme}{...}{...}
  ...
\end{wrapscheme}

A full example containing both variants:

\documentclass{article}
\usepackage{chemscheme}
\usepackage{wrapfig}

% for dummy text:
\usepackage{lipsum}

\newenvironment{wrapscheme}{\wrapfloat{scheme}}{\endwrapfloat}

\begin{document}

\section{Section Title}

\begin{wrapfloat}{scheme}[11]{L}{4cm}
  \rule{4cm}{3cm}
  \caption{foo bar baz}
\end{wrapfloat}
\lipsum[1-2]

\begin{wrapscheme}[11]{L}{4cm}
  \rule{4cm}{3cm}
  \caption{foo bar baz}
\end{wrapscheme}
\lipsum[1-2]

\end{document}

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.