I'd like to have this code.
Code: Select all
\definecolor{darkgray}{rgb}{0.97,0.97,0.97}
\lstset{backgroundcolor=\color{darkgray},
columns=fullflexible,
basicstyle=\ttfamily\footnotesize,
numbers=left,
numberstyle=\tiny,
stepnumber=2,
numbersep=5pt}
\begin{lstlisting}[frame=tb]
var capital = Map("US" -> "Washington", "France" -> "Paris")
capital += ("Japan" -> "Tokyo")
\end{lstlisting}
Code: Select all
\begin{mycode}
var capital = Map("US" -> "Washington", "France" -> "Paris")
capital += ("Japan" -> "Tokyo")
\end{mycode}
Code: Select all
\documentclass{article}
\newenvironment{mycode}%
{
\lstset{columns=fullflexible,
basicstyle=\ttfamily\footnotesize,
numbers=left,
numberstyle=\tiny,
stepnumber=2,
numbersep=5pt}
\begin{lstlisting}[frame=tb]
}
{\end{lstlisting}}
\begin{document}
\begin{mycode}
Hello, world.
\end{mycode}
\end{document}
Code: Select all
ERROR: Undefined control sequence.
--- TeX said ---
\mycode -> \lstset
{columns=fullflexible, basicstyle=\ttfamily \footnotesize...
l.16 \begin{mycode}