auctex-devel
[Top][All Lists]
Advanced

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

Re: Problem with RefTeX and the amsmath + mathtools styles


From: Arash Esbati
Subject: Re: Problem with RefTeX and the amsmath + mathtools styles
Date: Sun, 29 Dec 2019 21:09:18 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50

Hi Florent,

Florent Rougon <address@hidden> writes:

> I'm writing to you about a problem I encountered when I tried RefTeX a
> few months ago. Please note that I was completely new to RefTeX, tried
> it for a short period, then stopped because of this problem (basically,
> I thought “Uh, RefTeX is a complex third-party package that interferes
> badly with the already complex AUCTeX, this may bring me more trouble
> than comfort, better stay with what the AUCTeX devs take care of.”).
> However, it seems that RefTeX is maintained by the same AUCTeX
> developers nowadays, so... this at least justifies this report.
>
> Given the circumstances of this try-and-stop, I'm sorry to say thay I
> don't understand the short RefTeX setup reproduced below anymore---it
> may be that I copy/pasted the last chunk from the manual---and maybe it
> doesn't make much sense to you either. Don't worry too much, my life
> doesn't depend on this problem. :-) I am merely following up on Arash's
> kind suggestion.

Thanks for your message.  Let me again say that RefTeX is a great tool
when writing LaTeX files in Emacs.  You should definitely start using it
(again), it is worth the effort.

Regarding the issue you describe, I think it has nothing to do with
RefTeX, my guess is that your AUCTeX installation goes wrong somehow.
For the start, do you really need the latest AUCTeX for git?  If not, I
suggest you skip the hassle with the manual installation and install
AUCTeX via ELPA.  Just delete your manual installation, uncomment
(package-initialize), delete (require 'tex-site) and (require 'tex) from
your init.el (important!), restart Emacs and do `M-x list-packages RET'
and go from there.

If you need the latest version from git, then please follow the
description from the manual here[1].  This is what I will comment from
here on.

> So, here are the minimal conditions I found that can trigger the
> problem:
>
> 1) Install AUCTeX with:
>
>    ./configure --prefix="$HOME/.local" \
>                --with-lispdir="$HOME/lisp/manual-installs" \
>                --with-texmf-dir="$HOME/texmf"
>    make
>    make install

OK, this looks good acc. to [1].

> 2) ~/.emacs.d/init.el:
>
> ;(package-initialize)
>
> ;; No error with only "~/src-pastouche/auctex.git" added to `load-path'.
> ;(add-to-list 'load-path "~/src-pastouche/auctex.git")
> (add-to-list 'load-path "~/lisp/manual-installs")
> (add-to-list 'load-path "~/lisp/manual-installs/auctex")

Actually all three lines shouldn't be necessary.

> (require 'tex-site)
> (require 'reftex)
> (require 'tex)

Delete (require 'tex-site) and (require 'tex).  Replace them with this
line and you should be fine:

    (load "~/lisp/manual-installs/auctex.el" nil t t)

> (setq TeX-parse-self t
>       reftex-plug-into-AUCTeX t)
> (add-hook 'LaTeX-mode-hook 'turn-on-reftex)

OK.

> ; Not needed to trigger the error
> ;(add-to-list 'reftex-ref-style-alist
> ;             '("AMSMath" ("amsmath" (("\\eqref" ?e)))) t)

This form is faulty.  It should be:

    (add-to-list 'reftex-ref-style-alist
                 '("AMSMath" "amsmath" (("\\eqref" ?e))) t)

See the docstring:

    reftex-ref-style-alist is a variable defined in ‘reftex-vars.el’.
    Its value is shown below.

    Documentation:
    Alist of reference styles.
    Each element is a list of the style name, the name of the LaTeX
    package associated with the style or t for any package, and an
    alist of macros where the first entry of each item is the
    reference macro and the second a key for selecting the macro when
    the macro type is being prompted for.  (See also
    ‘reftex-ref-macro-prompt’.)  The keys, represented as characters,
    have to be unique.

But this isn't necessary at all since `amsmath.el' does the job already:

    http://git.savannah.gnu.org/cgit/auctex.git/tree/style/amsmath.el#n162

> (TeX-add-style-hook "amsmath"
>    (lambda ()
>      (when (fboundp 'reftex-add-label-environments)
>        (add-to-list 'reftex-ref-style-default-list "AMSMath" t)
>        (reftex-ref-style-activate "AMSMath")
>        (setq reftex-label-alist '(AMSTeX)))))

Again not needed since `amsmath.el' caters for it:

    http://git.savannah.gnu.org/cgit/auctex.git/tree/style/amsmath.el#n158

> 3) Open the following test.tex:
>
> \documentclass{article}
> \usepackage{mathtools}
>
> \begin{document}
> \end{document}
>
>
> Doing 3) fails with the error message:
>
>   Symbol’s value as variable is void: LaTeX-amsmath-package-options
>
> You'll find the corresponding backtrace attached.

This works for me (I have a different setup where I load auctex.el
directly out of the git repo, but that's a different story).  Please
open your test file and do `M-x list-load-path-shadows RET' and check
that you don't have multiple installations.

HTH.

Best, Arash

Footnotes:
[1]  
https://www.gnu.org/software/auctex/manual/auctex.html#Advice-for-non_002dprivileged-users



reply via email to

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