Emacs carnival: Writing experience

I am writing this blog entry, in org mode in Emacs, to describe some aspects related to my usual writing experience, specifically why I use org mode and Emacs. This entry is for the Emacs Carnival for July 2025.

Much of my writing, and particularly the writing that I enjoy, involves writing prose for journal and conference articles. My most recently published journal article (Fraga et al. 2025), for instance, was written entirely in org mode. Org mode and Emacs provide a number of capabilities that make writing such articles easy and, I must admit, enjoyable. These include the following:

There are others, in fact an almost innumerable set of little tools and features of Emacs, that contribute to the writing experience but I will just illustrate the ones listed above for this blog post.

Code and prose

A significant part of writing technical articles includes the generation and presentation of figures. These may be images but will also include diagrams and graphs. An example is the following plantuml code:

@startuml

start

:initialize;
repeat :do something;
repeat while (finished?) is (no)
->yes;

stop

@enduml

which results in the following diagram:

emacs-writing-experience-plantuml.png

The directive in org mode to start a src block for that plantuml code is:

#+begin_src plantuml :exports both :file images/emacs-writing-experience-plantuml.png

The greatest benefit of being able to mix code and prose is that everything is in one place. This makes sharing, for instance for collaboration, much easier. It also enables access to data elsewhere in the document, data that are often represented in tables, as we shall see in the next section.

Org mode tables

Tables in org mode can be thought of simply tables. However, their superpower, in my opinion, is that the full capabilities of Emacs Calc.1 Further, src blocks, as mentioned above, can reference data in tables.

So, for instance, consider the following table:

i x
1 0.92538387
2 0.079673122
3 0.57200777
4 0.78724941
5 0.48947977
6 0.59593461
7 0.70920302
8 0.38309949
9 0.61036809
10 0.42366906
average 0.558
std dev 0.235

The second column entries in the last two rows have been calculated by org mode using the Emacs Calc functions vmean and vsdev.2 The table format line that specifies how the entries are calculated looks like this:

#+TBLFM: @12$2=vmean(@I..@II);f3::@13$2=vsdev(@I..@II);f3

These data can now be used in other ways directly. For instance, we can generate an x-y scatter plot of the data using gnuplot:

reset
set xrange [0:11]
plot data with points pt 7 ps 2 title 'Table data'

emacs-writing-gnuplot-example.png

where the #+begin_src line for gnuplot includes the specification

:var data=exampletable[1:-2,]

assuming that the table above has been given the name exampletable. This directive associates data in gnuplot with the table and we've asked that the lines of the table to include are the second through to the third last (org uses 0 based indexing for the table) to avoid problems with the headings and the statistics entries. Both columns are passed to gnuplot.

Abbreviations

A feature of Emacs that applies to all text modes, including org mode, is the ability to define abbreviations. In technical writing (and more generally as well of course), we would like to minimise the amount of typing required. For long words, e.g. one that I use a lot is distillation, I can tell Emacs that when I type dl (followed by a non-word character, e.g. space or full stop), it should expand this to distillation. This feature might sound somewhat trivial when compared with the above features I've highlighted but it makes an incredible difference to me.

Summary

Although I do not intend to itemise all the other aspects of Emacs that I depend on when writing prose, I will say that the biggest strength of Emacs is its malleability: everything in Emacs can be adapted to your own requirements, whether by using built-in features of Emacs, adding packages from ELPA and MELPA (or elsewhere), or by actually modifying the code of Emacs itself as it's all there and accessible. Over time, Emacs adapts to your needs and desires instead of the other way around. This adaptation makes Emacs a joy to use for writing.

Blog navigation

Previous: Navigating Julia source code files using Xref in Emacs
Index

You can find me on Mastodon should you wish to comment on this entry or the whole blog.

References

Fraga, Eric S., Veerawat Udomvorakulchai, Miguel Pineda, and Lazaros G. Papageorgiou. 2025. “A Multi-Agent System for Hybrid Optimization.” Computers & Chemical Engineering 202: 109258. https://doi.org/10.1016/j.compchemeng.2025.109258.

Footnotes:

1

Emacs Calc deserves a post of its own. It is arguably one of the most impressive features of Emacs, a full symbolic algebra system which hides under the description of an advanced "calculator and mathematical tool". And you can embed mathematics directly in your document and have equations update automatically. For another day…

2

The actual data in the second column in the body of the table were generated using the random() function from Emacs Calc as well.

Author: Copyright © Professor Emeritus Eric S Fraga

Created: 2025-07-25 Fri 12:38

Validate