| 1 |
\documentclass[a4paper]{article} |
| 2 |
\usepackage{fontspec} |
| 3 |
\usepackage{libertine} |
| 4 |
\usepackage[fallback]{xeCJK} |
| 5 |
\usepackage[british]{babel} |
| 6 |
\usepackage{csquotes} |
| 7 |
\begin{filecontents}[force]{\jobname.bib} |
| 8 |
@book{tolstoy, |
| 9 |
author = {given=Лев, patronymic=Николаевич, family=Толстой, nametemplates=russian}, |
| 10 |
title = {Война и мир}, |
| 11 |
date = {1877}, |
| 12 |
langid = {russian}, |
| 13 |
} |
| 14 |
@book{bulgakov, |
| 15 |
author = {given=Михаил, patronymic=Афанасьевич, family=Булгаков, nametemplates=russian}, |
| 16 |
title = {Мастер и Маргарита}, |
| 17 |
date = {1966}, |
| 18 |
langid = {russian}, |
| 19 |
} |
| 20 |
@book{bulgakov:val, |
| 21 |
author = {given=Валентин, patronymic=Фёдорович, family=Булгаков, nametemplates=russian}, |
| 22 |
title = {Л. Н. Толстой в последний год его жизни}, |
| 23 |
date = {1911}, |
| 24 |
langid = {russian}, |
| 25 |
} |
| 26 |
|
| 27 |
@book{dosto:1, |
| 28 |
author = {given=Александр , patronymic=Андреевич, family=Достоевский, nametemplates=russian}, |
| 29 |
title = {О строении телец Грандри}, |
| 30 |
date = {1885}, |
| 31 |
langid = {russian}, |
| 32 |
} |
| 33 |
@book{dosto:2, |
| 34 |
author = {given=Андрей , patronymic=Андреевич, family=Достоевский, nametemplates=russian}, |
| 35 |
title = {П. П. Семенов-Тян-Шанский как исследователь, географ и статистик}, |
| 36 |
date = {1914}, |
| 37 |
langid = {russian}, |
| 38 |
} |
| 39 |
|
| 40 |
@book{demeke, |
| 41 |
author = {given=Kebede, patronymic=Daniel, papponymic=Demeke, nametemplates=ethiopian}, |
| 42 |
title = {One}, |
| 43 |
date = {1983} |
| 44 |
} |
| 45 |
@book{dameke, |
| 46 |
author = {given=Kebede, patronymic=Daniel, papponymic=Dameke, nametemplates=ethiopian}, |
| 47 |
title = {Two}, |
| 48 |
date = {1983} |
| 49 |
} |
| 50 |
@book{james, |
| 51 |
author = {given=Kebede, patronymic=James, papponymic=Demeke, nametemplates=ethiopian}, |
| 52 |
title = {Three}, |
| 53 |
date = {1983} |
| 54 |
} |
| 55 |
@book{jonathan, |
| 56 |
author = {given=Kebede, patronymic=Jonathan, papponymic=Kebede, nametemplates=ethiopian}, |
| 57 |
title = {Four}, |
| 58 |
date = {1986} |
| 59 |
} |
| 60 |
@book{william, |
| 61 |
author = {given=Kebede, patronymic=William, papponymic=Kebede, nametemplates=ethiopian}, |
| 62 |
title = {Four}, |
| 63 |
date = {1987} |
| 64 |
} |
| 65 |
|
| 66 |
@book{zhangx1, |
| 67 |
title = {Shuming}, |
| 68 |
titleaddon = {書名}, |
| 69 |
author = {family=Zhang, cjk=章學成, given=Xuecheng, nametemplates=cjk}, |
| 70 |
location = {Beijing}, |
| 71 |
publisher = {Zhonghua Shuju}, |
| 72 |
date = {2017}, |
| 73 |
} |
| 74 |
@book{zhangx2, |
| 75 |
title = {Shuming er}, |
| 76 |
titleaddon = {書名二}, |
| 77 |
author = {family=Zhang, cjk=張學成, given=Xuecheng, nametemplates=cjk}, |
| 78 |
location = {Shanghai}, |
| 79 |
publisher = {Shangwu Yinshuguan}, |
| 80 |
date = {2016}, |
| 81 |
} |
| 82 |
|
| 83 |
@book{bronte:c, |
| 84 |
author = {Charlotte Brontë}, |
| 85 |
date = {1847}, |
| 86 |
title = {Jane Eyre}, |
| 87 |
} |
| 88 |
@book{bronte:e, |
| 89 |
author = {Emily Brontë}, |
| 90 |
date = {1847}, |
| 91 |
title = {Wuthering Heights}, |
| 92 |
} |
| 93 |
|
| 94 |
@book{austen:jane, |
| 95 |
author = {Jane Austen}, |
| 96 |
date = {1813}, |
| 97 |
title = {Pride and Prejudice}, |
| 98 |
} |
| 99 |
@collection{austen:john, |
| 100 |
editor = {John Austen}, |
| 101 |
editortype = {compiler}, |
| 102 |
date = {1924}, |
| 103 |
title = {Rogues in Porcelain: A Miscellany of 18th Poems}, |
| 104 |
} |
| 105 |
\end{filecontents} |
| 106 |
\usepackage[style=authoryear,datamodel=93-nameparts,backend=biber, autolang=hyphen]{biblatex} |
| 107 |
\addbibresource{biblatex-examples.bib} |
| 108 |
\addbibresource{\jobname.bib} |
| 109 |
|
| 110 |
|
| 111 |
% Use transliteration to sort Cyrillic among Latin script |
| 112 |
\DeclareSortTranslit{ |
| 113 |
\translit[russian]{*}{russian}{bgn/pcgn-standard} |
| 114 |
} |
| 115 |
|
| 116 |
\makeatletter |
| 117 |
%% CJK names |
| 118 |
% the idea is to sort family -> given -> cjk (full name) |
| 119 |
% and disambiguate in the same manner using only full |
| 120 |
% forms of the name, no initials |
| 121 |
% the order should always be family -> given -> cjk |
| 122 |
% names are not reversed |
| 123 |
\DeclareSortingNamekeyTemplate[cjk]{ |
| 124 |
\keypart{ |
| 125 |
\namepart{family} |
| 126 |
} |
| 127 |
\keypart{ |
| 128 |
\namepart{given} |
| 129 |
} |
| 130 |
\keypart{ |
| 131 |
\namepart{cjk} |
| 132 |
} |
| 133 |
} |
| 134 |
|
| 135 |
\DeclareNamehashTemplate[russian]{ |
| 136 |
\namepart[hashscope=full]{prefix} |
| 137 |
\namepart[hashscope=full]{family} |
| 138 |
\namepart[hashscope=full]{suffix} |
| 139 |
\namepart[hashscope=full]{given} |
| 140 |
\namepart[hashscope=full]{patronymic} |
| 141 |
} |
| 142 |
|
| 143 |
\DeclareNamehashTemplate[ethiopian]{ |
| 144 |
\namepart[hashscope=full]{prefix} |
| 145 |
\namepart[hashscope=full]{family} |
| 146 |
\namepart[hashscope=full]{suffix} |
| 147 |
\namepart[hashscope=full]{given} |
| 148 |
\namepart[hashscope=full]{patronymic} |
| 149 |
\namepart[hashscope=full]{papponymic} |
| 150 |
} |
| 151 |
|
| 152 |
\DeclareNamehashTemplate[cjk]{ |
| 153 |
\namepart[hashscope=full]{prefix} |
| 154 |
\namepart[hashscope=full]{family} |
| 155 |
\namepart[hashscope=full]{suffix} |
| 156 |
\namepart[hashscope=full]{given} |
| 157 |
\namepart[hashscope=full]{cjk} |
| 158 |
} |
| 159 |
|
| 160 |
\DeclareUniquenameTemplate[cjk]{ |
| 161 |
\namepart[base=true]{family} |
| 162 |
\namepart[disambiguation=full]{given} |
| 163 |
\namepart[disambiguation=full]{cjk} |
| 164 |
} |
| 165 |
|
| 166 |
\newbibmacro*{name:cjk}[3]{% |
| 167 |
\usebibmacro{name:delim}{#2#3#1}% |
| 168 |
\usebibmacro{name:hook}{#2#3#1}% |
| 169 |
\mkbibnamefamily{#1}% |
| 170 |
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibnamegiven{#2}}% |
| 171 |
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibnamecjk{#3}}} |
| 172 |
|
| 173 |
%% Ethiopian names |
| 174 |
% Ethiopian names are given -> patronymic -> papponymic |
| 175 |
% the latter two are only needed for disambiguation |
| 176 |
% names order is never reversed |
| 177 |
\DeclareSortingNamekeyTemplate[ethiopian]{ |
| 178 |
\keypart{ |
| 179 |
\namepart{given} |
| 180 |
} |
| 181 |
\keypart{ |
| 182 |
\namepart{patronymic} |
| 183 |
} |
| 184 |
\keypart{ |
| 185 |
\namepart{papponymic} |
| 186 |
} |
| 187 |
} |
| 188 |
|
| 189 |
\DeclareUniquenameTemplate[ethiopian]{ |
| 190 |
\namepart[base=true]{given} |
| 191 |
\namepart[disambiguation=full]{patronymic} |
| 192 |
\namepart[disambiguation=full]{papponymic} |
| 193 |
} |
| 194 |
|
| 195 |
\newbibmacro*{name:ethiopian}[3]{% |
| 196 |
\usebibmacro{name:delim}{#1#2#3}% |
| 197 |
\usebibmacro{name:hook}{#1#2#3}% |
| 198 |
\mkbibethgiven{#1}% |
| 199 |
\ifdefvoid{#2}{}{\bibnamedelimd\mkbibethpat{#2}\isdot}% |
| 200 |
\ifdefvoid{#3}{}{\bibnamedelimd\mkbibethpap{#3}\isdot}} |
| 201 |
|
| 202 |
\let\mkbibethgiven\mkbibnamefamily |
| 203 |
\let\mkbibethpat\mkbibnamegiven |
| 204 |
\let\mkbibethpap\mkbibnamegiven |
| 205 |
|
| 206 |
%% Russian names |
| 207 |
% family -> given -> patronymic |
| 208 |
% we never show the given name alone, it is always accompanied |
| 209 |
% by the patronymic |
| 210 |
% (patronymic could just be treated as another given name) |
| 211 |
% reversed name order is 'family, given patronymic' |
| 212 |
\DeclareSortingNamekeyTemplate[russian]{ |
| 213 |
\keypart{ |
| 214 |
\namepart{family} |
| 215 |
} |
| 216 |
\keypart{ |
| 217 |
\namepart{given} |
| 218 |
} |
| 219 |
\keypart{ |
| 220 |
\namepart{patronymic} |
| 221 |
} |
| 222 |
} |
| 223 |
|
| 224 |
\DeclareUniquenameTemplate[russian]{ |
| 225 |
\namepart[base=true]{family} |
| 226 |
\namepart{given} |
| 227 |
\namepart{patronymic} |
| 228 |
} |
| 229 |
|
| 230 |
\newbibmacro*{name:russian}[3]{% |
| 231 |
\usebibmacro{name:delim}{#1#2#3}% |
| 232 |
\usebibmacro{name:hook}{#1#2#3}% |
| 233 |
\ifdefvoid{#2} |
| 234 |
{} |
| 235 |
{\mkbibnamegiven{#2}\isdot\bibnamedelimd |
| 236 |
\ifdefvoid{#3} |
| 237 |
{} |
| 238 |
{\mkbibnamepatronymic{#3}\isdot\bibnamedelimd}}% |
| 239 |
\mkbibnamefamily{#1}} |
| 240 |
|
| 241 |
\newbibmacro*{name:russian-rev}[3]{% |
| 242 |
\usebibmacro{name:delim}{#1#2#3}% |
| 243 |
\usebibmacro{name:hook}{#1#2#3}% |
| 244 |
\mkbibnamefamily{#1}% |
| 245 |
\ifdefvoid{#2} |
| 246 |
{} |
| 247 |
{\revsdnamepunct\bibnamedelimd |
| 248 |
\mkbibnamegiven{#2}\isdot |
| 249 |
\ifdefvoid{#3} |
| 250 |
{} |
| 251 |
{\bibnamedelimd\mkbibnamepatronymic{#3}\isdot}}} |
| 252 |
|
| 253 |
%% sortname |
| 254 |
% helper to select the sorting template in \ifcase |
| 255 |
\newcommand*{\abx@sortingnamekeytemplate}{0} |
| 256 |
\newcommand*{\abx@getsortingnamekeytemplate}{% |
| 257 |
\ifsortingnamekeytemplatename{cjk} |
| 258 |
{\def\abx@sortingnamekeytemplate{1}} |
| 259 |
{\ifsortingnamekeytemplatename{ethiopian} |
| 260 |
{\def\abx@sortingnamekeytemplate{2}} |
| 261 |
{\ifsortingnamekeytemplatename{russian} |
| 262 |
{\def\abx@sortingnamekeytemplate{3}} |
| 263 |
{}}}} |
| 264 |
|
| 265 |
% show fullest version of names, |
| 266 |
% reverse Russian and western names for sorting |
| 267 |
% all other names are always in the correct order for sorting |
| 268 |
\DeclareNameFormat{sortname}{% |
| 269 |
\abx@getsortingnamekeytemplate |
| 270 |
\ifcase\abx@sortingnamekeytemplate\relax |
| 271 |
\usebibmacro{name:family-given} |
| 272 |
{\namepartfamily} |
| 273 |
{\namepartgiven} |
| 274 |
{\namepartprefix} |
| 275 |
{\namepartsuffix}% |
| 276 |
\or |
| 277 |
\usebibmacro{name:cjk} |
| 278 |
{\namepartfamily} |
| 279 |
{\namepartgiven} |
| 280 |
{\namepartcjk}% |
| 281 |
\or |
| 282 |
\usebibmacro{name:ethiopian} |
| 283 |
{\namepartgiven} |
| 284 |
{\namepartpatronymic} |
| 285 |
{\namepartpapponymic}% |
| 286 |
\or |
| 287 |
\usebibmacro{name:russian-rev} |
| 288 |
{\namepartfamily} |
| 289 |
{\namepartgiven} |
| 290 |
{\namepartpatronymic}% |
| 291 |
\fi |
| 292 |
\usebibmacro{name:andothers}} |
| 293 |
|
| 294 |
%% labelname |
| 295 |
% copy of the standard definition in biblatex.def |
| 296 |
% uses the 'old way' of finding the disambiguating name part |
| 297 |
\newbibmacro{labelname:western}{% |
| 298 |
\ifcase\value{uniquename}% |
| 299 |
\usebibmacro{name:family} |
| 300 |
{\namepartfamily} |
| 301 |
{\namepartgiven} |
| 302 |
{\namepartprefix} |
| 303 |
{\namepartsuffix}% |
| 304 |
\or |
| 305 |
\ifuseprefix |
| 306 |
{\usebibmacro{name:given-family} |
| 307 |
{\namepartfamily} |
| 308 |
{\namepartgiveni} |
| 309 |
{\namepartprefix} |
| 310 |
{\namepartsuffixi}} |
| 311 |
{\usebibmacro{name:given-family} |
| 312 |
{\namepartfamily} |
| 313 |
{\namepartgiveni} |
| 314 |
{\namepartprefixi} |
| 315 |
{\namepartsuffixi}}% |
| 316 |
\or |
| 317 |
\usebibmacro{name:given-family} |
| 318 |
{\namepartfamily} |
| 319 |
{\namepartgiven} |
| 320 |
{\namepartprefix} |
| 321 |
{\namepartsuffix}% |
| 322 |
\fi |
| 323 |
\usebibmacro{name:andothers}} |
| 324 |
|
| 325 |
% Uses \iffieldequalstr{uniquepart} to find the disambiguating |
| 326 |
% name part. |
| 327 |
% If neither base (i.e. family) nor given name are enough, |
| 328 |
% go with the full name. |
| 329 |
% Uses \empty for suppressed name parts, so we don't have to define |
| 330 |
% dedicated macros for the shorter name forms. |
| 331 |
\newbibmacro{labelname:cjk}{% |
| 332 |
\iffieldequalstr{uniquepart}{base}% |
| 333 |
{\usebibmacro{name:cjk} |
| 334 |
{\namepartfamily} |
| 335 |
{\empty} |
| 336 |
{\empty}} |
| 337 |
{\iffieldequalstr{uniquepart}{given}% |
| 338 |
{\usebibmacro{name:cjk} |
| 339 |
{\namepartfamily} |
| 340 |
{\namepartgiven} |
| 341 |
{\empty}} |
| 342 |
{\usebibmacro{name:cjk} |
| 343 |
{\namepartfamily} |
| 344 |
{\namepartgiven} |
| 345 |
{\namepartcjk}}}} |
| 346 |
|
| 347 |
% similar to the CJK format |
| 348 |
\newbibmacro{labelname:ethiopian}{% |
| 349 |
\iffieldequalstr{uniquepart}{base}% |
| 350 |
{\usebibmacro{name:ethiopian} |
| 351 |
{\namepartgiven} |
| 352 |
{\empty} |
| 353 |
{\empty}} |
| 354 |
{\iffieldequalstr{uniquepart}{patronymic}% |
| 355 |
{\usebibmacro{name:ethiopian} |
| 356 |
{\namepartgiven} |
| 357 |
{\namepartpatronymic} |
| 358 |
{\empty}} |
| 359 |
{\usebibmacro{name:ethiopian} |
| 360 |
{\namepartgiven} |
| 361 |
{\namepartpatronymic} |
| 362 |
{\namepartpapponymic}}}} |
| 363 |
|
| 364 |
% Uses \iffieldequalstr{uniquepart} to get the disambiguating |
| 365 |
% name part. |
| 366 |
% We only choose between 'Given Patronymic Family' and |
| 367 |
% 'G. P. Family', the decision whether or not to use |
| 368 |
% initials is for the given name to decide. |
| 369 |
% If the given initial is enough to disambiguate the name, |
| 370 |
% the given name and patronymic become initials. |
| 371 |
% Even if the initial of the patronymic would make the name |
| 372 |
% unique we go with the full name instead. |
| 373 |
% There is no 'Given P. Family' format. |
| 374 |
% \namepart<>un=1 says initials are enough |
| 375 |
% 2 means the full name is required |
| 376 |
% 0 means not used |
| 377 |
\newbibmacro{labelname:russian}{% |
| 378 |
\iffieldequalstr{uniquepart}{base}% |
| 379 |
{\usebibmacro{name:russian} |
| 380 |
{\namepartfamily} |
| 381 |
{\empty} |
| 382 |
{\empty}} |
| 383 |
{\ifnum\namepartgivenun=1\relax |
| 384 |
\usebibmacro{name:russian} |
| 385 |
{\namepartfamily} |
| 386 |
{\namepartgiveni} |
| 387 |
{\namepartpatronymici}% |
| 388 |
\else |
| 389 |
\usebibmacro{name:russian} |
| 390 |
{\namepartfamily} |
| 391 |
{\namepartgiven} |
| 392 |
{\namepartpatronymic}% |
| 393 |
\fi}} |
| 394 |
|
| 395 |
% helper to select the uniquename template in \ifcase |
| 396 |
\newcommand*{\abx@uniquenametemplatename}{0} |
| 397 |
\newcommand*{\abx@getuniquenametemplatename}{% |
| 398 |
\ifuniquenametemplatename{cjk} |
| 399 |
{\def\abx@uniquenametemplatename{1}} |
| 400 |
{\ifuniquenametemplatename{ethiopian} |
| 401 |
{\def\abx@uniquenametemplatename{2}} |
| 402 |
{\ifuniquenametemplatename{russian} |
| 403 |
{\def\abx@uniquenametemplatename{3}} |
| 404 |
{}}}} |
| 405 |
|
| 406 |
\DeclareNameFormat{labelname}{% |
| 407 |
\abx@getuniquenametemplatename |
| 408 |
\ifcase\abx@uniquenametemplatename\relax |
| 409 |
\usebibmacro{labelname:western}% |
| 410 |
\or |
| 411 |
\usebibmacro{labelname:cjk}% |
| 412 |
\or |
| 413 |
\usebibmacro{labelname:ethiopian}% |
| 414 |
\or |
| 415 |
\usebibmacro{labelname:russian}% |
| 416 |
\fi |
| 417 |
\usebibmacro{name:andothers}} |
| 418 |
\makeatother |
| 419 |
|
| 420 |
\begin{document} |
| 421 |
% Historically, name handling in latex bibliographies has been determined by |
| 422 |
% the name parsing rules of bibtex. In a modern context, this name handling |
| 423 |
% is rather archaic, restricted to Western names with the four parts |
| 424 |
% "family", "given", "prefix", "suffix" (often referred to in bibtex |
| 425 |
% documentation as "last", "first", "von" and "Jr" parts). When using biber, |
| 426 |
% it is possible to define arbitrary name parts since the allowable name |
| 427 |
% parts are defined in the data model (see accompanying file 93-nameparts.dbx). |
| 428 |
|
| 429 |
% Here we demonstrate the possibility of adding a new name parts to the |
| 430 |
% datamodel and then using it in formatting, sorting etc. |
| 431 |
% Notice that we can use the new name part types in the datasource |
| 432 |
% which is now allowable due to the enhanced datamodel constant definition. |
| 433 |
% We have also defined a new name format and method of sorting names which |
| 434 |
% are aware of the new name parts. |
| 435 |
% |
| 436 |
\textcite{tolstoy,bulgakov,bulgakov:val} |
| 437 |
|
| 438 |
\textcite{dosto:1} |
| 439 |
|
| 440 |
\textcite{dosto:2} |
| 441 |
|
| 442 |
\textcite{demeke,dameke,james,jonathan,william} |
| 443 |
|
| 444 |
\textcite{sigfridsson,worman,geer,knuth:ct:a,cicero,companion,vangennep} |
| 445 |
|
| 446 |
\textcite{bronte:c,bronte:e,austen:jane,austen:john} |
| 447 |
|
| 448 |
\textcite{zhangx1,zhangx2} |
| 449 |
|
| 450 |
\printbibliography |
| 451 |
\end{document} |