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

How can I visualize code indentation? What I want is to draw a vertical line along the indentation. Since an example is easier to show then to explain you can see one in this paper (on page 2)

share|improve this question
up vote 7 down vote accepted

Use the "algorithm2e" package a short example is shown below:

\Switch{the value of T}{
  \uCase{a value}{
    do this\;
    do that\;
  \lCase{another value}{one line}\;
  \Case{last value}{
    do this\;
    for the other values\;
    do that\;
share|improve this answer
@Yiannis: Did you read the question? It clearly says "What I want is to draw a vertical line along the indentation." – Hendrik Vogt Jan 14 '11 at 12:52
@Hendrik I read the part ..."you can see one in this paper (on page 2)", that clearly shows code that was typeset with alogorithm2e. How did you understand it? – Yiannis Lazarides Jan 14 '11 at 14:25
@Yiannis: On page 2, I see that there are vertical lines along the indentation. And the OP asks how to reproduce that. – Hendrik Vogt Jan 14 '11 at 14:47
@Hendrik The only thing missing from Yiannis's answer is the line \SetAlgoVlined (or \SetAlgoLined depending on the style you want.) – Alan Munn Jan 14 '11 at 16:07
@Alan: Well, then that's the essential thing missing. From how I read the question, this was the only thing the OP wanted to know. But: Thanks for the info; maybe you want to post a separate answer, or Yiannis edits his answer. – Hendrik Vogt Jan 14 '11 at 16:13

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.