2

I have experienced problems with the following

  • Polyglossia
  • xelatex
  • fontspec

does not recognize accented letters in french

i'm using Texniccenter as editor of tex with the latest update to my MIKTEX

\documentclass[10pt,a4paper]{report}
\usepackage{amsthm}
\usepackage{setspace}
\usepackage{fontspec}
\usepackage{polyglossia}
\usepackage{xunicode}
\usepackage{xcolor}
\usepackage{pifont}
\usepackage{enumitem}
\setmainlanguage{english}
\setotherlanguage{arabic}

\newfontfamily\arabicfont[Script=Arabic,Scale=1.2]{Scheherazade}

\newcommand{\setcontext}[2]{\setcounter{chapter}{#1}\setcounter{section}{#2}}
\newcommand{\diff}{\mathop{}\mathopen{}\mathrm{d}}
%\frenchbsetup{StandardLists=true}

\newtheoremstyle{examplestyle}{10mm}{10mm}{\slshape}{2pt}{\bfseries}{}{\newline}{}
\theoremstyle{examplestyle}
\makeatletter

\newcounter{descriptcount}
\newlist{enumdescript}{description}{2}
\setlist[enumdescript,1]{%
  before={\setcounter{descriptcount}{0}%
          \renewcommand*\thedescriptcount{\Roman{descriptcount}}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}
\setlist[enumdescript,2]{%
  before={\setcounter{descriptcount}{0}%
          \renewcommand*\thedescriptcount{\alph{descriptcount}}}
  ,font=\bfseries\stepcounter{descriptcount}\thedescriptcount~
}

\begin{document}


un âne, la grêle, un traîneau, un symptôme, une mûre
\begin{enumdescript}
   \item [L'accent  aigu]
    \
    \begin{itemize}[font=\color{magenta} , label=\ding{59}]
\item amitié - tenacité - prévenir - médecin;
\end{itemize}
\item [L'accent grave]
\
    \begin{itemize}[font=\color{magenta} , label=\ding{59}]
\item  abcès - enlèvement - exprès - grève
\end{itemize}
\end{enumdescript}
\end{document}

which produces enter image description here

there is no error tex just warning in my techniccenter :

%%
%% This is file `fontspec-patches.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% fontspec.dtx  (with options: `patches')
%% 
%%   _________________________________________
%%   The fontspec package for XeLaTeX/LuaLaTeX
%%   (C) 2004--2014    Will Robertson and Khaled Hosny
%% 
%%   License information appended.
%% 
%% 
\ProvidesPackage{fontspec-patches}
  [2014/06/21 v2.4a Font selection for XeLaTeX and LuaLaTeX]


\ExplSyntaxOn
\cs_set_protected:Npn \@fnsymbol #1
 {
  \int_case:nnF {#1}
   {
    {0} {}
    {1} { \mode_if_math:TF *\textasteriskcentered }
    {2} { \mode_if_math:TF \dagger\textdagger }
    {3} { \mode_if_math:TF \ddagger\textdaggerdbl }
    {4} { \mode_if_math:TF \mathsection\textsection }
    {5} { \mode_if_math:TF \mathparagraph\textparagraph }
    {6} { \mode_if_math:TF \|\textbardbl }
    {7} { \mode_if_math:TF {**}{\textasteriskcentered\textasteriskcentered} }
    {8} { \mode_if_math:TF {\dagger\dagger}{\textdagger\textdagger} }
    {9} { \mode_if_math:TF {\ddagger\ddagger}{\textdaggerdbl\textdaggerdbl} }
   }
   { \@ctrerr }
 }
\DeclareRobustCommand \em
 {
  \@nomath\em
  \str_if_eq_x:nnTF \f@shape \itdefault \eminnershape
  {
    \str_if_eq_x:nnTF \f@shape \sldefault \eminnershape \emshape
  }
 }
\DeclareTextFontCommand{\emph}{\em}
\cs_set_eq:NN \emshape \itshape
\cs_set_eq:NN \eminnershape \upshape
\DeclareRobustCommand{\-}
 {
  \discretionary
   {
    \char\ifnum\hyphenchar\font<\z@
           \xlx@defaulthyphenchar
         \else
           \hyphenchar\font
         \fi
   }{}{}
 }
\def\xlx@defaulthyphenchar{`\-}
\cs_new:Nn \fontspec_visible_space:
 {
  \font_glyph_if_exist:NnTF \font {"2423}
   { \char"2423\scan_stop: }
   { \fontspec_visible_space_fallback: }
 }
\cs_new:Nn \fontspec_visible_space_fallback:
 {
  {
   \usefont{\g_fontspec_encoding_tl}{lmtt}{\f@series}{\f@shape}
   \textvisiblespace
  }
 }
\group_begin:
\char_set_catcode_active:n{"20}%
\cs_gset:Npn\fontspec_print_visible_spaces:{%
\char_set_catcode_active:n{"20}%
\cs_set_eq:NN^^20\fontspec_visible_space:%
}%
\group_end:
\def\verb
 {
  \relax\ifmmode\hbox\else\leavevmode\null\fi
  \bgroup
    \verb@eol@error \let\do\@makeother \dospecials
    \verbatim@font\@noligs
    \@ifstar\__fontspecsverb\@verb
 }
\def\__fontspecsverb{\fontspec_print_visible_spaces:\@sverb}
\AtBeginDocument
 {
  \fontspec_patch_verbatim:
  \fontspec_patch_moreverb:
  \fontspec_patch_fancyvrb:
  \fontspec_patch_listings:
 }
\cs_set:Npn \fontspec_patch_verbatim:
 {
  \@ifpackageloaded{verbatim}
   {
    \cs_set:cpn {verbatim*}
     {
      \group_begin: \@verbatim \fontspec_print_visible_spaces: \verbatim@start
     }
   }
   {
    \cs_set:cpn {verbatim*}
     {
      \@verbatim \fontspec_print_visible_spaces: \@sxverbatim
     }
   }
 }
\cs_set:Npn \fontspec_patch_moreverb:
 {
  \@ifpackageloaded{moreverb}{
    \cs_set:cpn {listingcont*}
     {
      \cs_set:Npn \verbatim@processline
       {
        \thelisting@line \global\advance\listing@line\c_one
        \the\verbatim@line\par
       }
      \@verbatim \fontspec_print_visible_spaces: \verbatim@start
     }
  }{}
 }
\cs_set:Npn \fontspec_patch_fancyvrb:
 {
  \@ifpackageloaded{fancyvrb}
   {
    \cs_set_eq:NN \FancyVerbSpace \fontspec_visible_space:
   }{}
 }
\cs_set:Npn \fontspec_patch_listings:
 {
  \@ifpackageloaded{listings}
   {
    \cs_set_eq:NN \lst@visiblespace \fontspec_visible_space:
   }{}
 }
\RenewDocumentCommand \oldstylenums {m}
 {
  { \addfontfeature{Numbers=OldStyle} #1 }
 }
\NewDocumentCommand \liningnums {m}
 {
  { \addfontfeature{Numbers=Lining} #1 }
 }
%% 
%% Copyright 2004--2014 Will Robertson <wspr81@gmail.com>
%% Copyright 2009--2013   Khaled Hosny <khaledhosny@eglug.org>
%% 
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%% 
%% This work is "maintained" by Will Robertson.
%% 
%% This work consists of this file fontspec.dtx
%%           and the derived files fontspec.sty,
%%                                 fontspec.lua,
%%                                 fontspec.cfg,
%%                                 fontspec-xetex.sty,
%%                                 fontspec-luatex.sty,
%%                                 fontspec-patches.sty,
%%                                 fontspec-example.tex,
%%                             and fontspec.pdf.
%% 
%%
%% End of file `fontspec-patches.sty'.

my code works fine i already checked it here https://www.overleaf.com/2280649fdmwpj#/5853636/ the problem is with Texniccenter

Educ
  • 4,362
  • If I compile the example, I can see the accented letters. – egreg Feb 20 '15 at 18:22
  • 1
    Your text editor is probably not set to UTF8 text encoding. – Franck Pastor Feb 20 '15 at 18:22
  • I also see the accented letters with your code (I'm using TeX Live2014). – Gonzalo Medina Feb 20 '15 at 18:23
  • i use techniccenter as editor of tex – Educ Feb 20 '15 at 18:23
  • I don't know TeXniccenter. Can it be configured to UTF-8 Unicode text encoding? – Franck Pastor Feb 20 '15 at 18:36
  • i don't know but may be see this http://tex.stackexchange.com/questions/99887/how-to-change-the-text-encoding-of-a-texniccenter-project and http://tex.stackexchange.com/questions/19427/how-do-i-change-the-encoding-of-my-files – Educ Feb 20 '15 at 18:39
  • @Educ: TeXnicCenter can be used to change the encoding, yes. In the bottom-right status bar you'll see the current encoding (ASCII, ANSI, UTF8, ...). To change it, File > Save As... > (choose correct encoding). – Werner Feb 20 '15 at 19:05
  • It doesn't seem to use utf8 by default. – Bernard Feb 20 '15 at 19:15
  • @Werner In that case, the file encoding must fit the default encoding of TeXnicCenter. Since this one is a XeLaTeX file, I figure that TeXnicCenter's default encoding must be previously set to UTF8-Unicode if one wants to get the accents. – Franck Pastor Feb 20 '15 at 19:15
  • @Werner yes its works when i save it as utf8 – Educ Feb 20 '15 at 19:32
  • My TeXnic Center endodes new files as Ansi: I suppose this is the default encoding, but the site claims it's utf8. A bug? – Bernard Feb 20 '15 at 19:39
  • i think based on what i did to solve that problem is 'Ansi' even it showed 'UTF8' – Educ Feb 20 '15 at 19:47
  • Reading comments below I see that it was just a problem of the editor encoding configuration that was solved after using the right encoding. Do you want to provide an answer to your own question or do you consider we could close it? – Gonzalo Medina Feb 20 '15 at 22:15
  • Mr Gonzalo Medina you can provide answer – Educ Feb 20 '15 at 22:25
  • Thanks but I think the person who should write an answer is @fpast who gave the clue about the editor encoding. Would you (fpast) like to provide a proper answer? – Gonzalo Medina Feb 21 '15 at 15:10
  • @GonzaloMedina yes why not – Educ Feb 21 '15 at 15:37
  • @Educ I've just wrote this answer. – Franck Pastor Feb 21 '15 at 15:46

1 Answers1

1

This kind of problems generally comes from the fact that the LaTeX editor is not configured to the suitable input encoding. In this peculiar case (a XeLaTeX file, and XeTeX interpreting the input as UTF-8 by default), it means that the editor must be configured to UTF8-Unicode input encoding.

Franck Pastor
  • 18,756
  • Try this piece of code: \usepackage[T1]{fontenc} \usepackage[utf8]{inputenc} \usepackage [french]{babel} – domi Oct 28 '17 at 02:17