Compare commits
2 Commits
2b80c15cc8
...
5bca7890c4
| Author | SHA1 | Date | |
|---|---|---|---|
| 5bca7890c4 | |||
| befa724551 |
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{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}
|
||||
|
||||
@@ -115,6 +115,7 @@ p {
|
||||
margin-bottom: 1.4rem;
|
||||
padding-right: 0;
|
||||
vertical-align: baseline;
|
||||
hyphens: auto;
|
||||
}
|
||||
|
||||
/* Chapter Epigraphs */
|
||||
|
||||
@@ -56,6 +56,10 @@
|
||||
(lr/error e "Error in renderer" {:node node})
|
||||
(render-renderer-error e)))))))
|
||||
|
||||
(def default-language
|
||||
"Default language, used in the lang attribute of the body tag."
|
||||
"en")
|
||||
|
||||
(defn org-document
|
||||
"Recursively render an Org-mode document to Hiccup."
|
||||
[doc]
|
||||
@@ -66,7 +70,7 @@
|
||||
[:head
|
||||
[:title "org document"]
|
||||
doerg-html/head]
|
||||
[:body
|
||||
[:body {:lang default-language}
|
||||
[:article
|
||||
rendered]]])))
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user