% Created 2009-08-08 Sat 12:46
\documentclass[11pt]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{graphicx}
\usepackage{longtable}
\usepackage{hyperref}
\usepackage{color}
\usepackage{listings}

\title{experimenting with the listings package}
\author{Eric Schulte}
\date{08 August 2009}

\begin{document}

\maketitle


\lstset{basicstyle=\ttfamily\bfseries\footnotesize}
\lstset{keywordstyle=\color{blue},
  commentstyle=\color{red},
  stringstyle=\color{green}
}
\lstset{numbers=left,
  numberstyle=\ttfamily\footnotesize,
  stepnumber=1,
  numbersep=10pt,
  backgroundcolor=\color{white},
}


\section*{listings in org}
\label{sec-1}


The following can be used to begin using the listings package to
export fontified source code blocks to \LaTeX{}.


\lstset{language=lisp}
\begin{lstlisting}
;; tell org to use listings
(setq org-export-latex-listings t)

;; you must include the listings package
(add-to-list 'org-export-latex-packages-alist '("" "listings"))

;; if you want colored source code then you need to include the color package
(add-to-list 'org-export-latex-packages-alist '("" "color"))
\end{lstlisting}



Here is a simple ruby example.


\lstset{language=ruby}
\begin{lstlisting}
class Example
# this is just a simple example
def says
puts :with_listings
end
end
\end{lstlisting}



Note that the indentation is removed in the above example even when
the normal \texttt{verbatim} environment is used.

\subsection*{subheading}
\label{sec-1.1}

another type of code in the same file


\lstset{language=lisp}
\begin{lstlisting}
(mapcar (lambda (el) (* el el)) '(1 2 3 4))
\end{lstlisting}



\end{document}