How to import / print a bibliography created from a separate / external document?












7















I have a document with a bibliography that I create using biblatex with the biber backend. I.e., somewhere in this document, there is a line



printbibliography


which prints the bibliography (say what).



Now I am required to create an additional cover letter which repeats the bibliography. This is a different document (in a different directory if that matters) and I was wondering if there is a way to persuade biblatex to print the bibliography at the end of the cover letter again when I compile it. (That would, of course, require the original document to always be compiled first, but that I would manage.)



Any ideas?



(I could just copy over the pages with bibliography with pdfpages but that's ugly because that would have wrong page numbers and I would always have to adjust the page range, should it change in the original file.)










share|improve this question























  • A first idea, not sure if exactly what you want. Based on the first document, you can extract a bib file only with your cited entries (see tex.stackexchange.com/q/41821/105447). Then on the second one, a nocite{*} plus printbibliography would do. True, every time the first document is changed, the extraction step would have to be repeated.

    – gusbrs
    Apr 17 '18 at 10:09






  • 1





    I'd just go for adding an extra page at the end where you re-print the bibliography, setting the page counter as required, then post-process using a PDF extraction tool. Probably not the solution you want ...

    – Joseph Wright
    Apr 17 '18 at 10:53
















7















I have a document with a bibliography that I create using biblatex with the biber backend. I.e., somewhere in this document, there is a line



printbibliography


which prints the bibliography (say what).



Now I am required to create an additional cover letter which repeats the bibliography. This is a different document (in a different directory if that matters) and I was wondering if there is a way to persuade biblatex to print the bibliography at the end of the cover letter again when I compile it. (That would, of course, require the original document to always be compiled first, but that I would manage.)



Any ideas?



(I could just copy over the pages with bibliography with pdfpages but that's ugly because that would have wrong page numbers and I would always have to adjust the page range, should it change in the original file.)










share|improve this question























  • A first idea, not sure if exactly what you want. Based on the first document, you can extract a bib file only with your cited entries (see tex.stackexchange.com/q/41821/105447). Then on the second one, a nocite{*} plus printbibliography would do. True, every time the first document is changed, the extraction step would have to be repeated.

    – gusbrs
    Apr 17 '18 at 10:09






  • 1





    I'd just go for adding an extra page at the end where you re-print the bibliography, setting the page counter as required, then post-process using a PDF extraction tool. Probably not the solution you want ...

    – Joseph Wright
    Apr 17 '18 at 10:53














7












7








7


1






I have a document with a bibliography that I create using biblatex with the biber backend. I.e., somewhere in this document, there is a line



printbibliography


which prints the bibliography (say what).



Now I am required to create an additional cover letter which repeats the bibliography. This is a different document (in a different directory if that matters) and I was wondering if there is a way to persuade biblatex to print the bibliography at the end of the cover letter again when I compile it. (That would, of course, require the original document to always be compiled first, but that I would manage.)



Any ideas?



(I could just copy over the pages with bibliography with pdfpages but that's ugly because that would have wrong page numbers and I would always have to adjust the page range, should it change in the original file.)










share|improve this question














I have a document with a bibliography that I create using biblatex with the biber backend. I.e., somewhere in this document, there is a line



printbibliography


which prints the bibliography (say what).



Now I am required to create an additional cover letter which repeats the bibliography. This is a different document (in a different directory if that matters) and I was wondering if there is a way to persuade biblatex to print the bibliography at the end of the cover letter again when I compile it. (That would, of course, require the original document to always be compiled first, but that I would manage.)



Any ideas?



(I could just copy over the pages with bibliography with pdfpages but that's ugly because that would have wrong page numbers and I would always have to adjust the page range, should it change in the original file.)







biblatex external-files






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 17 '18 at 9:21









fuenfundachtzigfuenfundachtzig

4,707123858




4,707123858













  • A first idea, not sure if exactly what you want. Based on the first document, you can extract a bib file only with your cited entries (see tex.stackexchange.com/q/41821/105447). Then on the second one, a nocite{*} plus printbibliography would do. True, every time the first document is changed, the extraction step would have to be repeated.

    – gusbrs
    Apr 17 '18 at 10:09






  • 1





    I'd just go for adding an extra page at the end where you re-print the bibliography, setting the page counter as required, then post-process using a PDF extraction tool. Probably not the solution you want ...

    – Joseph Wright
    Apr 17 '18 at 10:53



















  • A first idea, not sure if exactly what you want. Based on the first document, you can extract a bib file only with your cited entries (see tex.stackexchange.com/q/41821/105447). Then on the second one, a nocite{*} plus printbibliography would do. True, every time the first document is changed, the extraction step would have to be repeated.

    – gusbrs
    Apr 17 '18 at 10:09






  • 1





    I'd just go for adding an extra page at the end where you re-print the bibliography, setting the page counter as required, then post-process using a PDF extraction tool. Probably not the solution you want ...

    – Joseph Wright
    Apr 17 '18 at 10:53

















A first idea, not sure if exactly what you want. Based on the first document, you can extract a bib file only with your cited entries (see tex.stackexchange.com/q/41821/105447). Then on the second one, a nocite{*} plus printbibliography would do. True, every time the first document is changed, the extraction step would have to be repeated.

– gusbrs
Apr 17 '18 at 10:09





A first idea, not sure if exactly what you want. Based on the first document, you can extract a bib file only with your cited entries (see tex.stackexchange.com/q/41821/105447). Then on the second one, a nocite{*} plus printbibliography would do. True, every time the first document is changed, the extraction step would have to be repeated.

– gusbrs
Apr 17 '18 at 10:09




1




1





I'd just go for adding an extra page at the end where you re-print the bibliography, setting the page counter as required, then post-process using a PDF extraction tool. Probably not the solution you want ...

– Joseph Wright
Apr 17 '18 at 10:53





I'd just go for adding an extra page at the end where you re-print the bibliography, setting the page counter as required, then post-process using a PDF extraction tool. Probably not the solution you want ...

– Joseph Wright
Apr 17 '18 at 10:53










1 Answer
1






active

oldest

votes


















7














There is no interface to import the exact bibliography of another document. But in certain situations work-arounds are available.



All the information for citations and the bibliography lives in the .bbl file. That file is written by Biber following requests by biblatex in the .bcf file. So you can try to import the .bbl file of the other document to obtain its bibliography. This works as long as the set-up in both documents is simple: You can't have multiple refsections, the importing document can't cite sources that were not cited in the original document, etc.



Assuming you have a document called docmain.tex with citations and bibliography that has gone through the complete compilation sequence of LaTeX, Biber , LaTeX, LaTeX you can then import the bibliography from docmain (it lives in docmain.bbl so that file must exist) in another document (coverletter.tex) with



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

makeatletter
newcommand*{importbibfrom}[1]{%
defblx@bblfile{%
blx@secinit
begingroup
blx@bblstart
InputIfFileExists{#1.bbl}
{blx@info@noline{... file '#1.bbl' found}%
globaltoggletrue{blx@bbldone}}
{blx@info@noline{... file '#1.bbl' not found}%
typeout{No file #1.bbl.}}%
blx@bblend
endgroup
% global sorting as this is called at BeginDocument
csnumgdef{blx@labelnumber@thec@refsection}{0}}}

globalletblx@rerun@biberrelax
makeatother

importbibfrom{docmain}

begin{document}
cite{sigfridsson}
printbibliography
end{document}


You only need to compile the importing document coverletter with LaTeX (at least twice), don't run Biber on that file.



You can cite all entries that are in the bibliography and get the exact same bibliography as maindoc.tex.



Assuming maindoc.tex was



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
cite{sigfridsson,vizedom:related}
printbibliography
end{document}


the coverletter.tex from above yields



enter image description here



edit: See how to use refsection and xcite together for guidance on how to use different refsections and for help with defernumbers.






share|improve this answer


























  • Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

    – fuenfundachtzig
    Apr 17 '18 at 11:43











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f426964%2fhow-to-import-print-a-bibliography-created-from-a-separate-external-document%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









7














There is no interface to import the exact bibliography of another document. But in certain situations work-arounds are available.



All the information for citations and the bibliography lives in the .bbl file. That file is written by Biber following requests by biblatex in the .bcf file. So you can try to import the .bbl file of the other document to obtain its bibliography. This works as long as the set-up in both documents is simple: You can't have multiple refsections, the importing document can't cite sources that were not cited in the original document, etc.



Assuming you have a document called docmain.tex with citations and bibliography that has gone through the complete compilation sequence of LaTeX, Biber , LaTeX, LaTeX you can then import the bibliography from docmain (it lives in docmain.bbl so that file must exist) in another document (coverletter.tex) with



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

makeatletter
newcommand*{importbibfrom}[1]{%
defblx@bblfile{%
blx@secinit
begingroup
blx@bblstart
InputIfFileExists{#1.bbl}
{blx@info@noline{... file '#1.bbl' found}%
globaltoggletrue{blx@bbldone}}
{blx@info@noline{... file '#1.bbl' not found}%
typeout{No file #1.bbl.}}%
blx@bblend
endgroup
% global sorting as this is called at BeginDocument
csnumgdef{blx@labelnumber@thec@refsection}{0}}}

globalletblx@rerun@biberrelax
makeatother

importbibfrom{docmain}

begin{document}
cite{sigfridsson}
printbibliography
end{document}


You only need to compile the importing document coverletter with LaTeX (at least twice), don't run Biber on that file.



You can cite all entries that are in the bibliography and get the exact same bibliography as maindoc.tex.



Assuming maindoc.tex was



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
cite{sigfridsson,vizedom:related}
printbibliography
end{document}


the coverletter.tex from above yields



enter image description here



edit: See how to use refsection and xcite together for guidance on how to use different refsections and for help with defernumbers.






share|improve this answer


























  • Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

    – fuenfundachtzig
    Apr 17 '18 at 11:43
















7














There is no interface to import the exact bibliography of another document. But in certain situations work-arounds are available.



All the information for citations and the bibliography lives in the .bbl file. That file is written by Biber following requests by biblatex in the .bcf file. So you can try to import the .bbl file of the other document to obtain its bibliography. This works as long as the set-up in both documents is simple: You can't have multiple refsections, the importing document can't cite sources that were not cited in the original document, etc.



Assuming you have a document called docmain.tex with citations and bibliography that has gone through the complete compilation sequence of LaTeX, Biber , LaTeX, LaTeX you can then import the bibliography from docmain (it lives in docmain.bbl so that file must exist) in another document (coverletter.tex) with



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

makeatletter
newcommand*{importbibfrom}[1]{%
defblx@bblfile{%
blx@secinit
begingroup
blx@bblstart
InputIfFileExists{#1.bbl}
{blx@info@noline{... file '#1.bbl' found}%
globaltoggletrue{blx@bbldone}}
{blx@info@noline{... file '#1.bbl' not found}%
typeout{No file #1.bbl.}}%
blx@bblend
endgroup
% global sorting as this is called at BeginDocument
csnumgdef{blx@labelnumber@thec@refsection}{0}}}

globalletblx@rerun@biberrelax
makeatother

importbibfrom{docmain}

begin{document}
cite{sigfridsson}
printbibliography
end{document}


You only need to compile the importing document coverletter with LaTeX (at least twice), don't run Biber on that file.



You can cite all entries that are in the bibliography and get the exact same bibliography as maindoc.tex.



Assuming maindoc.tex was



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
cite{sigfridsson,vizedom:related}
printbibliography
end{document}


the coverletter.tex from above yields



enter image description here



edit: See how to use refsection and xcite together for guidance on how to use different refsections and for help with defernumbers.






share|improve this answer


























  • Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

    – fuenfundachtzig
    Apr 17 '18 at 11:43














7












7








7







There is no interface to import the exact bibliography of another document. But in certain situations work-arounds are available.



All the information for citations and the bibliography lives in the .bbl file. That file is written by Biber following requests by biblatex in the .bcf file. So you can try to import the .bbl file of the other document to obtain its bibliography. This works as long as the set-up in both documents is simple: You can't have multiple refsections, the importing document can't cite sources that were not cited in the original document, etc.



Assuming you have a document called docmain.tex with citations and bibliography that has gone through the complete compilation sequence of LaTeX, Biber , LaTeX, LaTeX you can then import the bibliography from docmain (it lives in docmain.bbl so that file must exist) in another document (coverletter.tex) with



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

makeatletter
newcommand*{importbibfrom}[1]{%
defblx@bblfile{%
blx@secinit
begingroup
blx@bblstart
InputIfFileExists{#1.bbl}
{blx@info@noline{... file '#1.bbl' found}%
globaltoggletrue{blx@bbldone}}
{blx@info@noline{... file '#1.bbl' not found}%
typeout{No file #1.bbl.}}%
blx@bblend
endgroup
% global sorting as this is called at BeginDocument
csnumgdef{blx@labelnumber@thec@refsection}{0}}}

globalletblx@rerun@biberrelax
makeatother

importbibfrom{docmain}

begin{document}
cite{sigfridsson}
printbibliography
end{document}


You only need to compile the importing document coverletter with LaTeX (at least twice), don't run Biber on that file.



You can cite all entries that are in the bibliography and get the exact same bibliography as maindoc.tex.



Assuming maindoc.tex was



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
cite{sigfridsson,vizedom:related}
printbibliography
end{document}


the coverletter.tex from above yields



enter image description here



edit: See how to use refsection and xcite together for guidance on how to use different refsections and for help with defernumbers.






share|improve this answer















There is no interface to import the exact bibliography of another document. But in certain situations work-arounds are available.



All the information for citations and the bibliography lives in the .bbl file. That file is written by Biber following requests by biblatex in the .bcf file. So you can try to import the .bbl file of the other document to obtain its bibliography. This works as long as the set-up in both documents is simple: You can't have multiple refsections, the importing document can't cite sources that were not cited in the original document, etc.



Assuming you have a document called docmain.tex with citations and bibliography that has gone through the complete compilation sequence of LaTeX, Biber , LaTeX, LaTeX you can then import the bibliography from docmain (it lives in docmain.bbl so that file must exist) in another document (coverletter.tex) with



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

makeatletter
newcommand*{importbibfrom}[1]{%
defblx@bblfile{%
blx@secinit
begingroup
blx@bblstart
InputIfFileExists{#1.bbl}
{blx@info@noline{... file '#1.bbl' found}%
globaltoggletrue{blx@bbldone}}
{blx@info@noline{... file '#1.bbl' not found}%
typeout{No file #1.bbl.}}%
blx@bblend
endgroup
% global sorting as this is called at BeginDocument
csnumgdef{blx@labelnumber@thec@refsection}{0}}}

globalletblx@rerun@biberrelax
makeatother

importbibfrom{docmain}

begin{document}
cite{sigfridsson}
printbibliography
end{document}


You only need to compile the importing document coverletter with LaTeX (at least twice), don't run Biber on that file.



You can cite all entries that are in the bibliography and get the exact same bibliography as maindoc.tex.



Assuming maindoc.tex was



documentclass[american]{article}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}
usepackage[style=authoryear, backend=biber]{biblatex}

addbibresource{biblatex-examples.bib}

begin{document}
cite{sigfridsson,vizedom:related}
printbibliography
end{document}


the coverletter.tex from above yields



enter image description here



edit: See how to use refsection and xcite together for guidance on how to use different refsections and for help with defernumbers.







share|improve this answer














share|improve this answer



share|improve this answer








edited Feb 5 at 9:59

























answered Apr 17 '18 at 10:51









moewemoewe

90.5k10111341




90.5k10111341













  • Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

    – fuenfundachtzig
    Apr 17 '18 at 11:43



















  • Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

    – fuenfundachtzig
    Apr 17 '18 at 11:43

















Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

– fuenfundachtzig
Apr 17 '18 at 11:43





Thanks, this solves my problem. My hacky solution so far was to copy and rename the bbl file (from maindoc.bbl to coverletter.bbl in your notation) but your importbibfrom command is certainly more elegant.

– fuenfundachtzig
Apr 17 '18 at 11:43


















draft saved

draft discarded




















































Thanks for contributing an answer to TeX - LaTeX Stack Exchange!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f426964%2fhow-to-import-print-a-bibliography-created-from-a-separate-external-document%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

How to change which sound is reproduced for terminal bell?

Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

Can I use Tabulator js library in my java Spring + Thymeleaf project?