| 1 |
% |
| 2 |
% This file demonstrates the data annotation feature |
| 3 |
% |
| 4 |
\documentclass[a4paper]{article} |
| 5 |
\usepackage{fontspec} |
| 6 |
\usepackage[american]{babel} |
| 7 |
\usepackage{csquotes} |
| 8 |
\begin{filecontents}[force]{\jobname.bib} |
| 9 |
@MISC{ann1, |
| 10 |
AUTHOR = {Last1, First1 and Last2, First2 and Last3, First3}, |
| 11 |
AUTHOR+an = {1:family=student;2=corresponding}, |
| 12 |
TITLE = {The Title}, |
| 13 |
TITLE+an:default = {=titleannotation}, |
| 14 |
TITLE+an:french = {="Le titre"}, |
| 15 |
TITLE+an:german = {="Der Titel"} |
| 16 |
} |
| 17 |
\end{filecontents} |
| 18 |
\usepackage[backend=biber]{biblatex} |
| 19 |
\addbibresource{\jobname.bib} |
| 20 |
|
| 21 |
\renewcommand*{\mkbibnamefamily}[1]{% |
| 22 |
\ifitemannotation{corresponding} |
| 23 |
{\textbf{#1}} |
| 24 |
{#1}% |
| 25 |
\ifpartannotation{family}{student} |
| 26 |
{\textsuperscript{*}} |
| 27 |
{}} |
| 28 |
|
| 29 |
% Default for numeric style so we are overriding the active format for titles |
| 30 |
\DeclareFieldFormat{titlecase}{ |
| 31 |
\iffieldannotation{titleannotation}{\textsc{#1}}{#1}% |
| 32 |
\hasfieldannotation[][french]{\mkbibparens{\getfieldannotation[][french]}}{}% |
| 33 |
\hasfieldannotation[][german]{\mkbibparens{\getfieldannotation[][german]}}{}} |
| 34 |
|
| 35 |
\begin{document} |
| 36 |
The annotation feature allows the user to attach metadata, either in the |
| 37 |
form of strings to be tested for in formatting commands, or in the form of |
| 38 |
strings to be printed as-is. This example demonstrates all aspects of the |
| 39 |
annotation feature: |
| 40 |
|
| 41 |
\begin{itemize} |
| 42 |
\item Metadata attaching to fields, items in a list or parts of an item in |
| 43 |
a list (e.g. name parts) |
| 44 |
\item Literal annotations where the annotation is a string to be printed |
| 45 |
rather than used as a metadata test for other formatting. |
| 46 |
\item Multiple named annotations for the same data field. |
| 47 |
\item The ``default'' name for annotations with no explicit name. |
| 48 |
\end{itemize} |
| 49 |
|
| 50 |
\cite{ann1} |
| 51 |
\printbibliography |
| 52 |
\end{document} |