1

I already made a few changes to the original AEA bibliographystyle code. Now I want the year of publication after the authors in brackets. What should I change? This is my Latex-file:

\documentclass{article}
\usepackage{natbib}

\begin{document}

\section{Test}

Here is an example to cite \citet{abeler2010gift} in text.

\pagebreak
\addcontentsline{toc}{section}{References}
\bibliographystyle{aea}
\bibliography{paper}
\nocite{*}


\end{document}

The references are generated with Jabref and saved in a separate bibliography file (paper) and are formatted like this:

@Article{abeler2010gift,
  author    = {Abeler, Johannes and Altmann, Steffen and Kube, Sebastian and Wibral, Matthias},
  title     = {Gift exchange and workers' fairness concerns: When equality is unfair},
  year      = {2010},
  volume    = {8},
  number    = {6},
  pages     = {1299--1324},
  journal   = {Journal of the European Economic Association},
  publisher = {Wiley Online Library},
}

The bibliography style is a modified version of the American Economic Review - Style (AEA). I uploaded the file here: https://www.file-upload.net/download-12626400/aea.bst.html

  • 1
    Welcome to TeX.SX! Please don't show only a code snippet of a bst file. To give good answers it is important to have a minimal but working example with bibliography (MWEB) not only to reproduce the problem but also to test our suggestions. And we need as much information as possible what is wrong with the example and what should be different. So please help us to help you. – Schweinebacke Jul 26 '17 at 8:04
  • 1
    Off-Topic: Is there a reason not to use biblatex + biber. It can be configured without bst hacking and has several other advantages. – Schweinebacke Jul 26 '17 at 8:06
  • 1
    I want you to post a MWEB. See the links in my comment for more information. – Schweinebacke Jul 26 '17 at 8:29
  • 1
    Once again: Would answers using biblatex + biber instead ob bibtex + natbib-file also be welcome? – Schweinebacke Jul 26 '17 at 9:45
  • 1
    @robinho Do you want all your 'years' to be typeset with brackets, or only the ones for article? (What about book, incollection, inbook etc.?) – Troy Jul 26 '17 at 15:54
1

You can achieve the desired effect by modifying the .bst file, with a small caveat as pointed out by the 'comments' in the aea.bst file:

Copying of this file is authorized only if either
     (1) you make absolutely no changes to your copy, including name, or
     (2) if you do make changes, you name it something other than
     btxbst.doc, plain.bst, unsrt.bst, alpha.bst, abbrv.bst, agsm.bst,
     dcu.bst, cje.bst, aer.bst, or kluwer.bst.
     This restriction helps ensure that all standard styles are identical.

If you make the changes as I show below, please save it as a new .bst file and name it something else, like robinho.bst perhaps.


  1. In the .bst file, find (Ctrl+F) the FUNCTION {output.month.year} entry. This controls the formatting of the month and year output. So to add the desired brackets (note that this will change all of the formatting of the year field to include brackets), replace

    FUNCTION {output.month.year}
      {
          space month plain.space.output
          space year plain.comma "year" output.check
      }
    

    with

    FUNCTION {output.month.year}
      {
          space month plain.space.output
          space "(" year * ")" * plain.comma "year" output.check
      }
    
  2. To influence the location of the year field, go ahead and find (Ctrl+F) in the .bst file, FUNCTION {article}. Replace

    FUNCTION {article}
    { output.bibitem
      author.item.check
      format.title.if.not.sortkey.check
      crossref missing$
        { space journal italic comma "journal" output.check
          output.month.year
          output.vol.num.pages
        }
        { space format.article.crossref plain.space output.nonnull
          comma format.pages plain.space.output
        }
      if$
      fin.entry
    }
    

    with

    FUNCTION {article}
    { output.bibitem
      author.item.check
      output.month.year
      format.title.if.not.sortkey.check
      crossref missing$
        { space journal italic comma "journal" output.check
          output.vol.num.pages
        }
        { space format.article.crossref plain.space output.nonnull
          comma format.pages plain.space.output
        }
      if$
      fin.entry
    }
    
  3. Save as robinho.bst. (Do so, for the reasons I mentioned at the beginning of this answer.)

Then consider the following MWEB:

\begin{filecontents*}{\jobname.bib}
    @Article{abeler2010gift,
        author    = {Abeler, Johannes and Altmann, Steffen and Kube, Sebastian and Wibral, Matthias},
        title     = {Gift exchange and workers' fairness concerns: When equality is unfair},
        year      = {2010},
        volume    = {8},
        number    = {6},
        pages     = {1299--1324},
        journal   = {Journal of the European Economic Association},
        publisher = {Wiley Online Library},
    }
\end{filecontents*}

\documentclass{article}
\usepackage{natbib}
\usepackage{filecontents}

\begin{document}
    \section{Test}

    Here is an example to cite \citet{abeler2010gift} in text.

    \bibliographystyle{robinho}% <-----------
    \bibliography{\jobname}% <-----------
%   \nocite{*}

\end{document}

which gives the output:

enter image description here

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.