4

I am using References after each chapter to print cited papers in that chapter, as well as a Complete Bibliography at the end. Now, I want a customized version of bibliography at the end of the chapter, while the complete bibliography will have the default setting.

Consider the following MWE (copied from here):

\documentclass{book}

\usepackage[defernums=true, hyperref, backref, refsegment=chapter]{biblatex}
\usepackage[colorlinks]{hyperref}
\defbibheading{references}[References]{% 
    \section*{#1}% 
    \markboth{#1}{#1}%
}

\defbibheading{bibliography}[Complete Bibliography]{% 
    \chapter*{#1}%
    \addcontentsline{toc}{chapter}{#1}
    \markboth{#1}{#1}%
}

\usepackage{filecontents}
\begin{filecontents}{\jobname.bib}
    @misc{A01,
        author = {Author, A. and Duthor, D.},
        year = {2001},
        title = {Alpha},
        shortdesc = {Conference1}
    }
    @misc{B02,
        author = {Buthor, B. and Euther, E. and Futher F.},
        year = {2002},
        title = {Bravo},
        shortdesc = {Journal2}
    }
    @misc{C03,
        author = {Cuthor, C.},
        year = {2003},
        title = {Charlie},
        shortdesc = {Workshop}
    }
\end{filecontents}

\bibliography{\jobname}


\begin{document}
    \chapter{First Chapter}
    Some more text \autocite{A01,B02}.
    \printbibliography[heading=references,segment=\therefsegment]
    %% This will have differnet format than Complete Bibliography
    %% [#] Lastname1, Lastname2, ...: ShortDescription'yy
    %%% [1] Author, Duthor: Conference1'01
    %%% [2] Buthor, Euther, Futher: Journal2'02
    \chapter{Second Chapter}
    Some text \autocite{A01,C03}.
    \printbibliography[heading=references,segment=\therefsegment]


    \printbibliography[heading=bibliography]

\end{document}

I want the References will have the format:

Lastname1, Lastname2, ..., LastnameN: ShortDescription'YY

Lastname1 to LastnameN are last names for N authors; ShortDescription is a keyword given in the bibentry by shortdesc; followed by upper comma '; YY is the last two digits of the year and no \backref. For example, after Chapter 1, we'll have the following References:

[1 ] Author, Duthor: Conference1'01

[2] Buthor, Euther, Futher: Journal2'02

Update

I just noticed the hyperlink from the citations goes to the References. Can this be changed such that it points to the Main Bibliography item?

7
+50

For shortdesc we need to define a new datamodel (.dbx file). Since all entry types should look the same in the chapter references we used \printbiblist so that we can use one driver for all entries. In \defbibenvironment{chapterref} we disable the hyperlink anchor so that the link goes to the main bibliography.

The code for the two-digit year is from this answer of Audrey's. See also Two-digit year in bib entry for articles and Show only two year digits. Note that this requires you to always give four-digit years.

\documentclass{book}
\usepackage{filecontents}
\begin{filecontents}{chapterref.dbx}
\DeclareDatamodelFields[type=field,datatype=literal]{
  shortdesc,
}
\DeclareDatamodelEntryfields{shortdesc}
\end{filecontents}

\usepackage[backref, refsegment=chapter, datamodel=chapterref]{biblatex}
\usepackage[colorlinks]{hyperref}

\begin{filecontents}{\jobname.bib}
@misc{A01,
  author    = {Author, A. and Duthor, D.},
  year      = {2001},
  title     = {Alpha},
  shortdesc = {Conference1},
}
@misc{B02,
  author    = {Buthor, B. and Euther, E. and Futher F.},
  year      = {2002},
  title     = {Bravo},
  shortdesc = {Journal2},
}
@misc{C03,
  author    = {Cuthor, C.},
  year      = {2003},
  title     = {Charlie},
  shortdesc = {Workshop},
}
\end{filecontents}

\addbibresource{\jobname.bib}

\makeatletter
\defbibenvironment{chapterref}
  {\list
     {\printtext[labelnumberwidth]{%
      \printfield{labelprefix}%
      \printfield{labelnumber}}}
     {\let\blx@anchor\relax
      \setlength{\labelwidth}{\labelnumberwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{\hss##1}}
  {\endlist}
  {\item}
\makeatother

\DeclareFieldFormat{shortyear}{\mkbibshortyear#1}
\def\mkbibshortyear#1#2#3#4{#3#4}

\DeclareBibliographyDriver{chapterref}{%
  \usebibmacro{begentry}%
  \renewcommand*{\finalnamedelim}{\multinamedelim}%
  \DeclareNameAlias{author}{labelname}%
  \DeclareNameAlias{editor}{labelname}%
  \DeclareNameAlias{translator}{labelname}%
  \usebibmacro{author/editor+others/translator+others}%
  \setunit{\addcomma\space}%
  \printfield{shortdesc}%
  \setunit{'}%
  \printfield[shortyear]{year}%
  \usebibmacro{finentry}}

\defbibheading{chapterref}[References]{% 
  \section*{#1}% 
  \markboth{#1}{#1}%
}

\defbibheading{bibliography}[Complete Bibliography]{% 
  \chapter*{#1}%
  \addcontentsline{toc}{chapter}{#1}%
  \markboth{#1}{#1}%
}

\begin{document}
  \chapter{First Chapter}
  Some more text \autocite{A01,B02}.
  \printbiblist[heading=chapterref, segment=\therefsegment]{chapterref}

  \chapter{Second Chapter}
  Some text \autocite{A01,C03}.
  \printbiblist[heading=chapterref, segment=\therefsegment]{chapterref}


  \printbibliography
\end{document}

chapter 1 chapter 2 complete bibliography

  • Great! Can you please add the last name part? – pushpen.paul Jun 2 '17 at 14:33
  • @pushpen.paul Done! – moewe Jun 2 '17 at 15:56
  • OK, solved the and problem by putting \renewcommand*{\finalnamedelim}{\addcomma\space} after \DeclareBibliographyDriver{chapterref}{ line – pushpen.paul Jun 2 '17 at 18:29
  • @pushpen.paul Have a look at my edited answer. I prefer \renewcommand*{\finalnamedelim}{\multinamedelim}, though that is a matter of taste. But you should make sure to include the %. – moewe Jun 3 '17 at 12:58
  • 1
    @pushpen.paul The % is needed to avoid spurious spaces, see here. I think it was unlikely that a missing % at that position would have caused trouble, but better be safe than sorry and it is a good habit to put % where the could be a problem. Have a look at the edit for two-digit years. (Note that the images have not been updated.) – moewe Jun 3 '17 at 15:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.