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}
  • 2
    Please, do not include the code by means of links to other sites. First, it may well be no longer there when others come later to see this question. Second, it is really unfair of you to request we look at your full code to fix a particular problem. So, you should provide a minimal working example (MWE) / minimal working example with bibliography (MWEB). – gusbrs Nov 7 '18 at 19:48
  • 1
    A similar in: redefinition can be found in tex.stackexchange.com/q/404201/35864 and seems to originate from tex.stackexchange.com/a/173653/35864. Audrey used a similar strategy before tex.stackexchange.com/q/122218/35864 – moewe Nov 7 '18 at 19:56
  • hey @gusbrs I completely understand. I just used it as it was suggested during another question :) and I only shared the minimal example - I can also delete other bib entries, however they were affected by the approach as well, so it might still be helpful to have the full list :) – user168390 Nov 7 '18 at 20:01
  • Because I didn't have the time to say it yesterday: This is a very good MWE. Thank you for taking the time to add it. It would be great if future questions would include MWEs like this from the start and not only after requests in the comments. That makes it much easier for both sides to get a good answer quickly. – moewe Nov 8 '18 at 7:31
  • Since you have some responses below that seem to answer your question, please consider marking one of them as ‘Accepted’ by clicking on the tickmark below their vote count (see How do you accept an answer?). This shows which answer helped you most, and it assigns reputation points to the author of the answer (and to you!). It's part of this site's idea to identify good questions and answers through upvotes and acceptance of answers. – user36296 Mar 28 at 19:58
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...

  • 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 '18 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 '18 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 '18 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 '18 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 '18 at 10:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.