라텍스_알고리즘
1.0.0
문제 1: 알고리즘 캡션에서 알고리즘 번호를 어떻게 제거할 수 있나요?
해결책: begin{algorithm}
뒤에 renewcommand{thealgorithm}{}
추가하세요.
샘플 Latex 파일 알고리듬_caption_no_number.tex 및 해당 PDF 출력을 참조하세요.
documentclass[11pt]{article}
usepackage{algorithmicx}
usepackage{algorithm}
usepackage{algpseudocode}
begin{document}
begin{algorithm}
renewcommand{thealgorithm}{}
caption{Test Algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of a and b}
State $rgets abmod b$
While{$rnot=0$}Comment{We have the answer if r is 0}
State $agets b$
State $bgets r$
State $rgets abmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is b}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}
문제 2: 알고리즘 본문에서 줄 번호를 어떻게 제거할 수 있나요?
해결책:
defNoNumber#1{{defalglinenumber##1{}State #1}addtocounter{ALG@line}{-1}}
NoNumber{}
에 넣습니다. 샘플 Latex 파일 알고리듬_line_no_number.tex 및 해당 PDF 출력을 참조하세요.
documentclass[11pt]{article}
usepackage{algorithmicx}
usepackage{algorithm}
usepackage{algpseudocode}
usepackage{color}
defNoNumber#1{{defalglinenumber##1{}State #1}addtocounter{ALG@line}{-1}}
begin{document}
begin{algorithm}
caption{Test Algorithm}label{euclid}
begin{algorithmic}[1]
Procedure{Euclid}{$a,b$}Comment{The g.c.d. of a and b}
State $rgets abmod b$
While{$rnot=0$}Comment{We have the answer if r is 0}
State $agets b$
State $bgets r$
State $rgets abmod b$
EndWhilelabel{euclidendwhile}
State textbf{return} $b$Comment{The gcd is b}
NoNumber{color{red} This line will not have a number!}
EndProcedure
end{algorithmic}
end{algorithm}
end{document}