In my custom style support file, I would like to add custom code to parse an environment. That is, my LaTeX code looks like this

  some complex stuff

and I don't want to capture some complex stuff in a regexp, it's too complex for that, but I do want to analyze it. I can't use generic entries to parse some complex stuff because they would have a ridiculous amount of false positives outside the foobar environment. I can capture the beginning of the environment in an entry in TeX-auto-regexp-list, but what am I supposed to put in my function?

(defun TeX-parse-foobar-environment (match)
  (let ((name (TeX-match-buffer match))
        (start ???) (end ???))
    (parse-foobar-region start end)))
(TeX-auto-add-regexp '("\\\\begin{\\(foobar\\)}" 1 TeX-parse-foobar-environment))

I don't see anything about this in the manual. Should I call LaTeX-find-matching-begin then LaTeX-find-matching-end to determine where the environment starts and ends? How does this generalize to examples other than environments? I could find out empirically where the point is, but can I count on that being the same in all versions of AUCTeX?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.