fix: native latex prelude
This commit is contained in:
5
doerg/resources/net/deertopia/doerg/native-prelude.tex
Normal file
5
doerg/resources/net/deertopia/doerg/native-prelude.tex
Normal 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
|
||||||
|
}
|
||||||
@@ -7,56 +7,13 @@
|
|||||||
\usepackage{quiver}
|
\usepackage{quiver}
|
||||||
\usepackage{tikz}
|
\usepackage{tikz}
|
||||||
\usepackage{amscd}
|
\usepackage{amscd}
|
||||||
|
\usepackage{metalogo}
|
||||||
|
|
||||||
\newcommand{\catname}[1]{\textbf{#1}}
|
% {{preamble}}
|
||||||
\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
|
|
||||||
}
|
|
||||||
|
|
||||||
\begin{document}
|
\begin{document}
|
||||||
\setlength\abovedisplayskip{0pt} % Remove padding before equation environments.
|
\setlength\abovedisplayskip{0pt} % Remove padding before equation environments.
|
||||||
%% \color[rgb]{0.000,0.000,0.004}\special{dvisvgm:currentcolor on}\setcounter{equation}{0}%
|
|
||||||
|
|
||||||
% {{contents}}
|
% {{contents}}
|
||||||
|
|
||||||
\end{document}
|
\end{document}
|
||||||
|
|||||||
@@ -107,13 +107,21 @@
|
|||||||
(format "%09d.svg" i))]
|
(format "%09d.svg" i))]
|
||||||
(zipmap (reverse snippets) svgs)))
|
(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]
|
(defn- instantiate-preview-template [snippets]
|
||||||
(let [contents (->> (for [s snippets]
|
(let [contents (->> (for [s snippets]
|
||||||
(format "\\begin{preview}\n%s\n\\end{preview}" s))
|
(format "\\begin{preview}\n%s\n\\end{preview}" s))
|
||||||
(str/join "\n"))]
|
(str/join "\n"))]
|
||||||
(-> (io/resource "net/deertopia/doerg/preview-template.tex")
|
(-> (io/resource "net/deertopia/doerg/preview-template.tex")
|
||||||
slurp
|
slurp
|
||||||
(str/replace-first "% {{contents}}" contents))))
|
(str/replace #"% \{\{(contents|preamble)}}"
|
||||||
|
#(case (second %)
|
||||||
|
"contents" contents
|
||||||
|
"preamble" (read-prelude))))))
|
||||||
|
|
||||||
(defn render
|
(defn render
|
||||||
"Render a collection of `snippets` to SVGs in `output-dir` using a
|
"Render a collection of `snippets` to SVGs in `output-dir` using a
|
||||||
|
|||||||
Reference in New Issue
Block a user