\documentclass[a4paper]{article} % generated by Docutils \usepackage{fixltx2e} % LaTeX patches, \textsubscript \usepackage{cmap} % fix search and cut-and-paste in Acrobat \usepackage{ifthen} \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \setcounter{secnumdepth}{0} %%% Custom LaTeX preamble % suppress the (LaTeX-added) References section heading \AtBeginDocument{\renewcommand{\refname}{\vspace{-1em}}} \newlength{\DUlineblockindent} \setlength{\DUlineblockindent}{1em} %%% User specified packages and stylesheets \usepackage{../data/pygments-docutilsroles} %%% Fallback definitions for Docutils-specific commands % inline markup (custom roles) % \DUrole{#1}{#2} tries \DUrole#1{#2} \providecommand*{\DUrole}[2]{% \ifcsname DUrole#1\endcsname% \csname DUrole#1\endcsname{#2}% \else% backwards compatibility: try \docutilsrole#1{#2} \ifcsname docutilsrole#1\endcsname% \csname docutilsrole#1\endcsname{#2}% \else% #2% \fi% \fi% } % hyperlinks: \ifthenelse{\isundefined{\hypersetup}}{ \usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue,citecolor=black]{hyperref} \urlstyle{same} % normal text font (alternatives: tt, rm, sf) }{} %%% Body \begin{document} This is a test of the new ``code'' directive: % Translate this document to HTML with a pygments enhanced frontend, e.g. % % ../rst2html-highlight --stylesheet=../data/pygments-default.css % % ../rst2latex-highlight --stylesheet=../data/pygments-docutilsroles.sty % \begin{quote}{\ttfamily \raggedright \noindent \DUrole{ln}{~7~}\DUrole{k}{def}~\DUrole{nf}{my\_function}\DUrole{p}{():}~\\ \DUrole{ln}{~8~}~~~~\DUrole{sd}{"{}"{}"Test~the~lexer.\\ }\DUrole{ln}{~9~}\DUrole{sd}{~\\ }\DUrole{ln}{10~}\DUrole{sd}{~~~~just~a~test"{}"{}"}~\\ \DUrole{ln}{11~}~\\ \DUrole{ln}{12~}~~~~\DUrole{c}{\#~and~now~for~something~completely~different}~\\ \DUrole{ln}{13~}~~~~\DUrole{k}{print}~\DUrole{mi}{8}\DUrole{o}{/}\DUrole{mi}{2} } \end{quote} The end. \end{document}