1

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.
  • 1
    Can you show us a simplified version of what you have so far (an MWE/MWEB: https://tex.meta.stackexchange.com/q/228/35864, https://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 02 '19 at 15:43
  • 1
    Very relevant: https://tex.stackexchange.com/q/168713/35864, https://tex.stackexchange.com/q/49941/35864 – moewe Apr 02 '19 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 02 '19 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 02 '19 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 02 '19 at 17:05

1 Answers1

3

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}}

\def\blx@refsections{%
  \newrefcontext[labelprefix=\csuse{chapter@for@refsection@\therefsection}-]%
  \ifcsvoid{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}
    {}
    {\toggletrue{blx@tempa}%
     \begingroup
     \expandafter\blx@bibliography\csname blx@dlist@entry@\the\c@refsection @\blx@refcontext@context\endcsname}%
  \ifnum\c@refsection<\blx@maxsection
    \advance\c@refsection\@ne
    \expandafter\blx@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}}
    
    \def\blx@refsections{%
      \newrefcontext[labelprefix=\csuse{chapter@for@refsection@\therefsection}-]%
      \ifcsvoid{blx@dlist@entry@\the\c@refsection @\blx@refcontext@context}
        {}
        {\toggletrue{blx@tempa}%
         \begingroup
         \expandafter\blx@bibliography\csname blx@dlist@entry@\the\c@refsection @\blx@refcontext@context\endcsname}%
      \ifnum\c@refsection<\blx@maxsection
        \advance\c@refsection\@ne
        \expandafter\blx@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.

moewe
  • 175,683