Python inside LaTeX :

SymPy image

I found an interesting page today, Embedding Python in LaTeX with the only following note :

"With this style file for LaTeX it is possible to write Python code inside a LaTeX document. It can be extremely useful for generating figures and similar things."

And in fact, Martin was really right! I started to play with his python.sty package, the results where somewhat promising, even if I had hard times figuring out how to work with accented chars [I found a trick, but I don't like it very much]. My first sample was writing squares of integers ranging from 0 to 9.

After some tries, I was wondering if I could play with python.sty together with SymPy. Why ? Because I'm working as a maths teacher and have sometimes the need to build exercises with responses quickly.

Here's the final output, note that all those calculus are done thanks to SymPy:

pylatex

You'll find here the final document translated to PDF and a zip file containing all the material to build it.

I'll appreciate any comment.

Comments
Back to index
blog comments powered by Disqus

Atom feeds