`oframed`環境でのアルゴリズム
Sep 21 2020
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{framed}
\setlength\FrameSep{5mm}
\begin{document}
\begin{oframed} Some text...
\begin{center}
\begin{algorithm}
\DontPrintSemicolon
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
\Input{The input to the algorithm}
\Output{The output of the algorithm}
\BlankLine
\caption{This is what the algorithm does}
\end{algorithm}
\end{center}
Some other text...
\end{oframed}
\end{document}
フレームを維持したまま、「未定義の制御シーケンス」エラーを削除する方法はありますか(アルゴリズムは他のテキストを含む大きなボックスの一部であるため、ボックスを削除したくありません)?
回答
1 MadyYuvi Sep 21 2020 at 13:34
algorithm一種であるfloatとfloat常に問題の内部を持つ\vboxとminipage、あなたがパッケージを使用する必要がありますfloatし、オプションを使用[H]して変更することMWEです:
\documentclass{book}
\usepackage{float}
\usepackage[ruled,vlined]{algorithm2e}
\usepackage{framed}
\setlength\FrameSep{5mm}
\begin{document}
\begin{oframed} Some text...
\begin{center}
\begin{algorithm}[H]
\DontPrintSemicolon
\SetKwInOut{Input}{Input}\SetKwInOut{Output}{Output}
\Input{$12$ numbered coins, $11$ of which have same weight}
\Output{Number of the fake coin}
\BlankLine
\caption{Finding the fake coin in $3$ measurements}
\end{algorithm}
\end{center}
Some other text...
\end{oframed}
\end{document}