
패키지 에 algorithmic
와 유사한 명령이 있습니까 ? (각각 중첩되는 것을 원하지 않습니다.\ElsIf
algorithmicx
만약에 들여쓰기됨).
답변1
예, 있습니다: \ELSIF
. 이것은 다음 중 하나입니다.첫 번째에서 가져온 예algorithms
묶음 선적 서류 비치(부분3.2if-then-else성명, 3페이지):
\documentclass{article}
\usepackage{algorithmic}
\begin{document}
\begin{algorithmic}
\IF{some condition is true}
\STATE do some processing
\ELSIF{some other condition is true}
\STATE do some different processing
\ELSIF{some even more bizarre condition is met}
\STATE do something else
\ELSE
\STATE do the default actions
\ENDIF
\end{algorithmic}
\end{document}
당신이 사용하는 경우algorithmicx
를 사용해야 합니다 \ElsIf
. 다음은 다음을 사용하여 위의 의사 코드를 미러링한 것입니다 algpseudocode
.
\documentclass{article}
\usepackage{algpseudocode,algorithm}
\begin{document}
\begin{algorithmic}
\If{some condition is true}
\State do some processing
\ElsIf{some other condition is true}
\State do some different processing
\ElsIf{some even more bizarre condition is met}
\State do something else
\Else
\State do the default actions
\EndIf
\end{algorithmic}
\end{document}