How do I insert code into a LaTeX document? Is there something like:
\begin{code}## Heading ##
...
\end{code}
The only thing that I really need is indentation and a fixed width font. Syntax highlighting could be nice although it is definitely not required.
Use
listingspackage.Simple configuration for LaTeX header (before
\begin{document}):You can change default language in the middle of document with
\lstset{language=Java}.Example of usage in the document:
Here’s the result: