Managing Python code with UTF-8 (french chars) in org-mode + babel + minted for LaTeX export

The goal of this article is to illustrate how to manage Python code which includes comments in UTF-8 characters inside a latin-1 source org-mode for LaTeX export.

Note that I’ve pasted in wordpress the HTML generated by org-mode, so I hope it isn’t broken too much.

My typical use case is a french lecture on Python where the text is written in french, as well as some of the code comments and examples

We’ll use org-mode’s babel module to include and manage the Python
examples. The goal is to write the source of the Python programs
directly in the same org source as the class book’s text, and to extract them into a subdir (with the “tangle” feature), so that they can be shipped to the students to experiment with.

The minted LaTeX environment is used, for babel, to make the Python syntax highlighting.

Continue reading “Managing Python code with UTF-8 (french chars) in org-mode + babel + minted for LaTeX export”