auctex-devel
[Top][All Lists]
Advanced

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

Re: [AUCTeX-devel] Newbie trying to understand the parser.


From: Tassilo Horn
Subject: Re: [AUCTeX-devel] Newbie trying to understand the parser.
Date: Fri, 18 Jul 2014 09:24:09 +0200
User-agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux)

Bernard Hurley <address@hidden> writes:

Hi Bernard,

> I'm trying to understand how the parser works as I would like to write
> some style files for TikZ. I hope you don't mind if I ask some
> possibly stupid questions, but I haven't seem them answered anywhere.

There are no stupid questions! :-)

> The first question is this: The code in "Hacking the Parser" in the
> info file contains:
>
>      (defvar TeX-newmacro-regexp
>        '("\\\\newmacro{\\\\\\([a-zA-Z]+\\)}{\\\\\\([a-zA-Z]+\\)}"
>          (1 2) TeX-auto-multi)
>        "Matches \newmacro definitions.")
>
> What is the purpose of the list (1 2) and what is the significance of
> the numbers?

In the regexp, there are two grouping constructs \\(..\\).  The list (1
2) means that the parser should capture the strings matching them and
put them in the TeX-auto-multi variable.  In the cleanup function, the
value of the variable (a list with 2-tuples, each item being a new
\def-ed macro) is processed to add the \newmacro-generated macros to
TeX-symbol-list so that AUCTeX recognizes them.

> For the second question, the following file (01-Hagen-Petri-net.ly)
> was automatically generated in my auto subdirectory:

You forgot to include that file. ;-)

>   (TeX-add-style-hook "01-Hagen-Petri-net"
>    (lambda ()
>       (TeX-run-style-hooks
>        "tikz"
>        ""
>        "latex2e"
>        "art10"
>        "article"
>        "a4paper")))
>
> Why does it contain an empty string?  What is the purpose of it?

It has no purpose.  Maybe you have an empty \usepackage{} somewhere in
your file?

Bye,
Tassilo




reply via email to

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