auctex-devel
[Top][All Lists]
Advanced

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

Re: reftex+catchfilebetweentags, reftex support for catchfilebetweentags


From: Arash Esbati
Subject: Re: reftex+catchfilebetweentags, reftex support for catchfilebetweentags tags
Date: Fri, 02 Dec 2022 16:23:57 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/30.0.50

Uwe Brauer <oub@mat.ucm.es> writes:

>>>> "AE" == Arash Esbati <arash@gnu.org> writes:
>
>> Uwe Brauer <oub@mat.ucm.es> writes:
>
Can you please refrain from changing the subject line with every
message?  Thanks.

> I think I understand some of the structure but still the workflow is not
> entirely reliable.

👍

> Indeed that works in the current Emacs session.
>
> However, even after putting these lines in my reftex_init.el file and
> byte-compiling it, after a restart of Emacs, the reftex did not add
> the correct reference/label to ExecuteExternalMetaData!
>
> I had explicitly to eval these lines again, to make it work. I am sort
> of puzzled.

You really should write a new AUCTeX style file like
`xcatchfilebetweentags.el' and put that stuff there instead of your init
file.  Since you need a xcatchfilebetweentags.sty anyway for the LaTeX
macro, so this for xcatchfilebetweentags.sty:

--8<---------------cut here---------------start------------->8---
\ProvidesPackage{xcatchfilebetweentags}[2022/12/02 v1.0]
\RequirePackage{catchfilebetweentags}
\newcommand{\ExecuteExternalMetaData}[2]{%
  \ExecuteMetaData[#1]{#2}%
}
--8<---------------cut here---------------end--------------->8---

And this for xcatchfilebetweentags.el:

--8<---------------cut here---------------start------------->8---
(defun LaTeX-arg-executeexternalmetadata (optional)
  (let ((reftex-ref-macro-prompt nil))
    (TeX-argument-insert (reftex-reference nil t) optional)))

(TeX-add-style-hook
 "xcatchfilebetweentags"
 (lambda ()
   (TeX-run-style-hooks "catchfilebetweentags")

   (TeX-add-symbols
    '("ExecuteExternalMetaData"
      (TeX-arg-input-file "File-name" t)
      LaTeX-arg-executeexternalmetadata))

   (unless (member "ExecuteExternalMetaData" reftex-include-file-commands)
     (add-to-list (make-local-variable 'reftex-include-file-commands)
                  "ExecuteExternalMetaData" t)
     (add-to-list (make-local-variable 'reftex-label-regexps)
                  "<\\*\\(?1:[^>]+\\)>" t)
     (reftex-compile-variables))

   ;; Fontification
   (when (and (featurep 'font-latex)
              (eq TeX-install-font-lock 'font-latex-setup))
     (font-latex-add-keywords '(("ExecuteExternalMetaData" "{{"))
                              'reference)))
 TeX-dialect)
--8<---------------cut here---------------end--------------->8---

Now \usepackage{xcatchfilebetweentags} in your .tex file and see if it
does what you want.

Best, Arash



reply via email to

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