summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/hep-bibliography
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-11-27 21:21:15 +0000
committerKarl Berry <karl@freefriends.org>2021-11-27 21:21:15 +0000
commitb133baed04ea7fd3fa7e3d533f19121600d7674f (patch)
tree6fc5d8ca722d865ead49e1b3bb02a81a821aed9a /Master/texmf-dist/tex/latex/hep-bibliography
parent7d0f841b76f290fa330e5f91c3e1c451529d59dd (diff)
hep-bibliography (27nov21)
git-svn-id: svn://tug.org/texlive/trunk@61166 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/hep-bibliography')
-rw-r--r--Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.dbx33
-rw-r--r--Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.sty226
2 files changed, 259 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.dbx b/Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.dbx
new file mode 100644
index 00000000000..c8c3e0e5c4e
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.dbx
@@ -0,0 +1,33 @@
+%%
+%% This is file `hep-bibliography.dbx',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% hep-bibliography-implementation.dtx (with options: `datamodel')
+%% This is a generated file.
+%% Copyright (C) 2019-2020 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.
+
+\ProvidesFile{hep-bibliography.dbx}[2021/08/01 v1.8 HEP-Bibliography biblatex data model]
+
+\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,
+}
+
+\endinput
+%%
+%% End of file `hep-bibliography.dbx'.
diff --git a/Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.sty b/Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.sty
new file mode 100644
index 00000000000..cf40308796c
--- /dev/null
+++ b/Master/texmf-dist/tex/latex/hep-bibliography/hep-bibliography.sty
@@ -0,0 +1,226 @@
+%%
+%% This is file `hep-bibliography.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% hep-bibliography-implementation.dtx (with options: `package')
+%% This is a generated file.
+%% Copyright (C) 2019-2020 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.
+
+\NeedsTeXFormat{LaTeX2e}[2005/12/01]
+\ProvidesPackage{hep-bibliography}[2021/09/01 v1.0 HEP-Bibliography]
+
+
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{
+ family=hepbib,
+ prefix=hepbib@
+}
+\DeclareStringOption[numeric-comp]{style}
+\ProcessKeyvalOptions*
+\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}}}%
+ }{}
+}
+\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
+\RequirePackage[style=\hepbib@style, datamodel=hep-bibliography]{biblatex}
+\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}}
+}
+\ExecuteBibliographyOptions{
+ sorting=hep-bibliography,
+ safeinputenc,
+ giveninits=true,
+ maxbibnames=7,
+ backref=true
+}
+\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}%
+ }%
+ }%
+}
+ \if@twocolumn
+ \AtBeginBibliography{\small}
+ \setlength\biblabelsep{\labelsep}
+ \fi
+\DefineBibliographyStrings{english}{translationof={Original}}
+\NewBibliographyString{erratum,erratums}
+\DefineBibliographyStrings{english}{erratum={Erratum},erratums={Errata}}
+\providecommand{\relateddelimerratum}{\addsemicolon\space}
+\DefineBibliographyExtras{british}{\def\finalandcomma{\addcomma}}
+\renewcommand{\subtitlepunct}{\addcolon\addspace}
+\let\hep@printbibliography\printbibliography
+\renewcommand{\printbibliography}{\sloppy\hep@printbibliography}
+
+\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)?}}
+\DeclareSourcemap{%
+ \maps[datatype=bibtex, overwrite=true]{%
+ \map{%
+ \step[fieldsource=Collaboration, final=true]%
+ \step[fieldset=collaboration, origfieldval, final=true]
+ }%
+ \map{%
+ \step[fieldsource=reportNumber, final=true]%
+ \step[fieldset=reportnumber, origfieldval, final=true]
+ }%
+ \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]
+ }
+ \map{
+ \step[fieldsource=url, final=true]
+ \step[fieldset=protocollessurl, origfieldval, final=true]
+ \step[fieldsource=protocollessurl, match=\reg@exp@url, replace={}]
+ }
+ \map{
+ \step[fieldsource=pmcid, final=true]
+ \step[fieldset=pmc, origfieldval, final=true]
+ \step[fieldsource=pmc, match=\reg@exp@pmc, replace={}]
+ }
+ }%
+}
+\providecommand{\letbibmacro}[2]{\csletcs{abx@macro@#1}{abx@macro@#2}}
+\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}}%
+ }%
+}
+\renewbibmacro*{in:}{%
+ \iffieldundef{journaltitle}{}{\printtext{\bibstring{in}\intitlepunct}}%
+}
+\RequirePackage{relsize}
+\DeclareFieldFormat{reportnumber}{%
+ \edef\commalistbody{\forcsvfield{%
+ \egroup\noexpand\item\unexpanded{\bgroup\smaller[.5]\textsc}
+ }{reportnumber}}%
+ \expandafter\commalist\commalistbody\egroup\endcommalist%
+}
+\DeclareFieldFormat{url}{%
+ \mkbibacro{URL}\addcolon\space\online{#1}{\thefield{protocollessurl}}%
+}
+\newcommand{\bib@online}[2]{%
+ \ifhyperref{\online{#1}{#2}}{\nolinkurl{#2}}%
+}
+\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}%
+}
+\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%
+ }%
+}
+
+\NewDocumentCommand{\new@eprint}{smm}{
+ \DeclareFieldFormat{eprint:#2}{%
+ \newcommand{\@path}{\IfBooleanT{#1}{\thefield{eprintclass}/}##1}%
+ #2\addcolon\space\bib@online{#3/\@path}{\@path}%
+ }%
+}
+\new@eprint{CTAN}{https://ctan.org/pkg}
+\DeclareFieldAlias{eprint:ctan}{eprint:CTAN}
+\new@eprint*{GitHub}{https://github.com}
+\DeclareFieldAlias{eprint:github}{eprint:GitHub}
+\new@eprint*{GitLab}{https://gitlab.com}
+\DeclareFieldAlias{eprint:gitlab}{eprint:GitLab}
+\new@eprint*{Bitbucket}{https://bitbucket.org}
+\DeclareFieldAlias{eprint:bitbucket}{eprint:Bitbucket}
+\new@eprint{Launchpad}{https://launchpad.net}
+\DeclareFieldAlias{eprint:launchpad}{eprint:Launchpad}
+\new@eprint{SourceForge}{https://sourceforge.net/projects}
+\DeclareFieldAlias{eprint:launchpad}{eprint:SourceForge}
+\DeclareFieldFormat{eprint:hepforge}{%
+ HEPForge\addcolon\space\bib@online{https://#1/hepforge.org}{#1}%
+}
+\DeclareFieldAlias{eprint:HEPForge}{eprint:hepforge}
+\NewBibliographyString{refname}
+\NewBibliographyString{refsname}
+\DefineBibliographyStrings{english}{%
+ refname = {reference},
+ refsname = {references}
+}
+\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}
+
+\endinput
+%%
+%% End of file `hep-bibliography.sty'.