[BangPypers] Python syntax highligting in Latex beamer

Puneeth Chaganti punchagan at gmail.com
Fri Jan 29 17:42:11 CET 2010


Hi

On Fri, Jan 29, 2010 at 9:50 PM, Noufal Ibrahim <noufal at gmail.com> wrote:
> On Fri, Jan 29, 2010 at 9:19 PM, JAGANADH G <jaganadhg at gmail.com> wrote:
>> Dear All
>>
>> Can somebody give me a clear example how to highlight Python code in latex
>> beamer.
>> I used listings but no result .

Something like this should work.

Put something like this in the preamble
\usepackage{color}
\usepackage{listings}
\lstset{language=Python,
    basicstyle=\ttfamily\bfseries,
    commentstyle=\color{red}\itshape,
  stringstyle=\color{darkgreen},
  showstringspaces=false,
  keywordstyle=\color{blue}\bfseries}

Use the following to display code.
\begin{lstlisting}
>>> print "Hello, World!"
\end{lstlisting}

Look at listings' manual for more info.

--
~punchagan


More information about the BangPypers mailing list