I'm trying to have 2 separate "citation style" in my document, leveraging the customX existing document type (an extension would be to have a separate document type, but I don't want to play with the lbx file for the moment).
So I've used the type customc
for my test. In the customc citation, there are no author and the citation should be "title, postnote" with an optional citation mode being "{title} {note}, postnote" if the note field is defined.
I'm having difficulties redefining the "customc:cite" for the document type customc. I thought it would be simply the same as DeclareBibliographyDriver
bu I cannot find a way to make them work. How could I achieve this ? Here is what I get so far
And here is my MWE :
\documentclass[11pt]{memoir}
\usepackage{filecontents}
\begin{filecontents}{test.bib}
@book{book1,
author = {Author, Roberto B.},
title = {The Writing of History in Ancient Egypt during the First Millennium BC (ca. 1070-180 BC). Trends and Perspectives},
shorttitle = {A short title},
}
@customc{atf1,
title = {A title},
note = {= Un titre},
}
@customc{atf2,
title = {Another title},
}
\end{filecontents}
\usepackage[style=authortitle,backend=biber,language=french]{biblatex}
\addbibresource{test.bib}
\UndefineBibliographyExtras{french}{\restorecommand\mkbibnamefamily}
\newcommand{\no}{n\textsuperscript{o}\addnbthinspace}
\newcommand{\nos}{n\textsuperscript{os}\addnbthinspace}
\newcommand{\considerant}{consid.\addnbthinspace}
\renewcommand*{\mkbibnamefamily}{\textsc}
\renewcommand*{\revsdnamepunct}{}
\DeclareFieldFormat*{citetitle}{\mkbibemph{#1}}
\renewcommand*{\multicitedelim}{\addsemicolon\space}
\newcommand{\ucites}{\parencites}
\DeclareFieldFormat[customc]{title}{#1}
\DeclareFieldFormat[customc]{citetitle}{#1}
\DeclareFieldFormat[customc]{note}{#1}
\DeclareFieldFormat[customc]{postnote}{\considerant #1}
\DeclareBibliographyDriver{customc}{%
\usebibmacro{bibindex}%
\usebibmacro{begentry}%
\printfield{title}%
\newunit\newblock
\printfield{note}%
\usebibmacro{finentry}
}
\newbibmacro*{customc:cite}{%
\usebibmacro{cite:title}%
\iffieldundef{note}{}{\printfield{note}}%
}
\begin{document}
a first test as demo \ucites[1]{book1}. a second text which also has some references \ucites[\nos 1, 2, 5]{book1}.
Finally a test using the custom citation style \ucites[2.a \& 2.b]{atf1}[5.1]{atf2}. However the display should be "A title = Un titre, consid. 2.a \& 2.b".
\end{document}
Best Answer
Unlike the bibliography output the citation output is not type-dependent in the standard
biblatex
styles. That means that there is only onecite
macro that controls the citation of all types and that there is no convenient macro like\DeclareBibliographyDriver{<type>}
orcite:<type>
to change the citation format of a particular type.In this case the straightforward way just redefines the
cite
macro (as defined inauthortitlte.cbx
) asThis simply adds a test for the type
@customc
and prints thenote
field if we have a@customc
entry.If you are aiming to add more complicated definitions for other entry types as well, you may want to look at a different setup. The following allows you to define type-specific cite macros and falls back to the standard definition.