![]() |
Compiling a bibliography | ![]() |
TeXmacs uses the BibTEX model for its bibliographies: the references are entries with a key (such as einstein1905), a type and fields, and the citations of a document are generated into a list of references in a chosen style. The references may come from a .bib file, from the bibliographic database of TeXmacs (see The bibliographic database), or from Zotero.
Insert\(\rightarrow\)Link\(\rightarrow\)Citation inserts a citation: Visible (shown as a reference to the bibliography), Invisible (the reference only enters the bibliography; an invisible citation of the key * puts all the references of the file there) or Detailed (with a precision, such as a page). When the document uses the package cite-author-year, the menu offers the citations by authors and years instead: abbreviated or full author lists, textual (“Einstein (1905)”) or parenthesized, and their parts.
Inside a citation, type the key of the reference. ⇥ completes it, with the keys of the .bib file of the bibliography (or of the database, when it is used) and those of Zotero. ⌃⇥, Focus\(\rightarrow\)Search references or the search icon of the focus bar open the window Search bibliographic reference: type words of the authors, of the title or a year, and click on a reference to cite it. A line at the top of the window names the sources which it searches, and each reference is marked with its source.
To cite TeXmacs itself, use Cite TeXmacs (in the focus menu of the citation, of the title or of the document): these references come with TeXmacs, and need no file.
At the place where the bibliography should be, use Insert\(\rightarrow\)Automatic\(\rightarrow\)Bibliography:
without the database tool, a file chooser asks for the .bib file of the references; the bibliography takes the style tm-plain;
with the database tool (Tools\(\rightarrow\)Database tool), the bibliography is inserted without file: its references come from the database (and from Zotero);
with New bibliography dialogue in the experimental features of Edit\(\rightarrow\)Preferences\(\rightarrow\)Other, a dialogue asks for the file (with a relative or an absolute path) and the style, and shows a preview of the bibliography; on an existing bibliography it modifies it.
The style and the file are the first two arguments of the bibliography tag, which can be changed afterwards (the focus bar proposes the styles). The file is written without its extension .bib, relative to the document; it is also searched in the directories which contain the document. When there is no such .bib file, a .bbl file of the same name, as produced by LaTeX, is used.
Then use Document\(\rightarrow\)Update\(\rightarrow\)Bibliography (or Document\(\rightarrow\)Update\(\rightarrow\)All) to generate the bibliography; do it again after adding citations.
The styles whose names start with tm- are implemented by TeXmacs itself, and need no other program: tm-plain, tm-abbrv, tm-alpha, tm-unsrt, tm-acm, tm-ieeetr, tm-siam, tm-elsart-num and tm-abstract (which also shows the abstracts). Any other name is a style of BibTEX (a .bst file), and the bibliography is then made by the bibtex program, which can be chosen in Edit\(\rightarrow\)Preferences\(\rightarrow\)Convert\(\rightarrow\)BibTeX. When bibtex is not installed, the standard styles plain, alpha, abbrv… are replaced by their tm- versions, and the other styles by tm-plain.
Additional BibTEX styles may be put in the directory ~/.TeXmacs/system/bib; a .bst file next to the document is copied there when it is used. When a style of BibTEX produces citations by authors and years (natbib), the package cite-author-year is added to the document.
A style whose name starts with csl- is a style of the Citation Style Language (CSL), the format of the styles of Zotero, Mendeley and Pandoc: csl-apa is formatted by the file apa.csl. TeXmacs processes these styles itself, from the same references as the other styles. A few styles come with TeXmacs, among which csl-apa, csl-ieee, csl-nature, csl-chicago-author-date, csl-chicago-notes-bibliography, csl-modern-language-association and csl-american-mathematical-society-label; they are listed in the dialogue of Insert\(\rightarrow\)Automatic\(\rightarrow\)Bibliography. Several thousands of other styles can be found at https://www.zotero.org/styles: put the .csl file next to your document or in the directory ~/.TeXmacs/csl/styles, and use its name without the suffix after csl-.
With such a style, the citations are also formatted by the style: as numbers, as authors and years, or as footnotes. Since a citation may depend on the other ones (two works of one author in the same year get the years 2001a and 2001b, the citations of one author are grouped), the citations are made together with the bibliography: after adding citations, update the document again. A citation which is not known yet shows its key or a provisional text. Besides cite and cite-detail, whose second argument may be a locator such as p. 12 or chap. 3, the following tags are understood: cite-textual for a citation which is part of the sentence, as in “Knuth (1984) shows”, cite-author for the authors alone and cite-year for the year alone. With a style which cites in footnotes, a citation inside a footnote of yours stays in that footnote.
The terms (“and”, “edited by”, the names of the months) are in the language of the style when it has one, and else in the language of the document.
A document with such a style is exported to LaTeX for the package citation-style-language, which formats the citations and the bibliography with the same style when LaTeX runs: its citations stay \cite, \textcite and \citeauthor commands, and the bibliography becomes \printbibliography. Next to the .tex file, the export writes the cited entries, in a file name-refs.bib, and a copy of the style. Such a file is compiled with lualatex, twice; with another engine, the program citeproc-lua has to be run between the two compilations, as BibTEX would be. The package is part of TeX Live.
BibTEX files can either be entered and edited using TeXmacs itself or using an external tool. Some external tools offer possibilities to search and retrieve bibliographic entries on the web, which can be a reason to prefer such tools from time to time. TeXmacs implements good converters for BibTEX files, so several editors can easily be used in conjunction.
The built-in editor for BibTEX files is automatically used for files with the .bib extension. New items can easily be added using Insert\(\rightarrow\)Database entry. When creating a new entry, required fields appear in dark blue, alternative fields in dark green and optional fields in light blue. The special field inside the header of your entry is the name of your entry, which will be used later for references to this entry. When editing a field, you may use ↩ to confirm it and jump to the next one (blank optional fields will automatically be removed when doing this). When the cursor is inside a bibliographic entry, additional fields may also be added using Focus\(\rightarrow\)Insert above and Focus\(\rightarrow\)Insert below.
BibTEX contains a few unnatural conventions for entering names of authors and managing capitalization inside titles. When editing BibTEX files using TeXmacs, these conventions are replaced by the following more user friendly conventions:
When entering authors (inside “Author” or “Editor” fields), use the name tag for specifying last names (using Insert\(\rightarrow\)Last name). For instance, “Albert Einstein” should be entered as “Albert Einstein” or as “A. Einstein”. Typing ↩ after “Albert Einstein” does it for you. The names are separated by typing a comma or “ and ” (or with Insert\(\rightarrow\)Extra name). Special particles such as “von” can be entered using Insert\(\rightarrow\)Particle or ⇧F5. Title suffixes such as “Jr.” can be entered similarly using Insert\(\rightarrow\)Title suffix or ⇧F7.
When entering titles, do not capitalize, except for the first character and names or concepts that always must be. For instance, use “Riemannian geometry” instead of “Riemannian Geometry” and “Differential Galois theory” instead of “Differential Galois Theory”.