# KOMA-Script captionbeside and custom floats

In a KOMA-Script report, I want to use a custom float for algorithms and display an algorithmic-environment with a caption right next to it instead of below. Apart from the fact that I have to wrap the algorithmic in a parbox to avoid compiler errors, captionbeside has a problem with float-floats:

\documentclass{scrreprt}
\usepackage{float}
\floatstyle{plain}
\newfloat{myfigure}{t}{myfigure}
\begin{document}
% Works as expected: Left & Right on same line.
\begin{figure}
\begin{captionbeside}{Right}Left\end{captionbeside}
\end{figure}
% Doesn't work: Left on one line, Right below
\begin{myfigure}
\begin{captionbeside}{Right}Left\end{captionbeside}
\end{myfigure}
\end{document}


What's the difference between built-in floats and float floats? How can I get the figure-like result for everything?

-

With KOMA-Script there's no need for an additional package in order to define new floating environments as it has its own mechanism:

\documentclass{scrreprt}

\DeclareNewTOC[
type=myfigure,
types=myfigures,
float,
floatpos=t,
name=My Figure,
listname={List of my Figures},
counterwithin=chapter
]{lomf}

\begin{document}

\chapter{foo}

\begin{figure}[h]% positioning parameter just for the example
\begin{captionbeside}{Right}Left\end{captionbeside}
\end{figure}

\begin{myfigure}[h]% positioning parameter just for the example
\begin{captionbeside}{Right}Left\end{captionbeside}
\end{myfigure}

\end{document}


The command \DeclareNewTOC and its options are explained in scrguien.pdf section 13.5.

-
ah, that's even better, thanks –  pascal Apr 2 '13 at 21:28

The float package seems to introduce slight incompatibilities with lots of other packages and classes. Your example works as intended with the newfloat package.

\documentclass{scrreprt}

\usepackage{newfloat}
\DeclareFloatingEnvironment[placement=t]{myfigure}

\begin{document}

\chapter{foo}

\begin{figure}[h]% positioning parameter just for the example
\begin{captionbeside}{Right}Left\end{captionbeside}
\end{figure}

\begin{myfigure}[h]% positioning parameter just for the example
\begin{captionbeside}{Right}Left\end{captionbeside}
\end{myfigure}

\end{document}


-
Additional note: KOMA-Script package scrhack. –  Speravir Apr 2 '13 at 14:59