# Custom environment in wrapfigure

I which to have a wrapped figure in a custom float environment: the caption should be on top and carry the name "Infographic". Unfortunately I don't know how to do this.

This is what I came up with

\documentclass{article}

\usepackage{float}
\usepackage{wrapfig}

\floatstyle{plain}
\newfloat{infographic}{H}{info}
\floatname{infographic}{Infographic}

\begin{document}

\begin{wrapfigure}{r}{.4\textwidth}
\begin{infographic}
\centering
\includegraphics[width=.4\textwidth]{test}
\end{infographic}
\end{wrapfigure}

\end{document}


but the newfloat completely messes up the wrapfigure.

• Remember wrapfig is an explicit figure environment. It is not a place you put other floats. You'll probably have better luck removing the infographic env and use \captionof  from the caption package to explicitly set the caption type to something different that figure – daleif Oct 12 '18 at 8:55

Wrapfig is an explicit figure-like environment. In order to get a caption of another type, use \captionof{type}{caption text} from the caption package.

\documentclass{article}

\usepackage{float}
\usepackage{wrapfig}
\usepackage{kantlipsum} % sample tekst
\usepackage{caption}
\floatstyle{plain}
\newfloat{infographic}{H}{info}
\floatname{infographic}{Infographic}

\begin{document}

\kant*[1]
\begin{wrapfigure}{r}{.4\textwidth}
\centering
\rule{4cm}{4cm}
\captionof{infographic}{Test}
\end{wrapfigure}
\kant*[2]

\end{document}