Discussion:
[AUCTeX] How to configure TeX special characters?
Marcin Borkowski
2017-05-01 13:13:34 UTC
Permalink
Hi all,

a friend of mine has this problem: he does not want $, & and % to have
special meaning to (La)TeX, so he changes their catcodes to make them
un-special; to retain the possibility of inputting math, typesetting
tables and commenting out things, he assigns the respective catcodes to
some Unicode\setminus ASCII characters.

Putting aside the question whether it's a good idea (personally I don't
like it very much, but I can see the rationale), how do I convince
AUCTeX to take that into consideration when font-locking? I tried to
monkey-patch AUCTeX sources (for instance, I tried changing
"\\$\\$\\([^$]+\\)\\$\\$" in font-latex-make-user-keywords into
something like "〖\\([^$]+\\)〗", then even restarting Emacs
altogether), but to no avail.

TIA,

--
Marcin Borkowski
David Kastrup
2017-05-01 13:46:11 UTC
Permalink
Post by Marcin Borkowski
Hi all,
a friend of mine has this problem: he does not want $, & and % to have
special meaning to (La)TeX, so he changes their catcodes to make them
un-special; to retain the possibility of inputting math, typesetting
tables and commenting out things, he assigns the respective catcodes to
some Unicode\setminus ASCII characters.
Putting aside the question whether it's a good idea (personally I don't
like it very much, but I can see the rationale), how do I convince
AUCTeX to take that into consideration when font-locking? I tried to
monkey-patch AUCTeX sources (for instance, I tried changing
"\\$\\$\\([^$]+\\)\\$\\$" in font-latex-make-user-keywords into
something like "〖\\([^$]+\\)〗", then even restarting Emacs
altogether), but to no avail.
That would be a serious upstream battle. Language-specific editing
support relies on assumptions. That is one reason that LaTeX has
several editors catering to it pretty well while plain TeX (which does
not really provide much in the line of document structuring) doesn't.

I don't think that AUCTeX caters all that well for more serious breaches
of convention.
--
David Kastrup
Marcin Borkowski
2017-05-03 05:42:37 UTC
Permalink
Post by David Kastrup
Post by Marcin Borkowski
Hi all,
a friend of mine has this problem: he does not want $, & and % to have
special meaning to (La)TeX, so he changes their catcodes to make them
un-special; to retain the possibility of inputting math, typesetting
tables and commenting out things, he assigns the respective catcodes to
some Unicode\setminus ASCII characters.
Putting aside the question whether it's a good idea (personally I don't
like it very much, but I can see the rationale), how do I convince
AUCTeX to take that into consideration when font-locking? I tried to
monkey-patch AUCTeX sources (for instance, I tried changing
"\\$\\$\\([^$]+\\)\\$\\$" in font-latex-make-user-keywords into
something like "〖\\([^$]+\\)〗", then even restarting Emacs
altogether), but to no avail.
That would be a serious upstream battle. Language-specific editing
support relies on assumptions. That is one reason that LaTeX has
several editors catering to it pretty well while plain TeX (which does
not really provide much in the line of document structuring) doesn't.
I don't think that AUCTeX caters all that well for more serious breaches
of convention.
Thanks for your prompt reply!

I am not sure about my personal stand on it. On the one hand, it's
always saddening to find a piece in Emacs (or the "Emacs ecosystem")
which is not easily configurable. OTOH, as I mentioned in the OP,
I agree that my friend's idea goes quite against established LaTeX
conventions. OYAH, AFAIK ConTeXt already treats dollars etc. as normal
characters, so it's quite possible that AUCTeX will have to cater for
that particular thing anyway.

Best,

--
Marcin Borkowski
David Kastrup
2017-05-03 06:12:33 UTC
Permalink
Post by Marcin Borkowski
Post by David Kastrup
Post by Marcin Borkowski
Hi all,
a friend of mine has this problem: he does not want $, & and % to have
special meaning to (La)TeX, so he changes their catcodes to make them
un-special; to retain the possibility of inputting math, typesetting
tables and commenting out things, he assigns the respective catcodes to
some Unicode\setminus ASCII characters.
Putting aside the question whether it's a good idea (personally I don't
like it very much, but I can see the rationale), how do I convince
AUCTeX to take that into consideration when font-locking? I tried to
monkey-patch AUCTeX sources (for instance, I tried changing
"\\$\\$\\([^$]+\\)\\$\\$" in font-latex-make-user-keywords into
something like "〖\\([^$]+\\)〗", then even restarting Emacs
altogether), but to no avail.
That would be a serious upstream battle. Language-specific editing
support relies on assumptions. That is one reason that LaTeX has
several editors catering to it pretty well while plain TeX (which does
not really provide much in the line of document structuring) doesn't.
I don't think that AUCTeX caters all that well for more serious breaches
of convention.
Thanks for your prompt reply!
I am not sure about my personal stand on it. On the one hand, it's
always saddening to find a piece in Emacs (or the "Emacs ecosystem")
which is not easily configurable. OTOH, as I mentioned in the OP,
I agree that my friend's idea goes quite against established LaTeX
conventions. OYAH, AFAIK ConTeXt already treats dollars etc. as normal
characters, so it's quite possible that AUCTeX will have to cater for
that particular thing anyway.
I am pretty sure I remember that comment character is configurable in
some parts of AUCTeX, but I am also pretty sure that it's unlikely to be
implemented consistently and reliably because it's just too uncommon.
--
David Kastrup
Mosè Giordano
2017-05-06 17:30:06 UTC
Permalink
Hi Marcin,

I tend to agree with David, fontification in AUCTeX is known to fail
at some point when too many catcodes are changed. Sophisticated LaTeX
style files are not so nicely displayed by AUCTeX. It would be
awesome to make this more configurable, the problem is that this is *a
lot* of work. In AUCTeX, the character to start macros should be
always indicated with `TeX-esc' (also because TeXinfo uses a different
character), but I'm pretty sure there are many places where a
hard-coded backslash is used. Or, the start of comment should be
indicated with `TeX-comment-start-regexp', but this is never used in
"font-latex.el".

Bye,
Mosè
Post by Marcin Borkowski
Hi all,
a friend of mine has this problem: he does not want $, & and % to have
special meaning to (La)TeX, so he changes their catcodes to make them
un-special; to retain the possibility of inputting math, typesetting
tables and commenting out things, he assigns the respective catcodes to
some Unicode\setminus ASCII characters.
Putting aside the question whether it's a good idea (personally I don't
like it very much, but I can see the rationale), how do I convince
AUCTeX to take that into consideration when font-locking? I tried to
monkey-patch AUCTeX sources (for instance, I tried changing
"\\$\\$\\([^$]+\\)\\$\\$" in font-latex-make-user-keywords into
something like "〖\\([^$]+\\)〗", then even restarting Emacs
altogether), but to no avail.
TIA,
--
Marcin Borkowski
_______________________________________________
auctex mailing list
https://lists.gnu.org/mailman/listinfo/auctex
Loading...