What are the advantages of using a pseudocode package (like
algorithm2e) above simply putting code inside of a
In order to make the question less vague, I will say this: Sometimes, inside of a LaTeX document, a person will want to display code. The code to display might be pseudocode, Java, C, C++, Fortran, LaTeX, or be written in some other language. There are various goals. For example, indentation is a key feature of code. We wish to have indents preserved in the final output .pdf.
\verbatim preserves indentation, displays the result in a mono-spaced font, etc... Packages like
algorithm2e (the specific package doesn't matter) can also be used to display code (many kinds of code -- pseudocode, LaTeX code, Java...). The question is, what are the advantages of using a package tool to display your code instead of simply using the
\verbatim command to display your code?
\verbatim might be defined in some LaTeX package, but
\verbatim is comes with LaTeX distributions more often than things like
algorithm2e Often, no import statement is required for for using
\verbatim. Does anything bad happen while using
\verbatim which won't happen when using a tool like