[Tex/LaTex] Adding condition into BibTex .bst file

bibtex

I am trying to edit a bibliography style file (bst) such that
it only prints the language part if the item is not in English.
For example I want to have "(in German)"
if the item is not English but
I do not have any idea how to modify this part to achieve it:

FUNCTION {format.language}
{ language "language" bibinfo.check
  duplicate$ empty$ 'skip$
  {
     new.block
     "(in " swap$ * ")" *
  } if$
}

Best Answer

you need an entry language in the list of entries (at the beginning of the bst-file) and then:

FUNCTION {format.language}
{ language empty$
    { "" }
    { "English" language = % 0 is on stack if _not_ english
      { }
      { ", in German" * }
      if$
    }
  if$
}

If your style file has no entries for the language then you have to add something like:

FUNCTION {book}
{ output.bibitem
  author empty$

[...]

  format.date "year" output.check
  new.block
  format.language
  new.block
  note output
  fin.entry
}

My example output looks like

enter image description here

with the following bib data:

@BOOK{Kern2009_01,
  title = {Entwicklung haptischer Geräte},
  publisher = {Springer},
  year = {2009},
  language = {English},
  editor = {Thorsten A. Kern},
  isbn = {978-3540876434},
  doi = {10.1007/978-3-540-87644-1},
  keywords = {key:Haptik,key:Technik,key:PDF},
  subtitle = {Ein Einstieg für Ingenieure}
}

@BOOK{Wilcox2005,
  title = {Introduciton to robust estimation and hypothesis testing},
  publisher = {Elsevie},
  year = {2005},
  author = {Wilcox, R. R.},
  language={German},
  address = {Burlington, MA},
  edition = {2}
}
Related Question