[Top][All Lists]

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

Re: [AUCTeX-devel] insert a label with the file name as suffix.

From: Arash Esbati
Subject: Re: [AUCTeX-devel] insert a label with the file name as suffix.
Date: Fri, 05 May 2017 18:08:18 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2

Uwe Brauer <address@hidden> writes:

>    > I think the issue is somewhere else: In exam.el,
>    > `LaTeX-exam-insert-label' is used for "titledquestion" and
>    > "bonustitledquestion".  IIRC, you have to add these environments to
>    > `LaTeX-label-alist' and `reftex-label-alist' in order to get what you
>    > want, e.g.
>    >     (add-to-list 'LaTeX-label-alist '("titledquestion" . 
> LaTeX-exam-label))
>    > and
>    >     (add-to-list 'reftex-label-alist
>    >                  `("titledquestion" ?x ,LaTeX-exam-label ...))
> Thanks for your answer. I tried out the following
> I set
> (add-to-list 'LaTeX-label-alist '("titledquestion" . LaTeX-exam-label))
> And then I replaced
>   (setq reftex-label-alist
>         '(("titledquestion"   ?t "exm:%f:"  "~\\ref{%s}" nil ("ejercicio"  
> ))))
> By
>   (setq reftex-label-alist
>         '(("titledquestion" ?x ,LaTeX-exam-label)))       
> Are you sure about that syntax? Now when entering a new latex file I
> obtain an error.

Hi Uwe,

I didn't test it, but I'm pretty sure about the syntax ;-)  If you look
closer at my code above for RefTeX, you'll see that it uses backquote `
and not a quote '.  See here for why[1].

If you want to put that stuff in your .emacs, try something like this:

--8<---------------cut here---------------start------------->8---
(with-eval-after-load "latex"
  (add-to-list 'LaTeX-label-alist '("titledquestion" . LaTeX-exam-label)))

(require 'reftex)

(add-to-list 'reftex-label-alist
             `("titledquestion" ?x
               ,(concat LaTeX-exam-label "%f:")
               "~\\ref{%s}" nil ("ejercicio") ))
--8<---------------cut here---------------end--------------->8---

I'm not sure if using ?t is a good idea since it is hard-coded in RefTeX
for tables.

Best, Arash


reply via email to

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