
En un informe KOMA-Script, quiero usar un flotante personalizado para algoritmos y mostrar un algorithmic
entorno con un título justo al lado en lugar de debajo. Aparte del hecho de que tengo que envolver el archivo algorithmic
en a parbox
para evitar errores del compilador, captionbeside
tiene 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}
¿Cuál es la diferencia entre flotadores incorporados y float
flotadores? ¿Cómo puedo obtener el figure
resultado 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 \DeclareNewTOC
y sus opciones se explican enscrguien.pdfsección 13.5.
Respuesta2
El float
paquete parece introducir ligeras incompatibilidades con muchos otros paquetes y clases. Su ejemplo funciona según lo previsto con elnewfloat
paquete.
\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}