I'm trying to typeset Python programs with LaTeX and the Minted package. I'm under Ubuntu 15.10, with TeXlive installed from Ubuntu standard repositories. The python-pygment package is at version 2.0.1+dfsg-1. Compiling the code below :
\documentclass[11pt,a4paper]{article}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{minted}
% \setminted{encoding=utf-8}
\begin{document}
On importe toute la librairie Tkinter (attention, cette écriture ne fonctionne qu'en Python 3)
\begin{minted}{python}
from tkinter import *
# Creation de la fenetre de base de l'application
f=Tk()
# On lui donne un nom
f.title("Découverte de Tkinter")
\end{minted}
\end{document}
ends up with the following error :
! Package inputenc Error: Unicode char \u8:�co not set up for use with LaTeX.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.7 ...dq{}D�couverte de Tkinter\PYZdq{}}\PY{p}{)}
If I change the « é » in the string into a simple « e », it compiles silently. I've read somewhere it could be useful to set the encoding or outencoding parameter, but I get another error :
(./Python-Tkinter.w18)))/usr/bin/pygmentize
! Undefined control sequence.
<recently read> \setminted
l.7 \setminted
{encoding=utf-8}
?
I checked the /usr/share/texlive/texmf-dist/tex/latex/minted/minted.sty file (which is at version 2015/01/31 v2.0) :
user@machine:/usr/share/texlive/texmf-dist/tex/latex/minted# cat minted.sty | grep -E 'encoding|setminted'
\ifx\encodingdefault\upquote@OTone
\minted@def@optcl{encoding}{-P encoding}{#1}
\minted@def@optcl{outencoding}{-P outencoding}{#1}
\newcommand{\minted@encoding}{\minted@get@opt{encoding}{UTF8}}
%Need a version of open() that supports encoding under Python 2
f = open(\"}#1\detokenize{\", \"r\", encoding=\"}\minted@encoding\detokenize{\");
f = open(\"}\minted@outputdir\jobname.pyg\detokenize{\", \"w\", encoding=\"}\minted@encoding\detokenize{\");
%Need a version of open() that supports encoding under Python 2
f = open(\"}#1\detokenize{\", \"r\", encoding=\"}\minted@encoding\detokenize{\");
f = open(\"}\minted@outputdir\jobname.pyg\detokenize{\", \"w\", encoding=\"}\minted@encoding\detokenize{\");
\newcommand{\setminted}[2][]{%
\newcommand{\setmintedinline}[2][]{%
\setmintedinline[php]{startinline=true}
\newcommand{\usemintedstyle}[2][]{\setminted[#1]{style=#2}}
\setminted{style=default}%
Following an advice, here is the output from command line compilation with the \listfiles command :
*File List*
article.cls 2014/09/29 v1.4h Standard LaTeX document class
size11.clo 2014/09/29 v1.4h Standard LaTeX file (size option)
inputenc.sty 2015/03/17 v1.2c Input encoding file
utf8.def 2014/09/29 v1.1m UTF-8 support for inputenc
t1enc.dfu 2014/09/29 v1.1m UTF-8 support for inputenc
ot1enc.dfu 2014/09/29 v1.1m UTF-8 support for inputenc
omsenc.dfu 2014/09/29 v1.1m UTF-8 support for inputenc
fontenc.sty
t1enc.def 2005/09/27 v1.99g Standard LaTeX file
babel.sty 2014/09/25 3.9l The Babel package
frenchb.ldf 2015/06/26 v3.1g French support from the babel system
scalefnt.sty
keyval.sty 2014/10/28 v1.15 key=value parser (DPC)
minted.sty 2011/09/17 v1.7 Yet another Pygments shim for LaTeX
fancyvrb.sty 2008/02/07
xcolor.sty 2007/01/21 v2.11 LaTeX color extensions (UK)
color.cfg 2007/01/18 v1.5 color configuration of teTeX/TeXLive
pdftex.def 2011/05/27 v0.06d Graphics/color for pdfTeX
infwarerr.sty 2010/04/08 v1.3 Providing info/warning/error messages (HO)
ltxcmds.sty 2011/11/09 v1.22 LaTeX kernel commands for general use (HO)
float.sty 2001/11/08 v1.3d Float enhancements (AL)
ifthen.sty 2014/09/29 v1.1c Standard LaTeX ifthen package (DPC)
calc.sty 2014/10/28 v4.3 Infix arithmetic (KKT,FJ)
ifplatform.sty 2010/10/22 v0.4 Testing for the operating system
pdftexcmds.sty 2011/11/29 v0.20 Utility functions of pdfTeX for LuaTeX (HO)
ifluatex.sty 2010/03/01 v1.3 Provides the ifluatex switch (HO)
ifpdf.sty 2011/01/30 v2.3 Provides the ifpdf switch (HO)
catchfile.sty 2011/03/01 v1.6 Catch the contents of a file (HO)
etexcmds.sty 2011/02/16 v1.5 Avoid name clashes with e-TeX commands (HO)
testMinted.w18
supp-pdf.mkii
testMinted.pyg
testMinted.out.pyg
t1cmtt.fd 2014/09/29 v2.5h Standard LaTeX font definitions
***********
So everything seems OK. I'm stuck. It would be great if someone had an idea. Thanks.
é
at all.