I have for a long time a problem with the accents (i write in french) in the comments of my source code (VBA). I spend many hours on it but i was unsuccessful so I hope somebody can help me and thank you for that in advance.
My document has this following header :
\documentclass[10pt]{article} \usepackage{a4wide} \usepackage[french]{babel} \usepackage[latin1]{inputenc} \usepackage{vmargin} \usepackage[dvips]{graphicx} %Ce package suivant pour l'insertion de code (HTML, PHP, MySQL,...) \usepackage{color,listings} \usepackage{array} \newcolumntype{M}[1]{>{\raggedright}m{#1}} %STYLE VIDE SUR LES PAGES DE GARDE \pagestyle{empty} \setpapersize{A4} \setmarginsrb{15mm}{10mm}{15mm}{10mm}{5pt}{5mm}{5pt}{5mm} %gauche, haut, droite, bas, hauteur en-tête, sep avant entête, hauteur pied, sep avant pied page \begin{document} \pagestyle{empty} \renewcommand{\baselinestretch}{2} \setlength{\parskip}{1.5ex plus 0.5ex minus 0.2ex} \setlength{\parindent}{0pt} \lstdefinelanguage{VBA}{morekeywords={And, As, Byte, Call, Case, Compare, CDbl, Datebase, Date, Dim, Else, ElseIf, End, Error, Exit, Explicit, False, Function, GoTo, If, IIF, Integer, Not, Nothing, Null, Object, On, Option, Or, Private, Resume, String, Single, Select, Set, Static, Sub, Then, True, To,}, sensitive=false, morecomment=[l]Rem, morecomment=[l]', morestring=[b]", emph={acFormBar, acEditMenu, acCurrent, acEntire, acMenuVer70, acSaveYes, acViewNormal, acForm, acDataErrAdded, acNewRec, acDataErrContinue, Cancel, CancelEvent, Close, CurrentDb, DefaultValue, DateValue, DAO, Description, DoCmd, DoMenuItem, Err, Error, Error$, $, Execute, FindRecord, Forms, FindFirst, IsNull, Me, MsgBox, GoToControl, GoToRecord, NewData, Nz, Maximize, Number, OpenForm, Parent, Recordset, Requery, Response, SetFocus, stDocName, stLinkCriteria, Value, vbExclamation, vbOK, vbOKCancel, vbInformation, vbYes, vbNo, vbYesNo, vbCancel, vbQuestion, vbYesNoCancel, Visible,}, emphstyle=\itshape} \lstloadlanguages{VBA, HTML} \lstset{% language=VBA, basicstyle=\small, keywordstyle=\color{blue}\bfseries, commentstyle=\color{green}\itshape, tabsize=1, extendedchars=false, inputencoding=latin1, breaklines=true, showstringspaces=false, stringstyle=\sffamily, numbers=left, numberstyle=\tiny, stepnumber=2, numbersep=5pt}
Everything works fine except the comments. If i comment something like "sélection" it comes out like "éslection". It means that the é comes first as well as others characters with accent.
Thank you in advance for your precious help.
Best regards