
コロンとテキストの間のこの大きなスペースを、入力:? また、テキストの配置を削除する方法を教えてください入力:そして前提条件:? を使用していますalgorithm2e
。このパッケージで可能ですか? これが私のコードです:
\documentclass{article}
\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{amsmath}
\usepackage{setspace}
\begin{document}
\begin{algorithm}
\SetAlgorithmName{Algorithm}{}{}
\SetKwInOut{Precondition}{Precondition~}
\SetKwInOut{Input}{Input~}
\Input{~There is some fancy input definition.}
\Precondition {~There is some fancy precondition.}
\begin{doublespace}
\eIf{$b=0$}
{
return $a$
}
{
$b$
}
\end{doublespace}
\caption{Best algorithm ever.}
\end{algorithm}
\end{document}
これは実際の州:
これは望んだ最終状態:
答え1
ご覧のとおり、スペースを調整するだけで機能するSetKwInput
ため、最初の条件に使用できます。SetKwInOut
ここに例を挙げる
\documentclass{article}
\usepackage[linesnumbered,ruled]{algorithm2e}
\usepackage{amsmath}
\usepackage{setspace}
\begin{document}
\begin{algorithm}
\SetAlgorithmName{Algorithm}{}{}
\SetKwInput{Precondition}{Precondition~}
\SetKwInput{Input}{Input~}
\Input{~There is some fancy input definition.}
\Precondition {~There is some fancy precondition.}
\begin{doublespace}
\eIf{$b=0$}
{
return $a$
}
{
$b$
}
\end{doublespace}
\caption{Best algorithm ever.}
\end{algorithm}
\end{document}
結果: