fix: native latex prelude

This commit is contained in:
2026-03-19 15:45:29 -06:00
parent 2b80c15cc8
commit befa724551
3 changed files with 17 additions and 47 deletions

View File

@@ -0,0 +1,5 @@
% Default uses arrow glyphs from the active font, which are kinda ugly in the
% case of Plex.
\tikzcdset{
arrow style=tikz
}

View File

@@ -7,56 +7,13 @@
\usepackage{quiver}
\usepackage{tikz}
\usepackage{amscd}
\usepackage{metalogo}
\newcommand{\catname}[1]{\textbf{#1}}
\newcommand{\C}[1]{\catname{#1}}
% Specific categories
\newcommand{\Set}{\catname{Set}}
\newcommand{\Cat}{\catname{Cat}}
\newcommand{\CAT}{\catname{CAT}}
\newcommand{\Grp}{\catname{Grp}}
% Common objects and functions
\newcommand{\Ob}{\operatorname{Ob}}
\newcommand{\op}{\text{op}}
\newcommand{\opof}[1]{{#1}^{\text{op}}}
% \id{x} is the identity morphism on x.
\newcommand{\id}[1]{1_{#1}}
% \Id{C} is the identity functor on C.
\newcommand{\Id}[1]{1_{#1}}
\newcommand{\Mor}{\operatorname{Mor}}
\newcommand{\homset}[3]{{{#1} \left[ {#2} \to {#3} \right]}}
% Constructions of categories.
\newcommand{\FunctorCategory}[2]{\left[#1, #2\right]}
\newcommand{\Funct}[2]{\FunctorCategory{#1}{#2}} % Deprecated.
\newcommand{\ArrowCategory}[1]{{#1}^\to}
% Semantic aliases
\newcommand{\monicto}{\rightarrowtail}
\newcommand{\epicto}{\twoheadrightarrow}
\newcommand{\naturalto}{\Rightarrow}
\newcommand{\isoto}{\cong}
\newcommand{\equivto}{\simeq}
\newcommand{\naturaltrans}[2]{#1 \naturalto #2} % Deprecated.
\newcommand{\horizontalcompose}{\ast}
% Optics
\newcommand{\opticname}[1]{\textbf{#1}}
\newcommand{\optic}[3]{\opticname{#1}^\prime\;#2\;#3}
\newcommand{\Optic}[5]{\opticname{#1}\;#2\;#3\;#4\;#5}
% Default uses arrow glyphs from the active font, which are kinda ugly in the
% case of Plex.
\tikzcdset{
arrow style=tikz
}
% {{preamble}}
\begin{document}
\setlength\abovedisplayskip{0pt} % Remove padding before equation environments.
%% \color[rgb]{0.000,0.000,0.004}\special{dvisvgm:currentcolor on}\setcounter{equation}{0}%
% {{contents}}
\end{document}

View File

@@ -107,13 +107,21 @@
(format "%09d.svg" i))]
(zipmap (reverse snippets) svgs)))
(defn- read-prelude []
(str (-> "net/deertopia/doerg/prelude.tex" io/resource slurp)
\newline
(-> "net/deertopia/doerg/native-prelude.tex" io/resource slurp)))
(defn- instantiate-preview-template [snippets]
(let [contents (->> (for [s snippets]
(format "\\begin{preview}\n%s\n\\end{preview}" s))
(str/join "\n"))]
(-> (io/resource "net/deertopia/doerg/preview-template.tex")
slurp
(str/replace-first "% {{contents}}" contents))))
(str/replace #"% \{\{(contents|preamble)}}"
#(case (second %)
"contents" contents
"preamble" (read-prelude))))))
(defn render
"Render a collection of `snippets` to SVGs in `output-dir` using a