0

I have to use a very specific citation style for my thesis. Since verbose is the closest I can find to this style, I decided to customize it.

This is my progress thus far. A MWE would be:

\ProvidesFile{biblatex.cfg}

% -- No prefix for pages
\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

% -- No italic titles
\DeclareFieldFormat{title}{#1}
\DeclareFieldFormat{booktitle}{#1}
\DeclareFieldFormat{citetitle}{#1}
\DeclareFieldFormat{journaltitle}{#1}

% -- No "'" for title
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{citetitle}{#1}
\DeclareFieldFormat[article,inbook,incollection,inproceedings,patent,thesis,unpublished]{title}{#1}

% -- Authors and editors in italic and only show surname
\DeclareNameFormat{family}{\mkbibemph{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}}%
  \usebibmacro{name:andothers}}
\DeclareNameAlias{default}{family}
\DeclareNameAlias{sortname}{default}
\DeclareNameAlias{labelname}{default}

% -- "/" between names but "," and "and" in textcite
\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimFormat{finalnamedelim}{\slash}
\DeclareDelimFormat[textcite]{multinamedelim}{,\space}
\DeclareDelimFormat[textcite]{finalnamedelim}{~and\space}

\AtEveryCitekey{%
  \clearlist{publisher}%
  \clearlist{language}%
  \clearlist{location}%
  \clearfield{isbn}%
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{note}%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}%
    \clearfield{volume}%
    \clearfield{day}%
    \clearfield{month}%
    \clearfield{pagetotal}%
    \clearfield{pages}%
    \clearfield{url}%
    \clearfield{urlyear}%
    \clearfield{review}%
    \clearfield{series}}{}}

\AtEveryBibitem{%
  \clearlist{publisher}%
  \clearlist{language}%
  \clearlist{location}%
  \clearfield{isbn}%
  \clearfield{issn}%
  \clearfield{doi}%
  \clearfield{note}%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}%
    \clearfield{volume}%
    \clearfield{day}%
    \clearfield{month}%
    \clearfield{pagetotal}%
    \clearfield{pages}%
    \clearfield{url}%
    \clearfield{urlyear}%
    \clearfield{review}%
    \clearfield{series}}{}}
\endinput

A .tex file MWE would look like:

\documentclass{article}
\usepackage[backend=biber, style=verbose, autocite=footnote, citepages=suppress]{biblatex}
\addbibresource{\jobname.bib}
\usepackage{filecontents}

\begin{filecontents}{\jobname.bib}
@book{alexyRechtVernunftDiskurs1995,
  title = {Recht, Vernunft, Diskurs: Studien zur Rechtsphilosophie},
  shorttitle = {Recht, Vernunft, Diskurs},
  author = {Alexy, Robert},
  date = {1995},
  edition = {1},
  publisher = {{Suhrkamp}},
  location = {{Frankfurt am Main}},
  isbn = {978-3-518-28767-5},
  langid = {german},
  note = {OCLC: 243802548},
  number = {1167},
  pagetotal = {292},
  series = {Suhrkamp-Taschenbuch Wissenschaft}
}
\end{filecontents}

\begin{document}

\cite{alexyRechtVernunftDiskurs1995}

\printbibliography

\end{document}

In the next step I would like to get the citation of books right. With the above MWE, verbose outputs:

Alexy. Recht, Vernunft, Diskurs: Studien zur Rechtsphilosophie. 1st ed. 1995, 75.

What I want is:

Alexy, Recht, Vernunft, Diskurs: Studien zur Rechtsphilosophie¹ (1995), 75.

After the first mention, the citation should be (it should show the short-title instead of title):

Alexy, Recht, Vernunft, Diskurs¹ (1995), 75.

How can I achieve this?

3
  • Note that in this case a minimal working example would also include a (very) short document loading biblatex that uses you biblatex.cfg as well as a few relevant example .bib entries. – moewe May 7 '20 at 6:14
  • By 'upper-case' for the "1" do you mean superscript? Like "this¹"? Should the edition number be directly after the title with no space or directly before the year with no space? – moewe May 7 '20 at 6:15
  • Yes, it should be "Alexy, Recht, Vernunft, Diskurs: Studien zur Rechtsphilosophie¹ (1995), 75." I'll quickly add a short .tex file. – philipp_th May 7 '20 at 6:46
3

If you want to manipulate styles like this you probably should have a look at the source. In this case, you will want to look at

The files are linked to their release version on GitHub here, but you can (and probably should) look at the versions that are installed on your system instead. You can find out where the files hide by typing kpsewhich <file> in the command line. See also What is the location of the biblatex citation style files?.

The general setup

The relevant bits from verbose.cbx are

\newbibmacro*{cite}{%
  \usebibmacro{cite:citepages}%
  \ifciteseen
    {\iffieldundef{shorthand}
       {\usebibmacro{cite:short}}
       {\usebibmacro{cite:shorthand}}}
    {\usebibmacro{cite:full}}}

\newbibmacro*{cite:full}{%
  \usebibmacro{cite:full:citepages}%
  \printtext[bibhypertarget]{%
    \usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}}%
  \usebibmacro{shorthandintro}}

\newbibmacro*{cite:short}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}}}

That means that cite executes cite:full for the first citation of an entry and cite:short for all subsequent citations. cite:full calls \usedriver, which means that it produces the same output as the bibliography.

So if you want to change the output of the first citation, you essentially need to change the bibliography output. For subsequent citations you need to modify cite:short.

Customise follow-up citations

Note that currently all entry types use the same cite:short definition, since it just prints author/editor and (short)title, which is pretty much universal. If you want to add additional pieces of data, you may have to resort to a more complex setup if the additional data may depend on the entry type. It would work roughly like this

\newbibmacro*{cite:short-standard}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}}}

\newbibmacro*{cite:short:book}{%
  \printnames{labelname}%
  \setunit*{\printdelim{nametitledelim}}%
  \printtext[bibhyperlink]{%
    \printfield[citetitle]{labeltitle}%
    \printfield{edition}}%
  \setunit{\addspace}%
  \printdate}

\renewbibmacro*{cite:short}{%
  \ifbibmacroundef{cite:short:\strfield{entrytype}}
    {\usebibmacro{cite:short-standard}}
    {\usebibmacro*{cite:short:\strfield{entrytype}}}}

This approach is for example explained in custom citation style for custom document and used in Custom verbose citations don't look like bibliography to customise citations of the @interview type and in Customize second citation for books, articles, incollection and Make style=verbose's short citations for @online more verbose for @online. (A similar principle is shown in Presentation References -- no-title footnotes, allowing arXiv and Customize citation with bibulous.)

Customise the first citation

As mentioned above, the first citation is essentially a copy of the bibliography output, so to modify the first citation, it is easiest to modify the bibliography output.

If your bibliography output and first citation should look different, there are two options

  • small differences can be obtained with the <precode> argument of \usedriver, for example cite:full says

    \usedriver
      {\DeclareNameAlias{sortname}{default}}
      {\thefield{entrytype}}
    

    so that (with the standard setup and style=verbose) you get "Emma Sigfridsson and Ulf Ryde" in citations, but the bibliography will show "Sigfridsson, Emma and Ulf Ryde".

    Depending on the exact nature and structure of the change, you can even pull quite significant changes here.

  • If you have very large differences between first citation and bibliography, you may need to think of a different scheme. It may for example be possible to copy each driver declared with \DeclareBibliographyDriver in the .bbx file and write a dedicated driver for citation. This is also what I recommended in Switching driver after first citation. You might then have

    \DeclareBibliographyDriver{article}{%
    ... bib output for @article ...
    }
    
    \DeclareBibliographyDriver{cite:article}{%
    ... first cite output for @article ...
    }
    
    \DeclareBibliographyDriver{book}{%
    ... bib output for @book ...
    }
    
    \DeclareBibliographyDriver{cite:book}{%
    ... first cite output for @book ...
    }
    
    \renewbibmacro*{cite:full}{%
      \usebibmacro{cite:full:citepages}%
      \printtext[bibhypertarget]{%
        \usedriver
          {\DeclareNameAlias{sortname}{default}}
          {cite:\thefield{entrytype}}}%
      \usebibmacro{shorthandintro}}
    

Unrelated observations about your biblatex.cfg

In your biblatex.cfg you have an extensive list of \clear... commands in \AtEveryCitekey and \AtEveryBibitem. That is not particularly easy to read (I find) and not very efficient.

Usually I prefer to use \DeclareSourcemap to remove unwanted fields in documents when you don't (want to) modify the used style heavily. See for example Excessive fields in biblatex could not be removed if using \fullcite. The advantage is that fields removed with a sourcemap never get processed by Biber and that you only have to do it once and not for bibliography and citations separately.

If you are writing a style, however, it is often easier to suppress fields by simply redefining (or not using) the bibmacros that print them. Instead of saying (Problems in suppressing "series" field)

\AtEveryCitekey{%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}}{}}

\AtEveryBibitem{%
  \ifentrytype{book}{%
    \clearfield{series}%
    \clearfield{number}}{}}

or

\DeclareSourcemap{
  \maps[datatype=bibtex]{
    \map{
       \pertype{book}
       \step[fieldset=series, null]
       \step[fieldset=number, null]
    }
  }
}

you could just say

\renewbibmacro*{series+number}{}

or delete that macro from the drivers and gone are the fields.

In general one should avoid hard coding text or punctuation in biblatex: Use bibstrings and biblatex's punctuation commands instead.

Instead of

% -- "/" between names but "," and "and" in textcite
\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimFormat{finalnamedelim}{\slash}
\DeclareDelimFormat[textcite]{multinamedelim}{,\space}
\DeclareDelimFormat[textcite]{finalnamedelim}{~and\space}

write

\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[textcite]{multinamedelim}{\addcomma\space}
% not sure if a no-breaking space is the best choice here,
% so I'd probably prefer \addspace over \addnbspace
\DeclareDelimFormat[textcite]{finalnamedelim}{\addnbspace\bibstring{and}\space}

Overall formatting for name fields can be applied with wrappers. So

\DeclareNameFormat{family}{\mkbibemph{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}}%
  \usebibmacro{name:andothers}}

would be

\DeclareNameFormat{family}{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}}

 \DeclareNameWrapperFormat{family}{\mkbibemph{#1}}

Here is a start with the (very similar) drivers for @book and @collection

\documentclass[naustrian]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[backend=biber,
  style=verbose,
  citepages=suppress,
  autocite=footnote,
  dashed=false,
]{biblatex}

\renewcommand*{\newunitpunct}{\addcomma\space}

\DeclareNameFormat{family}{%
  \usebibmacro{name:family}
    {\namepartfamily}
    {\namepartgiven}
    {\namepartprefix}
    {\namepartsuffix}%
  \usebibmacro{name:andothers}}

\DeclareNameWrapperFormat{family}{\mkbibemph{#1}}

\DeclareNameAlias{default}{family}
\DeclareNameAlias{sortname}{default}
\DeclareNameAlias{labelname}{default}

\DeclareNameWrapperAlias{default}{family}
\DeclareNameWrapperAlias{sortname}{default}
\DeclareNameWrapperAlias{labelname}{default}

\DeclareDelimFormat{multinamedelim}{\slash}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}
\DeclareDelimFormat[textcite]{multinamedelim}{\addcomma\space}
% not sure if a no-breaking space is the best choice here,
% so I'd probably prefer \addspace over \addnbspace
\DeclareDelimFormat[textcite]{finalnamedelim}{\addspace\bibstring{and}\space}


\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}

\renewcommand*{\subtitlepunct}{\addcolon\space}

\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat*{booktitle}{#1}
\DeclareFieldFormat*{citetitle}{#1}
\DeclareFieldFormat*{journaltitle}{#1}

\DeclareFieldFormat{volume}{\RN{#1}}

\DeclareFieldFormat{date}{\mkbibparens{#1}}

\DeclareFieldFormat{superedition}{\mkbibsuperscript{#1}}

\DeclareBibliographyDriver{book}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{author/editor}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \setunit{\space}%
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \setunit{}%
  \printfield[superedition]{edition}%
  \setunit{\addspace}\newblock
  \usebibmacro{date}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\DeclareBibliographyDriver{collection}{%
  \usebibmacro{bibindex}%
  \usebibmacro{begentry}%
  \usebibmacro{editor}%
  \setunit{\printdelim{nametitledelim}}\newblock
  \usebibmacro{maintitle+title}%
  \setunit{\space}%
  \iffieldundef{maintitle}
    {\printfield{volume}%
     \printfield{part}}
    {}%
  \setunit{}%
  \printfield[superedition]{edition}%
  \setunit{\addspace}\newblock
  \usebibmacro{date}%
  \setunit{\bibpagerefpunct}\newblock
  \usebibmacro{pageref}%
  \newunit\newblock
  \iftoggle{bbx:related}
    {\usebibmacro{related:init}%
     \usebibmacro{related}}
    {}%
  \usebibmacro{finentry}}

\renewcommand*{\finentrypunct}{}

\begin{filecontents}{\jobname.bib}
@book{alexyRechtVernunftDiskurs1995,
  title      = {Recht, Vernunft, Diskurs},
  subtitle   = {Studien zur Rechtsphilosophie},
  author     = {Alexy, Robert},
  date       = {1995},
  edition    = {1},
  publisher  = {Suhrkamp},
  location   = {Frankfurt am Main},
  isbn       = {978-3-518-28767-5},
  langid     = {german},
  note       = {OCLC: 243802548},
  number     = {1167},
  pagetotal  = {292},
  series     = {Suhrkamp"=Taschenbuch Wissenschaft},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
Lorem \autocite{alexyRechtVernunftDiskurs1995}
ipsum \autocite{alexyRechtVernunftDiskurs1995}

\printbibliography
\end{document}

Alexy, Recht, Vernunft, Diskurs: Studien zur Rechtsphilosophie¹ (1995).

I decided to re-use as many existing macros as possible, but if some of those don't quite do what you want you may want to think about redefining them or using your own versions.

9
  • Thanks for the detailed answer! – philipp_th May 7 '20 at 10:58
  • I still have one question however. How can I modify the bibliography output to match my desired citation style? – philipp_th May 7 '20 at 11:51
  • @philipp_th Since you seem to want quite large changes compared to the standard styles, I would probably suggest you rewrite the bibliography driver. What it should look like exactly will depend on what you need to happen for @book entries with additional fields (for example editor, translator, maintitle, volume, ...). It's hard to write a solid driver from just one example. It would also help if you could provide an example .tex and .bib file. – moewe May 7 '20 at 15:34
  • I added a MWE. Book should only consist of editor or author if no editor is specified (both in italics), title, volume in roman letters, edition in superscript and year in brackets. At this point, would it be better to make the bibliography style from scratch as opposed to modifying another one so heavily? – philipp_th May 8 '20 at 10:16
  • @philipp_th If that's all a @book should ever show, then I believe it would be better to write a new driver for @book. If it's the same with other entry types compared to the standard style, you essentially end up creating a new style anyway. So yes, from what I know so far I think you would be better of writing a new style from scratch. (Of course writing from scratch doesn't mean that you can't copy copious amounts of code from the biblatex standard styles.) – moewe May 8 '20 at 13:54

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.