Bibtex4Word - Reference Information

Contents: Magic Characters - Bookmarks - Encoding BibTeX Keys - Citation Entries - Environment Variables - Document Properties - Toolbar - Debugging

Magic Characters

Bibtex4Word uses two magic characters: "@" for searching and "/" to indicate style flags. You can change these to any two non-alphanumeric characters by listing them after the default style in the BIBSTYLE environment variable, e.g. BIBSTYLE=alpha$n :$. Note that, as in this example, changing the "/" character has an immediate effect and you must use the new character if you specify any default flags in BIBSTYLE. If you change the characters you should avoid characters that appear within BibTeX style names or BibTeX keys in your database.


For each entry in the bibliography, two bookmarks are created: BIB_xxxx and B4B_xxxx where xxxx is the bibtex key name (encoded as described below). The first of these bookmarks refers to the label of the bibliography entry excluding any enclosing brackets; the second bookmark just refers to the start of the label without including its text.

Bibtex Key Encoding

The bookmarks corresponding to a particular publication are of the form BIB_xxxx and B4B_xxxx where xxxx is normally the bibtex key name. However, if the bibtex key contains any non-alphanumeric characters, these are encoded as _hh where hh is the corresponding hexadecimal character code. This ensures that the bookmark names contain only legal characters.

Citation Entries

A normal citation entry consists of a sequence of bookmark references of the form BIB_xxxx separated by commas and enclosed in square brackets. Non-citing references are always at the start of the list and use the alternate bookmarks B4B_xxxx which do not include the label text and are therefore invisible. If the "compress" style flag, , is selected, the intermediate values in a compressed sequence also use this alternate form.

Environment Variables

You can define the default behaviour of Bibtex4Word by specifying some or all of the following environment variables. To do so, use Start>>Settings>>Control Panel>> System>>Advanced>>Enviromental Variables>>User Variables>>New.

Defines the default bibtex database (e.g. BIBFILE=C:\data\file.bib)
Defines the default bibtex style, style flags and magic characters (e.g. BIBSTYLE=plainnat/ndu :$). The magic characters should normally be left at their default values (:/) and only need be changed if you use these characters in your bibtex keys.
Defines the bibtex executable program (e.g. BIBEXE=C:\Program Files\MiKTeX 2.8\miktex\bin\bibtex.exe). This overrides the "+" style flag.
Defines the folder that Bibtex4Word will use for temporary file (e.g. BIBTEMP=C:\xxx\dirname). It is not normally necessary to set this explicitly.

Document Properties

Document-specific information is stored within the word document as custom properties and can be seen by selecting File>>Properties>> Custom.

BIBFILE Defines the bibtex database (e.g. BIBFILE=C:\data\file.bib) BIBSTYLE Defines the default bibtex style and style flags (e.g. BIBSTYLE=plainnat/ndu). The magic characters are computer-specific and are never stored in the Word document. BIBDISP Has the value ref or key according to the display mode selected by the button.


Insert one or more comma-separated citations. Search the database using keywords.
 The first time you press this, a bibliography is inserted at the cursor position. Subsequently, pressing this button will update the bibliography regardless of where the cursor is.
Toggles the display of citations within the text between their labels (e.g. [1], [2] etc) and their BibTex keys. When the file is printed (or whenever fields are updated) then the entries will revert to their labels.
Allows you to select the bibtex style in the form style/flags that should be used to generate the bibliography. The style name is not case sensitive.

Special style entries:
//b - opens the bibtex database
//t - opens the four temporary files that Bibtex4Word uses to store intermediate data. This can be useful for figuring out why things are not working as expected.

Allows you to select the BibTex database that should be searched for references. At present you are not allowed to use multiple databases.
Creates a new BibTex database file containing only the entries that are cited in the current document.


Although installing into the STARTUP folder (step 5 of the installation procedure above) is convenient, it makes the code invisible and impossible to debug. If you want access to the code, you need instead to install into your templates folder and using it as a template for a new document. You can find or change this folder by starting Word and selecting: [Word 2003]:Tools>Options>File Locations or [Word 2007]:Office Button>Word Options>Advanced>File Locations (at bottom of page).

BibTex4Word creates four temporary files in the folder defined by the TEMP environment variable (typically F:\Documents and Settings\*\Local Settings\Temp). If Bibtex4Word does not function as you expect, inspecting these files is the best way to find out why. The easiest way to view the files is to enter the special style “/t” which will open the four files using notepad. The files have the following fixed names and will be overwritten each time the bibliography is updated:

This file is created by Bibtex4Word and gives information about the actions it has taken.
This file is created by Bibtex4Word when you press and forms the input to the BibTeX program. It tells BibTeX which style to use and lists all the citations in your document.
BibTeX creates this file which gives the contents of teh bibliography in LaTeX format. Bibtex4Word reads this file, interprets the LaTeX commands it contains and uses this information to write the bibliography. Some styles may use commands that Bibtex4Word cannot interpret; when this happens, the command will be ignored but a message will be written in bibtex4word.log. This is the most likely cause of incorrect formatting in the bibliography.
 BibTeX creates this file which includes any error messages that occurred when BibTeX executed.

This page is part of the Bibtex4Word documentation. Copyright © 2006-2013 Mike Brookes, Imperial College, London, UK. See the file gfl.html for copying instructions. Please send any comments or suggestions to "mike.brookes" at "".
Updated: $Id: b4w_reference.html 2836 2013-03-23 09:53:32Z dmb $