@pretextbook/pretext-html 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (111) hide show
  1. package/README.md +42 -3
  2. package/assets/preview-html.xsl +230 -230
  3. package/assets/upstream.json +7 -7
  4. package/assets/xsl/README.md +0 -0
  5. package/assets/xsl/entities.ent +154 -154
  6. package/assets/xsl/extract-asymptote.xsl +68 -68
  7. package/assets/xsl/extract-biblio-csl.xsl +327 -327
  8. package/assets/xsl/extract-datafile.xsl +71 -71
  9. package/assets/xsl/extract-dynamic.xsl +139 -139
  10. package/assets/xsl/extract-identity.xsl +136 -136
  11. package/assets/xsl/extract-interactive.xsl +81 -81
  12. package/assets/xsl/extract-latex-image.xsl +118 -118
  13. package/assets/xsl/extract-mermaid.xsl +58 -58
  14. package/assets/xsl/extract-mom.xsl +63 -63
  15. package/assets/xsl/extract-pg.xsl +2897 -2897
  16. package/assets/xsl/extract-prefigure.xsl +157 -157
  17. package/assets/xsl/extract-qrcode.xsl +100 -100
  18. package/assets/xsl/extract-runestone-page-template.xsl +139 -139
  19. package/assets/xsl/extract-sageplot.xsl +166 -166
  20. package/assets/xsl/extract-stack.xsl +56 -56
  21. package/assets/xsl/extract-trace.xsl +134 -134
  22. package/assets/xsl/extract-youtube.xsl +63 -63
  23. package/assets/xsl/html-symbols.xsl +3344 -3344
  24. package/assets/xsl/latex/pretext-latex-AIM.xsl +56 -56
  25. package/assets/xsl/latex/pretext-latex-CLP.xsl +148 -148
  26. package/assets/xsl/latex/pretext-latex-chaos.xsl +317 -317
  27. package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +76 -76
  28. package/assets/xsl/latex/pretext-latex-guide.xsl +104 -104
  29. package/assets/xsl/latex/pretext-latex-texstyle.xsl +862 -862
  30. package/assets/xsl/localizations/README.md +0 -0
  31. package/assets/xsl/localizations/af-ZA.xml +276 -276
  32. package/assets/xsl/localizations/bg-BG.xml +276 -276
  33. package/assets/xsl/localizations/ca-ES.xml +285 -285
  34. package/assets/xsl/localizations/cs-CZ.xml +280 -280
  35. package/assets/xsl/localizations/de-DE.xml +281 -281
  36. package/assets/xsl/localizations/en-US.xml +427 -427
  37. package/assets/xsl/localizations/es-ES.xml +287 -287
  38. package/assets/xsl/localizations/fi-FI.xml +275 -275
  39. package/assets/xsl/localizations/fr-CA.xml +276 -276
  40. package/assets/xsl/localizations/fr-FR.xml +280 -280
  41. package/assets/xsl/localizations/hu-HU.xml +280 -280
  42. package/assets/xsl/localizations/it-IT.xml +276 -276
  43. package/assets/xsl/localizations/ku-CKB.xml +275 -275
  44. package/assets/xsl/localizations/localizations.xml +48 -48
  45. package/assets/xsl/localizations/nl-NL.xml +275 -275
  46. package/assets/xsl/localizations/pt-BR.xml +288 -288
  47. package/assets/xsl/localizations/pt-PT.xml +292 -292
  48. package/assets/xsl/localizations/zh-HANS.xml +269 -269
  49. package/assets/xsl/pretext-assembly.xsl +4795 -4795
  50. package/assets/xsl/pretext-basic-html.xsl +86 -86
  51. package/assets/xsl/pretext-beamer.xsl +662 -662
  52. package/assets/xsl/pretext-braille-preprint.xsl +2249 -2249
  53. package/assets/xsl/pretext-common.xsl +12018 -12018
  54. package/assets/xsl/pretext-dynamic.xsl +65 -65
  55. package/assets/xsl/pretext-epub.xsl +1483 -1483
  56. package/assets/xsl/pretext-fo.xsl +4593 -4593
  57. package/assets/xsl/pretext-html.xsl +14791 -14791
  58. package/assets/xsl/pretext-json-manifest.xsl +150 -150
  59. package/assets/xsl/pretext-jupyter.xsl +868 -868
  60. package/assets/xsl/pretext-latex-classic.xsl +952 -952
  61. package/assets/xsl/pretext-latex-common.xsl +11563 -11563
  62. package/assets/xsl/pretext-latex.xsl +47 -47
  63. package/assets/xsl/pretext-litprog.xsl +105 -105
  64. package/assets/xsl/pretext-merge.xsl +41 -41
  65. package/assets/xsl/pretext-numbers.xsl +875 -875
  66. package/assets/xsl/pretext-revealjs.xsl +522 -522
  67. package/assets/xsl/pretext-runestone-fitb.xsl +1233 -1233
  68. package/assets/xsl/pretext-runestone-static.xsl +1438 -1438
  69. package/assets/xsl/pretext-runestone.xsl +3083 -3083
  70. package/assets/xsl/pretext-sage-doctest.xsl +289 -289
  71. package/assets/xsl/pretext-smc.xsl +492 -492
  72. package/assets/xsl/pretext-solution-manual-latex.xsl +323 -323
  73. package/assets/xsl/pretext-text-utilities.xsl +1217 -1217
  74. package/assets/xsl/pretext-text.xsl +392 -392
  75. package/assets/xsl/pretext-units.xsl +195 -195
  76. package/assets/xsl/pretext-view-source.xsl +157 -157
  77. package/assets/xsl/pretext-ww-problem-sets.xsl +391 -391
  78. package/assets/xsl/publisher-variables.xsl +4756 -4756
  79. package/assets/xsl/support/README.md +0 -0
  80. package/assets/xsl/support/extract-math.xsl +256 -256
  81. package/assets/xsl/support/package-math.xsl +141 -141
  82. package/assets/xsl/support/play-button/README.md +0 -0
  83. package/assets/xsl/support/play-button/play-button.png +0 -0
  84. package/assets/xsl/support/play-button/play-button.svg +3 -3
  85. package/assets/xsl/support/pretext-pg-macros.xsl +110 -110
  86. package/assets/xsl/support/webpack_static_imports.xml +14 -14
  87. package/assets/xsl/tests/README.md +0 -0
  88. package/assets/xsl/tests/null.xml +3 -3
  89. package/assets/xsl/tests/pretext-text-utilities-test.xsl +333 -333
  90. package/assets/xsl/utilities/README.md +0 -0
  91. package/assets/xsl/utilities/author-report.xsl +107 -107
  92. package/assets/xsl/utilities/deprecate-autoname.sed +18 -18
  93. package/assets/xsl/utilities/deprecate-index.sed +33 -33
  94. package/assets/xsl/utilities/fix-deprecations.xsl +663 -663
  95. package/assets/xsl/utilities/pretext-enhanced-source.xsl +112 -112
  96. package/assets/xsl/utilities/report-publisher-variables.xsl +162 -162
  97. package/assets/xsl/xml-to-json.xsl +326 -326
  98. package/assets/xsl/xml-to-string.xsl +328 -328
  99. package/dist/{cli-C6tfAVvi.js → cli-BQizBK0N.js} +74 -72
  100. package/dist/cli.d.ts +0 -0
  101. package/dist/cli.js +1 -1
  102. package/dist/index.d.ts +2 -0
  103. package/dist/index.js +12 -6
  104. package/dist/mounts.d.ts +0 -0
  105. package/dist/publication.d.ts +0 -0
  106. package/dist/renderer.d.ts +10 -0
  107. package/dist/sourcemap.d.ts +0 -0
  108. package/dist/theme.d.ts +68 -0
  109. package/dist/theme.js +93 -0
  110. package/dist/xinclude.d.ts +0 -0
  111. package/package.json +14 -2
@@ -1,662 +1,662 @@
1
- <?xml version='1.0'?>
2
-
3
- <!--********************************************************************
4
- Copyright 2020 Oscar Levin, Andrew Rechnitzer, Steven Clontz, Robert A. Beezer
5
-
6
- This file is part of PreTeXt.
7
-
8
- PreTeXt is free software: you can redistribute it and/or modify
9
- it under the terms of the GNU General Public License as published by
10
- the Free Software Foundation, either version 2 or version 3 of the
11
- License (at your option).
12
-
13
- PreTeXt is distributed in the hope that it will be useful,
14
- but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- GNU General Public License for more details.
17
-
18
- You should have received a copy of the GNU General Public License
19
- along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
20
- *********************************************************************-->
21
-
22
- <!DOCTYPE xsl:stylesheet [
23
- <!ENTITY % entities SYSTEM "./entities.ent">
24
- %entities;
25
- ]>
26
-
27
- <!-- A "slideshow" realized as a LaTeX/Beamer presentation. -->
28
- <!-- -->
29
- <!-- Modeled on the reveal.js conversion: import the full parent -->
30
- <!-- conversion (LaTeX), which supplies inline markup, mathematics, -->
31
- <!-- images, tables, programs, side-by-side, and so on. Override -->
32
- <!-- the entry point and the structure ("slideshow", "section", -->
33
- <!-- "slide", "subslide"), pauses, and the block elements, which -->
34
- <!-- become native Beamer environments. -->
35
- <!-- -->
36
- <!-- Lists are implemented here, and NOT inherited: the LaTeX -->
37
- <!-- conversion's lists rely on the "enumitem" package, which -->
38
- <!-- interferes with Beamer's own list machinery (especially -->
39
- <!-- overlays); Beamer's native lists are used instead. -->
40
- <xsl:stylesheet
41
- xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
42
- xmlns:xml="http://www.w3.org/XML/1998/namespace"
43
- xmlns:exsl="http://exslt.org/common"
44
- xmlns:date="http://exslt.org/dates-and-times"
45
- extension-element-prefixes="exsl date"
46
- >
47
-
48
- <xsl:import href="./pretext-latex.xsl" />
49
-
50
- <xsl:output method="text" indent="no" encoding="UTF-8"/>
51
-
52
- <!-- The Beamer theme, an author/publisher choice. A string parameter -->
53
- <!-- until slideshow options mature in the publisher file. -->
54
- <xsl:param name="beamer.theme" select="'Boadilla'"/>
55
-
56
- <!-- Blocks on slides never carry a LaTeX \label, so cross-reference -->
57
- <!-- numbers are hard-coded rather than realized through \ref -->
58
- <xsl:variable name="b-latex-hardcode-numbers" select="true()"/>
59
-
60
- <!-- ############## -->
61
- <!-- Entry Template -->
62
- <!-- ############## -->
63
-
64
- <!-- Mirror the LaTeX conversion's entry template: warnings are -->
65
- <!-- computed on the original source, and we process the enhanced -->
66
- <!-- source produced by the assembly stylesheet (so generated -->
67
- <!-- images, WeBWorK representations, and their friends all exist). -->
68
- <xsl:template match="/">
69
- <xsl:call-template name="banner-warning">
70
- <xsl:with-param name="warning">Conversion to Beamer presentations/slideshows is experimental&#xa;Requests for additional specific constructions welcome&#xa;Additional PreTeXt elements are subject to change</xsl:with-param>
71
- </xsl:call-template>
72
- <xsl:apply-templates select="$original" mode="generic-warnings"/>
73
- <xsl:apply-templates select="$original" mode="element-deprecation-warnings"/>
74
- <xsl:apply-templates select="$original" mode="parameter-deprecation-warnings"/>
75
- <xsl:apply-templates select="$root"/>
76
- </xsl:template>
77
-
78
- <xsl:template match="/mathbook|/pretext">
79
- <xsl:apply-templates select="slideshow"/>
80
- </xsl:template>
81
-
82
- <!-- ################ -->
83
- <!-- Document Shell -->
84
- <!-- ################ -->
85
-
86
- <xsl:template match="slideshow">
87
- <xsl:call-template name="converter-blurb-latex" />
88
- <xsl:call-template name="beamer-preamble"/>
89
- <xsl:text>\begin{document}&#xa;&#xa;</xsl:text>
90
- <xsl:apply-templates select="frontmatter"/>
91
- <!-- an overview of the sections, when there are sections -->
92
- <xsl:if test="section">
93
- <xsl:text>\begin{frame}&#xa;</xsl:text>
94
- <xsl:text>\frametitle{</xsl:text>
95
- <xsl:apply-templates select="." mode="type-name">
96
- <xsl:with-param name="string-id" select="'toc'"/>
97
- </xsl:apply-templates>
98
- <xsl:text>}&#xa;</xsl:text>
99
- <xsl:text>\tableofcontents&#xa;</xsl:text>
100
- <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
101
- </xsl:if>
102
- <xsl:apply-templates select="section|slide"/>
103
- <xsl:text>\end{document}&#xa;</xsl:text>
104
- </xsl:template>
105
-
106
- <!-- ########### -->
107
- <!-- Frontmatter -->
108
- <!-- ########### -->
109
-
110
- <!-- Title, subtitle, authors, event, date become Beamer's title -->
111
- <!-- page material, on a plain frame. An optional "abstract" -->
112
- <!-- follows on a frame of its own. -->
113
- <xsl:template match="slideshow/frontmatter">
114
- <xsl:text>\title{</xsl:text>
115
- <xsl:apply-templates select="parent::slideshow" mode="title-full"/>
116
- <xsl:text>}&#xa;</xsl:text>
117
- <xsl:if test="parent::slideshow/subtitle">
118
- <xsl:text>\subtitle{</xsl:text>
119
- <xsl:apply-templates select="parent::slideshow" mode="subtitle"/>
120
- <xsl:text>}&#xa;</xsl:text>
121
- </xsl:if>
122
- <!-- short form (names only) for theme footlines -->
123
- <xsl:text>\author[</xsl:text>
124
- <xsl:for-each select="$bibinfo/author">
125
- <xsl:apply-templates select="personname"/>
126
- <xsl:if test="following-sibling::author">
127
- <xsl:text>, </xsl:text>
128
- </xsl:if>
129
- </xsl:for-each>
130
- <xsl:text>]{</xsl:text>
131
- <xsl:for-each select="$bibinfo/author">
132
- <xsl:apply-templates select="personname"/>
133
- <!-- assembly wraps a bare "institution" in an "affiliation" -->
134
- <xsl:if test="affiliation/institution|institution">
135
- <xsl:text>\\ {\small </xsl:text>
136
- <xsl:apply-templates select="(affiliation/institution|institution)[1]/node()"/>
137
- <xsl:text>}</xsl:text>
138
- </xsl:if>
139
- <xsl:if test="following-sibling::author">
140
- <xsl:text> \and </xsl:text>
141
- </xsl:if>
142
- </xsl:for-each>
143
- <xsl:text>}&#xa;</xsl:text>
144
- <xsl:text>\date{</xsl:text>
145
- <xsl:if test="$bibinfo/event">
146
- <xsl:apply-templates select="$bibinfo/event"/>
147
- <xsl:if test="$bibinfo/date">
148
- <xsl:text>\\ </xsl:text>
149
- </xsl:if>
150
- </xsl:if>
151
- <xsl:if test="$bibinfo/date">
152
- <xsl:apply-templates select="$bibinfo/date"/>
153
- </xsl:if>
154
- <xsl:text>}&#xa;&#xa;</xsl:text>
155
- <xsl:text>\begin{frame}[plain]&#xa;</xsl:text>
156
- <xsl:text>\titlepage&#xa;</xsl:text>
157
- <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
158
- <xsl:apply-templates select="abstract"/>
159
- </xsl:template>
160
-
161
- <xsl:template match="slideshow/frontmatter/abstract">
162
- <xsl:text>\begin{frame}&#xa;</xsl:text>
163
- <xsl:text>\frametitle{</xsl:text>
164
- <xsl:apply-templates select="." mode="type-name"/>
165
- <xsl:text>}&#xa;</xsl:text>
166
- <xsl:apply-templates/>
167
- <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
168
- </xsl:template>
169
-
170
- <!-- ######################## -->
171
- <!-- Sections, Slides, Pauses -->
172
- <!-- ######################## -->
173
-
174
- <!-- A "section" is a Beamer section (navigation, table of contents) -->
175
- <!-- with a section-title frame, as in the reveal.js conversion. -->
176
- <xsl:template match="slideshow/section">
177
- <xsl:text>&#xa;\section{</xsl:text>
178
- <xsl:apply-templates select="." mode="title-full"/>
179
- <xsl:text>}&#xa;</xsl:text>
180
- <xsl:text>\begin{frame}&#xa;</xsl:text>
181
- <xsl:text>\sectionpage&#xa;</xsl:text>
182
- <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
183
- <xsl:apply-templates select="slide"/>
184
- </xsl:template>
185
-
186
- <!-- A "slide" is a frame. A frame whose content includes anything -->
187
- <!-- realized through the "listings" package (or other verbatim-like -->
188
- <!-- material) must be marked "fragile". -->
189
- <xsl:template match="slide">
190
- <xsl:text>\begin{frame}</xsl:text>
191
- <xsl:if test="descendant::program or descendant::console or descendant::sage or descendant::cd or descendant::pre">
192
- <xsl:text>[fragile]</xsl:text>
193
- </xsl:if>
194
- <xsl:text>&#xa;</xsl:text>
195
- <xsl:text>\frametitle{</xsl:text>
196
- <xsl:apply-templates select="." mode="title-full"/>
197
- <xsl:text>}&#xa;</xsl:text>
198
- <xsl:apply-templates/>
199
- <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
200
- </xsl:template>
201
-
202
- <!-- A "subslide" is material that appears, as one group, after an -->
203
- <!-- advance of the slideshow. Beamer's \pause would also suppress -->
204
- <!-- everything *after* the group, but material following a subslide -->
205
- <!-- is visible from the outset (as with reveal.js "fragments"), so -->
206
- <!-- we uncover the group on the next pause step and leave the -->
207
- <!-- surroundings alone. -->
208
- <xsl:template match="subslide">
209
- <xsl:text>\uncover&lt;+(1)-&gt;{%&#xa;</xsl:text>
210
- <xsl:apply-templates/>
211
- <xsl:text>}%&#xa;</xsl:text>
212
- </xsl:template>
213
-
214
- <!-- A paragraph may pause before it appears; identical device -->
215
- <xsl:template match="slide//p[@pause = 'yes']">
216
- <xsl:text>\uncover&lt;+(1)-&gt;{%&#xa;</xsl:text>
217
- <xsl:apply-imports/>
218
- <xsl:text>}%&#xa;</xsl:text>
219
- </xsl:template>
220
-
221
- <!-- ##### -->
222
- <!-- Lists -->
223
- <!-- ##### -->
224
-
225
- <!-- Beamer's native lists, since the inherited lists rely on the -->
226
- <!-- "enumitem" package, which fights Beamer. A list with pauses -->
227
- <!-- gets the incremental default overlay specification, item by -->
228
- <!-- item, matching the reveal.js conversion's fragments. -->
229
-
230
- <!-- An "ol" marker passes through as a Beamer "mini-template", -->
231
- <!-- where the characters A, a, I, i, 1 are the counter formats, -->
232
- <!-- consonant with PreTeXt marker conventions -->
233
- <xsl:template match="slide//ol">
234
- <xsl:call-template name="begin-list-columns"/>
235
- <xsl:text>\begin{enumerate}</xsl:text>
236
- <xsl:if test="@pause = 'yes'">
237
- <xsl:text>[&lt;+-&gt;]</xsl:text>
238
- </xsl:if>
239
- <xsl:if test="@marker">
240
- <xsl:text>[</xsl:text>
241
- <xsl:value-of select="@marker"/>
242
- <xsl:text>]</xsl:text>
243
- </xsl:if>
244
- <xsl:text>&#xa;</xsl:text>
245
- <xsl:apply-templates select="li"/>
246
- <xsl:text>\end{enumerate}&#xa;</xsl:text>
247
- <xsl:call-template name="end-list-columns"/>
248
- </xsl:template>
249
-
250
- <xsl:template match="slide//ul">
251
- <xsl:call-template name="begin-list-columns"/>
252
- <xsl:text>\begin{itemize}</xsl:text>
253
- <xsl:if test="@pause = 'yes'">
254
- <xsl:text>[&lt;+-&gt;]</xsl:text>
255
- </xsl:if>
256
- <xsl:text>&#xa;</xsl:text>
257
- <xsl:apply-templates select="li"/>
258
- <xsl:text>\end{itemize}&#xa;</xsl:text>
259
- <xsl:call-template name="end-list-columns"/>
260
- </xsl:template>
261
-
262
- <xsl:template match="slide//dl">
263
- <xsl:text>\begin{description}</xsl:text>
264
- <xsl:if test="@pause = 'yes'">
265
- <xsl:text>[&lt;+-&gt;]</xsl:text>
266
- </xsl:if>
267
- <xsl:text>&#xa;</xsl:text>
268
- <xsl:apply-templates select="li"/>
269
- <xsl:text>\end{description}&#xa;</xsl:text>
270
- </xsl:template>
271
-
272
- <!-- Multiple columns via the "multicol" package (in the preamble) -->
273
- <xsl:template name="begin-list-columns">
274
- <xsl:if test="@cols and (@cols != 1)">
275
- <xsl:text>\begin{multicols}{</xsl:text>
276
- <xsl:value-of select="@cols"/>
277
- <xsl:text>}&#xa;</xsl:text>
278
- </xsl:if>
279
- </xsl:template>
280
-
281
- <xsl:template name="end-list-columns">
282
- <xsl:if test="@cols and (@cols != 1)">
283
- <xsl:text>\end{multicols}&#xa;</xsl:text>
284
- </xsl:if>
285
- </xsl:template>
286
-
287
- <xsl:template match="slide//ol/li|slide//ul/li">
288
- <xsl:text>\item{}</xsl:text>
289
- <xsl:if test="title">
290
- <xsl:text> \lititle{</xsl:text>
291
- <xsl:apply-templates select="." mode="title-full"/>
292
- <xsl:text>}\par</xsl:text>
293
- </xsl:if>
294
- <xsl:text> </xsl:text>
295
- <xsl:apply-templates/>
296
- <xsl:text>&#xa;</xsl:text>
297
- </xsl:template>
298
-
299
- <!-- The title becomes Beamer's description label -->
300
- <xsl:template match="slide//dl/li">
301
- <xsl:text>\item[</xsl:text>
302
- <xsl:apply-templates select="." mode="title-full"/>
303
- <xsl:text>] </xsl:text>
304
- <xsl:apply-templates/>
305
- <xsl:text>&#xa;</xsl:text>
306
- </xsl:template>
307
-
308
- <!-- ###### -->
309
- <!-- Blocks -->
310
- <!-- ###### -->
311
-
312
- <!-- Blocks become native Beamer environments, which the theme -->
313
- <!-- styles. Beamer predefines "definition", "theorem", -->
314
- <!-- "corollary", "lemma", "fact", "example", "proof" and the -->
315
- <!-- generic titled "block". Blocks are not numbered on slides. -->
316
-
317
- <xsl:template match="&DEFINITION-LIKE;" priority="1">
318
- <xsl:call-template name="beamer-environment">
319
- <xsl:with-param name="environment" select="'definition'"/>
320
- </xsl:call-template>
321
- </xsl:template>
322
-
323
- <xsl:template match="theorem|corollary|lemma|fact" priority="1">
324
- <xsl:call-template name="beamer-environment">
325
- <xsl:with-param name="environment" select="local-name(.)"/>
326
- </xsl:call-template>
327
- </xsl:template>
328
-
329
- <xsl:template match="&EXAMPLE-LIKE;" priority="1">
330
- <xsl:call-template name="beamer-environment">
331
- <xsl:with-param name="environment" select="'example'"/>
332
- </xsl:call-template>
333
- </xsl:template>
334
-
335
- <!-- Everything else theorem-ish, plus remarks and asides, is a -->
336
- <!-- generic Beamer "block" headed by its type-name and title -->
337
- <xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&ASIDE-LIKE;|&GOAL-LIKE;|assemblage">
338
- <xsl:text>\begin{block}{</xsl:text>
339
- <xsl:apply-templates select="." mode="type-name"/>
340
- <xsl:if test="title">
341
- <xsl:text>: </xsl:text>
342
- <xsl:apply-templates select="." mode="title-full"/>
343
- </xsl:if>
344
- <xsl:text>}&#xa;</xsl:text>
345
- <xsl:apply-templates select="*[not(&PROOF-FILTER;)]"/>
346
- <xsl:text>\end{block}&#xa;</xsl:text>
347
- <xsl:apply-templates select="&PROOF-LIKE;"/>
348
- </xsl:template>
349
-
350
- <!-- The common core: the environment, an optional title in the -->
351
- <!-- optional argument, the guts, and any proof following outside -->
352
- <xsl:template name="beamer-environment">
353
- <xsl:param name="environment"/>
354
- <xsl:text>\begin{</xsl:text>
355
- <xsl:value-of select="$environment"/>
356
- <xsl:text>}</xsl:text>
357
- <xsl:if test="title">
358
- <xsl:text>[</xsl:text>
359
- <xsl:apply-templates select="." mode="title-full"/>
360
- <xsl:text>]</xsl:text>
361
- </xsl:if>
362
- <xsl:text>&#xa;</xsl:text>
363
- <xsl:apply-templates select="*[not(&PROOF-FILTER;)]"/>
364
- <xsl:text>\end{</xsl:text>
365
- <xsl:value-of select="$environment"/>
366
- <xsl:text>}&#xa;</xsl:text>
367
- <xsl:apply-templates select="&PROOF-LIKE;"/>
368
- </xsl:template>
369
-
370
- <xsl:template match="&PROOF-LIKE;">
371
- <xsl:text>\begin{proof}&#xa;</xsl:text>
372
- <xsl:apply-templates/>
373
- <xsl:text>\end{proof}&#xa;</xsl:text>
374
- </xsl:template>
375
-
376
- <!-- "statement" is a pure container in this context -->
377
- <xsl:template match="statement">
378
- <xsl:apply-templates/>
379
- </xsl:template>
380
-
381
- <!-- Metadata of blocks, handled elsewhere or meaningless on a slide -->
382
- <xsl:template match="notation"/>
383
-
384
- <!-- ####### -->
385
- <!-- Figures -->
386
- <!-- ####### -->
387
-
388
- <!-- The LaTeX conversion realizes captioned items through generated -->
389
- <!-- environments of its styling scheme, which Beamer does not carry. -->
390
- <!-- On a slide there is no numbering, so a caption or title is just -->
391
- <!-- a small centered legend after the content. -->
392
- <xsl:template match="&FIGURE-LIKE;" priority="1">
393
- <xsl:text>\begin{center}&#xa;</xsl:text>
394
- <xsl:apply-templates select="*[not(self::caption)]"/>
395
- <xsl:choose>
396
- <xsl:when test="caption">
397
- <xsl:text>\par\smallskip{}{\small{}</xsl:text>
398
- <xsl:apply-templates select="caption/node()"/>
399
- <xsl:text>}&#xa;</xsl:text>
400
- </xsl:when>
401
- <xsl:when test="title">
402
- <xsl:text>\par\smallskip{}{\small{}</xsl:text>
403
- <xsl:apply-templates select="." mode="title-full"/>
404
- <xsl:text>}&#xa;</xsl:text>
405
- </xsl:when>
406
- <xsl:otherwise/>
407
- </xsl:choose>
408
- <xsl:text>\end{center}&#xa;</xsl:text>
409
- </xsl:template>
410
-
411
- <!-- ################ -->
412
- <!-- Cross-References -->
413
- <!-- ################ -->
414
-
415
- <!-- The content of a cross-reference is computed by the -common -->
416
- <!-- machinery; on a slide we do not make it a hyperlink, since the -->
417
- <!-- likely target is a nearby slide with no useful anchor in a PDF. -->
418
- <xsl:template match="*" mode="xref-link">
419
- <xsl:param name="target"/>
420
- <xsl:param name="content"/>
421
- <xsl:copy-of select="$content"/>
422
- </xsl:template>
423
-
424
- <!-- Every number in a cross-reference is hard-coded: no block on a -->
425
- <!-- slide carries a LaTeX \label, so \ref has nothing to resolve. -->
426
- <xsl:template match="*" mode="xref-number">
427
- <xsl:param name="xref" select="/.." />
428
- <xsl:apply-templates select="." mode="xref-number-hardcoded">
429
- <xsl:with-param name="xref" select="$xref"/>
430
- </xsl:apply-templates>
431
- </xsl:template>
432
-
433
- <!-- ######## -->
434
- <!-- Preamble -->
435
- <!-- ######## -->
436
-
437
- <!-- N.B. Portions of this preamble duplicate fragments of the LaTeX -->
438
- <!-- conversion's preamble, since the inherited content templates -->
439
- <!-- presume supporting macros and environments ("image", "sidebyside" -->
440
- <!-- and "sbspanel", "program", "console", "sageinput"/"sageoutput", -->
441
- <!-- tabular rules, semantic macros). Re-architecting the LaTeX -->
442
- <!-- preamble into shareable pieces would remove the duplication. -->
443
- <xsl:template name="beamer-preamble">
444
- <xsl:text>\documentclass[11pt, compress]{beamer}&#xa;</xsl:text>
445
- <xsl:if test="$latex.preamble.early != ''">
446
- <xsl:text>%% Custom Preamble Entries, early (use latex.preamble.early)&#xa;</xsl:text>
447
- <xsl:value-of select="$latex.preamble.early" />
448
- <xsl:text>&#xa;</xsl:text>
449
- </xsl:if>
450
- <xsl:text>\usetheme{</xsl:text>
451
- <xsl:value-of select="$beamer.theme"/>
452
- <xsl:text>}&#xa;</xsl:text>
453
- <xsl:text>\usefonttheme[onlymath]{serif}&#xa;</xsl:text>
454
- <xsl:text>%% quash navigation symbols&#xa;</xsl:text>
455
- <xsl:text>\setbeamertemplate{navigation symbols}{}&#xa;</xsl:text>
456
- <xsl:text>%% every "section" gets a section-title frame via \sectionpage&#xa;</xsl:text>
457
- <xsl:text>&#xa;%%%% Start PreTeXt generated preamble %%%%&#xa;&#xa;</xsl:text>
458
- <xsl:text>\usepackage{amsmath}&#xa;</xsl:text>
459
- <xsl:text>%% fonts: the inherited templates emit T1-encoded glyph names&#xa;</xsl:text>
460
- <xsl:text>%% (such as \textquotedbl), so match the LaTeX conversion's setup&#xa;</xsl:text>
461
- <xsl:text>\ifPDFTeX&#xa;</xsl:text>
462
- <xsl:text>\usepackage[T1]{fontenc}&#xa;</xsl:text>
463
- <xsl:text>\else&#xa;</xsl:text>
464
- <xsl:text>\usepackage{fontspec}&#xa;</xsl:text>
465
- <xsl:text>\fi&#xa;</xsl:text>
466
- <xsl:text>%% Some aspects of the preamble are conditional,&#xa;</xsl:text>
467
- <xsl:text>%% the LaTeX engine is one such determinant&#xa;</xsl:text>
468
- <xsl:text>\usepackage{ifthen}&#xa;</xsl:text>
469
- <xsl:text>\newcommand{\tabularfont}{}&#xa;</xsl:text>
470
- <xsl:text>\usepackage[xparse, raster]{tcolorbox}&#xa;</xsl:text>
471
- <xsl:text>\tcbset{colback=white, colframe=white}&#xa;</xsl:text>
472
- <xsl:text>%% tcolorbox styles used by images and side-by-side panels&#xa;</xsl:text>
473
- <xsl:text>\tcbset{ bwminimalstyle/.style={size=minimal, boxrule=-0.3pt, frame empty,&#xa;</xsl:text>
474
- <xsl:text>colback=white, colbacktitle=white, coltitle=black, opacityfill=0.0} }&#xa;</xsl:text>
475
- <xsl:if test="$document-root//image">
476
- <xsl:text>%% "tcolorbox" environment for a single image, as in the LaTeX conversion&#xa;</xsl:text>
477
- <xsl:text>\tcbset{ imagestyle/.style={bwminimalstyle} }&#xa;</xsl:text>
478
- <xsl:text>\NewTColorBox{tcbimage}{mmm}{imagestyle,left skip=#1\linewidth,width=#2\linewidth}&#xa;</xsl:text>
479
- <xsl:text>\NewDocumentEnvironment{image}{mmmm}{\notblank{#4}{\leavevmode\nopagebreak\vspace{#4}}{}\begin{tcbimage}{#1}{#2}{#3}}{\end{tcbimage}%&#xa;}</xsl:text>
480
- <xsl:text>&#xa;</xsl:text>
481
- </xsl:if>
482
- <xsl:if test="$document-root//ol[@cols]|$document-root//ul[@cols]">
483
- <xsl:text>%% Multiple column lists&#xa;</xsl:text>
484
- <xsl:text>\usepackage{multicol}&#xa;</xsl:text>
485
- </xsl:if>
486
- <xsl:if test="$b-has-program or $b-has-console or $b-has-sage">
487
- <xsl:text>%% Program listing support: for listings, programs, consoles, and Sage code&#xa;</xsl:text>
488
- <xsl:text>\ifthenelse{\boolean{xetex} \or \boolean{luatex}}%&#xa;</xsl:text>
489
- <xsl:text> {\tcbuselibrary{listings}}%&#xa;</xsl:text>
490
- <xsl:text> {\tcbuselibrary{listingsutf8}}%&#xa;</xsl:text>
491
- <xsl:text>%% A null language, free of any formatting or style&#xa;</xsl:text>
492
- <xsl:text>\lstdefinelanguage{none}{identifierstyle=,commentstyle=,stringstyle=,keywordstyle=}&#xa;</xsl:text>
493
- <xsl:if test="$b-has-program">
494
- <xsl:text>%% Colors match a subset of Google prettify "Default" style&#xa;</xsl:text>
495
- <xsl:text>\definecolor{identifiers}{rgb}{0.375,0,0.375}&#xa;</xsl:text>
496
- <xsl:text>\definecolor{comments}{rgb}{0.5,0,0}&#xa;</xsl:text>
497
- <xsl:text>\definecolor{strings}{rgb}{0,0.5,0}&#xa;</xsl:text>
498
- <xsl:text>\definecolor{keywords}{rgb}{0,0,0.5}&#xa;</xsl:text>
499
- <xsl:text>\lstdefinestyle{programcodestyle}{identifierstyle=\color{identifiers},commentstyle=\color{comments},stringstyle=\color{strings},keywordstyle=\color{keywords}, breaklines=true, breakatwhitespace=true, columns=fixed, extendedchars=true, aboveskip=0pt, belowskip=0pt}&#xa;</xsl:text>
500
- <xsl:text>\lstdefinestyle{programcodenumberedstyle}{style=programcodestyle, numbers=left}&#xa;</xsl:text>
501
- <xsl:text>\tcbset{ programboxstyle/.style={left=3ex, right=0pt, top=0ex, bottom=0ex, middle=0pt, toptitle=0pt, bottomtitle=0pt, boxsep=0pt, &#xa;</xsl:text>
502
- <xsl:text>listing only, fontupper=\small\ttfamily,&#xa;</xsl:text>
503
- <xsl:text>colback=white, sharp corners, boxrule=-0.3pt, leftrule=0.5pt,&#xa;</xsl:text>
504
- <xsl:text>parbox=false,&#xa;</xsl:text>
505
- <xsl:text>} }&#xa;</xsl:text>
506
- <xsl:text>\tcbset{ programboxnumberedstyle/.style={programboxstyle, left=6ex} }&#xa;</xsl:text>
507
- <xsl:text>%% Arguments: language, left margin, width, right margin (latter ignored)&#xa;</xsl:text>
508
- <xsl:text>\newtcblisting{program}[4]{programboxstyle, left skip=#2\linewidth, width=#3\linewidth, listing options={language=#1, style=programcodestyle}}&#xa;</xsl:text>
509
- <xsl:text>\newtcblisting{programnumbered}[4]{programboxnumberedstyle, left skip=#2\linewidth, width=#3\linewidth, listing options={language=#1, style=programcodenumberedstyle}}&#xa;</xsl:text>
510
- <xsl:text>\newcommand{\programfragment}[2]{\lstinline[language=#1, style=programcodestyle, basicstyle=\ttfamily]#2}&#xa;</xsl:text>
511
- </xsl:if>
512
- <xsl:if test="$b-has-console">
513
- <xsl:text>%% Console session with prompt, input, output&#xa;</xsl:text>
514
- <xsl:text>\newcommand{\consoleinput}[1]{\textbf{#1}}&#xa;</xsl:text>
515
- <xsl:text>\lstdefinestyle{consolecodestyle}{language=none, escapeinside={(*}{*)}, identifierstyle=, commentstyle=, stringstyle=, keywordstyle=, breaklines=false, breakatwhitespace=false, columns=fixed, extendedchars=true, aboveskip=0pt, belowskip=0pt}&#xa;</xsl:text>
516
- <xsl:text>\tcbset{ consoleboxstyle/.style={left=0pt, right=0pt, top=0ex, bottom=0ex, middle=0pt, toptitle=0pt, bottomtitle=0pt, boxsep=0pt,&#xa;</xsl:text>
517
- <xsl:text>listing only, fontupper=\small\ttfamily,&#xa;</xsl:text>
518
- <xsl:text>colback=white, boxrule=-0.3pt,&#xa;</xsl:text>
519
- <xsl:text>parbox=false,&#xa;</xsl:text>
520
- <xsl:text>} }&#xa;</xsl:text>
521
- <xsl:text>%% Arguments: left margin, width, right margin (latter ignored)&#xa;</xsl:text>
522
- <xsl:text>\newtcblisting{console}[3]{consoleboxstyle, left skip=#1\linewidth, width=#2\linewidth, listing options={style=consolecodestyle}}&#xa;</xsl:text>
523
- </xsl:if>
524
- <xsl:if test="$b-has-sage">
525
- <xsl:text>%% The listings package as tcolorbox for Sage code&#xa;</xsl:text>
526
- <xsl:text>\definecolor{sageblue}{HTML}{</xsl:text><xsl:value-of select="$sage-input-background"/><xsl:text>}&#xa;</xsl:text>
527
- <xsl:text>\tcbset{ sagestyle/.style={left=0pt, right=0pt, top=0ex, bottom=0ex, middle=0pt, toptitle=0pt, bottomtitle=0pt,&#xa;</xsl:text>
528
- <xsl:text>boxsep=4pt, listing only, fontupper=\small\ttfamily,&#xa;</xsl:text>
529
- <xsl:text>parbox=false, &#xa;</xsl:text>
530
- <xsl:text>listing options={language=Python,breaklines=true,breakatwhitespace=true, extendedchars=true, aboveskip=0pt, belowskip=0pt}} }&#xa;</xsl:text>
531
- <xsl:text>\newtcblisting{sageinput}{sagestyle, colback=sageblue, sharp corners, boxrule=0.5pt, }&#xa;</xsl:text>
532
- <xsl:text>\newtcblisting{sageoutput}{sagestyle, colback=white, colframe=white, frame empty, before skip=0pt, after skip=0pt, }&#xa;</xsl:text>
533
- </xsl:if>
534
- </xsl:if>
535
- <xsl:if test="$document-root//sidebyside">
536
- <xsl:text>%% tcolorbox styles for sidebyside layout&#xa;</xsl:text>
537
- <xsl:text>\tcbset{ sbsstyle/.style={raster before skip=2.0ex, raster equal height=rows, raster force size=false} }&#xa;</xsl:text>
538
- <xsl:text>\tcbset{ sbspanelstyle/.style={bwminimalstyle} }&#xa;</xsl:text>
539
- <xsl:text>%% "xparse" environment for entire sidebyside&#xa;</xsl:text>
540
- <xsl:text>\NewDocumentEnvironment{sidebyside}{mmmm}&#xa;</xsl:text>
541
- <xsl:text> {\begin{tcbraster}&#xa;</xsl:text>
542
- <xsl:text> [sbsstyle,raster columns=#1,&#xa;</xsl:text>
543
- <xsl:text> raster left skip=#2\linewidth,raster right skip=#3\linewidth,raster column skip=#4\linewidth]}&#xa;</xsl:text>
544
- <xsl:text> {\end{tcbraster}}&#xa;</xsl:text>
545
- <xsl:text>%% "tcolorbox" environment for a panel of sidebyside&#xa;</xsl:text>
546
- <xsl:text>\NewTColorBox{sbspanel}{mO{top}}{sbspanelstyle,width=#1\linewidth,valign=#2}&#xa;</xsl:text>
547
- </xsl:if>
548
- <xsl:if test="$document-root//tabular">
549
- <xsl:text>%% For improved tables&#xa;</xsl:text>
550
- <xsl:text>\usepackage{array}&#xa;</xsl:text>
551
- <xsl:text>\setlength{\extrarowheight}{0.2ex}&#xa;</xsl:text>
552
- <xsl:text>%% Variable thickness horizontal rules, full and partial&#xa;</xsl:text>
553
- <xsl:text>\newcommand{\hrulethin} {\noalign{\hrule height 0.04em}}&#xa;</xsl:text>
554
- <xsl:text>\newcommand{\hrulemedium}{\noalign{\hrule height 0.07em}}&#xa;</xsl:text>
555
- <xsl:text>\newcommand{\hrulethick} {\noalign{\hrule height 0.11em}}&#xa;</xsl:text>
556
- <xsl:text>\let\oldsetlength\setlength&#xa;</xsl:text>
557
- <xsl:text>\newlength{\Oldarrayrulewidth}&#xa;</xsl:text>
558
- <xsl:text>\newcommand{\crulethin}[1]%&#xa;</xsl:text>
559
- <xsl:text>{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%&#xa;</xsl:text>
560
- <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{0.04em}}\cline{#1}%&#xa;</xsl:text>
561
- <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}%&#xa;</xsl:text>
562
- <xsl:text>\newcommand{\crulemedium}[1]%&#xa;</xsl:text>
563
- <xsl:text>{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%&#xa;</xsl:text>
564
- <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{0.07em}}\cline{#1}%&#xa;</xsl:text>
565
- <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}&#xa;</xsl:text>
566
- <xsl:text>\newcommand{\crulethick}[1]%&#xa;</xsl:text>
567
- <xsl:text>{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%&#xa;</xsl:text>
568
- <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{0.11em}}\cline{#1}%&#xa;</xsl:text>
569
- <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}&#xa;</xsl:text>
570
- <xsl:text>%% Single letter column specifiers defined via array package&#xa;</xsl:text>
571
- <xsl:text>\newcolumntype{A}{!{\vrule width 0.04em}}&#xa;</xsl:text>
572
- <xsl:text>\newcolumntype{B}{!{\vrule width 0.07em}}&#xa;</xsl:text>
573
- <xsl:text>\newcolumntype{C}{!{\vrule width 0.11em}}&#xa;</xsl:text>
574
- </xsl:if>
575
- <xsl:if test="$document-root//cell/line">
576
- <xsl:text>\newcommand{\tablecelllines}[3]%&#xa;</xsl:text>
577
- <xsl:text>{\begin{tabular}[#2]{@{}#1@{}}#3\end{tabular}}&#xa;</xsl:text>
578
- </xsl:if>
579
- <xsl:text>\newcommand{\lt}{&lt;}&#xa;</xsl:text>
580
- <xsl:text>\newcommand{\gt}{&gt;}&#xa;</xsl:text>
581
- <xsl:text>\newcommand{\amp}{&amp;}&#xa;</xsl:text>
582
- <xsl:text>%% Begin: Semantic Macros&#xa;</xsl:text>
583
- <xsl:text>\newcommand{\mono}[1]{\texttt{#1}}&#xa;</xsl:text>
584
- <xsl:variable name="one-line-reps" select="
585
- ($document-root//abbr)[1]|
586
- ($document-root//acro)[1]|
587
- ($document-root//init)[1]"/>
588
- <xsl:for-each select="$one-line-reps">
589
- <xsl:apply-templates select="." mode="tex-macro"/>
590
- </xsl:for-each>
591
- <xsl:if test="$document-root//alert">
592
- <xsl:text>\newcommand{\alert}[1]{\textbf{\textit{#1}}}&#xa;</xsl:text>
593
- </xsl:if>
594
- <xsl:if test="$document-root//term">
595
- <xsl:text>\newcommand{\terminology}[1]{\textbf{#1}}&#xa;</xsl:text>
596
- </xsl:if>
597
- <xsl:if test="$document-root//pubtitle">
598
- <xsl:text>\newcommand{\pubtitle}[1]{\textsl{#1}}&#xa;</xsl:text>
599
- </xsl:if>
600
- <xsl:if test="$document-root//fillin[not(parent::m or parent::me or parent::men or parent::mrow)]">
601
- <xsl:call-template name="fillin-text"/>
602
- </xsl:if>
603
- <xsl:if test="$document-root//m/fillin|$document-root//me/fillin|$document-root//men/fillin|$document-root//mrow/fillin">
604
- <xsl:call-template name="fillin-math"/>
605
- </xsl:if>
606
- <xsl:if test="$document-root//swungdash">
607
- <xsl:text>\newcommand{\swungdash}{\raisebox{-2.25ex}{\scalebox{2}{\~{}}}}&#xa;</xsl:text>
608
- </xsl:if>
609
- <xsl:if test="$document-root//quantity">
610
- <xsl:text>%% Used for units and number formatting&#xa;</xsl:text>
611
- <xsl:text>\usepackage[per-mode=fraction]{siunitx}&#xa;</xsl:text>
612
- <xsl:text>\sisetup{inter-unit-product=\cdot}&#xa;</xsl:text>
613
- <xsl:text>\ifxetex\sisetup{math-micro=\text{µ},text-micro=µ}\fi&#xa;</xsl:text>
614
- <xsl:text>\ifluatex\sisetup{math-micro=\text{µ},text-micro=µ}\fi&#xa;</xsl:text>
615
- <xsl:text>%% Common non-SI units&#xa;</xsl:text>
616
- <xsl:for-each select="document('pretext-units.xsl')//base[@siunitx]">
617
- <xsl:text>\DeclareSIUnit\</xsl:text>
618
- <xsl:value-of select="@full" />
619
- <xsl:text>{</xsl:text>
620
- <xsl:choose>
621
- <xsl:when test="@siunitx='none'">
622
- <xsl:value-of select="@short" />
623
- </xsl:when>
624
- <xsl:otherwise>
625
- <xsl:value-of select="@siunitx" />
626
- </xsl:otherwise>
627
- </xsl:choose>
628
- <xsl:text>}&#xa;</xsl:text>
629
- </xsl:for-each>
630
- </xsl:if>
631
- <xsl:if test="$document-root//case[@direction]">
632
- <xsl:text>%% Arrows for iff proofs, with trailing space&#xa;</xsl:text>
633
- <xsl:text>\newcommand{\forwardimplication}{($\Rightarrow$)}&#xa;</xsl:text>
634
- <xsl:text>\newcommand{\backwardimplication}{($\Leftarrow$)}&#xa;</xsl:text>
635
- </xsl:if>
636
- <xsl:if test="$document-root//ol/li/title|$document-root//ul/li/title">
637
- <xsl:text>%% Style of a title on a list item, for ordered and unordered lists&#xa;</xsl:text>
638
- <xsl:text>\newcommand{\lititle}[1]{{\slshape#1}}&#xa;</xsl:text>
639
- </xsl:if>
640
- <xsl:if test="$document-root//xref">
641
- <xsl:text>%% Font for cross-reference numbers, a no-op on slides&#xa;</xsl:text>
642
- <xsl:text>\newcommand{\xreffont}{}&#xa;</xsl:text>
643
- </xsl:if>
644
- <xsl:text>%% End: Semantic Macros&#xa;</xsl:text>
645
- <xsl:if test="$latex.preamble.late != ''">
646
- <xsl:text>%% Custom Preamble Entries, late (use latex.preamble.late)&#xa;</xsl:text>
647
- <xsl:value-of select="$latex.preamble.late" />
648
- <xsl:text>&#xa;</xsl:text>
649
- </xsl:if>
650
- <xsl:if test="$docinfo/macros">
651
- <xsl:text>%% Custom macros (docinfo/macros)&#xa;</xsl:text>
652
- <xsl:value-of select="$docinfo/macros"/>
653
- <xsl:text>&#xa;</xsl:text>
654
- </xsl:if>
655
- <xsl:if test="$latex-image-preamble">
656
- <xsl:text>%% Graphics Preamble Entries&#xa;</xsl:text>
657
- <xsl:value-of select="$latex-image-preamble"/>
658
- </xsl:if>
659
- <xsl:text>&#xa;%%%% End of PreTeXt generated preamble %%%%&#xa;&#xa;</xsl:text>
660
- </xsl:template>
661
-
662
- </xsl:stylesheet>
1
+ <?xml version='1.0'?>
2
+
3
+ <!--********************************************************************
4
+ Copyright 2020 Oscar Levin, Andrew Rechnitzer, Steven Clontz, Robert A. Beezer
5
+
6
+ This file is part of PreTeXt.
7
+
8
+ PreTeXt is free software: you can redistribute it and/or modify
9
+ it under the terms of the GNU General Public License as published by
10
+ the Free Software Foundation, either version 2 or version 3 of the
11
+ License (at your option).
12
+
13
+ PreTeXt is distributed in the hope that it will be useful,
14
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
15
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
+ GNU General Public License for more details.
17
+
18
+ You should have received a copy of the GNU General Public License
19
+ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
20
+ *********************************************************************-->
21
+
22
+ <!DOCTYPE xsl:stylesheet [
23
+ <!ENTITY % entities SYSTEM "./entities.ent">
24
+ %entities;
25
+ ]>
26
+
27
+ <!-- A "slideshow" realized as a LaTeX/Beamer presentation. -->
28
+ <!-- -->
29
+ <!-- Modeled on the reveal.js conversion: import the full parent -->
30
+ <!-- conversion (LaTeX), which supplies inline markup, mathematics, -->
31
+ <!-- images, tables, programs, side-by-side, and so on. Override -->
32
+ <!-- the entry point and the structure ("slideshow", "section", -->
33
+ <!-- "slide", "subslide"), pauses, and the block elements, which -->
34
+ <!-- become native Beamer environments. -->
35
+ <!-- -->
36
+ <!-- Lists are implemented here, and NOT inherited: the LaTeX -->
37
+ <!-- conversion's lists rely on the "enumitem" package, which -->
38
+ <!-- interferes with Beamer's own list machinery (especially -->
39
+ <!-- overlays); Beamer's native lists are used instead. -->
40
+ <xsl:stylesheet
41
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
42
+ xmlns:xml="http://www.w3.org/XML/1998/namespace"
43
+ xmlns:exsl="http://exslt.org/common"
44
+ xmlns:date="http://exslt.org/dates-and-times"
45
+ extension-element-prefixes="exsl date"
46
+ >
47
+
48
+ <xsl:import href="./pretext-latex.xsl" />
49
+
50
+ <xsl:output method="text" indent="no" encoding="UTF-8"/>
51
+
52
+ <!-- The Beamer theme, an author/publisher choice. A string parameter -->
53
+ <!-- until slideshow options mature in the publisher file. -->
54
+ <xsl:param name="beamer.theme" select="'Boadilla'"/>
55
+
56
+ <!-- Blocks on slides never carry a LaTeX \label, so cross-reference -->
57
+ <!-- numbers are hard-coded rather than realized through \ref -->
58
+ <xsl:variable name="b-latex-hardcode-numbers" select="true()"/>
59
+
60
+ <!-- ############## -->
61
+ <!-- Entry Template -->
62
+ <!-- ############## -->
63
+
64
+ <!-- Mirror the LaTeX conversion's entry template: warnings are -->
65
+ <!-- computed on the original source, and we process the enhanced -->
66
+ <!-- source produced by the assembly stylesheet (so generated -->
67
+ <!-- images, WeBWorK representations, and their friends all exist). -->
68
+ <xsl:template match="/">
69
+ <xsl:call-template name="banner-warning">
70
+ <xsl:with-param name="warning">Conversion to Beamer presentations/slideshows is experimental&#xa;Requests for additional specific constructions welcome&#xa;Additional PreTeXt elements are subject to change</xsl:with-param>
71
+ </xsl:call-template>
72
+ <xsl:apply-templates select="$original" mode="generic-warnings"/>
73
+ <xsl:apply-templates select="$original" mode="element-deprecation-warnings"/>
74
+ <xsl:apply-templates select="$original" mode="parameter-deprecation-warnings"/>
75
+ <xsl:apply-templates select="$root"/>
76
+ </xsl:template>
77
+
78
+ <xsl:template match="/mathbook|/pretext">
79
+ <xsl:apply-templates select="slideshow"/>
80
+ </xsl:template>
81
+
82
+ <!-- ################ -->
83
+ <!-- Document Shell -->
84
+ <!-- ################ -->
85
+
86
+ <xsl:template match="slideshow">
87
+ <xsl:call-template name="converter-blurb-latex" />
88
+ <xsl:call-template name="beamer-preamble"/>
89
+ <xsl:text>\begin{document}&#xa;&#xa;</xsl:text>
90
+ <xsl:apply-templates select="frontmatter"/>
91
+ <!-- an overview of the sections, when there are sections -->
92
+ <xsl:if test="section">
93
+ <xsl:text>\begin{frame}&#xa;</xsl:text>
94
+ <xsl:text>\frametitle{</xsl:text>
95
+ <xsl:apply-templates select="." mode="type-name">
96
+ <xsl:with-param name="string-id" select="'toc'"/>
97
+ </xsl:apply-templates>
98
+ <xsl:text>}&#xa;</xsl:text>
99
+ <xsl:text>\tableofcontents&#xa;</xsl:text>
100
+ <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
101
+ </xsl:if>
102
+ <xsl:apply-templates select="section|slide"/>
103
+ <xsl:text>\end{document}&#xa;</xsl:text>
104
+ </xsl:template>
105
+
106
+ <!-- ########### -->
107
+ <!-- Frontmatter -->
108
+ <!-- ########### -->
109
+
110
+ <!-- Title, subtitle, authors, event, date become Beamer's title -->
111
+ <!-- page material, on a plain frame. An optional "abstract" -->
112
+ <!-- follows on a frame of its own. -->
113
+ <xsl:template match="slideshow/frontmatter">
114
+ <xsl:text>\title{</xsl:text>
115
+ <xsl:apply-templates select="parent::slideshow" mode="title-full"/>
116
+ <xsl:text>}&#xa;</xsl:text>
117
+ <xsl:if test="parent::slideshow/subtitle">
118
+ <xsl:text>\subtitle{</xsl:text>
119
+ <xsl:apply-templates select="parent::slideshow" mode="subtitle"/>
120
+ <xsl:text>}&#xa;</xsl:text>
121
+ </xsl:if>
122
+ <!-- short form (names only) for theme footlines -->
123
+ <xsl:text>\author[</xsl:text>
124
+ <xsl:for-each select="$bibinfo/author">
125
+ <xsl:apply-templates select="personname"/>
126
+ <xsl:if test="following-sibling::author">
127
+ <xsl:text>, </xsl:text>
128
+ </xsl:if>
129
+ </xsl:for-each>
130
+ <xsl:text>]{</xsl:text>
131
+ <xsl:for-each select="$bibinfo/author">
132
+ <xsl:apply-templates select="personname"/>
133
+ <!-- assembly wraps a bare "institution" in an "affiliation" -->
134
+ <xsl:if test="affiliation/institution|institution">
135
+ <xsl:text>\\ {\small </xsl:text>
136
+ <xsl:apply-templates select="(affiliation/institution|institution)[1]/node()"/>
137
+ <xsl:text>}</xsl:text>
138
+ </xsl:if>
139
+ <xsl:if test="following-sibling::author">
140
+ <xsl:text> \and </xsl:text>
141
+ </xsl:if>
142
+ </xsl:for-each>
143
+ <xsl:text>}&#xa;</xsl:text>
144
+ <xsl:text>\date{</xsl:text>
145
+ <xsl:if test="$bibinfo/event">
146
+ <xsl:apply-templates select="$bibinfo/event"/>
147
+ <xsl:if test="$bibinfo/date">
148
+ <xsl:text>\\ </xsl:text>
149
+ </xsl:if>
150
+ </xsl:if>
151
+ <xsl:if test="$bibinfo/date">
152
+ <xsl:apply-templates select="$bibinfo/date"/>
153
+ </xsl:if>
154
+ <xsl:text>}&#xa;&#xa;</xsl:text>
155
+ <xsl:text>\begin{frame}[plain]&#xa;</xsl:text>
156
+ <xsl:text>\titlepage&#xa;</xsl:text>
157
+ <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
158
+ <xsl:apply-templates select="abstract"/>
159
+ </xsl:template>
160
+
161
+ <xsl:template match="slideshow/frontmatter/abstract">
162
+ <xsl:text>\begin{frame}&#xa;</xsl:text>
163
+ <xsl:text>\frametitle{</xsl:text>
164
+ <xsl:apply-templates select="." mode="type-name"/>
165
+ <xsl:text>}&#xa;</xsl:text>
166
+ <xsl:apply-templates/>
167
+ <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
168
+ </xsl:template>
169
+
170
+ <!-- ######################## -->
171
+ <!-- Sections, Slides, Pauses -->
172
+ <!-- ######################## -->
173
+
174
+ <!-- A "section" is a Beamer section (navigation, table of contents) -->
175
+ <!-- with a section-title frame, as in the reveal.js conversion. -->
176
+ <xsl:template match="slideshow/section">
177
+ <xsl:text>&#xa;\section{</xsl:text>
178
+ <xsl:apply-templates select="." mode="title-full"/>
179
+ <xsl:text>}&#xa;</xsl:text>
180
+ <xsl:text>\begin{frame}&#xa;</xsl:text>
181
+ <xsl:text>\sectionpage&#xa;</xsl:text>
182
+ <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
183
+ <xsl:apply-templates select="slide"/>
184
+ </xsl:template>
185
+
186
+ <!-- A "slide" is a frame. A frame whose content includes anything -->
187
+ <!-- realized through the "listings" package (or other verbatim-like -->
188
+ <!-- material) must be marked "fragile". -->
189
+ <xsl:template match="slide">
190
+ <xsl:text>\begin{frame}</xsl:text>
191
+ <xsl:if test="descendant::program or descendant::console or descendant::sage or descendant::cd or descendant::pre">
192
+ <xsl:text>[fragile]</xsl:text>
193
+ </xsl:if>
194
+ <xsl:text>&#xa;</xsl:text>
195
+ <xsl:text>\frametitle{</xsl:text>
196
+ <xsl:apply-templates select="." mode="title-full"/>
197
+ <xsl:text>}&#xa;</xsl:text>
198
+ <xsl:apply-templates/>
199
+ <xsl:text>\end{frame}&#xa;&#xa;</xsl:text>
200
+ </xsl:template>
201
+
202
+ <!-- A "subslide" is material that appears, as one group, after an -->
203
+ <!-- advance of the slideshow. Beamer's \pause would also suppress -->
204
+ <!-- everything *after* the group, but material following a subslide -->
205
+ <!-- is visible from the outset (as with reveal.js "fragments"), so -->
206
+ <!-- we uncover the group on the next pause step and leave the -->
207
+ <!-- surroundings alone. -->
208
+ <xsl:template match="subslide">
209
+ <xsl:text>\uncover&lt;+(1)-&gt;{%&#xa;</xsl:text>
210
+ <xsl:apply-templates/>
211
+ <xsl:text>}%&#xa;</xsl:text>
212
+ </xsl:template>
213
+
214
+ <!-- A paragraph may pause before it appears; identical device -->
215
+ <xsl:template match="slide//p[@pause = 'yes']">
216
+ <xsl:text>\uncover&lt;+(1)-&gt;{%&#xa;</xsl:text>
217
+ <xsl:apply-imports/>
218
+ <xsl:text>}%&#xa;</xsl:text>
219
+ </xsl:template>
220
+
221
+ <!-- ##### -->
222
+ <!-- Lists -->
223
+ <!-- ##### -->
224
+
225
+ <!-- Beamer's native lists, since the inherited lists rely on the -->
226
+ <!-- "enumitem" package, which fights Beamer. A list with pauses -->
227
+ <!-- gets the incremental default overlay specification, item by -->
228
+ <!-- item, matching the reveal.js conversion's fragments. -->
229
+
230
+ <!-- An "ol" marker passes through as a Beamer "mini-template", -->
231
+ <!-- where the characters A, a, I, i, 1 are the counter formats, -->
232
+ <!-- consonant with PreTeXt marker conventions -->
233
+ <xsl:template match="slide//ol">
234
+ <xsl:call-template name="begin-list-columns"/>
235
+ <xsl:text>\begin{enumerate}</xsl:text>
236
+ <xsl:if test="@pause = 'yes'">
237
+ <xsl:text>[&lt;+-&gt;]</xsl:text>
238
+ </xsl:if>
239
+ <xsl:if test="@marker">
240
+ <xsl:text>[</xsl:text>
241
+ <xsl:value-of select="@marker"/>
242
+ <xsl:text>]</xsl:text>
243
+ </xsl:if>
244
+ <xsl:text>&#xa;</xsl:text>
245
+ <xsl:apply-templates select="li"/>
246
+ <xsl:text>\end{enumerate}&#xa;</xsl:text>
247
+ <xsl:call-template name="end-list-columns"/>
248
+ </xsl:template>
249
+
250
+ <xsl:template match="slide//ul">
251
+ <xsl:call-template name="begin-list-columns"/>
252
+ <xsl:text>\begin{itemize}</xsl:text>
253
+ <xsl:if test="@pause = 'yes'">
254
+ <xsl:text>[&lt;+-&gt;]</xsl:text>
255
+ </xsl:if>
256
+ <xsl:text>&#xa;</xsl:text>
257
+ <xsl:apply-templates select="li"/>
258
+ <xsl:text>\end{itemize}&#xa;</xsl:text>
259
+ <xsl:call-template name="end-list-columns"/>
260
+ </xsl:template>
261
+
262
+ <xsl:template match="slide//dl">
263
+ <xsl:text>\begin{description}</xsl:text>
264
+ <xsl:if test="@pause = 'yes'">
265
+ <xsl:text>[&lt;+-&gt;]</xsl:text>
266
+ </xsl:if>
267
+ <xsl:text>&#xa;</xsl:text>
268
+ <xsl:apply-templates select="li"/>
269
+ <xsl:text>\end{description}&#xa;</xsl:text>
270
+ </xsl:template>
271
+
272
+ <!-- Multiple columns via the "multicol" package (in the preamble) -->
273
+ <xsl:template name="begin-list-columns">
274
+ <xsl:if test="@cols and (@cols != 1)">
275
+ <xsl:text>\begin{multicols}{</xsl:text>
276
+ <xsl:value-of select="@cols"/>
277
+ <xsl:text>}&#xa;</xsl:text>
278
+ </xsl:if>
279
+ </xsl:template>
280
+
281
+ <xsl:template name="end-list-columns">
282
+ <xsl:if test="@cols and (@cols != 1)">
283
+ <xsl:text>\end{multicols}&#xa;</xsl:text>
284
+ </xsl:if>
285
+ </xsl:template>
286
+
287
+ <xsl:template match="slide//ol/li|slide//ul/li">
288
+ <xsl:text>\item{}</xsl:text>
289
+ <xsl:if test="title">
290
+ <xsl:text> \lititle{</xsl:text>
291
+ <xsl:apply-templates select="." mode="title-full"/>
292
+ <xsl:text>}\par</xsl:text>
293
+ </xsl:if>
294
+ <xsl:text> </xsl:text>
295
+ <xsl:apply-templates/>
296
+ <xsl:text>&#xa;</xsl:text>
297
+ </xsl:template>
298
+
299
+ <!-- The title becomes Beamer's description label -->
300
+ <xsl:template match="slide//dl/li">
301
+ <xsl:text>\item[</xsl:text>
302
+ <xsl:apply-templates select="." mode="title-full"/>
303
+ <xsl:text>] </xsl:text>
304
+ <xsl:apply-templates/>
305
+ <xsl:text>&#xa;</xsl:text>
306
+ </xsl:template>
307
+
308
+ <!-- ###### -->
309
+ <!-- Blocks -->
310
+ <!-- ###### -->
311
+
312
+ <!-- Blocks become native Beamer environments, which the theme -->
313
+ <!-- styles. Beamer predefines "definition", "theorem", -->
314
+ <!-- "corollary", "lemma", "fact", "example", "proof" and the -->
315
+ <!-- generic titled "block". Blocks are not numbered on slides. -->
316
+
317
+ <xsl:template match="&DEFINITION-LIKE;" priority="1">
318
+ <xsl:call-template name="beamer-environment">
319
+ <xsl:with-param name="environment" select="'definition'"/>
320
+ </xsl:call-template>
321
+ </xsl:template>
322
+
323
+ <xsl:template match="theorem|corollary|lemma|fact" priority="1">
324
+ <xsl:call-template name="beamer-environment">
325
+ <xsl:with-param name="environment" select="local-name(.)"/>
326
+ </xsl:call-template>
327
+ </xsl:template>
328
+
329
+ <xsl:template match="&EXAMPLE-LIKE;" priority="1">
330
+ <xsl:call-template name="beamer-environment">
331
+ <xsl:with-param name="environment" select="'example'"/>
332
+ </xsl:call-template>
333
+ </xsl:template>
334
+
335
+ <!-- Everything else theorem-ish, plus remarks and asides, is a -->
336
+ <!-- generic Beamer "block" headed by its type-name and title -->
337
+ <xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&ASIDE-LIKE;|&GOAL-LIKE;|assemblage">
338
+ <xsl:text>\begin{block}{</xsl:text>
339
+ <xsl:apply-templates select="." mode="type-name"/>
340
+ <xsl:if test="title">
341
+ <xsl:text>: </xsl:text>
342
+ <xsl:apply-templates select="." mode="title-full"/>
343
+ </xsl:if>
344
+ <xsl:text>}&#xa;</xsl:text>
345
+ <xsl:apply-templates select="*[not(&PROOF-FILTER;)]"/>
346
+ <xsl:text>\end{block}&#xa;</xsl:text>
347
+ <xsl:apply-templates select="&PROOF-LIKE;"/>
348
+ </xsl:template>
349
+
350
+ <!-- The common core: the environment, an optional title in the -->
351
+ <!-- optional argument, the guts, and any proof following outside -->
352
+ <xsl:template name="beamer-environment">
353
+ <xsl:param name="environment"/>
354
+ <xsl:text>\begin{</xsl:text>
355
+ <xsl:value-of select="$environment"/>
356
+ <xsl:text>}</xsl:text>
357
+ <xsl:if test="title">
358
+ <xsl:text>[</xsl:text>
359
+ <xsl:apply-templates select="." mode="title-full"/>
360
+ <xsl:text>]</xsl:text>
361
+ </xsl:if>
362
+ <xsl:text>&#xa;</xsl:text>
363
+ <xsl:apply-templates select="*[not(&PROOF-FILTER;)]"/>
364
+ <xsl:text>\end{</xsl:text>
365
+ <xsl:value-of select="$environment"/>
366
+ <xsl:text>}&#xa;</xsl:text>
367
+ <xsl:apply-templates select="&PROOF-LIKE;"/>
368
+ </xsl:template>
369
+
370
+ <xsl:template match="&PROOF-LIKE;">
371
+ <xsl:text>\begin{proof}&#xa;</xsl:text>
372
+ <xsl:apply-templates/>
373
+ <xsl:text>\end{proof}&#xa;</xsl:text>
374
+ </xsl:template>
375
+
376
+ <!-- "statement" is a pure container in this context -->
377
+ <xsl:template match="statement">
378
+ <xsl:apply-templates/>
379
+ </xsl:template>
380
+
381
+ <!-- Metadata of blocks, handled elsewhere or meaningless on a slide -->
382
+ <xsl:template match="notation"/>
383
+
384
+ <!-- ####### -->
385
+ <!-- Figures -->
386
+ <!-- ####### -->
387
+
388
+ <!-- The LaTeX conversion realizes captioned items through generated -->
389
+ <!-- environments of its styling scheme, which Beamer does not carry. -->
390
+ <!-- On a slide there is no numbering, so a caption or title is just -->
391
+ <!-- a small centered legend after the content. -->
392
+ <xsl:template match="&FIGURE-LIKE;" priority="1">
393
+ <xsl:text>\begin{center}&#xa;</xsl:text>
394
+ <xsl:apply-templates select="*[not(self::caption)]"/>
395
+ <xsl:choose>
396
+ <xsl:when test="caption">
397
+ <xsl:text>\par\smallskip{}{\small{}</xsl:text>
398
+ <xsl:apply-templates select="caption/node()"/>
399
+ <xsl:text>}&#xa;</xsl:text>
400
+ </xsl:when>
401
+ <xsl:when test="title">
402
+ <xsl:text>\par\smallskip{}{\small{}</xsl:text>
403
+ <xsl:apply-templates select="." mode="title-full"/>
404
+ <xsl:text>}&#xa;</xsl:text>
405
+ </xsl:when>
406
+ <xsl:otherwise/>
407
+ </xsl:choose>
408
+ <xsl:text>\end{center}&#xa;</xsl:text>
409
+ </xsl:template>
410
+
411
+ <!-- ################ -->
412
+ <!-- Cross-References -->
413
+ <!-- ################ -->
414
+
415
+ <!-- The content of a cross-reference is computed by the -common -->
416
+ <!-- machinery; on a slide we do not make it a hyperlink, since the -->
417
+ <!-- likely target is a nearby slide with no useful anchor in a PDF. -->
418
+ <xsl:template match="*" mode="xref-link">
419
+ <xsl:param name="target"/>
420
+ <xsl:param name="content"/>
421
+ <xsl:copy-of select="$content"/>
422
+ </xsl:template>
423
+
424
+ <!-- Every number in a cross-reference is hard-coded: no block on a -->
425
+ <!-- slide carries a LaTeX \label, so \ref has nothing to resolve. -->
426
+ <xsl:template match="*" mode="xref-number">
427
+ <xsl:param name="xref" select="/.." />
428
+ <xsl:apply-templates select="." mode="xref-number-hardcoded">
429
+ <xsl:with-param name="xref" select="$xref"/>
430
+ </xsl:apply-templates>
431
+ </xsl:template>
432
+
433
+ <!-- ######## -->
434
+ <!-- Preamble -->
435
+ <!-- ######## -->
436
+
437
+ <!-- N.B. Portions of this preamble duplicate fragments of the LaTeX -->
438
+ <!-- conversion's preamble, since the inherited content templates -->
439
+ <!-- presume supporting macros and environments ("image", "sidebyside" -->
440
+ <!-- and "sbspanel", "program", "console", "sageinput"/"sageoutput", -->
441
+ <!-- tabular rules, semantic macros). Re-architecting the LaTeX -->
442
+ <!-- preamble into shareable pieces would remove the duplication. -->
443
+ <xsl:template name="beamer-preamble">
444
+ <xsl:text>\documentclass[11pt, compress]{beamer}&#xa;</xsl:text>
445
+ <xsl:if test="$latex.preamble.early != ''">
446
+ <xsl:text>%% Custom Preamble Entries, early (use latex.preamble.early)&#xa;</xsl:text>
447
+ <xsl:value-of select="$latex.preamble.early" />
448
+ <xsl:text>&#xa;</xsl:text>
449
+ </xsl:if>
450
+ <xsl:text>\usetheme{</xsl:text>
451
+ <xsl:value-of select="$beamer.theme"/>
452
+ <xsl:text>}&#xa;</xsl:text>
453
+ <xsl:text>\usefonttheme[onlymath]{serif}&#xa;</xsl:text>
454
+ <xsl:text>%% quash navigation symbols&#xa;</xsl:text>
455
+ <xsl:text>\setbeamertemplate{navigation symbols}{}&#xa;</xsl:text>
456
+ <xsl:text>%% every "section" gets a section-title frame via \sectionpage&#xa;</xsl:text>
457
+ <xsl:text>&#xa;%%%% Start PreTeXt generated preamble %%%%&#xa;&#xa;</xsl:text>
458
+ <xsl:text>\usepackage{amsmath}&#xa;</xsl:text>
459
+ <xsl:text>%% fonts: the inherited templates emit T1-encoded glyph names&#xa;</xsl:text>
460
+ <xsl:text>%% (such as \textquotedbl), so match the LaTeX conversion's setup&#xa;</xsl:text>
461
+ <xsl:text>\ifPDFTeX&#xa;</xsl:text>
462
+ <xsl:text>\usepackage[T1]{fontenc}&#xa;</xsl:text>
463
+ <xsl:text>\else&#xa;</xsl:text>
464
+ <xsl:text>\usepackage{fontspec}&#xa;</xsl:text>
465
+ <xsl:text>\fi&#xa;</xsl:text>
466
+ <xsl:text>%% Some aspects of the preamble are conditional,&#xa;</xsl:text>
467
+ <xsl:text>%% the LaTeX engine is one such determinant&#xa;</xsl:text>
468
+ <xsl:text>\usepackage{ifthen}&#xa;</xsl:text>
469
+ <xsl:text>\newcommand{\tabularfont}{}&#xa;</xsl:text>
470
+ <xsl:text>\usepackage[xparse, raster]{tcolorbox}&#xa;</xsl:text>
471
+ <xsl:text>\tcbset{colback=white, colframe=white}&#xa;</xsl:text>
472
+ <xsl:text>%% tcolorbox styles used by images and side-by-side panels&#xa;</xsl:text>
473
+ <xsl:text>\tcbset{ bwminimalstyle/.style={size=minimal, boxrule=-0.3pt, frame empty,&#xa;</xsl:text>
474
+ <xsl:text>colback=white, colbacktitle=white, coltitle=black, opacityfill=0.0} }&#xa;</xsl:text>
475
+ <xsl:if test="$document-root//image">
476
+ <xsl:text>%% "tcolorbox" environment for a single image, as in the LaTeX conversion&#xa;</xsl:text>
477
+ <xsl:text>\tcbset{ imagestyle/.style={bwminimalstyle} }&#xa;</xsl:text>
478
+ <xsl:text>\NewTColorBox{tcbimage}{mmm}{imagestyle,left skip=#1\linewidth,width=#2\linewidth}&#xa;</xsl:text>
479
+ <xsl:text>\NewDocumentEnvironment{image}{mmmm}{\notblank{#4}{\leavevmode\nopagebreak\vspace{#4}}{}\begin{tcbimage}{#1}{#2}{#3}}{\end{tcbimage}%&#xa;}</xsl:text>
480
+ <xsl:text>&#xa;</xsl:text>
481
+ </xsl:if>
482
+ <xsl:if test="$document-root//ol[@cols]|$document-root//ul[@cols]">
483
+ <xsl:text>%% Multiple column lists&#xa;</xsl:text>
484
+ <xsl:text>\usepackage{multicol}&#xa;</xsl:text>
485
+ </xsl:if>
486
+ <xsl:if test="$b-has-program or $b-has-console or $b-has-sage">
487
+ <xsl:text>%% Program listing support: for listings, programs, consoles, and Sage code&#xa;</xsl:text>
488
+ <xsl:text>\ifthenelse{\boolean{xetex} \or \boolean{luatex}}%&#xa;</xsl:text>
489
+ <xsl:text> {\tcbuselibrary{listings}}%&#xa;</xsl:text>
490
+ <xsl:text> {\tcbuselibrary{listingsutf8}}%&#xa;</xsl:text>
491
+ <xsl:text>%% A null language, free of any formatting or style&#xa;</xsl:text>
492
+ <xsl:text>\lstdefinelanguage{none}{identifierstyle=,commentstyle=,stringstyle=,keywordstyle=}&#xa;</xsl:text>
493
+ <xsl:if test="$b-has-program">
494
+ <xsl:text>%% Colors match a subset of Google prettify "Default" style&#xa;</xsl:text>
495
+ <xsl:text>\definecolor{identifiers}{rgb}{0.375,0,0.375}&#xa;</xsl:text>
496
+ <xsl:text>\definecolor{comments}{rgb}{0.5,0,0}&#xa;</xsl:text>
497
+ <xsl:text>\definecolor{strings}{rgb}{0,0.5,0}&#xa;</xsl:text>
498
+ <xsl:text>\definecolor{keywords}{rgb}{0,0,0.5}&#xa;</xsl:text>
499
+ <xsl:text>\lstdefinestyle{programcodestyle}{identifierstyle=\color{identifiers},commentstyle=\color{comments},stringstyle=\color{strings},keywordstyle=\color{keywords}, breaklines=true, breakatwhitespace=true, columns=fixed, extendedchars=true, aboveskip=0pt, belowskip=0pt}&#xa;</xsl:text>
500
+ <xsl:text>\lstdefinestyle{programcodenumberedstyle}{style=programcodestyle, numbers=left}&#xa;</xsl:text>
501
+ <xsl:text>\tcbset{ programboxstyle/.style={left=3ex, right=0pt, top=0ex, bottom=0ex, middle=0pt, toptitle=0pt, bottomtitle=0pt, boxsep=0pt, &#xa;</xsl:text>
502
+ <xsl:text>listing only, fontupper=\small\ttfamily,&#xa;</xsl:text>
503
+ <xsl:text>colback=white, sharp corners, boxrule=-0.3pt, leftrule=0.5pt,&#xa;</xsl:text>
504
+ <xsl:text>parbox=false,&#xa;</xsl:text>
505
+ <xsl:text>} }&#xa;</xsl:text>
506
+ <xsl:text>\tcbset{ programboxnumberedstyle/.style={programboxstyle, left=6ex} }&#xa;</xsl:text>
507
+ <xsl:text>%% Arguments: language, left margin, width, right margin (latter ignored)&#xa;</xsl:text>
508
+ <xsl:text>\newtcblisting{program}[4]{programboxstyle, left skip=#2\linewidth, width=#3\linewidth, listing options={language=#1, style=programcodestyle}}&#xa;</xsl:text>
509
+ <xsl:text>\newtcblisting{programnumbered}[4]{programboxnumberedstyle, left skip=#2\linewidth, width=#3\linewidth, listing options={language=#1, style=programcodenumberedstyle}}&#xa;</xsl:text>
510
+ <xsl:text>\newcommand{\programfragment}[2]{\lstinline[language=#1, style=programcodestyle, basicstyle=\ttfamily]#2}&#xa;</xsl:text>
511
+ </xsl:if>
512
+ <xsl:if test="$b-has-console">
513
+ <xsl:text>%% Console session with prompt, input, output&#xa;</xsl:text>
514
+ <xsl:text>\newcommand{\consoleinput}[1]{\textbf{#1}}&#xa;</xsl:text>
515
+ <xsl:text>\lstdefinestyle{consolecodestyle}{language=none, escapeinside={(*}{*)}, identifierstyle=, commentstyle=, stringstyle=, keywordstyle=, breaklines=false, breakatwhitespace=false, columns=fixed, extendedchars=true, aboveskip=0pt, belowskip=0pt}&#xa;</xsl:text>
516
+ <xsl:text>\tcbset{ consoleboxstyle/.style={left=0pt, right=0pt, top=0ex, bottom=0ex, middle=0pt, toptitle=0pt, bottomtitle=0pt, boxsep=0pt,&#xa;</xsl:text>
517
+ <xsl:text>listing only, fontupper=\small\ttfamily,&#xa;</xsl:text>
518
+ <xsl:text>colback=white, boxrule=-0.3pt,&#xa;</xsl:text>
519
+ <xsl:text>parbox=false,&#xa;</xsl:text>
520
+ <xsl:text>} }&#xa;</xsl:text>
521
+ <xsl:text>%% Arguments: left margin, width, right margin (latter ignored)&#xa;</xsl:text>
522
+ <xsl:text>\newtcblisting{console}[3]{consoleboxstyle, left skip=#1\linewidth, width=#2\linewidth, listing options={style=consolecodestyle}}&#xa;</xsl:text>
523
+ </xsl:if>
524
+ <xsl:if test="$b-has-sage">
525
+ <xsl:text>%% The listings package as tcolorbox for Sage code&#xa;</xsl:text>
526
+ <xsl:text>\definecolor{sageblue}{HTML}{</xsl:text><xsl:value-of select="$sage-input-background"/><xsl:text>}&#xa;</xsl:text>
527
+ <xsl:text>\tcbset{ sagestyle/.style={left=0pt, right=0pt, top=0ex, bottom=0ex, middle=0pt, toptitle=0pt, bottomtitle=0pt,&#xa;</xsl:text>
528
+ <xsl:text>boxsep=4pt, listing only, fontupper=\small\ttfamily,&#xa;</xsl:text>
529
+ <xsl:text>parbox=false, &#xa;</xsl:text>
530
+ <xsl:text>listing options={language=Python,breaklines=true,breakatwhitespace=true, extendedchars=true, aboveskip=0pt, belowskip=0pt}} }&#xa;</xsl:text>
531
+ <xsl:text>\newtcblisting{sageinput}{sagestyle, colback=sageblue, sharp corners, boxrule=0.5pt, }&#xa;</xsl:text>
532
+ <xsl:text>\newtcblisting{sageoutput}{sagestyle, colback=white, colframe=white, frame empty, before skip=0pt, after skip=0pt, }&#xa;</xsl:text>
533
+ </xsl:if>
534
+ </xsl:if>
535
+ <xsl:if test="$document-root//sidebyside">
536
+ <xsl:text>%% tcolorbox styles for sidebyside layout&#xa;</xsl:text>
537
+ <xsl:text>\tcbset{ sbsstyle/.style={raster before skip=2.0ex, raster equal height=rows, raster force size=false} }&#xa;</xsl:text>
538
+ <xsl:text>\tcbset{ sbspanelstyle/.style={bwminimalstyle} }&#xa;</xsl:text>
539
+ <xsl:text>%% "xparse" environment for entire sidebyside&#xa;</xsl:text>
540
+ <xsl:text>\NewDocumentEnvironment{sidebyside}{mmmm}&#xa;</xsl:text>
541
+ <xsl:text> {\begin{tcbraster}&#xa;</xsl:text>
542
+ <xsl:text> [sbsstyle,raster columns=#1,&#xa;</xsl:text>
543
+ <xsl:text> raster left skip=#2\linewidth,raster right skip=#3\linewidth,raster column skip=#4\linewidth]}&#xa;</xsl:text>
544
+ <xsl:text> {\end{tcbraster}}&#xa;</xsl:text>
545
+ <xsl:text>%% "tcolorbox" environment for a panel of sidebyside&#xa;</xsl:text>
546
+ <xsl:text>\NewTColorBox{sbspanel}{mO{top}}{sbspanelstyle,width=#1\linewidth,valign=#2}&#xa;</xsl:text>
547
+ </xsl:if>
548
+ <xsl:if test="$document-root//tabular">
549
+ <xsl:text>%% For improved tables&#xa;</xsl:text>
550
+ <xsl:text>\usepackage{array}&#xa;</xsl:text>
551
+ <xsl:text>\setlength{\extrarowheight}{0.2ex}&#xa;</xsl:text>
552
+ <xsl:text>%% Variable thickness horizontal rules, full and partial&#xa;</xsl:text>
553
+ <xsl:text>\newcommand{\hrulethin} {\noalign{\hrule height 0.04em}}&#xa;</xsl:text>
554
+ <xsl:text>\newcommand{\hrulemedium}{\noalign{\hrule height 0.07em}}&#xa;</xsl:text>
555
+ <xsl:text>\newcommand{\hrulethick} {\noalign{\hrule height 0.11em}}&#xa;</xsl:text>
556
+ <xsl:text>\let\oldsetlength\setlength&#xa;</xsl:text>
557
+ <xsl:text>\newlength{\Oldarrayrulewidth}&#xa;</xsl:text>
558
+ <xsl:text>\newcommand{\crulethin}[1]%&#xa;</xsl:text>
559
+ <xsl:text>{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%&#xa;</xsl:text>
560
+ <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{0.04em}}\cline{#1}%&#xa;</xsl:text>
561
+ <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}%&#xa;</xsl:text>
562
+ <xsl:text>\newcommand{\crulemedium}[1]%&#xa;</xsl:text>
563
+ <xsl:text>{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%&#xa;</xsl:text>
564
+ <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{0.07em}}\cline{#1}%&#xa;</xsl:text>
565
+ <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}&#xa;</xsl:text>
566
+ <xsl:text>\newcommand{\crulethick}[1]%&#xa;</xsl:text>
567
+ <xsl:text>{\noalign{\global\oldsetlength{\Oldarrayrulewidth}{\arrayrulewidth}}%&#xa;</xsl:text>
568
+ <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{0.11em}}\cline{#1}%&#xa;</xsl:text>
569
+ <xsl:text>\noalign{\global\oldsetlength{\arrayrulewidth}{\Oldarrayrulewidth}}}&#xa;</xsl:text>
570
+ <xsl:text>%% Single letter column specifiers defined via array package&#xa;</xsl:text>
571
+ <xsl:text>\newcolumntype{A}{!{\vrule width 0.04em}}&#xa;</xsl:text>
572
+ <xsl:text>\newcolumntype{B}{!{\vrule width 0.07em}}&#xa;</xsl:text>
573
+ <xsl:text>\newcolumntype{C}{!{\vrule width 0.11em}}&#xa;</xsl:text>
574
+ </xsl:if>
575
+ <xsl:if test="$document-root//cell/line">
576
+ <xsl:text>\newcommand{\tablecelllines}[3]%&#xa;</xsl:text>
577
+ <xsl:text>{\begin{tabular}[#2]{@{}#1@{}}#3\end{tabular}}&#xa;</xsl:text>
578
+ </xsl:if>
579
+ <xsl:text>\newcommand{\lt}{&lt;}&#xa;</xsl:text>
580
+ <xsl:text>\newcommand{\gt}{&gt;}&#xa;</xsl:text>
581
+ <xsl:text>\newcommand{\amp}{&amp;}&#xa;</xsl:text>
582
+ <xsl:text>%% Begin: Semantic Macros&#xa;</xsl:text>
583
+ <xsl:text>\newcommand{\mono}[1]{\texttt{#1}}&#xa;</xsl:text>
584
+ <xsl:variable name="one-line-reps" select="
585
+ ($document-root//abbr)[1]|
586
+ ($document-root//acro)[1]|
587
+ ($document-root//init)[1]"/>
588
+ <xsl:for-each select="$one-line-reps">
589
+ <xsl:apply-templates select="." mode="tex-macro"/>
590
+ </xsl:for-each>
591
+ <xsl:if test="$document-root//alert">
592
+ <xsl:text>\newcommand{\alert}[1]{\textbf{\textit{#1}}}&#xa;</xsl:text>
593
+ </xsl:if>
594
+ <xsl:if test="$document-root//term">
595
+ <xsl:text>\newcommand{\terminology}[1]{\textbf{#1}}&#xa;</xsl:text>
596
+ </xsl:if>
597
+ <xsl:if test="$document-root//pubtitle">
598
+ <xsl:text>\newcommand{\pubtitle}[1]{\textsl{#1}}&#xa;</xsl:text>
599
+ </xsl:if>
600
+ <xsl:if test="$document-root//fillin[not(parent::m or parent::me or parent::men or parent::mrow)]">
601
+ <xsl:call-template name="fillin-text"/>
602
+ </xsl:if>
603
+ <xsl:if test="$document-root//m/fillin|$document-root//me/fillin|$document-root//men/fillin|$document-root//mrow/fillin">
604
+ <xsl:call-template name="fillin-math"/>
605
+ </xsl:if>
606
+ <xsl:if test="$document-root//swungdash">
607
+ <xsl:text>\newcommand{\swungdash}{\raisebox{-2.25ex}{\scalebox{2}{\~{}}}}&#xa;</xsl:text>
608
+ </xsl:if>
609
+ <xsl:if test="$document-root//quantity">
610
+ <xsl:text>%% Used for units and number formatting&#xa;</xsl:text>
611
+ <xsl:text>\usepackage[per-mode=fraction]{siunitx}&#xa;</xsl:text>
612
+ <xsl:text>\sisetup{inter-unit-product=\cdot}&#xa;</xsl:text>
613
+ <xsl:text>\ifxetex\sisetup{math-micro=\text{µ},text-micro=µ}\fi&#xa;</xsl:text>
614
+ <xsl:text>\ifluatex\sisetup{math-micro=\text{µ},text-micro=µ}\fi&#xa;</xsl:text>
615
+ <xsl:text>%% Common non-SI units&#xa;</xsl:text>
616
+ <xsl:for-each select="document('pretext-units.xsl')//base[@siunitx]">
617
+ <xsl:text>\DeclareSIUnit\</xsl:text>
618
+ <xsl:value-of select="@full" />
619
+ <xsl:text>{</xsl:text>
620
+ <xsl:choose>
621
+ <xsl:when test="@siunitx='none'">
622
+ <xsl:value-of select="@short" />
623
+ </xsl:when>
624
+ <xsl:otherwise>
625
+ <xsl:value-of select="@siunitx" />
626
+ </xsl:otherwise>
627
+ </xsl:choose>
628
+ <xsl:text>}&#xa;</xsl:text>
629
+ </xsl:for-each>
630
+ </xsl:if>
631
+ <xsl:if test="$document-root//case[@direction]">
632
+ <xsl:text>%% Arrows for iff proofs, with trailing space&#xa;</xsl:text>
633
+ <xsl:text>\newcommand{\forwardimplication}{($\Rightarrow$)}&#xa;</xsl:text>
634
+ <xsl:text>\newcommand{\backwardimplication}{($\Leftarrow$)}&#xa;</xsl:text>
635
+ </xsl:if>
636
+ <xsl:if test="$document-root//ol/li/title|$document-root//ul/li/title">
637
+ <xsl:text>%% Style of a title on a list item, for ordered and unordered lists&#xa;</xsl:text>
638
+ <xsl:text>\newcommand{\lititle}[1]{{\slshape#1}}&#xa;</xsl:text>
639
+ </xsl:if>
640
+ <xsl:if test="$document-root//xref">
641
+ <xsl:text>%% Font for cross-reference numbers, a no-op on slides&#xa;</xsl:text>
642
+ <xsl:text>\newcommand{\xreffont}{}&#xa;</xsl:text>
643
+ </xsl:if>
644
+ <xsl:text>%% End: Semantic Macros&#xa;</xsl:text>
645
+ <xsl:if test="$latex.preamble.late != ''">
646
+ <xsl:text>%% Custom Preamble Entries, late (use latex.preamble.late)&#xa;</xsl:text>
647
+ <xsl:value-of select="$latex.preamble.late" />
648
+ <xsl:text>&#xa;</xsl:text>
649
+ </xsl:if>
650
+ <xsl:if test="$docinfo/macros">
651
+ <xsl:text>%% Custom macros (docinfo/macros)&#xa;</xsl:text>
652
+ <xsl:value-of select="$docinfo/macros"/>
653
+ <xsl:text>&#xa;</xsl:text>
654
+ </xsl:if>
655
+ <xsl:if test="$latex-image-preamble">
656
+ <xsl:text>%% Graphics Preamble Entries&#xa;</xsl:text>
657
+ <xsl:value-of select="$latex-image-preamble"/>
658
+ </xsl:if>
659
+ <xsl:text>&#xa;%%%% End of PreTeXt generated preamble %%%%&#xa;&#xa;</xsl:text>
660
+ </xsl:template>
661
+
662
+ </xsl:stylesheet>