summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/biblatex-oxref/oxalph.bbx
blob: de9438edf6538d348f9d5b2d8da88ff8e77323b9 (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
%%
%% 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{2019/02/15 v1.0}
\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
}{}{\wlog{WARNING: biblatex-oxref (oxalph) failed to patch bbx@opt@mergedate@maximum (print)}}
\xpatchcmd{\bbx@opt@mergedate@maximum}{%
  \csuse{print\thefield{labeldatesource}dateextra}%
}{%
  \csuse{print\thefield{labeldatesource}date}%
}{}{\wlog{WARNING: biblatex-oxref (oxalph) failed to patch bbx@opt@mergedate@maximum (label)}}
\xpatchcmd{\bbx@opt@mergedate@compact}{%
  \csuse{print\thefield{labeldatesource}dateextra}%
}{%
  \csuse{print\thefield{labeldatesource}date}%
}{}{\wlog{WARNING: biblatex-oxref (oxalph) failed to patch bbx@opt@mergedate@compact}}
\xpatchbibmacro{labeldate}{%
  \printlabeldateextra
}{%
  \printlabeldate
}{}{\wlog{WARNING: biblatex-oxref (oxalph) failed to patch labeldate}}
\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–2019 Alex Ball
%%
%% End of file `oxalph.bbx'.