2

This is a follow up question to Year in bibliography with brackets, where I also took this MWE from.

\documentclass[pdftex,a4paper,12pt,german]{book}
\usepackage[german,ngerman]{babel} 
\usepackage[latin1]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[authoryear]{natbib}
\begin{document}
\bibliographystyle{myplainnat}
\cite{lastname.2019a}
\cite{lastname.2019b}
\bibliography{Literatur}
\end{document}
@book{lastname.2019a,
 author = {Firstname Lastname},
 year = {2019},
 title = {Title 1},
 address = {Berlin},
 publisher = {Springer}
}

@book{lastname.2019b,
 author = {Firstname Lastname},
 year = {2019},
 title = {Title 2},
 address = {Berlin},
 publisher = {Springer}
}

I edited my .bst file as the code provided in the answers like this:

FUNCTION {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
  month empty$
    'skip$
    { month
      " " * swap$ *
    }
  if$
  duplicate$ empty$ 'skip$ %% added
  { "(" swap$ * ")" *}     %% added
  if$
  extra.label *
}

However, my Bibliography now looks like this:

Lastname, Firstname. (2019)a, Title 1. Springer, Berlin.

Lastname, Firstname. (2019)b, Title 2. Springer, Berlin.

But I want it to look like this:

Lastname, Firstname. (2019a), Title 1. Springer, Berlin.

Lastname, Firstname. (2019b), Title 2. Springer, Berlin.

I know I have to edit the extra.label line in my .bst file somehow, but I cannot get it to work.

1

1 Answer 1

1

It should be enough to simply move the line extra.label * before the new added lines.

FUNCTION {format.date}
{ year duplicate$ empty$
    { "empty year in " cite$ * warning$
       pop$ "" }
    'skip$
  if$
  month empty$
    'skip$
    { month
      " " * swap$ *
    }
  if$
  extra.label *
  duplicate$ empty$
    'skip$
    { "(" swap$ * ")" * }
  if$
}

The complete file can be downloaded at https://gist.github.com/moewew/0b5992f6973bbc6af7d3c2cd5f0e297c (including an exact diff to plainnat.bst). It results in

Firstname Lastname. Title 1. Springer, Berlin, (2019a).//Firstname Lastname. Title 1. Springer, Berlin, (2019b).

when used in the MWE from the question.

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.