Título de KOMA-Script al lado y flotadores personalizados

Título de KOMA-Script al lado y flotadores personalizados

En un informe KOMA-Script, quiero usar un flotante personalizado para algoritmos y mostrar un algorithmicentorno con un título justo al lado en lugar de debajo. Aparte del hecho de que tengo que envolver el archivo algorithmicen a parboxpara evitar errores del compilador, captionbesidetiene un problema con 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}

producción

¿Cuál es la diferencia entre flotadores incorporados y floatflotadores? ¿Cómo puedo obtener el figureresultado similar para todo?

Respuesta1

ConKOMA-ScriptNo es necesario un paquete adicional para definir nuevos entornos flotantes ya que tiene su propio mecanismo:

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

El comando \DeclareNewTOCy sus opciones se explican enscrguien.pdfsección 13.5.

Respuesta2

El floatpaquete parece introducir ligeras incompatibilidades con muchos otros paquetes y clases. Su ejemplo funciona según lo previsto con elnewfloatpaquete.

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

ingrese la descripción de la imagen aquí

información relacionada