22

I am trying to adjust the bibliography style of natbib. There I am facing constructs like these:

FUNCTION {emphasize}
{ duplicate$ empty$
    { pop$ "" }
    { "\emph{" swap$ * "}" * }
  if$
}

Which language is it? I'd like to read about it to better understand it. Is there a manual? I found some documents, but none of them covered the concept in detail like the TeXbook does for TeX concepts.

9
  • 11
    The language has no name and, as far as I know, it's used only for programming bst files.
    – egreg
    Commented Feb 1, 2014 at 19:13
  • 2
    Have you seen e.g. tex.stackexchange.com/questions/107747/… and tex.stackexchange.com/questions/25007/…?
    – Joseph Wright
    Commented Feb 1, 2014 at 19:13
  • Okay; what would you suggest to better understand it? Is there any chance? I am trying to translate some parts to fit German citation styles (like "und" instead of "and", "Auflage" instead of edition" etc.). Is there an easier way?
    – Xiphias
    Commented Feb 1, 2014 at 19:14
  • 3
    texdoc tamethebeast is your friend. Here you can find it online.
    – egreg
    Commented Feb 1, 2014 at 19:16
  • 6
    It has no name, but it's Reverse Polish Notation, also used for decades with HP's awesome calculators. IIRC PostScript uses the same notation. Commented Feb 1, 2014 at 19:23

3 Answers 3

25

The BibTeX author mentions:

Here's how BibTeX works. It takes as input

  1. an .aux file produced by LaTeX on an earlier run;
  2. a .bst file (the style file), which specifies the general reference-list style and specifies how to format individual entries, and which is written by a style designer (called a wizard throughout this program) in a special-purpose language described in the BibTeX documentation - see the file btxdoc.tex; and
  3. .bib file(s) constituting a database of all reference-list entries the user might ever hope to use.

A "special-purpose language", as described in Designing BibTeX Styles, is a form of "postfix stack language":

Basically the style file is a program, written in an unnamed language, that tells BibTeX how to format the entries that will go in the reference list [..]. This programming language has ten commands [..]. These commands manipulate the language's objects: constants, variables, functions, the stack, and the entry list. (Warning: The terminology [..] chosen for ease of explanation, is slightly different from BibTeX's. For example [..] "variables" and "functions" are both "functions" to BibTeX. [..])

There are two types of functions: built-in ones that BibTeX provides [..] and ones you define using either the MACRO or FUNCTION command.

Your most time-consuming task, as a style designer, will be creating or modifying functions using the FUNCTION command [..].

Another interesting, related read would be Taming the BeaST, which attempts to provide the "B to X of BibTeX" - as complete a reference as possible.

bibtex itself is written in Web (similar to TeX). While we know it as an executable file, the original bibtex.web source is tangled into PASCAL code, and then compiled into a binary executable.

2

You can make your own BibTeX .bst files by running

latex makebst

which uses merlin.mbs, see here, to generate a .dbj (available here). LaTeX then compiles the .dbj file into a .bst. With this method, the command prompt will ask you a long list of questions to create the custom .bst.

An alternative is to generate .bst files by commenting/uncommenting the appropriate lines in a pre-existing .dbj file, e.g. from here, and then compile it using e.g.

latex imsi.dbj

Some example .bst files are also available on this github repo.

0

these cases helped me a lot. It's a simple modification in the .bst file. I had to change "and" to "&" and also modify the editor function had ", editor" in it and i changed it to "(Hrsg.)". I am using the natbib package with apalike bibliography style. It works fine for me.

Bibliography: natbib, apa-style and apacite

BibTeX: Apalike using & instead of and

Like they said, its easy to modify with TexShop or any text tool.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .
https://tex.stackexchange.com/questions/157045/in-which-programming-language-are-bst-bibtex-style-files-written
tex.stackexchange.com
CC-MAIN-2024-30
177320
application/http; msgtype=response
sha1:O2GOMSVG6YY3Y3ZKEYGILRNKJS3WM2S5
<urn:uuid:ef628729-5f23-4a19-831f-56a31e6f72d3>
2024-07-19T21:03:45Z
104.18.43.226
text/html
sha1:MUALNBLBDZRUKAHDMWAHBHFEZFRKRXMI
<urn:uuid:a0c01a7f-74d2-45b4-9819-bce6876139e0>
https://tex.stackexchange.com/questions/157045/in-which-programming-language-are-bst-bibtex-style-files-written
response
<urn:uuid:a12c7275-9e49-4f8b-bc8b-8fe87ac2ccd2>
isPartOf: CC-MAIN-2024-30
publisher: Common Crawl
description: Wide crawl of the web for July 2024
operator: Common Crawl Admin (info@commoncrawl.org)
hostname: ip-10-67-67-110
software: Apache Nutch 1.20 (modified, https://github.com/commoncrawl/nutch/)
robots: checked via crawler-commons 1.5-SNAPSHOT (https://github.com/crawler-commons/crawler-commons)
format: WARC File Format 1.1
conformsTo: https://iipc.github.io/warc-specifications/specifications/warc-format/warc-1.1/