TeXmacs is a technical writing system for use by scientists and engineers. TeXmacs is a reimplementation of Donald Knuth’s TeX document preparation system that offers a unique advantage, the ability to embed interpreted computing language sessions using tools like Octave, Python, Maxima, etc. To learn more about using TeXmacs in a MacOS environment, read on.
Revisions
- 2021-10-21 Original
- 2021-10-23 Revised introduction to clearly indicate that TexMacs is a direct rendering reimplementation of TeX as opposed to a visual tool like LyX for editing TeX documents and then run the TeX tool chain to produce finished output. TeXmacs represents the document in Scheme or XML rather than TeX language.
References
- http://texmacs.org/tmweb/home/welcome.en.html
- https://www.fsf.org/
- https://maxima.sourceforge.io/
- https://open.umn.edu/opentextbooks/textbooks/557
- https://www.python.org/
TeX and TeXmacs Origins
TeXmacs is an engineering and science writing tool that is sort of what you see is what you get. TeXmacs is a reimplementation in Scheme and C++ of Donald Knuth’s TeX typesetting model designed to permit direct interactive creation of the document in a what you see is what you get fashion. TeXmacs saves the document using Scheme lisp and can produce an XML equivalent. TeXmacs can produce Postscript and PDF representations of the document allowing use of the macOS imaging system to view and print the finished document.
Using the original TeX system required you to encode your document using either TeX primitives or descriptive markup tags from a macro package such as LaTeX. To proofread your work, you needed to run the TeX typesetting and printing back end subsystems. Although TeX was quite capable, it was designed and implemented before high performance graphics workstations were available.
In the opening of the century, high performance workstations were commonplace and the personal computer had gained enough performance and graphical capability to do typesetting so a group of maths and programming boffins decided to develop a graphical direct rendering version of TeX that permitted direct entry of the document and rendered it on the fly. TeXmacs is unique in this regard. TeXmacs is also unique in that it has a session model that lets it run various external mathematical applications that accept input from standard input and write output to standard output. TeXmacs is able to capture the output and present it in line. This permits the use of Maxima, Octave, Python, R, Scilab, etc to produce compound documents containing a mix of natural language descriptive material and mathematical programming.
TeX math markup is descriptive allowing it to represent the semantics of a mathematical expression. TeX or TeXmacs can typeset the expression but it can also pass off the expression to a computer algebra system for evaluation and present the returned result.
While working, I used TexMacs and Octave to model the network traffic resulting from execution of a problem in one of the Navy’s combat interaction simulators. To design the simulation system network, we needed to figure out how much simulation traffic was going where. A series of formulae could represent the entity population and the entity update and interaction rates. Expressing these as Octave statements in the report, a reader could review the model and calculations and we knew the computed results shown matched the model because they were both together in the paper.
Installing TeXmacs
TeXmacs is licensed under the GNU Public License and may be distributed as specified in the GPL. Obtain TeXmacs directly from the project or from the Free Software Foundation. The project maintains recent builds for Windows and MacOS. The MacOS version is built as a Intel app containing all of the required libraries not part of the MacOS distribution. No package hunts.
TeXmacs is packaged as a MacOS app. Just drag the app icon to Applications. The developers may not have bothered with Apple signing protocol (that is, they used the GNU tool chain rather than Xcode tools) so you’ll need to command click to authorize running of an unsigned App on the initial startup. MacOS will remember this authorization.
The current version is compiled as a MacOS Intel binary but Rosetta2 makes quick work of it on Apple M1 Macs.
Additional interpreters
Computer algebra interpreters are extra. Python and a selection of shells come with MacOS. Maxima and Octave require installation from disk images available at the links in the references. Python packages Numpy, Scipy, etc will also need downloading as described at Python.Org. Use the Python package manager to ensure these are put in the proper location.
Driving TeXmacs
TeXmacs is designed to save the author the labor of learning one of the TeX macro packages such as AMSTeX and using it to code the document layout. TeXmacs uses menus and keystroke sequences to directly create text objects in context. A SCHEME lisp object represents each text object. It is the SCHEME representation that is saved.
First, select an article style. Then begin inserting elements using the insert menu. TeXmacs has a menu bar, a primary tool bar that lets you insert lists, figures, links, and change typefaces, insert a formula inline, insert a block of formulae, or switch to maths mode.
TeXmacs documents can use one of several styles. This one is an article. As you build up the document, you insert elements into it. Here we are looking at a subsection object that contains a paragraph object and the start of a Python session that will calculate all of the materials to be used to build a small stair landing pad. The first figure shows the block size calculation. The next figure shows the pad shape and calculates the number of blocks needed.
Yes, I could have used Numbers app or LibreOffice to do this calculation. But they are really hard to verify. The math is hidden in the cells and references are to cell coordinates.
TeXmacs lets you write out the formulae in the interpreted language of your choice, set the values, and see the calculation printing key intermediate values and the results.
Too Much Work for a Dinky Project?
This may seem like a lot of work for a dinky project. Just scribble it all out on the back of save the bay solicitation. Well, then do it again because Lowes had only part of the supplies needed in stock locally. Recalculate using things Homer has locally. The second time around is trivial. Just change the block size and turn the crank.
Printing on MacOS
To see the printed representation of a TeXmacs document, export it to PDF on the desktop. Use Preview to view the PDF or print it. This saves dragging Ghostscript and Ghostprint to target systems. This technique is not well documented in any of the online stuff. I discovered it while poking around in the configuration guidance.
TeXmacs Sessions
TeXmacs, unique among TeX implementations, has the ability to interleave session objects with TeXmacs text. A session remains open until you exit the interpreter. This allows you to break up the calculations into parts embedded with the description of what it is you are trying to do. In effect, the document combines a project’s descriptive material and computational material.
TeXmacs can start and feed commands to any command line interpreter such as Python, Scheme, Octave, Maxima, R, a graphing tools, etc. It captures the standard output and standard error inserting the text into the document. Python sessions may load modules such as Numpy, Scipy, and plotting packages. Basically, it can run any package that has a shell interface.
You must be logged in to post a comment.