2

MWE:

\documentclass{book}
\usepackage{a4wide}
\usepackage{fancyhdr}
\usepackage{graphicx}
\usepackage{polyglossia}
\setmainlanguage[spelling=new,babelshorthands=true]{german}
\usepackage[autostyle]{csquotes}
\usepackage[style=authortitle-icomp,backref=true,backrefstyle=two+,hyperref=true,isbn=false,backend=biber,citereset=chapter,bibencoding=utf8]{biblatex}

\usepackage{filecontents}
\begin{filecontents}{file.bib}
@BOOK{b1,
  author = { first1 last1},
  title = {title1},
  year = {1993},
  note = {tt}
}
@BOOK{b2,
    author = { first2 last2},
    title = {title2},
    year = {1994}
}
\end{filecontents}

\addbibresource{file.bib}
\begin{document}
text \footcite{b1} text.
text \footcite{b2} haha. 
\end{document}

I want to achieve that the author of b1, which has some keyword in the note field, in this case tt, is formatted with \texttt{} while entries which don't have the keyword in the note field, are formatted in a standard way. There is nothing else in the note field than the keyword.

So, expanded it should give

\texttt{last1}, title1
last2, title2

in the footnotes as well as in the bibliography instead of this current result.

Thanks for the help.

17
  • You are looking for the \iffieldequalstr command. In the current version of the biblatex documentation it is in section 4.6.2 on page 182. Sep 15, 2015 at 19:21
  • If you can use the keyword field (which will not be printed, unlike the note field) you just need \ifkeyword{tt}. Alternatively you can use the options field but then you will have to do a bit more work to set things up nicely. What do you need this for in your document? Maybe there is an easier solution.
    – moewe
    Sep 15, 2015 at 19:30
  • I just have a lot of anonymous sources which are formatted like author = {P/L/51-65/T} and want to use a monospace font for the author to line them all up nicely to be easier to read.
    – Philipp
    Sep 15, 2015 at 19:32
  • OK, would using they keywords field be an option for you? Or do you prefer the note field? (That is do you want the output or not?) But maybe using an author field for anonymous sources such as this isn't the best idea in the first place ...
    – moewe
    Sep 15, 2015 at 19:36
  • Ok but how do I actually do the formatting? in the preamble I guess. I'd have to read through the biblatex docs. Any biblatex pros here?
    – Philipp
    Sep 15, 2015 at 19:36

1 Answer 1

2

Depending on what you are trying to do here it might be a good idea to create a new entry type, see Creating Entry in Bibtex for Executive Orders and the slightly more involved How can I create entirely new data types with BibLaTeX/Biber?.

Changing the author font depending on the keywords field, which I think is better suited for this task than the note field, is not very hard

\renewcommand*\mkbibnamelast[1]{\ifkeyword{chiffreauthor}{\texttt{#1}}{#1}}

makes sure to print all entries with the keyword chiffreauthor in a typewriter font.

\documentclass[ngerman]{article}
\usepackage{babel}
\usepackage[autostyle]{csquotes}
\usepackage[style=authortitle-icomp,backend=biber]{biblatex}

\usepackage{filecontents}
\begin{filecontents*}{\jobname.bib}
@BOOK{b1,
  author   = {first1 last1},
  title    = {title1},
  year     = {1993},
  keywords = {chiffreauthor},
}
@BOOK{b2,
    author = { first2 last2},
    title  = {title2},
    year   = {1994}
}
\end{filecontents*}

\addbibresource{\jobname.bib}

\renewcommand*\mkbibnamelast[1]{\ifkeyword{chiffreauthor}{\texttt{#1}}{#1}}

\begin{document}
text \footcite{b1} text.
text \footcite{b2} haha. 
\end{document}

enter image description here

If you want to make use of the note field, which is going to be printed, you can use

\renewcommand*\mkbibnamelast[1]{\iffieldequalstr{note}{chiffreauthor}{\texttt{#1}}{#1}}
4
  • Note that I would strongly advocate creating a new type if the relevant entries don't fit into the existing scheme of entry types, if they are interviews, survey/study reports or the like. But I don't see a point in creating a different entry types for say books with "anonymous" authors, when there is already the type @book.
    – moewe
    Sep 16, 2015 at 9:18
  • What version was this tested on? Running texlive 2015.20160320 on Kubuntu 16.04, the above MWE produces identical formatting for both footnotes. Aug 8, 2018 at 14:23
  • 1
    @Supernormal Judging by the date it would have been either biblatex 3.0 or 3.1, so quite a few versions ago. If you are running 3.3 or above you need \mkbibnamefamily instead of \mkbibnamelast, see tex.stackexchange.com/q/299036/35864
    – moewe
    Aug 8, 2018 at 14:26
  • @Supernormal Depending on what exactly you want to do there are more elegant methods to do this and related things now. Field annotations come to mind: tex.stackexchange.com/q/349570/35864
    – moewe
    Aug 8, 2018 at 14:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .