Preliminary remark
This problem is constantly annoying me, so I'd like to find a solution. From my experience with biber
I thought I would just need to copy/rename some files created by bibtex
to make it work (see my examples below), but with bibtex
it seems to be not that easy.
So my second idea seems more practical: extracting the list of cited references and then citing all of them with a nocite
command (see details of my idea below):
Background of my question
I'm often using the "compile region" command in Emacs auctex-mode
to compile only the current paragraph and quickly see, if my editing had the wished result.
However, citations are not handled properly, as in the region there is only a subset of the references cited, so the numeric citekey [95] is different (and that can have also consequences on linebreaks and typesetting.
So I'd like to find a way to let the region use the same (long) list of references as the complete document and cite accordingly.
Some ideas for a solution (my knowledge is not sufficient to make it work automagically)
Maybe it would make sense to regularly extract all cited references from the main document and then somehow add a
\nocite{ref1, ref2, ... ref350}
command to the region file.
Maybe I should create a custom bibliography file for the main file and just add\nocite{*}
to the preamble. This would only be problematic when citing new references, then I would have to refresh the custom .bib file...- how can I extract the cited references of the master document?
- can I modify the region file in
auctex
and append a\nocite{ref1, ref2, ..., refn)
command, which uses the extracted list of references? - alternatively: could I create a custom bibliography file for the master file which only contains the cited references and then add
\nocite{*}
to my preamble?
But then: what if I would remove all citations of one of those references from the text body? Can I then still find out in the aux files, which ones are only cited vianocite
and which ones are really cited by a\cite{)
(or similar) command?
Can I copy some of the original files to
_region_....
and thus let the region use the same bibliography order and numbers?If I copy the .aux file from the main document to
_region_.aux
, I get the correct numbering of my references, but this aux file is overwritten at each latex run. Furthermore, typesetting/placing of some tables and floats like longtables etc. might take 2 pdflatex runs and by just overwriting the .aux file before each pdflatex run, I assume I'd loose information necessary for the second pdflatex run.- the order and numbering of the references seems to be written in lines like this one:
\abx@aux@number{25}{chiu}{0}{20}
. Might it make sense to grab just those lines from the aux file of the complete document and append them to the_region_.aux
file? I am not successful with my large document, as those lines seem to be overwritten each time I compile withpdflatex
.
I tried like that:grep -i \abx@aux@number main.aux >> _region_.aux
, but that has no effect - particularly, as in region.aux there are no similar lines created if I compile the document fromauctex
, but still the same source gets another numerical cite key...
Example
Main file BibtexRegion_FullDocument.tex
\documentclass{scrbook}
\usepackage[natbib=true, style=numeric-comp, backend=bibtex8, defernumbers, useprefix,firstinits=true, maxnames=99, maxcitenames=3]{biblatex} % für bessere Literaturverzeichnisse
\addbibresource{biblatex-examples.bib}
\begin{document}
\nocite{*}
This document has 2 paragraphs. This is the first one.
This is the second one and it cites \textcite{chiu}.
\printbibliography
\end{document}
- this works in with TeXLive 2014, as it uses the
biblatex
example bibliography.
result: \cite{chiu}
becomes [20]
Auctex creates the following region file _region_.tex
:
If I only mark the second paragraph, and compile the region, auctex
creates the following tex file
\message{ !name(BibtexRegion_FullDocument.tex)}
\documentclass{scrbook}
\usepackage[natbib=true, style=numeric-comp, backend=bibtex8, defernumbers, useprefix,firstinits=true, maxnames=99, maxcitenames=3]{biblatex} % für bessere Literaturverzeichnisse
\addbibresource{biblatex-examples.bib}
\begin{document}
\message{ !name(BibtexRegion_FullDocument.tex) !offset(4) }
This is the second one and it cites \textcite{chiu}.
\message{ !name(BibtexRegion_FullDocument.tex) !offset(6) }
\end{document}
Result: \cite{chiu}
becomes 1 - how can I get [20] here too?
Files in directory
-rw-r--r-- 1 mbg4 admin 306 6 Mär 11:05 BibtexRegion_FullDocument-blx.bib
-rw-r--r-- 1 mbg4 admin 3933 6 Mär 11:05 BibtexRegion_FullDocument.aux
-rw-r--r-- 1 mbg4 admin 84175 6 Mär 11:05 BibtexRegion_FullDocument.bbl
-rw-r--r-- 1 mbg4 admin 1986 6 Mär 11:05 BibtexRegion_FullDocument.blg
-rw-r--r-- 1 mbg4 admin 14524 6 Mär 11:05 BibtexRegion_FullDocument.log
-rw-r--r-- 1 mbg4 admin 39 6 Mär 11:01 BibtexRegion_FullDocument.out
-rw-r--r-- 1 mbg4 admin 114343 6 Mär 11:05 BibtexRegion_FullDocument.pdf
-rw-r--r-- 1 mbg4 admin 2765 6 Mär 11:05 BibtexRegion_FullDocument.run.xml
-rw-r--r-- 1 mbg4 admin 50679 6 Mär 11:05 BibtexRegion_FullDocument.synctex.gz
-rw-r--r-- 1 mbg4 admin 433 6 Mär 11:04 BibtexRegion_FullDocument.tex
-rw-r--r-- 1 mbg4 admin 306 6 Mär 11:06 _region_-blx.bib
-rw-r--r-- 1 mbg4 admin 495 6 Mär 11:06 _region_.aux
-rw-r--r-- 1 mbg4 admin 1394 6 Mär 11:05 _region_.bbl
-rw-r--r-- 1 mbg4 admin 1770 6 Mär 11:05 _region_.blg
-rw-r--r-- 1 mbg4 admin 13209 6 Mär 11:06 _region_.log
-rw-r--r-- 1 mbg4 admin 0 6 Mär 11:03 _region_.out
-rw-r--r-- 1 mbg4 admin 13426 6 Mär 11:06 _region_.pdf
-rw-r--r-- 1 mbg4 admin 2612 6 Mär 11:06 _region_.run.xml
-rw-r--r-- 1 mbg4 admin 942 6 Mär 11:06 _region_.synctex.gz
-rw-r--r-- 1 mbg4 admin 508 6 Mär 11:05 _region_.tex
\include
+\includeonly
does. – giordano Mar 10 '15 at 10:03_region_.aux
withBibtexRegion_FullDocument.aux
, run latex withC-c C-r
just once and view the output. But you should do this every time before running latex withC-c C-r
, as this always overwrites the auxiliary file. – giordano Mar 10 '15 at 10:28bibtex
or are the original files linked by the copied .aux file? – MostlyHarmless Mar 10 '15 at 11:27