# Change 'Chapter' in @inbook to 'Appendix' for one BibLaTex entry

I'm working on a thesis and I want to quote twice from one book using the type @inbook. Once I want to quote a regular chapter. This works fine and yields something like

[1] AuthorA. "TitleA". In: Booktitle. Chap. 1.

The other quote is an appendix. My problem is that I can't manage to replace Chap. by App. in the Bibligraphy. I'd like to have something like

[2] AuthorB. "TitleB". In: Booktitle. App. 4.

but instead just have an ugly A4 for appendix 4 in the chapter field

[2] AuthorB. "TitleB". In: Booktitle. Chap. A4.

I managed to change Chap. to some other string with \DefineBibliographyStrings but obviously this changes all Chap. entries and thus does not solve my problem. Is there a way to change this for just one entry? Or do I have to create a new type?

My question is quite similar to this one but the author differs so I can not use the solution proposed there.

A MWE for the situation where I am stuck at:

\documentclass{scrbook}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}

\begin{filecontents}{refs.bib}
@Inbook{CiteA,
Title                    = {TitleA},
Author                   = {AuthorA},
Booktitle                = {Booktitle},
Chapter                  = {1},
}
@Inbook{CiteB,
Title                    = {TitleB},
Author                   = {AuthorB},
Booktitle                = {Booktitle},
Chapter                  = {A4},
}

\end{filecontents}

\nocite{*}

\begin{document}
\printbibliography
\end{document}

• As the manual says, this field is controversial. You could use a note={App. A4} (or perhaps a subtitle...) or not include the information in the bibliography and cite as \cite[App. A4]{CiteB} May 21, 2014 at 18:58

One could also tell biblatex whether to print "appendix" or "chapter" based on an option set in the .bib file.

First we define a switch (toggle) to toggle from "chapter" to "appendix" on a per-entry basis

\newtoggle{bib@appendix} % fallback is false
\DeclareEntryOption{appendix}[true]{\settoggle{bib@appendix}{#1}}


Obviously, we will need the "appendix" bib string (unlike Guido above, we will implement this in a separate .lbx file, so we can have both a full and an abbreviated version of the string; if you like you can use Guido's version instead)

\ProvidesFile{english-append.lbx}[2014/05/22 english with appendix]
\InheritBibliographyExtras{english}
\NewBibliographyString{appendix}
\DeclareBibliographyStrings{%
inherit   = {english},
}


The .lbx file must be put somewhere LaTeX can find it - in the MWE below it will be created with filecontents, if you plan to use it more often, you really should save it in an appropriate directory. It can then be loaded via \DeclareLanguageMapping{english}{english-append}.

\DeclareFieldFormat{chapter}{%
\iftoggle{bib@appendix}
{\bibstring{appendix}}
{\bibstring{chapter}}~#1}


Then we can toggle the "appendix" string via options = {appendix}, CiteB would look like this

@Inbook{CiteB,
title     = {TitleB},
author    = {AuthorB},
booktitle = {Booktitle},
chapter   = {A4},
options   = {appendix}
}


MWE

\documentclass{scrbook}
\usepackage[backend=biber]{biblatex}
\usepackage{filecontents}

\begin{filecontents*}{\jobname.bib}
@Inbook{CiteA,
Title                    = {TitleA},
Author                   = {AuthorA},
Booktitle                = {Booktitle},
Chapter                  = {1},
}
@Inbook{CiteB,
title     = {TitleB},
author    = {AuthorB},
booktitle = {Booktitle},
chapter   = {A4},
options   = {appendix}
}
\end{filecontents*}

\begin{filecontents*}{english-append.lbx}
\ProvidesFile{english-append.lbx}[2014/05/22 english with appendix]
\InheritBibliographyExtras{english}
\NewBibliographyString{appendix}
\DeclareBibliographyStrings{%
inherit   = {english},
}
\end{filecontents*}
\DeclareLanguageMapping{english}{english-append}

\newtoggle{bib@appendix} % fallback is false
\DeclareEntryOption{appendix}[true]{\settoggle{bib@appendix}{#1}}

\DeclareFieldFormat{chapter}{%
\iftoggle{bib@appendix}
{\bibstring{appendix}}
{\bibstring{chapter}}~#1}

\nocite{*}

\begin{document}
\printbibliography
\end{document}


Here is a solution: The idea is to change how the chapter field is printed based on the key value of an entry (stored in the entrykey pseudo-field).

First of all, we create a new biblatex string for appendix.

\NewBibliographyString{appendix}
\DefineBibliographyStrings{english}{%
appendix = {Appendix},
}


then, we change the formatting instructions for chapter using a switch (conditional) taking care of a particular value of the field entrykey.

\DeclareFieldFormat{chapter}{%
\iffieldequalstr{entrykey}
{CiteB}
{\bibstring{appendix}}
{\bibstring{chapter}}~#1}


The output for the given MWE is: