TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question
up vote 7 down vote accepted

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


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

Sample output




  \eIf {\( x>y \)}{greater}{less than or equal}


  \eIf {\( x>y \)}{greater}{less than or equal}

share|improve this answer
thats exactly the representation i was looking for - thank you for the clear answer! – bobb_the_builder Feb 27 '13 at 11:28

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.