Why do I need to do the extra work starting with \ifdefined in order to get my French guillemets correct in the pdf output, when using xelatex with a source specifying the use of T1-encoded fonts ?
\documentclass[french]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\ifdefined\XeTeXinterchartoks
\catcode`« \active
\catcode`» \active
\def«{\char19 }
\def»{\char20 }% ça marche, même avec Babel+frenchb
\fi
\usepackage{newtxtext}
\usepackage{babel}
\frenchbsetup{og=«, fg=»}
\begin{document}
\showboxbreadth\maxdimen
\showboxdepth\maxdimen
\showoutput
«coucou»
\end{document}
The log contains:
Package: inputenc 2015/03/17 v1.2c Input encoding file
\inpenc@prehook=\toks14
\inpenc@posthook=\toks15
Package inputenc Warning: inputenc package ignored with utf8 based engines.
But it is loaded after fontenc. It is not forbidden to use fontenc with xelatex. inputenc is loaded after it. Thus it should know that T1-encoded font slots are to be used. Why then doesn't it do the job of making these characters active and map them to the suitable \char xx slots ?
There is something escaping me here...
Notice that the code sample also uses babel+frenchb which adds automatic spacing. It seems not to have been perturbed from my making the characters active.
In order to explain more the issue, consider the following input:
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
\showboxbreadth\maxdimen
\showboxdepth\maxdimen
\showoutput
«coucou»
\end{document}
It produces, if compiled with xelatex:
The explanation is simple: the ascii chars « and » are in slots 171 and 187 respectively. Hence the corresponding glyphs from the T1 encoding are used, giving the result. inputenc does nothing, but it could have donc something akin to my code above.
...\hbox(6.63332+0.0)x345.0, glue set 290.00977fil
....\hbox(0.0+0.0)x15.0
....\T1/cmr/m/n/10 «
....\T1/cmr/m/n/10 c
....\T1/cmr/m/n/10 o
....\T1/cmr/m/n/10 u
....\T1/cmr/m/n/10 c
....\T1/cmr/m/n/10 o
....\T1/cmr/m/n/10 u
....\T1/cmr/m/n/10 »



xelatexshould only be used with Unicode fonts ? – Dec 11 '15 at 18:33xelatexhad such grave lacunae in support of classic 256 slots fonts. So far, I had not seen any authoritative advice : "use xelatex only with opentype fonts". (and what aboutlualatexthen ?) – Dec 11 '15 at 18:54xetexequivalent ofluainputenc. Thexetex-inputencpackage referenced there unfortunately only does anything useful with 8-bit input. – Robert Dec 11 '15 at 20:17luainputencadresses (with quite some years of anticipation...) precisely the issue I was raising. – Dec 11 '15 at 20:52inputenc's future with UTF-aware engines here. – Robert Dec 11 '15 at 20:52xelatexwas for easierpnggraphics inclusion. The latex source is not created directly by me, (I explain in a comment to Ulrike's answer) and I didn't want to engage into figuring out the bounding boxes and how to let the Sphinx ReST to latex converter incorporate it. Thus I switched to xelatex (I needed some work to obtain from Sphinx a xelatex compatible preamble). Circa484Kovs620Ko. With Libertine the ratio was more like 1 to 2. The comparison is withpdflatexnot withlatex+dvipdfmx. – Dec 12 '15 at 13:088bitlegacy fonts for me is that I want to compile on various platforms to identical result. If I started using for exampleMenlofont on my Mac, I would not have it on my linux box at the office. – Dec 12 '15 at 13:11TL2015on both; but more important for me than to the Å identity is the possibility to compile; again, I could use very pleasing opentype fonts on my Mac system, but then I would not have them at other locations (nor do I have the possibility to install them). – Dec 12 '15 at 13:21graphicxI know I don't have to change the source, it is enough to haveimage.bbfiles available. As I am doing this on a conclusion of a project, I could indeed create and add these files to the suitable location, and then the latex + dvipdfmx road could be followed. Butsphinx.styhas a bug and always passespdftexas driver tographicx. I would have to patch that. See https://github.com/sphinx-doc/sphinx/issues/2164 – Dec 12 '15 at 13:25char 19 /20, as I only had a specific issue with « and ». I came here out of curiosity to learn whyinputencdid nothing. Strong arguments to justify it, I am learning thanks to the comments. But they don't totally explain so far whyinputencdecided not to do whatluainputenc(seems to, I have been so busy harassing folks here and also I am doing other things that I haven't yet examined closely) does. – Dec 12 '15 at 13:52inputencmaps non-ascii to ascii commands. XeTeX can handle unicode, so there really is no need to map to ascii. I am sorry, i have read every comment to all answers, but i still don't know what you really mean. – Johannes_B Dec 12 '15 at 13:55\documentclass{article}\usepackage{amsmath}\begin{document}\[\max_{(s'\to s)\Rightarrow u_{i}=1}\bigl(\tilde{\delta}_{i}(s',s)\bigr)\]\end{document}gives:64011butes withpdflatex,63551bytes withlualatexand8390bytes withxelatex. (figures vary) – Dec 15 '15 at 18:42xelatexwas as good at font compression aslatex+dvipdfmx, which explains why I am in a phase currently of experimentation with xelatex. (which simplifies a bit the graphics aspects and naturally has the great features of handling system fonts). – Dec 15 '15 at 20:36