auctex
[Top][All Lists]
Advanced

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

Re: Select and insert multiple bibliography entries into one \cite comma


From: Hongyi Zhao
Subject: Re: Select and insert multiple bibliography entries into one \cite command with regexp search.
Date: Mon, 9 Aug 2021 09:06:43 +0800

On Mon, Aug 9, 2021 at 2:07 AM Arash Esbati <arash@gnu.org> wrote:
>
> Hongyi Zhao <hongyi.zhao@gmail.com> writes:
>
> > I noticed that the \cite command operation using reftex supports the
> > following options:
> >
> > ###########
> > n / p      Go to next/previous entry (Cursor motion works as well).
> >  g / r      Start over with new regexp / Refine with additional regexp.
> >  SPC        Show full database entry in other window.
> >  f          Toggle follow mode: Other window will follow with full db entry.
> >  .          Show insertion point.
> >  q          Quit without inserting \cite macro into buffer.
> >  TAB        Enter citation key with completion.
> >  RET        Accept current entry (also on mouse-2) and create \cite macro.
> >  m / u      Mark/Unmark the entry.
> >  e / E      Create BibTeX file with all (marked/unmarked) entries
> >  a / A      Put all (marked) entries into one/many \cite commands.
> > ###########
> >
> > But I still can't figure out the convenient and efficient workflow for
> > using regexp to select and insert multiple bibliography entries into a
> > \cite command.
>
> This is the description from the manual[1]:
>
>     Command: reftex-citation
>
>     Make a citation using BibTeX database files. After prompting for a
>     regular expression, scans the buffers with BibTeX entries (taken
>     from the \bibliography command or a thebibliography environment) and
>     offers the matching entries for selection. The selected entry is
>     formatted according to reftex-cite-format and inserted into the
>     buffer.
>
>     When called with a C-u prefix, prompt for optional arguments in cite
>     macros. When called with a numeric prefix, make that many
>     citations. When called with point inside the braces of a \cite
>     command, it will add another key, ignoring the value of
>     reftex-cite-format.
>
>     The regular expression uses an expanded syntax: ‘&&’ is interpreted
>     as 'and'. Thus, ‘aaaa&&bbb’ matches entries which contain both
>     ‘aaaa’ and ‘bbb’. While entering the regexp, completion on knows
>     citation keys is possible. ‘=’ is a good regular expression to match
>     all entries in all files.
>
> Once you have the regexp, just mark the entries you want with 'm' in
> that order and hit 'a'.  Does this fit the bill?

Thank you very much for telling me these manipulation details buried
deep in a huge manual.
Now, I try to check the above directives with `C-c [', but nothing
happens except that the following message appears in the *Messages*
buffer:

reftex-offer-bib-menu: No valid bibliography in this document, and no
default available


I use the following bibliography settings in my LaTeX document:

\bibliographystyle{plainnat}
%https://tex.stackexchange.com/questions/62010/can-i-access-system-environment-variables-from-latex-for-instance-home
\bibliography{\string~/Documents/bibliograph/better-bibtex/references-bibtex}

And the bib file exists at the corresponding location:

$ ls ~/Documents/bibliograph/better-bibtex/references-bibtex.bib
/home/werner/Documents/bibliograph/better-bibtex/references-bibtex.bib


> Best, Arash
>
> Footnotes:
> [1]  https://www.gnu.org/software/auctex/manual/reftex.html#IDX233

Regards
-- 
Assoc. Prof. Hongyi Zhao <hongyi.zhao@gmail.com>
Theory and Simulation of Materials
Hebei Vocational University of Technology and Engineering
No. 473, Quannan West Street, Xindu District, Xingtai, Hebei province



reply via email to

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