2

I am extremely new to .bst-files and I'm trying to change some stuff in plainnat.bst to make my references look differently. The way \cite and \citep are right now are perfect and I don't want to affect that in any way by making wrong changes in the bst (if that is possible?). The references right now look like the following:

The way the references are right now

I've managed to make volume bold, move year, and add () to encompass year. What I want to change is:

  1. A space after ":" before the page numbering.

  2. Removing the "." after year for article and "," for book.

  3. Not print out all of the authors if there are more than three authors, end with et al. after three authors.

  4. No "and" before the last author just a "," like for the rest of the authors.

  5. No "." after the first letter of the author names, only for the last author before the year.

  6. Change "," to ";" after journal name.

I'm really lost and I've tried googling and found some answers, hence the changes already made, but I cannot figure out the rest. Thanks in advance!

EDIT (with minimum working example, I'm not sure this is what is asked for): Main document

\documentclass[11pt, titlepage]{book}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc} %remove comment before print 
\usepackage[nottoc,numbib]{tocbibind} %inputs bibliography in table of contents
\usepackage[round]{natbib}   % omit 'round' option if you prefer square brackets
\bibliographystyle{myplainnat3_2}
\begin{document}
\citep{Cyrys2012}
\bibliography{report}  
\end{document}

Bib file (example of one of the references, they are all presented the same by bst)

@article{Cyrys2012,
author = {Cyrys, Josef and Eeftens, Marloes and Heinrich, Joachim and Ampe, Christophe and Armengaud, Alexandre and Beelen, Rob and Bellander, Tom and Beregszaszi, Timea and Birk, Matthias and Cesaroni, Giulia and Cirach, Marta and de Hoogh, Kees and {De Nazelle}, Audrey and de Vocht, Frank and Declercq, Christophe and Dedele, Audrius and Dimakopoulou, Konstantina and Eriksen, Kirsten and Galassi, Claudia and Graulevi\v{c}iene, Regina and Grivas, Georgios and Gruzieva, Olena and Gustafsson, Annika Hagenbj{\"{o}}rk and Hoffmann, Barbara and Iakovides, Minas and Ineichen, Alex and Kr{\"{a}}mer, Ursula and Lanki, Timo and Lozano, Patricia and Madsen, Christian and Meliefste, Kees and Modig, Lars and M{\"{o}}lter, Anna and Mosler, Gioia and Nieuwenhuijsen, Mark and Nonnemacher, Michael and Oldenwening, Marieke and Peters, Annette and Pontet, Sabrina and Probst-Hensch, Nicole and Quass, Ulrich and Raaschou-Nielsen, Ole and Ranzi, Andrea and Sugiri, Dorothee and Stephanou, Euripides G. and Taimisto, Pekka and Tsai, Ming Yi and Vask{\"{o}}vi, \'{E}va and Villani, Simona and Wang, Meng and Brunekreef, Bert and Hoek, Gerard},
journal = {Atmospheric Environment},
keywords = {Air pollution,ESCAPE study,Long term,NO2,NOx,Spatial variation,Traffic},
number = {2},
pages = {374--390},
title = {{Variation of NO2 and NOx concentrations between and within 36 European study areas: Results from the ESCAPE study}},
volume = {62},
year = {2012}
}

A small snippet of the bst file

FUNCTION {article}
{ output.bibitem
format.authors "author" output.check
author format.key output
new.block
format.date "year" output.check
new.block
format.title "title" output.check
new.block
crossref missing$
{ journal emphasize "journal" output.check
  eid empty$
    { format.vol.num.pages output }
    { format.vol.num.eid output }
  if$
}
{ format.article.crossref output.nonnull
  eid empty$
    { format.pages output }
    { format.eid output }
  if$
}
if$
format.issn output
format.doi output
format.url output
new.block
note output
fin.entry
}

FUNCTION {book}
{ output.bibitem
author empty$
{ format.editors "author and editor" output.check
  editor format.key output
}
{ format.authors output.nonnull
  crossref missing$
    { "author and editor" editor either.or.check }
    'skip$
  if$
}  
if$
new.block
format.date "year" output.check 
format.btitle "title" output.check
crossref missing$
{ format.bvolume output
  new.block
  format.number.series output
  new.sentence
  publisher "publisher" output.check
  address output
}
{ new.block
  format.book.crossref output.nonnull
}
if$
format.edition output
format.isbn output
format.doi output
format.url output
new.block
note output
fin.entry
}
1
  • @CarLaTeX I think that I've managed to add an MWE/MWEB now.
    – mash
    Commented Jan 22, 2018 at 22:01

1 Answer 1

1

I'll start from the original plainnat.bst .

1: Remove the "\penalty0" after ":" in "FUNCTION {format.vol.num.pages}". This function will be:

FUNCTION {format.vol.num.pages}
{ volume field.or.null
  number empty$
    'skip$
    { "\penalty0 (" number * ")" * *
      volume empty$
        { "there's a number but no volume in " cite$ * warning$ }
        'skip$
      if$
    }
  if$
  pages empty$
    'skip$
    { duplicate$ empty$
        { pop$ format.pages }
        { ": " * pages n.dashify * }
      if$
    }
  if$
}

2: Every output in the middle of an entry writes a dot or comma after the previous item. Since nothing is wanted after the year, you can use a trick of manually setting the output.state to before.all. Then the FUNCTION {article} is like:

FUNCTION {article}
{ output.bibitem
  format.authors "author" output.check
  author format.key output
  new.block
  format.date "year" output.check
  before.all 'output.state :=
  format.title "title" output.check
  new.block
  crossref missing$
    { journal emphasize "journal" output.check
      before.all 'output.state :=
      "; " output
      before.all 'output.state :=
      eid empty$
        { format.vol.num.pages output }
        { format.vol.num.eid output }
      if$
    }
    { format.article.crossref output.nonnull
      eid empty$
        { format.pages output }
        { format.eid output }
      if$
    }
  if$
  format.issn output
  format.doi output
  format.url output
  new.block
  note output
  fin.entry
}

The modification of FUNCTION {book} is the same.

3--5: These require a lot of changes in FUNCTION {format.names}. I'll give the result directly as follows.

FUNCTION {format.names}
{ 's :=
  #1 'nameptr :=
  s num.names$ 'numnames :=
  numnames 'namesleft :=
    { namesleft #0 > }
    { s nameptr "{vv~}{ll}{ f{ }}{, jj}" format.name$ 't :=
      nameptr #1 >
        { namesleft #1 = t "others" = and
            { ", et~al." * }
            { ", " * t * }
          if$
          nameptr #3 = namesleft #1 > and
            { ", et~al." *
              #1 'namesleft :=
            }
            'skip$
          if$
        }
        't
      if$
      nameptr #1 + 'nameptr :=
      namesleft #1 - 'namesleft :=
    }
  while$
}

6: This is similar to 1, setting the output.state and writing the ";".

The whole modified bst file is at https://gist.github.com/zepinglee/31f2f01c267922af77bff9cbbf7f1a19 .

1
  • It's so beautiful, a million times thank you! It's for my thesis so I hope it's alright if I mention you in the Acknowledgements section? :)
    – mash
    Commented Jan 23, 2018 at 11:02

You must log in to answer this question.

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