Skip to content

Instantly share code, notes, and snippets.

@CaptSolo
Created June 6, 2009 23:54
Show Gist options
  • Save CaptSolo/125060 to your computer and use it in GitHub Desktop.
Save CaptSolo/125060 to your computer and use it in GitHub Desktop.
\documentclass{article}
% compile this file using:
% pdflatex --shell-escape py-latex.tex
\usepackage{python}
\usepackage{url}
\begin{document}
\title{
Testing Embedding of Python in \LaTeX
}
\author{Uldis Boj\=ars}
\maketitle
\section{Intro}
This is a test of the python.sty package which allows to embed Python code inside a \LaTeX document.
Get it at: \url{http://www.imada.sdu.dk/~ehmsen/pythonlatex.php}
\section{Example}
Executing code:
\begin{verbatim}
for i in range(0,10):
print "hahaha", i
print
\end{verbatim}
Result:
\begin{python}
for i in range(0,10):
print "hahaha", i
print
\end{python}
Note: the code is replaced with its output and is intepreted as \LaTeX instructions.
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment