# Algorithm2e modify line numbers

I'm using the LaTeX algorithm2e package by defining

\usepackage[ruled, linesnumbered, vlined]{algorithm2e}


The linesnumbered argument adds lines numbers from [1,...,n] if we have an algorithm with n lines. I would like to know if there's any possibility to change the numbers in something like: [1*,...,n*] (adding a symbol like a * or a ' behind the number). Note I have several algorithms in my document, thus I want to define the above described "different line number style" in a local \begin{algorithm} ... \end{algorithm} scope. I am thankful for all help and information.

-
Welcome to TeX.sx!. A tip: You can use backticks  to mark your inline code as I did in my edit. –  texenthusiast Feb 27 '13 at 10:54
@lockstep: looks much better, thank you for the hint! –  bobb_the_builder Feb 27 '13 at 11:26

Use the command \SetNlSty to change the style of the numbering. It takes three argumnts, the first is the font to use, the second the text to appear before the number and the third the text to appear after. Thus

\SetNlSty{textbf}{}{*}


will place * after the line numbers, all bold face (which is the default font).

\documentclass{article}

\usepackage[ruled,linesnumbered,vlined]{algorithm2e}

\begin{document}

\begin{algorithm}
\eIf {$$x>y$$}{greater}{less than or equal}
\end{algorithm}

\SetNlSty{textbf}{}{*}

\begin{algorithm}
\eIf {$$x>y$$}{greater}{less than or equal}
\end{algorithm}

\end{document}
`
-
thats exactly the representation i was looking for - thank you for the clear answer! –  bobb_the_builder Feb 27 '13 at 11:28