auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [AUCTeX] files with non-ascii characters and LaTeX as in TeXLive 201


From: jfbu
Subject: Re: [AUCTeX] files with non-ascii characters and LaTeX as in TeXLive 2018
Date: Thu, 24 May 2018 20:03:13 +0200
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:52.0) Gecko/20100101 Thunderbird/52.8.0

Le 24/05/2018 à 19:39, jfbu a écrit :
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 may have been a bit optimistic

I have problem when adding an equation and asking to generate preview at point


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



with this file

\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}


when I add

\[x^3+y^3\]

and then try to generate preview "at point" I get this

```
Running `Preview-LaTeX' on `_region_' with ``pdflatex -interaction=nonstopmode 
\&prv_test_my_la\́te\́x "/AUCTEXINPUT{" _region_.tex "}"''
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded 
format=pdflatex)
 restricted \write18 enabled.
entering extended mode
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)
        .
(./_region_.tex
No file _region_.aux.
(/path/to/.emacs.d/elpa/auctex-12.1.0/latex/preview.sty 
(/usr/local/texlive/2018/texmf-dist/tex/generic/luatex85/luatex85.sty) 
(/path/to/.emacs.d/elpa/auctex-12.1.0/latex/prtightpage.def) 
(/path/to/.emacs.d/elpa/auctex-12.1.0/latex/prauctex.def
No auxiliary output files.


(/path/to/.emacs.d/elpa/auctex-12.1.0/latex/prauctex.cfg)) 
(/path/to/.emacs.d/elpa/auctex-12.1.0/latex/prfootnotes.def)
Preview: Fontsize 10pt
Preview: PDFoutput 1
)
! Undefined control sequence.
\GenericError  ...
                                                    #4  \errhelp 
address@hidden@     ...
l.8 \message{ !name(test my lá
                                téx.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                  \let address@hidden@          
     ...
l.8 \message{ !name(test my lá
                                téx.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                  address@hidden \def 
\MessageBreak...
l.8 \message{ !name(test my lá
                                téx.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                     \endgroup
l.8 \message{ !name(test my lá
                                téx.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                    #4  \errhelp 
address@hidden@     ...
l.8 \message{ !name(test my láté
                                    x.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                  \let address@hidden@          
     ...
l.8 \message{ !name(test my láté
                                    x.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                  address@hidden \def 
\MessageBreak...
l.8 \message{ !name(test my láté
                                    x.tex) !offset(0) }
! Undefined control sequence.
\GenericError  ...
                                                     \endgroup
l.8 \message{ !name(test my láté
                                    x.tex) !offset(0) }
 !name(test my la\protect \begingroup \immediate \write address@hidden   \def 
\MessageBreak
 \let \protect \edef  You may provide a definition with\MessageBreak 
\DeclareUnicodeCharacter   \errhelp \let \def \MessageBreak
(inputenc)                 \def   \errmessage  Package inputenc Error: Unicode 
character ́ (U+301)\MessageBreak not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help   \endgroup te\protect \begingroup 
\immediate \write address@hidden   \def \MessageBreak
 \let \protect \edef  You may provide a definition with\MessageBreak 
\DeclareUnicodeCharacter   \errhelp \let \def \MessageBreak
(inputenc)                 \def   \errmessage  Package inputenc Error: Unicode 
character ́ (U+301)\MessageBreak not set up for use with LaTeX.

See the inputenc package documentation for explanation.
Type  H <return>  for immediate help   \endgroup x.tex) !offset(0)
! Preview: Snippet 1 started.
<-><->
l.11 \[
       x^3+y^3\]
Preview: Tightpage -32891 -32891 32891 32891
! Preview: Snippet 1 ended.(693664+0x12359148).
<-><->
l.11 \[x^3+y^3\] [1{/usr/local/texlive/2018/texmf-var/fonts/map/pdftex/updmap/pdftex.map}] )
(see the transcript file for additional 
information)</usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmmi10.pfb></usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmr10.pfb></usr/local/texlive/2018/texmf-dist/fonts/type1/public/amsfonts/cm/cmr7.pfb>
Output written on _region_.pdf (1 page, 22824 bytes).
Transcript written on _region_.log.

TeX Output exited as expected with code 1 at Thu May 24 19:56:58
LaTeX: LaTeX found no preview images
```

I don't know where from the \message's originate.


Best

Jean-François


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


_______________________________________________
auctex mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/auctex





reply via email to

[Prev in Thread] Current Thread [Next in Thread]