% kpi-thesis-dstu.bbx — biblatex bibliography style per ДСТУ 8302:2015. % House choices where the standard allows options: «.» between areas (4.4), the host title in % italics after «.» instead of «//» (4.9.1), 1–3 authors in the heading and 4+ as «/ І. Б. Прізвище % та ін.» after the title (4.4), DOI instead of the URL when there is one (7.4.4.3.1), page ranges % with «–» like the rest of the text. «URL:» and «(дата звернення: …)» stay Ukrainian for every % source; the other abbreviations follow the source language (langid = english → Vol., no., P.). \ProvidesFile{kpi-thesis-dstu.bbx}[2026/11/22 v2.1 DSTU 8302:2015 bibliography style] \RequireBibliographyStyle{numeric} \ExecuteBibliographyOptions{ sorting=none, giveninits=true, maxbibnames=99, minbibnames=99, autolang=other, isbn=false, eprint=false, useeditor=false, usetranslator=false, } % Names sort as printed: «Єременко В. С.» from «Віталій Семенович» and from «В. С.» are one author. \DeclareSortingNamekeyTemplate{ \keypart{\namepart{prefix}} \keypart{\namepart{family}} \keypart{\namepart[inits=true]{given}} } % Alphabetical and chronological order follow the heading of the description: a work with % 4+ authors or only editors starts with its title, a standard with its designation, and % Latin headings go after Cyrillic ones. \DeclareStyleSourcemap{ \maps[datatype=bibtex]{ \map{ \step[fieldsource=author, match=\regexp{\A(?:[^\{\}]|\{[^\{\}]*\})*?\sand\s(?:[^\{\}]|\{[^\{\}]*\})*?\sand\s(?:[^\{\}]|\{[^\{\}]*\})*?\sand\s}, final] \step[fieldset=options, fieldvalue={,useauthor=false}, append] } \map{ \step[fieldsource=author, match=\regexp{\sand\s+others\s*\Z}, final] \step[fieldset=options, fieldvalue={,useauthor=false}, append] } \map{ \pertype{standard} \step[fieldsource=number, final] \step[fieldset=sorttitle, origfieldval] } \map{ \pertype{standard} \step[fieldsource=number, match=\regexp{\A\{?[A-Za-z]}, final] \step[fieldset=presort, fieldvalue={zz}] } \map{ \step[fieldsource=author, match=\regexp{\A\{?[A-Za-z]}, final] \step[fieldset=presort, fieldvalue={zz}] } \map{ \step[notfield=author, final] \step[fieldsource=title, match=\regexp{\A\{?[A-Za-z]}, final] \step[fieldset=presort, fieldvalue={zz}] } } } % --- Strings --------------------------------------------------------------------------------- \NewBibliographyString{dstupages,dstupagetotal,dstuvolume,dstuvolumes,dstunumber,dstuissue, dstuedition,dstueditor,dstucompiler,dstutranslator,dstupatent,dstufrom,dstuversion,dstuurl, dstuurlseen,dstudoi,dstuchief,dstuorigfrom} \DefineBibliographyStrings{ukrainian}{ dstupages = {С\adddot}, dstupagetotal = {с\adddot}, dstuvolume = {Т\adddot}, dstuvolumes = {т\adddot}, dstunumber = {№}, dstuissue = {Вип\adddot}, dstuedition = {вид\adddot}, dstueditor = {ред\adddot}, dstucompiler = {уклад\adddot}, dstutranslator = {пер\adddot}, dstupatent = {пат\adddot}, dstufrom = {від}, dstuversion = {Версія}, dstuurl = {URL}, dstuurlseen = {дата звернення}, dstudoi = {DOI}, dstuchief = {голов\adddot\addspace ред\adddot}, dstuorigfrom = {з}, andothers = {та\addnbspace ін\adddot}, } \DefineBibliographyStrings{english}{ dstupages = {P\adddot}, dstupagetotal = {p\adddot}, dstuvolume = {Vol\adddot}, dstuvolumes = {vols\adddot}, dstunumber = {no\adddot}, dstuissue = {Iss\adddot}, dstuedition = {ed\adddot}, dstueditor = {ed\adddot\addspace by}, dstucompiler = {comp\adddot}, dstutranslator = {transl\adddot}, dstupatent = {pat\adddot}, dstufrom = {of}, dstuversion = {Version}, dstuurl = {URL}, dstuurlseen = {дата звернення}, dstudoi = {DOI}, dstuchief = {ed.-in-chief}, dstuorigfrom = {from}, andothers = {et\addnbspace al\adddot}, } \DefineBibliographyStrings{russian}{ dstupages = {С\adddot}, dstupagetotal = {с\adddot}, dstuvolume = {Т\adddot}, dstuvolumes = {т\adddot}, dstunumber = {№}, dstuissue = {Вып\adddot}, dstuedition = {изд\adddot}, dstueditor = {ред\adddot}, dstucompiler = {сост\adddot}, dstutranslator = {пер\adddot}, dstupatent = {пат\adddot}, dstufrom = {от}, dstuversion = {Версия}, dstuurl = {URL}, dstuurlseen = {дата звернення}, dstudoi = {DOI}, dstuchief = {гл\adddot\addspace ред\adddot}, dstuorigfrom = {с}, andothers = {и\addnbspace др\adddot}, } % URLs and DOIs break only at their own break points, without stretching inside the line. \biburlbigskip=0mu\relax \biburlnumskip=0mu\relax \biburlucskip=0mu\relax \biburllcskip=0mu\relax % Ranges with «–» in every language (ukrainian.lbx would give «—»). \DefineBibliographyExtras{ukrainian}{\protected\def\bibrangedash{\textendash\nobreak}} \DefineBibliographyExtras{english}{\protected\def\bibrangedash{\textendash\nobreak}} \DefineBibliographyExtras{russian}{\protected\def\bibrangedash{\textendash\nobreak}} % --- Punctuation and names ------------------------------------------------------------------- \renewcommand*{\newunitpunct}{\addperiod\space} \newcommand*{\kpidstucolon}{:} \newcommand*{\kpidstuslash}{/} \newcommand*{\kpidstusemicolon}{;} \renewcommand*{\subtitlepunct}{\addnbspace\kpidstucolon\space} \renewcommand*{\revsdnamepunct}{} \DeclareDelimFormat{multinamedelim}{\addcomma\space} \DeclareDelimFormat{finalnamedelim}{\addcomma\space} \DeclareDelimFormat[bib]{nametitledelim}{\addperiod\space} % «Прізвище І. Б.» in the heading, «І. Б. Прізвище» after «/». \DeclareNameFormat{dstu:heading}{% \usebibmacro{name:family-given}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}% \usebibmacro{name:andothers}} \DeclareNameFormat{dstu:resp}{% \usebibmacro{name:given-family}{\namepartfamily}{\namepartgiveni}{\namepartprefix}{\namepartsuffix}% \usebibmacro{name:andothers}} % --- Field formats --------------------------------------------------------------------------- % Italics without \emph: the class loads ulem, which underlines \emph. \renewcommand*{\mkbibemph}[1]{\textit{#1}} \DeclareFieldFormat*{title}{#1} \DeclareFieldFormat*{subtitle}{#1} \DeclareFieldFormat*{titleaddon}{#1} \DeclareFieldFormat{booktitle}{\textit{#1}} \DeclareFieldFormat{journaltitle}{\textit{#1}} \DeclareFieldFormat*{maintitle}{#1} \DeclareFieldFormat*{part}{#1} \DeclareFieldFormat*{pages}{\bibstring{dstupages}\addnbspace#1} \DeclareFieldFormat*{pagetotal}{#1\addnbspace\bibstring{dstupagetotal}} \DeclareFieldFormat*{volume}{\bibstring{dstuvolume}\addnbspace#1} \DeclareFieldFormat{volumes}{% \iffieldequalstr{langid}{english}{in #1\addnbspace\bibstring{dstuvolumes}}{у #1\addnbspace\bibstring{dstuvolumes}}} \DeclareFieldFormat*{number}{\bibstring{dstunumber}\addnbspace#1} \DeclareFieldFormat[standard,patent,report]{number}{#1} \DeclareFieldFormat[legislation,legal]{number}{\bibstring{dstunumber}\addnbspace#1} \DeclareFieldFormat{issue}{\bibstring{dstuissue}\addnbspace#1} % The issue of an official gazette is its «№»; number is the act's own number. \DeclareFieldFormat[legislation,legal]{issue}{\bibstring{dstunumber}\addnbspace#1} \DeclareFieldFormat{version}{\bibstring{dstuversion}\addnbspace#1} \DeclareFieldFormat{doi}{\bibstring{dstudoi}\addcolon\space\href{https://doi.org/#1}{\nolinkurl{#1}}} \DeclareFieldFormat{url}{\bibstring{dstuurl}\addcolon\space\url{#1}} \DeclareFieldFormat{urldate}{\mkbibparens{\bibstring{dstuurlseen}\addcolon\space#1}} \DeclareFieldFormat{labelnumberwidth}{#1\bibrightparen} \DeclareListFormat{location}{\ifnumgreater{\value{listcount}}{1}{\addnbspace\kpidstusemicolon\space}{}#1} % Ukrainian ordinal for «2-ге вид.»: the ending follows the last digit; 11–19 and 40 are exceptions. \ExplSyntaxOn \cs_new:Npn \kpi_dstu_ordinal:n #1 { #1 - \int_compare:nNnTF { \int_mod:nn {#1} {100} } > { 10 } { \int_compare:nNnTF { \int_mod:nn {#1} {100} } < { 20 } { те } { \kpi_dstu_ordinal_end:n {#1} } } { \kpi_dstu_ordinal_end:n {#1} } } \cs_new:Npn \kpi_dstu_ordinal_end:n #1 { \int_compare:nNnTF { \int_mod:nn {#1} {100} } = { 40 } { ве } { \int_case:nnF { \int_mod:nn {#1} {10} } { {1} {ше} {2} {ге} {3} {тє} {7} {ме} {8} {ме} } { те } } } \cs_new_eq:NN \kpidstuordinal \kpi_dstu_ordinal:n \ExplSyntaxOff \DeclareFieldFormat{edition}{% \ifinteger{#1} {\iffieldequalstr{langid}{english} {\mkbibordedition{#1}\addnbspace\bibstring{dstuedition}} {\iffieldequalstr{langid}{russian} {#1-е\addnbspace\bibstring{dstuedition}} {\kpidstuordinal{#1}\addnbspace\bibstring{dstuedition}}}} {#1}} % dd.mm.yyyy for every date the style prints in full. \newcommand*{\kpidstudate}[1]{% \iffieldundef{#1day}{}{\mkdayzeros{\thefield{#1day}}.}% \iffieldundef{#1month}{}{\mkmonthzeros{\thefield{#1month}}.}% \thefield{#1year}} % «4 серп.» for a newspaper issue (ДСТУ 3582 month abbreviations). \newcommand*{\kpidstumonth}[1]{% \ifcase#1\or січ.\or лют.\or берез.\or квіт.\or трав.\or черв.\or лип.\or серп.\or верес.\or жовт.\or листоп.\or груд.\fi} % --- Building blocks ------------------------------------------------------------------------- \newtoggle{kpi@many} \newtoggle{kpi@resp} \newbibmacro*{dstu:manyauthors}{% \togglefalse{kpi@many}% \ifnameundef{author}{} {\ifnumgreater{\value{author}}{3}{\toggletrue{kpi@many}}{}% \ifandothers{author}{\toggletrue{kpi@many}}{}}} % Heading: 1–3 authors, or nothing (the title opens the entry). \newbibmacro*{dstu:heading}{% \usebibmacro{dstu:manyauthors}% \iftoggle{kpi@many}{} {\ifnameundef{author}{} {\printnames[dstu:heading][1-3]{author}% \setunit{\printdelim{nametitledelim}}}}} \newbibmacro*{dstu:title}{% \printfield{title}% \setunit{\subtitlepunct}\printfield{subtitle}% \setunit{\subtitlepunct}\printfield{titleaddon}} \newbibmacro*{dstu:volumes}{% \iffieldundef{volumes}{}{\setunit{\subtitlepunct}\printfield{volumes}}} % Statement of responsibility after «/»: 4+ authors as «І. Б. Прізвище та ін.», then editors or % compilers and translators, separated by « ; ». \newbibmacro*{dstu:respsep}{% \iftoggle{kpi@resp}{\setunit{\addnbspace\kpidstusemicolon\space}}{\setunit{\addnbspace\kpidstuslash\space}}% \toggletrue{kpi@resp}} \newbibmacro*{dstu:manyresp}{% \usebibmacro{dstu:manyauthors}% \iftoggle{kpi@many} {\usebibmacro{dstu:respsep}% \printnames[dstu:resp][1-1]{author}}{}} \newbibmacro*{dstu:editors}{% \ifnameundef{editor}{} {\usebibmacro{dstu:respsep}% \printtext{\iffieldequalstr{editortype}{compiler}{\bibstring{dstucompiler}} {\iffieldequalstr{editortype}{chief}{\bibstring{dstuchief}}{\bibstring{dstueditor}}}}% \setunit{\addspace}\printnames[dstu:resp]{editor}}} % «пер. з англ.»: the original language as a short adjective. \newcommand*{\kpidstulang}[1]{% \ifstrequal{#1}{english}{англ.}{\ifstrequal{#1}{german}{нім.}{\ifstrequal{#1}{french}{франц.}{% \ifstrequal{#1}{russian}{рос.}{\ifstrequal{#1}{polish}{пол.}{\ifstrequal{#1}{ukrainian}{укр.}{#1}}}}}}} \DeclareListFormat{origlanguage}{\kpidstulang{#1}} \newtoggle{kpi@orgresp} \toggletrue{kpi@orgresp} \newbibmacro*{dstu:resp}{% \togglefalse{kpi@resp}% \usebibmacro{dstu:manyresp}% \iftoggle{kpi@orgresp} {\ifboolexpr{test {\iflistundef{organization}} or test {\iflistundef{publisher}}}{} {\usebibmacro{dstu:respsep}\printlist{organization}}}{}% \usebibmacro{dstu:editors}% \ifnameundef{translator}{} {\usebibmacro{dstu:respsep}% \printtext{\bibstring{dstutranslator}% \iflistundef{origlanguage}{}{\addspace\bibstring{dstuorigfrom}\addspace\printlist{origlanguage}}}% \setunit{\addspace}\printnames[dstu:resp]{translator}}} % «Місто : Видавець, рік»; «Місто, рік», «Видавець, рік» or just «рік» when parts are missing. \newbibmacro*{dstu:place+publisher+year}[1]{% \newunit\newblock \printlist{location}% \iflistundef{#1}{} {\iflistundef{location}{\newunit}{\setunit{\addnbspace\kpidstucolon\space}}% \printlist{#1}}% \ifboolexpr{test {\iflistundef{location}} and test {\iflistundef{#1}}} {\newunit}{\setunit{\addcomma\space}}% \printfield{year}% \iffieldequalstr{entrysubtype}{newspaper} {\iffieldundef{month}{} {\setunit{\addperiod\space}\printtext{\iffieldundef{day}{}{\thefield{day}\addnbspace}\kpidstumonth{\thefield{month}}}}} {}} \newbibmacro*{dstu:imprint}{% \iflistundef{publisher} {\usebibmacro{dstu:place+publisher+year}{organization}} {\usebibmacro{dstu:place+publisher+year}{publisher}}} \newbibmacro*{dstu:volume+pages}{% \newunit\printfield{volume}% \newunit\printfield{pages}% \newunit\printfield{pagetotal}} % DOI replaces the URL (7.4.4.3.1); a URL carries its access date. \newbibmacro*{dstu:access}{% \iffieldundef{doi} {\iffieldundef{url}{} {\newunit\newblock\printfield{url}% \iffieldundef{urlyear}{}{\setunit{\addspace}\printtext[urldate]{\kpidstudate{url}}}}} {\newunit\newblock\printfield{doi}}} \newbibmacro*{dstu:finish}{% \newunit\printfield{note}% \usebibmacro{dstu:access}% \finentry} % «Т. 5, № 2» / «Vol. 5, no. 2» for serials. \newbibmacro*{dstu:serial}{% \newunit\newblock\printfield{journaltitle}% \setunit{\subtitlepunct}\printfield{journalsubtitle}% \newunit\printfield{year}% \iffieldequalstr{entrysubtype}{newspaper} {\iffieldundef{month}{} {\setunit{\addperiod\space}\printtext{\iffieldundef{day}{}{\thefield{day}\addnbspace}\kpidstumonth{\thefield{month}}}}} {}% \newunit\printfield{volume}% \iffieldundef{issue}{} {\iffieldundef{volume}{\newunit}{\setunit{\addcomma\space}}\printfield{issue}}% \iffieldundef{number}{} {\ifboolexpr{test {\iffieldundef{volume}} and test {\iffieldundef{issue}}} {\newunit}{\setunit{\addcomma\space}}% \printfield{number}}% \newunit\printfield{pages}} % --- Drivers --------------------------------------------------------------------------------- \DeclareBibliographyDriver{book}{% \usebibmacro{dstu:heading}% \iffieldundef{maintitle} {\usebibmacro{dstu:title}% \usebibmacro{dstu:volumes}% \usebibmacro{dstu:resp}% \newunit\printfield{edition}% \usebibmacro{dstu:imprint}% \usebibmacro{dstu:volume+pages}} {\printfield{maintitle}% \setunit{\subtitlepunct}\printfield{mainsubtitle}% \usebibmacro{dstu:volumes}% \usebibmacro{dstu:resp}% \newunit\printfield{edition}% \usebibmacro{dstu:imprint}% \newunit\printfield{volume}% \setunit{\subtitlepunct}\usebibmacro{dstu:title}% \newunit\printfield{pages}% \newunit\printfield{pagetotal}}% \usebibmacro{dstu:finish}} \DeclareBibliographyAlias{mvbook}{book} \DeclareBibliographyAlias{collection}{book} \DeclareBibliographyAlias{mvcollection}{book} \DeclareBibliographyAlias{proceedings}{book} \DeclareBibliographyAlias{reference}{book} \DeclareBibliographyAlias{manual}{book} \DeclareBibliographyDriver{report}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \iffieldundef{type}{}{\setunit{\subtitlepunct}\printfield{type}}% \usebibmacro{dstu:resp}% \newunit\printfield{number}% \usebibmacro{dstu:place+publisher+year}{institution}% \usebibmacro{dstu:volume+pages}% \usebibmacro{dstu:finish}} \DeclareBibliographyDriver{thesis}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \setunit{\subtitlepunct}\printfield{type}% \usebibmacro{dstu:resp}% \usebibmacro{dstu:place+publisher+year}{institution}% \newunit\printfield{pagetotal}% \usebibmacro{dstu:finish}} \DeclareBibliographyDriver{article}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \usebibmacro{dstu:resp}% \usebibmacro{dstu:serial}% \usebibmacro{dstu:finish}} % A part of a book or proceedings: the host title in italics, its editors after «/». \DeclareBibliographyDriver{incollection}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \togglefalse{kpi@resp}% \usebibmacro{dstu:manyresp}% \newunit\newblock\printfield{booktitle}% \setunit{\subtitlepunct}\printfield{booksubtitle}% \setunit{\subtitlepunct}\printfield{booktitleaddon}% \togglefalse{kpi@resp}% \usebibmacro{dstu:editors}% \usebibmacro{dstu:imprint}% \usebibmacro{dstu:volume+pages}% \usebibmacro{dstu:finish}} \DeclareBibliographyAlias{inproceedings}{incollection} \DeclareBibliographyAlias{inbook}{incollection} \DeclareBibliographyAlias{inreference}{incollection} % «ДСТУ 8302:2015. Назва. Чинний від 01.07.2016. Київ : ДП «УкрНДНЦ», 2016. 17 с.» \DeclareBibliographyDriver{standard}{% \printfield{number}% \newunit\usebibmacro{dstu:title}% \newunit\printfield{note}% \usebibmacro{dstu:imprint}% \newunit\printfield{pagetotal}% \clearfield{note}% \usebibmacro{dstu:finish}} % «Про освіту : Закон України від 05.09.2017 № 2145-VIII.» \DeclareBibliographyDriver{legislation}{% \usebibmacro{dstu:title}% \setunit{\subtitlepunct}\printfield{type}% \iffieldundef{year}{}{\setunit{\addspace}\printtext{\bibstring{dstufrom}\addspace\kpidstudate{}}}% \iffieldundef{number}{}{\setunit{\addspace}\printfield{number}}% \clearfield{number}% \iffieldundef{journaltitle}{}{\usebibmacro{dstu:serial}}% \usebibmacro{dstu:finish}} \DeclareBibliographyAlias{legal}{legislation} % «Назва : пат. 76509 Україна. № 2004042416 ; заявл. 01.04.2004 ; опубл. 01.08.2006, Бюл. № 8. 120 с.» \DeclareBibliographyDriver{patent}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \setunit{\subtitlepunct}\printtext{\bibstring{dstupatent}}% \setunit{\addspace}\printfield{number}% \setunit{\addspace}\printlist{location}% \newunit\printfield{note}% \newunit\printfield{pagetotal}% \clearfield{note}% \usebibmacro{dstu:finish}} % Web pages, documentation, software, repositories, datasets. \DeclareBibliographyDriver{online}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \togglefalse{kpi@orgresp}% \usebibmacro{dstu:resp}% \toggletrue{kpi@orgresp}% \newunit\printfield{version}% \newunit\newblock\printlist{organization}% \setunit{\addcomma\space}\printlist{publisher}% \iffieldundef{url}{\setunit{\addcomma\space}\printfield{year}}{}% \usebibmacro{dstu:finish}} \DeclareBibliographyAlias{software}{online} \DeclareBibliographyAlias{dataset}{online} \DeclareBibliographyAlias{www}{online} \DeclareBibliographyDriver{misc}{% \usebibmacro{dstu:heading}% \usebibmacro{dstu:title}% \usebibmacro{dstu:resp}% \newunit\newblock\printfield{howpublished}% \usebibmacro{dstu:imprint}% \usebibmacro{dstu:volume+pages}% \usebibmacro{dstu:finish}} \DeclareBibliographyAlias{unpublished}{misc} \DeclareBibliographyAlias{booklet}{misc} \DeclareBibliographyAlias{*}{misc} % --- List layout: «1)» hanging from the paragraph indent, like the class's thebibliography ----- \defbibenvironment{bibliography} {\list {\printtext[labelnumberwidth]{\printfield{labelprefix}\printfield{labelnumber}}} {\setlength{\labelwidth}{\labelnumberwidth}% \setlength{\labelsep}{0.5em}% \setlength{\leftmargin}{0pt}% \setlength{\itemindent}{\dimexpr\parindent+\labelwidth+\labelsep\relax}% \setlength{\itemsep}{0pt}% \setlength{\parsep}{0pt}}% \sloppy\clubpenalty4000\widowpenalty4000\frenchspacing} {\endlist} {\item} \endinput