Suppose a LaTeX command such as: \Person[<opt>]{<arg>} where <arg> may be any last name and [<opt>] may take several 'named arguments' like so:

\Person[function={President of the United States},
        otherinfo={some items of information}]{Roosevelt}

Is it possible to define a symbol in AUCTeX that would allow the user to enter those necessarily undefined values in the minibuffer when one is prompted for the accepted keys?

I have tried this so far:

(defvar LaTeX-mypackage-person-options
  "Local options.")

;; and then in the hooks

    '("Person" [ TeX-arg-key-val LaTeX-mypackage-person-options ]t)

But infortunately I run into a no match warning---as expected---from the minibuffer as soon as I hit the space key. Defining values in LaTeX-mypackage-person-options is irrelevant because these values are unpredictable by definition.

Is there a way to define such symbols properly in AUCTeX?

  • To whomever downvoted this question: a short comment would have helped me at least to understand why it is devoid of interest! – Robert Alessi Apr 11 at 17:29
  • I deleted my (wrong) comment and upvoted to counteract the downvote. We start from scratch! Hope somebody can help you. – NickD Apr 11 at 18:55
  • @NickD Thank you! I couldn't get round this issue. k=v 'verbose' options are actually processed the same way by many style files. Try for instance to set hyperref's pdfauthor: you will bump into the same no match error message as soon as you hit space after your first name... – Robert Alessi Apr 11 at 22:16

This is by design as minibuffer-local-completion-map and the derived variable crm-local-completion-map both set SPACE to minibuffer-complete-word and crm-complete-word respectively.

You can write a function in your style file which let-binds these variables removing the entries for SPACE. E.g., have a look at graphicx.el and the definition of LaTeX-arg-graphicx-includegraphics-key-val.

In general, you can hit C-q SPACE if you need a SPACE in the minibuffer. This should suffice for most cases.

| improve this answer | |
  • Thanks Arash! This is exactly what I was looking for. I agree: C-q SPACE is quite acceptable for short insertions viz. a couple of words or so. – Robert Alessi Apr 14 at 12:36

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.