summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/biblatex/examples/94-labelprefix.tex
blob: 666c5f5f512e21dd16299571126443fdd8e23d68 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
\documentclass[a4paper]{article}
\usepackage{fontspec}
\usepackage{csquotes}
\usepackage[style=numeric, sorting=none, defernumbers=true, backend=biber]{biblatex}
\addbibresource{biblatex-examples.bib}

\DeclareBibliographyCategory{cat1}
\addtocategory{cat1}{yoon}
\DeclareBibliographyCategory{cat2}
\addtocategory{cat2}{piccato}
\assignrefcontextcats[sorting=none,labelprefix=Q]{cat2}
\assignrefcontextentries[labelprefix=Q]{yoon}
\assignrefcontextkeyws*[sorting=none,labelprefix=S]{secondary}
\defbibfilter{cats}{category=cat1 or category=cat2}

\DeclareRefcontext{rcone}{labelprefix=R}
\DeclareRefcontext{rctwo}{labelprefix=T}
\DeclareRefcontext{rcthree}{sorting=nty}

\setlength{\parindent}{0pt}
\newcommand{\cmd}[1]{\texttt{\textbackslash #1}}
\begin{document}
This example demonstrates the quite complex options for assigning
labelprefices to bibliographies and how citations decide which bibliography
to point to. The default rule is that a citation will point to its entry in
the last bibliography in which it appears. This can be overridden by
explicit assignment to particular refcontexts with the
\cmd{assignrefcontext*} macros.\\

% refcontext=none/global//

This is a publication by Aristotle:
\cite{aristotle:anima} % comes from refcontext=none/global/R

These are not publications by Aristotle:
\cite{yoon} % comes from default refcontext=none/global/Q due to \assignrefcontextentries
\cite{worman} % comes from default refcontext=nty/global// and not from
              % nty/global/T in next refsection even though that is the
              % last printed bib/biblist with worman in it. This is because
              % refcontext defaults are local to refcontexts
\cite{piccato} % comes from refcontext=none/global/Q due to \assignrefcontextcats
\cite{nussbaum} % comes from refcontext=none/global/S due to \assignrefcontextkeyws*

This is another publication by Aristotle:
\cite{aristotle:physics} % comes from refcontext=none/global/R

\begin{refcontext}{rcone}
% refcontext=none/global/R
\printbibliography[keyword=primary, title={Aristotle Publications}]
% aristotle:anima and aristotle:physics default refcontext is this one
\end{refcontext}

% Alternative style of specifying refcontext
% Note here that the optional argument to \newrefcontext overrides the
% value set with the named refcontext
\newrefcontext[labelprefix=S]{rctwo}
% refcontext=none/global/S
\printbibliography[notkeyword=primary, title={Other publications}]
\endrefcontext

\begin{refcontext}[labelprefix=Q]
% refcontext=none/global/Q
\printbibliography[filter=cats, title={Other publications}]
\end{refcontext}

\begin{refcontext}[sorting=nty]
% refcontext=nty/global//
\printbibliography[resetnumbers, notkeyword=primary, title={More Other publications}]
% Nussbaum default refcontext is this one
% piccato default refcontext is this one
% yoon default refcontext is this one
% worman default refcontext is this one
\cite{nussbaum} % comes from refcontext=nty/global// due to weak \assignrefcontextkeyws*
\end{refcontext}

\section*{New Refsection}
\newrefsection
\cite{worman} % comes from default refcontext=nty/global/T
\begin{refcontext}[labelprefix=T]{rcone}
% refcontext=nty/global//
\printbibliography[resetnumbers, notkeyword=primary, title={More Other publications}]
\end{refcontext}

\end{document}