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