
Em um relatório KOMA-Script, quero usar um float personalizado para algoritmos e exibir um algorithmic
-environment com uma legenda ao lado dele, em vez de abaixo. Tirando o fato de ter que agrupar o algorithmic
em a parbox
para evitar erros do compilador, captionbeside
tem um problema com 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}
Qual é a diferença entre carros alegóricos integrados e float
carros alegóricos? Como posso obter o figure
resultado semelhante para tudo?
Responder1
ComKOMA-Scriptnão há necessidade de um pacote adicional para definir novos ambientes flutuantes, pois possui mecanismo próprio:
\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}
O comando \DeclareNewTOC
e suas opções são explicados emscrguien.pdfseção 13.5.
Responder2
O float
pacote parece introduzir pequenas incompatibilidades com muitos outros pacotes e classes. Seu exemplo funciona como pretendido com onewfloat
pacote.
\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}