Write, code and publish in Org Mode

Posted on 2024-05-06 by Zilong Li

This page serves as an example of org-tufte, which is exported by a simple org file.

Introduction to org mode

Org mode is for keeping notes org-roam is a mature note-taking solution in org-mode if you like back-linked notes! , maintaining TODO lists, planning projects, and authoring documents with a fast and effective plain-text system A great article elaborates on this. .

Nice bits of org mode

As being members of Emacs cult, org-mode is a natural choice for note-taking, authoring, publishing and literate programming.

  1. Authoring and publishing: org can be exported to various formats TeX, PDF and HTML. great for writers and academics.
  2. Literate programming: org-babel is more powerful than rmarkdown, quarto. nice for teaching and reproducible research.
  3. Get Tings Done.
  4. And so on.

Org Demo

We use Lorem ipsum text to demonstrate all elements you would expect to see in the org-exported HTML pages.

The ordered list

  1. Lorem ipsum dolor sit amet, consectetur adipiscing elit.
  2. Donec et massa sit amet ligula maximus feugiat.
  3. Morbi consequat orci et tincidunt sagittis.

Unordered list

  • Aliquam non metus nec elit pellentesque scelerisque.
  • In accumsan nunc ac orci varius hendrerit.
  • Suspendisse non eros eu nisi finibus maximus.

Definition list

Lorem ipsum
dolor sit amet, consectetur adipiscing elit. Mauris laoreet sollicitudin venenatis. Duis sed consequat dolor.
Etiam feugiat
pharetra sapien et semper. Nunc ornare lacus sit amet massa auctor, vitae aliquam eros interdum. Mauris arcu ante, imperdiet vel purus ac, bibendum faucibus diam. Ut blandit nec mi at ultricies. Donec eget mattis nisl. In sed nibh felis. Cras quis convallis orci.
Sed aliquam
odio sed faucibus aliquam, arcu augue elementum justo, ut vulputate ligula sem in augue. Maecenas ante felis, pellentesque auctor semper non, eleifend quis ante. Fusce enim orci, suscipit ac dapibus et, fermentum eu tortor. Duis in facilisis ante, quis faucibus dolor. Etiam maximus lorem quis accumsan vehicula.


Org was born in 2003, out of frustration over the user interface of the Emacs Outline mode. I was trying to organize my notes and projects, and using Emacs seemed to be the natural way to go. However, having to remember eleven different commands with two or three keys per command, only to hide and show parts of the outline tree, that seemed entirely unacceptable to me. Also, when using outlines to take notes, I constantly wanted to restructure the tree, organizing it parallel to my thoughts and plans. Visibility cycling and structure editing were originally implemented in the package ‘outline-magic.el’, but quickly moved to the more general ‘org.el’. As this environment became comfortable for project planning, the next step was adding TODO entries, basic timestamps, and table support. These areas highlighted the two main goals that Org still has today: to be a new, outline-based, plain text mode with innovative and intuitive editing features, and to incorporate project planning functionality directly into a notes file. – From Carsten


org-cite is a very exciting feature See this blog for details. . In my field Test figure in sidenote pcaone-uml.png , there is a cutting-edge ultra-fast PCA method (, ).

Inline Math

This is an inline math \(\mathcal{F}(a) = \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z - a}\,dz\). And it can also look like equation but without equation number.

\[ \int_D (\nabla\cdot \mathcal{F})\,dV =\int_{\partial D}\mathcal{F}\cdot n\, dS \]

Math equation

The follows are equations with number label.

\begin{align} \mathcal{F}(a) &= \frac{1}{2\pi i}\oint_\gamma \frac{f(z)}{z - a}\,dz\\ \int_D (\nabla\cdot \mathcal{F})\,dV &=\int_{\partial D}\mathcal{F}\cdot n\, dS \end{align}

Unicode and ligatures

Org-tufte uses et-book-ligatures font for ligatures. Julia has native unicode support such that the code itself just looks like math written with greek symbol. nice for mathematical writting.

ρ(i, s, z) = sum(α[i, s, z, :] .* β[i, s, z, :]) / θ[i]
ρ(i, s) = map(z -> ρ(i, s, z), 1:size(α)[3])
κ(i, s, z, k; Q, F, ρ, h) = ρ[z] * Q[i, k] * F[z, s, k] / h[z]
κ(i, s; Q, F, ρ, h) = begin
   C×K = product(1:size(F)[1], 1:size(F)[3])
   map(((z, k),) -> κ(i, s, z, k; Q=Q, F=F, ρ=ρ, h=h), C×K)
ν(i, s, z1, z2, k1, k2; Q, F, h) =
    α[i, s, z1, z2] * β[i, s, z1, z2] / θ[i] *
    Q[i, k1] * F[z1, s, k1] / h[z1] *
    Q[i, k2] * F[z2, s, k2] / h[z2]


Table 1: Table Caption
\(N\) \(N^2\) \(N^3\) \(N^4\) \(\sqrt n\) \(\sqrt[4]N\)
1 1 1 1 1 1
2 4 8 16 1.4142 1.1892
3 9 27 81 1.7321 1.3161


Figure 1: Caption of the image is on the margin side. The benefit is that the caption can be very long and won't distract the audience from the main text. The benefit is that the caption can be very long and won't distract the audience from the main text. The benefit is that the caption can be very long and won't distract the audience from the main text.org-tufte-demo-1.jpg


Source code highlighting

(require 'org-tufte)
(setq org-tufte-htmlize-code t)