# custom citation style for custom document

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}

\UndefineBibliographyExtras{french}{\restorecommand\mkbibnamefamily}

\renewcommand*{\mkbibnamefamily}{\textsc}
\renewcommand*{\revsdnamepunct}{}

\DeclareFieldFormat*{citetitle}{\mkbibemph{#1}}

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

• The standard styles have no type-specific citation handling. All types are handled the same in citations. So you would have to modify the cite bibmacro. I could write an answer how that would work in the MWE, but I have the feeling that you may already have a highly modified cite bibmacro, in that case it might help if you added its definition to the MWE. In its current form customc:cite won't do anything. – moewe Oct 29 '18 at 9:29
• Haha, based on my history, you're right. Bu actually, I was planning on using the authortitle version, with the potential goal to use the variation with the authoryear-icomp. So plain authortitle style :-) – XaWin Oct 29 '18 at 9:41
• Ah OK, with authortitle things should be not that horrible. – moewe Oct 29 '18 at 9:43

Unlike the bibliography output the citation output is not type-dependent in the standard biblatex styles. That means that there is only one cite macro that controls the citation of all types and that there is no convenient macro like \DeclareBibliographyDriver{<type>} or cite:<type> to change the citation format of a particular type.

In this case the straightforward way just redefines the cite macro (as defined in authortitlte.cbx) as

\renewbibmacro*{cite}{%
\iffieldundef{shorthand}
{\printnames{labelname}%
\setunit*{\printdelim{nametitledelim}}%
\usebibmacro{cite:title}%
\ifentrytype{customc}
\printfield{note}}
{}}%
{\usebibmacro{cite:shorthand}}}


This simply adds a test for the type @customc and prints the note 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.

% save the "default" cite macro in cite:default.
% That means we can overwrite cite later
% and still use the old definition within the new one
\letbibmacro*{cite:default}{cite}

\renewbibmacro*{cite}{%
\ifbibmacroundef{cite:\strfield{entrytype}}
{\usebibmacro{cite:default}}
{\usebibmacro*{cite:\strfield{entrytype}}}}

\newbibmacro*{cite:customc}{%
\usebibmacro{cite:title}%

• @XaWin Indeed \letbibmacro is fairly new. The biblatex version on Overleaf does not know it yet. I guess there is only one unified citation macro for all types because usually all types have the same citation format. So normally there is little point in having type-specific citations. – moewe Oct 29 '18 at 11:41