This work has been partly supported by the French ANR-09-JCJC-0098-01 MaGiX project, and by the Digiteo 2009-36HD grant of the Région Ile-de-France.

GNU TeXmacs: a scientific editing platform

Joris van der Hoevenvdhoeven@lix.polytechnique.fr

1. Laboratoire d'informatique (CNRS, UMR 7161), École polytechnique, Palaiseau 91128, France.


Andrey GrozinA.G.Grozin@inp.nsk.su

2. Budker Institute of Nuclear Physics, Lavrentiev st. 11, Novosibirsk 630090, Russia.


Massimiliano Gubinellimassimiliano.gubinelli@ceremade.dauphine.fr

3. CEREMADE (CNRS, UMR 7534), Université Paris-Dauphine, Place du Maréchal De Lattre De Tassigny, Paris 75775, France.


Grégoire Lecerfgregoire.lecerf@lix.polytechnique.fr1

François Poulainfpoulain@metrodore.fr1

Denis Rauxdenis.raux@lix.polytechnique.fr1

Preliminary version of January 4, 2015


GNU TeXmacs is a free software for editing scientific documents, which can also be used as an interface for computer algebra systems. In this software demonstration we will briefly recall its main features and present some recent developments.

1Context, motivation, and objectives

GNU TeXmacs is a free wysiwyw (what you see is what you want) platform for editing scientific documents. Its development was initiated in the nineties by van der Hoeven and the latest version is available from http://www.texmacs.org. TeXmacs provides a unified and user friendly framework for editing structured documents with different types of content such as text, mathematics, computer algebra sessions, graphics, animations, hyperlinks, spreadsheets, etc. The rendering engine uses high-quality typesetting algorithms for the production of professionally looking documents, which can either be printed out or presented from a laptop. TeXmacs runs on all major Unix platforms, Mac OS X, and Windows.

Some parts of TeXmacs were originally inspired by TeX [4] and LaTeX [5]. However, contrary to other programs such as LyX [6] or Scientific WorkPlace [1], TeXmacs is not a graphical front-end for LaTeX, and an alternative rendering engine has been rewritten from scratch in C++. Besides an improved typesetting quality with respect to TeX, the rendering engine has the major advantage that documents are typeset in real time. This makes it possible to edit documents in a wysywig and user friendly way, without being distracted by compilation issues or encrypting formulas by LaTeX code.

Another objective of TeXmacs is to promote the development of free software for and by scientists, by significantly reducing the cost of producing documents, presentations, but also high quality user interfaces with other software. TeXmacs currently supports interfaces for many free computer algebra systems, such as FriCAS, Macaulay 2, Mathemagix, Maxima, Pari, Reduce, Sage, etc., for several other mathematical systems, such as Octave, Scilab, GNU R, Graphviz, TeXgraph, etc., and for certain versions of a few proprietary systems, such as Maple, Mathematica and MuPAD.

During the last years, TeXmacs has greatly evolved. Our current focus is on better portability to Mac OS X and Windows platforms and on making the user interface even more intuitive. In particular, the former X11 based graphical interface has recently been replaced by a modern looking interface relying on the Qt library, with platform dependent widgets and keyboard bindings. We are also working on better converters to other formats and more specific editing features for graphics, spreadsheets, presentations, etc.

Figure 1. Preparing a laptop presentation with TeXmacs.






Figure 2. Computation of successive derivatives in a spreadsheet using Mathemagix.

2Some features of the editor

Efficiency for typing scientific documents.
TeXmacs has been designed for typing structured texts with mathematical formulas in an efficient and easy to learn way. For instance, mathematical symbols such as (\rightsquigarrow) can be typed using a natural keyboard shortcut ~ >. There are also simple shortcuts for operating on the structure of the document, such as changing a theorem into a lemma.

Stylesheet language.
TeXmacs, like TeX/LaTeX, provides a stylesheet language in order to specify the rendering of markup elements in the document. TeXmacs provides a few standard files, as well as various packages which can be combined in order to design custom styles.

Extension language.
One major characteristic of TeXmacs is the possibility to extend the editor using the Guile-Scheme extension language. Such extensions can be simple, like a personal boot file with frequently used keyboard shortcuts, or more complex, like a plug-in with special editing routines for a particular type of documents.

Laptop presentations.
TeXmacs natively supports a full screen mode for laptop presentations (see Figure 1). Various interactive markup elements are provided for folding and unfolding, overlays, animations, dynamically executable computer algebra sessions, etc.

Vector graphics editor.
TeXmacs natively integrates a rudimentary tool for drawing simple two dimensional vector graphics, which may themselves contain other text or formulas. For instance, the picture in Figure 1 was drawn with this tool.

One big problem with TeX/LaTeX is that there is no well specified document format: documents are really programs in an exotic (hard to parse) programming language, which complicates conversions to other formats. Nevertheless, we put a lot of effort in the development of high quality converters. TeXmacs also provides converters for Html and MathML. For instance, the TeXmacs web site is automatically generated from TeXmacs documents. Converters for Word and Open Office are also planned.

Semantic editing.
Recent versions of TeXmacs implement mechanisms for giving at least a syntactic meaning to mathematical formulas. When editing, visual feedback is given to the user on how formulas are interpreted. A mathematical syntax corrector has also been integrated [2].

Mmx] use "graphix";
Mmx] $group ($width ("2ln", $graph (x :-> x * sin x)),
             $width ("2ln", $with ("dash-style", "10",
                                   $graph (x :-> x * cos x))))

Figure 3. Example of a Mathemagix session which draws the graphs of two functions. The resulting picture was further resized and annotated by the author from within the editor.

3Interfaces with computer algebra systems

We have already mentioned that TeXmacs can be interfaced to many external computer algebra systems and other software for scientific computations. Such external systems can be invoked in various ways:

  1. The most classical communication is based on shell-like sessions, in which it is possible to evaluate commands and display the results in a nice, graphical way.

  2. The external system can also be used as an aid for editing documents. For instance, one may use it to differentiate or simplify the current formula or the current selection.

  3. A recent new feature (under development) is a spreadsheet facility, where any computer algebra system can in principle be used as a spreadsheet language (see Figure 2).

Particular efforts are currently being put into the development of a good interface for the Mathemagix computer algebra system [3], which is free software available from http://www.mathemagix.org. TeXmacs documents can be created and manipulated directly from Mathemagix, which makes possible to automate the creation of sophisticated pictures and animations. For example, in Figure 3, we produced the graphs of two functions with different attributes via the graphix package of Mathemagix. These graphs are in fact native graphical TeXmacs objects, so that they can be easily modified and annotated. In addition they are automatically redrawn whenever the size or the origin of the graph is modified by the user.


[1] Scientific workplace version 5.5, 2012. http://www.mackichan.com.

[2] J. van der Hoeven. Towards semantic mathematical editing. Technical report, HAL, 2011. http://hal.archives-ouvertes.fr/hal-00569351.

[3] J. van der Hoeven, G. Lecerf, B. Mourain, Ph. Trébuchet, J. Berthomieu, D. Diatta, and A. Mantzaflaris. Mathemagix, the quest of modularity and efficiency for symbolic and certified numeric computation. ACM SIGSAM Communications in Computer Algebra, 177(3), 2011. In Section "ISSAC 2011 Software Demonstrations", edited by M. Stillman, p. 166–188.

[4] D. E. Knuth. The TeXbook. Addison-Wesley, 1984.

[5] L. Lamport. LaTeX, a document preparation system. Addison Wesley, 1994.

[6] The LyX Team. LyX 2.0.3 - The Document Processor [Computer software and manual], 2012. http://www.lyx.org.