Variables
Variables
There is no =[name, value] / $[name] pair
An earlier draft of this page described those two operators. They were never
implemented. Variables in Tachyonn come from two places instead: the
frontmatter and macro parameters, and both are read with /var[…].
Reading a value: /var[key]
/var[key] interpolates a value wherever text goes:
===
title: Statistical Mechanics
author: Daniel Porto
semester: 2026.2
===
## Welcome
/var[title] — /var[semester]
Taught by /var[author].Because the frontmatter cascades, a key set in a tac.config is available to
every deck in the folder. Put semester: 2026.2 in the course's roottac.config and no lecture has to know the number — you change it once a term.
Macro parameters
The other source is a macro. Each k=v
you pass on insertion becomes /var[k] inside the body:
<<[<term> **/var[name]** — /var[def]]
>>[<term> name="KaTeX", def="client-side math engine, bundled offline"]
>>[<term> name="Shiki", def="the syntax highlighter used for code blocks"]And in a loop, the loop variable is read
the same way:
>>[<each> f in: Fast, Offline, Scientific]
- /var[f]
[[/each]]One syntax, three sources. Everything is substituted at parse time, so there is
no runtime cost and no chance of a variable resolving differently between the
screen and the PDF.
The footer's own tokens
The footer has a separate, simpler mechanism —
brace tokens, not /var[…]:
{page} · {total} · {title} · {subtitle} · {author} · {date} ·{description}
===
footer.right: {page} / {total}
footer.left: {title}
===