Biblatex: dual referencing (both by end of chapter and at the end of the document) on...












0















I have been using LaTeX the "Clas­sicTh­e­sis" template by Dr. André Miede v. 4.6, for my dissertation/thesis document. However I require to have my references at end of each chapter as well as my "bibliography" at the end of the document/dissertation. I have tried to add commands like:



begin{refsection},

printbibliography[heading=subbibliography],

end{refsection}


but I keep getting error. Could it be possible someone provide me with step by step guild on how to modify this template as it contains few configuration files?




  • The ["Clas­sicTh­e­sis"] produces numeric bibliography at the end of the document with respect to the global bibliography file.

  • Could it be possible each chapter refer to separate bibliography file. and end of document bibliography refer to the global bibliography file.

  • I could have alphabetic or the numeric references, in case of numeric, could each chapter citation have a form like "1-12" where 1 refer to chapter number and 12 referring to 12th reference.










share|improve this question




















  • 1





    Can you show us a simplified version of what you have so far (an MWE/MWEB: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? What bibliography style are you using? How exactly would the 'global' bibliography look like? How would it be sorted? Does the citation numbering restart in each chapter, how would that work in the global bib at the end? ...

    – moewe
    Apr 2 at 15:43








  • 1





    Very relevant: tex.stackexchange.com/q/168713/35864, tex.stackexchange.com/q/49941/35864

    – moewe
    Apr 2 at 15:46








  • 1





    I can see this working for an alphabetic or authoryear bibliography. But the default bib style in classicthesis is numeric and with that style I am having some trouble figuring out what should happen. If you sort your entries with sorting=nty or nyt (and don't say defernumbers=true) then the global bibliography at the end would have continuous numbering (nice), but the per-chapter bibliographies may skip certain numbers (not so nice). With sorting=nyt/nty and defernumbers=true the per-chapter bibliographies would have continuous numbering, but ...

    – moewe
    Apr 2 at 15:53






  • 1





    ... the global bibliography at the end would not have continuous numbering. (One caveat is that entries which appear in multiple per-chapter bibs may crash out of the numbering) .With sorting=none the situation would be similar to the situation with defernumbers=false: The global bib is continuous, the other bibs skip numbers (nut only if you cite the same source in different chapters, if you don't do that then the numbering will be continuous even in the per-chapter bibs). All of these options have drawbacks that make them quite unattractive on first sight.

    – moewe
    Apr 2 at 16:00













  • Dear Moewe, thanks for your comments. I have modified my question to address some clarification points. As I am new with LaTeX, could you please let me know where / which file I need to modify to get the proper result.

    – Michael R.
    Apr 2 at 17:05
















0















I have been using LaTeX the "Clas­sicTh­e­sis" template by Dr. André Miede v. 4.6, for my dissertation/thesis document. However I require to have my references at end of each chapter as well as my "bibliography" at the end of the document/dissertation. I have tried to add commands like:



begin{refsection},

printbibliography[heading=subbibliography],

end{refsection}


but I keep getting error. Could it be possible someone provide me with step by step guild on how to modify this template as it contains few configuration files?




  • The ["Clas­sicTh­e­sis"] produces numeric bibliography at the end of the document with respect to the global bibliography file.

  • Could it be possible each chapter refer to separate bibliography file. and end of document bibliography refer to the global bibliography file.

  • I could have alphabetic or the numeric references, in case of numeric, could each chapter citation have a form like "1-12" where 1 refer to chapter number and 12 referring to 12th reference.










share|improve this question




















  • 1





    Can you show us a simplified version of what you have so far (an MWE/MWEB: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? What bibliography style are you using? How exactly would the 'global' bibliography look like? How would it be sorted? Does the citation numbering restart in each chapter, how would that work in the global bib at the end? ...

    – moewe
    Apr 2 at 15:43








  • 1





    Very relevant: tex.stackexchange.com/q/168713/35864, tex.stackexchange.com/q/49941/35864

    – moewe
    Apr 2 at 15:46








  • 1





    I can see this working for an alphabetic or authoryear bibliography. But the default bib style in classicthesis is numeric and with that style I am having some trouble figuring out what should happen. If you sort your entries with sorting=nty or nyt (and don't say defernumbers=true) then the global bibliography at the end would have continuous numbering (nice), but the per-chapter bibliographies may skip certain numbers (not so nice). With sorting=nyt/nty and defernumbers=true the per-chapter bibliographies would have continuous numbering, but ...

    – moewe
    Apr 2 at 15:53






  • 1





    ... the global bibliography at the end would not have continuous numbering. (One caveat is that entries which appear in multiple per-chapter bibs may crash out of the numbering) .With sorting=none the situation would be similar to the situation with defernumbers=false: The global bib is continuous, the other bibs skip numbers (nut only if you cite the same source in different chapters, if you don't do that then the numbering will be continuous even in the per-chapter bibs). All of these options have drawbacks that make them quite unattractive on first sight.

    – moewe
    Apr 2 at 16:00













  • Dear Moewe, thanks for your comments. I have modified my question to address some clarification points. As I am new with LaTeX, could you please let me know where / which file I need to modify to get the proper result.

    – Michael R.
    Apr 2 at 17:05














0












0








0








I have been using LaTeX the "Clas­sicTh­e­sis" template by Dr. André Miede v. 4.6, for my dissertation/thesis document. However I require to have my references at end of each chapter as well as my "bibliography" at the end of the document/dissertation. I have tried to add commands like:



begin{refsection},

printbibliography[heading=subbibliography],

end{refsection}


but I keep getting error. Could it be possible someone provide me with step by step guild on how to modify this template as it contains few configuration files?




  • The ["Clas­sicTh­e­sis"] produces numeric bibliography at the end of the document with respect to the global bibliography file.

  • Could it be possible each chapter refer to separate bibliography file. and end of document bibliography refer to the global bibliography file.

  • I could have alphabetic or the numeric references, in case of numeric, could each chapter citation have a form like "1-12" where 1 refer to chapter number and 12 referring to 12th reference.










share|improve this question
















I have been using LaTeX the "Clas­sicTh­e­sis" template by Dr. André Miede v. 4.6, for my dissertation/thesis document. However I require to have my references at end of each chapter as well as my "bibliography" at the end of the document/dissertation. I have tried to add commands like:



begin{refsection},

printbibliography[heading=subbibliography],

end{refsection}


but I keep getting error. Could it be possible someone provide me with step by step guild on how to modify this template as it contains few configuration files?




  • The ["Clas­sicTh­e­sis"] produces numeric bibliography at the end of the document with respect to the global bibliography file.

  • Could it be possible each chapter refer to separate bibliography file. and end of document bibliography refer to the global bibliography file.

  • I could have alphabetic or the numeric references, in case of numeric, could each chapter citation have a form like "1-12" where 1 refer to chapter number and 12 referring to 12th reference.







biblatex cross-referencing classicthesis






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Apr 2 at 17:51







Michael R.

















asked Apr 2 at 15:29









Michael R.Michael R.

11




11








  • 1





    Can you show us a simplified version of what you have so far (an MWE/MWEB: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? What bibliography style are you using? How exactly would the 'global' bibliography look like? How would it be sorted? Does the citation numbering restart in each chapter, how would that work in the global bib at the end? ...

    – moewe
    Apr 2 at 15:43








  • 1





    Very relevant: tex.stackexchange.com/q/168713/35864, tex.stackexchange.com/q/49941/35864

    – moewe
    Apr 2 at 15:46








  • 1





    I can see this working for an alphabetic or authoryear bibliography. But the default bib style in classicthesis is numeric and with that style I am having some trouble figuring out what should happen. If you sort your entries with sorting=nty or nyt (and don't say defernumbers=true) then the global bibliography at the end would have continuous numbering (nice), but the per-chapter bibliographies may skip certain numbers (not so nice). With sorting=nyt/nty and defernumbers=true the per-chapter bibliographies would have continuous numbering, but ...

    – moewe
    Apr 2 at 15:53






  • 1





    ... the global bibliography at the end would not have continuous numbering. (One caveat is that entries which appear in multiple per-chapter bibs may crash out of the numbering) .With sorting=none the situation would be similar to the situation with defernumbers=false: The global bib is continuous, the other bibs skip numbers (nut only if you cite the same source in different chapters, if you don't do that then the numbering will be continuous even in the per-chapter bibs). All of these options have drawbacks that make them quite unattractive on first sight.

    – moewe
    Apr 2 at 16:00













  • Dear Moewe, thanks for your comments. I have modified my question to address some clarification points. As I am new with LaTeX, could you please let me know where / which file I need to modify to get the proper result.

    – Michael R.
    Apr 2 at 17:05














  • 1





    Can you show us a simplified version of what you have so far (an MWE/MWEB: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? What bibliography style are you using? How exactly would the 'global' bibliography look like? How would it be sorted? Does the citation numbering restart in each chapter, how would that work in the global bib at the end? ...

    – moewe
    Apr 2 at 15:43








  • 1





    Very relevant: tex.stackexchange.com/q/168713/35864, tex.stackexchange.com/q/49941/35864

    – moewe
    Apr 2 at 15:46








  • 1





    I can see this working for an alphabetic or authoryear bibliography. But the default bib style in classicthesis is numeric and with that style I am having some trouble figuring out what should happen. If you sort your entries with sorting=nty or nyt (and don't say defernumbers=true) then the global bibliography at the end would have continuous numbering (nice), but the per-chapter bibliographies may skip certain numbers (not so nice). With sorting=nyt/nty and defernumbers=true the per-chapter bibliographies would have continuous numbering, but ...

    – moewe
    Apr 2 at 15:53






  • 1





    ... the global bibliography at the end would not have continuous numbering. (One caveat is that entries which appear in multiple per-chapter bibs may crash out of the numbering) .With sorting=none the situation would be similar to the situation with defernumbers=false: The global bib is continuous, the other bibs skip numbers (nut only if you cite the same source in different chapters, if you don't do that then the numbering will be continuous even in the per-chapter bibs). All of these options have drawbacks that make them quite unattractive on first sight.

    – moewe
    Apr 2 at 16:00













  • Dear Moewe, thanks for your comments. I have modified my question to address some clarification points. As I am new with LaTeX, could you please let me know where / which file I need to modify to get the proper result.

    – Michael R.
    Apr 2 at 17:05








1




1





Can you show us a simplified version of what you have so far (an MWE/MWEB: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? What bibliography style are you using? How exactly would the 'global' bibliography look like? How would it be sorted? Does the citation numbering restart in each chapter, how would that work in the global bib at the end? ...

– moewe
Apr 2 at 15:43







Can you show us a simplified version of what you have so far (an MWE/MWEB: tex.meta.stackexchange.com/q/228/35864, tex.meta.stackexchange.com/q/4407/35864)? What bibliography style are you using? How exactly would the 'global' bibliography look like? How would it be sorted? Does the citation numbering restart in each chapter, how would that work in the global bib at the end? ...

– moewe
Apr 2 at 15:43






1




1





Very relevant: tex.stackexchange.com/q/168713/35864, tex.stackexchange.com/q/49941/35864

– moewe
Apr 2 at 15:46







Very relevant: tex.stackexchange.com/q/168713/35864, tex.stackexchange.com/q/49941/35864

– moewe
Apr 2 at 15:46






1




1





I can see this working for an alphabetic or authoryear bibliography. But the default bib style in classicthesis is numeric and with that style I am having some trouble figuring out what should happen. If you sort your entries with sorting=nty or nyt (and don't say defernumbers=true) then the global bibliography at the end would have continuous numbering (nice), but the per-chapter bibliographies may skip certain numbers (not so nice). With sorting=nyt/nty and defernumbers=true the per-chapter bibliographies would have continuous numbering, but ...

– moewe
Apr 2 at 15:53





I can see this working for an alphabetic or authoryear bibliography. But the default bib style in classicthesis is numeric and with that style I am having some trouble figuring out what should happen. If you sort your entries with sorting=nty or nyt (and don't say defernumbers=true) then the global bibliography at the end would have continuous numbering (nice), but the per-chapter bibliographies may skip certain numbers (not so nice). With sorting=nyt/nty and defernumbers=true the per-chapter bibliographies would have continuous numbering, but ...

– moewe
Apr 2 at 15:53




1




1





... the global bibliography at the end would not have continuous numbering. (One caveat is that entries which appear in multiple per-chapter bibs may crash out of the numbering) .With sorting=none the situation would be similar to the situation with defernumbers=false: The global bib is continuous, the other bibs skip numbers (nut only if you cite the same source in different chapters, if you don't do that then the numbering will be continuous even in the per-chapter bibs). All of these options have drawbacks that make them quite unattractive on first sight.

– moewe
Apr 2 at 16:00







... the global bibliography at the end would not have continuous numbering. (One caveat is that entries which appear in multiple per-chapter bibs may crash out of the numbering) .With sorting=none the situation would be similar to the situation with defernumbers=false: The global bib is continuous, the other bibs skip numbers (nut only if you cite the same source in different chapters, if you don't do that then the numbering will be continuous even in the per-chapter bibs). All of these options have drawbacks that make them quite unattractive on first sight.

– moewe
Apr 2 at 16:00















Dear Moewe, thanks for your comments. I have modified my question to address some clarification points. As I am new with LaTeX, could you please let me know where / which file I need to modify to get the proper result.

– Michael R.
Apr 2 at 17:05





Dear Moewe, thanks for your comments. I have modified my question to address some clarification points. As I am new with LaTeX, could you please let me know where / which file I need to modify to get the proper result.

– Michael R.
Apr 2 at 17:05










1 Answer
1






active

oldest

votes


















1














This is actually surprisingly complicated (or maybe not so surprisingly given the fundamental complexity of such a set-up that I mentioned in the comments before your edit).



If you want separate bibliographies for each chapter, where an item will appear with a chapter prefix you need to use refsections. Otherwise (with refsegments) an entry cited in several chapters would get the same prefix in every chapter and so an item cited in chapters 1 and 3 would always be cited as "1-4" even in chapter 3, that would look odd. But with refsections it becomes much more complicated to produce an overall bibliography at the end. Even more so when we need labelprefix and thus refcontexts. bibbysection can be used to print bibliographies for all refsections one by one, but we need an additional hack to fix the refcontext as expected. The hack is adding a newrefcontext to the internal command blx@refsections. But we need to know the correct labelprefix here, so we need to remember it with another special command: savechapterrefsection.



So you need the bit between makeatletter...makeatother in your preamble. You also need to issue



newrefsection
newrefcontext[labelprefix=thechapter-]
savechapterrefsection


directly after every chapter command. At the end of the chapter you can say



printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


to get the per-chapter bibliography.



At the end of your document you say



printbibheading[title=Overall bibname]
bibbysection[heading=none]


to print the complete bibliography.



In total



documentclass[british]{report}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}
usepackage{babel}
usepackage{csquotes}

usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

makeatletter
newcommand*{savechapterrefsection}{%
csxdef{chapter@for@refsection@therefsection}{thechapter}}

defblx@refsections{%
newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
{}
{toggletrue{blx@tempa}%
begingroup
expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
ifnumc@refsection<blx@maxsection
advancec@refsection@ne
expandafterblx@refsections
else
iftoggle{blx@tempa}{}{blx@warn@bibempty}%
endgroup
fi}
makeatother

addbibresource{biblatex-examples.bib}

begin{document}
chapter{One}
newrefsection
newrefcontext[labelprefix=thechapter-]
savechapterrefsection
cite{sigfridsson,worman,geer}
printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]

chapter{Two}
newrefsection
newrefcontext[labelprefix=thechapter-]
savechapterrefsection
cite{knuth:ct:a,knuth:ct:b,sigfridsson}
printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


printbibheading[title=Overall bibname]
bibbysection[heading=none]
end{document}




With classicthesis the general steps are the same, but things are made unnecessarily complicated by the complex structure of the template/package.



Assuming you have a pristine version of the template from CTAN. (Note that in general it is extremely bad advice to modify system installed-files from CTAN without renaming them. But classicthesis is more than a package and some files seem to be intended for modification, so ... it's probably fine.)





  1. Go to classicthesis-config.tex and delete lines 85-97 reading



    PassOptionsToPackage{%
    %backend=biber,bibencoding=utf8, %instead of bibtex
    backend=bibtex8,bibencoding=ascii,%
    language=auto,%
    style=numeric-comp,%
    %style=authoryear-comp, % Author 1999, 2010
    %bibstyle=authoryear,dashed=false, % dashed: substitute rep. author with ---
    sorting=nyt, % name, year, title
    maxbibnames=10, % default: 3, et al.
    %backref=true,%
    natbib=true % natbib compatibility mode (citep and citet still work)
    }{biblatex}
    usepackage{biblatex}


    and replace them with



    usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

    makeatletter
    newcommand*{savechapterrefsection}{%
    csxdef{chapter@for@refsection@therefsection}{thechapter}}

    defblx@refsections{%
    newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
    ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
    {}
    {toggletrue{blx@tempa}%
    begingroup
    expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
    ifnumc@refsection<blx@maxsection
    advancec@refsection@ne
    expandafterblx@refsections
    else
    iftoggle{blx@tempa}{}{blx@warn@bibempty}%
    endgroup
    fi}
    makeatother


    from the MWE above. Of course you can choose your favourite biblatex style and add more options, but it is crucial that both defernumbers and backend=biber stay and are not overwritten/contradicted by other options.




  2. Remove the complete contents of FrontBackmatter/Bibliography.tex and replace it with just



    printbibheading[title=Overall bibname]
    bibbysection[heading=none]



  3. In every one of your chapters add



    newrefsection
    newrefcontext[labelprefix=thechapter-]
    savechapterrefsection


    after chapter and label and then add



    printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


    to the end of the chapter file where you want the bibliography to appear. If you want the bibliography in the ToC say heading=subbibintoc or heading=subbibnumbered instead of heading=subbibliography.



  4. Make sure you compile your file with Biber and not with BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations for help.



I tested this workflow with the files from CTAN and there are only two caveats.




  • The file AMiede_Publications.bib is not encoded in UTF-8. Biber will choke on it, but that can be fixed by recoding the file and is likely not an issue for most people since they will use their .bib files.


  • The code makes heavy use of natbib commands. If you want to use those, you need to load biblatex with the natbib=true option in step 1. See also Is there a disadvantage to using natbib=true with biblatex?.



The result is



Bibliography of chapter 2



for the beginning of the bibliography of chapter 2 and



Overall bibliography



for the overall bibliography.






share|improve this answer


























    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%2f482796%2fbiblatex-dual-referencing-both-by-end-of-chapter-and-at-the-end-of-the-documen%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









    1














    This is actually surprisingly complicated (or maybe not so surprisingly given the fundamental complexity of such a set-up that I mentioned in the comments before your edit).



    If you want separate bibliographies for each chapter, where an item will appear with a chapter prefix you need to use refsections. Otherwise (with refsegments) an entry cited in several chapters would get the same prefix in every chapter and so an item cited in chapters 1 and 3 would always be cited as "1-4" even in chapter 3, that would look odd. But with refsections it becomes much more complicated to produce an overall bibliography at the end. Even more so when we need labelprefix and thus refcontexts. bibbysection can be used to print bibliographies for all refsections one by one, but we need an additional hack to fix the refcontext as expected. The hack is adding a newrefcontext to the internal command blx@refsections. But we need to know the correct labelprefix here, so we need to remember it with another special command: savechapterrefsection.



    So you need the bit between makeatletter...makeatother in your preamble. You also need to issue



    newrefsection
    newrefcontext[labelprefix=thechapter-]
    savechapterrefsection


    directly after every chapter command. At the end of the chapter you can say



    printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


    to get the per-chapter bibliography.



    At the end of your document you say



    printbibheading[title=Overall bibname]
    bibbysection[heading=none]


    to print the complete bibliography.



    In total



    documentclass[british]{report}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}
    usepackage{babel}
    usepackage{csquotes}

    usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

    makeatletter
    newcommand*{savechapterrefsection}{%
    csxdef{chapter@for@refsection@therefsection}{thechapter}}

    defblx@refsections{%
    newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
    ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
    {}
    {toggletrue{blx@tempa}%
    begingroup
    expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
    ifnumc@refsection<blx@maxsection
    advancec@refsection@ne
    expandafterblx@refsections
    else
    iftoggle{blx@tempa}{}{blx@warn@bibempty}%
    endgroup
    fi}
    makeatother

    addbibresource{biblatex-examples.bib}

    begin{document}
    chapter{One}
    newrefsection
    newrefcontext[labelprefix=thechapter-]
    savechapterrefsection
    cite{sigfridsson,worman,geer}
    printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]

    chapter{Two}
    newrefsection
    newrefcontext[labelprefix=thechapter-]
    savechapterrefsection
    cite{knuth:ct:a,knuth:ct:b,sigfridsson}
    printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


    printbibheading[title=Overall bibname]
    bibbysection[heading=none]
    end{document}




    With classicthesis the general steps are the same, but things are made unnecessarily complicated by the complex structure of the template/package.



    Assuming you have a pristine version of the template from CTAN. (Note that in general it is extremely bad advice to modify system installed-files from CTAN without renaming them. But classicthesis is more than a package and some files seem to be intended for modification, so ... it's probably fine.)





    1. Go to classicthesis-config.tex and delete lines 85-97 reading



      PassOptionsToPackage{%
      %backend=biber,bibencoding=utf8, %instead of bibtex
      backend=bibtex8,bibencoding=ascii,%
      language=auto,%
      style=numeric-comp,%
      %style=authoryear-comp, % Author 1999, 2010
      %bibstyle=authoryear,dashed=false, % dashed: substitute rep. author with ---
      sorting=nyt, % name, year, title
      maxbibnames=10, % default: 3, et al.
      %backref=true,%
      natbib=true % natbib compatibility mode (citep and citet still work)
      }{biblatex}
      usepackage{biblatex}


      and replace them with



      usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

      makeatletter
      newcommand*{savechapterrefsection}{%
      csxdef{chapter@for@refsection@therefsection}{thechapter}}

      defblx@refsections{%
      newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
      ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
      {}
      {toggletrue{blx@tempa}%
      begingroup
      expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
      ifnumc@refsection<blx@maxsection
      advancec@refsection@ne
      expandafterblx@refsections
      else
      iftoggle{blx@tempa}{}{blx@warn@bibempty}%
      endgroup
      fi}
      makeatother


      from the MWE above. Of course you can choose your favourite biblatex style and add more options, but it is crucial that both defernumbers and backend=biber stay and are not overwritten/contradicted by other options.




    2. Remove the complete contents of FrontBackmatter/Bibliography.tex and replace it with just



      printbibheading[title=Overall bibname]
      bibbysection[heading=none]



    3. In every one of your chapters add



      newrefsection
      newrefcontext[labelprefix=thechapter-]
      savechapterrefsection


      after chapter and label and then add



      printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


      to the end of the chapter file where you want the bibliography to appear. If you want the bibliography in the ToC say heading=subbibintoc or heading=subbibnumbered instead of heading=subbibliography.



    4. Make sure you compile your file with Biber and not with BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations for help.



    I tested this workflow with the files from CTAN and there are only two caveats.




    • The file AMiede_Publications.bib is not encoded in UTF-8. Biber will choke on it, but that can be fixed by recoding the file and is likely not an issue for most people since they will use their .bib files.


    • The code makes heavy use of natbib commands. If you want to use those, you need to load biblatex with the natbib=true option in step 1. See also Is there a disadvantage to using natbib=true with biblatex?.



    The result is



    Bibliography of chapter 2



    for the beginning of the bibliography of chapter 2 and



    Overall bibliography



    for the overall bibliography.






    share|improve this answer






























      1














      This is actually surprisingly complicated (or maybe not so surprisingly given the fundamental complexity of such a set-up that I mentioned in the comments before your edit).



      If you want separate bibliographies for each chapter, where an item will appear with a chapter prefix you need to use refsections. Otherwise (with refsegments) an entry cited in several chapters would get the same prefix in every chapter and so an item cited in chapters 1 and 3 would always be cited as "1-4" even in chapter 3, that would look odd. But with refsections it becomes much more complicated to produce an overall bibliography at the end. Even more so when we need labelprefix and thus refcontexts. bibbysection can be used to print bibliographies for all refsections one by one, but we need an additional hack to fix the refcontext as expected. The hack is adding a newrefcontext to the internal command blx@refsections. But we need to know the correct labelprefix here, so we need to remember it with another special command: savechapterrefsection.



      So you need the bit between makeatletter...makeatother in your preamble. You also need to issue



      newrefsection
      newrefcontext[labelprefix=thechapter-]
      savechapterrefsection


      directly after every chapter command. At the end of the chapter you can say



      printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


      to get the per-chapter bibliography.



      At the end of your document you say



      printbibheading[title=Overall bibname]
      bibbysection[heading=none]


      to print the complete bibliography.



      In total



      documentclass[british]{report}
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}
      usepackage{babel}
      usepackage{csquotes}

      usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

      makeatletter
      newcommand*{savechapterrefsection}{%
      csxdef{chapter@for@refsection@therefsection}{thechapter}}

      defblx@refsections{%
      newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
      ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
      {}
      {toggletrue{blx@tempa}%
      begingroup
      expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
      ifnumc@refsection<blx@maxsection
      advancec@refsection@ne
      expandafterblx@refsections
      else
      iftoggle{blx@tempa}{}{blx@warn@bibempty}%
      endgroup
      fi}
      makeatother

      addbibresource{biblatex-examples.bib}

      begin{document}
      chapter{One}
      newrefsection
      newrefcontext[labelprefix=thechapter-]
      savechapterrefsection
      cite{sigfridsson,worman,geer}
      printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]

      chapter{Two}
      newrefsection
      newrefcontext[labelprefix=thechapter-]
      savechapterrefsection
      cite{knuth:ct:a,knuth:ct:b,sigfridsson}
      printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


      printbibheading[title=Overall bibname]
      bibbysection[heading=none]
      end{document}




      With classicthesis the general steps are the same, but things are made unnecessarily complicated by the complex structure of the template/package.



      Assuming you have a pristine version of the template from CTAN. (Note that in general it is extremely bad advice to modify system installed-files from CTAN without renaming them. But classicthesis is more than a package and some files seem to be intended for modification, so ... it's probably fine.)





      1. Go to classicthesis-config.tex and delete lines 85-97 reading



        PassOptionsToPackage{%
        %backend=biber,bibencoding=utf8, %instead of bibtex
        backend=bibtex8,bibencoding=ascii,%
        language=auto,%
        style=numeric-comp,%
        %style=authoryear-comp, % Author 1999, 2010
        %bibstyle=authoryear,dashed=false, % dashed: substitute rep. author with ---
        sorting=nyt, % name, year, title
        maxbibnames=10, % default: 3, et al.
        %backref=true,%
        natbib=true % natbib compatibility mode (citep and citet still work)
        }{biblatex}
        usepackage{biblatex}


        and replace them with



        usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

        makeatletter
        newcommand*{savechapterrefsection}{%
        csxdef{chapter@for@refsection@therefsection}{thechapter}}

        defblx@refsections{%
        newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
        ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
        {}
        {toggletrue{blx@tempa}%
        begingroup
        expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
        ifnumc@refsection<blx@maxsection
        advancec@refsection@ne
        expandafterblx@refsections
        else
        iftoggle{blx@tempa}{}{blx@warn@bibempty}%
        endgroup
        fi}
        makeatother


        from the MWE above. Of course you can choose your favourite biblatex style and add more options, but it is crucial that both defernumbers and backend=biber stay and are not overwritten/contradicted by other options.




      2. Remove the complete contents of FrontBackmatter/Bibliography.tex and replace it with just



        printbibheading[title=Overall bibname]
        bibbysection[heading=none]



      3. In every one of your chapters add



        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection


        after chapter and label and then add



        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


        to the end of the chapter file where you want the bibliography to appear. If you want the bibliography in the ToC say heading=subbibintoc or heading=subbibnumbered instead of heading=subbibliography.



      4. Make sure you compile your file with Biber and not with BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations for help.



      I tested this workflow with the files from CTAN and there are only two caveats.




      • The file AMiede_Publications.bib is not encoded in UTF-8. Biber will choke on it, but that can be fixed by recoding the file and is likely not an issue for most people since they will use their .bib files.


      • The code makes heavy use of natbib commands. If you want to use those, you need to load biblatex with the natbib=true option in step 1. See also Is there a disadvantage to using natbib=true with biblatex?.



      The result is



      Bibliography of chapter 2



      for the beginning of the bibliography of chapter 2 and



      Overall bibliography



      for the overall bibliography.






      share|improve this answer




























        1












        1








        1







        This is actually surprisingly complicated (or maybe not so surprisingly given the fundamental complexity of such a set-up that I mentioned in the comments before your edit).



        If you want separate bibliographies for each chapter, where an item will appear with a chapter prefix you need to use refsections. Otherwise (with refsegments) an entry cited in several chapters would get the same prefix in every chapter and so an item cited in chapters 1 and 3 would always be cited as "1-4" even in chapter 3, that would look odd. But with refsections it becomes much more complicated to produce an overall bibliography at the end. Even more so when we need labelprefix and thus refcontexts. bibbysection can be used to print bibliographies for all refsections one by one, but we need an additional hack to fix the refcontext as expected. The hack is adding a newrefcontext to the internal command blx@refsections. But we need to know the correct labelprefix here, so we need to remember it with another special command: savechapterrefsection.



        So you need the bit between makeatletter...makeatother in your preamble. You also need to issue



        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection


        directly after every chapter command. At the end of the chapter you can say



        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


        to get the per-chapter bibliography.



        At the end of your document you say



        printbibheading[title=Overall bibname]
        bibbysection[heading=none]


        to print the complete bibliography.



        In total



        documentclass[british]{report}
        usepackage[T1]{fontenc}
        usepackage[utf8]{inputenc}
        usepackage{babel}
        usepackage{csquotes}

        usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

        makeatletter
        newcommand*{savechapterrefsection}{%
        csxdef{chapter@for@refsection@therefsection}{thechapter}}

        defblx@refsections{%
        newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
        ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
        {}
        {toggletrue{blx@tempa}%
        begingroup
        expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
        ifnumc@refsection<blx@maxsection
        advancec@refsection@ne
        expandafterblx@refsections
        else
        iftoggle{blx@tempa}{}{blx@warn@bibempty}%
        endgroup
        fi}
        makeatother

        addbibresource{biblatex-examples.bib}

        begin{document}
        chapter{One}
        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection
        cite{sigfridsson,worman,geer}
        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]

        chapter{Two}
        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection
        cite{knuth:ct:a,knuth:ct:b,sigfridsson}
        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


        printbibheading[title=Overall bibname]
        bibbysection[heading=none]
        end{document}




        With classicthesis the general steps are the same, but things are made unnecessarily complicated by the complex structure of the template/package.



        Assuming you have a pristine version of the template from CTAN. (Note that in general it is extremely bad advice to modify system installed-files from CTAN without renaming them. But classicthesis is more than a package and some files seem to be intended for modification, so ... it's probably fine.)





        1. Go to classicthesis-config.tex and delete lines 85-97 reading



          PassOptionsToPackage{%
          %backend=biber,bibencoding=utf8, %instead of bibtex
          backend=bibtex8,bibencoding=ascii,%
          language=auto,%
          style=numeric-comp,%
          %style=authoryear-comp, % Author 1999, 2010
          %bibstyle=authoryear,dashed=false, % dashed: substitute rep. author with ---
          sorting=nyt, % name, year, title
          maxbibnames=10, % default: 3, et al.
          %backref=true,%
          natbib=true % natbib compatibility mode (citep and citet still work)
          }{biblatex}
          usepackage{biblatex}


          and replace them with



          usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

          makeatletter
          newcommand*{savechapterrefsection}{%
          csxdef{chapter@for@refsection@therefsection}{thechapter}}

          defblx@refsections{%
          newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
          ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
          {}
          {toggletrue{blx@tempa}%
          begingroup
          expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
          ifnumc@refsection<blx@maxsection
          advancec@refsection@ne
          expandafterblx@refsections
          else
          iftoggle{blx@tempa}{}{blx@warn@bibempty}%
          endgroup
          fi}
          makeatother


          from the MWE above. Of course you can choose your favourite biblatex style and add more options, but it is crucial that both defernumbers and backend=biber stay and are not overwritten/contradicted by other options.




        2. Remove the complete contents of FrontBackmatter/Bibliography.tex and replace it with just



          printbibheading[title=Overall bibname]
          bibbysection[heading=none]



        3. In every one of your chapters add



          newrefsection
          newrefcontext[labelprefix=thechapter-]
          savechapterrefsection


          after chapter and label and then add



          printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


          to the end of the chapter file where you want the bibliography to appear. If you want the bibliography in the ToC say heading=subbibintoc or heading=subbibnumbered instead of heading=subbibliography.



        4. Make sure you compile your file with Biber and not with BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations for help.



        I tested this workflow with the files from CTAN and there are only two caveats.




        • The file AMiede_Publications.bib is not encoded in UTF-8. Biber will choke on it, but that can be fixed by recoding the file and is likely not an issue for most people since they will use their .bib files.


        • The code makes heavy use of natbib commands. If you want to use those, you need to load biblatex with the natbib=true option in step 1. See also Is there a disadvantage to using natbib=true with biblatex?.



        The result is



        Bibliography of chapter 2



        for the beginning of the bibliography of chapter 2 and



        Overall bibliography



        for the overall bibliography.






        share|improve this answer















        This is actually surprisingly complicated (or maybe not so surprisingly given the fundamental complexity of such a set-up that I mentioned in the comments before your edit).



        If you want separate bibliographies for each chapter, where an item will appear with a chapter prefix you need to use refsections. Otherwise (with refsegments) an entry cited in several chapters would get the same prefix in every chapter and so an item cited in chapters 1 and 3 would always be cited as "1-4" even in chapter 3, that would look odd. But with refsections it becomes much more complicated to produce an overall bibliography at the end. Even more so when we need labelprefix and thus refcontexts. bibbysection can be used to print bibliographies for all refsections one by one, but we need an additional hack to fix the refcontext as expected. The hack is adding a newrefcontext to the internal command blx@refsections. But we need to know the correct labelprefix here, so we need to remember it with another special command: savechapterrefsection.



        So you need the bit between makeatletter...makeatother in your preamble. You also need to issue



        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection


        directly after every chapter command. At the end of the chapter you can say



        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


        to get the per-chapter bibliography.



        At the end of your document you say



        printbibheading[title=Overall bibname]
        bibbysection[heading=none]


        to print the complete bibliography.



        In total



        documentclass[british]{report}
        usepackage[T1]{fontenc}
        usepackage[utf8]{inputenc}
        usepackage{babel}
        usepackage{csquotes}

        usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

        makeatletter
        newcommand*{savechapterrefsection}{%
        csxdef{chapter@for@refsection@therefsection}{thechapter}}

        defblx@refsections{%
        newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
        ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
        {}
        {toggletrue{blx@tempa}%
        begingroup
        expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
        ifnumc@refsection<blx@maxsection
        advancec@refsection@ne
        expandafterblx@refsections
        else
        iftoggle{blx@tempa}{}{blx@warn@bibempty}%
        endgroup
        fi}
        makeatother

        addbibresource{biblatex-examples.bib}

        begin{document}
        chapter{One}
        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection
        cite{sigfridsson,worman,geer}
        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]

        chapter{Two}
        newrefsection
        newrefcontext[labelprefix=thechapter-]
        savechapterrefsection
        cite{knuth:ct:a,knuth:ct:b,sigfridsson}
        printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


        printbibheading[title=Overall bibname]
        bibbysection[heading=none]
        end{document}




        With classicthesis the general steps are the same, but things are made unnecessarily complicated by the complex structure of the template/package.



        Assuming you have a pristine version of the template from CTAN. (Note that in general it is extremely bad advice to modify system installed-files from CTAN without renaming them. But classicthesis is more than a package and some files seem to be intended for modification, so ... it's probably fine.)





        1. Go to classicthesis-config.tex and delete lines 85-97 reading



          PassOptionsToPackage{%
          %backend=biber,bibencoding=utf8, %instead of bibtex
          backend=bibtex8,bibencoding=ascii,%
          language=auto,%
          style=numeric-comp,%
          %style=authoryear-comp, % Author 1999, 2010
          %bibstyle=authoryear,dashed=false, % dashed: substitute rep. author with ---
          sorting=nyt, % name, year, title
          maxbibnames=10, % default: 3, et al.
          %backref=true,%
          natbib=true % natbib compatibility mode (citep and citet still work)
          }{biblatex}
          usepackage{biblatex}


          and replace them with



          usepackage[style=numeric, defernumbers, backend=biber]{biblatex}

          makeatletter
          newcommand*{savechapterrefsection}{%
          csxdef{chapter@for@refsection@therefsection}{thechapter}}

          defblx@refsections{%
          newrefcontext[labelprefix=csuse{chapter@for@refsection@therefsection}-]%
          ifcsvoid{blx@dlist@entry@thec@refsection @blx@refcontext@context}
          {}
          {toggletrue{blx@tempa}%
          begingroup
          expandafterblx@bibliographycsname blx@dlist@entry@thec@refsection @blx@refcontext@contextendcsname}%
          ifnumc@refsection<blx@maxsection
          advancec@refsection@ne
          expandafterblx@refsections
          else
          iftoggle{blx@tempa}{}{blx@warn@bibempty}%
          endgroup
          fi}
          makeatother


          from the MWE above. Of course you can choose your favourite biblatex style and add more options, but it is crucial that both defernumbers and backend=biber stay and are not overwritten/contradicted by other options.




        2. Remove the complete contents of FrontBackmatter/Bibliography.tex and replace it with just



          printbibheading[title=Overall bibname]
          bibbysection[heading=none]



        3. In every one of your chapters add



          newrefsection
          newrefcontext[labelprefix=thechapter-]
          savechapterrefsection


          after chapter and label and then add



          printbibliography[heading=subbibliography, title={bibname for chapter~thechapter}]


          to the end of the chapter file where you want the bibliography to appear. If you want the bibliography in the ToC say heading=subbibintoc or heading=subbibnumbered instead of heading=subbibliography.



        4. Make sure you compile your file with Biber and not with BibTeX. See Biblatex with Biber: Configuring my editor to avoid undefined citations for help.



        I tested this workflow with the files from CTAN and there are only two caveats.




        • The file AMiede_Publications.bib is not encoded in UTF-8. Biber will choke on it, but that can be fixed by recoding the file and is likely not an issue for most people since they will use their .bib files.


        • The code makes heavy use of natbib commands. If you want to use those, you need to load biblatex with the natbib=true option in step 1. See also Is there a disadvantage to using natbib=true with biblatex?.



        The result is



        Bibliography of chapter 2



        for the beginning of the bibliography of chapter 2 and



        Overall bibliography



        for the overall bibliography.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Apr 5 at 9:28

























        answered Apr 5 at 8:47









        moewemoewe

        96.7k10118362




        96.7k10118362






























            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%2f482796%2fbiblatex-dual-referencing-both-by-end-of-chapter-and-at-the-end-of-the-documen%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?

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

            Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents