5

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$
}
  • Welcome to TeX.sx! Your post was migrated here from another Stack Exchange site. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. – Marco Daniel Apr 22 '13 at 16:05
  • Please add a minimal working example (MWE) that illustrates your problem. It will be much easier for us to reproduce your situation and find out what the issue is when we see compilable code, starting with \documentclass{...} and ending with \end{document}. – Marco Daniel Apr 22 '13 at 16:05
7

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}
}
  • Thanks @Herbert. I managed to fix it using your help but I think it should be { ", in " language * } instead of { ", in German" * } in the bst file or with my style { "(in " language * ")" * } – Reza Apr 23 '13 at 1:49
  • @MohammadrezaJooyandeh: true, I thought you mean always German – user2478 Apr 23 '13 at 6:41

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.