summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/biblatex-socialscienceshuberlin/socialscienceshuberlin.bbx
blob: 2616292db89758852e7424d0ff55aa46c70ffe91 (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
% socialsciences|huberlin --%
% Copyright (c) 2018 Lukas C. Bossert 
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
% of this license or (at your option) any later version.
% The latest version of this license is in
% http://www.latex-project.org/lppl.txt
% and version 1.3 or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
\def\sshu@date{2018/05/24}
\def\sshu@version{0.0.1}
\def\sshu@bbxid{\sshu@date\space v\sshu@version\space biblatex-socialsciences|huberlin bibliography style (LCB)}
\def\sshu@cbxid{\sshu@date\space v\sshu@version\space biblatex-socialsciences|huberlin citation style (LCB)}
\def\sshu@lbxid{\sshu@date\space v\sshu@version\space biblatex-socialsciences|huberlin localization (LCB)}

\ProvidesFile{socialscienceshuberlin.bbx}[\sshu@bbxid]
\RequireBibliographyStyle{ext-authoryear}

\AtBeginDocument{%
  \urlstyle{same}%
  \typeout{* * * socialsciences|huberlin * * *}
}
\def\socialscienceshuberlinversion{\sshu@version}
\def\socialscienceshuberlindate{\sshu@date}

\ExecuteBibliographyOptions{%
  innamebeforetitle=true,
  autocite=inline,
  isbn=false,
}
%-----------------------
\newtoggle{bbx:colornames}

\DeclareBibliographyOption{colornames}[true]{%
 \csuse{toggle#1}{bbx:colornames}}

\DeclareFieldFormat{pages}{#1}
\DeclareFieldFormat{postnote}{\mknormrange{#1}}
\DeclareFieldFormat{multipostnote}{\mknormrange{#1}}
\DeclareFieldFormat{biblabeldate}{#1} 
\DeclareFieldFormat{origdate}{\mkbibbrackets{#1}}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}} 
\DeclareDelimFormat{editortypedelim}{\addspace} 
\DeclareDelimFormat[bib,biblist]{innametitledelim}{\addcomma\space}
\DeclareFieldFormat[article]{number}{\mkbibparens{#1}}
\DeclareFieldFormat*{title}{#1}
\DeclareFieldFormat[book]{title}{\mkbibemph{#1}}

\RequirePackage{xcolor}
\definecolor{sshuberlincolor}{cmyk}{1, .50, .10, .01} %default


\renewcommand*{\labelnamepunct}{\addcolon\space}
\renewcommand*{\volnumdelim}{\space}
\renewcommand{\postnotedelim}{\addcolon\space}


\DeclareRedundantLanguages{german}{german,ngerman,austrian,naustrian}
\DeclareRedundantLanguages{english,american}{english,american,british,%
 canadian,australian,newzealand,USenglish,UKenglish}
\DeclareLanguageMapping{german}{german-socialscienceshuberlin}


% get origdates after date
\renewbibmacro*{date+extradate}{%
  \iffieldundef{labelyear}
    {}
    {\printtext[\blx@delimcontext labeldate]{%
       \iflabeldateisdate
         {\printdateextra}
         {\printlabeldateextra}}
     \iffieldequalstr{labeldatesource}{orig}
       {}
       {\printorigdate}}}

% https://tex.stackexchange.com/a/364192/98739
\DeclareNameFormat{color-family-given}{%
  \ifgiveninits
    {\usebibmacro{name:color:family-given}
      {\namepartfamily}
      {\namepartgiveni}
      {\namepartprefix}
      {\namepartsuffix}}
    {\usebibmacro{name:color:family-given}
      {\namepartfamily}
      {\namepartgiven}
      {\namepartprefix}
      {\namepartsuffix}}%
  \usebibmacro{name:andothers}}

\newbibmacro*{name:color:family-given}[4]{%
  \ifuseprefix
    {\usebibmacro{name:delim}{#3#1}%
     \usebibmacro{name:hook}{#3#1}%
     \textcolor{red}{%
       \ifdefvoid{#3}{}{%
         \ifcapital
           {\mkbibnameprefix{\MakeCapital{#3}}\isdot}
           {\mkbibnameprefix{#3}\isdot}%
         \ifprefchar{}{\bibnamedelimc}}%
       \mkbibnamefamily{#1}\isdot 
       \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
       \ifdefvoid{#2}{}{\revsdnamepunct\bibnamedelimd\mkbibnamegiven{#2}\isdot}}}
    {\usebibmacro{name:delim}{#1}%
     \usebibmacro{name:hook}{#1}%
     \textcolor{sshuberlincolor}{%
       \mkbibnamefamily{#1}\isdot
       \ifdefvoid{#4}{}{\bibnamedelimd\mkbibnamesuffix{#4}\isdot}%
       \ifboolexpe{%
         test {\ifdefvoid{#2}}
         and
         test {\ifdefvoid{#3}}}
         {}
         {\revsdnamepunct}%  
       \ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}\isdot}%
       \ifdefvoid{#3}{}{\bibnamedelimd\mkbibnameprefix{#3}\isdot}}}}

 % {\DeclareNameAlias{sortname}{color-family-given}} %not working with parens
\DeclareNameAlias{sortname}{color-family-given}
  

\endinput