summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-oxref/oxalph.bbx
blob: 9f182735ae1ac5dc4161881d1811e6a90b490eed (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
%%
%% This is file `oxalph.bbx',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% oxref.dtx  (with options: `bbx,a')
%% ----------------------------------------------------------------
%% biblatex-oxref --- Biblatex styles inspired by the Oxford Guide to Style
%% Author:  Alex Ball
%% E-mail:  a.j.ball@bath.ac.uk
%% License: Released under the LaTeX Project Public License v1.3c or later
%% See:     http://www.latex-project.org/lppl.txt
%% ----------------------------------------------------------------
%% 
\def\Version{2018/01/26 v0.11.1}
\NeedsTeXFormat{LaTeX2e}[1999/12/01]
\ProvidesFile{oxalph.bbx}
    [\Version\space Alphabetic bibliography style inspired by the Oxford Guide to Style]
\RequireBibliographyStyle{oxyear}
\xpatchcmd{\bbx@opt@mergedate@maximum}{%
  \printdateextra
}{%
  \printdate
}{}{}
\xpatchcmd{\bbx@opt@mergedate@maximum}{%
  \csuse{print\thefield{labeldatesource}dateextra}
}{%
  \csuse{print\thefield{labeldatesource}date}
}{}{}
\xpatchcmd{\bbx@opt@mergedate@maximum}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{}
\xpatchcmd{\bbx@opt@mergedate@compact}{%
  \csuse{print\thefield{labeldatesource}dateextra}
}{%
  \csuse{print\thefield{labeldatesource}date}
}{}{}
\xpatchcmd{\bbx@opt@mergedate@compact}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{}
\xpatchcmd{\bbx@opt@mergedate@year}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{}
\xpatchcmd{\bbx@opt@mergedate@basic}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{}
\xpatchcmd{\bbx@opt@mergedate@minimum}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{}
\xpatchcmd{\bbx@opt@mergedate@false}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{}
\ExecuteBibliographyOptions{mergedate}

\ExecuteBibliographyOptions{labelalpha,sorting=anyt}

\DeclareFieldFormat{labelalphawidth}{\mkbibbrackets{#1}}
\DeclareFieldFormat{shorthandwidth}{\mkbibbrackets{#1}}

\defbibenvironment{bibliography}
  {\list
     {\printtext[labelalphawidth]{%
        \printfield{labelprefix}%
\printfield{labelalpha}%
        \printfield{extraalpha}}}
     {\setlength{\labelwidth}{\labelalphawidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}%
      \renewcommand*{\makelabel}[1]{##1\hss}}
  {\endlist}
  {\item}

\defbibenvironment{shorthand}
  {\list
     {\printfield[shorthandwidth]{shorthand}}
     {\setlength{\labelwidth}{\shorthandwidth}%
      \setlength{\leftmargin}{\labelwidth}%
      \setlength{\labelsep}{\biblabelsep}%
      \addtolength{\leftmargin}{\labelsep}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}%
      \renewcommand*{\makelabel}[1]{##1\hss}}}
  {\endlist}
  {\item}
\DeclareStyleSourcemap{%
  \maps[datatype=bibtex]{%
    \map[overwrite=false]{%
      \step[fieldsource=title, final]
      \step[fieldset=shortlabeltitle, origfieldval]
      \step[fieldsource=subtitle]
      \step[fieldset=shortlabeltitle, origfieldval, append=true]
      \step[fieldsource=shortlabeltitle,
            match=\regexp{[^\p{Lu}]},
            replace=\regexp{}]
}}}
\DeclareLabelalphaTemplate{%
  \labelelement{
    \field[final]{shorthand}
    \field{label}
    \field[strwidth=3,strside=left,ifnames=1]{labelname}
    \field[strwidth=1,strside=left]{labelname}
    \field[strwidth=3,strside=left]{shortlabeltitle}
    \field[strwidth=4,strside=left]{labeltitle}
  }
  \labelelement{
    \field[strwidth=2,strside=right]{labelyear}
  }
}
%% 
%% Copyright (C) 2016–2018 Alex Ball
%%
%% End of file `oxalph.bbx'.