[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: Uwe Brauer
Subject: Re: [AUCTeX-devel] insert a label with the file name as suffix.
Date: Fri, 05 May 2017 16:34:54 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

    > Uwe Brauer <address@hidden> writes:

    > 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].

Ok then I thought that was malformed by the MTA. Thanks for clarifying.

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

    > (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") ))

The latter did not work.

I tried emacs -Q
and loaded the file

(require 'reftex)
(add-to-list 'reftex-label-alist
             `("titledquestion" ?x
               ,(concat LaTeX-exam-label "%f:")
               "~\\ref{%s}" nil ("ejercicio") ))
and obtained

cons: Symbol's value as variable is void: LaTeX-exam-label

So I did the following

(defun my-reftex-label-alist-6 ()
  "Sets reftex-label to have a 6th entry"
  (setq reftex-label-alist
        '(`("titledquestion" ?x
            ,(concat LaTeX-exam-label "%f:")
            "~\\ref{%s}" nil ("ejercicio") ))))
(add-hook 'reftex-mode-hook 'my-reftex-label-alist-6)

And then run a test in file exam-test.tex

When inserting a titledquestion I obtained an error:

Debugger entered--Lisp error: (wrong-type-argument characterp ("titledquestion" 
120 (\, (concat LaTeX-exam-label "%f:")) "~\\ref{%s}" nil ("ejercicio")))
  char-to-string(("titledquestion" 120 (\, (concat LaTeX-exam-label "%f:")) 
"~\\ref{%s}" nil ("ejercicio")))
  reftex-label("questions" nil)
  LaTeX-label("questions" environment)
  TeX-parse-argument(nil LaTeX-exam-insert-label)
  TeX-parse-arguments(("Title" ["Points"] LaTeX-exam-insert-label 
(TeX-arg-literal " ")))
  TeX-parse-macro("titledquestion" ("Title" ["Points"] LaTeX-exam-insert-label 
(TeX-arg-literal " ")))
  funcall-interactively(TeX-insert-macro "titledquestion")
  call-interactively(TeX-insert-macro nil nil)

reply via email to

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