LaTeX/Source Code Listings - Wikibooks, open books for an open world - latex listing environment

How can I define a custom listing environment? - TeX - LaTeX Stack Exchange latex listing environment

\begin{verbatim} Text enclosed inside \texttt{verbatim} environment is printed directly and all \LaTeX{} commands are.

LaTeX logo.svg. LaTeX If you just want to write code within your document the package provides the lstlisting environment: Latex Pascal Listing.png.

Abstract. The listings package is a source code printer for LATEX. You can typeset stand alone files as well as listings with an environment similar to verbatim.

You cannot create a new lstlisting environment via \newenvironment. You need to use \lstnewenvironment. See the listings documentation, section 5.14.

[Code listings in LaTeX]There may be times when you want to include text need to worry about special characters, such as #, within the verbatim environment.