
В отчете KOMA-Script я хочу использовать пользовательский float для алгоритмов и отображать -environment algorithmic
с подписью прямо рядом с ним, а не ниже. Помимо того, что мне приходится обертывать в algorithmic
a parbox
, чтобы избежать ошибок компилятора, captionbeside
есть проблема с float
-float:
\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}
В чем разница между встроенными float и float
float? Как мне получить figure
результат -like для всего?
решение1
СКОМА-Скриптнет необходимости в дополнительном пакете для определения новых плавающих сред, поскольку у него есть свой собственный механизм:
\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}
Команда \DeclareNewTOC
и ее параметры описаны вscrguien.pdfраздел 13.5.
решение2
Пакет float
, похоже, вносит небольшие несовместимости с множеством других пакетов и классов. Ваш пример работает так, как и предполагалось сnewfloat
упаковка.
\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}