diff options
Diffstat (limited to 'macros/latex/contrib/biblatex-contrib/biblatex-iso690/iso.bbx')
-rw-r--r-- | macros/latex/contrib/biblatex-contrib/biblatex-iso690/iso.bbx | 259 |
1 files changed, 215 insertions, 44 deletions
diff --git a/macros/latex/contrib/biblatex-contrib/biblatex-iso690/iso.bbx b/macros/latex/contrib/biblatex-contrib/biblatex-iso690/iso.bbx index ce2668f718..a43c6a81e9 100644 --- a/macros/latex/contrib/biblatex-contrib/biblatex-iso690/iso.bbx +++ b/macros/latex/contrib/biblatex-contrib/biblatex-iso690/iso.bbx @@ -1,13 +1,15 @@ \ProvidesFile{iso.bbx} - [2020/03/25 v0.4.0 ISO 690 biblatex bibliography style] + [2022/03/20 v0.4.1 ISO 690 biblatex bibliography style] % Currently available language mappings: -% Czech, English, Slovak, German, Polish, Bulgarian, -% French +% Czech, English, German, Polish, Slovak, and more. +% You can list them directly with `$ ls *lbx`. +% Or you can check the translation matrix at the wiki page: +% https://github.com/michal-h21/biblatex-iso690/wiki/Translation-Guideline#translation-matrix \DeclareLanguageMappingSuffix{-iso} % Currently needed the following additional language strings: \NewBibliographyString{at,bysupervisor,urlalso, - director,bydirector,inventor,byinventor,online,film} + director,bydirector,inventor,byinventor,online,film,application,publication} % PACKAGE OPTIONS @@ -22,6 +24,8 @@ \newtoggle{bbx:doi} \newtoggle{bbx:eprint} \newtoggle{bbx:articlepubinfo} +\newtoggle{bbx:currentlang} +\newtoggle{bbx:noenddot} % Print info about package options into .log file \protected\def\isoblx@info@noline#1{% @@ -48,7 +52,7 @@ \DeclareBibliographyOption{thesisinfoinnotes}[true]{% \settoggle{bbx:thesisinfoinnotes}{#1}% - \isoblx@info@noline{Printing thesis info at the end enabled: #1}} + \isoblx@info@noline{Thesis info in the notes section enabled: #1}} \DeclareBibliographyOption{url}[true]{% \settoggle{bbx:url}{#1}% @@ -70,6 +74,15 @@ \settoggle{bbx:articlepubinfo}{#1}% \isoblx@info@noline{Article publication info enabled: #1}} +\DeclareBibliographyOption{currentlang}[true]{ + \settoggle{bbx:currentlang}{#1}% + \isoblx@info@noline{Use current language for the bibliography: #1}} + +\DeclareBibliographyOption{noenddot}[true]{ + \settoggle{bbx:noenddot}{#1}% + \isoblx@info@noline{Use no end dot for the bibliography entries: #1}} + + % Set default package options \ExecuteBibliographyOptions{% spacecolon=false, @@ -87,8 +100,11 @@ autolang=other,% Use the 'langid' language for the entry date=year,% Use only years urldate=iso,% Use ISO8601 Extended Format (yyyy-mm-dd) for URL 'seen' dates - seconds=true,% ISO8601 format requires 'seconds=true' + origdate=iso,% Use ISO8601 Extended Format (yyyy-mm-dd) for patent appl. dates + seconds=true,% iso (ISO8601) format requires 'seconds=true' datecirca=true,% Use circa for approximate dates + currentlang=false,% Use main document language for printing of bibliography strings + noenddot=false,% Use an end dot for the bibliography entries } % Default definitions of beginning and closing macro @@ -113,6 +129,13 @@ % The separator between 'dates' and the numeration section \newcommand{\numerationpunct}{\addcomma\space} +% No seperator or a dot at the very end of an entry +\renewcommand{\finentrypunct}{% + \iftoggle{bbx:noenddot} + {} + {\addperiod}% +} + % A colon preceded with or without space \newcommand{\addspacecolon}{% \iftoggle{bbx:spcolon} @@ -227,6 +250,11 @@ {\mainlangbibstring{#1}} {#1}% } +\DeclareFieldFormat[patent]{type}{% + \ifbibstring{#1} + {\mainlangbiblstring{#1}} + {#1}% +} % Format supervisor of thesis (precedes the name with a localisation string) \DeclareFieldFormat{supervisor}{% @@ -300,19 +328,64 @@ {#1}}% This is the go-to format } +% Define names to consider for 'labelname', based on +% the default definition, but adding holder as the +% very first choice for patents. +\DeclareLabelname[patent]{% + \field{holder} + \field{shortauthor} + \field{author} + \field{shorteditor} + \field{editor} + \field{translator} +} + % Define dates to consider for 'labeldate', based on % the default definition, but without 'urldate' field, % preventing printing url seen date in place of the year % of a publication. \DeclareLabeldate{% + \field{origdate}% <----- used by patents \field{date} \field{year} \field{dateaddon}% <---- biblatex-iso690 data model extension \field{eventdate} - \field{origdate} \literal{nodate} } +% Sorting based on the default definition, but adding +% holder and origyear to work with patent entry types. +\DeclareSortingTemplate{nyt}{ + \sort{ + \field{presort} + } + \sort[final]{ + \field{sortkey} + } + \sort{ + \field{sortname} + \field{holder} + \field{author} + \field{editor} + \field{translator} + \field{sorttitle} + \field{title} + } + \sort{ + \field{sortyear} + \field{origyear} + \field{year} + } + \sort{ + \field{sorttitle} + \field{title} + } + \sort{ + \field{volume} + \literal{0} + } +} + % Format chapter of book with preceding localisation string \DeclareFieldFormat{chapter}{\bibstring{chapter}\addnbspace#1\isdot} @@ -354,6 +427,26 @@ % given (first) name followed by last (family) name, % so it may sound more naturally in this order \DeclareNameAlias{supervisor}{given-family} +% For patents, the author field is supposed to be the inventor +% of the patent, which we want to have in reverse name order, +% since it may sound more naturally in this order +\DeclareNameAlias[patent]{author}{given-family} +% However, if there is no holder field for a patent, +% author field should be in the default order since it acts +% as a primary creator of the patent at the beginning +% of the bib reference (consistency rule) +\DeclareStyleSourcemap{ + \maps[datatype=bibtex]{ + \map{ + \pertype{patent} + \step[fieldsource=author] + \step[fieldset=holder, origfieldval] + } + } +} + + + % BIBLIOGRAPHY MACROS @@ -362,15 +455,16 @@ % Based on author/editor macro % Adds nameaddon field to author names \newbibmacro*{names:primary}{% - \ifboolexpr{ - test \ifuseauthor - and - not test {\ifnameundef{author}} - } - {\usebibmacro{author}% - \setunit{\addspace}% - \printfield{nameaddon}}% - {\usebibmacro{editor}}% + \ifboolexpr{test \ifuseholder and test {\ifentrytype{patent}} + and not test {\ifnameundef{holder}}} + {\usebibmacro{byholder}% + \setunit{\addspace}% + \printfield{nameaddon}}% + {\ifboolexpr{test \ifuseauthor and not test {\ifnameundef{author}}} + {\usebibmacro{author}% + \setunit{\addspace}% + \printfield{nameaddon}}% + {\usebibmacro{editor}}}% } % Macro for secondary authors with their role @@ -398,6 +492,16 @@ \printnames{supervisor}}% } +% Macro for printing the inventor of a patent +\newbibmacro*{patentinventor}{% + \ifnameundef{author} + {} + {\mainlangbibstring{inventor}% + \setunit{\addcolon\space}% + \usebibmacro{author}}% +} + + % TITLES MACROS % Macro for formatting <prefix>titles @@ -432,7 +536,8 @@ \newbibmacro{multi:titles}{% \iffieldundef{maintitle} {\iffieldundef{booktitle} - {\usebibmacro{titles}{}{emph}} + {\usebibmacro{titles}{}{emph}% + \usebibmacro{volume}} {\usebibmacro{titles}{book}{emph}% \usebibmacro{volume}% \usebibmacro{titles}{}{}}}% @@ -462,6 +567,7 @@ {\usebibmacro{titles}{issue}{}}% } + % MEDIUM TYPE MACROS \newbibmacro*{medium-type}{% @@ -476,7 +582,7 @@ or test {\ifentrytype{online}}) } % Use a localisation string 'online' in the main document language - {\mainlangbibstring[\mkbibbrackets]{online}}% + {\midsentence\mainlangbibstring[\mkbibbrackets]{online}}% {}}% Don't print anything {% The only situation when we don't want to print % 'howpublished' field is when @@ -495,6 +601,9 @@ {\printfield{howpublished}}}% } + + + % PUBLICATION INFO MACROS % By default only year is used, but for some entries, @@ -523,18 +632,23 @@ } % Based on publisher+location+date macro (defined in standard.bbx) -% Differs only in punctuation +% Differs only in punctuation, and printing the organization field % % Wrapper for printing normal or full date. 1st argument: -% * empty: \usebibmacro{date} -% * 'full': \usebibmacro{fulldate} +% a) <empty>: \usebibmacro{date} +% b) 'full' : \usebibmacro{fulldate} \newbibmacro*{location+publisher+dateform}[1]{% \printlist{location}% - \iflistundef{publisher} + \ifboolexpr{ + test {\iflistundef{publisher}} + and + test {\iflistundef{organization}}} {\setunit*{\addcomma\space}} {\setunit*{\subtitlepunct}}% <---- different punctuation \printlist{publisher}% \setunit*{\addcomma\space}% + \printlist{organization}% + \setunit*{\addcomma\space}% \usebibmacro{#1date}% \newunit} @@ -544,6 +658,25 @@ \newbibmacro*{location+publisher+fulldate}{% \usebibmacro{location+publisher+dateform}{full}} + + +% ADDITIONAL DATE MACROS FOR PATENTS + +% Application date +\newbibmacro{applicationdate}{% + \iffieldundef{origyear} + {} + {\mainlangbibstring{application}\addcolon\space\printorigdate} +} + +% Publication date +\newbibmacro{publicationdate}{% + \iffieldundef{year} + {} + {\mainlangbibstring{publication}\addcolon\space\usebibmacro{fulldate}} +} + + % NUMERATION MACROS \newbibmacro*{serial:numeration}{% @@ -560,6 +693,7 @@ \printfield{chapter}% } + % SERIES TITLE AND NUMBER MACROS % Based on series+number macro (defined in standard.bbx) @@ -570,6 +704,7 @@ \printfield{number}% }% + % STANDARD IDENTIFIERS MACROS % Bunch of standard identifiers @@ -590,6 +725,7 @@ {}% } + % AVAILABILITY AND ACCESS MACROS % Precedes DOI field with urlfrom localisation string @@ -634,6 +770,18 @@ {}% } +\newbibmacro*{urldate-space}{% + % if there is no publisher specified in the bib file, set unit to dot, + % so there is a separation between previous block + \ifboolexpr{% + test {\iflistundef{publisher}}% + and test {\iflistundef{location}}% + and test {\iffieldundef{date}}% + and test {\iffieldundef{version}}% + }{\setunit{\adddot\addspace}}% + {\setunit{\addspace}}% +} + % The url seen date of @online entries is always printed \renewbibmacro*{urldate}{% \ifboolexpr{ @@ -644,6 +792,7 @@ {}% } + % LOCATION MACROS % Additional location information (e.g. library, repository) @@ -654,6 +803,7 @@ \printfield{library}}% } + % OTHER MACROS % Redeclare in: bibmacro to use the main document language. @@ -673,6 +823,7 @@ \printunit{\intitlepunct}% } + % BIBLATEX CORE ADJUSTMENTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -692,19 +843,32 @@ \newrobustcmd*{\blx@imc@mainlangbibsstring}[2][\@firstofone]{% \blx@mainlangbibstring{#1}{abx@sstr}{#2}} +% We use Babel or Polyglossia main document language for some +% bibliography strings. With currentlang option, the currently +% selected language is used instead. It is useful in some classes +% that don't support selection of the main language. +% https://github.com/michal-h21/biblatex-iso690/issues/90 +\newcommand\blx@selectlangmacro{% + \ifboolexpr{% + test {\iftoggle{bbx:currentlang}}% + and test {\ifdef{\textouterlang}}% + }% + {\let\iso@mainlang\textouterlang}{\let\iso@mainlang\textmainlang}% +} + \protected\def\blx@mainlangbibstring#1#2#3{% - {\mainlang% <---- use main document language - \blx@begunit - \blx@hyphenreset - \blx@bibstringsimple + \blx@begunit% + \blx@hyphenreset% + \blx@bibstringsimple% + \blx@selectlangmacro% \lowercase{\edef\blx@tempa{#3}}% - \ifcsundef{#2@\blx@tempa} - {\blx@warn@nostring\blx@tempa - \blx@endnounit} - {\blx@imc@ifcapital - {#1{\MakeCapital{\csuse{#2@\blx@tempa}}}} - {#1{\csuse{#2@\blx@tempa}}}% - \blx@endunit}}} + \ifcsundef{#2@\blx@tempa}% + {\blx@warn@nostring\blx@tempa% + \blx@endnounit}% + {\blx@imc@ifcapital% + {\iso@mainlang{#1{\MakeCapital{\csuse{#2@\blx@tempa}}}}}% + {\iso@mainlang{#1{\csuse{#2@\blx@tempa}}}}% + \blx@endunit}} \blx@regimcs{% \mainlangbibstring \mainlangbiblstring \mainlangbibsstring @@ -988,7 +1152,7 @@ {\blx@nounit} {\printtext[{#1date}]{% \datecircaprint - % Such a season component can only come from an ISO8601 season which replaces + % Such a season component can only come from an ISO8601 season which replaces % a normal month so if it exists, we know that a normal date print is ruled out \iffieldundef{#1season} {\blx@ymddate{#1}{}% @@ -1061,13 +1225,15 @@ \usebibmacro{names:subsidiary}% \newunit\newblock \usebibmacro{location+publisher+date}% - \newunit + \newunit% \printfield{version}% - \setunit{\addspace}% + \usebibmacro{urldate-space}% \usebibmacro{urldate}% \newunit\newblock \usebibmacro{series+number}% \newunit\newblock + \printfield{volumes} + \newunit\newblock \usebibmacro{identifier}% \newunit\newblock \usebibmacro{availability+access}% @@ -1250,7 +1416,7 @@ \usebibmacro{location+publisher+fulldate}% \newunit \printfield{version}% - \setunit{\addspace}% + \usebibmacro{urldate-space}% \usebibmacro{urldate}% \newunit\newblock \usebibmacro{series+number}% @@ -1281,7 +1447,7 @@ \usebibmacro{location+publisher+date}% \newunit \printfield{version}% - \setunit{\addspace}% + \usebibmacro{urldate-space}% \usebibmacro{urldate}% \newunit\newblock \usebibmacro{identifier}% @@ -1326,7 +1492,7 @@ \usebibmacro{location+publisher+fulldate}% \newunit \printfield{version}% - \setunit{\addspace}% + \usebibmacro{urldate-space}% \usebibmacro{urldate}% \newunit\newblock \iffieldundef{type} @@ -1360,28 +1526,33 @@ \newunit\newblock \usebibmacro{names:subsidiary}% \newunit\newblock + \usebibmacro{patentinventor}% + \newunit + \usebibmacro{publicationdate}% + \newunit + \usebibmacro{applicationdate}% + \newunit + \printfield{note}% + \newunit\newblock \printlist{location}% \newunit\newblock \iffieldundef{type} {} {\printfield{type}% - \setunit*{\addcomma\space}}% + \setunit*{\addspace}}% \printfield{number}% \newunit\newblock - \usebibmacro{fulldate}% - \setunit{\addspace}% \usebibmacro{urldate}% \newunit\newblock \usebibmacro{availability+access}% \newunit\newblock - \printfield{note}% - \newunit\newblock \setunit{\bibpagerefpunct}\newblock \usebibmacro{pageref}% \usebibmacro{finentry}}% % BIBLIOGRAPHY ALIASES +\DeclareBibliographyAlias{mvbook}{book} \DeclareBibliographyAlias{bookinbook}{inbook} \DeclareBibliographyAlias{suppbook}{inbook} \DeclareBibliographyAlias{booklet}{book} |