Skip to content

Commit 3637812

Browse files
committed
ready for pdf builds
1 parent aac2b68 commit 3637812

File tree

4 files changed

+591
-0
lines changed

4 files changed

+591
-0
lines changed

latex/bibliography.xsl

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0"?>
2+
<!-- SPDX-License-Identifier: CC0-1.0 -->
3+
<xsl:stylesheet version="1.0"
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5+
xmlns:f="http://www.jonmsterling.com/jms-005P.xml"
6+
xmlns:html="http://www.w3.org/1999/xhtml">
7+
8+
<xsl:output method="text" encoding="utf-8" indent="yes" doctype-public="" doctype-system="" />
9+
10+
<xsl:template match="/f:tree/f:frontmatter">
11+
</xsl:template>
12+
13+
<xsl:template match="/f:tree/f:backmatter">
14+
</xsl:template>
15+
16+
<xsl:template match="/f:tree/f:mainmatter/f:p">
17+
</xsl:template>
18+
19+
<xsl:template match="f:anchor|f:addr|f:route|f:title|f:date|f:authors|f:taxon">
20+
</xsl:template>
21+
22+
<xsl:template match="/f:tree/f:mainmatter/f:tree/f:frontmatter/f:meta[not(@name='bibtex')]">
23+
</xsl:template>
24+
25+
<xsl:template match="/f:tree/f:mainmatter/f:tree/f:frontmatter/f:meta[@name='bibtex']">
26+
<xsl:apply-templates />
27+
<xsl:text>
28+
29+
</xsl:text>
30+
</xsl:template>
31+
32+
</xsl:stylesheet>

latex/book.xsl

+257
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,257 @@
1+
<?xml version="1.0"?>
2+
<!-- SPDX-License-Identifier: CC0-1.0 -->
3+
<xsl:stylesheet version="1.0"
4+
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
5+
xmlns:f="http://www.jonmsterling.com/jms-005P.xml"
6+
xmlns:html="http://www.w3.org/1999/xhtml">
7+
8+
<xsl:output method="text" encoding="utf-8" indent="yes" doctype-public="" doctype-system="" />
9+
10+
<xsl:template match="/">
11+
<xsl:apply-templates select="/f:tree/f:frontmatter" mode="top" />
12+
<xsl:apply-templates select="/f:tree/f:mainmatter" />
13+
</xsl:template>
14+
15+
<xsl:template match="f:frontmatter" mode="top">
16+
<xsl:text>\part{</xsl:text>
17+
<xsl:apply-templates select="f:title" />
18+
<xsl:text>}</xsl:text>
19+
<xsl:text>\label{</xsl:text>
20+
<xsl:apply-templates select="f:addr" />
21+
<xsl:text>}</xsl:text>
22+
<xsl:text>\thispagestyle{fancy}</xsl:text>
23+
</xsl:template>
24+
25+
<xsl:template match="/f:tree/f:mainmatter/f:tree[not(f:frontmatter/f:taxon)]/f:frontmatter/f:title">
26+
<xsl:text>\chapter{</xsl:text>
27+
<xsl:apply-templates />
28+
<xsl:text>}</xsl:text>
29+
<xsl:text>\thispagestyle{fancy}</xsl:text>
30+
</xsl:template>
31+
32+
<xsl:template match="/f:tree/f:mainmatter/f:tree/f:mainmatter/f:tree[not(f:frontmatter/f:taxon)]/f:frontmatter/f:title">
33+
<xsl:text>\section{</xsl:text>
34+
<xsl:apply-templates />
35+
<xsl:text>}</xsl:text>
36+
</xsl:template>
37+
38+
<xsl:template match="/f:tree/f:mainmatter/f:tree/f:mainmatter/f:tree/f:mainmatter/f:tree[not(f:frontmatter/f:taxon)]/f:frontmatter/f:title">
39+
<xsl:text>\subsection{</xsl:text>
40+
<xsl:apply-templates />
41+
<xsl:text>}</xsl:text>
42+
</xsl:template>
43+
44+
<xsl:template match="f:tree[not(f:frontmatter/f:taxon)]">
45+
<xsl:apply-templates select="f:frontmatter/f:title" />
46+
<xsl:text>\label{</xsl:text>
47+
<xsl:value-of select="f:frontmatter/f:addr" />
48+
<xsl:text>}</xsl:text>
49+
<xsl:apply-templates select="f:mainmatter" />
50+
</xsl:template>
51+
52+
<xsl:template match="f:taxon[text()='Original']">
53+
<xsl:text>original</xsl:text>
54+
</xsl:template>
55+
56+
<xsl:template match="f:taxon[text()='Definition']">
57+
<xsl:text>definition</xsl:text>
58+
</xsl:template>
59+
60+
<xsl:template match="f:taxon[text()='Theorem']">
61+
<xsl:text>theorem</xsl:text>
62+
</xsl:template>
63+
64+
<xsl:template match="f:taxon[text()='Lemma']">
65+
<xsl:text>lemma</xsl:text>
66+
</xsl:template>
67+
68+
<xsl:template match="f:taxon[text()='Proposition']">
69+
<xsl:text>proposition</xsl:text>
70+
</xsl:template>
71+
72+
<xsl:template match="f:taxon[text()='Corollary']">
73+
<xsl:text>corollary</xsl:text>
74+
</xsl:template>
75+
76+
<xsl:template match="f:taxon[text()='Statement']">
77+
<xsl:text>statement</xsl:text>
78+
</xsl:template>
79+
80+
<xsl:template match="f:taxon[text()='Example']">
81+
<xsl:text>example</xsl:text>
82+
</xsl:template>
83+
84+
<xsl:template match="f:taxon[text()='Remark']">
85+
<xsl:text>remark</xsl:text>
86+
</xsl:template>
87+
88+
<xsl:template match="f:taxon[text()='Remarks']">
89+
<xsl:text>remarks</xsl:text>
90+
</xsl:template>
91+
92+
<xsl:template match="f:taxon[text()='Scholium']">
93+
<xsl:text>scholium</xsl:text>
94+
</xsl:template>
95+
96+
<xsl:template match="f:taxon[text()='Conjecture']">
97+
<xsl:text>conjecture</xsl:text>
98+
</xsl:template>
99+
100+
<xsl:template match="f:taxon[text()='Equation']">
101+
<xsl:text>eqn</xsl:text>
102+
</xsl:template>
103+
104+
<xsl:template match="f:tree[f:frontmatter/f:taxon[text()='Proof']]">
105+
<xsl:text>\begin{proof}</xsl:text>
106+
<xsl:apply-templates select="f:mainmatter" />
107+
<xsl:text>\end{proof}</xsl:text>
108+
</xsl:template>
109+
110+
<xsl:template match="f:tree[f:frontmatter/f:taxon[not(text()='Proof')]]">
111+
<xsl:text>\begin{</xsl:text>
112+
<xsl:apply-templates select="f:frontmatter/f:taxon" />
113+
<xsl:text>}</xsl:text>
114+
<xsl:if test="f:frontmatter/f:title">
115+
<xsl:text>[{</xsl:text>
116+
<xsl:apply-templates select="f:frontmatter/f:title" />
117+
<xsl:text>}]</xsl:text>
118+
</xsl:if>
119+
<xsl:text>{</xsl:text>
120+
<xsl:apply-templates select="f:frontmatter/f:number" />
121+
<xsl:text>}</xsl:text>
122+
<xsl:if test="f:frontmatter/f:number">
123+
<xsl:text>\setnumber{</xsl:text>
124+
<xsl:apply-templates select="f:frontmatter/f:number" />
125+
<xsl:text>}</xsl:text>
126+
</xsl:if>
127+
<xsl:if test="f:frontmatter/f:addr[@type='user']">
128+
<xsl:text>\label{</xsl:text>
129+
<xsl:value-of select="f:frontmatter/f:addr" />
130+
<xsl:text>}</xsl:text>
131+
</xsl:if>
132+
<xsl:text>\skipsinglepar</xsl:text>
133+
<xsl:apply-templates select="f:mainmatter" />
134+
<xsl:text>\end{</xsl:text>
135+
<xsl:apply-templates select="f:frontmatter/f:taxon" />
136+
<xsl:text>}</xsl:text>
137+
</xsl:template>
138+
139+
<xsl:template match="f:mainmatter">
140+
<xsl:apply-templates select="f:p|f:tex|f:ol|f:ul|f:tree|html:ol|html:li" />
141+
</xsl:template>
142+
143+
<xsl:template match="f:p">
144+
<xsl:text>\par{}</xsl:text>
145+
<xsl:apply-templates />
146+
</xsl:template>
147+
148+
<xsl:template match="f:strong">
149+
<xsl:text>\textbf{</xsl:text>
150+
<xsl:apply-templates />
151+
<xsl:text>}</xsl:text>
152+
</xsl:template>
153+
154+
<xsl:template match="f:em">
155+
<xsl:text>\emph{</xsl:text>
156+
<xsl:apply-templates />
157+
<xsl:text>}</xsl:text>
158+
</xsl:template>
159+
160+
<xsl:template match="f:code">
161+
<xsl:text>\url{</xsl:text>
162+
<xsl:apply-templates />
163+
<xsl:text>}</xsl:text>
164+
</xsl:template>
165+
166+
<xsl:template match="f:tex[not(@display='block')]">
167+
<xsl:text>\(</xsl:text>
168+
<xsl:apply-templates />
169+
<xsl:text>\)</xsl:text>
170+
</xsl:template>
171+
172+
<xsl:template match="f:tex[@display='block']">
173+
<xsl:text>\[</xsl:text>
174+
<xsl:apply-templates />
175+
<xsl:if test="parent::f:mainmatter/parent::f:tree/f:frontmatter/f:taxon[text()='Proof'] and position()=last()">
176+
<xsl:text>\qedhere</xsl:text>
177+
</xsl:if>
178+
<xsl:text>\]</xsl:text>
179+
</xsl:template>
180+
181+
<xsl:template match="f:ol">
182+
<xsl:text>\begin{enumerate}</xsl:text>
183+
<xsl:apply-templates />
184+
<xsl:text>\end{enumerate}</xsl:text>
185+
</xsl:template>
186+
187+
<xsl:template match="f:ul">
188+
<xsl:text>\begin{itemize}</xsl:text>
189+
<xsl:apply-templates />
190+
<xsl:text>\end{itemize}</xsl:text>
191+
</xsl:template>
192+
193+
<xsl:template match="f:li">
194+
<xsl:text>\item{}</xsl:text>
195+
<xsl:apply-templates />
196+
<xsl:if test="(parent::f:ol/parent::f:mainmatter/parent::f:tree/f:frontmatter/f:taxon[text()='Proof'] or parent::f:ul/parent::f:mainmatter/parent::f:tree/f:frontmatter/f:taxon[text()='Proof']) and position()=last()">
197+
<xsl:text>\qedhere</xsl:text>
198+
</xsl:if>
199+
</xsl:template>
200+
201+
<xsl:template match="html:ol">
202+
<xsl:text>\begin{enumerate}</xsl:text>
203+
<xsl:apply-templates />
204+
<xsl:text>\end{enumerate}</xsl:text>
205+
</xsl:template>
206+
207+
<xsl:template match="html:li">
208+
<xsl:text>\item[</xsl:text>
209+
<xsl:variable name="firstSplit" select="substring-after(@style, ': &quot;')" />
210+
<xsl:variable name="secondSplit" select="substring-before($firstSplit, ' &quot;')" />
211+
<xsl:value-of select="$secondSplit" />
212+
<xsl:text>]</xsl:text>
213+
<xsl:apply-templates />
214+
</xsl:template>
215+
216+
<xsl:template match="f:ref[@taxon]">
217+
<xsl:text>\hyperref[</xsl:text>
218+
<xsl:value-of select="@addr" />
219+
<xsl:text>]{</xsl:text>
220+
<xsl:value-of select="@taxon" />
221+
<xsl:text>~</xsl:text>
222+
<xsl:text>\ref*{</xsl:text>
223+
<xsl:value-of select="@addr" />
224+
<xsl:text>}}</xsl:text>
225+
</xsl:template>
226+
227+
<xsl:template match="f:ref[not(@taxon)]">
228+
<xsl:text>\cref{</xsl:text>
229+
<xsl:value-of select="@addr" />
230+
<xsl:text>}</xsl:text>
231+
</xsl:template>
232+
233+
<xsl:template match="f:link[@type='local']">
234+
<xsl:text>\hyperref[</xsl:text>
235+
<xsl:value-of select="@addr" />
236+
<xsl:text>]{</xsl:text>
237+
<xsl:apply-templates />
238+
<xsl:text>}</xsl:text>
239+
</xsl:template>
240+
241+
<xsl:template match="f:block">
242+
<xsl:text>\begin{proof}</xsl:text>
243+
<xsl:apply-templates />
244+
<xsl:text>\end{proof}</xsl:text>
245+
</xsl:template>
246+
247+
<xsl:template match="f:headline" />
248+
249+
<xsl:template match="f:embedded-tex">
250+
<xsl:text>\begin{center}</xsl:text>
251+
<xsl:text>\includestandalone{</xsl:text>
252+
<xsl:value-of select="@hash" />
253+
<xsl:text>}</xsl:text>
254+
<xsl:text>\end{center}</xsl:text>
255+
</xsl:template>
256+
257+
</xsl:stylesheet>

latex/buildtex.sh

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#!/bin/bash
2+
3+
declare -a volumes=("fga-foreword"
4+
"fga1"
5+
"fga2"
6+
"fga3.i"
7+
"fga3.ii"
8+
"fga3.iii"
9+
"fga3.iv"
10+
"fga3.v"
11+
"fga3.vi")
12+
13+
for file in "${volumes[@]}"
14+
do
15+
cp ../output/"$file".xml .
16+
xsltproc book.xsl "$file".xml > "$file".tex
17+
done
18+
19+
cp ../output/fga-bibliography.xml .
20+
xsltproc bibliography.xsl fga-bibliography.xml > fga-bibliography.bib

0 commit comments

Comments
 (0)