Discussion:
[AUCTeX] Emacs + AUCTeX + cœur LaTeX + MiKTeX + Nom de fichier avec caractères accentués
v***@gmail.com
2018-09-28 04:31:28 UTC
Permalink
The following message is a courtesy copy of an article
that has been posted to fr.comp.text.tex,fr.comp.applications.emacs as well.

Bonjour,

Récemment je suis tombé sur un problème que je n'avais pas avant.

Voilà la chose : lorsque j’essaie de compiler un document comprenant une
lettre accentuée, par exemple liberté.tex ça ne marche plus.

Je réfute d'avance la réponse qui serait d'écrire liberte au lieu de
liberté, je ne connais pas plus Liberte qu'Alberte, et c'est juste une
question de choix, je préfère la tracasserie de tomber de temps en temps
dans ce genre de nid de poule en utilisant des lettres accentuées dans
les noms de fichier à celle consistant à écrire les noms de fichiers
sans accents, en franquais plutôt qu'en français.

J'utilise AUCTeX sur MiKTeX, mais j'ignore si le souci vient du portage
de pdflatex que fait MiKTeX ou bien du cœur LaTeX. À moins que ce soit
une mise à jour d'Emacs qui change le comportement d'AUCTeX.

En regardant en détail ce qui se passe, AUCTeX ne fait que appeler la
commande

pdflatex \input liberté.tex

(avec quelques guillemets que je supprime ici parce que les guillemets
ne sont pas les mêmes en DOS et en Unix, et que ce n'est pas le problème
ici).

Cette commande échoue parce que liberté y est interprété comme du code
LaTeX et que le é va donc donner autre chose que la suite des deux octets
C3 A9 en hexa.

Il m'a suffit pour corriger le problème de bidouiller AUCTeX pour qu'il
appelle

pdflatex liberté.tex


Pour que ça passe. Dans ce cas pdflatex interprète liberté.tex comme un
nom de fichier.

Au cas où d'autres tomberaient dans le même problème voici ce que j'ai
dû faire sous AUCTeX — la modif n'était pas si triviale, alors je la
donne — dans mon fichier d'init j'ai défini cette fonction:

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
(defun my-latex-input-expander ()
(prog1
(if
(stringp TeX-command-text)
(progn
(setq TeX-command-pos
(and
(string-match " "
(funcall file t t))
"\"")))
(setq TeX-command-pos nil)
"")
(setq TeX-command-text nil)))
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----

Et ensuite j'ai customisé TeX-expand-list pour que ça vaille

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
'(("%'" vbl-latex-input-expander))
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----

Voici ce que ça donne dans le tampon de customisation :

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
Hide Tex Expand List:
INS DEL Key: %'
Expander: vbl-latex-input-expander
Arguments:
INS
INS
State : SAVED and set.
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----

Enfin bref, ça a résolu mon problème, mais j'écris ici pour savoir si
quelqu'un connais le changement qui l'a produit :

- Est-ce un changement du cœur LaTeX (\input ne se comportant plus comme
avant)

- Est-ce un changement d'Emacs — ma version :

GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2018-08-10

je suspecte qu'il faisait une conversion utf-8 → windows-1252 dans
les versions précédente, ce qu'en tout cas visiblement il ne fait pas
dans ma version actuelle.

- Est-ce un changement dans le moteur pdflatex de MiKTeX

- Est-ce un changement dans AUCTeX (j'en doute, je n'ai pas remis à jour
depuis très longtemps).

J'ai tendance à penser que c'est Emacs qui a changé car c'est le truc
que j'ai remis à jour le plus récemment.

V.
v***@gmail.com
2018-09-28 04:40:03 UTC
Permalink
The following message is a courtesy copy of an article
that has been posted to fr.comp.text.tex as well.
Post by v***@gmail.com
Bonjour,
Récemment je suis tombé sur un problème que je n'avais pas avant.
[...]
Post by v***@gmail.com
Enfin bref, ça a résolu mon problème, mais j'écris ici pour savoir si
- Est-ce un changement du cœur LaTeX (\input ne se comportant plus comme
avant)
GNU Emacs 27.0.50 (build 1, x86_64-w64-mingw32) of 2018-08-10
je suspecte qu'il faisait une conversion utf-8 → windows-1252 dans
les versions précédente, ce qu'en tout cas visiblement il ne fait pas
dans ma version actuelle.
- Est-ce un changement dans le moteur pdflatex de MiKTeX
- Est-ce un changement dans AUCTeX (j'en doute, je n'ai pas remis à jour
depuis très longtemps).
J'ai tendance à penser que c'est Emacs qui a changé car c'est le truc
que j'ai remis à jour le plus récemment.
V.
Je me réponds à moi même pour dire que ça ne vient pas d'Emacs. Je viens
de trouver une vieille (GNU Emacs 26.0.50 (build 1, i686-pc-mingw32) of
2017-06-29) version d'Emacs — la plus vieille que j'ai pu trouver sur ma
machine, et il y a exactement le même problème.

Sans ma customisation d'AUCTeX ça fait cela:

--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
Running `LaTeX' on `liberté' with ``pdflatex -file-line-error -interaction=nonstopmode "\input" "liberté.tex"''
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6745 64-bit)
entering extended mode
LaTeX2e <2018-04-01> patch level 5
???:0: I can't find file `libert'.
<to be read again>
\global
<*> \input liberté
.tex
Please type another input file name
???:0: Emergency stop
???:0: ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.

TeX Output exited abnormally with code 1 at Fri Sep 28 06:34:53
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----

V.
Arash Esbati
2018-09-28 11:58:08 UTC
Permalink
Post by v***@gmail.com
--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
Running `LaTeX' on `liberté' with ``pdflatex -file-line-error -interaction=nonstopmode "\input" "liberté.tex"''
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6745 64-bit)
entering extended mode
LaTeX2e <2018-04-01> patch level 5
???:0: I can't find file `libert'.
<to be read again>
\global
<*> \input liberté
.tex
Please type another input file name
???:0: Emergency stop
???:0: ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.
TeX Output exited abnormally with code 1 at Fri Sep 28 06:34:53
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
Hi Vincent,

latest development version of AUCTeX handles file names with non-ascii
characters correctly. For details, see this change[1].

Compiling a file `liberté.tex' and hitting `C-c C-l' shows this for me:

--8<---------------cut here---------------start------------->8---
Running `LaTeX' on `liberté' with ``pdflatex -file-line-error -interaction=nonstopmode "liberté.tex"''
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./liberté.tex
LaTeX2e <2018-04-01> patch level 5
...
Transcript written on liberté.log.
--8<---------------cut here---------------end--------------->8---

Note the missing \input <filename.tex>. I'm using TeXlive, but this
shouldn't make a difference.

Best, Arash

Footnotes:
[1] http://git.savannah.gnu.org/cgit/auctex.git/commit/?id=a8ea1273fd95da5702fe95ad3f41d151b621bc72
Vincent Belaïche
2018-09-30 19:13:26 UTC
Permalink
Dear Arash,
Thanks for the feedback, I reinstalled AUCTeX from the GIT repo, and after erasing my customization & relaunching Emacs it worked, as expected with MiKTeX.

Just out of curiosity : do you have any idea of what the root cause of this change of behaviour is ? What surprises me is not really that it does not work any longer with \input, but that for some reason it has ever worked, and that Indeed it used to work with it?

Anyway, the root cause of this sort of issues is that the TeX engines command line is based on some non POSIX command line format and some euristic, one cannot write something like

pdflatex --tex \input --file liberté.tex

where the argument after --tex would be interpreted as TeX code, and the argument after --file would be interpreted as a filename (ie all characters getting catcode 11 or 12).

So, OK not having \input makes it work for the simple case of LaTeX compilation, but the command line euristic is broken when, say, the TeX4ht loader is used, which means that non ASCII letters in the input filename would be quite messy for TeX4ht to support.

I also remember similar discussion for texi2dvi, see this fix if you are interested:
http://svn.savannah.gnu.org/viewvc/texinfo/trunk/util/texi2dvi?r1=7199&r2=7200, the trick was made to support funny characters like ~ in filenames while continuing to have \input in the command line...


VBR,
Vincent.
________________________________
De : auctex <auctex-bounces+vincent.b.1=***@gnu.org> de la part de Arash Esbati <***@gnu.org>
Envoyé : vendredi 28 septembre 2018 13:58
À : ***@gmail.com
Cc : AUCTeX; MikTeX user group list
Objet : Re: [AUCTeX] Emacs + AUCTeX + cœur LaTeX + MiKTeX + Nom de fichier avec caractères accentués
Post by v***@gmail.com
--8<----8<----8<----8<----8<-- begin -->8---->8---->8---->8---->8----
Running `LaTeX' on `liberté' with ``pdflatex -file-line-error -interaction=nonstopmode "\input" "liberté.tex"''
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (MiKTeX 2.9.6745 64-bit)
entering extended mode
LaTeX2e <2018-04-01> patch level 5
???:0: I can't find file `libert'.
<to be read again>
\global
<*> \input liberté
.tex
Please type another input file name
???:0: Emergency stop
???:0: ==> Fatal error occurred, no output PDF file produced!
Transcript written on texput.log.
TeX Output exited abnormally with code 1 at Fri Sep 28 06:34:53
--8<----8<----8<----8<----8<-- end -->8---->8---->8---->8---->8----
Hi Vincent,

latest development version of AUCTeX handles file names with non-ascii
characters correctly. For details, see this change[1].

Compiling a file `liberté.tex' and hitting `C-c C-l' shows this for me:

--8<---------------cut here---------------start------------->8---
Running `LaTeX' on `liberté' with ``pdflatex -file-line-error -interaction=nonstopmode "liberté.tex"''
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018/W32TeX) (preloaded format=pdflatex)
restricted \write18 enabled.
entering extended mode
(./liberté.tex
LaTeX2e <2018-04-01> patch level 5
...
Transcript written on liberté.log.
--8<---------------cut here---------------end--------------->8---

Note the missing \input <filename.tex>. I'm using TeXlive, but this
shouldn't make a difference.

Best, Arash

Footnotes:
[1] http://git.savannah.gnu.org/cgit/auctex.git/commit/?id=a8ea1273fd95da5702fe95ad3f41d151b621bc72
Loading...