0

I am trying to generate citations that include multiple references to different works, e.g. \cite{A,B} giving [A,B] in the text. I cannot seem to figure out how to use RefTeX+AUCTeX (in Emacs 27.1) to include multiple citations.

There is a similar question asked here that shows how to manipulate RefTeX, but in my workflow I still cannot seem to use \cites to query for multiple regexes and include those in the same \cite{} command. I have also tried hitting ?, and this suggests n/p to go to the next/previous entry, but this does not actually do anything on my end. Can it be that there exists some clash on my system that prevents the next/previous entry commands to work? Note that manually including the multiple entries, e.g. \cite{A,B} does generate correct behavior -- so my LaTeX/bibliography distro supports multiple citations in a single \cite command.

How do you search the database multiple times and include several different bibliography entries into a single \cite command?

MWE

\documentclass{article}
\bibliography{plain}

\begin{document}

Some citation~\cite{lamport94}.

\begin{thebibliography}{9}
\bibitem{texbook}
Donald E. Knuth (1986) \emph{The \TeX{} Book}, Addison-Wesley Professional.

\bibitem{lamport94}
Leslie Lamport (1994) \emph{\LaTeX: a document preparation system}, Addison
Wesley, Massachusetts, 2nd ed.
\end{thebibliography}

\end{document}

Commands used: C-c [

4
  • When you call reftex-citation (C-c [), you'll first go through a dispatcher to choose the citation command, after that, you're queried for a regex with which the entries are searched for. After that, you get a list of possible entries matching your regex. You can select multiple entries with m (navigating with n/p, or whatever else). Once you're done, exit with a (for "all", I guess), and marked entries will be inserted in a comma separated list for your citation command.
    – gusbrs
    Mar 13 at 18:11
  • Yes, but this does not allow me to select multiple entries. I want to select distinct entries, e.g. texbook and lamport94 as in the example. I cannot seem to select multiple distinct entries that do not appear in the same regex. Mar 14 at 8:58
  • See also the problem here, but this does not work for me as it always selects the final query. Mar 14 at 9:15
  • I have now pinpointed the main problem: vertico (I got the hint for the completion framework messing with it from here). Turns out it was the completion framework that is messing with RefTeX. I will try to come up with a solution and post it here. Mar 14 at 9:34

1 Answer 1

1

The main issue turned out to be my Emacs completion framework vertico. This completed my Regex queries and when using TAB or RET it only included the currently selected in the Vertico prompt. I can still execute the Regex (e.g. not the input suggested by Vertico) by using vertico-exit-input (with default binding M-RET). In this way the original Regex (e.g. Author1\|Author2) can be executed, multiple entries can be marked, using m, in the RefTeX selection buffer and inserted in a single \cite command using a.

1
  • 1
    This is actually part of the learning curve for new users of both Vertico and Ivy. The default binding for RET leaves completion selecting the current candidate. If you want to leave with the current input, whether it partially matches a candidate or not, you need a different binding: M-RET for Vertico, and C-M-j for Ivy.
    – gusbrs
    Mar 14 at 12:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .