enhance the pdf data extractor (reported by Gert Ingold)
[PyX/mjg.git] / examples / examples.py
blobf8c4287231ec6a12af5fe5484fbfe7f4bdc89b3f
1 #!/usr/bin/env python
3 import sys; sys.path[:0]=[".."]
4 import os.path
5 import pyx
7 tex = open("examples.tex", "w")
8 tex.write(r"""
9 \documentclass[abstracton,a4paper]{scrreprt}
10 \areaset{17cm}{24cm}
11 \usepackage{pyx,graphicx,scrpage,listings,color}
12 \usepackage[latin1]{inputenc}
13 \lstloadlanguages{Python}
14 \lstset{language=Python,commentstyle={\itshape\lstset{columns=fullflexible}},extendedchars=true}
15 \begin{document}
16 \subject{\texttt{http://pyx.sourceforge.net/}}
17 \title{\PyX{} %s\\Examples}
18 \author{J\"org Lehmann \texttt{<joergl@users.sourceforge.net>}\and
19 Andr\'e Wobst \texttt{<wobsta@users.sourceforge.net>}}
20 \maketitle
21 """ % pyx.__version__)
22 for file in sys.argv[1:]:
23 dir = os.path.dirname(file)
24 tex.write("\\deftripstyle{mypagestyle}{}{%s}{}{}{\\pagemark}{}\n" % file)
25 tex.write("\\pagestyle{mypagestyle}{}\n")
26 tex.write("\\section*{%s}\n" % file)
27 tex.write("\\lstinputlisting{%s.py}\n" % file)
28 tex.write("\\vspace{1cm}\n")
29 tex.write("\\centerline{\\includegraphics{%s}}\n\\clearpage\n" % file)
30 tex.write("\\end{document}\n")