2

Usually, the year with a period is the last field in my entries. However, if a url exists it should be last and it should be separated from the year by a comma. How can I change the year delimiter as to only affect it, when a url is present?

This should work with all of the entry types listed in the filecontents.

EDIT: I've simplified my code a bit to clarify my goal. Basically, I want to change the comma after the title and booktitle fields to a period. The in: should also be in caps, as In:.

MWE:

\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}
8
  • \autodot is a a KOMA-Script command that produces a dot depending on the way your chapter/section numbering is set up. I don't think you want to use it in a biblatex context.
    – moewe
    Jul 4, 2020 at 7:57
  • I'm trying to understand the redefinition of institution+location+date, but I can't quite understand what it is supposed to do. For @thesis the code will print institution twice
    – moewe
    Jul 4, 2020 at 8:07
  • Generally I also recommend not to including leading or trailing punctuation in a field format. Don't use \DeclareFieldFormat{edition}{#1\addcomma} if you want to have a comma after the edition. Redefine the relevant bibmacros to change the punctuation.
    – moewe
    Jul 4, 2020 at 8:11
  • 1
    You change a lot of things from periods to commas. So maybe it would make sense to change \renewcommand*{\newunitpunct}{\addcomma\space} and try to insert periods explicitly where you want them. Where would that be? (After the title?)
    – moewe
    Jul 4, 2020 at 8:17
  • @moewe Regarding your last comment: using this code simplified my code substantially. How would I go about changing the comma after the title to a period?
    – fuj36840
    Jul 4, 2020 at 14:44

1 Answer 1

2

One way to force a period after title, booktitle (and maintitle) is to add a \printunit call to the end of the corresponding bibmacros. Unlike \setunit \printunit is not overwritten by subsequent \setunit calls, so we are guaranteed a period after these title fields.

In the MWE I reordered and modernised some of your code (mainly uses of \DeclareDelimFormat instead of \renewcommand to redefine context sensitive delimiters). I also tried to restore a more sane indentation of the code that seems to have been mangled by some auto-indent feature.

\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.: Statistical Analysis of Dimensional Accuracy in Additive Manufacturing Considering STL Model Properties. In: The International Journal of Advanced Manufacturing Technology, vol. 97, no. 5, pp. 2835–2849, 2018.

An alternative method where the bibliography drivers are patched is shown in https://tex.stackexchange.com/a/545112/35864.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .