1

I'm trying to use floatflt (or one of the other packages that gives floating figures in the margin) with amsthm, and ran in to the issue that the AMS theorem-like environments are defined using trivlist, which causes problems with all of the floating-figure environments that I'm aware of. This issue is mentioned several places on the web, but never with a solution that I could find. In particular, I don't know how one would use \fltitem in this context. Switching from amsthm is not an option. Has anyone figured out how to do this?

Here's a sample attempt that doesn't work: if I uncomment the commented text, I get a LaTeX error.

\documentclass{amsart}

\usepackage{floatflt}
\usepackage{lipsum}
\usepackage{color}
\theoremstyle{definition}
\newtheorem{definition}{Definition}

\begin{document}
\begin{floatingfigure}[r]{4cm}
{\color{red} Lorem ipusm dolor sit amet, consectetuer adipscing elit.}
\end{floatingfigure}
\lipsum[1]
\begin{definition}
% \begin{floatingfigure}[r]{3cm}
% {\color{blue} Lorem ipusm dolor sit amet, consectetuer adipscing elit.}
% \end{floatingfigure}
  \lipsum[2]
\end{definition}
\lipsum[3]
\end{document}
1
  • I don't think it has to do with amsthm because also the default theorem environments are built with trivlist.
    – egreg
    Oct 28 '15 at 22:04
1

Actually, your figure doesn't have to float, since you want it inside a theorem-like environment.

I propose a solution based on the insbox set of generic macros. I define an \InsertBoxDef, to be used just after \begin{definition}, which accepts a mandatory argument, whatever has to be inserted, and an optional argument, the number of supplementary lines that have to be right indented, in case the number of indented lines is wrongly calculated.

The macro can be easily adapted to other theorem-like structure. Demo:

\documentclass{amsart}

\usepackage{floatflt}
\usepackage{lipsum}
\usepackage{xcolor}
\theoremstyle{definition}
\newtheorem{definition}{Definition}
\input{insbox}
\usepackage{graphicx}

\newcommand\InsertBoxDef[2][]{\mbox{}\vskip-\baselineskip\InsertBoxR{0}{\hskip0.6em#2}[#1]\noindent\mbox{\hphantom{\bfseries Definition 1.\hskip0.04em}}}

\begin{document}
\begin{floatingfigure}[r]{4cm}
  {\color{red} Lorem ipusm dolor sit amet, consectetuer adipscing elit.}
\end{floatingfigure}
\lipsum[11]

\begin{definition}%
  \InsertBoxDef{\includegraphics[scale=0.4]{loupnorstein1}}
  Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes,
  nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum diam eros,
  fringilla et, consectetuer eu, nonummy id, sapien. Nullam at lectus. In sagittis
  ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce blandit. Aliquam
  erat volutpat. Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec
  dolor.
\end{definition}

\begin{definition}%
  \InsertBoxDef{\parbox{3.5cm}{\color{blue} Lorem ipusm dolor sit amet, consectetuer adipscing elit.}}
  Sed feugiat. Cum sociis natoque penatibus et magnis dis parturient montes,
  nascetur ridiculus mus. Ut pellentesque augue sed urna. Vestibulum diam eros,
  fringilla et, consectetuer eu, nonummy id, sapien. Nullam at lectus. In sagittis
  ultrices mauris. Curabitur malesuada erat sit amet massa. Fusce blandit. Aliquam
  erat volutpat. Aliquam euismod. Aenean vel lectus. Nunc imperdiet justo nec
  dolor.
\end{definition}

\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.