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 07 '18 at 19:48
  • 1
    A similar in: redefinition can be found in https://tex.stackexchange.com/q/404201/35864 and seems to originate from https://tex.stackexchange.com/a/173653/35864. Audrey used a similar strategy before https://tex.stackexchange.com/q/122218/35864 – moewe Nov 07 '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 07 '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 08 '18 at 07: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. – samcarter_is_at_topanswers.xyz Mar 28 '19 at 19:58

1 Answers1

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...

moewe
  • 175,683
  • Thank you! That helped with the In: issue; unfortunately now I have new issue. The "(Hg.)" now is inconsistent. (s. entry "Commission.." and "Gotoda") -> added it to the main question :) – user168390 Nov 07 '18 at 19:58
  • @user168390 Sorry, I need to see the code that produces this. Otherwise I have to guess. First stab in the dark would be to remove the \mkbibparens{...} in \mkbibparens{\usebibmacro{editorstrg}}% to make it read \usebibmacro{editorstrg}%... but that's just a guess. – moewe Nov 07 '18 at 20:01
  • yup, sorry added it to overleaf or if you rather want to have it in the initial question as suggested by another user, I can do that too :) – user168390 Nov 07 '18 at 20:05
  • 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 07 '18 at 20:09
  • 1
    @user168390 If you are unsure about how a so-called MWE should look like you may want to read https://tex.meta.stackexchange.com/q/228/35864 and https://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 07 '18 at 20:11
  • @user168390 In case it got drowned in between me spamming you trying to convince you to add minimal examples to your question (which you should, you get the point ...): I edited the answer again. There should be no double brackets around "Hg" now. – moewe Nov 07 '18 at 20:16
  • Thank you @moewe - I am only struggling at understanding how to place a bib in one code example, as I only used it as a different bib file - other than that your example did indeed remove the []brackets successfully, however now the following text does not have any "space" between the respective words. I have added it to the example url in the question for now. – user168390 Nov 07 '18 at 20:26
  • @user168390 The two links should explain how you can do that and as I say many answers to your questions show good examples how one can integrate the .bib file directly into the .tex file by means of filecontents. It's too late for me to investigate the disapearing spaces, I have to go to bed. But I promise you that I will have a look at it tomorrow if you add a proper MWE in the sense of my links and other explanations to your question, so I don't have to fight with Overleaf any more. – moewe Nov 07 '18 at 20:34
  • i tried :D hope 2 bib entries are okay, as one has the Hg at the beginning and one in the middle of the entry (and they behaved differently with the [] brackets ) – user168390 Nov 07 '18 at 20:48
  • @user168390 Check the edit. That seems to have been a simply typo. – moewe Nov 07 '18 at 20:53
  • you saved me! thank you so much!! and sleep well! – user168390 Nov 07 '18 at 20:55
  • 1
    @moewe, a small detail, but one I'm aware you care about: How about \DeclareNameAlias{editor}{family-given}? – gusbrs Nov 07 '18 at 21:03
  • @gusbrs Good point, thank you. Whenever I hear that Overleaf is involved my motivation to modernise the code slumps because I can never remember the biblatex version Overleaf is using and when exactly new features I would suggest were introduced. So I often end up accruing a thread of comments complaining that commands are not defined and others don't seem to be working... – moewe Nov 08 '18 at 07:28
  • @moewe Ah! That is true! And I also can't get why those guys, which have this for a living, can't keep things up to date (or less outdated, if the concern is stability)... – gusbrs Nov 08 '18 at 09:17
  • @gusbrs Well I can understand that Overleaf does not roll daily updates (or regular updates with fairly small intervals). Of course they want to make sure that their system works and updates always introduce a chance of failure. I know nothing about their system, but more regular updates could pose other difficulties as well. And last but not least they have to balance the needs of their customers. People have no control over Overleaf udpdates and a breaking update that destroys people's biblatex style (think version 3.3) two days before an important deadline is not what they want. – moewe Nov 08 '18 at 09:22
  • ... I mean updates once a year to the current TeX live would be nice, but I'm sure that I would moan about missing biblatex updates after six months or so even then, so you can't please everyone... – moewe Nov 08 '18 at 09:25
  • 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 08 '18 at 09:51
  • @moewe A propos of updates, congrats on 3.12! And thank you very much! – gusbrs Nov 08 '18 at 10:29
  • 1
    @gusbrs https://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 08 '18 at 10:37
  • @moewe Thanks for the link. Perhaps these are desires of folks who don't use Overleaf anyway. But I must admit that the idea of having an option is a nice one. Anyway, I didn't mean to pester you with an Overleaf rant. ;-) – gusbrs Nov 08 '18 at 10:52