2

sorry for all the questions, your help was amazing so far!

I have yet another question. I want journal titles in articles to be preceded by

In:

just like in collections (example of incollection below) enter image description here

current article: enter image description here In front of the Asahi should be an

In:

I am a bit at a loss how to achieve this. Thank you in advance and have a nice evening! :)

Latex example: https://www.overleaf.com/read/dvtrpzgfqghn

new issue of inconsistent (Hg.) enter image description here

-- Edit: I hope that's an okay example :) The parts after Hg now lack some spaces for some reason :<

\documentclass{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}
%----------------------------------------------------------------------------
%   BIB
%----------------------------------------------------------------------------
  \usepackage[
    backend=biber,
    style=authoryear,
    sorting=nyvt
  ]{biblatex}
\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\renewcommand{\labelnamepunct}{\addcolon\space}
\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\renewcommand\postnotedelim{\addcolon\addspace}
\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1\isdot}

% sets Hg
\renewbibmacro*{in:}{%
  \printtext{%
     \bibstring{in}\intitlepunct}%
  \ifentrytype{incollection}
    {\DeclareNameAlias{editor}{last-first}%
     \ifnameundef{editor}
       {}
       {\printnames{editor}%
        \setunit{\printunit{editortypedelim}}%
        \usebibmacro{editorstrg}%
        \setunit{\addcolon\addspace}}%
     \usebibmacro{maintitle+booktitle}%
     \clearfield{maintitle}%
     \clearfield{booktitle}%
     \clearfield{volume}%
     \clearfield{part}%
     \clearname{editor}}
    {}}

% Use Hg. in parentheses after editor
\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DefineBibliographyStrings{german}{%
     editor = {Hg\adddot}
     andothers = {et\ al\adddot}, %et al. statt u.a.
     editor = {{Hg\adddot}}, %Hg. statt Hrsg.
     editors = {{Hgg\adddot}}, %Hgg. plural
     byeditor = {{Hg\adddot}},
}

\begin{filecontents*}{\jobname.bib}
@book{CommissionontheHumanities.1980,
 editor = {{Commission on the Humanities}},
 year = {1980},
 title = {The Humanities in American Life},
 keywords = {Humanities},
 publisher = {{University of California Press}},
 isbn* = {0520041836},
 subtitle = {Report of the Commission on the Humanities},
 location = {Berkeley and London},
 abstract = {},
 organization = {{Commission on the Humanities}}
}

@incollection{Gotoda.1990,
 author = {Got{\^o}da, Masaharu},
 year = {1990},
 title = {Shin no minshu shugi o mezashite},
 titleaddon = {Eine wirkliche Demokratie anstreben},
 publisher = {Seibund{\^o}},
 maintitle = {Shishunki no seiji},
 maintitleaddon = {Politik in der Pubert{\"a}t},
 pagetotal = {34--59},
 location = {T{\^o}ky{\^o}},
 abstract = {},
 editor = {Yasuoka, Okiharu},
}
\end{filecontents*}
\addbibresource{\jobname.bib}
%----------------------------------------------------------------------------
%   MAIN
%----------------------------------------------------------------------------
\begin{document}
\nocite{*}
\printbibliography[heading=bibintoc,title={Literaturverzeichnis}]

\end{document}
5

1 Answer 1

2

You have a redefinition of the in: bibmacro in your code. (For the benefit of future readers of this Q&A: The original redefinition of the in: bibmacro is not the one shown in the MWE in the question. The original code was only posted as link to Overleaf which may or may not be accessible in the future. The MWE in the question already contains the result of a first – and almost successful, but ultimately buggy – attempt to resolve the original problem – see also the edit history of this answer, if you are interested in embarrassing typos on my part.)

You probably want that redefinition to be slightly different to make sure that the "in" is printed at all times and not just for @incollection: Simply move the bit of code that prints the "in" outside the conditional. I also fixed a few possible spurious spaces and tries to modernise the entire thing, that way it plays nicely with your other definitions (namely the editortype format).

\documentclass{scrreprt}
\usepackage[onehalfspacing]{setspace}
\usepackage[main=ngerman, english]{babel}

\usepackage[backend=biber, style=authoryear, sorting=nyvt]{biblatex}

\renewcommand{\mkbibnamefamily}[1]{\textsc{#1}}
\DeclareDelimFormat[bib]{nametitledelim}{\addcolon\space}

\DeclareFieldFormat{postnote}{#1}
\DeclareFieldFormat{multipostnote}{#1}
\renewcommand\postnotedelim{\addcolon\addspace}

\DeclareFieldFormat
  [article,inbook,incollection,inproceedings,patent,thesis,unpublished]
  {title}{#1\isdot}

\renewbibmacro*{in:}{%
  \printtext{%
     \bibstring{in}\intitlepunct}%
  \ifentrytype{incollection}
    {\DeclareNameAlias{editor}{family-given}%
     \ifnameundef{editor}
       {}
       {\printnames{editor}%
        \setunit{\printdelim{editortypedelim}}%
        \usebibmacro{editorstrg}%
        \setunit{\addcolon\space}}%
     \usebibmacro{maintitle+booktitle}%
     \clearfield{maintitle}%
     \clearfield{booktitle}%
     \clearfield{volume}%
     \clearfield{part}%
     \clearname{editor}}
    {}}

\DeclareDelimFormat{editortypedelim}{\addspace}
\DeclareFieldFormat{editortype}{\mkbibparens{#1}}
\DefineBibliographyStrings{german}{%
  editor    = {Hg\adddot}
  andothers = {et\ al\adddot}, %et al. statt u.a.
  editor    = {{Hg\adddot}}, %Hg. statt Hrsg.
  editors   = {{Hgg\adddot}}, %Hgg. plural
  byeditor  = {{Hg\adddot}},
}

\begin{filecontents*}{\jobname.bib}
@book{CommissionontheHumanities.1980,
  editor       = {{Commission on the Humanities}},
  year         = {1980},
  title        = {The Humanities in {American} Life},
  keywords     = {Humanities},
  publisher    = {University of California Press},
  isbn         = {0520041836},
  subtitle     = {Report of the Commission on the Humanities},
  location     = {Berkeley and London},
  organization = {Commission on the Humanities}
}

@incollection{Gotoda.1990,
  author         = {Got{\^o}da, Masaharu},
  year           = {1990},
  title          = {Shin no minshu shugi o mezashite},
  titleaddon     = {Eine wirkliche Demokratie anstreben},
  publisher      = {Seibund{\^o}},
  maintitle      = {Shishunki no seiji},
  maintitleaddon = {Politik in der Pubert{\"a}t},
  pagetotal      = {34--59},
  location       = {T{\^o}ky{\^o}},
  editor         = {Yasuoka, Okiharu},
}
\end{filecontents*}
\addbibresource{\jobname.bib}

\begin{document}
\nocite{*}
\printbibliography[heading=bibintoc, title={Literaturverzeichnis}]
\end{document}

I personally would not recommend this approach to print the editors of an @incollection before the booktitle. Instead I would use biblatex-ext's innamebeforetitle option, but then I'm obviously biased...

20
  • 1
    @user168390 Definitely add the necessary code as a minimal working example directly to your question in the future. Make sure that the code you post is a small as possible (i.e. does not consist of several files with \input and \include, does not reference files we don't have etc) and compilable only by copying and pasting the example. I know this means quite some work for you, but it is the only way that is really sustainable for the people trying to help you and benefit from your questions in the long term.
    – moewe
    Nov 7, 2018 at 20:09
  • 1
    @user168390 If you are unsure about how a so-called MWE should look like you may want to read tex.meta.stackexchange.com/q/228/35864 and tex.meta.stackexchange.com/q/4407/35864. And you will also want to take a look at the answers you received to your questions. Almost all answers (except this one) contain very good and concise minimal working examples that are focused on the issue at hand - this is more or less what we are after in your question as well. Reproduce the problematic output with as little code as possible.
    – moewe
    Nov 7, 2018 at 20:11
  • 1
    @moewe, a small detail, but one I'm aware you care about: How about \DeclareNameAlias{editor}{family-given}?
    – gusbrs
    Nov 7, 2018 at 21:03
  • 1
    @moewe Those are good points, I get the trade off. Particularly the circumstance that users don't stand a chance of reverting the update, if need be. But those are essentially arguments for an eternal freeze. If I recall correctly, they lag a number of years behind (I don't really know the frequency of updates, if any). Why should it be too difficult to offer a menu option with, e.g. "TL2018(current)", "TL2017(frozen)(default for new projects)", "TL2016(frozen)", and so on?
    – gusbrs
    Nov 8, 2018 at 9:51
  • 1
    @gusbrs overleaf.com/blog/435-tex-live-upgrade-november-2016n is quite interesting. Not sure if they still have the "same TeX live as current Ubuntu" goal, but I think at least Overleaf v2 has TeX live 2017 with biblatex 3.10, so that could be close to 18.04's TeX. That said, I really like the idea of yearly TeX live versions that people can choose. Have the current TeX live be the default for new projects (I'd probably opt for not updating it via tlmgr), old projects remain on their versions and let people change the version as they like. But of course that needs lots of resources.
    – moewe
    Nov 8, 2018 at 10:37

You must log in to answer this question.

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