KOMA スクリプトのキャプションとカスタムフロート

KOMA スクリプトのキャプションとカスタムフロート

KOMA スクリプト レポートで、アルゴリズムにカスタム float を使用し、下ではなくそのすぐ横にキャプション付きの -environment を表示したいと考えています。コンパイラ エラーを回避するためにを でalgorithmic囲む必要があるという事実とは別に、-floatには問題があります。algorithmicparboxcaptionbesidefloat

\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

KOMAスクリプト独自のメカニズムがあるため、新しいフローティング環境を定義するために追加のパッケージは必要ありません。

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

ここに画像の説明を入力してください

関連情報