|
From: | jfbu |
Subject: | Re: [AUCTeX] files with non-ascii characters and LaTeX as in TeXLive 2018 |
Date: | Thu, 24 May 2018 19:39:14 +0200 |
User-agent: | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 |
Hi Keita I have applied your patch (with diff of preview.el.in transferred to preview.el) to my elpa installed 12.1.0 (later I saw I had 12.1.1 on another computer and that preview.el had changed a bit. As the elpa comes with .gitignore which by bad luck for me has /preview.el, my initial commit did not have the original one which I then manually modified with your patch --- I recovered later from the other computer the preview.el there and re-did my commits) (b.t.w. I also git cloned the savannah, and https://git.savannah.gnu.org/cgit/auctex.git has a typo it should be https://git.savannah.gnu.org/git/auctex.git ) Le 24/05/2018 à 17:26, Ikumi Keita a écrit :
Hi Jean and all, The proposed method, with slight modification explained below, works for all the cases I tested. Thank you again! For now, I attach the patch for preview-latex part only so that the reader can concentrate on the relavant changes.jfbu <address@hidden> writes:\ifx\pdfoutput\undefined\else\let\PREVIEWdump\dump\def\dump{% \edef\next{{\pdfoutput=\the\pdfoutput\relax\the\everyjob}}% \everyjob\next\catcode`\ 10 % \catcode`/ 0 % \def\AUCTEXINPUT##1{\catcode`/ 12\relax\catcode`\ 9\relax\input{\detokenize{"##1"}}}% \let\dump\PREVIEWdump\dump}\fi\input mylatex.ltx \relax%Notice that when ##1 (i.e. the filename) will be grabbed) the / is of catcode 0, so ##1 is tokenized accordingly. Which in principle could perhaps cause an issue \detokenize{aaa/b23} would give aaa/b<space>123 but as / is not legal in filenames in contexts I know of, I did not even test this anticipation.AUCTeX always runs TeX commands after changing the current directory to that of the master file, so forward slash would never appear as an argument of the command. The region file is created in the same directory as the master, thus region compilation should work as well.I have also added quotes inside the \detokenize.I tried removing those quotes and let the quotes added around the file name with space to be put inside /AUCTEXINPUT like this: pdflatex -foo -bar &prv_ppp_qqq /AUCTEXINPUT{"ppp qqq"} (without escape for shell) , because it's easier to absorb the difference in the way of quoting the shell arguments between w32 and non-w32 platforms. Experiments showed no problems even for files without space, so the attached patch takes this way. If this has any shortcomings, please tell me.
My testing so far indicates no problem on Mac OS X 10.9.5 I was intrigued by these changes related to quotes, but it turns out when I had tried manually on the command line that I was not quoting correctly. With your patch on top of 12.1.0 I successfully generate preview for a file with both spaces and utf-8 characters. The top of preview generation log displays starts like this; Running `Preview-LaTeX' on `test my látéx' with ``pdflatex -interaction=nonstopmode \&prv_test_my_la\́te\́x "/AUCTEXINPUT{" \"test\ my\ la\́te\́x.tex\" "}"'' (the Mac OS uses a special form of Unicode for filenames with combining characters) I did not check the ini file because it is volatile but I think you indicated how to modify cache-preamble to make it permanent. Anyway, above file with contents \documentclass{article} \def\foo{E=mc^2} \def\bar{x^n + y^n = z^n} \def\foofoo{E=h\nu} \begin{document} \(\foo\) \(\bar\) \(\foofoo\) \end{document} generates correct previews. It also compiles fine because my TeX-command-list does not have the %` and %'. And the non-\input form correctly escapes the spaces for the shell so it seems. A proposito, the above in the pdflatex command (once the format is done)means \input will be with extra spaces \input{<space>"test my látéx.tex"<space>} but fortunately that works fine. (one can check that by using this \\def\\AUCTEXINPUT##1{\\catcode`/ 12\\relax\\catcode`\\ 9\\relax\\message{+++\\detokenize{##1}+++}\\input{\\detokenize{##1}}}% in preview.el and then check generate-preview compilation log) LaTeX2e <2018-04-01> patch level 4 CUSTOMISED FORMAT. Preloaded files: . "test my látéx.tex" article.cls 2014/09/29 v1.4h Standard LaTeX document class size10.clo 2014/09/29 v1.4h Standard LaTeX file (size option) . +++ "test my látéx.tex" +++ (./test my látéx.tex No file "test my látéx".aux. Anyway, all seems fine! Thanks! Jean-François
[Prev in Thread] | Current Thread | [Next in Thread] |