SelfscribeDownloadOpen the app

Academic

Type \section, \emph and \begin{theorem} as you would in LaTeX, and read a typeset paper with real formulas.

A rulebook. Save it in the app's library, then start any document with use academic.

Edit it in the playgroundRead the file

What it shows

Write a paper in LaTeX commands, each one a rule.

What you learn

A command with braces as an inline rule, \begin and \end as a block rule, labels drawn by CSS, a slot written into an attribute, a line rule that hides comments, maths and TikZ through plugins, a look for the whole page.

Try this

  • Change theorem in the palette to #c92a2a, and the theorem's bar turns red.
examples/rulebooks/academic.self · 138 lines
~~~ selfscribe
# Academic: LaTeX-style commands for papers and notes. Use it with:  use academic
# Lesson: Write a paper in LaTeX commands, each one a rule.
# You learn: a command with braces as an inline rule, \begin and \end as a block rule, labels drawn by CSS, a slot written into an attribute, a line rule that hides comments, maths and TikZ through plugins, a look for the whole page.
# Try this: change `theorem` in the palette to #c92a2a, and the theorem's bar turns red.
# summary: Type \section, \emph and \begin{theorem} as you would in LaTeX, and read a typeset paper with real formulas.
# category: syntax
set title Academic

# ---- The page: a paper's look, serif type and numbered sections ----------------------
set style academic

# ---- Colours, each with its shade for dark pages -------------------------------------
palette
  cite     #1c64d8  dark #74a7ff
  theorem  #6741d9  dark #b197fc

# ---- \title{…}, \author{…} and \date{…} on their own lines: the centred head of the paper -
# Two backslashes in a pattern stand for one backslash in the text.
line   \\title{_}                              -> header.ac-title   { font: 650 1.95em/1.18 var(--doc-font-heading, Georgia, serif); text-align: center; text-wrap: balance; margin: 0.4em 0 0.5em }  as ac-title
line   \\author{_}                             -> div.ac-author     { text-align: center; font-size: 1.08em }  as ac-author
line   \\date{_}                               -> div.ac-date       { text-align: center; font-size: 0.95em; opacity: 0.7; margin: 0.15em 0 2em }  as ac-date

# ---- \section{…} and \subsection{…}: numbered headings you can fold in the editor -----
line   \\section{_}                            -> h2                fold 2
line   \\subsection{_}                         -> h3                fold 3

# ---- \emph{…}, \textbf{…}, \texttt{…} and \cite{…} inside a sentence ------------------
inline \\emph{_}                               -> em
inline \\textbf{_}                             -> strong
# verbatim: the text inside is shown as typed, so a command in it stays a command.
inline \\texttt{_}                             -> code              verbatim
inline \\cite{_}                               -> cite.ac-ref       { font-style: normal; color: var(--cite) }  as ac-cite
class ac-ref::before  { content: "[" }
class ac-ref::after   { content: "]" }

# ---- \begin{…} and \end{…} lines around text: the abstract, a theorem, a proof, lists ----
# The words Abstract, Theorem and Proof, and the square that ends a proof, come from the CSS.
block  \\begin{abstract} ... \\end{abstract}   -> div.ac-abstract   { margin: 0 7% 2em; font-size: 0.92em }  as ac-abstract
class ac-abstract::before  { content: "Abstract"; display: block; text-align: center; font-weight: 700; margin-bottom: 0.35em }
block  \\begin{theorem} ... \\end{theorem}     -> div.ac-theorem    { margin: 1.3em 0 0.6em; padding: 0.8em 1.15em; border-left: 3px solid var(--theorem); border-radius: 0 8px 8px 0; background: color-mix(in srgb, var(--theorem) 8%, transparent); font-style: italic }  as ac-theorem
class ac-theorem::before  { content: "Theorem."; font-style: normal; font-weight: 700; margin-right: 0.45em }
class ac-theorem > p:first-child  { display: inline }
block  \\begin{proof} ... \\end{proof}         -> div.ac-proof      { margin: 0.6em 0 1.4em }  as ac-proof
class ac-proof::before  { content: "Proof."; font-style: italic; margin-right: 0.45em }
class ac-proof::after   { content: "∎"; float: right; margin-left: 1em }
class ac-proof > p:first-child  { display: inline }
block  \\begin{itemize} ... \\end{itemize}     -> ul
block  \\begin{enumerate} ... \\end{enumerate} -> ol
line   \\item _                                -> li

# ---- A figure: a TikZ picture with a caption under it ----------------------------------
block  \\begin{figure} ... \\end{figure}       -> figure.ac-figure  { margin: 1.6em 0; text-align: center }  as ac-figure
block  \\begin{tikzpicture} ... \\end{tikzpicture}  -> tikz          verbatim
line   \\caption{_}                            -> figcaption        { max-width: 34em; margin: 0.6em auto 0; font-size: 0.9em; text-align: center; opacity: 0.85 }  as ac-caption

# ---- The references: \bibitem{key} and the entry; the key in brackets before it --------
block  \\begin{thebibliography} ... \\end{thebibliography}  -> section.ac-refs  as ac-refs
class ac-refs::before  { content: "References"; display: block; font: 650 1.28em/1.3 var(--doc-font-heading, inherit); margin: 1.8em 0 0.7em }
line   \\bibitem{_} _                          -> p.ac-bib          data-key=_1  _2  { padding-left: 4.4em; text-indent: -4.4em; font-size: 0.92em; text-align: start }  as ac-bib
class ac-bib::before  { content: "[" attr(data-key) "]"; display: inline-block; width: 4.4em; text-indent: 0; color: var(--cite) }

# ---- A line starting with a percent sign: a note to yourself that never prints -------
line   % _                                     -> hidden

# ---- Dollar signs around TeX: maths in a line, or on its own between two $$ lines -----
inline $_$                                     -> math   verbatim
block  $$ ... $$                               -> math   verbatim
~~~
\title{Tiling deficient boards with trominoes}
\author{R. Okonkwo}
\date{March 2026}

\begin{abstract}
A board of $2^n \times 2^n$ squares with one square removed can always be covered by L-shaped trominoes, with no overlaps and nothing left over. We give the counting argument that makes this plausible, and the short induction that proves it.
\end{abstract}

\section{The result}
% Check the 1954 reference against the library's copy before submitting.
A \emph{tromino} is three squares joined in an L. The smallest case worth drawing is a $4 \times 4$ board with its top right square removed.

\begin{figure}
\begin{tikzpicture}
\filldraw[fill=blue!22, draw=black!70, thick] (0,0) -- (2,0) -- (2,1) -- (1,1) -- (1,2) -- (0,2) -- cycle;
\filldraw[fill=orange!30, draw=black!70, thick] (2,0) -- (4,0) -- (4,2) -- (3,2) -- (3,1) -- (2,1) -- cycle;
\filldraw[fill=green!25, draw=black!70, thick] (0,2) -- (1,2) -- (1,3) -- (2,3) -- (2,4) -- (0,4) -- cycle;
\filldraw[fill=violet!22, draw=black!70, thick] (2,2) -- (4,2) -- (4,3) -- (3,3) -- (3,4) -- (2,4) -- cycle;
\filldraw[fill=red!28, draw=black!70, thick] (1,1) -- (3,1) -- (3,2) -- (2,2) -- (2,3) -- (1,3) -- cycle;
\fill[black!75] (3,3) rectangle (4,4);
\end{tikzpicture}
\caption{The $4 \times 4$ board without its top right square, covered by five trominoes. The red one, in the middle, is placed first.}
\end{figure}

\begin{theorem}
For every $n \ge 1$, a $2^n \times 2^n$ board with any one square removed can be tiled by trominoes \cite{Gol54}.
\end{theorem}

\begin{proof}
Split the board into four quarters. The missing square lies in one of them. Place one tromino at the centre so that it covers a square of each of the other three quarters. Now every quarter misses \emph{exactly} one square and has side $2^{n-1}$, so induction on $n$ finishes the proof.
\end{proof}

\subsection{Counting squares}
A board of side $2^n$ has $4^n$ squares. With one removed, the rest must split into threes:

$$
4^n - 1 = (2^n - 1)(2^n + 1)
$$

Of $2^n - 1$, $2^n$ and $2^n + 1$, one is a multiple of three. It is never $2^n$, so the count always divides.

\subsection{What the proof needs}
\begin{itemize}
\item The case $n = 1$: a $2 \times 2$ board missing one square \textbf{is} a tromino.
\item Four quarters of side $2^{n-1}$, each missing exactly one square.
\item Induction on $n$.
\end{itemize}

\begin{thebibliography}
\bibitem{Gol54} S. W. Golomb, Checker boards and polyominoes, \emph{The American Mathematical Monthly} 61 (1954), 675–682.
\end{thebibliography}

\section{How it's made}
\begin{itemize}
\item Every command is a rule in the rules block. A \texttt{\section} line becomes a numbered heading, and \texttt{\emph} or \texttt{\cite} in a sentence becomes emphasis or a reference.
\item A \texttt{\begin} line and its \texttt{\end} line make a box: the abstract, the theorem, the proof, the figure.
\item The words Abstract, Theorem and Proof, and the square that ends the proof, are drawn by the rules' CSS. You never type them.
\item Maths between dollar signs goes to the maths plugin, and the \texttt{tikzpicture} to the TikZ plugin. The line \texttt{set style academic} gives the page its serif type and its numbered sections.
\end{itemize}

\section{Try it yourself}
\begin{enumerate}
\item Change \texttt{theorem} in the palette to \texttt{#c92a2a}. The theorem's bar turns red.
\item Change \texttt{red!28} in the picture to \texttt{yellow!40}. The middle tromino turns yellow.
\item Write a line that starts with a percent sign. It never shows on the page.
\item Add a \texttt{\bibitem} line with a key of your own, and cite it with \texttt{\cite}. The key shows in brackets in both places.
\end{enumerate}

\textbf{Next:} \emph{Maths notes} writes the same maths in Markdown; \emph{Research paper} is a whole paper with citations.