Preparing teaching materials

G

grkuntzmd

I am considering teaching a beginning programming course using Python.
I would like to prepare my class handouts in such a way that I can
import the Python code from real ".py" files directly into the
documents. This way I can run real unit tests on the code to confirm
that they work as expected.

I am considering using LaTeX to write the handouts and then converting
them to PDF files. I will probably use a Makefile to convert the LaTeX
with embedded Python code into the PDF files using pdflatex.

I will probably organize my directory structure into sub-directories
py-src, py-test, doc-src, and doc-dist.

I will be starting out using Windows Vista/cygwin and hopefully switch
to a Macbook this summer.

Any thoughts?
 
M

Michele Simionato

I am considering teaching a beginning programming course using Python.
I would like to prepare my class handouts in such a way that I can
import the Python code from real ".py" files directly into the
documents. This way I can run real unit tests on the code to confirm
that they work as expected.

I am considering using LaTeX to write the handouts and then converting
them to PDF files. I will probably use a Makefile to convert the LaTeX
with embedded Python code into the PDF files using pdflatex.

I will probably organize my directory structure into sub-directories
py-src, py-test, doc-src, and doc-dist.

I will be starting out using Windows Vista/cygwin and hopefully switch
to a Macbook this summer.

Any thoughts?

One word: Sphinx.
 
M

Michele Simionato

And the second word(s):

..  literalinclude:: example.py

TJG

The interesting thing is that Sphinx uses pygments
and can highlight any code fragment, not only Python
code. For instance, last week I did some experiment
with Sphinx to convert my "Adventures of a Pythonista
in Schemeland" (which contains Scheme code) to PDF
and it worked out quite well. I have yet to fix the
images, but the result after a next-to-zero effort is
the following:

http://www.phyast.pitt.edu/~micheles/scheme/TheAdventuresofaPythonistainSchemeland.pdf

(I think the OP may be interested in how the PDF output of
Sphinx-generated documents may look like).


Michele Simionato
 
T

Tim Golden

Michele said:
The interesting thing is that Sphinx uses pygments
and can highlight any code fragment, not only Python
code. For instance, last week I did some experiment
with Sphinx to convert my "Adventures of a Pythonista
in Schemeland" (which contains Scheme code) to PDF
and it worked out quite well. I have yet to fix the
images, but the result after a next-to-zero effort is
the following:

http://www.phyast.pitt.edu/~micheles/scheme/TheAdventuresofaPythonistainSchemeland.pdf

(I think the OP may be interested in how the PDF output of
Sphinx-generated documents may look like).

That looks really snappy. Do you have the HTML output to compare?

TJG
 
T

Terry Reedy

Michele said:
The interesting thing is that Sphinx uses pygments
and can highlight any code fragment, not only Python
code. For instance, last week I did some experiment
with Sphinx to convert my "Adventures of a Pythonista
in Schemeland" (which contains Scheme code) to PDF
and it worked out quite well. I have yet to fix the
images, but the result after a next-to-zero effort is
the following:

http://www.phyast.pitt.edu/~micheles/scheme/TheAdventuresofaPythonistainSchemeland.pdf

Nice.
However...any decent spell checker (or any editor with one built in)
would notice things like 'dinamic', 'tecniques', and 'parenthesi' ;-).
 
A

André

I am considering teaching a beginning programming course using Python.
I would like to prepare my class handouts in such a way that I can
import the Python code from real ".py" files directly into the
documents. This way I can run real unit tests on the code to confirm
that they work as expected.

I am considering using LaTeX to write the handouts and then converting
them to PDF files. I will probably use a Makefile to convert the LaTeX
with embedded Python code into the PDF files using pdflatex.

I will probably organize my directory structure into sub-directories
py-src, py-test, doc-src, and doc-dist.

I will be starting out using Windows Vista/cygwin and hopefully switch
to a Macbook this summer.

Any thoughts?

If I may suggest a very different alternative than the ones already
suggested: use Crunchy. (http://code.google.com/p/crunchy)

You can have you handouts (html or reStructuredText documents) live on
the web with all your code samples executable from within Firefox.

If you don't want to install Crunchy, but want to see it in action,
you can check these older videos:
http://showmedo.com/videos/video?name=1430000;fromSeriesID=143
http://showmedo.com/videos/video?name=1430020;fromSeriesID=143

André
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,221
Latest member
TrinidadKa

Latest Threads

Top