Подпись KOMA-Script сбоку и пользовательские поплавки

Подпись KOMA-Script сбоку и пользовательские поплавки

В отчете KOMA-Script я хочу использовать пользовательский float для алгоритмов и отображать -environment algorithmicс подписью прямо рядом с ним, а не ниже. Помимо того, что мне приходится обертывать в algorithmica 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 и floatfloat? Как мне получить 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}

введите описание изображения здесь

Связанный контент