diff --git a/trees/macros.tree b/trees/macros.tree index 75051b2..5003dac 100644 --- a/trees/macros.tree +++ b/trees/macros.tree @@ -1,9 +1,66 @@ \title{basic macros} -\p{Here we define:} - \import{latex-preamble} +\xmlns:html{http://www.w3.org/1999/xhtml} + +\strong{Useful macros from [jonsterling's macros](https://git.sr.ht/~jonsterling/public-trees/tree/main/item/base-macros.tree)} + +\p{\code{citek[uid]}: Refer to a reference entry with brackets.} + +\def\citek[uid]{ + \let\escape[x]{\x} + + [\escape{[\uid]}](\uid) +} + +\p{\code{mark[body]}: Some yellow background mark text.} + +\def\mark[body]{\{\body}} + +\strong{Useful macros from [CAIMEOX's macros](https://github.com/CAIMEOX/caimeox.github.io/blob/main/trees/macros.tree)} + +\p{\code{block[tit][body]}: A block that is part of the TOC.} + +\def\block[tit][body]{ + \subtree{ + \title{\tit} + \body + } +} + +\p{\code{section[tit][body]}: A section that is NOT part of the TOC.} + +\def\section[tit][body]{ + \scope{ + \put\transclude/toc{false} + \subtree{ + \tit + \body + } + } +} + +\p{\code{tikz[g]}: A TikZ graph rendered via LaTeX.} + +\def\tikz[g]{ + \xml{center}{\tex{ + \usepackage{tikz-cd} + \usepackage{amssymb} + }{ + \g + } + } +} + +\p{\code{codeblock[lang][body]}: A code block specifying the language.} + +\def\codeblock[lang][body]{ + \pre{ \xml{code}[class]{\lang}{\body} } +} + +\strong{Useful macros we defined} + \alloc\base/tex-preamble \p{\code{minitex[body]}: Typesetting LaTeX code in a minipage, with the width of an A5 paper, @@ -30,16 +87,7 @@ so the text size almost matches the size output by native forester code. This do } } -% From: https://git.sr.ht/~jonsterling/public-trees/tree/main/item/base-macros.tree -\p{\code{citek[uid]}: Refer to a reference entry with brackets.} - -\def\citek[uid]{ - \let\escape[x]{\x} - - [\escape{[\uid]}](\uid) -} - -\p{\code{texdef[name][reference][body]}: Making a \code{minitex} definition with a reference.} +\p{\code{texdef[name][reference][body]}: A \code{minitex} definition with a reference.} \def\texdef[name][reference][body]{ \title{\name \citek{\reference}} @@ -47,7 +95,7 @@ so the text size almost matches the size output by native forester code. This do \minitex{\body} } -\p{\code{wikiref[name][pageid]}: Making a reference to a Wikipedia article.} +\p{\code{wikiref[name][pageid]}: A reference to a Wikipedia article.} \def\wikiref[name][pageid]{ \title{\name - Wikipedia} @@ -55,7 +103,7 @@ so the text size almost matches the size output by native forester code. This do \taxon{reference} } -\p{\code{nlabref[name][wikiid]}: Making a reference to a nLab article.} +\p{\code{nlabref[name][pageid]}: A reference to a nLab article.} \def\nlabref[name][pageid]{ \title{\name - nLab} @@ -63,7 +111,7 @@ so the text size almost matches the size output by native forester code. This do \taxon{reference} } -\p{\code{edit[treeid]}: Making a reference to a nLab article.} +\p{\code{edit[treeid]}: A link to the source code of a tree.} \def\edit[treeid]{ \let\escape[x]{\x} @@ -87,43 +135,4 @@ so the text size almost matches the size output by native forester code. This do } } -\p{Below are some useful macros taken from [CAIMEOX's macros](https://github.com/CAIMEOX/caimeox.github.io/blob/main/trees/macros.tree):} - -\p{\code{block[tit][body]}: A block that is part of the TOC.} - -\def\block[tit][body]{ - \subtree{ - \title{\tit} - \body - } -} - -\p{\code{section[tit][body]}: A section that is NOT part of the TOC.} - -\def\section[tit][body]{ - \scope{ - \put\transclude/toc{false} - \subtree{ - \tit - \body - } - } -} - -\p{\code{tikz[g]}: A TikZ graph rendered via LaTeX.} - -\def\tikz[g]{ - \xml{center}{\tex{ - \usepackage{tikz-cd} - \usepackage{amssymb} - }{ - \g - } - } -} - -\p{\code{codeblock[lang][body]}: A code block specifying the language.} - -\def\codeblock[lang][body]{ - \pre{ \xml{code}[class]{\lang}{\body} } -} \ No newline at end of file +\meta{source}{ \edit{macros} } \ No newline at end of file