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 would like to mark (e.g. with a *) a line in a pseudo-code typeset with the algorithmic package. I would like the label to appear on the left margin, instead of the line number. Is that possible?

I would like to have something like this:

  a = 5
  b = 7
* if a < b then
  end if
share|improve this question

Use a \marginpar.

\reversemarginpar % left hand
\STATE foo\marginpar{\hfill*}
\STATE bar

In two-sided document, you must test if the page number is odd using \ifoddpage from changepage, and choose \reversemarginpar or \normalmarginpar.

share|improve this answer

Your Answer


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