Skip to content

TeX macros

Giorgio Garofalo edited this page Apr 5, 2025 · 1 revision

When writing TeX formulas, it may come in handy to have access to user-defined macros.

The .texmacro {name} {content} function defines a new macro which can be used in math elements.

.texmacro {\gradient} {\nabla}

$ \gradient f $

As with every Quarkdown function, the last argument can be used as a block argument.

.texmacro {\gradient}
    \nabla
Gradient

 

Parameters

Macros can feature a variable number of parameters:

.texmacro {\sumlim}
    \sum_{#1}^{#2}

$ \sumlim{i=1}{n} a_i $
Sum with limits

 

Composing

Multiple macros can be defined and can be combined, as you would do in LaTeX:

.texmacro {\hello}
    \text {Hello, \textit {world}}

.texmacro {\highlight}
    \colorbox{yellow}{#1}

$ \highlight{\hello} $

And also composed with other macros:

.texmacro {\hello}
    \text {Hello, \textit {world}}

.texmacro {\highlighthello}
    \colorbox{yellow}{\hello}

$ \highlighthello $
Highlighted hello world
Clone this wiki locally