Ok, je mettrai désormais le code latex entre les balises correspondantes et je ne mettrai plus mon texte en gras.
Si je ne déclare pas \lsset je ne peux afficher aucun des caractères accentués et, de plus, j'ai un message d'erreur que je n'arrive pas à exploiter. Il me semblait que cette déclaration permettait justement de traiter ce problème de caractères accentués: c'est ce que j'ai cru avoir compris des recherches à ce sujet sur le web. Voici mon code sans la déclaration \lsset (qui ne fonctionne pas si j'utilise des lettres accentuées et qui fonctionne sinon)
Code : Tout sélectionner
\documentclass[a4paper,11pt]{article}
\usepackage[french]{babel}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{xcolor}
\usepackage{listings}
\lstdefinestyle{python}{
language=Python,
basicstyle = \ttfamily,
keywordstyle = \color{magenta},
keywordstyle = [2]\color{orange},
commentstyle = \color{gray}\itshape,
stringstyle = \color{cyan},
numbers = left,
frame = single,
framesep = 2pt,
aboveskip = 1ex
}
\begin{document}
\begin{minipage}{0.5\textwidth}
\begin{lstlisting}[style=python]
é
\end{lstlisting}
\end{minipage}
\end{document}
Voici mon message d'erreur.
Code : Tout sélectionner
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (TeX Live 2019/Debian) (preloaded format=pdflatex 2021.9.11) 22 DEC 2021 11:42
entering extended mode
\write18 enabled.
Source specials enabled.
%&-line parsing enabled.
**essai.tex
(./essai.tex
LaTeX2e <2020-02-02> patch level 2
L3 programming layer <2020-02-14>
(/usr/share/texlive/texmf-dist/tex/latex/base/article.cls
Document Class: article 2019/12/20 v1.4l Standard LaTeX document class
(/usr/share/texlive/texmf-dist/tex/latex/base/size11.clo
File: size11.clo 2019/12/20 v1.4l Standard LaTeX file (size option)
)
\c@part=\count167
\c@section=\count168
\c@subsection=\count169
\c@subsubsection=\count170
\c@paragraph=\count171
\c@subparagraph=\count172
\c@figure=\count173
\c@table=\count174
\abovecaptionskip=\skip47
\belowcaptionskip=\skip48
\bibindent=\dimen134
)
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.sty
Package: babel 2020/02/14 3.40 The Babel package
(/usr/share/texlive/texmf-dist/tex/generic/babel/switch.def
File: switch.def 2020/02/14 3.40 Babel switching mechanism
)
(/usr/share/texlive/texmf-dist/tex/generic/babel-french/french.ldf
Language: french 2020/01/30 v3.5g French support from the babel system
(/usr/share/texlive/texmf-dist/tex/generic/babel/babel.def
File: babel.def 2020/02/14 3.40 Babel common definitions
\babel@savecnt=\count175
\U@D=\dimen135
(/usr/share/texlive/texmf-dist/tex/generic/babel/txtbabel.def)
\bbl@readstream=\read2
\bbl@dirlevel=\count176
)
Package babel Info: \l@acadian = using hyphenrules for french
(babel) (\language82) on input line 91.
Package babel Info: \l@canadien = using hyphenrules for french
(babel) (\language82) on input line 92.
\FB@nonchar=\count177
Package babel Info: Making : an active character on input line 419.
Package babel Info: Making ; an active character on input line 420.
Package babel Info: Making ! an active character on input line 421.
Package babel Info: Making ? an active character on input line 422.
\FBguill@level=\count178
\FBold@everypar=\toks14
\FB@Mht=\dimen136
\mc@charclass=\count179
\mc@charfam=\count180
\mc@charslot=\count181
\std@mcc=\count182
\dec@mcc=\count183
\c@FBcaption@count=\count184
\listindentFB=\dimen137
\descindentFB=\dimen138
\labelindentFB=\dimen139
\labelwidthFB=\dimen140
\leftmarginFB=\dimen141
\parindentFFN=\dimen142
\FBfnindent=\dimen143
))
(/usr/share/texlive/texmf-dist/tex/latex/carlisle/scalefnt.sty)
(/usr/share/texlive/texmf-dist/tex/latex/graphics/keyval.sty
Package: keyval 2014/10/28 v1.15 key=value parser (DPC)
\KV@toks@=\toks15
)
(/usr/share/texlive/texmf-dist/tex/latex/base/inputenc.sty
Package: inputenc 2018/08/11 v1.3c Input encoding file
\inpenc@prehook=\toks16
\inpenc@posthook=\toks17
)
(/usr/share/texlive/texmf-dist/tex/latex/base/fontenc.sty
Package: fontenc 2020/02/11 v2.0o Standard LaTeX package
)
(/usr/share/texlive/texmf-dist/tex/latex/xcolor/xcolor.sty
Package: xcolor 2016/05/11 v2.12 LaTeX color extensions (UK)
(/usr/share/texlive/texmf-dist/tex/latex/graphics-cfg/color.cfg
File: color.cfg 2016/01/02 v1.6 sample color configuration
)
Package xcolor Info: Driver file: pdftex.def on input line 225.
(/usr/share/texlive/texmf-dist/tex/latex/graphics-def/pdftex.def
File: pdftex.def 2018/01/08 v1.0l Graphics/color driver for pdftex
)
Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1348.
Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1352.
Package xcolor Info: Model `RGB' extended on input line 1364.
Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1366.
Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1367.
Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1368.
Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1369.
Package xcolor Info: Model `Gray' substituted by `gray' on input line 1370.
Package xcolor Info: Model `wave' substituted by `hsb' on input line 1371.
)
(/usr/share/texlive/texmf-dist/tex/latex/listings/listings.sty
\lst@mode=\count185
\lst@gtempboxa=\box45
\lst@token=\toks18
\lst@length=\count186
\lst@currlwidth=\dimen144
\lst@column=\count187
\lst@pos=\count188
\lst@lostspace=\dimen145
\lst@width=\dimen146
\lst@newlines=\count189
\lst@lineno=\count190
\lst@maxwidth=\dimen147
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstmisc.sty
File: lstmisc.sty 2019/09/10 1.8c (Carsten Heinz)
\c@lstnumber=\count191
\lst@skipnumbers=\count192
\lst@framebox=\box46
)
(/usr/share/texlive/texmf-dist/tex/latex/listings/listings.cfg
File: listings.cfg 2019/09/10 1.8c listings configuration
))
Package: listings 2019/09/10 1.8c (Carsten Heinz)
(/usr/share/texlive/texmf-dist/tex/latex/l3backend/l3backend-pdfmode.def
File: l3backend-pdfmode.def 2020-02-03 L3 backend support: PDF mode
\l__kernel_color_stack_int=\count193
\l__pdf_internal_box=\box47
)
(./essai.aux)
\openout1 = `essai.aux'.
LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for OMS/cmsy/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for OT1/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for T1/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for TS1/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for OMX/cmex/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Font Info: Checking defaults for U/cmr/m/n on input line 22.
LaTeX Font Info: ... okay on input line 22.
LaTeX Info: Redefining \degres on input line 22.
LaTeX Info: Redefining \dots on input line 22.
LaTeX Info: Redefining \up on input line 22.
(/usr/share/texlive/texmf-dist/tex/context/base/mkii/supp-pdf.mkii
[Loading MPS to PDF converter (version 2006.09.02).]
\scratchcounter=\count194
\scratchdimen=\dimen148
\scratchbox=\box48
\nofMPsegments=\count195
\nofMParguments=\count196
\everyMPshowfont=\toks19
\MPscratchCnt=\count197
\MPscratchDim=\dimen149
\MPnumerator=\count198
\makeMPintoPDFobject=\count199
\everyMPtoPDFconversion=\toks20
)
\c@lstlisting=\count266
(/usr/share/texlive/texmf-dist/tex/latex/listings/lstlang1.sty
File: lstlang1.sty 2019/09/10 1.8c listings language file
)
LaTeX Font Info: Trying to load font information for T1+cmtt on input line 2
5.
(/usr/share/texlive/texmf-dist/tex/latex/base/t1cmtt.fd
File: t1cmtt.fd 2019/12/16 v2.5j Standard LaTeX font definitions
)
! Package inputenc Error: Invalid UTF-8 byte sequence.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.26 é
The document does not appear to be in UTF-8 encoding.
Try adding \UseRawInputEncoding as the first line of the file
or specify an encoding such as \usepackage [latin1]{inputenc}
in the document preamble.
Alternatively, save the file in UTF-8 using your editor or another tool
! Package inputenc Error: Invalid UTF-8 byte "A9.
See the inputenc package documentation for explanation.
Type H <return> for immediate help.
...
l.26 é
The document does not appear to be in UTF-8 encoding.
Try adding \UseRawInputEncoding as the first line of the file
or specify an encoding such as \usepackage [latin1]{inputenc}
in the document preamble.
Alternatively, save the file in UTF-8 using your editor or another tool
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <10.95> on input line 28.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <8> on input line 28.
LaTeX Font Info: External font `cmex10' loaded for size
(Font) <6> on input line 28.
[1
{/var/lib/texmf/fonts/map/pdftex/updmap/pdftex.map}] (./essai.aux) )
Here is how much of TeX's memory you used:
4694 strings out of 481239
63173 string characters out of 5920377
493385 words of memory out of 5000000
19968 multiletter control sequences out of 15000+600000
536160 words of font info for 35 fonts, out of 8000000 for 9000
1141 hyphenation exceptions out of 8191
30i,5n,49p,194b,1287s stack positions out of 5000i,500n,10000p,200000b,80000s
{/usr/share
/texmf/fonts/enc/dvips/cm-super/cm-super-t1.enc}</usr/share/texmf/fonts/type1/p
ublic/cm-super/sfrm1095.pfb>
Output written on essai.pdf (1 page, 11456 bytes).
PDF statistics:
13 PDF objects out of 1000 (max. 8388607)
8 compressed objects within 1 object stream
0 named destinations out of 1000 (max. 500000)
1 words of extra memory for PDF output out of 10000 (max. 10000000)
Merci encore de votre aide.
Bonne journée.
Patrice.