1

I am trying to customize a biblatex citation style (adapted from biblatex-juradiss). I have the problem that in my text I use many \cite commands which have two or more authors given in the prenote, and I want them formatted similarly to the editors of the publication that is referenced. So if I write

\cite[Smith, John and Johnson, Henry][23]{biblabel}

I would like the output to look like:

Smith / Johnson in: Editora / Editorb, other bibliographical data, p. 23.

where Editora and Editorb are the editor's surnames from the entry in my .bib file, and "other bibliographical data" stands for whatever biblatex would normally output after the editors. Biblatex does the editor list nicely, and I'd like the authors to look the same.

Please note that the slashes are not in italics, so I can't just give the additional author names inline with the slash in the prenote. Also, biblatex uses whitespace in the editor list which is somewhat narrower than usual.

  • The issue with this is that the prenote argument would have to be passed to Biber from within the document, as Biber has to parse name list like these for biblatex to make sense of them - and I'm not sure how that would work. You could create a dummy entry for "Smith, John and Johnson, Henry" though like @misc{smithjohnson, author{Smith, John and Johnson, Henry}} in the .bib file and then do \cite[\citeauthor{smithjohnson}][23]{biblabel}. (If you go for this option, biblatex. comfortable author citing might be of interest to you.) – moewe May 23 '14 at 5:10
  • Instead of using @misc for the dummy entry smithjohnson, it might be better to create a new entry type @person/@author that does not appear in the bibliography even if cited and just holds the names. See also Create a register of persons with biblatex. – moewe May 23 '14 at 5:14
  • Since last coming here, I have understood more of the issue. The core problem is biblatex's data model: I was going to use the prenote for displaying a list of authors. This would require to treat the data entry for the prenote as a name list, while it is a field, which has no index. The "obvious" solution should be to go to the data model definition and change the type of the prenote entry from "field" to "names", and then in the .cbx file copy the author format into that of the prenote field. Sadly, this looks like more than I can chew at this time, as submission date is drawing closer. – Michael Aug 9 '14 at 20:21
  • The problem with this approach though is that postnote and prenote are treated differently from the other fields by biblatex. While the standard fields are consumed (and digested) by Biber, Biber does not get to see either postnote or prenote, neither are the two fields mentioned in any of the data model files (so one would not be able to change the type from field to name; and it would be necessary for Biber to be able to see the post/prenote fields). – moewe Aug 10 '14 at 8:49
4

The main problem is that name lists have to be parsed by Biber/BibTeX so they can be used properly. But the prenote and postnote field are local to the .tex file and are not passed to Biber for consumption.

So we either have to pass the prenote to Biber by means of writing to a temporary file, or we have to fake Biber's name parsing from within the document with biblatex/LaTeX itself.

The first method is can be implemented with limited extra work. The command \formatasname can be used anywhere to return a list of names as they would be written in a .bib file as biblatex would print them.

\formatasname writes the names it is given to a temporary .bib file and then cites them. In the process the names are parsed by Biber and are formatted just like other names.

Just be careful that you have no .bib file ending with -formatnames.bib in your folder. That file is automatically created by the code below and will be overwritten without warning.

\documentclass[british]{report}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage{babel}
\usepackage{csquotes}

\usepackage[style=authoryear, backend=biber]{biblatex}

\makeatletter
\DeclareCiteCommand{\nfblx@formatasname}
  {}
  {\printnames[labelname]{author}}
  {}
  {}

\def\nfblx@bibfile@name{\jobname -formatnames.bib}
\newwrite\nfblx@bibfile
\immediate\openout\nfblx@bibfile=\nfblx@bibfile@name
\newcounter{nfblx@name}
\setcounter{nfblx@name}{0}
\newcommand*{\formatasname}[1]{%
  \stepcounter{nfblx@name}%
  \edef\nfblx@tmp@cite{%
    \noexpand\nfblx@formatasname{nfblx@name@\the\value{nfblx@name}}%
  }%
  \nfblx@tmp@cite
  \immediate\write\nfblx@bibfile{%
    @misc{nfblx@name@\the\value{nfblx@name}, author = {\unexpanded{#1}}, %
          options = {dataonly=true},}%
  }%
}

\AtEndDocument{%
  \closeout\nfblx@bibfile}

\addbibresource{\nfblx@bibfile@name}
\makeatother

\addbibresource{biblatex-examples.bib}

\begin{document}
\cite[\formatasname{Humprey Appleby and Bernard Woolley} in:][13]{sigfridsson}
\printbibliography
\end{document}

enter image description here

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.