[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: |
Wed, 11 Aug 2021 12:42:28 +0800 |
On Wed, Aug 11, 2021 at 10:43 AM Vladimir Lomov <lomov.vl@yandex.ru> wrote:
>
> Hello,
> ** Hongyi Zhao <hongyi.zhao@gmail.com> [2021-08-11 07:47:33 +0800]:
>
> > On Wed, Aug 11, 2021 at 12:40 AM Arash Esbati <arash@gnu.org> wrote:
> [...]
> >>
> >> For me, it works with a simple file like this on my Windows box:
> >>
> >> \documentclass{article}
> >>
> >> \usepackage{natbib}
> >> \bibliography{z:/path/to/test-bib-file}
> >>
> >> \begin{document}
> >>
> >> \begin{verbatim}
> >> (insert "\n"
> >> (format "%S" (symbol-value reftex-docstruct-symbol)))
> >> \end{verbatim}
> >> \end{document}
> >>
> >> %%% Local Variables:
> >> %%% mode: latex
> >> %%% TeX-master: t
> >> %%% End:
> >>
> >> When I eval the form in the verbatim env, there is an entry like this:
> >>
> >> (bib "z:/path/to/test-bib-file.bib")
> >>
> >> inserted in the buffer, hence RefTeX finds the file which is in a
> >> different directory than the .tex file.
>
> > I tried to adjust your above example according to my situation as follows:
>
> > \documentclass{article}
>
> > \usepackage{natbib}
> > \bibliography{/home/werner/Documents/bibliograph/better-bibtex/references-bibtex.bib}
>
> > \begin{document}
>
>
> > \cite{weiFirstprinciplesCharacterizationBibased2009}
>
> > \begin{verbatim}
> > (insert "\n"
> > (format "%S" (symbol-value reftex-docstruct-symbol)))
> > \end{verbatim}
> > \end{document}
>
> > %%% Local Variables:
> > %%% mode: latex
> > %%% TeX-master: t
> > %%% End:
>
> > Then I run xelatex and bibtex several times on the above document
>
> but that's not what Arash did! He explicitly wrote:
>
> >> When I eval the form in the verbatim env, there is an entry like this:
>
> and shown the output. What you get when do the same?
>
> > in Emacs, but finally meet the following error:
>
> > ##################
> > Running `LaTeX' on `reftex-docstruct-symbol' with ``xelatex
> > -file-line-error --synctex=1 -interaction=nonstopmode
> > reftex-docstruct-symbol.tex''
> > This is XeTeX, Version 3.141592653-2.6-0.999993 (TeX Live 2021)
> > (preloaded format=xelatex)
> > restricted \write18 enabled.
> > entering extended mode
> > (./reftex-docstruct-symbol.tex
> > LaTeX2e <2020-10-01> patch level 4
> > L3 programming layer <2021-05-07>
> > (/opt/texlive/2021/texmf-dist/tex/latex/base/article.cls
> > Document Class: article 2020/04/10 v1.4m Standard LaTeX document class
> > (/opt/texlive/2021/texmf-dist/tex/latex/base/size10.clo))
> > (/opt/texlive/2021/texmf-dist/tex/latex/natbib/natbib.sty)
> > \bibdata{/home/werner/Documents/bibliograph/better-bibtex/references-bibtex.bib}
> > (./reftex-docstruct-symbol.bbl)
> > (/opt/texlive/2021/texmf-dist/tex/latex/l3backend/l3backend-xetex.def
> > (|extractbb --version)) (./reftex-docstruct-symbol.aux)
> > (/opt/texlive/2021/texmf-dist/tex/latex/base/ts1cmr.fd)
>
> > Package natbib Warning: Citation
> > `weiFirstprinciplesCharacterizationBibased2009' on page 1 undefined on
> > input line 9.
>
>
> > Package natbib Warning: There were undefined citations.
>
> > [1] (./reftex-docstruct-symbol.aux) )
> > Output written on reftex-docstruct-symbol.pdf (1 page).
> > SyncTeX written on reftex-docstruct-symbol.synctex.gz.
> > Transcript written on reftex-docstruct-symbol.log.
>
> > TeX Output finished at Wed Aug 11 07:43:44
> > ##################
>
> And how this suppose to be related with RefTeX? You run xelatex (you didn't
> mention earlier that you typeset document using a LaTeX engine) and then
> bibtex. Whether you typeset document using AUCTeX or did this on command line
> isn't really matter.
>
> Besides, this in NOT an ERROR! This is a WARNING! You should look into
> reftex-docstruct-symbol.blg file to figure out what the problem is.
The content of the above file is as follows:
$ cat reftex-docstruct-symbol.blg
This is BibTeX, Version 0.99d (TeX Live 2021)
Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
The top-level auxiliary file: reftex-docstruct-symbol.aux
I found no \bibdata command---while reading file reftex-docstruct-symbol.aux
I found no \bibstyle command---while reading file reftex-docstruct-symbol.aux
You've used 1 entry,
0 wiz_defined-function locations,
85 strings with 610 characters,
and the built_in function-call counts, 0 in all, are:
= -- 0
> -- 0
< -- 0
+ -- 0
- -- 0
* -- 0
:= -- 0
add.period$ -- 0
call.type$ -- 0
change.case$ -- 0
chr.to.int$ -- 0
cite$ -- 0
duplicate$ -- 0
empty$ -- 0
format.name$ -- 0
if$ -- 0
int.to.chr$ -- 0
int.to.str$ -- 0
missing$ -- 0
newline$ -- 0
num.names$ -- 0
pop$ -- 0
preamble$ -- 0
purify$ -- 0
quote$ -- 0
skip$ -- 0
stack$ -- 0
substring$ -- 0
swap$ -- 0
text.length$ -- 0
text.prefix$ -- 0
top$ -- 0
type$ -- 0
warning$ -- 0
while$ -- 0
width$ -- 0
write$ -- 0
(There were 2 error messages)
> Usually if there is a problem AUCTeX (in minibuffer) suggest to run 'C-c C-l'
> to see
> the log.
Thank you for correcting my incorrect understanding.
> [...]
>
> >> Since the absolute path version doesn't work, you could try something
> >> else provided by RefTeX. Otherwise you have to find the culprit in your
> >> setup. I don't think this is a RefTeX issue.
>
> > Thank you for your comment.
>
> I've made following example:
>
> ------------------------------------------------------------------------------
> \documentclass{article}
>
> \usepackage{natbib}
>
> \begin{document}
>
> Sample text. Cite: \cite{test:2021aug}.
>
> \begin{verbatim}
> (insert "\n" (format "%S" (symbol-value reftex-docstruct-symbol)))
> \end{verbatim}
>
> Another cite: \cite{test2:2021aug}.
>
> \bibliographystyle{plainnat}
> % \bibliography{sample.bib}
> \bibliography{/home/vladimir/tmp/test/sample.bib}
>
> \end{document}
>
> %%% Local Variables:
> %%% TeX-master: t
> %%% End:
> ------------------------------------------------------------------------------
>
> I open the document in Emacs (with my configuration of AUCTeX+RefTeX+CDLaTeX),
> did the same thing as Arash and got[1]
>
> ------------------------------------------------------------------------------
> (bib "/home/vladimir/tmp/test/sample.bib")
> ------------------------------------------------------------------------------
To be sure, how to eval the form in the verbatim env?
I try to eval the following in *scratch* buffer with `C-j', but obtain `nilnil':
(insert "\n" (format "%S" (symbol-value reftex-docstruct-symbol)))
nilnil
> Of course I was able to typeset the document within Emacs as well as on
> command line. Also I could insert new \cite using RefTeX 'C-c [' key as well
> as to add new items into it while point being in '\cite' macro but I didn't
> test to input several citations at one time.
Your example works for me as well. By hitting 'C-c [' key, the `SELECT
THE CITATATION FORMAT' frame will be triggered as shown in the
attachment. But I still can't figure out how to select the first
format listed on the frame, i.e. the following:
[^M] \cite [][]{%l}
Which is the ^M key?
And based on my further testing, the 'C-c [' also works with
`\string~' expansio to find the bib file, as shown in the attachment
titled by `my-original-exmaple.png'. I don't know why it doesn't work
with 'C-c [' previously.
> The second example has only one minor change: the name of bibtex file.
>
> ------------------------------------------------------------------------------
> \documentclass{article}
>
> \usepackage{natbib}
>
> \begin{document}
>
> Sample text. Cite: \cite{test:2021aug}.
>
> \begin{verbatim}
> (insert "\n" (format "%S" (symbol-value reftex-docstruct-symbol)))
> \end{verbatim}
>
> Another cite: \cite{test2:2021aug}.
>
> \bibliographystyle{plainnat}
> % \bibliography{sample.bib}
> \bibliography{/home/vladimir/tmp/test/sample2.bib}
>
> \end{document}
>
> %%% Local Variables:
> %%% TeX-master: t
> %%% End:
> ------------------------------------------------------------------------------
>
> Now there is no such bibtex file and there is no 'bib' part. And as expected
> bibtex exits "abnormally" with errors (you could see them in Emacs if run 'C-c
> C-l'):
>
> ------------------------------------------------------------------------------
> Running `BibTeX' on `doc-sample2' with ``bibtex doc-sample2.aux''
> This is BibTeX, Version 0.99d (TeX Live 2021)
> The top-level auxiliary file: doc-sample2.aux
> The style file: plainnat.bst
> I couldn't open database file /home/vladimir/tmp/test/sample2.bib
> ---line 5 of file doc-sample2.aux
> : \bibdata{/home/vladimir/tmp/test/sample2.bib
> : }
> I'm skipping whatever remains of this command
> I found no database files---while reading file doc-sample2.aux
> Warning--I didn't find a database entry for "test:2021aug"
> Warning--I didn't find a database entry for "test2:2021aug"
> (There were 2 error messages)
>
> TeX Output exited abnormally with code 2 at Wed Aug 11 09:31:05
> ------------------------------------------------------------------------------
>
> It would be helpful if you say what exactly you do and what you expect and
> didn't try to ask several unrelated questions in the same topic. Also, follow
> advices given on the mailing list and tell what exactly you run and what you
> get.
>
> I've made following bib file for tests:
>
> ------------------------------------------------------------------------------
> @article{test:2021aug,
> title = "{Some thought about testing and how people read the answers}",
> author = "Lomov V.P.",
> journal = "Philosophical Thoughts",
> year = "2021",
> vol = "08",
> pages = "133–135"
> }
>
> @article{test2:2021aug,
> title = "{Why sometimes we got angry while reading some replies on
> mailing lists?}",
> author = "Lomov V.P.",
> journal = "Philosophical Thoughts",
> year = "2021",
> vol = "08",
> pages = "143–144"
> }
>
> @article{test3:2021aug,
> title = "{How to calm down yourself when replying to someone}",
> author = "Lomov V.P.",
> journal = "Philosophical Thoughts",
> year = "2021",
> vol = "08",
> pages = "150–151"
> }
> ------------------------------------------------------------------------------
>
> --- NOTES ---
>
> [1] To be honest when I open document first time in Emacs I got 'nil'. To get
> correct result I had to run either 'Ref -> Parse Document -> Entire Document'
> or to try insert citation using 'C-u C-c [' which forces document parsing. The
> necessary information is written to .rel file.
Without using the above trick, only `C-c [' will work on my side with
your example. OTOH, even I run the above step, I still can't find the
.rel file.
Best, Hongyi
--
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
cite.png
Description: PNG image
my-original-exmaple.png
Description: PNG image
- Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/03
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Arash Esbati, 2021/08/08
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/08
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Arash Esbati, 2021/08/09
- Message not available
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Arash Esbati, 2021/08/10
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/10
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Vladimir Lomov, 2021/08/10
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search.,
Hongyi Zhao <=
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/11
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Vladimir Lomov, 2021/08/11
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/11
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Vladimir Lomov, 2021/08/11
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/12
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/12
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Vladimir Lomov, 2021/08/12
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/12
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Hongyi Zhao, 2021/08/12
- Re: Select and insert multiple bibliography entries into one \cite command with regexp search., Vladimir Lomov, 2021/08/12