7

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)

1 Answer 1

7

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

\documentclass{article}
\usepackage{algorithm2e}
\begin{document}
\SetAlgoLined
\begin{procedure}
\Switch{the value of T}{
  \uCase{a value}{
    do this\;
    do that\;
  }
  \lCase{another value}{one line}\;
  \Case{last value}{
    do this\;
    break\;
  }
  \Other{
    for the other values\;
    do that\;
  }
}
\end{procedure}
\end{document}
9
  • @Yiannis: Did you read the question? It clearly says "What I want is to draw a vertical line along the indentation." Commented Jan 14, 2011 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?
    – yannisl
    Commented Jan 14, 2011 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. Commented Jan 14, 2011 at 14:47
  • 1
    @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. Commented Jan 14, 2011 at 16:13
  • 1
    Thanks, Yiannis. One point for users with older installations: In previous versions of algorithms2e it was \SetLine, not \SetAlgoLined. Commented Jan 14, 2011 at 17:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .