summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/biblatex-contrib/hep-bibliography/hep-bibliography-implementation.dtx
blob: 1288b491462bf6e0281900a83f54b65cb783a16e (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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
% \iffalse meta-comment
%
% Copyright (C) 2019 by Jan Hajer
% -----------------------------------
%
% This file may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3c
% 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.3c or later is part of all distributions of LaTeX
% version 2005/12/01 or later.
%
% \fi
%
% \iffalse

%<package>\NeedsTeXFormat{LaTeX2e}[2005/12/01]
%<package>\ProvidesPackage{hep-bibliography}[2021/09/01 v1.0 HEP-Bibliography]
%<datamodel>\ProvidesFile{hep-bibliography.dbx}[2021/08/01 v1.8 HEP-Bibliography biblatex data model]
%<documentation>\ProvidesFile{hep-bibliography-documentation.tex}[2021/08/01 v1.8 HEP-Bibliography documentation]
%
%<*documentation>

\RequirePackage[l2tabu, orthodox]{nag}
\documentclass{ltxdoc}
\AtBeginDocument{\DeleteShortVerb{\|}}
\AtBeginDocument{\MakeShortVerb{\"}}

\EnableCrossrefs
\CodelineIndex
\RecordChanges

\usepackage[parskip]{hep-paper}

\bibliography{bibliography}

\acronym{URL}{uniform resource locator}

\usepackage{hologo}

\MacroIndent=1.5em
\AtBeginEnvironment{macrocode}{\renewcommand{\ttdefault}{clmt}}
%</documentation>

%<*driver>
\expandafter\newif\csname ifshort\endcsname
\shortfalse
\begin{document}
\DocInput{hep-bibliography-implementation.dtx}
\end{document}
%</driver>
%
% \fi
%
% \CheckSum{315}
%
% \CharacterTable
%  {Upper-case    \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%   Lower-case    \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
%   Digits        \0\1\2\3\4\5\6\7\8\9
%   Exclamation   \!     Double quote  \"     Hash (number) \#
%   Dollar        \$     Percent       \%     Ampersand     \&
%   Acute accent  \'     Left paren    \(     Right paren   \)
%   Asterisk      \*     Plus          \+     Comma         \,
%   Minus         \-     Point         \.     Solidus       \/
%   Colon         \:     Semicolon     \;     Less than     \<
%   Equals        \=     Greater than  \>     Question mark \?
%   Commercial at \@     Left bracket  \[     Backslash     \\
%   Right bracket \]     Circumflex    \^     Underscore    \_
%   Grave accent  \`     Left brace    \{     Vertical bar  \|
%   Right brace   \}     Tilde         \~}
%
% \changes{v1.0}{2021/09/01}{Initial version of the style file.}
%
% \ifshort
%<*documentation>
% \fi
%
\GetFileInfo{hep-bibliography.sty}

\title{The \software{hep-bibliography} package\thanks{This document corresponds to \software{hep-bibliography}~\fileversion.}}
\subtitle{Bibliographies for high energy physics}
\author{Jan Hajer \email{jan.hajer@unibas.ch}}
\date{\filedate}

% \ifshort
\begin{document}
% \fi

\newgeometry{vscale=.8, vmarginratio=3:4, includeheadfoot, left=11em, marginparwidth=4.6cm, marginparsep=3mm, right=7em}

\maketitle

\begin{abstract}
The \software{hep-bibliography} package extends the \software{biblatex} package with some functionality mostly useful for high energy physics.
In particular it makes full use of all "bibtex" fields provided by "inspirehep.net".
\end{abstract}

The package can be loaded via "\usepackage{hep-bibliography}".

\DescribeMacro{\bibliography}
\DescribeMacro{\printbibliography}
The \software{biblatex} package \cite{biblatex} is loaded for bibliography management.
The user has to add the line "\bibliography"\marg{my.bib} to the preamble of the document and "\printbibliography" at the end of the document.
The bibliography is generated by \software{Biber} \cite{biber}.
"biblatex" is extended to be able to cope with the "collaboration" and "reportNumber" fields provided by \online{https://inspirehep.net}{inspirehep.net} and a bug in the volume number is fixed.
Additionally, the PubMed IDs are recognized and \online{https://ctan.org}{ctan.org}, \online{https://github.com}{github.com}, \online{https://gitlab.com}{gitlab.com}, \online{https://bitbucket.org}{bitbucket.org}, \online{https://www.launchpad.net}{launchpad.net}, \online{https://sourceforge.net}{sourceforge.net}, and \online{https://hepforge.org}{hepforge.org} are valid "eprinttype"s.
\DescribeMacro{erratum}
Errata can be included using the "related" feature.
\begin{verbatim}
\article{key1,
  ...,
  relatedtype="erratum",
  related="key2",
}
\article{key2,
  ...,
}
\end{verbatim}

% \ifshort
\printbibliography

\end{document}
%
%</documentation>
% \fi
%
% \StopEventually{
% \printbibliography
% \PrintChanges
% }
%
% \appendix
%
% \section{Implementation}
%
%<*package>

% Load the \software{kvoptions} package \cite{kvoptions} and define a "hepbib" namespace.
%    \begin{macrocode}
\RequirePackage{kvoptions}
\SetupKeyvalOptions{
  family=hepbib,
  prefix=hepbib@
}
%    \end{macrocode}
%
% \begin{macro}{bibliography}
% Provide the "style" option for passing a "style" string to the \software{biblatex} package \cite{biblatex} or disabling the automatic loading of "biblatex".
%    \begin{macrocode}
\DeclareStringOption[numeric-comp]{style}
%    \end{macrocode}
% \end{macro}
%
%    \begin{macrocode}
\ProcessKeyvalOptions*
%    \end{macrocode}
%
% \begin{macro}{\online}
% \begin{macro}{\email}
% Define the "\online"\marg{text}\marg{url} macro combining the features of the "\href" and the "\url" macros.
% Define a macro for typesetting emails.
%    \begin{macrocode}
\providecommand{\online}[2]{\texttt{#2}}%
\providecommand{\hep@email}[1]{\online{mailto:#1}{#1}}
\providecommand\email{\hep@email}
\AtBeginDocument{\@ifpackageloaded{hyperref}{%
    \renewcommand{\online}[2]{\href{#1}{\nolinkurl{#2}}}%
  }{}
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{environment}{commalist}
% Define a commalist environment using the "xparse" package \cite{xparse}.
%    \begin{macrocode}
\RequirePackage{xparse}
\ExplSyntaxOn
\NewDocumentEnvironment{commalist}{O{\space}+b}{
  \hep@comma@list:n{#2}
}{#1}
\seq_new:N \hep@items@sequence
\cs_new_protected:Npn \hep@comma@list:n #1{
  \seq_set_split:Nnn \hep@items@sequence{\item}{#1}
  \seq_pop_left:NN \hep@items@sequence \l_tmpa_tl
  \seq_use:Nnnn \hep@items@sequence{~and~}{,~}{,~and~}
}
\ExplSyntaxOff
%    \end{macrocode}
% \end{environment}
%
%
% \begin{macro}{\bibliography}
% Load the \software{biblatex} package \cite{biblatex} with the datamodel defined in \cref{sec:data model}.
%    \begin{macrocode}
\RequirePackage[style=\hepbib@style, datamodel=hep-bibliography]{biblatex}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{hep-bibliography}
% Provide the "\DeclareSortingTemplate" macro for older "biblatex" installations.
% Define a new sorting template that sorts only multi key "\cite" entries according to their date and leaves the rest of the bibliography entries in the order they appear in the text.
%    \begin{macrocode}
\providecommand{\DeclareSortingTemplate}{\DeclareSortingScheme}
\DeclareSortingTemplate{hep-bibliography}{
  \sort{\citeorder}
  \sort[final]{\field{sortkey}}
  \sort{\field{sortyear} \field{year} \literal{9999}}
  \sort{\field{month}}
  \sort{\field{eprint} \field{doi}}
  \sort{\field{sorttitle} \field{title}}
  \sort{\field{subtitle} \field{volume}}
}
%    \end{macrocode}
% \end{macro}
%
% Use the new sorting scheme and abbreviat all first names.
%    \begin{macrocode}
\ExecuteBibliographyOptions{
  sorting=hep-bibliography,
  safeinputenc,
  giveninits=true,
  maxbibnames=7,
  backref=true
}
%    \end{macrocode}
%
% Hide the backrefs but use the information to link the index to the page of first citation.
%    \begin{macrocode}
\renewbibmacro*{pageref}{}%
\def\blxjk@grabfirslisttitem#1#2\@nil{#1}
\DeclareFieldFormat{labelnumberwidth}{%
  \iflistundef{pageref}{%
    \mkbibbrackets{#1}%
  }{%
    \edef\blxjk@firstpage{%
      \expandafter\blxjk@grabfirslisttitem\abx@list@pageref{}\@nil%
    }%
    \ifhyperref{%
      \hyperlink{page.\blxjk@firstpage}{\mkbibbrackets{#1}}%
    }{%
      \mkbibbrackets{#1}%
    }%
  }%
}
%    \end{macrocode}
%
% Shrink the biblography in two column mode.
%    \begin{macrocode}
% \newif\ifhep@journal\hep@journalfalse
% \ifhep@journal\else
  \if@twocolumn
    \AtBeginBibliography{\small}
    \setlength\biblabelsep{\labelsep}
  \fi
% \fi
%    \end{macrocode}
%
% \begin{macro}{translationof}
% Redefine the "translationof" string to fit better to documents without a original title.
%    \begin{macrocode}
\DefineBibliographyStrings{english}{translationof={Original}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{erratum}
% Add new bibliography string \enquote{Erratum} for the use in the "relatedtype" field.
%    \begin{macrocode}
\NewBibliographyString{erratum,erratums}
\DefineBibliographyStrings{english}{erratum={Erratum},erratums={Errata}}
\providecommand{\relateddelimerratum}{\addsemicolon\space}
%    \end{macrocode}
% \end{macro}
%
% Activate the Oxford comma when using "british" and separate title and subtitle with a colon.
%    \begin{macrocode}
\DefineBibliographyExtras{british}{\def\finalandcomma{\addcomma}}
\renewcommand{\subtitlepunct}{\addcolon\addspace}
%    \end{macrocode}
%
% \begin{macro}{\printbibliography}
% Allow the bibliography to be printed sloppy
%    \begin{macrocode}
\let\hep@printbibliography\printbibliography
\renewcommand{\printbibliography}{\sloppy\hep@printbibliography}
%    \end{macrocode}
% \end{macro}

% \subsection{Sourcemap}
%
% \begin{macro}{\reg@exp@one}
% \begin{macro}{\reg@exp@two}
% \begin{macro}{\reg@exp@url}
% \begin{macro}{\reg@exp@pmc}
% Define regular expressions in order to deal with inconsistent journal title and volume naming as well as \URL protocols and the PMCID.
%    \begin{macrocode}
\newcommand{\reg@exp@one}{\regexp{\A(\p{L}+)?\d+(\p{L}+)?\Z}}
\newcommand{\reg@exp@two}{\regexp{\A(\p{L}+)?(\d+)(\p{L}+)?\Z}}
\newcommand{\reg@exp@url}{\regexp{\A(ht|f)tp(s)?:\/\/}}
\newcommand{\reg@exp@pmc}{\regexp{\A(PMC)?}}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\DeclareSourcemap}
% Use the "\DeclareSourcemap" feature.
%    \begin{macrocode}
\DeclareSourcemap{%
  \maps[datatype=bibtex, overwrite=true]{%
%    \end{macrocode}
% \begin{macro}{collaboration}
% Read the collaboration information if present.
%    \begin{macrocode}
    \map{%
      \step[fieldsource=Collaboration, final=true]%
      \step[fieldset=collaboration, origfieldval, final=true]
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{reportnumber}
% Read the pre-print information if present.
%    \begin{macrocode}
    \map{%
      \step[fieldsource=reportNumber, final=true]%
      \step[fieldset=reportnumber, origfieldval, final=true]
    }%
%    \end{macrocode}
% \end{macro}
% \begin{macro}{journal}
% Move letters from the volume field to the journal field.
%    \begin{macrocode}
    \map[overwrite]{
      \pertype{article}
      \step[fieldsource=volume, match=\reg@exp@one, final]
      \step[fieldsource=volume, match=\reg@exp@two, replace={$2}]
      \step[fieldsource=journal, fieldtarget=journaltitle]
      \step[fieldset=journaltitle, fieldvalue={\space$1$2}, append=true]
    }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{url}
% Remove the protocol from \URL.
%    \begin{macrocode}
    \map{
      \step[fieldsource=url, final=true]
      \step[fieldset=protocollessurl, origfieldval, final=true]
      \step[fieldsource=protocollessurl, match=\reg@exp@url, replace={}]
    }
%    \end{macrocode}
% \end{macro}
% \begin{macro}{pmc}
% Remove the PMC from the PMCID.
%    \begin{macrocode}
    \map{
      \step[fieldsource=pmcid, final=true]
      \step[fieldset=pmc, origfieldval, final=true]
      \step[fieldsource=pmc, match=\reg@exp@pmc, replace={}]
    }
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\letbibmacro}
% Provide the "\letbibmacro" macro for old "biblatex" installations.
%    \begin{macrocode}
\providecommand{\letbibmacro}[2]{\csletcs{abx@macro@#1}{abx@macro@#2}}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{collaboration}
% Execute the author macro even if only the collaboration information if present and override the author information with collaboration information if present.
%    \begin{macrocode}
\renewbibmacro*{author/translator+others}{%
  \ifboolexpr{
    test \ifuseauthor and (
      not test {\ifnameundef{author}} or
      not test {\iffieldundef{collaboration}}
    )
  }
  {\usebibmacro{author}}
  {\usebibmacro{translator+others}}
}
\letbibmacro{hep@bib@author}{author}
\renewbibmacro*{author}{%
  \iffieldundef{collaboration}{%
    \usebibmacro{hep@bib@author}}{\textit{\printfield{collaboration}}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{In:}
% Remove spurious \enquote{In:} if no journal is present.
%    \begin{macrocode}
\renewbibmacro*{in:}{%
  \iffieldundef{journaltitle}{}{\printtext{\bibstring{in}\intitlepunct}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{reportnumber}
% Print the "reportnumber" as commalist using the \software{relsize} package \cite{relsize}.
%    \begin{macrocode}
\RequirePackage{relsize}
\DeclareFieldFormat{reportnumber}{%
  \edef\commalistbody{\forcsvfield{%
    \egroup\noexpand\item\unexpanded{\bgroup\smaller[.5]\textsc}
  }{reportnumber}}%
  \expandafter\commalist\commalistbody\egroup\endcommalist%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{url}
% Show \URLs without the protocol.
%    \begin{macrocode}
\DeclareFieldFormat{url}{%
  \mkbibacro{URL}\addcolon\space\online{#1}{\thefield{protocollessurl}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{\bib@online}
% Private "\bib@online" macro
%    \begin{macrocode}
\newcommand{\bib@online}[2]{%
  \ifhyperref{\online{#1}{#2}}{\nolinkurl{#2}}%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{pmid}
% \begin{macro}{pmcid}
% Present PubMed IDs.
%    \begin{macrocode}
\DeclareFieldFormat{pmid}{%
  \mkbibacro{PM}\addcolon\space%
  \bib@online{https://www.ncbi.nlm.nih.gov/pubmed/#1}{#1}%
}
\DeclareFieldFormat{pmc}{%
  \mkbibacro{PMC}\addcolon\space%
  \bib@online{https://www.ncbi.nlm.nih.gov/pmc/articles/PMC#1}{#1}%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%
% \begin{macro}{pmcid}
% \begin{macro}{pmid}
% \begin{macro}{reportnumber}
% Add the pre-print and PubMed information if present.
%    \begin{macrocode}
\letbibmacro{hep-doi+eprint+url}{doi+eprint+url}
\renewbibmacro*{doi+eprint+url}{%
  \usebibmacro{hep-doi+eprint+url}
  \iffieldundef{pmc}{%
    \iffieldundef{pmid}{}{\printfield{pmid}\newunit}%
  }{\printfield{pmc}\newunit}
  \iffieldundef{reportnumber}{}{%
    \newunitpunct\textnumero\intitlepunct%
    \printfield{reportnumber}\newunit%
  }%
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}

% \subsection{Eprints}
%
% \begin{macro}{\new@eprint}
% Private "\new@eprint" macro
%    \begin{macrocode}
\NewDocumentCommand{\new@eprint}{smm}{
  \DeclareFieldFormat{eprint:#2}{%
    \newcommand{\@path}{\IfBooleanT{#1}{\thefield{eprintclass}/}##1}%
    #2\addcolon\space\bib@online{#3/\@path}{\@path}%
  }%
}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{CTAN}
% Add CTAN as a eprint option
%    \begin{macrocode}
\new@eprint{CTAN}{https://ctan.org/pkg}
\DeclareFieldAlias{eprint:ctan}{eprint:CTAN}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GitHub}
% Add GitHub as a eprint option
%    \begin{macrocode}
\new@eprint*{GitHub}{https://github.com}
\DeclareFieldAlias{eprint:github}{eprint:GitHub}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{GitLab}
% Add GitLab as a eprint option
%    \begin{macrocode}
\new@eprint*{GitLab}{https://gitlab.com}
\DeclareFieldAlias{eprint:gitlab}{eprint:GitLab}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Bitbucket}
% Add Bitbucket as a eprint option
%    \begin{macrocode}
\new@eprint*{Bitbucket}{https://bitbucket.org}
\DeclareFieldAlias{eprint:bitbucket}{eprint:Bitbucket}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{Launchpad}
% Add Launchpad as a eprint option
%    \begin{macrocode}
\new@eprint{Launchpad}{https://launchpad.net}
\DeclareFieldAlias{eprint:launchpad}{eprint:Launchpad}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{SourceForge}
% Add SourceForge as a eprint option
%    \begin{macrocode}
\new@eprint{SourceForge}{https://sourceforge.net/projects}
\DeclareFieldAlias{eprint:launchpad}{eprint:SourceForge}
%    \end{macrocode}
% \end{macro}
%
% \begin{macro}{HEPForge}
% Add HEPForge as a eprint option
%    \begin{macrocode}
\DeclareFieldFormat{eprint:hepforge}{%
  HEPForge\addcolon\space\bib@online{https://#1/hepforge.org}{#1}%
}
\DeclareFieldAlias{eprint:HEPForge}{eprint:hepforge}
%    \end{macrocode}
% \end{macro}
%
% Define bibstrings for reference names.
%    \begin{macrocode}
\NewBibliographyString{refname}
\NewBibliographyString{refsname}
\DefineBibliographyStrings{english}{%
  refname = {reference},
  refsname = {references}
}
%    \end{macrocode}
% \begin{macro}{\ccite}
% \begin{macro}{\Ccite}
% Define \emph{clever} citation macros.
% \begin{macrocode}
\DeclareCiteCommand{\ccite}{%
  \ifnum\thecitetotal=1
    \bibstring{refname}%
  \else%
    \bibstring{refsname}%
  \fi%
  \addnbspace\bibopenbracket%
  \usebibmacro{cite:init}\usebibmacro{prenote}%
}{\usebibmacro{citeindex}\usebibmacro{cite:comp}}{}{%
  \usebibmacro{cite:dump}\usebibmacro{postnote}%
  \bibclosebracket%
}

\newrobustcmd*{\Ccite}{\bibsentence\ccite}
%    \end{macrocode}
% \end{macro}
% \end{macro}
%</package>
%
% \section{Biblatex datamodel file} \label{sec:data model}
%
%<*datamodel>
%
% \begin{macro}{collaboration}
% \begin{macro}{pmid}
% \begin{macro}{pmcid}
% \begin{macro}{pmc}
% \begin{macro}{reportnumber}
% \begin{macro}{protocollessurl}
% Define the "dbx" file containing the "hep-bibliography" datamodel.
%    \begin{macrocode}
\DeclareDatamodelFields[type=field, datatype=literal]{
  collaboration, pmid, pmcid, pmc,
}
\DeclareDatamodelFields[type=field, format=xsv, datatype=literal]{
  reportnumber,
}
\DeclareDatamodelFields[type=field, datatype=uri]{protocollessurl}
\DeclareDatamodelEntryfields{
  collaboration, pmid, pmcid, pmc, reportnumber, protocollessurl,
}
%    \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
%</datamodel>
%
% \section{Test}
%
%<*test>
%    \begin{macrocode}
\documentclass[twocolumn,a4paper]{article}

\usepackage{hep-bibliography}

\begin{filecontents}{\jobname.bib}
@article{Ade:2015xua,
    author = "Ade, P. A. R. and others",
    collaboration = "Planck",
    title = "{Planck 2015 results. XIII. Cosmological parameters}",
    eprint = "1502.01589",
    archivePrefix = "arXiv",
    primaryClass = "astro-ph.CO",
    doi = "10.1051/0004-6361/201525830",
    journal = "Astron. Astrophys.",
    volume = "594",
    pages = "A13",
    year = "2016"
}

@article{Agashe:2014kda,
    author = "Olive, K. A. and others",
    collaboration = "Particle Data Group",
    title = "{Review of Particle Physics}",
    doi = "10.1088/1674-1137/38/9/090001",
    journal = "Chin. Phys. C",
    volume = "38",
    pages = "090001",
    year = "2014"
}

@article{Ade:2013zuv,
    author = "Ade, P. A. R. and others",
    collaboration = "Planck",
    title = "{Planck 2013 results. XVI. Cosmological parameters}",
    eprint = "1303.5076",
    archivePrefix = "arXiv",
    primaryClass = "astro-ph.CO",
    reportNumber = "CERN-PH-TH-2013-129",
    doi = "10.1051/0004-6361/201321591",
    journal = "Astron. Astrophys.",
    volume = "571",
    pages = "A16",
    year = "2014"
}

@article{Aad:2012tfa,
    author = "Aad, Georges and others",
    collaboration = "ATLAS",
    title = "{Observation of a new particle in the search for the Standard Model Higgs boson with the ATLAS detector at the LHC}",
    eprint = "1207.7214",
    archivePrefix = "arXiv",
    primaryClass = "hep-ex",
    reportNumber = "CERN-PH-EP-2012-218",
    doi = "10.1016/j.physletb.2012.08.020",
    journal = "Phys. Lett. B",
    volume = "716",
    pages = "1--29",
    year = "2012"
}

@article{Chatrchyan:2012ufa,
    author = "Chatrchyan, Serguei and others",
    collaboration = "CMS",
    title = "{Observation of a New Boson at a Mass of 125 GeV with the CMS Experiment at the LHC}",
    eprint = "1207.7235",
    archivePrefix = "arXiv",
    primaryClass = "hep-ex",
    reportNumber = "CMS-HIG-12-028, CERN-PH-EP-2012-220",
    doi = "10.1016/j.physletb.2012.08.021",
    journal = "Phys. Lett. B",
    volume = "716",
    pages = "30--61",
    year = "2012"
}

@article{Beringer:1900zz,
    author = "Beringer, J. and others",
    collaboration = "Particle Data Group",
    title = "{Review of Particle Physics (RPP)}",
    reportNumber = "SLAC-REPRINT-2014-001",
    doi = "10.1103/PhysRevD.86.010001",
    journal = "Phys. Rev. D",
    volume = "86",
    pages = "010001",
    year = "2012"
}

@article{Chatrchyan:2008aa,
    author = "Chatrchyan, S. and others",
    collaboration = "CMS",
    title = "{The CMS Experiment at the CERN LHC}",
    doi = "10.1088/1748-0221/3/08/S08004",
    journal = "JINST",
    volume = "3",
    pages = "S08004",
    year = "2008"
}

@article{Cacciari:2008gp,
    author = "Cacciari, Matteo and Salam, Gavin P. and Soyez, Gregory",
    title = "{The anti-$k_t$ jet clustering algorithm}",
    eprint = "0802.1189",
    archivePrefix = "arXiv",
    primaryClass = "hep-ph",
    reportNumber = "LPTHE-07-03",
    doi = "10.1088/1126-6708/2008/04/063",
    journal = "JHEP",
    volume = "04",
    pages = "063",
    year = "2008"
}

@article{Aad:2008zzm,
    author = "Aad, G. and others",
    collaboration = "ATLAS",
    title = "{The ATLAS Experiment at the CERN Large Hadron Collider}",
    doi = "10.1088/1748-0221/3/08/S08003",
    journal = "JINST",
    volume = "3",
    pages = "S08003",
    year = "2008"
}

@article{Sjostrand:2006za,
    author = "Sjostrand, Torbjorn and Mrenna, Stephen and Skands, Peter Z.",
    title = "{PYTHIA 6.4 Physics and Manual}",
    eprint = "hep-ph/0603175",
    archivePrefix = "arXiv",
    reportNumber = "FERMILAB-PUB-06-052-CD-T, LU-TP-06-13",
    doi = "10.1088/1126-6708/2006/05/026",
    journal = "JHEP",
    volume = "05",
    pages = "026",
    year = "2006"
}

@article{Spergel:2003cb,
    author = "Spergel, D. N. and others",
    collaboration = "WMAP",
    title = "{First year Wilkinson Microwave Anisotropy Probe (WMAP) observations: Determination of cosmological parameters}",
    eprint = "astro-ph/0302209",
    archivePrefix = "arXiv",
    doi = "10.1086/377226",
    journal = "Astrophys. J. Suppl.",
    volume = "148",
    pages = "175--194",
    year = "2003"
}

@article{Agostinelli:2002hh,
    author = "Agostinelli, S. and others",
    collaboration = "GEANT4",
    title = "{GEANT4--a simulation toolkit}",
    reportNumber = "SLAC-PUB-9350, FERMILAB-PUB-03-339, CERN-IT-2002-003",
    doi = "10.1016/S0168-9002(03)01368-8",
    journal = "Nucl. Instrum. Meth. A",
    volume = "506",
    pages = "250--303",
    year = "2003"
}

@article{Randall:1999ee,
    author = "Randall, Lisa and Sundrum, Raman",
    title = "{A Large mass hierarchy from a small extra dimension}",
    eprint = "hep-ph/9905221",
    archivePrefix = "arXiv",
    reportNumber = "MIT-CTP-2860, PUPT-1860, BUHEP-99-9",
    doi = "10.1103/PhysRevLett.83.3370",
    journal = "Phys. Rev. Lett.",
    volume = "83",
    pages = "3370--3373",
    year = "1999"
}

@article{Perlmutter:1998np,
    author = "Perlmutter, S. and others",
    collaboration = "Supernova Cosmology Project",
    title = "{Measurements of $\Omega$ and $\Lambda$ from 42 high redshift supernovae}",
    eprint = "astro-ph/9812133",
    archivePrefix = "arXiv",
    reportNumber = "LBNL-41801, LBL-41801",
    doi = "10.1086/307221",
    journal = "Astrophys. J.",
    volume = "517",
    pages = "565--586",
    year = "1999"
}

@article{Riess:1998cb,
    author = "Riess, Adam G. and others",
    collaboration = "Supernova Search Team",
    title = "{Observational evidence from supernovae for an accelerating universe and a cosmological constant}",
    eprint = "astro-ph/9805201",
    archivePrefix = "arXiv",
    doi = "10.1086/300499",
    journal = "Astron. J.",
    volume = "116",
    pages = "1009--1038",
    year = "1998"
}

@article{Witten:1998qj,
    author = "Witten, Edward",
    title = "{Anti-de Sitter space and holography}",
    eprint = "hep-th/9802150",
    archivePrefix = "arXiv",
    reportNumber = "IASSNS-HEP-98-15",
    doi = "10.4310/ATMP.1998.v2.n2.a2",
    journal = "Adv. Theor. Math. Phys.",
    volume = "2",
    pages = "253--291",
    year = "1998"
}

@article{Gubser:1998bc,
    author = "Gubser, S. S. and Klebanov, Igor R. and Polyakov, Alexander M.",
    title = "{Gauge theory correlators from noncritical string theory}",
    eprint = "hep-th/9802109",
    archivePrefix = "arXiv",
    reportNumber = "PUPT-1767",
    doi = "10.1016/S0370-2693(98)00377-3",
    journal = "Phys. Lett. B",
    volume = "428",
    pages = "105--114",
    year = "1998"
}

@article{Maldacena:1997re,
    author = "Maldacena, Juan Martin",
    title = "{The Large N limit of superconformal field theories and supergravity}",
    eprint = "hep-th/9711200",
    archivePrefix = "arXiv",
    reportNumber = "HUTP-97-A097, HUTP-98-A097",
    doi = "10.1023/A:1026654312961",
    journal = "Adv. Theor. Math. Phys.",
    volume = "2",
    pages = "231--252",
    year = "1998"
}

@article{Schlegel:1997yv,
    author = "Schlegel, David J. and Finkbeiner, Douglas P. and Davis, Marc",
    title = "{Maps of dust IR emission for use in estimation of reddening and CMBR foregrounds}",
    eprint = "astro-ph/9710327",
    archivePrefix = "arXiv",
    doi = "10.1086/305772",
    journal = "Astrophys. J.",
    volume = "500",
    pages = "525",
    year = "1998"
}

@article{Guth:1980zm,
    author = "Guth, Alan H.",
    editor = "Fang, Li-Zhi and Ruffini, R.",
    title = "{The Inflationary Universe: A Possible Solution to the Horizon and Flatness Problems}",
    reportNumber = "SLAC-PUB-2576",
    doi = "10.1103/PhysRevD.23.347",
    journal = "Phys. Rev. D",
    volume = "23",
    pages = "347--356",
    year = "1981"
}

@article{Altarelli:1977zs,
    author = "Altarelli, Guido and Parisi, G.",
    title = "{Asymptotic Freedom in Parton Language}",
    reportNumber = "LPTENS-77-6",
    doi = "10.1016/0550-3213(77)90384-4",
    journal = "Nucl. Phys. B",
    volume = "126",
    pages = "298--318",
    year = "1977"
}

@article{Hawking:1974sw,
    author = "Hawking, S. W.",
    editor = "Gibbons, G. W. and Hawking, S. W.",
    title = "{Particle Creation by Black Holes}",
    doi = "10.1007/BF02345020",
    journal = "Commun. Math. Phys.",
    volume = "43",
    pages = "199--220",
    year = "1975",
    related = "Hawking:1974sw-1",
    relatedtype = "erratum"
}

@article{Kobayashi:1973fv,
    author = "Kobayashi, Makoto and Maskawa, Toshihide",
    title = "{CP Violation in the Renormalizable Theory of Weak Interaction}",
    reportNumber = "KUNS-242",
    doi = "10.1143/PTP.49.652",
    journal = "Prog. Theor. Phys.",
    volume = "49",
    pages = "652--657",
    year = "1973"
}

@article{Weinberg:1967tq,
    author = "Weinberg, Steven",
    title = "{A Model of Leptons}",
    doi = "10.1103/PhysRevLett.19.1264",
    journal = "Phys. Rev. Lett.",
    volume = "19",
    pages = "1264--1266",
    year = "1967"
}

@article{Glashow:1961tr,
    author = "Glashow, S. L.",
    title = "{Partial Symmetries of Weak Interactions}",
    doi = "10.1016/0029-5582(61)90469-2",
    journal = "Nucl. Phys.",
    volume = "22",
    pages = "579--588",
    year = "1961"
}

@article{Hawking:1974sw-1,
    author = "Hawking, S. W.",
    journal = "Commun. Math. Phys.",
    volume = "46",
    pages = "206",
    year = "1976",
    options = {skipbib=true}
}
\end{filecontents}
\bibliography{\jobname}
\nocite{*}
\usepackage{hyperref}

\begin{document}
\printbibliography
\end{document}
%    \end{macrocode}
%</test>
%
% \section{Readme}
%
%<*readme>
%
%    \begin{macrocode}
# The `hep-bibliography` package

Bibliographies for high energy physics

## Introduction

The `hep-bibliography` package extends the `biblatex` package with some functionality mostly useful for high energy physics.
In particular it makes full use of all `bibtex` fields provided by `inspirehep.net`.

The package can be loaded via `\usepackage{hep-bibliography}`.

## Author

Jan Hajer

## License

This file may be distributed and/or modified under the conditions of the `LaTeX` Project Public License, either version 1.3c 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.3c or later is part of all distributions of LaTeX version 2005/12/01 or later.
%    \end{macrocode}
%
%</readme>
%
% \Finale

\endinput

% \PrintIndex
% makeindex -s gglo.ist -o hep-bibliography-implementation.gls hep-bibliography-implementation.glo
% makeindex -s gglo.ist -o hep-bibliography-implementation.ind hep-bibliography-implementation.idx