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: Vladimir Lomov
Subject: Re: Select and insert multiple bibliography entries into one \cite command with regexp search.
Date: Thu, 12 Aug 2021 15:21:32 +0800

Hello,
** Hongyi Zhao <hongyi.zhao@gmail.com> [2021-08-12 12:40:24 +0800]:

[...]

> What do you mean by saying ``"big" output''? The original description
> given by Arash is as follows:

> (bib "z:/path/to/test-bib-file.bib")

The output length is bigger than 80 symbols (cf. what Arash shown).

[...]

> But even so, I still can't see the similar result given by Arash as follows:

> (bib "z:/path/to/test-bib-file.bib")

This is output in the buffer

------------------------------------------------------------------------------
((xr nil "\\\\\\\\\\\\") (index-tags) (is-multi nil) (bibview-cache) 
(master-dir . "/home/vladimir/tmp/test/emacs/") (label-numbers) (bof 
"/home/vladimir/tmp/test/emacs/doc-samp3.ltx") (eof 
"/home/vladimir/tmp/test/emacs/doc-samp3.ltx"))
------------------------------------------------------------------------------

for my third document after I forced RefTeX to reparse document (I think
RefTeX parses document only when there is a change in a buffer or after some
time, didn't check that though). This is output for my second document

------------------------------------------------------------------------------
((xr nil "\\\\\\\\\\\\") (index-tags) (is-multi nil) (bibview-cache) 
(master-dir . "/home/vladimir/tmp/test/emacs/") (label-numbers) (bof 
"/home/vladimir/tmp/test/emacs/doc-samp2.ltx") (eof 
"/home/vladimir/tmp/test/emacs/doc-samp2.ltx"))
------------------------------------------------------------------------------

and the first one:

------------------------------------------------------------------------------
((xr nil "\\\\\\\\\\\\") (index-tags) (is-multi nil) (bibview-cache) 
(master-dir . "/home/vladimir/tmp/test/emacs/") (label-numbers) (bof 
"/home/vladimir/tmp/test/emacs/doc-samp.ltx") (bib 
"/home/vladimir/tmp/test/emacs/sample.bib") (eof 
"/home/vladimir/tmp/test/emacs/doc-samp.ltx"))
------------------------------------------------------------------------------

As you see, only the first document has 'bib' part.

> See the following result of mine generated by `C-x C-e' on the lisp
> code line of the TeX document:

> ------------------------------------
> \documentclass{article}

> \usepackage{natbib}
> \bibliography{\string~/Documents/bibliograph/better-bibtex/references-bibtex.bib}

> \begin{document}

> \cite{weiFirstprinciplesCharacterizationBibased2009}

> \begin{verbatim}
>  (insert "\n"
>       (format "%S" (symbol-value reftex-docstruct-symbol)))
> ((xr nil "\\\\\\\\\\\\") (index-tags) (is-multi nil) (bibview-cache)
> (master-dir . 
> "/home/werner/Desktop/work/emacs-auctex/reftex-docstruct-symbol/")
> (label-numbers) (bof
> "/home/werner/Desktop/work/emacs-auctex/reftex-docstruct-symbol/reftex-docstruct-symbol.tex")
> (eof 
> "/home/werner/Desktop/work/emacs-auctex/reftex-docstruct-symbol/reftex-docstruct-symbol.tex"))
> \end{verbatim}
> \end{document}

> %%% Local Variables:
> %%% mode: latex
> %%% TeX-master: t
> %%% End:
> ------------------------------------

To be sure I made a fourth document in which I moved '\bibliography' into
preamble and use '\string~' and got

------------------------------------------------------------------------------
((xr nil "\\\\\\\\\\\\") (index-tags) (is-multi nil) (bibview-cache) 
(master-dir . "/home/vladimir/tmp/test/emacs/") (label-numbers) (bof 
"/home/vladimir/tmp/test/emacs/doc-samp4.ltx") (eof 
"/home/vladimir/tmp/test/emacs/doc-samp4.ltx"))
------------------------------------------------------------------------------

Funny, I didn't even try to replicate your document, I merely wrote mine as
example to check what is going on. I read RefTeX manual again and didn't find
any mention where '\bibliography' macro must in document to be taken into
account. Well, I consulted with source2e (LaTeX source) and found this
(quoting from source2e.pdf, run texdoc source2e to find section "ltbibl.dtx"):

  \bibliography{⟨file1,file2, . . . ,filen⟩} : specifies the bibdata files.
  Writes a \bibdata entry on the .aux file and tries to read in mainfile.bbl.

in other words, LaTeX will insert bibliography list in place of
'\bibliography' command. Why someone would issue the command in document
preamble, it is meaningless. Why you use it there?

I made my examples didn't consulting LaTeX manual but follow some logic: put
'\bibliography' macro there where I need to insert bibliography list. May be I
read some manual, may be the LaTeX source and remember that but I even didn't
thought to issue '\bibliography' into a preamble.

To conclude: you have problem only because you insert '\bibliography' macro in
WRONG place. Though I'm not sure if RefTeX is "smart" enough but it definitely
ignores that macro and it is right.

> Best, Hongyi

---
WBR, Vladimir Lomov

-- 
Don't tell me what you dreamed last night for I've been reading Freud.

Attachment: signature.asc
Description: PGP signature


reply via email to

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