summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/historische-zeitschrift/cbx/historische-zeitschrift.cbx
blob: 1c00cfc8b44a3edf06ccf8d1788e4c3e5393c996 (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
% historische-zeitschrift.cbx, Dominik Waßenhoven 2008

\ProvidesFile{historische-zeitschrift.cbx}[2010/03/11 v0.9 citation style]

\ExecuteBibliographyOptions{
  citetracker=context,
  ibidtracker=constrict,
  singletitle=false,%<----------------
  pagetracker,
  autocite=footnote
}

\providecommand*{\mkibid}[1]{#1}
\newbool{cbx@loccit}
% to check if a 'see note' phrase is in use:
\newbool{cbx@seenote}

\DeclareBibliographyOption{ibidpage}[true]{%
  \ifstrequal{#1}{true}
    {\ExecuteBibliographyOptions{loccittracker=constrict}}
    {\ExecuteBibliographyOptions{loccittracker=false}}}


%%%%% %%%%% %%%%% %%%%% %%%%% 
%%%%% Reformatting      %%%%% 
%%%%% %%%%% %%%%% %%%%% %%%%% 

\DeclareFieldFormat{citetitle}{#1\isdot}
\DeclareFieldFormat[article]{citetitle}{#1}
\DeclareFieldFormat[inbook]{citetitle}{#1}
\DeclareFieldFormat[incollection]{citetitle}{#1}
\DeclareFieldFormat[inproceedings]{citetitle}{#1}
\DeclareFieldFormat[patent]{citetitle}{#1}
\DeclareFieldFormat[thesis]{citetitle}{#1}
\DeclareFieldFormat[unpublished]{citetitle}{#1}

\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}

%%%%% %%%%% %%%%% %%%%% %%%%% %%%%% 
%%%%% Bibliography strings    %%%%%
%%%%% %%%%% %%%%% %%%%% %%%%% %%%%%  
\DefineBibliographyStrings{german}{%
  seenote   = {wie Anm\adddot},
}

%%%%% %%%%% %%%%% %%%%%  
%%%%% Postnote    %%%%% 
%%%%% %%%%% %%%%% %%%%% 
% has to be redefined, because the 'see note' phrase
% is in parentheses
\renewbibmacro*{postnote}{%
  \ifbool{cbx@seenote}
    {\iffieldundef{postnote}
      {\printtext{\bibrightparen}}
      {\postnotedelim
       \printfield{postnote}%
       \printtext{\bibrightparen}}}
    {\iffieldundef{postnote}
      {}
      {\postnotedelim
       \printfield{postnote}}}}

%%%%% %%%%% %%%%% %%%%% %%%%% 
%%%%% Cite bibmacros    %%%%%
%%%%% %%%%% %%%%% %%%%% %%%%% 

\newbibmacro*{cite}{%
  \global\boolfalse{cbx@seenote}% NEW!
  \iffieldundef{shorthand}
    {\usedriver
       {\DeclareNameAlias{sortname}{default}}
       {\thefield{entrytype}}}
    {\printfield{shorthand}}}

\newbibmacro*{footcite}{%
  \global\boolfalse{cbx@loccit}%
  \global\boolfalse{cbx@seenote}% NEW!
  \ifciteseen
    {\iffieldundef{shorthand}
       {\ifthenelse{\ifciteibid\AND\NOT\iffirstonpage}
          {\usebibmacro{footcite:ibid}}
          {\usebibmacro{footcite:note}}}
       {\usebibmacro{footcite:shorthand}}}
    {\usebibmacro{footcite:full}%
     \usebibmacro{footcite:save}}}

\newbibmacro*{footcite:save}{%
  \ifundef\@thefnmark
    {\ifundef\@theenmark % endnotes.sty
       {\csgdef{cbx@note@\thefield{entrykey}}{%
          \BibliographyWarning{Missing footnote mark}\textbf{??}}}
       {\global\cslet{cbx@note@\thefield{entrykey}}\@theenmark}}
    {\global\cslet{cbx@note@\thefield{entrykey}}\@thefnmark}%
  \csxdef{cbx@first@\thefield{entrykey}}{\the\value{instcount}}}

\newbibmacro*{footcite:full}{%
  \printtext{%
    \bibhypertarget{\thefield{entrykey}:\the\value{instcount}}{%
      \usedriver
	{\DeclareNameAlias{sortname}{default}}
	{\thefield{entrytype}}}}%
  \usebibmacro{shorthandintro}}

\newbibmacro*{footcite:note}{%
  \global\booltrue{cbx@seenote}% NEW!
  \ifnameundef{labelname}
    {\printfield{label}}
    {\printnames{labelname}}%
  \ifsingletitle
    {}
    {\setunit*{\addcomma\space}%
     \printfield[title]{labeltitle}}%
  \setunit*{\addspace}%<--- CHANGED
  \printtext{%
    \bibhyperlink{\thefield{entrykey}:%
                  \@nameuse{cbx@first@\thefield{entrykey}}}{%
      \printtext{\bibleftparen}%
      \bibstring{seenote}\space
      \@nameuse{cbx@note@\thefield{entrykey}}}}}

\newbibmacro*{footcite:ibid}{%
  \printtext{%
    \bibhyperlink{\thefield{entrykey}:%
                  \@nameuse{cbx@first@\thefield{entrykey}}}{%
      \bibstring[\mkibid]{ibidem}}}%
  \ifloccit
    {\global\booltrue{cbx@loccit}}
    {}}
    
\newbibmacro*{footcite:shorthand}{%
  \printtext{%
    \bibhyperlink{\thefield{entrykey}:%
                  \@nameuse{cbx@first@\thefield{entrykey}}}{%
      \printfield{shorthand}}}}

\newbibmacro*{cite:postnote}{%
  \ifbool{cbx@loccit}
    {}
    {\usebibmacro{postnote}}}
    
%%%%% %%%%% %%%%% %%%%% %%%%% 
%%%%% Cite commands     %%%%%
%%%%% %%%%% %%%%% %%%%% %%%%% 

\DeclareCiteCommand{\cite}
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \iffootnote
     {\usebibmacro{footcite}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\parencite}[\mkbibparens]
  {\usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \iffootnote
     {\usebibmacro{footcite}}
     {\usebibmacro{cite}}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\DeclareCiteCommand{\footcite}[\mkbibfootnote]
  {\bibsentence
   \usebibmacro{prenote}}
  {\usebibmacro{citeindex}%
   \usebibmacro{footcite}}
  {\multicitedelim}
  {\usebibmacro{cite:postnote}}

\endinput