summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-musuos/musuos.cbx
blob: 7959047eee0e0ecb332230968e0d8a9c34c4a146 (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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
% Tobias Weh, 2011

% THANKS to Audrey form TeX.SX for building the
% quoted-in-cite-code. His code is marked with the
% pseudo tag <audrey>.
% See http://tex.stackexchange.com/q/27964/4918
\ProvidesFile{musuos.cbx}[2011/09/10 v1.0 Musikwissenschaften Uni Osnabrueck]

% Ausgangsstil laden
\RequireCitationStyle{verbose-ibid}

% Voreinstellungen
\ExecuteBibliographyOptions{
	autocite=footnote, 
	labelyear=true,
	dashed=false,
	urldate=long,
%<audrey>
	citetracker=true,
	ibidtracker=true,
	ibidpage=true,
%</audrey>
}

% Auf die neue Sprachdatei umleiten
\DeclareLanguageMapping{german}{german-musuos}

% Zitatmacros anpassen
\renewbibmacro*{cite:short}{% 
	\iffieldequalstr{entrytype}{music}{%
		\iffieldundef{userb}{%
			\printnames{labelname}%
			\newunit{\addcolon\space}{\printfield{title}}
		}{%
			\printfield{userb}%
		}
	}{%
		\ifthenelse{\ifnameundef{labelname}\OR\iffieldundef{labelyear}}{%
			\printnames{labelname}% 
			\setunit{\nameyeardelim}%
			\usebibmacro{cite:label}% 
		 	\setunit{\addcolon}%
		}{%
			\printnames{labelname}% 
			\setunit{\nameyeardelim}% 
			\usebibmacro{cite:labelyear+extrayear}%
		}%
	}%
} 

\newbibmacro*{cite:labelyear+extrayear}{% 
	\iffieldundef{labelyear}{%
	}{%
		\printtext[bibhyperref]{% 
	 		\printfield{labelyear}% 
	 		\printfield{extrayear}}
	 }%
}

\newbibmacro*{cite:label}{%
	\newunit{\nameyeardelim}{o.\,J.}% 
}

\renewbibmacro*{shorthandintro}{%
  \iffieldundef{shorthandintro}
    {\iffieldundef{shorthand}
       {}
       {\setunit{\addspace}%
        \printtext[parens]{%
          \bibstring{citedas}\space
          \mkbibquote{\printfield{shorthand}}}}}
    {\setunit{\addspace}%
     \printtext[parens]{\printfield{shorthandintro}}}}

%<audrey>
\newbibmacro*{cite:quotee}{%
  \savefieldcs{postnote}{cbx@post}%
  \ifboolexpr{ test {\ifciteseen} and not test {\iftoggle{cbx@fullquote}} }
    {\iffieldundef{shorthand}
       {\ifboolexpr{ not test {\iffirstonpage}
                     and test {\ifsamepage{\value{instcount}}{\value{instcount}-2}}
                     and test {\iftoggle{cbx@iflastquote}}
                     and test {\iffieldequalcs{entrykey}{cbx@lastquoteekey}} }
          {\printtext[bibhyperlink]{\bibstring[\mkibid]{ibidem}}%
           \iffieldequalcs{postnote}{cbx@lastquoteepost}
             {\clearfield{postnote}}
             {\global\toggletrue{cbx@ifquoteepost}}%
           \global\toggletrue{cbx@iflastibid}}
          {\usebibmacro{cite:short}}}
       {\usebibmacro{cite:shorthand}}}
    {\usebibmacro{cite:full}}%
  \csxdef{cbx@lastquoteepost}{\csuse{cbx@post}}}

\newbibmacro*{cite:quoter}{%
  \savefieldcs{postnote}{cbx@post}%
  \ifboolexpr{ not test {\iftoggle{cbx@fullquote}}
               and test {\iftoggle{cbx@iflastibid}}
               and test {\iffieldequalcs{entrykey}{cbx@lastquoterkey}} }
    {\iffieldequalcs{postnote}{cbx@lastquoterpost}
       {\clearfield{postnote}}
       {\global\toggletrue{cbx@ifquoterpost}}}
    {\iftoggle{cbx@iflastibid}
       {\quotedelim}
       {}%
     \global\togglefalse{cbx@iflastibid}%
     \ifboolexpr{ test {\ifciteseen} and not test {\iftoggle{cbx@fullquote}} }
       {\iffieldundef{shorthand}
          {\usebibmacro{cite:short}}
          {\usebibmacro{cite:shorthand}}}
       {\usebibmacro{cite:full}}}%
  \csxdef{cbx@lastquoterpost}{\csuse{cbx@post}}%
  \global\togglefalse{cbx@ifquoteepost}}

\DeclareCiteCommand{\cbx@quotecite}
  {\usebibmacro{prenote}}
  {\ifnumless{\value{multicitecount}}{2}% <loopcode>
     {\usebibmacro{citeindex}% Current entry is a quotee
      \addtocategory{quotee}{\thefield{entrykey}}%
      \xdef\cbx@quoteekey{\thefield{entrykey}}%
      \usebibmacro{cite:quotee}%
      \csxdef{cbx@lastquoteekey}{\thefield{entrykey}}}
     {\addtocategory{quoter}{\thefield{entrykey}}% Current entry is a quoter
      \xifinlistcs{\thefield{entrykey}}{cbx@quoterlist@\cbx@quoteekey}
        {}
        {\csxappto{cbx@quoter@\cbx@quoteekey}{\thefield{entrykey},}%
         \listcsxadd{cbx@quoterlist@\cbx@quoteekey}{\thefield{entrykey}}}%
      \usebibmacro{cite:quoter}%
      \csxdef{cbx@lastquoterkey}{\thefield{entrykey}}}}
  {\multicitedelim}
  {\iftoggle{cbx@iflastibid}
     {\iftoggle{cbx@ifquoteepost}
        {\let\postnotedelim=\quoteepostdelim}
        {\iftoggle{cbx@ifquoterpost}
           {\let\postnotedelim=\quoterpostdelim}
           {}}}
     {}%
   \usebibmacro{cite:postnote}%
   \global\toggletrue{cbx@iflastquote}}

\newrobustcmd{\cbx@mkfullquote}{%
  \AtNextCite{\citetrackerfalse}%
  \toggletrue{cbx@fullquote}}

\DeclareMultiCiteCommand{\quotecite}
  [\cbx@qcwrapper\relax\mkbibautoformat] 
  {\cbx@quotecite} 
  {\cbx@qcdelim}
\DeclareMultiCiteCommand{\fullquotecite}
  [\cbx@qcwrapper\cbx@mkfullquote\mkbibautoformat]
  {\cbx@quotecite}
  {\cbx@qcdelim}

\newrobustcmd{\mkbibautoformat}[1]{%
  \cslet{cbx@autocite}{\autocite}%
  \ifcsequal{cbx@autocite}{blx@acite@inline}
    {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}}
                  or test {\ifdefstring{\blx@bbxfile}{alphabetic}} }
       {\mkbibbrackets{#1}}
       {\mkbibparens{#1}}}
    {\ifcsequal{cbx@autocite}{blx@acite@footnote}
       {\iffootnote
          {\ifboolexpr{ test {\ifdefstring{\blx@bbxfile}{numeric}}
                        or test {\ifdefstring{\blx@bbxfile}{alphabetic}} }
             {\mkbibbrackets{#1}}
             {\mkbibparens{#1}}}
          {\mkbibfootnote{#1}}}
       {\ifcsequal{cbx@autocite}{blx@acite@superscript}
          {\mkbibsuperscript{#1}}
          {#1}}}}


\newrobustcmd{\cbx@qcwrapper}[3]{%
  \global\toggletrue{cbx@isquote}%
  \global\togglefalse{cbx@fullquote}%
  #1#2{#3}%
  \global\togglefalse{cbx@isquote}%
  \global\togglefalse{cbx@iflastibid}%
  \global\togglefalse{cbx@ifquoteepost}%
  \global\togglefalse{cbx@ifquoterpost}}

\newrobustcmd{\cbx@qcdelim}{%
  \iftoggle{cbx@iflastibid}
    {}
    {\quotedelim}}
%</audrey>

% Feldformate anpassen
\DeclareFieldFormat{url}{\url{#1}}
\DeclareFieldFormat{urldate}{\bibstring{urlseen}\space#1}

\endinput