Biblatex:将年份后的句号改为逗号

Biblatex:将年份后的句号改为逗号

通常,带句点的年份是我的条目中的最后一个字段。但是,如果存在 URL,则它应该是最后一个,并且应该用逗号与年份分隔。我如何更改年份分隔符,以便仅在存在 URL 时才影响它?

这应该适用于文件内容中列出的所有条目类型。

编辑:我稍微简化了代码以明确我的目标。基本上,我想将titlebooktitle字段后的逗号更改为句点。in:也应该大写,如In:

梅威瑟:

\documentclass{scrbook}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[hyphens]{url}
\usepackage[hidelinks, breaklinks]{hyperref}

\begin{filecontents}{test.bib}
    @thesis{harm,
        title = {Normung in Europa \textendash{} technische Anforderungen \textendash{} harmonisierte Normen \textendash{} CE-Kennzeichnung},
        author = {{Europ\"aische Kommision}},
        date = {2020},
        url = {https://europa.eu/youreurope/business/product-requirements/standards/standards-in-europe/index_de.htm},
        urldate = {2020-05-29}
    }
    @article{baturynska2018,
        title = {Statistical Analysis of Dimensional Accuracy in Additive Manufacturing Considering {{STL}} Model Properties},
        author = {Baturynska, Ivanna},
        date = {2018},
        journaltitle = {The International Journal of Advanced Manufacturing Technology},
        volume = {97},
        pages = {2835--2849},
        number = {5}
    }
    @book{breuninger2013,
        title = {Generative Fertigung mit Kunststoffen: Konzeption und Konstruktion f\"ur Selektives Lasersintern},
        shorttitle = {Generative Fertigung mit Kunststoffen},
        author = {Breuninger, Jannis and Becker, Ralf and Wolf, Andreas and Rommel, Steve and Verl, Alexander},
        date = {2013},
        publisher = {{Springer Vieweg}},
        location = {{Berlin/Heidelberg}},
    }
    @inreference{greitemann2017,
        title = {Orthese},
        booktitle = {Lexikon Orthop\"adie und Unfallchirurgie},
        author = {Greitemann, Bernhard},
        editor = {Englehardt, Marting},
        date = {2017},
        publisher = {{Springer}},
        url = {http://www.lexikon-orthopaedie.com/pdx.pl?dv=0&id=01649}
    }
    @incollection{josupeit2015,
        title = {Powder ageing and material properties of laser sintered polyamide 12 using low refresh rates},
        booktitle = {Neue Entwicklungen in der Additiven Fertigung},
        author = {Josupeit, Stefan and Tutzschky, Sabine and Gessler, Monika and Schmid, Hans-Joachim},
        editor = {Witt, Gerd and Wegner, Andreas and Sehrt, J. T.},
        date = {2015},
        pages = {63--78},
        publisher = {{Springer}},
        location = {{Berlin/Heidelberg}}
    }
    @inproceedings{josupeit2015a,
        title = {Material Properties of Laser Sintered Polyamide 12 as Function of Build Cycles Using Low Refresh Rates},
        author = {Josupeit, Stefan and Lohn, Johannes and Hermann, Eduard and Gessler, Monika and Tenbrink, Stephan and Schmid, Hans-Joachim},
        date = {2015},
        pages = {540--548},
        location = {{Austin}},
        eventtitle = {26th {{International Sold Free Form Symposium}} \textendash{} {{An Additive Manufacturing Conference}}}
    }
\end{filecontents}

\usepackage[backend=biber, style=ext-numeric, citestyle=numeric-comp, sorting=nyt, autocite=inline, innamebeforetitle=true, giveninits=true, maxbibnames=99]{biblatex}
\addbibresource{test.bib}

\renewcommand*{\newunitpunct}{\addcomma\space}

\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{8000}

\DeclareNameAlias{default}{family-given}

\DeclareFieldFormat{url}{\bibstring{url}\addcolon\space\url{#1}}
\DeclareFieldFormat[article]{volume}{\bibstring{jourvol}\addnbspace #1}
\DeclareFieldFormat[article]{number}{\bibstring{number}\addnbspace #1}
\DeclareFieldFormat{issuedate}{#1}
\DeclareFieldFormat[article,inbook,incollection,thesis,book,inproceedings]{title}{\itshape #1}
\DeclareFieldFormat{journaltitle}{#1}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareFieldFormat{edition}{#1}
\DeclareFieldFormat{series}{#1}
\DeclareDelimFormat[bib, biblist]{nametitledelim}{\addcolon\space}

\renewcommand{\multinamedelim}{\addsemicolon\space}
\renewcommand{\jourvoldelim}{\addcomma\space}
\renewcommand{\volnumdelim}{\addcomma\space}
\renewcommand{\finalnamedelim}{\addsemicolon\space}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\renewcommand{\editortypedelim}{\addspace}

%%%% rearange pages and date
\renewbibmacro*{journal+issuetitle}{%
    \usebibmacro{journal}%
    \setunit*{\jourvoldelim}%
    \iffieldundef{series}
        {}
        {\setunit*{\addcomma\space}%
        \printfield{series}%
        \setunit{\servoldelim}}%
    \usebibmacro{volume+number+eid}%
    \setunit{\addcolon\space}%
    \usebibmacro{issue}%
    \setunit{\bibpagespunct}%
    \printfield{pages}%
    \setunit{\addcomma\space}%
    \usebibmacro{issue+date}%
\newunit}

\renewbibmacro*{note+pages}{%
    \printfield{note}%
\newunit}
%%%%

\begin{document}

\autocite{harm,baturynska2018,breuninger2013,greitemann2017,josupeit2015,josupeit2015a}

\printbibliography

\end{document}

答案1

title强制在, booktitle(和maintitle)后添加句点的一种方法是将\printunit调用添加到相应的 bibmacros 末尾。 Unlike\setunit \printunit不会被后续\setunit调用覆盖,因此我们可以保证在这些标题字段后添加句点。

在 MWE 中,我重新排序并更新了部分代码(主要使用 of\DeclareDelimFormat而不是 of\renewcommand来重新定义上下文敏感的分隔符)。我还尝试恢复似乎被某些自动缩进功能破坏的代码的更合理缩进。

\documentclass{article}

\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[hyphens]{url}
\usepackage[backend=biber,
  style=ext-numeric-comp,
  sorting=nyt,
  maxbibnames=99,
  giveninits=true, 
  autocite=inline,
  innamebeforetitle=true,
]{biblatex}

\usepackage[hidelinks, breaklinks]{hyperref}


\renewcommand*{\newunitpunct}{\addcomma\space}

\DeclareNameAlias{default}{family-given}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}

\DeclareDelimFormat{multinamedelim}{\addsemicolon\space}
\DeclareDelimAlias{finalnamedelim}{multinamedelim}


\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DeclareDelimFormat{editortypedelim}{\addspace}

\DeclareDelimFormat[bib, biblist]{nametitledelim}{\addcolon\space}

\DeclareFieldFormat*{title}{\mkbibemph{#1}}
\DeclareFieldFormat{journaltitle}{#1}

\newcommand*{\aftertitlepunct}{\addperiod\space}
\newcommand*{\afterbooktitlepunct}{\aftertitlepunct}
\newcommand*{\aftermaintitlepunct}{\aftertitlepunct}

\renewbibmacro*{title}{%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {\printtext[title]{%
       \printfield[titlecase:title]{title}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase:title]{subtitle}}%
     \setunit{\titleaddonpunct}}%
  \printfield{titleaddon}%
  \ifboolexpr{
    test {\iffieldundef{title}}
    and
    test {\iffieldundef{subtitle}}
  }
    {}
    {\printunit{\aftertitlepunct}}}

\renewbibmacro*{booktitle}{%
  \ifboolexpr{
    test {\iffieldundef{booktitle}}
    and
    test {\iffieldundef{booksubtitle}}
  }
    {}
    {\printtext[booktitle]{%
       \printfield[titlecase:booktitle]{booktitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase:booktitle]{booksubtitle}}%
     \setunit{\titleaddonpunct}}%
  \printfield{booktitleaddon}%
  \ifboolexpr{
    test {\iffieldundef{booktitle}}
    and
    test {\iffieldundef{booksubtitle}}
  }
    {}
    {\printunit{\afterbooktitlepunct}}}

\renewbibmacro*{maintitle}{%
  \ifboolexpr{
    test {\iffieldundef{maintitle}}
    and
    test {\iffieldundef{mainsubtitle}}
  }
    {}
    {\printtext[maintitle]{%
       \printfield[titlecase:maintitle]{maintitle}%
       \setunit{\subtitlepunct}%
       \printfield[titlecase:maintitle]{mainsubtitle}}%
     \setunit{\titleaddonpunct}}%
  \printfield{maintitleaddon}%
  \ifboolexpr{
    test {\iffieldundef{maintitle}}
    and
    test {\iffieldundef{mainsubtitle}}
  }
    {}
    {\printunit{\aftermaintitlepunct}}}

\DeclareFieldFormat{edition}{#1}
\DeclareFieldFormat{series}{#1}

\renewcommand{\jourvoldelim}{\addcomma\space}
\renewcommand{\volnumdelim}{\addcomma\space}

\DeclareFieldFormat[article]{volume}{\bibstring{jourvol}\addnbspace #1}
\DeclareFieldFormat[article]{number}{\bibstring{number}\addnbspace #1}
\DeclareFieldFormat{issuedate}{#1}
%%%% rearange pages and date
\renewbibmacro*{journal+issuetitle}{%
  \usebibmacro{journal}%
  \setunit*{\jourvoldelim}%
  \iffieldundef{series}
    {}
    {\setunit*{\addcomma\space}%
     \printfield{series}%
     \setunit{\servoldelim}}%
  \usebibmacro{volume+number+eid}%
  \setunit{\addcolon\space}%
  \usebibmacro{issue}%
  \setunit{\bibpagespunct}%
  \printfield{pages}%
  \setunit{\addcomma\space}%
  \usebibmacro{issue+date}%
\newunit}

\renewbibmacro*{note+pages}{%
  \printfield{note}%
  \newunit}

\setcounter{biburllcpenalty}{7000}
\setcounter{biburlucpenalty}{8000}
\DeclareFieldFormat{url}{\bibstring{url}\addcolon\space\url{#1}}

\begin{filecontents}{\jobname.bib}
@thesis{harm,
  title   = {Normung in Europa -- technische Anforderungen
             -- harmonisierte Normen -- CE-Kennzeichnung},
  author  = {{Europäische Kommision}},
  date    = {2020},
  url     = {https://europa.eu/youreurope/business/product-requirements/standards/standards-in-europe/index_de.htm},
  urldate = {2020-05-29},
}
@article{baturynska2018,
  title        = {Statistical Analysis of Dimensional Accuracy in
                  Additive Manufacturing Considering {STL} Model Properties},
  author       = {Baturynska, Ivanna},
  date         = {2018},
  journaltitle = {The International Journal of Advanced Manufacturing Technology},
  volume       = {97},
  pages        = {2835--2849},
  number       = {5},
}
@book{breuninger2013,
  title      = {Generative Fertigung mit Kunststoffen},
  subtitle   = {Konzeption und Konstruktion für Selektives Lasersintern},
  author     = {Breuninger, Jannis and Becker, Ralf and Wolf, Andreas
                and Rommel, Steve and Verl, Alexander},
  date       = {2013},
  publisher  = {Springer Vieweg},
  location   = {Berlin and Heidelberg},
}
@inreference{greitemann2017,
  title     = {Orthese},
  booktitle = {Lexikon Orthopädie und Unfallchirurgie},
  author    = {Greitemann, Bernhard},
  editor    = {Englehardt, Marting},
  date      = {2017},
  publisher = {Springer},
  url       = {http://www.lexikon-orthopaedie.com/pdx.pl?dv=0&id=01649},
}
@incollection{josupeit2015,
  title     = {Powder ageing and material properties of laser sintered
               polyamide 12 using low refresh rates},
  booktitle = {Neue Entwicklungen in der Additiven Fertigung},
  author    = {Josupeit, Stefan and Tutzschky, Sabine
               and Gessler, Monika and Schmid, Hans-Joachim},
  editor    = {Witt, Gerd and Wegner, Andreas and Sehrt, J. T.},
  date      = {2015},
  pages     = {63--78},
  publisher = {Springer},
  location  = {Berlin/Heidelberg},
}
@inproceedings{josupeit2015a,
  title      = {Material Properties of Laser Sintered Polyamide 12
                as Function of Build Cycles Using Low Refresh Rates},
  author     = {Josupeit, Stefan and Lohn, Johannes and Hermann, Eduard
                and Gessler, Monika and Tenbrink, Stephan and Schmid, Hans-Joachim},
  date       = {2015},
  pages      = {540--548},
  location   = {Austin},
  eventtitle = {26th International Sold Free Form Symposium
                -- An Additive Manufacturing Conference},
}
\end{filecontents}
\addbibresource{\jobname.bib}

\begin{document}
\autocite{harm,baturynska2018,breuninger2013,greitemann2017,josupeit2015,josupeit2015a}

\printbibliography
\end{document}

Baturynska, I.:考虑 STL 模型属性的增材制造尺寸精度统计分析。《国际先进制造技术杂志》第 97 卷第 5 期,第 2835-2849 页,2018 年。

修补参考书目驱动程序的另一种方法如下https://tex.stackexchange.com/a/545112/35864

相关内容