I have a large document with lots of pseudocode in LaTeX. My question
is: what is the easiest way for me to get decent-looking code?
The fewer of these I need to do, the easier I consider it: (i)
numbering lines by hand, (ii) escaping characters like "|" (pipe), ">"
(greater than) or "%" (percent), and (iii) putting "//" at the end of
each line
The pseudocode must have the following features:
- numbered lines (must be able to start from an arbitrary number so I
can split the code into several figures)
- proportional font
- indentation
- I must be able to use my own commands to change the formatting of
specific words, something like this: \method{openGizmo()}
- I must be able to change the font size and line spacing
Finally, it would be really nice if when I refer to line numbers later
in the text, these number adjust if I add or remove lines in the
pseudocode (in the same way that \ref{introduction} will change to
"Section 2" if the introduction gets moved to section 2).
I have tried the tabbing environment. It's not very nice because I
have to end each line by hand, I have to escape lots of characters,
and (worst of all) I have to number lines by hand.
I have also tried the listings package (with the lstlisting command)
but I can't find a way to get my text in a proportional font, not do I
see an easy mechanism to keep my code indented neatly once I can get a
proportional font. |