Reledmac. Typesetting technology-independent critical editions with LaTeX

Reledmac, Maïeul Rouquette (ed.), 1987-2019. (Last Accessed: 21.07.2019). Reviewed by Andrew N. J. Dunning (Bodleian Library, University of Oxford), ||


Reledmac, an open-source package for the LaTeX typesetting system, offers a reliable method to arrange text on a page with multiple levels of scholarly apparatus and commentary. Its straightforward interface and wide availability has allowed its use in several projects aiming to visualize an edition encoded in TEI XML in a printed format.


1It is questionable whether anyone is happy with the traditional format of the critical printed edition. The critical apparatus was designed around the constraints of typesetting in the eighteenth century, and leaves much to be desired as a method of visualizing textual variation. Researchers rely daily on being able to search primary sources, but most public corpora are based on editions from the nineteenth century, since few series of critical editions make their texts openly available in digital form. Nonetheless, many academics view printed books as the most reasonable method of publishing critical editions in light of concerns over digital publications’ stability, readability, and authority. If we wish to encourage more scholars to start editing texts in ways that exploit the computing resources available to us, we need to provide ways to produce editions that give the best possible presentations of a text in both digital and print forms – editions that are designed for humans to read as well as our machines.

2There is not yet a reusable solution to editing texts in such a technology-independent form, but one of the key pieces in this puzzle has existed for decades: software for automatically typesetting texts with a scholarly apparatus. Maïeul Rouquette’s Reledmac, a package for the venerable LaTeX typesetting system, has emerged as a readily available program that, used correctly, can produce professional results. A non-comprehensive bibliography lists almost seventy publications that have used it with a multitude of languages, including contributions from leading scholars (Wujastyk and Rouquette 2013). Although the package’s gestation over more than three decades has resulted in some quirks, the wide support for LaTeX and its portability to nearly any system has made Reledmac’s adoption possible by several digital editing projects, showing its potential as a key piece of scholarly infrastructure.

Fig. 1: Toronto Medieval Latin Texts edition and commentary, typeset using Reledmac.

3 This review addresses Reledmac1 2.32.1, released 21 July 2019. It is based in part on my experience using it to typeset my own work encoded using the Text Encoding Initiative (TEI) guidelines. Reledmac’s greatest potential is as a mechanism for typesetting structured editions, but the TEI community has left this route underdeveloped and poorly documented. It remains less work to interact with the package directly if one’s primary goal is a short printed edition. I used Reledmac in this way when I typeset a student edition and commentary for the Toronto Medieval Latin Texts series (Robins 2019), which gave ample opportunity to explore its features. (Philippa M. W. Matheson had previously set my own edition in the series using plain TeX: Dunning 2016.) Robins wrote the edition in Microsoft Word, which I initially converted into LaTeX using Pandoc2 before making manual adjustments (MacFarlane; cf. Krewinkel and Winkler 2017). I encountered several minor bugs in the package over the course of this project, which Rouquette was kind enough to address. I also submitted minor improvements to the package via its GitHub repository. The options available in Reledmac facilitated improvements on several aspects of the series design (Fig. 1 shows the final result), accommodating practically any layout for a commentary or apparatus.

Reviving typography with TeX

4Reledmac is a mature tool with a long gestation; to understand its advantages, success, and idiosyncrasies, one needs to consider it within the development of the TeX typesetting system, which is sometimes called ‘plain TeX’ to distinguish it from the typesetting systems based on it such as LaTeX. Donald Knuth, a computer scientist and mathematician, first released this program in 1978 in reaction to the poor quality of early digitally typeset books (Knuth 1986 is his comprehensive guide). This program quickly became popular in academic circles, and is particularly respected for the Knuth-Plass line breaking algorithm (Knuth and Plass 1981), which composes text as a paragraph to minimize hyphenation and other typesetting problems. By contrast, standard word processors and Web browsers still compose text on a line-by-line basis, which produces a distinctly mechanical feel and reduces reading comprehension.

5Both medieval scribes and early printers aimed for evenness in what designers now call ‘type colour’, producing text blocks that look almost grey when one squints at them, without distracting gaps or abrupt combinations of heavy and light text. The industrialization of typesetting beginning in the nineteenth century gradually eroded this principle. The developers of phototypeset books, beginning in the 1950s, almost completely ignored it. This underlies much of the poor quality of a digitally produced book from the 1970s in comparison to its equivalent from earlier centuries.

6The celebrated typographer Hermann Zapf further advanced the state of automated typesetting with his Hz-program, introducing what is sometimes called ‘microtypography’. This software implemented the techniques of scribes and the first type compositors to produce consistent type colour by using narrower or wider versions of characters (Zapf 1993; Bringhurst 2013). This was far more laborious to produce in print than in manuscript, and quickly fell by the wayside, but this does not make the underlying concept less useful. It has been used for many recent books after Adobe Systems acquired Zapf’s software for integration in its page layout software, InDesign. The principles have also been implemented for TeX, and can be easily included in any document using the Microtype package (Schlicht 2004–2019). It is this approach to paragraph composition that allows the TeX family of software to produce such excellent results.

The LaTeX ecosystem

7Few people now use TeX directly, instead using a derivative such that facilitates a structured approach to typesetting. Leslie Lamport released LaTeX in 1983, abstracting much of TeX behind macros centred on the organization of a document. For example, it provides a \chapter{Chapter Title} command to begin a new book chapter. A team of volunteers continues to maintain this program. LaTeX works around the principle of a document class, which allows one to specify a module that provides a starting design for a typical type of publication, such as an article, book, or letter. Developers have produced a wide range of classes that cover various scenarios, as well as packages that add extra capabilities to other classes – Reledmac is one of these.

8These additions are both the greatest strength and weakness of LaTeX. Individual volunteers write most packages, which provide additional TeX programming that exists on the same level as LaTeX itself. They can produce unexpected results when combined. The creators of packages often cease to maintain them, and old packages are rarely pruned from CTAN, the standard repository for TeX-related software, leaving traps for users who might accidentally use one of these packages after finding an old reference to it. This situation has been remedied in part through the creation of KOMA-Script (Kohm 1994–2019) and Memoir (Wilson and Madsen 2001–2018), providing versatile and carefully conceived classes that eliminate the need for many packages and provide their own reference manuals covering most aspects of LaTeX. It is such packages, combined with the generous community of users that maintain online help forums, that has sustained LaTeX over so many years in spite of many shortcomings in its design.

9The final complication of using TeX is the series of different engines that can turn its files into a PDF: there are three different options, each with limitations. TeX predates both PDF files and the need to display formatted documents on a screen: it originally produced its own format to be fed into a printer. An engine emerged by the late 1990s for producing a PDF from a TeX file, called pdfTeX; but it cannot handle many Unicode characters or normal system fonts. XeTeX is the second engine typically used today, implementing Unicode and modern font technologies, but in a way that broke compatibility with earlier LaTeX packages (including Microtype). LuaTeX is gradually emerging as a replacement for both, maintaining compatibility with pdfTeX alongside the innovations of XeTeX. It has not yet caught on universally, however, because it is much slower than the other two engines. Some linguistic support available for XeTeX (especially for right-to-left languages) is not yet complete for LuaTeX. As a result, the seemingly simple operation of turning a LaTeX file into a PDF can be fraught with complications.

10An attempt to streamline this complex situation exists in ConTeXt, a more recent abstraction of TeX independent of LaTeX. In spite of its many improvements, it has yet to gain comparable traction because it lacks the ready-made classes and packages that allow one to quickly produce good results with LaTeX, as long as one is working within its paradigm. LaTeX is truly a reflection of humanity, showing the beauty that collective generosity can produce, but also the confusion that results from a lack of coordination.

Typesetting an edition with Reledmac

11It is within this web of packages and different interfaces for TeX that Reledmac exists, and its history defines both its strengths and limitations. Reledmac originates in Edmac (short for ‘editing macros’), which John Lavagnino (a Shakespearean and systems manager then at Brandeis University, now at King’s College London) and Dominik Wujastyk (a Sanskrit scholar, then at the Wellcome Institute for the History of Medicine, now at the University of Alberta) designed in 1987–89, developing it in their spare time to support their own editing work (Lavagnino and Wujastyk 1990; Wujastyk 1993). LaTeX had not yet become widespread, and they designed the package to interact directly with plain TeX without taking LaTeX functionality into account. Beginning in 1994, Peter Wilson (a specialist in information modelling) ported the package to LaTeX as a pure labour of love, renaming it Ledmac (Walden 2006). Wilson was responsible for a large number of LaTeX packages, leaving a maintenance gap on his retirement that took several people to fill (Robertson 2009).

12Maïeul Rouquette, a scholar of early Christianity at the University of Lausanne, took over Ledmac in 2011 when he was using it to write his doctoral thesis (Rouquette 2017), renaming it first Eledmac and then Reledmac, which allowed him to revise the interface and functionality without affecting projects that used older versions. He has since continued to improve the package’s functionality beyond the scope of his own research. Rouquette has also put significant energy into writing thorough documentation, alongside a general introduction to LaTeX for humanists that discusses Reledmac alongside Reledpar, its sister package for setting parallel texts (Rouquette 2012). The project’s GitHub repository lists fourteen other minor contributors. The culture of open-source software created out of goodwill for a practical end without explicit funding is typical for LaTeX packages. This haphazard model often produces useful results, but it is not clear that it is sustainable, especially as the employment of early-career researchers becomes increasingly unstable.

13The legacy of the original Edmac and the process of its transition to LaTeX remains evident in the package as it now exists. Wilson had only the goal of making the package functional, and did not rewrite it to use the logic of LaTeX. As a result, the package must emulate the functionality of many basic LaTeX macros such as headings and block quotations rather than use them directly, and they often do not behave in the way one expects. For instance, although KOMA-Script and Wilson’s own Memoir class include environments for setting verse, they give unexpected results in Reledmac, and one instead needs to use its internal mechanism. One needs to treat Reledmac almost as a separate system from LaTeX, and the package would need to be rewritten to resolve this situation. The Ednotes package began this effort (Lück 2003), but it never reached equal functionality and development ceased in 2006. This situation is not the fault of the package’s authors, but it increases the challenge of converting text for typesetting in LaTeX with Reledmac, as well as the learning curve.

Fig. 2: A simple Reledmac document.

14 Once one understands Reledmac’s limitations, and its methodological focus on visualizing textual variants using traditional mechanisms developed for print, its interface is nearly as simple as one can achieve. A critical edition involves a complex dataset, and the LaTeX format imposes further constraints similar to those of the XML format underlying TEI. The software works from encoding for critical notes that focuses on typography rather than semantics, running its own TeX code to arrange notes and line numbers according to LaTeX’s positioning of the text. This is a basic document with critical notes (see also Fig. 2):

\documentclass{scrbook} % KOMA-Script book class
\usepackage{microtype} % improves justification
\usepackage[pdfusetitle,hidelinks]{hyperref} % adds links from apparatus to text
\usepackage[series={A,B}]{reledmac} % enables two levels of apparatus
\title{Sample Edition}
\author{Andrew Dunning}
\begin{document} % begin LaTeX document
Introductory text.
% text outside \beginnumbering … \endnumbering works as normal LaTeX
\beginnumbering % begins Reledmac numbered section
\pstart % begin a paragraph in Reledmac; or use the \autopar command
This is a \edtext{test}{\Afootnote{experimental \emph{L}}}
\edtext{sentence}{\Bfootnote{Introduced to English via Old French
from Latin \emph{sententia} 'opinion'.}}.
\pend % end a paragraph in Reledmac
\endnumbering % end Reledmac numbered section
\end{document} % end LaTeX document

Example 1

15Files using Reledmac can be rendered using any LaTeX engine. It results in slightly longer compilation times than normal, because it needs to generate extra temporary files. The example above enables two series of critical notes with Reledmac. (One can instead use standard numbered footnotes or endnotes.) The \edtext{text}{commands} command marks a word or phrase for comment; one can add as many commands as necessary in the second set of braces for a critical apparatus, source apparatus, or whatever else the edition requires. One can have multiple notes on the same word using \Afootnote, \Bfootnote, and so forth.

Fig. 3: Usage of the \lemma command.

16 Reledmac demonstrates a few minor shortcomings in facilitating features of high-quality editions, though there are usually ways to achieve the desired results by hand. When making a note on a long passage, most editors will refer only to its first and last words. In Reledmac, this requires the \lemma command to truncate the text (see also Fig. 3):

\edtext{Arma uirumque cano}{\lemma{arma … cano}
\Bfootnote{The opening line of Virgil, \emph{Aeneid.}}}

Example 2

17This must be done by hand for every note that does not quote the full lemma. In some cases, this is advantageous. For commentaries in particular, the ability to write one’s own lemma to focus on the precise passage in question is a great help. On the other hand, it would be a great service if Reledmac could borrow Classical Text Editor’s options for setting document-wide styles to automatically process lemmata by truncating a phrase to the first and last words; removing punctuation and other specified characters; making the text lowercase; and transliterating text as appropriate, for example from V to u in Latin. Similarly, it would be useful to have an option to abbreviate number ranges automatically (e.g. changing ‘107–108’ to ‘107–8’). These, however, are among the few obvious examples of missing functionality in the package.

Fig. 4: Example of automatic cross references.

18 Reledmac also includes a powerful cross referencing system, allowing one to add references to page and line numbers and have them remain accurate through any changes to the document (see also Fig. 4):

% Add labels to cross references
\setapprefprefixsingle{line }
\setapprefprefixmore{lines }
\setSErefprefixsingle{line }
\setSErefprefixmore{lines }
\title{Sample Edition}
\author{Andrew Dunning}
Introductory text: see \SEref{sentence} and note to \appref{test}.
\edlabelS{sentence}This is a \edtext{test}{\applabel{test}
\Afootnote{experimental \emph{L}}} \edtext{sentence}{\Bfootnote{Introduced to English via Old French from Latin \emph{sententia} `opinion'.}}.\edlabelE{sentence}

Example 3

19Reledmac has several commands for creating cross references, but most users will only need two. The \SEref{label} command allows one to refer to a range of text between \edlabelS{label} and \edlabelE{label} (or \edlabelSE{label} for a single point in the text). The \appref{label} allows one to refer to the lines to which a critical note labelled with \applabel{label} refers.

Using Reledmac with TEI

20LaTeX syntax is less verbose than XML, and I have known several colleagues who have found it initially much easier to understand than TEI. Over the long term, however, writing an edition in TEI rather than directly in LaTeX is more sustainable, even if it is intended purely for print publication. From a practical perspective, XML validation allows one to find errors more quickly: a missing bracket can cause LaTeX to fall over itself in reporting obtuse error messages through its logs, which themselves are more difficult to read than necessary. Reledmac is focused purely on typesetting, making it difficult to develop mechanical checks for one’s editorial work. TEI’s focus on semantic markup is highly useful in this respect, and a number of researchers have taken advantage of this on a project-level basis. It is crucial that the TEI community seize this opportunity if it wishes to be viewed as a serious publishing option.

21There are a number of scripts available for typesetting TEI editions with LaTeX and Reledmac, most of them developed to fit the needs of specific projects. The earliest of these is part of the TEI Consortium’s official stylesheets (Rahtz et al. 2011–2019). These stylesheets do not render text following any scholarly convention for a printed critical edition, and are complex to modify. As a result, implementations for individual projects are usually written from scratch (e.g. Witt 2018; Camps 2017; McLean 2015–2016). None yet offer a general-purpose tool that renders TEI elements into the form one would normally expect for printed editions of premodern texts.

Fig. 5: TEI Critical Apparatus Toolbox.

22 Marjorie Burghart’s TEI Critical Apparatus Toolbox3 (see Fig. 5) is an especially promising use of an automated typesetting tool as one of several elements for supporting the creation of editions (Burghart 2016). This web application provides tools for finding common errors in a critical apparatus (such as an unaccounted source), extracting the text of a particular witness, finding statistics on a document, and turning a standard TEI critical apparatus into a PDF using Reledmac. It provides an interface for most of Reledmac’s options, making them much easier to find than by sorting through its manual. Although it is not yet finished, this is an excellent demonstration of the role both TEI and Reledmac could play in developing a solution for creating any type of edition, and not merely one geared to a particular format.

23Such attempts are achievable because of the wide support for integrating LaTeX into other environments and its portability. Any full LaTeX distribution4 includes Reledmac, ranging from versions for every common platform to editions that work inside a browser such as Overleaf5. Rouquette has made a concentrated effort to document the package’s options, alongside his introductory book to LaTeX. There is also an active community of users that provide support for one another in the Reledmac section on TeX Stack Exchange6. The plethora of online tutorials for LaTeX and the wide availability of the software, including on mobile platforms, makes it much easier to gain usable results from it than from TEI if one is working independently.

24At the same time, LaTeX has a number of oddities that can make transformation from XML somewhat complex. For example, there is no standard mechanism for changing the language, as there are two mutually incompatible packages for achieving this (Babel7 and Polyglossia8). Reledmac also poses its own difficulties. For the historical reasons noted above, it is necessary to encode text (including headings and paragraphs) slightly differently from normal LaTeX. It also cannot automatically index identical words in a single line. In a critical apparatus, if one has two instances of ‘et’ in a single line, one would refer to them as ‘et1’ and ‘et2’. An extra script can mostly remedy this, but there remain some situations in which it must be checked by hand (Christensen 2018). In short, LaTeX is not the solution we would create today if we were developing it again from scratch – but it is the one we have, and it can produce excellent results when used carefully.

Future directions

25Given this history of software cobbled together by a series of programmers, humanists, and non-specialists in spare time over three decades, it is a small miracle that LaTeX with Reledmac is not merely functional but has become the most reliable method of automatic typesetting for critical editions. It is to be hoped that one day the editing community will band together to give the project more support and ensure its sustainability, for it is clear that Rouquette could create a much more functional package if he had the time, resources, and desire to redesign it from the ground up. Both using the package directly and typesetting critical editions from TEI XML would be much more straightforward with a package designed from the outset to work with LaTeX. Alternatively, there might be more promise in creating a critical editing module for ConTeXt, a rationalized competitor to LaTeX that has a focus on typesetting XML directly without the need to first transform it into a different markup language. There have been some forays down this path (Hamid 2007), but nothing has yet seen the light of day.

26In the small field of software for critical editing, Reledmac fills a helpful niche alongside the more complex TUSTEP (Ott 1979; Schälkle and Ott 2018) and the commercial Classical Text Editor (Hagel 2007), focusing on providing a key element of a publishing workflow rather than an all-encompassing editing environment. Its interface is as user-friendly as one can achieve in LaTeX code; its clear documentation and examples mean that one can reasonably expect to learn it oneself; and it can produce documents of the highest quality. One can hardly ask for more, and our community is indebted to Rouquette and his predecessors for putting so much of their energy into the basic digital infrastructure for the humanities that often goes unacknowledged.