auctex
[Top][All Lists]
Advanced

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

Re: [AUCTeX] overlay prompting


From: jfbu
Subject: Re: [AUCTeX] overlay prompting
Date: Mon, 25 Jan 2016 10:08:06 +0100
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.5.1

Le 24/01/2016 22:00, Joost Kremers a écrit :

On Sun, Jan 24 2016, jfbu <address@hidden> wrote:
The \documentclass{beamer} arises on line 1890.

So if you set `TeX-auto-parse-length' to some value about 1500,
that will fix it for me ;;;---)

Can't you put a ZERO WIDTH NO-BREAK SPACE (U+FEFF) in the
\documentclass{beamer} line inside the verbatim environment? That should
be enough to throw off the parser but it won't show in the pdf.


ok, good idea thanks, but I have a constraint that for some reasons
my document must use an 8bit source encoding, and also for some other
(additional) reasons I must use latex, not xelatex or lualatex.

nevertheless let me briefly report on trying your idea:

With the initial test file:

\documentclass{article}
\begin{document}
\begin{verbatim}
\documentclass{beamer}
\end{verbatim}
\end{document}

1) an U+FEFF inserted before the closing brace does not fool the
parser

2) an U+FEFF inserted between document and class does trick the
parser on C-xC-s but has the aftereffect that if I do C-cC-n
then AUCTeX mistakenly switches the buffer to AMSTeX mode (plain tex).

3) with the U+FEFF between "doc" and "ument", things are _OK_.

I can then compile the source above with xelatex/lualatex. But,
trying with pdflatex and the modified source (I have the U+FEFF there)

\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\begin{document}
% insert thousands of lines if you wish
\begin{verbatim}
\documentclass{beamer}
\end{verbatim}

\end{document}

I get

ERROR: Package inputenc Error: Unicode char  (U+FEFF)

--- TeX said ---
(inputenc) not set up for use with LaTeX.

Some extra work would thus be needed. Anyhow I mentioned already that
in my use case, my source must be 8bit encoded.

And, for maintenance I need to be able to copy-paste easily from
my source these code snippets for testing, and using such an
(almost) invisible character is not very convenient.

I can do something inspired by your idea. My source is latin1 encoded.
I could devote some character in the 128-255 range for that task,
a character not in use elsewhere.

For example:

% -*- coding: iso-latin-1; -*-
\documentclass{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\let¡\empty
\begin{document}

\begin{verbatim}
\doc¡umentclass{beamer}
\end{verbatim}

\end{document}

This works. Testing for maintenance of the document that the code snippet
from the verbatim is OK is made a bit more complicated as I will
have to remove the ¡, but at least it is obvious what I should do.

My document has other AUCTeX-parsing related problems. For example

\begin{verbatim}
    \usepackage{fontspec}
\end{verbatim}

similarly triggers AUCTeX to prompt me for xetex/luatex compilation.
This made the workflow a bit painful, but I forgot about it last time
as I was doing latex runs via a Makefile.

I could use the ¡ trick here, but I also have \usepackage{fontspec}
in other locations: within (sort of) \iffalse...\fi blocks, for
docstrip file extractions from the dtx source. Having a ¡ in there
means something extra has to be added:

\input docstrip.tex
\catcode`\¡ 9

works, but with the extra complication that this itself also has to
be extracted from the .dtx source, to be put inside an .ins file,
hence if ¡ is "ignored" during that extraction the ins file will end
up with \catcode`\ 9. But that's a detail.

I could do some massive search/replace now for \documentclass/\usepackage
occurrences, but 1) I hope not to have to work on the document for quite
some time, and 2) it is a bit annoying to modify sources only for matters
of an Editor; as these sources are then distributed, I would
thereby make them less usable to third parties.

Also, perhaps commands like \setmainfont also make AUCTeX's parser react,
or is it only \documentclass and \usepackage ?

Best,

Jean-François




reply via email to

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