summaryrefslogtreecommitdiff
path: root/sandbox/code-block-directive/docs/myfunction.py.tex
blob: 6d5ddd5ddfc1ff806cd391be67e530f65c403820 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
\documentclass[10pt,a4paper,english]{scrartcl}
\usepackage{babel}
\usepackage[T1]{fontenc}
\usepackage{shortvrb}
\usepackage{ucs}
\usepackage[utf8x]{inputenc}
\usepackage{tabularx}
\usepackage{longtable}
\usepackage{booktabs}
\setlength{\extrarowheight}{2pt}
\usepackage{amsmath}
\usepackage{graphicx}
\usepackage{color}
\usepackage{multirow}
\usepackage{ifthen}
\typearea{12}
% generated by Docutils <http://docutils.sourceforge.net/>
\newlength{\admonitionwidth}
\setlength{\admonitionwidth}{0.9\textwidth}
\newlength{\docinfowidth}
\setlength{\docinfowidth}{0.9\textwidth}
\newlength{\locallinewidth}
\newcommand{\optionlistlabel}[1]{\bf #1 \hfill}
\newenvironment{optionlist}[1]
{\begin{list}{}
  {\setlength{\labelwidth}{#1}
   \setlength{\rightmargin}{1cm}
   \setlength{\leftmargin}{\rightmargin}
   \addtolength{\leftmargin}{\labelwidth}
   \addtolength{\leftmargin}{\labelsep}
   \renewcommand{\makelabel}{\optionlistlabel}}
}{\end{list}}
\newlength{\lineblockindentation}
\setlength{\lineblockindentation}{2.5em}
\newenvironment{lineblock}[1]
{\begin{list}{}
  {\setlength{\partopsep}{\parskip}
   \addtolength{\partopsep}{\baselineskip}
   \topsep0pt\itemsep0.15\baselineskip\parsep0pt
   \leftmargin#1}
 \raggedright}
{\end{list}}
% begin: floats for footnotes tweaking.
\setlength{\floatsep}{0.5em}
\setlength{\textfloatsep}{\fill}
\addtolength{\textfloatsep}{3em}
\renewcommand{\textfraction}{0.5}
\renewcommand{\topfraction}{0.5}
\renewcommand{\bottomfraction}{0.5}
\setcounter{totalnumber}{50}
\setcounter{topnumber}{50}
\setcounter{bottomnumber}{50}
% end floats for footnotes
% some commands, that could be overwritten in the style file.
\newcommand{\rubric}[1]{\subsection*{~\hfill {\it #1} \hfill ~}}
\newcommand{\titlereference}[1]{\textsl{#1}}
% end of "some commands"
% user specified packages and stylesheets:
\usepackage{../data/pygments-docutilsroles}
\ifthenelse{\isundefined{\hypersetup}}{
\usepackage[colorlinks=true,linkcolor=blue,urlcolor=blue]{hyperref}
}{}
% Custom roles: 
% \DUrole{NAME}{content} calls \docutilsroleNAME if it exists
\providecommand{\DUrole}[2]{%
  \ifcsname docutilsrole#1\endcsname%
    \csname docutilsrole#1\endcsname{#2}%
  \else%
    #2%
  \fi%
}
\title{}
\author{}
\date{}
\raggedbottom
\begin{document}

\setlength{\locallinewidth}{\linewidth}

This is a test of the new code-block directive:
% Translate this document to HTML with a pygments enhanced frontend, e.g.
% 
% rst2html-highlight --stylesheet=../data/pygments-default.css --link-stylesheet
% 
% rst2latex-highlight --stylesheet=../data/pygments-docutileroles.sty 
\begin{quote}{\ttfamily \raggedright \noindent
\DUrole{k}{def}~\DUrole{nf}{my{\_}function}\DUrole{p}{():}~\\
~~~~\DUrole{s}{"just~a~test"}~\\
~~~~\DUrole{k}{print}~\DUrole{mf}{8}\DUrole{o}{/}\DUrole{mf}{2}~\\

}\end{quote}

\end{document}