August 2017

# Latex; How to remove the algorithm number in algorithm captions?

25 08 17 • 22:08& Filed in: Latex

How one can remove the algorithm number in the algorithm caption?

Solution: just add

Solution:

Define a new command:

and put the text in \NoNumber{}

Sample Latex Code

Solution: just add

`\renewcommand{\thealgorithm}{}`

after `\begin {algorithm}`

*How one can remove the line number in the algorithm body?*

Solution:

Define a new command:

`\def\NoNumber#1{{\def\alglinenumber##1{}\State #1}\addtocounter{ALG@line}{-1}}`

and put the text in \NoNumber{}

Sample Latex Code

`\documentclass[11pt]{article}`

`\usepackage{algorithmicx}`

`\usepackage{algorithm}`

`\usepackage{algpseudocode}`

`\def\NoNumber#1{{\def\alglinenumber##1{}\State #1}\addtocounter{ALG@line}{-1}}`

`\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 $r\gets a\bmod b$`

` \While{$r\not=0$}\Comment{We have the answer if r is 0}`

` \State $a\gets b$`

` \State $b\gets r$`

` \State $r\gets a\bmod b$`

` \EndWhile\label{euclidendwhile}`

` \State \textbf{return} $b$\Comment{The gcd is b}`

` \NoNumber{This line will not have a number!}`

` \EndProcedure`

`\end{algorithmic}`

`\end{algorithm}`

`\end{document}`