Algoritma_lateks
1.0.0
MASALAH 1: Bagaimana cara menghilangkan nomor algoritma pada caption suatu algoritma?
SOLUSI: Tambahkan renewcommand{thealgorithm}{}
setelah begin{algorithm}
Lihat contoh file Lateks algoritma_caption_no_number.tex dan keluaran PDF-nya
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}
MASALAH 2: Bagaimana cara menghilangkan nomor baris di badan algoritma?
LARUTAN:
defNoNumber#1{{defalglinenumber##1{}State #1}addtocounter{ALG@line}{-1}}
NoNumber{}
Lihat contoh file Lateks algoritma_line_no_number.tex dan keluaran PDF-nya
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}