summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex/latex/bbx/reading.bbx
blob: 3eb35c3909c10b8faaf62e3b4e6771dfe3573c4e (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
\ProvidesFile{reading.bbx}
[\abx@bbxid]

\RequireBibliographyStyle{standard}

\DeclareNameAlias{author}{default}
\DeclareNameAlias{editor}{default}
\DeclareNameAlias{translator}{default}

\DeclareNameWrapperAlias{author}{default}
\DeclareNameWrapperAlias{editor}{default}
\DeclareNameWrapperAlias{translator}{default}

\DeclareFieldFormat{entrykey}{\mbox{\bfseries#1}}
\DeclareFieldFormat{annotation}{\bibstring{annotation}\addcolon\space #1}
\DeclareFieldFormat{abstract}{\bibstring{abstract}\addcolon\space #1}
\DeclareFieldFormat{library}{\bibstring{library}\addcolon\space #1}
\DeclareFieldFormat{file}{\bibstring{file}\addcolon\space \url{#1}}
\DeclareFieldFormat{shorthandwidth}{#1}

\InitializeBibliographyStyle{%
  \global\undef\bbx@lasthash}

\setlength{\bibitemsep}{0.5\baselineskip}
\setlength{\bibparsep}{0pt}

\defbibenvironment{bibliography}
  {\list
     {}
     {\setlength{\leftmargin}{0pt}%
      \setlength{\itemindent}{0pt}%
      \setlength{\itemsep}{\bibitemsep}%
      \setlength{\parsep}{\bibparsep}}}
  {\endlist}
  {\bbx@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}

\def\bbx@item@false{%
  \itemsep2\bibitemsep
  \item\relax
  \itemsep\bibitemsep}

\def\bbx@item@true{%
  \bbx@item@full}

\def\bbx@item@full{%
  \itemsep2\bibitemsep
  \@itempenalty\z@
  \item\relax
  \begingroup
  \samepage\bfseries
  \def\finentrypunct{\strut}%
  \usebibmacro{entryhead:full}%
  \ifbool{bbx:entrykey}
    {\def\newblockpunct{%
       \nobreak\hskip\z@skip\strut
       \hfill\penalty100\hskip1em\relax
       \hbox{}\nobreak\hfill\strut}%
     \def\finentrypunct{%
       \parfillskip\z@\finalhyphendemerits\z@
       \par\nobreak}%
     \newblock
     \printfield{entrykey}}
    {}%
  \finentry
  \endgroup
  \hrule height 1.25pt\relax
  \itemsep\bibitemsep
  \@itempenalty\@M
  \item\strut
  \@itempenalty\z@}

\def\bbx@item@name{%
  \iffieldequals{fullhash}{\bbx@lasthash}
    {\bbx@item@false}
    {\itemsep2\bibitemsep
     \@itempenalty\z@
     \item\relax
     \begingroup
     \samepage\bfseries
     \def\finentrypunct{\strut}%
     \usebibmacro{entryhead:name}%
     \finentry
     \endgroup
     \hrule height 1.25pt\relax
     \itemsep\bibitemsep
     \@itempenalty\@M
     \item\strut
     \@itempenalty\z@}}

\newbool{bbx:entrykey}
\newbool{bbx:annotation}
\newbool{bbx:abstract}
\newbool{bbx:library}
\newbool{bbx:file}

\DeclareBiblatexOption{global,type,entry}[boolean]{entryhead}[true]{%
  \ifcsdef{bbx@item@#1}
    {\letcs\bbx@item{bbx@item@#1}}
    {\PackageError{biblatex}
       {Invalid option 'header=#1'}
       {Valid values: header=true, false, full, name.}}}
\DeclareBiblatexOption{global,type,entry}[boolean]{entrykey}[true]{%
  \setbool{bbx:entrykey}{#1}}
\DeclareBiblatexOption{global,type,entry}[boolean]{annotation}[true]{%
  \setbool{bbx:annotation}{#1}}
\DeclareBiblatexOption{global,type,entry}[boolean]{abstract}[true]{%
  \setbool{bbx:abstract}{#1}}
\DeclareBiblatexOption{global,type,entry}[boolean]{library}[true]{%
  \setbool{bbx:library}{#1}}
\DeclareBiblatexOption{global,type,entry}[boolean]{file}[true]{%
  \setbool{bbx:file}{#1}}

\ExecuteBibliographyOptions{loadfiles,entryhead,entrykey,annotation,abstract,library,file}

\newbibmacro*{entryhead:full}{%
  \printnames[labelname][-1]{labelname}%
  \setunit*{\addcolon\space}%
  \printfield{labeltitle}}

\newbibmacro*{entryhead:name}{%
  \ifnameundef{labelname}
    {\printfield{labeltitle}}
    {\printnames[labelname]{labelname}}%
  \savefield{fullhash}{\bbx@lasthash}}

\newbibmacro*{entrytail}{%
  \newunit\newblock
  \begingroup
  \def\newblockpunct{\item}%
  \ifbool{bbx:annotation}
    {\usebibmacro{annotation}%
     \newunit\newblock}
    {}%
  \ifbool{bbx:abstract}
    {\usebibmacro{abstract}%
     \newunit\newblock}
    {}%
  \ifbool{bbx:file}
    {\printfield{file}%
     \newunit\newblock}
    {}%
  \ifbool{bbx:library}
    {\printfield{library}%
     \newunit\newblock}
    {}%
  \endgroup}

\renewbibmacro*{finentry}{%
  \ifbibliography
    {\usebibmacro{entrytail}}
    {}%
  \finentry}

\DeclareBibliographyDriver{set}{%
  \renewbibmacro*{finentry}{\finentry}%
  \entryset{}{}%
  \newunit\newblock
  \usebibmacro{setpageref}%
  \ifbibliography
    {\usebibmacro{entrytail}}
    {}%
  \finentry}

\endinput