Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I am currently using the shaded environment from the framed package for large calculation digressions in my papers.

\usepackage{framed}
\newenvironment{digression}[1]{\begin{shaded} \noindent\textbf{\sc {#1}\\} }{ \end{shaded} } % or snugshade
\definecolor{shadecolor}{gray}{0.9}

Unfortunately, when I try to include a figure within such a digression, I get the error ! LaTeX Error: Float(s) lost.

I'm using tikz right now, but ideally I'd like it to be in a wrapfigure since it's such a small figure..

share|improve this question

1 Answer 1

up vote 3 down vote accepted

Since figures are floating in nature, you can't use them inside a static environment. But the reverse can be done as in:

\documentclass{article}
\usepackage{framed,graphicx,xcolor}

\begin{document}
\definecolor{shadecolor}{gray}{0.9}

\begin{figure}[htb]
\begin{shaded}
  \centering
  \includegraphics[width=.5\textwidth]{example-image-a}
\end{shaded}
\end{figure}
\end{document}

enter image description here

share|improve this answer
    
That is interesting, although I really wanted to be able to use a wrapfigure which I don't think this is very applicable to. But thanks for the response. –  Hanmyo Dec 9 '12 at 6:35
2  
@Hanmyo: If you provide a complete (non)working code starting from \documentclass{..} and ending at \end{document}, chances of getting a solution will improve. –  Harish Kumar Dec 9 '12 at 6:44
    
Thanks, Harish. While trying to make an mwe, I realized that it actually does work. The problem must have been in my code elsewhere.. –  Hanmyo Dec 9 '12 at 7:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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