@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.
- package/README.md +42 -3
- package/assets/preview-html.xsl +230 -230
- package/assets/upstream.json +7 -7
- package/assets/xsl/README.md +0 -0
- package/assets/xsl/entities.ent +154 -154
- package/assets/xsl/extract-asymptote.xsl +68 -68
- package/assets/xsl/extract-biblio-csl.xsl +327 -327
- package/assets/xsl/extract-datafile.xsl +71 -71
- package/assets/xsl/extract-dynamic.xsl +139 -139
- package/assets/xsl/extract-identity.xsl +136 -136
- package/assets/xsl/extract-interactive.xsl +81 -81
- package/assets/xsl/extract-latex-image.xsl +118 -118
- package/assets/xsl/extract-mermaid.xsl +58 -58
- package/assets/xsl/extract-mom.xsl +63 -63
- package/assets/xsl/extract-pg.xsl +2897 -2897
- package/assets/xsl/extract-prefigure.xsl +157 -157
- package/assets/xsl/extract-qrcode.xsl +100 -100
- package/assets/xsl/extract-runestone-page-template.xsl +139 -139
- package/assets/xsl/extract-sageplot.xsl +166 -166
- package/assets/xsl/extract-stack.xsl +56 -56
- package/assets/xsl/extract-trace.xsl +134 -134
- package/assets/xsl/extract-youtube.xsl +63 -63
- package/assets/xsl/html-symbols.xsl +3344 -3344
- package/assets/xsl/latex/pretext-latex-AIM.xsl +56 -56
- package/assets/xsl/latex/pretext-latex-CLP.xsl +148 -148
- package/assets/xsl/latex/pretext-latex-chaos.xsl +317 -317
- package/assets/xsl/latex/pretext-latex-dyslexic-font.xsl +76 -76
- package/assets/xsl/latex/pretext-latex-guide.xsl +104 -104
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +862 -862
- package/assets/xsl/localizations/README.md +0 -0
- package/assets/xsl/localizations/af-ZA.xml +276 -276
- package/assets/xsl/localizations/bg-BG.xml +276 -276
- package/assets/xsl/localizations/ca-ES.xml +285 -285
- package/assets/xsl/localizations/cs-CZ.xml +280 -280
- package/assets/xsl/localizations/de-DE.xml +281 -281
- package/assets/xsl/localizations/en-US.xml +427 -427
- package/assets/xsl/localizations/es-ES.xml +287 -287
- package/assets/xsl/localizations/fi-FI.xml +275 -275
- package/assets/xsl/localizations/fr-CA.xml +276 -276
- package/assets/xsl/localizations/fr-FR.xml +280 -280
- package/assets/xsl/localizations/hu-HU.xml +280 -280
- package/assets/xsl/localizations/it-IT.xml +276 -276
- package/assets/xsl/localizations/ku-CKB.xml +275 -275
- package/assets/xsl/localizations/localizations.xml +48 -48
- package/assets/xsl/localizations/nl-NL.xml +275 -275
- package/assets/xsl/localizations/pt-BR.xml +288 -288
- package/assets/xsl/localizations/pt-PT.xml +292 -292
- package/assets/xsl/localizations/zh-HANS.xml +269 -269
- package/assets/xsl/pretext-assembly.xsl +4795 -4795
- package/assets/xsl/pretext-basic-html.xsl +86 -86
- package/assets/xsl/pretext-beamer.xsl +662 -662
- package/assets/xsl/pretext-braille-preprint.xsl +2249 -2249
- package/assets/xsl/pretext-common.xsl +12018 -12018
- package/assets/xsl/pretext-dynamic.xsl +65 -65
- package/assets/xsl/pretext-epub.xsl +1483 -1483
- package/assets/xsl/pretext-fo.xsl +4593 -4593
- package/assets/xsl/pretext-html.xsl +14791 -14791
- package/assets/xsl/pretext-json-manifest.xsl +150 -150
- package/assets/xsl/pretext-jupyter.xsl +868 -868
- package/assets/xsl/pretext-latex-classic.xsl +952 -952
- package/assets/xsl/pretext-latex-common.xsl +11563 -11563
- package/assets/xsl/pretext-latex.xsl +47 -47
- package/assets/xsl/pretext-litprog.xsl +105 -105
- package/assets/xsl/pretext-merge.xsl +41 -41
- package/assets/xsl/pretext-numbers.xsl +875 -875
- package/assets/xsl/pretext-revealjs.xsl +522 -522
- package/assets/xsl/pretext-runestone-fitb.xsl +1233 -1233
- package/assets/xsl/pretext-runestone-static.xsl +1438 -1438
- package/assets/xsl/pretext-runestone.xsl +3083 -3083
- package/assets/xsl/pretext-sage-doctest.xsl +289 -289
- package/assets/xsl/pretext-smc.xsl +492 -492
- package/assets/xsl/pretext-solution-manual-latex.xsl +323 -323
- package/assets/xsl/pretext-text-utilities.xsl +1217 -1217
- package/assets/xsl/pretext-text.xsl +392 -392
- package/assets/xsl/pretext-units.xsl +195 -195
- package/assets/xsl/pretext-view-source.xsl +157 -157
- package/assets/xsl/pretext-ww-problem-sets.xsl +391 -391
- package/assets/xsl/publisher-variables.xsl +4756 -4756
- package/assets/xsl/support/README.md +0 -0
- package/assets/xsl/support/extract-math.xsl +256 -256
- package/assets/xsl/support/package-math.xsl +141 -141
- package/assets/xsl/support/play-button/README.md +0 -0
- package/assets/xsl/support/play-button/play-button.png +0 -0
- package/assets/xsl/support/play-button/play-button.svg +3 -3
- package/assets/xsl/support/pretext-pg-macros.xsl +110 -110
- package/assets/xsl/support/webpack_static_imports.xml +14 -14
- package/assets/xsl/tests/README.md +0 -0
- package/assets/xsl/tests/null.xml +3 -3
- package/assets/xsl/tests/pretext-text-utilities-test.xsl +333 -333
- package/assets/xsl/utilities/README.md +0 -0
- package/assets/xsl/utilities/author-report.xsl +107 -107
- package/assets/xsl/utilities/deprecate-autoname.sed +18 -18
- package/assets/xsl/utilities/deprecate-index.sed +33 -33
- package/assets/xsl/utilities/fix-deprecations.xsl +663 -663
- package/assets/xsl/utilities/pretext-enhanced-source.xsl +112 -112
- package/assets/xsl/utilities/report-publisher-variables.xsl +162 -162
- package/assets/xsl/xml-to-json.xsl +326 -326
- package/assets/xsl/xml-to-string.xsl +328 -328
- package/dist/{cli-C6tfAVvi.js → cli-BQizBK0N.js} +74 -72
- package/dist/cli.d.ts +0 -0
- package/dist/cli.js +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +12 -6
- package/dist/mounts.d.ts +0 -0
- package/dist/publication.d.ts +0 -0
- package/dist/renderer.d.ts +10 -0
- package/dist/sourcemap.d.ts +0 -0
- package/dist/theme.d.ts +68 -0
- package/dist/theme.js +93 -0
- package/dist/xinclude.d.ts +0 -0
- package/package.json +14 -2
|
@@ -1,952 +1,952 @@
|
|
|
1
|
-
<?xml version='1.0'?>
|
|
2
|
-
|
|
3
|
-
<!--********************************************************************
|
|
4
|
-
Copyright 2020 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
|
-
|
|
23
|
-
<!-- WARNING: this is an experimental conversion for LaTeX -->
|
|
24
|
-
<!-- Use `pretext-latex.xsl` for the standard conversion. -->
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
<!-- Conveniences for classes of similar elements -->
|
|
28
|
-
<!DOCTYPE xsl:stylesheet [
|
|
29
|
-
<!ENTITY % entities SYSTEM "./entities.ent">
|
|
30
|
-
%entities;
|
|
31
|
-
]>
|
|
32
|
-
|
|
33
|
-
<!-- Identify as a stylesheet -->
|
|
34
|
-
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
35
|
-
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
36
|
-
>
|
|
37
|
-
|
|
38
|
-
<!-- We override specific templates of the common conversion -->
|
|
39
|
-
|
|
40
|
-
<xsl:import href="./pretext-latex-common.xsl" />
|
|
41
|
-
|
|
42
|
-
<!-- Note (2025-01-29): This is the start of a new "classic" -->
|
|
43
|
-
<!-- latex conversion that can be used to create journal-ready -->
|
|
44
|
-
<!-- latex documents. It is still a work in progress, although -->
|
|
45
|
-
<!-- it does now produce a working amsart latex file. -->
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
<xsl:template match="/">
|
|
49
|
-
<xsl:call-template name="banner-warning">
|
|
50
|
-
<xsl:with-param name="warning">You are using (a version of) the pretext-latex-classic conversion, which is still experimental and under development.</xsl:with-param>
|
|
51
|
-
</xsl:call-template>
|
|
52
|
-
<xsl:apply-imports />
|
|
53
|
-
</xsl:template>
|
|
54
|
-
|
|
55
|
-
<!-- Currently there are no changes for a book (or letter or memo), so we note this and exit -->
|
|
56
|
-
<xsl:template match="book|letter|memo">
|
|
57
|
-
<xsl:call-template name="banner-warning">
|
|
58
|
-
<xsl:with-param name="warning">You have selected a latex style designed for articles, but are not building an article. The resulting output will be identical to that of not specifying any latex style.</xsl:with-param>
|
|
59
|
-
</xsl:call-template>
|
|
60
|
-
</xsl:template>
|
|
61
|
-
|
|
62
|
-
<!-- Do not support exercises or reading questions or solutions -->
|
|
63
|
-
<xsl:template match="exercises|reading-questions|solutions">
|
|
64
|
-
<xsl:call-template name="banner-warning">
|
|
65
|
-
<xsl:with-param name="warning">Exercises divisions are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
66
|
-
</xsl:call-template>
|
|
67
|
-
</xsl:template>
|
|
68
|
-
|
|
69
|
-
<!-- Do not support glossary yet -->
|
|
70
|
-
<xsl:template match="glossary">
|
|
71
|
-
<xsl:call-template name="banner-warning">
|
|
72
|
-
<xsl:with-param name="warning">Glossary divisions are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
73
|
-
</xsl:call-template>
|
|
74
|
-
</xsl:template>
|
|
75
|
-
|
|
76
|
-
<xsl:template match="section//references">
|
|
77
|
-
<xsl:call-template name="banner-warning">
|
|
78
|
-
<xsl:with-param name="warning">References (bibliography) for individual sections are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken. You can still have a bibliography at the end of your article.</xsl:with-param>
|
|
79
|
-
</xsl:call-template>
|
|
80
|
-
</xsl:template>
|
|
81
|
-
|
|
82
|
-
<xsl:template match="worksheet">
|
|
83
|
-
<xsl:call-template name="banner-warning">
|
|
84
|
-
<xsl:with-param name="warning">Worksheets are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
85
|
-
</xsl:call-template>
|
|
86
|
-
</xsl:template>
|
|
87
|
-
|
|
88
|
-
<xsl:template match="handout">
|
|
89
|
-
<xsl:call-template name="banner-warning">
|
|
90
|
-
<xsl:with-param name="warning">Handouts are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
91
|
-
</xsl:call-template>
|
|
92
|
-
</xsl:template>
|
|
93
|
-
|
|
94
|
-
<!-- Defaults that can be overriden by style files -->
|
|
95
|
-
<xsl:variable name="documentclass" select="'article'"/>
|
|
96
|
-
<xsl:variable name="bibliographystyle" select="'amsplain'"/>
|
|
97
|
-
|
|
98
|
-
<!-- An article, LaTeX structure -->
|
|
99
|
-
<!-- One page, full of sections (with abstract, references) -->
|
|
100
|
-
<!-- Or, one page, totally unstructured, just lots of paragraphs, widgets, etc -->
|
|
101
|
-
<xsl:template match="article">
|
|
102
|
-
<xsl:call-template name="converter-blurb-latex"/>
|
|
103
|
-
<xsl:call-template name="snapshot-package-info"/>
|
|
104
|
-
<xsl:text>\documentclass[</xsl:text>
|
|
105
|
-
<xsl:call-template name="sidedness"/>
|
|
106
|
-
<xsl:text>,</xsl:text>
|
|
107
|
-
<xsl:value-of select="$font-size"/>
|
|
108
|
-
<xsl:text>,</xsl:text>
|
|
109
|
-
<xsl:if test="$b-latex-draft-mode" >
|
|
110
|
-
<xsl:text>draft,</xsl:text>
|
|
111
|
-
</xsl:if>
|
|
112
|
-
<xsl:text>]{</xsl:text>
|
|
113
|
-
<xsl:value-of select="$documentclass" />
|
|
114
|
-
<xsl:text>}
</xsl:text>
|
|
115
|
-
|
|
116
|
-
<xsl:call-template name="latex-preamble" />
|
|
117
|
-
|
|
118
|
-
<xsl:call-template name="bibinfo-pre-begin-document" />
|
|
119
|
-
<xsl:text>\begin{document}
</xsl:text>
|
|
120
|
-
<xsl:call-template name="bibinfo-post-begin-document" />
|
|
121
|
-
|
|
122
|
-
<xsl:apply-templates select="*"/>
|
|
123
|
-
|
|
124
|
-
<xsl:text>\end{document}
</xsl:text>
|
|
125
|
-
</xsl:template>
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
<xsl:template name="latex-preamble">
|
|
129
|
-
<!-- Some journal styles require specific packages be loaded right away -->
|
|
130
|
-
<xsl:call-template name="journal-packages"/>
|
|
131
|
-
<xsl:call-template name="frontmatter-helpers"/>
|
|
132
|
-
<xsl:call-template name="preamble-early"/>
|
|
133
|
-
<xsl:call-template name="cleardoublepage"/>
|
|
134
|
-
<xsl:call-template name="standard-packages"/>
|
|
135
|
-
<xsl:call-template name="latex-theorem-environments"/>
|
|
136
|
-
<xsl:call-template name="tcolorbox-init"/>
|
|
137
|
-
<xsl:call-template name="numberless-environments"/>
|
|
138
|
-
<xsl:call-template name="page-setup"/>
|
|
139
|
-
<xsl:call-template name="latex-engine-support"/>
|
|
140
|
-
<xsl:call-template name="font-support"/>
|
|
141
|
-
<xsl:call-template name="math-packages"/>
|
|
142
|
-
<xsl:call-template name="text-symbols"/>
|
|
143
|
-
<xsl:call-template name="pdfpages-package"/>
|
|
144
|
-
<!--<xsl:call-template name="division-titles"/>-->
|
|
145
|
-
<xsl:call-template name="semantic-macros"/>
|
|
146
|
-
<xsl:call-template name="exercises-and-solutions"/>
|
|
147
|
-
<xsl:call-template name="chapter-start-number"/>
|
|
148
|
-
<xsl:call-template name="equation-numbering"/>
|
|
149
|
-
<xsl:call-template name="image-tcolorbox"/>
|
|
150
|
-
<xsl:call-template name="tables"/>
|
|
151
|
-
<!--<xsl:call-template name="footnote-numbering"/> -->
|
|
152
|
-
<xsl:call-template name="font-awesome"/>
|
|
153
|
-
<xsl:call-template name="poetry-support"/>
|
|
154
|
-
<xsl:call-template name="music-support"/>
|
|
155
|
-
<xsl:call-template name="code-support"/>
|
|
156
|
-
<xsl:call-template name="list-layout"/>
|
|
157
|
-
<xsl:call-template name="load-configure-hyperref"/>
|
|
158
|
-
<xsl:call-template name="create-numbered-tcolorbox"/>
|
|
159
|
-
<xsl:call-template name="watermark"/>
|
|
160
|
-
<xsl:call-template name="showkeys"/>
|
|
161
|
-
<xsl:call-template name="latex-image-support"/>
|
|
162
|
-
<xsl:call-template name="sidebyside-environment"/>
|
|
163
|
-
<xsl:call-template name="kbd-keys"/>
|
|
164
|
-
<xsl:call-template name="late-preamble-adjustments"/>
|
|
165
|
-
</xsl:template>
|
|
166
|
-
|
|
167
|
-
<!-- No journal-packages by default; can be overridden by importing xsl -->
|
|
168
|
-
<xsl:template name="journal-packages"/>
|
|
169
|
-
|
|
170
|
-
<!-- paragraph and page setup -->
|
|
171
|
-
<!-- TODO: Clean this up with just what -classic needs. -->
|
|
172
|
-
<xsl:template name="page-setup">
|
|
173
|
-
<!-- This should save-off the indentation used for the first line of -->
|
|
174
|
-
<!-- a paragraph, in effect for the chosen document class. Then the -->
|
|
175
|
-
<!-- "parbox" used by "tcolorbox" can restore indentation rather than -->
|
|
176
|
-
<!-- run with none. Part of -->
|
|
177
|
-
<!-- https://tex.stackexchange.com/questions/250165/ -->
|
|
178
|
-
<!-- normal-body-text-within-tcolorbox -->
|
|
179
|
-
<!-- In a similar fashion we save/restore the parskip, only should -->
|
|
180
|
-
<!-- an ambitious publisher try to set it globally -->
|
|
181
|
-
<xsl:text>%% Save default paragraph indentation and parskip for use later, when adjusting parboxes
</xsl:text>
|
|
182
|
-
<xsl:text>\newlength{\ptxnormalparindent}
</xsl:text>
|
|
183
|
-
<xsl:text>\newlength{\ptxnormalparskip}
</xsl:text>
|
|
184
|
-
<xsl:text>\AtBeginDocument{\setlength{\ptxnormalparindent}{\parindent}}
</xsl:text>
|
|
185
|
-
<xsl:text>\AtBeginDocument{\setlength{\ptxnormalparskip}{\parskip}}
</xsl:text>
|
|
186
|
-
<xsl:text>\newcommand{\setparstyle}{\setlength{\parindent}{\ptxnormalparindent}\setlength{\parskip}{\ptxnormalparskip}}</xsl:text>
|
|
187
|
-
|
|
188
|
-
<!-- could condition on "subfigure-reps" -->
|
|
189
|
-
<xsl:if test="$b-has-sidebyside">
|
|
190
|
-
<xsl:text>%% shorter subnumbers in some side-by-side require manipulations
</xsl:text>
|
|
191
|
-
<xsl:text>\usepackage{xstring}
</xsl:text>
|
|
192
|
-
</xsl:if>
|
|
193
|
-
<!--<xsl:if test="$document-root//fn|$document-root//part">
|
|
194
|
-
<xsl:text>%% Footnote counters and part/chapter counters are manipulated
</xsl:text>
|
|
195
|
-
<xsl:text>%% April 2018: chngcntr commands now integrated into the kernel,
</xsl:text>
|
|
196
|
-
<xsl:text>%% but circa 2018/2019 the package would still try to redefine them,
</xsl:text>
|
|
197
|
-
<xsl:text>%% so we need to do the work of loading conditionally for old kernels.
</xsl:text>
|
|
198
|
-
<xsl:text>%% From version 1.1a, chngcntr should detect defintions made by LaTeX kernel.
</xsl:text>
|
|
199
|
-
<xsl:text>\ifdefined\counterwithin
</xsl:text>
|
|
200
|
-
<xsl:text>\else
</xsl:text>
|
|
201
|
-
<xsl:text> \usepackage{chngcntr}
</xsl:text>
|
|
202
|
-
<xsl:text>\fi
</xsl:text>-->
|
|
203
|
-
<!-- implies book/part -->
|
|
204
|
-
<!--<xsl:if test="$parts = 'structural'">
|
|
205
|
-
<xsl:text>%% Structural chapter numbers reset within parts
</xsl:text>
|
|
206
|
-
<xsl:text>%% Starred form will not prefix part number
</xsl:text>
|
|
207
|
-
<xsl:text>\counterwithin*{chapter}{part}
</xsl:text>
|
|
208
|
-
</xsl:if>-->
|
|
209
|
-
<!--</xsl:if>-->
|
|
210
|
-
<!-- Determine height of text block, assumes US letterpaper (11in height) -->
|
|
211
|
-
<!-- Could react to document type, paper, margin specs -->
|
|
212
|
-
<!--<xsl:variable name="text-height">
|
|
213
|
-
<xsl:text>9.0in</xsl:text>
|
|
214
|
-
</xsl:variable>-->
|
|
215
|
-
<!-- Bringhurst: 30x => 66 chars, so 34x => 75 chars -->
|
|
216
|
-
<!--<xsl:variable name="text-width">
|
|
217
|
-
<xsl:value-of select="34 * substring-before($font-size, 'pt')" />
|
|
218
|
-
<xsl:text>pt</xsl:text>
|
|
219
|
-
</xsl:variable>-->
|
|
220
|
-
<!--<xsl:text>%% Text height identically 9 inches, text width varies on point size
</xsl:text>
|
|
221
|
-
<xsl:text>%% See Bringhurst 2.1.1 on measure for recommendations
</xsl:text>
|
|
222
|
-
<xsl:text>%% 75 characters per line (count spaces, punctuation) is target
</xsl:text>
|
|
223
|
-
<xsl:text>%% which is the upper limit of Bringhurst's recommendations
</xsl:text>
|
|
224
|
-
<xsl:text>\geometry{letterpaper,total={</xsl:text>
|
|
225
|
-
<xsl:value-of select="$text-width" />
|
|
226
|
-
<xsl:text>,</xsl:text>
|
|
227
|
-
<xsl:value-of select="$text-height" />
|
|
228
|
-
<xsl:text>}}
</xsl:text>-->
|
|
229
|
-
<xsl:text>%% Custom Page Layout Adjustments (use publisher page-geometry entry)
</xsl:text>
|
|
230
|
-
<xsl:if test="$latex-page-geometry != ''">
|
|
231
|
-
<xsl:text>\geometry{</xsl:text>
|
|
232
|
-
<xsl:value-of select="$latex-page-geometry" />
|
|
233
|
-
<xsl:text>}
</xsl:text>
|
|
234
|
-
</xsl:if>
|
|
235
|
-
<!-- Crop marks, as independent of author tools -->
|
|
236
|
-
<!-- Always *after* geometry package, no driver selected, -->
|
|
237
|
-
<!-- since it should auto-detect. Tested with xelatex. -->
|
|
238
|
-
<!-- crop package suggests explicitly turning off driver -->
|
|
239
|
-
<!-- options for the geometery package. We don't. -->
|
|
240
|
-
<xsl:if test="$b-latex-crop-marks">
|
|
241
|
-
<xsl:text>\usepackage[</xsl:text>
|
|
242
|
-
<xsl:value-of select="$latex-crop-papersize"/>
|
|
243
|
-
<xsl:text>,cam,center]{crop}
</xsl:text>
|
|
244
|
-
</xsl:if>
|
|
245
|
-
<xsl:if test="$latex-right-alignment = 'ragged'">
|
|
246
|
-
<xsl:text>%% better handing of text alignment
</xsl:text>
|
|
247
|
-
<xsl:text>\usepackage{ragged2e}
</xsl:text>
|
|
248
|
-
</xsl:if>
|
|
249
|
-
</xsl:template>
|
|
250
|
-
|
|
251
|
-
<!-- By default, no bibinfo is included before the \begin{document}. -->
|
|
252
|
-
<!-- Other latex styles can override this to put some information there. -->
|
|
253
|
-
<xsl:template name="bibinfo-pre-begin-document">
|
|
254
|
-
<xsl:apply-templates select="$document-root" mode="article-title"/>
|
|
255
|
-
<!--<xsl:apply-templates select="$bibinfo/support" mode="article-frontmatter"/>-->
|
|
256
|
-
<xsl:call-template name="article-authors"/>
|
|
257
|
-
<xsl:apply-templates select="$bibinfo/date" mode="article-frontmatter"/>
|
|
258
|
-
</xsl:template>
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
<!-- By default, all bibinfo goes inside (after) \begin{document}. -->
|
|
262
|
-
<!-- Other latex styles can override this in combination with the pre-version. -->
|
|
263
|
-
<!-- Order of bibinfo elements after \begin{document} -->
|
|
264
|
-
<xsl:template name="bibinfo-post-begin-document">
|
|
265
|
-
<xsl:text>\maketitle
</xsl:text>
|
|
266
|
-
<xsl:apply-templates select="$document-root/frontmatter/abstract" mode="article-frontmatter"/>
|
|
267
|
-
</xsl:template>
|
|
268
|
-
|
|
269
|
-
<xsl:template match="*" mode="article-title">
|
|
270
|
-
<xsl:text>%% Title page information for article
</xsl:text>
|
|
271
|
-
<xsl:text>\title{</xsl:text>
|
|
272
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
273
|
-
<xsl:apply-templates select="$bibinfo/support" mode="article-frontmatter"/>
|
|
274
|
-
<xsl:if test="subtitle">
|
|
275
|
-
<xsl:text>\\
</xsl:text>
|
|
276
|
-
<!-- Trying to match author fontsize -->
|
|
277
|
-
<xsl:text>{\small </xsl:text>
|
|
278
|
-
<xsl:apply-templates select="." mode="subtitle"/>
|
|
279
|
-
<xsl:text>}</xsl:text>
|
|
280
|
-
</xsl:if>
|
|
281
|
-
<xsl:text>}
</xsl:text>
|
|
282
|
-
</xsl:template>
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
<!-- For now, this just wraps the common article-info for author in an \author{...} tag -->
|
|
286
|
-
<xsl:template name="article-authors">
|
|
287
|
-
<xsl:text>\author{</xsl:text>
|
|
288
|
-
<xsl:apply-templates select="$bibinfo/author" mode="article-frontmatter"/>
|
|
289
|
-
<xsl:text>}
</xsl:text>
|
|
290
|
-
</xsl:template>
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
<xsl:template match="author" mode="article-frontmatter">
|
|
294
|
-
<xsl:apply-templates select="personname" />
|
|
295
|
-
<xsl:if test="support">
|
|
296
|
-
<xsl:text>\thanks{</xsl:text>
|
|
297
|
-
<xsl:apply-templates select="support" />
|
|
298
|
-
<xsl:text>}</xsl:text>
|
|
299
|
-
</xsl:if>
|
|
300
|
-
<xsl:if test="affiliation">
|
|
301
|
-
<xsl:text>\\
</xsl:text>
|
|
302
|
-
<xsl:apply-templates select="affiliation" />
|
|
303
|
-
</xsl:if>
|
|
304
|
-
<xsl:if test="email">
|
|
305
|
-
<xsl:text>\\
</xsl:text>
|
|
306
|
-
<xsl:apply-templates select="email" mode="article-info"/>
|
|
307
|
-
</xsl:if>
|
|
308
|
-
<xsl:if test="following-sibling::author" >
|
|
309
|
-
<xsl:text>
\and</xsl:text>
|
|
310
|
-
</xsl:if>
|
|
311
|
-
<xsl:text>
</xsl:text>
|
|
312
|
-
</xsl:template>
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
<!-- Preprocessor always puts Department, Institution, and Address -->
|
|
316
|
-
<!-- inside Affiliation. This just adds line breaks between them as needed. -->
|
|
317
|
-
<xsl:template match="affiliation">
|
|
318
|
-
<xsl:param name="sep" select="'\\
'"/>
|
|
319
|
-
<xsl:param name="after"/>
|
|
320
|
-
<xsl:if test="department">
|
|
321
|
-
<xsl:apply-templates select="department">
|
|
322
|
-
<xsl:with-param name="sep" select="$sep"/>
|
|
323
|
-
</xsl:apply-templates>
|
|
324
|
-
<xsl:if test="department/following-sibling::*">
|
|
325
|
-
<xsl:value-of select="$sep"/>
|
|
326
|
-
</xsl:if>
|
|
327
|
-
</xsl:if>
|
|
328
|
-
<xsl:if test="institution">
|
|
329
|
-
<xsl:apply-templates select="institution">
|
|
330
|
-
<xsl:with-param name="sep" select="$sep"/>
|
|
331
|
-
</xsl:apply-templates>
|
|
332
|
-
<xsl:if test="institution/following-sibling::*">
|
|
333
|
-
<xsl:value-of select="$sep"/>
|
|
334
|
-
</xsl:if>
|
|
335
|
-
</xsl:if>
|
|
336
|
-
<xsl:if test="location">
|
|
337
|
-
<xsl:apply-templates select="location">
|
|
338
|
-
<xsl:with-param name="sep" select="$sep"/>
|
|
339
|
-
</xsl:apply-templates>
|
|
340
|
-
</xsl:if>
|
|
341
|
-
<!-- always end with a new line, after the `after` param if passed -->
|
|
342
|
-
<xsl:value-of select="$after"/>
|
|
343
|
-
<xsl:text>
</xsl:text>
|
|
344
|
-
</xsl:template>
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
<!-- override the default department[line] etc and line templates to use sep param -->
|
|
348
|
-
<xsl:template match="department[line]|institution[line]|location[line]">
|
|
349
|
-
<xsl:param name="sep" select="'\\
'"/>
|
|
350
|
-
<xsl:apply-templates select="line">
|
|
351
|
-
<xsl:with-param name="sep" select="$sep"/>
|
|
352
|
-
</xsl:apply-templates>
|
|
353
|
-
</xsl:template>
|
|
354
|
-
|
|
355
|
-
<xsl:template match="line">
|
|
356
|
-
<xsl:param name="sep" select="'\\
'"/>
|
|
357
|
-
<xsl:apply-templates/>
|
|
358
|
-
<xsl:if test="following-sibling::line">
|
|
359
|
-
<xsl:value-of select="$sep"/>
|
|
360
|
-
</xsl:if>
|
|
361
|
-
</xsl:template>
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
<xsl:template match="bibinfo/date" mode="article-frontmatter">
|
|
365
|
-
<xsl:text>\date{</xsl:text>
|
|
366
|
-
<xsl:apply-templates select="."/>
|
|
367
|
-
<xsl:text>}
</xsl:text>
|
|
368
|
-
</xsl:template>
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
<xsl:template match="bibinfo/support" mode="article-frontmatter">
|
|
372
|
-
<xsl:text>\support{</xsl:text>
|
|
373
|
-
<xsl:apply-templates select="$bibinfo/support" mode="article-info"/>
|
|
374
|
-
<xsl:text>}
</xsl:text>
|
|
375
|
-
</xsl:template>
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
<xsl:template match="frontmatter/abstract" mode="article-frontmatter">
|
|
379
|
-
<xsl:text>\begin{abstract}
</xsl:text>
|
|
380
|
-
<xsl:apply-templates select="*"/>
|
|
381
|
-
<xsl:apply-templates select="$bibinfo/keywords"/>
|
|
382
|
-
<xsl:text>\end{abstract}
</xsl:text>
|
|
383
|
-
</xsl:template>
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
<xsl:template match="email" mode="article-info">
|
|
387
|
-
<xsl:value-of select="." />
|
|
388
|
-
</xsl:template>
|
|
389
|
-
|
|
390
|
-
<!-- Since the bibinfo-post-begin-document takes care of all frontmatter, we kill the frontmatter as a separate thing here -->
|
|
391
|
-
<xsl:template match="article/frontmatter"/>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
<!-- latex-common includes a title-page-info-article template, but latex-classic -->
|
|
395
|
-
<!-- does not use this. So we warn in case we forget and call it by mistake. -->
|
|
396
|
-
<xsl:template name="title-page-info-article">
|
|
397
|
-
<xsl:message>PTX:BUG: latex-classic based templates do not use title-page-info-article template.</xsl:message>
|
|
398
|
-
</xsl:template>
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
<!-- Theorems, Proofs, Definitions, Examples, Exercises -->
|
|
402
|
-
|
|
403
|
-
<!-- Theorems have statement/proof structure -->
|
|
404
|
-
<!-- Definitions have notation, which is handled elsewhere -->
|
|
405
|
-
<!-- Examples have no structure, or have statement and solution -->
|
|
406
|
-
<!-- Exercises have hints, answers and solutions -->
|
|
407
|
-
|
|
408
|
-
<!-- For preamble -->
|
|
409
|
-
<xsl:template name="latex-theorem-environments">
|
|
410
|
-
<xsl:text>%% Theorem-like environments
</xsl:text>
|
|
411
|
-
<xsl:text>%
% amsthm package: redundant if using amsart documentclass, but required otherwise.
</xsl:text>
|
|
412
|
-
<xsl:text>\usepackage{amsthm}%
%
</xsl:text>
|
|
413
|
-
<xsl:text>\theoremstyle{plain}
</xsl:text>
|
|
414
|
-
<!-- We need a counter, and want it to be "theorem" to agree with some journal styles -->
|
|
415
|
-
<!-- So if the document contains theorem's, we can create it. Otherwise we don't care-->
|
|
416
|
-
<!-- what it is called, so we can still use this and it will just have a blank name. -->
|
|
417
|
-
<xsl:text>\newtheorem{theorem}{</xsl:text>
|
|
418
|
-
<xsl:apply-templates select="($document-root//theorem)[1]" mode="type-name"/>
|
|
419
|
-
<xsl:text>}[section]
</xsl:text>
|
|
420
|
-
<!-- Now continue with the remaining elements, checking to see if they are present -->
|
|
421
|
-
<xsl:variable name="theoremstyle-plain" select="
|
|
422
|
-
($document-root//lemma)[1]|
|
|
423
|
-
($document-root//proposition)[1]|
|
|
424
|
-
($document-root//corollary)[1]|
|
|
425
|
-
($document-root//claim)[1]|
|
|
426
|
-
($document-root//fact)[1]|
|
|
427
|
-
($document-root//identity)[1]|
|
|
428
|
-
($document-root//conjecture)[1]
|
|
429
|
-
"/>
|
|
430
|
-
<xsl:for-each select="$theoremstyle-plain">
|
|
431
|
-
<xsl:apply-templates select="." mode="newtheorem"/>
|
|
432
|
-
</xsl:for-each>
|
|
433
|
-
<xsl:text>
</xsl:text>
|
|
434
|
-
|
|
435
|
-
<xsl:text>\theoremstyle{definition}
</xsl:text>
|
|
436
|
-
<xsl:variable name="theoremstyle-definition" select="
|
|
437
|
-
($document-root//definition)[1]|
|
|
438
|
-
($document-root//axiom)[1]|
|
|
439
|
-
($document-root//principle)[1]|
|
|
440
|
-
($document-root//heuristic)[1]|
|
|
441
|
-
($document-root//hypothesis)[1]|
|
|
442
|
-
($document-root//assumption)[1]|
|
|
443
|
-
($document-root//openproblem)[1]|
|
|
444
|
-
($document-root//openquestion)[1]|
|
|
445
|
-
($document-root//algorithm)[1]|
|
|
446
|
-
($document-root//question)[1]|
|
|
447
|
-
($document-root//activity)[1]|
|
|
448
|
-
($document-root//exercise)[1]|
|
|
449
|
-
($document-root//inlineexercise)[1]|
|
|
450
|
-
($document-root//investigation)[1]|
|
|
451
|
-
($document-root//exploration)[1]|
|
|
452
|
-
($document-root//problem)[1]|
|
|
453
|
-
($document-root//example)[1]|
|
|
454
|
-
($document-root//project)[1]
|
|
455
|
-
"/>
|
|
456
|
-
<xsl:for-each select="$theoremstyle-definition">
|
|
457
|
-
<xsl:apply-templates select="." mode="newtheorem"/>
|
|
458
|
-
</xsl:for-each>
|
|
459
|
-
<xsl:text>
</xsl:text>
|
|
460
|
-
|
|
461
|
-
<xsl:text>\theoremstyle{remark}
</xsl:text>
|
|
462
|
-
<xsl:variable name="theoremstyle-remark" select="
|
|
463
|
-
($document-root//convention)[1]|
|
|
464
|
-
($document-root//warning)[1]|
|
|
465
|
-
($document-root//remark)[1]|
|
|
466
|
-
($document-root//insight)[1]|
|
|
467
|
-
($document-root//note)[1]|
|
|
468
|
-
($document-root//observation)[1]|
|
|
469
|
-
($document-root//computation)[1]|
|
|
470
|
-
($document-root//technology)[1]|
|
|
471
|
-
($document-root//data)[1]
|
|
472
|
-
"/>
|
|
473
|
-
<xsl:for-each select="$theoremstyle-remark">
|
|
474
|
-
<xsl:apply-templates select="." mode="newtheorem"/>
|
|
475
|
-
</xsl:for-each>
|
|
476
|
-
<xsl:text>
</xsl:text>
|
|
477
|
-
</xsl:template>
|
|
478
|
-
|
|
479
|
-
<xsl:template match="*" mode="newtheorem">
|
|
480
|
-
<xsl:text>\newtheorem{</xsl:text>
|
|
481
|
-
<xsl:choose>
|
|
482
|
-
<!-- One exception for inline exercises -->
|
|
483
|
-
<xsl:when test="local-name(.) = 'exercise'">
|
|
484
|
-
<xsl:text>inlineexercise</xsl:text>
|
|
485
|
-
</xsl:when>
|
|
486
|
-
<xsl:otherwise>
|
|
487
|
-
<xsl:value-of select="local-name(.)"/>
|
|
488
|
-
</xsl:otherwise>
|
|
489
|
-
</xsl:choose>
|
|
490
|
-
<xsl:text>}[theorem]{</xsl:text>
|
|
491
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
492
|
-
<xsl:text>}
</xsl:text>
|
|
493
|
-
</xsl:template>
|
|
494
|
-
|
|
495
|
-
<!-- Preamble assemblage environment -->
|
|
496
|
-
|
|
497
|
-
<xsl:template name="numberless-environments">
|
|
498
|
-
<!-- Assemblages -->
|
|
499
|
-
<xsl:if test="$document-root//assemblage">
|
|
500
|
-
<xsl:apply-templates select="($document-root//assemblage)[1]" mode="environment"/>
|
|
501
|
-
</xsl:if>
|
|
502
|
-
<!-- ASIDE-LIKE -->
|
|
503
|
-
<xsl:variable name="aside-reps" select="
|
|
504
|
-
($document-root//aside)[1]|
|
|
505
|
-
($document-root//historical)[1]|
|
|
506
|
-
($document-root//biographical)[1]"/>
|
|
507
|
-
<xsl:if test="$aside-reps">
|
|
508
|
-
<xsl:text>%%
</xsl:text>
|
|
509
|
-
<xsl:text>%% tcolorbox, with styles, for ASIDE-LIKE
</xsl:text>
|
|
510
|
-
<xsl:text>%%
</xsl:text>
|
|
511
|
-
</xsl:if>
|
|
512
|
-
<xsl:for-each select="$aside-reps">
|
|
513
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
514
|
-
</xsl:for-each>
|
|
515
|
-
</xsl:template>
|
|
516
|
-
|
|
517
|
-
<!-- We need to redefine these to be more like regular environments -->
|
|
518
|
-
<xsl:template match="assemblage|&ASIDE-LIKE;" mode="environment">
|
|
519
|
-
<!-- Names of various pieces use the element name -->
|
|
520
|
-
<xsl:variable name="environment-name">
|
|
521
|
-
<xsl:value-of select="local-name(.)"/>
|
|
522
|
-
</xsl:variable>
|
|
523
|
-
<xsl:text>%% </xsl:text>
|
|
524
|
-
<xsl:value-of select="$environment-name"/>
|
|
525
|
-
<xsl:text>: fairly simple un-numbered block/structure
</xsl:text>
|
|
526
|
-
<xsl:text>\tcbset{ </xsl:text>
|
|
527
|
-
<xsl:value-of select="$environment-name"/>
|
|
528
|
-
<xsl:text>style/.style={</xsl:text>
|
|
529
|
-
<xsl:apply-templates select="." mode="tcb-style"/>
|
|
530
|
-
<xsl:text>} }
</xsl:text>
|
|
531
|
-
<xsl:text>\newtcolorbox{</xsl:text>
|
|
532
|
-
<xsl:value-of select="$environment-name"/>
|
|
533
|
-
<xsl:text>}[1][]{title={#1}, </xsl:text>
|
|
534
|
-
<xsl:text>breakable, before upper app={\setparstyle}, </xsl:text>
|
|
535
|
-
<xsl:value-of select="$environment-name"/>
|
|
536
|
-
<xsl:text>style}
</xsl:text>
|
|
537
|
-
</xsl:template>
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
<!-- In document -->
|
|
541
|
-
<xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&DEFINITION-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&ASIDE-LIKE;|exercise[boolean(&INLINE-EXERCISE-FILTER;)]|assemblage" mode="block-options">
|
|
542
|
-
<xsl:apply-templates select="." mode="env-title"/>
|
|
543
|
-
<xsl:text>\label{</xsl:text>
|
|
544
|
-
<xsl:apply-templates select="." mode="unique-id"/>
|
|
545
|
-
<xsl:text>}%
</xsl:text>
|
|
546
|
-
</xsl:template>
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
<!-- Proofs and cases are handled using amsthm; anything other than a proof gets a title or the name of the proof-like env. -->
|
|
551
|
-
<xsl:template match="&PROOF-LIKE;">
|
|
552
|
-
<xsl:text>\begin{proof}</xsl:text>
|
|
553
|
-
<xsl:choose>
|
|
554
|
-
<xsl:when test="title">
|
|
555
|
-
<xsl:text>[</xsl:text>
|
|
556
|
-
<xsl:apply-templates select="." mode="title-simple"/>
|
|
557
|
-
<xsl:text>]</xsl:text>
|
|
558
|
-
</xsl:when>
|
|
559
|
-
<xsl:when test="local-name(.)!='proof'">
|
|
560
|
-
<xsl:text>[</xsl:text>
|
|
561
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
562
|
-
<xsl:text>]</xsl:text>
|
|
563
|
-
</xsl:when>
|
|
564
|
-
</xsl:choose>
|
|
565
|
-
<xsl:text>\label{</xsl:text>
|
|
566
|
-
<xsl:apply-templates select="." mode="unique-id"/>
|
|
567
|
-
<xsl:text>}%
</xsl:text>
|
|
568
|
-
<xsl:apply-templates select="*"/>
|
|
569
|
-
<xsl:text>\end{proof}
</xsl:text>
|
|
570
|
-
</xsl:template>
|
|
571
|
-
|
|
572
|
-
<!-- Cases in proofs -->
|
|
573
|
-
<xsl:template match="case">
|
|
574
|
-
<xsl:text>\par\medskip%
</xsl:text>
|
|
575
|
-
<xsl:text>\noindent{}</xsl:text>
|
|
576
|
-
<xsl:if test="@direction">
|
|
577
|
-
<xsl:apply-templates select="." mode="case-direction"/>
|
|
578
|
-
<xsl:text> </xsl:text>
|
|
579
|
-
</xsl:if>
|
|
580
|
-
<xsl:if test="title">
|
|
581
|
-
<xsl:text>\textit{</xsl:text>
|
|
582
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
583
|
-
<xsl:text>}</xsl:text>
|
|
584
|
-
</xsl:if>
|
|
585
|
-
<xsl:if test="not(title) and not(@direction)">
|
|
586
|
-
<xsl:text>\textit{</xsl:text>
|
|
587
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
588
|
-
<xsl:text>}</xsl:text>
|
|
589
|
-
</xsl:if>
|
|
590
|
-
<!-- label -->
|
|
591
|
-
<xsl:text>\label{</xsl:text>
|
|
592
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
593
|
-
<xsl:text>}%
</xsl:text>
|
|
594
|
-
<xsl:apply-templates select="*"/>
|
|
595
|
-
</xsl:template>
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
<xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&DEFINITION-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|exercise[boolean(&INLINE-EXERCISE-FILTER;)]" mode="env-title">
|
|
599
|
-
<xsl:if test="title|creator">
|
|
600
|
-
<xsl:text>[</xsl:text>
|
|
601
|
-
<xsl:if test="title">
|
|
602
|
-
<!-- Title, but without punctuation. Or is there a smarter way? -->
|
|
603
|
-
<xsl:apply-templates select="." mode="title-xref"/>
|
|
604
|
-
</xsl:if>
|
|
605
|
-
<xsl:if test="(title) and (creator)">
|
|
606
|
-
<xsl:text> </xsl:text>
|
|
607
|
-
</xsl:if>
|
|
608
|
-
<xsl:if test="creator">
|
|
609
|
-
<xsl:apply-templates select="." mode="creator-full"/>
|
|
610
|
-
</xsl:if>
|
|
611
|
-
<xsl:text>]</xsl:text>
|
|
612
|
-
</xsl:if>
|
|
613
|
-
</xsl:template>
|
|
614
|
-
|
|
615
|
-
<xsl:template match="&ASIDE-LIKE;|assemblage" mode="env-title">
|
|
616
|
-
<xsl:if test="title">
|
|
617
|
-
<xsl:text>[</xsl:text>
|
|
618
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
619
|
-
<xsl:text>]</xsl:text>
|
|
620
|
-
</xsl:if>
|
|
621
|
-
</xsl:template>
|
|
622
|
-
|
|
623
|
-
<!-- Divisions -->
|
|
624
|
-
|
|
625
|
-
<xsl:template match="section|subsection|subsubsection|appendix">
|
|
626
|
-
<xsl:apply-templates select="." mode="console-typeout"/>
|
|
627
|
-
<xsl:text>\</xsl:text>
|
|
628
|
-
<xsl:value-of select="local-name(.)"/>
|
|
629
|
-
<xsl:text>{</xsl:text>
|
|
630
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
631
|
-
<xsl:text>}\label{</xsl:text>
|
|
632
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
633
|
-
<xsl:text>}%
</xsl:text>
|
|
634
|
-
<xsl:apply-templates select="*"/>
|
|
635
|
-
<xsl:text>% end of </xsl:text>
|
|
636
|
-
<xsl:value-of select="local-name(.)"/>
|
|
637
|
-
<xsl:text>: </xsl:text>
|
|
638
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
639
|
-
<xsl:text>
</xsl:text>
|
|
640
|
-
</xsl:template>
|
|
641
|
-
|
|
642
|
-
<xsl:template match="subsubsubsection">
|
|
643
|
-
<xsl:apply-templates select="." mode="console-typeout"/>
|
|
644
|
-
<xsl:text>\paragraph</xsl:text>
|
|
645
|
-
<xsl:text>{</xsl:text>
|
|
646
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
647
|
-
<xsl:text>}\label{</xsl:text>
|
|
648
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
649
|
-
<xsl:text>}%
</xsl:text>
|
|
650
|
-
<xsl:apply-templates select="*"/>
|
|
651
|
-
<xsl:text>% end of subsubsubsection: </xsl:text>
|
|
652
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
653
|
-
<xsl:text>
</xsl:text>
|
|
654
|
-
</xsl:template>
|
|
655
|
-
|
|
656
|
-
<!-- Paragraphs -->
|
|
657
|
-
<!-- Use *-version of section/subsection/subsubsection/etc at a level one below parent -->
|
|
658
|
-
<xsl:template match="paragraphs">
|
|
659
|
-
<xsl:choose>
|
|
660
|
-
<xsl:when test="parent::article">
|
|
661
|
-
<xsl:text>\section*{</xsl:text>
|
|
662
|
-
</xsl:when>
|
|
663
|
-
<xsl:when test="parent::section">
|
|
664
|
-
<xsl:text>\subsection*{</xsl:text>
|
|
665
|
-
</xsl:when>
|
|
666
|
-
<xsl:when test="parent::subsection">
|
|
667
|
-
<xsl:text>\subsubsection*{</xsl:text>
|
|
668
|
-
</xsl:when>
|
|
669
|
-
<xsl:when test="parent::subsubsection">
|
|
670
|
-
<xsl:text>\paragraph*{</xsl:text>
|
|
671
|
-
</xsl:when>
|
|
672
|
-
<xsl:otherwise>
|
|
673
|
-
<xsl:text>\subparagraph*{</xsl:text>
|
|
674
|
-
</xsl:otherwise>
|
|
675
|
-
</xsl:choose>
|
|
676
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
677
|
-
<xsl:text>}</xsl:text>
|
|
678
|
-
<xsl:text>\label{</xsl:text>
|
|
679
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
680
|
-
<xsl:text>}%
</xsl:text>
|
|
681
|
-
<xsl:apply-templates select="*"/>
|
|
682
|
-
<xsl:text>% end of paragraphs
</xsl:text>
|
|
683
|
-
</xsl:template>
|
|
684
|
-
|
|
685
|
-
<!-- Introductions and Conclusions -->
|
|
686
|
-
<!-- Introductions and conclusions are just their contents at their position. -->
|
|
687
|
-
<xsl:template match="article/introduction|chapter/introduction|section/introduction|subsection/introduction|appendix/introduction|exercises/introduction|solutions/introduction|worksheet/introduction|reading-questions/introduction|references/introduction">
|
|
688
|
-
<xsl:text>% Introduction
</xsl:text>
|
|
689
|
-
<xsl:apply-templates select="*"/>
|
|
690
|
-
<xsl:text>% end of introduction
</xsl:text>
|
|
691
|
-
</xsl:template>
|
|
692
|
-
|
|
693
|
-
<xsl:template match="article/conclusion|chapter/conclusion|section/conclusion|subsection/conclusion|appendix/conclusion|exercises/conclusion|solutions/conclusion|worksheet/conclusion|reading-questions/conclusion|references/conclusion">
|
|
694
|
-
<xsl:text>% Conclusion
</xsl:text>
|
|
695
|
-
<xsl:apply-templates select="*"/>
|
|
696
|
-
<xsl:text>% end of conclusion
</xsl:text>
|
|
697
|
-
</xsl:template>
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
<!-- ################### -->
|
|
702
|
-
<!-- References Sections -->
|
|
703
|
-
<!-- ################### -->
|
|
704
|
-
<!-- TODO: The following will certainly change when the bibliography work is completed -->
|
|
705
|
-
|
|
706
|
-
<xsl:template match="references">
|
|
707
|
-
<xsl:apply-templates select="." mode="console-typeout"/>
|
|
708
|
-
<xsl:text>\bibliographystyle{</xsl:text>
|
|
709
|
-
<xsl:value-of select="$bibliographystyle"/>
|
|
710
|
-
<xsl:text>}
</xsl:text>
|
|
711
|
-
<xsl:text>\begin{thebibliography}{99}
</xsl:text>
|
|
712
|
-
<xsl:apply-templates select="*"/>
|
|
713
|
-
<xsl:text>\end{thebibliography}
</xsl:text>
|
|
714
|
-
</xsl:template>
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
<xsl:template match="biblio[@type='raw'] | biblio[@type='bibtex']">
|
|
718
|
-
<xsl:text>\bibitem</xsl:text>
|
|
719
|
-
<!-- "label" (e.g. Jud99), or by default serial number -->
|
|
720
|
-
<!-- LaTeX's bibitem will provide the visual brackets -->
|
|
721
|
-
<xsl:text>[</xsl:text>
|
|
722
|
-
<xsl:apply-templates select="." mode="serial-number" />
|
|
723
|
-
<xsl:text>]</xsl:text>
|
|
724
|
-
<!-- "key" for cross-referencing -->
|
|
725
|
-
<xsl:text>{</xsl:text>
|
|
726
|
-
<xsl:apply-templates select="." mode="unique-id"/>
|
|
727
|
-
<xsl:text>}</xsl:text>
|
|
728
|
-
<xsl:apply-templates select="." mode="label" />
|
|
729
|
-
<xsl:apply-templates/>
|
|
730
|
-
<xsl:text>
</xsl:text>
|
|
731
|
-
</xsl:template>
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
<!-- A much smaller version from common: -->
|
|
735
|
-
<!-- TODO: Refactor this to give only what we need. -->
|
|
736
|
-
<xsl:template name="create-numbered-tcolorbox">
|
|
737
|
-
<!-- ################## -->
|
|
738
|
-
<!-- Division Numbering -->
|
|
739
|
-
<!-- ################## -->
|
|
740
|
-
<xsl:text>%% Division Numbering: Chapters, Sections, Subsections, etc
</xsl:text>
|
|
741
|
-
<xsl:text>%% Division numbers may be turned off at some level ("depth")
</xsl:text>
|
|
742
|
-
<xsl:text>%% A section *always* has depth 1, contrary to us counting from the document root
</xsl:text>
|
|
743
|
-
<xsl:text>%% The latex default is 3. If a larger number is present here, then
</xsl:text>
|
|
744
|
-
<xsl:text>%% removing this command may make some cross-references ambiguous
</xsl:text>
|
|
745
|
-
<xsl:text>%% The precursor variable $numbering-maxlevel is checked for consistency in the common XSL file
</xsl:text>
|
|
746
|
-
<xsl:text>\setcounter{secnumdepth}{</xsl:text>
|
|
747
|
-
<xsl:value-of select="$latex-numbering-maxlevel" />
|
|
748
|
-
<xsl:text>}
</xsl:text>
|
|
749
|
-
<xsl:text>%%
</xsl:text>
|
|
750
|
-
|
|
751
|
-
<!-- -->
|
|
752
|
-
<xsl:text>%%
</xsl:text>
|
|
753
|
-
<xsl:text>%% A faux tcolorbox whose only purpose is to provide common numbering
</xsl:text>
|
|
754
|
-
<xsl:text>%% facilities for most blocks (possibly not projects, 2D displays)
</xsl:text>
|
|
755
|
-
<xsl:text>%% Controlled by numbering.theorems.level processing parameter
</xsl:text>
|
|
756
|
-
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
757
|
-
<!-- control the levels of the numbering -->
|
|
758
|
-
<!-- global (no periods) is the default -->
|
|
759
|
-
<xsl:if test="not($numbering-blocks = 0)">
|
|
760
|
-
<xsl:text>, number within=</xsl:text>
|
|
761
|
-
<xsl:call-template name="level-to-name">
|
|
762
|
-
<xsl:with-param name="level" select="$numbering-blocks" />
|
|
763
|
-
</xsl:call-template>
|
|
764
|
-
</xsl:if>
|
|
765
|
-
<xsl:text>]{block}{}
</xsl:text>
|
|
766
|
-
<!-- should condition on $project-reps, but it is not defined yet -->
|
|
767
|
-
<xsl:if test="$b-number-project-distinct">
|
|
768
|
-
<xsl:text>%%
</xsl:text>
|
|
769
|
-
<xsl:text>%% This document is set to number PROJECT-LIKE on a separate numbering scheme
</xsl:text>
|
|
770
|
-
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
771
|
-
<xsl:text>%% Controlled by numbering.projects.level processing parameter
</xsl:text>
|
|
772
|
-
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
773
|
-
<!-- control the levels of the numbering -->
|
|
774
|
-
<!-- global (no periods) is the default -->
|
|
775
|
-
<xsl:if test="not($numbering-projects = 0)">
|
|
776
|
-
<xsl:text>, number within=</xsl:text>
|
|
777
|
-
<xsl:call-template name="level-to-name">
|
|
778
|
-
<xsl:with-param name="level" select="$numbering-projects" />
|
|
779
|
-
</xsl:call-template>
|
|
780
|
-
</xsl:if>
|
|
781
|
-
<xsl:text>]{project-distinct}{}
</xsl:text>
|
|
782
|
-
</xsl:if>
|
|
783
|
-
<xsl:if test="$b-number-exercise-distinct">
|
|
784
|
-
<xsl:text>%%
</xsl:text>
|
|
785
|
-
<xsl:text>%% This document is set to number inline exercises on a separate numbering scheme
</xsl:text>
|
|
786
|
-
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
787
|
-
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
788
|
-
<!-- control the levels of the numbering -->
|
|
789
|
-
<!-- global (no periods) is the default -->
|
|
790
|
-
<xsl:if test="not($numbering-exercises = 0)">
|
|
791
|
-
<xsl:text>, number within=</xsl:text>
|
|
792
|
-
<xsl:call-template name="level-to-name">
|
|
793
|
-
<xsl:with-param name="level" select="$numbering-exercises" />
|
|
794
|
-
</xsl:call-template>
|
|
795
|
-
</xsl:if>
|
|
796
|
-
<xsl:text>]{exercise-distinct}{}
</xsl:text>
|
|
797
|
-
</xsl:if>
|
|
798
|
-
<xsl:if test="$b-number-figure-distinct">
|
|
799
|
-
<xsl:text>%%
</xsl:text>
|
|
800
|
-
<xsl:text>%% This document is set to number figure, table, list, listing on a separate numbering scheme
</xsl:text>
|
|
801
|
-
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
802
|
-
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
803
|
-
<!-- control the levels of the numbering -->
|
|
804
|
-
<!-- global (no periods) is the default -->
|
|
805
|
-
<xsl:if test="not($numbering-figures = 0)">
|
|
806
|
-
<xsl:text>, number within=</xsl:text>
|
|
807
|
-
<xsl:call-template name="level-to-name">
|
|
808
|
-
<xsl:with-param name="level" select="$numbering-figures" />
|
|
809
|
-
</xsl:call-template>
|
|
810
|
-
</xsl:if>
|
|
811
|
-
<xsl:text>]{figure-distinct}{}
</xsl:text>
|
|
812
|
-
</xsl:if>
|
|
813
|
-
<xsl:if test="$b-number-openproblem-distinct">
|
|
814
|
-
<xsl:text>%%
</xsl:text>
|
|
815
|
-
<xsl:text>%% This document is set to number OPENPROBLEM-LIKE on a separate numbering scheme
</xsl:text>
|
|
816
|
-
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
817
|
-
<xsl:text>%% Controlled by numbering.openproblems.level processing parameter
</xsl:text>
|
|
818
|
-
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
819
|
-
<!-- control the levels of the numbering -->
|
|
820
|
-
<!-- global (no periods) is the default -->
|
|
821
|
-
<xsl:if test="not($numbering-openproblems = 0)">
|
|
822
|
-
<xsl:text>, number within=</xsl:text>
|
|
823
|
-
<xsl:call-template name="level-to-name">
|
|
824
|
-
<xsl:with-param name="level" select="$numbering-openproblems" />
|
|
825
|
-
</xsl:call-template>
|
|
826
|
-
</xsl:if>
|
|
827
|
-
<xsl:text>]{openproblem-distinct}{}
</xsl:text>
|
|
828
|
-
</xsl:if>
|
|
829
|
-
<!-- TODO: condition of figure/*/figure-like, or $subfigure-reps -->
|
|
830
|
-
<xsl:text>%% A faux tcolorbox whose only purpose is to provide common numbering
</xsl:text>
|
|
831
|
-
<xsl:text>%% facilities for 2D displays which are subnumbered as part of a "sidebyside"
</xsl:text>
|
|
832
|
-
<!-- faux subdisplay requires manipulating low-level counters -->
|
|
833
|
-
<!-- TODO: condition on presence of (plain) 2-D displays to limit use? -->
|
|
834
|
-
<xsl:text>\makeatletter
</xsl:text>
|
|
835
|
-
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
836
|
-
<!-- control the levels of the numbering -->
|
|
837
|
-
<!-- global (no periods) is the default -->
|
|
838
|
-
<xsl:text>, number within=</xsl:text>
|
|
839
|
-
<xsl:choose>
|
|
840
|
-
<xsl:when test="$b-number-figure-distinct">
|
|
841
|
-
<xsl:text>tcb@cnt@figure-distinct</xsl:text>
|
|
842
|
-
</xsl:when>
|
|
843
|
-
<xsl:otherwise>
|
|
844
|
-
<xsl:text>tcb@cnt@block</xsl:text>
|
|
845
|
-
</xsl:otherwise>
|
|
846
|
-
</xsl:choose>
|
|
847
|
-
<xsl:text>, number freestyle={\noexpand\thetcb@cnt@block(\noexpand\alph{\tcbcounter})}</xsl:text>
|
|
848
|
-
<xsl:text>]{subdisplay}{}
</xsl:text>
|
|
849
|
-
<!-- faux subdisplay requires manipulating low-level counters -->
|
|
850
|
-
<xsl:text>\makeatother
</xsl:text>
|
|
851
|
-
<!-- Groups of environments/blocks -->
|
|
852
|
-
|
|
853
|
-
<!-- GOAL-LIKE -->
|
|
854
|
-
<xsl:variable name="goal-reps" select="
|
|
855
|
-
($document-root//objectives)[1]|
|
|
856
|
-
($document-root//outcomes)[1]"/>
|
|
857
|
-
<xsl:if test="$goal-reps">
|
|
858
|
-
<xsl:text>%%
</xsl:text>
|
|
859
|
-
<xsl:text>%% tcolorbox, with styles, for GOAL-LIKE
</xsl:text>
|
|
860
|
-
<xsl:text>%%
</xsl:text>
|
|
861
|
-
</xsl:if>
|
|
862
|
-
<xsl:for-each select="$goal-reps">
|
|
863
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
864
|
-
</xsl:for-each>
|
|
865
|
-
|
|
866
|
-
<!-- FIGURE-LIKE -->
|
|
867
|
-
<!-- FIGURE-LIKE come in three flavors: blocks (not in a side-by-side), -->
|
|
868
|
-
<!-- panels (in a side-by-side, but not in an overall "figure"), or -->
|
|
869
|
-
<!-- subnumbered (panel of a side-by-side, which is then in an overall -->
|
|
870
|
-
<!-- "figure'). Selections must be careful (not like dropping through -->
|
|
871
|
-
<!-- a choose/when). Environments need to consider title/caption -->
|
|
872
|
-
<!-- placement and counters. So we might create twelve different -->
|
|
873
|
-
<!-- environments here. In -common, see the "figure-placement" template -->
|
|
874
|
-
<!-- for another determination, and a more careful explanation. -->
|
|
875
|
-
<!-- (There was once a subtle bug when we were not so careful here.) -->
|
|
876
|
-
<xsl:variable name="figure-reps" select="
|
|
877
|
-
($document-root//figure[not(parent::sidebyside)])[1]|
|
|
878
|
-
($document-root//table[not(parent::sidebyside)])[1]|
|
|
879
|
-
($document-root//listing[not(parent::sidebyside)])[1]|
|
|
880
|
-
($document-root//list[not(parent::sidebyside)])[1]"/>
|
|
881
|
-
<xsl:if test="$figure-reps">
|
|
882
|
-
<xsl:text>%%
</xsl:text>
|
|
883
|
-
<xsl:text>%% tcolorbox, with styles, for FIGURE-LIKE
</xsl:text>
|
|
884
|
-
<xsl:text>%%
</xsl:text>
|
|
885
|
-
</xsl:if>
|
|
886
|
-
<xsl:for-each select="$figure-reps">
|
|
887
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
888
|
-
</xsl:for-each>
|
|
889
|
-
<!-- (PANEL)FIGURE-LIKE -->
|
|
890
|
-
<!-- sidebyside panel versions, if not contained by overall figure -->
|
|
891
|
-
<xsl:variable name="panel-reps" select="
|
|
892
|
-
($document-root//sidebyside/figure[not(ancestor::figure)])[1]|
|
|
893
|
-
($document-root//sidebyside/table[not(ancestor::figure)])[1]|
|
|
894
|
-
($document-root//sidebyside/listing[not(ancestor::figure)])[1]|
|
|
895
|
-
($document-root//sidebyside/list[not(ancestor::figure)])[1]"/>
|
|
896
|
-
<xsl:if test="$panel-reps">
|
|
897
|
-
<xsl:text>%%
</xsl:text>
|
|
898
|
-
<xsl:text>%% tcolorbox, with styles, for (PANEL)FIGURE-LIKE
</xsl:text>
|
|
899
|
-
<xsl:text>%%
</xsl:text>
|
|
900
|
-
</xsl:if>
|
|
901
|
-
<xsl:for-each select="$panel-reps">
|
|
902
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
903
|
-
</xsl:for-each>
|
|
904
|
-
<!-- (SUB)FIGURE-LIKE -->
|
|
905
|
-
<!-- subnumbered versions, if contained by overall figure -->
|
|
906
|
-
<xsl:variable name="subnumber-reps" select="
|
|
907
|
-
($document-root//figure/sidebyside/figure|$document-root//figure/sbsgroup/sidebyside/figure)[1]|
|
|
908
|
-
($document-root//figure/sidebyside/table|$document-root//figure/sbsgroup/sidebyside/table)[1]|
|
|
909
|
-
($document-root//figure/sidebyside/listing|$document-root//figure/sbsgroup/sidebyside/listing)[1]|
|
|
910
|
-
($document-root//figure/sidebyside/list|$document-root//figure/sbsgroup/sidebyside/list)[1]"/>
|
|
911
|
-
<xsl:if test="$subnumber-reps">
|
|
912
|
-
<xsl:text>%%
</xsl:text>
|
|
913
|
-
<xsl:text>%% tcolorbox, with styles, for (SUB)FIGURE-LIKE
</xsl:text>
|
|
914
|
-
<xsl:text>%%
</xsl:text>
|
|
915
|
-
</xsl:if>
|
|
916
|
-
<xsl:for-each select="$subnumber-reps">
|
|
917
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
918
|
-
</xsl:for-each>
|
|
919
|
-
|
|
920
|
-
<!-- MISCELLANEOUS -->
|
|
921
|
-
<!-- "paragraphs" are partly like a division, -->
|
|
922
|
-
<!-- but we include it here as a one-off -->
|
|
923
|
-
<xsl:variable name="miscellaneous-reps" select="
|
|
924
|
-
($document-root//gi)[1]|
|
|
925
|
-
($document-root//backmatter/colophon)[1]"/>
|
|
926
|
-
<xsl:if test="$miscellaneous-reps">
|
|
927
|
-
<xsl:text>%%
</xsl:text>
|
|
928
|
-
<xsl:text>%% tcolorbox, with styles, for miscellaneous environments
</xsl:text>
|
|
929
|
-
<xsl:text>%%
</xsl:text>
|
|
930
|
-
</xsl:if>
|
|
931
|
-
<xsl:for-each select="$miscellaneous-reps">
|
|
932
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
933
|
-
</xsl:for-each>
|
|
934
|
-
</xsl:template>
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
<!-- Preamble template for elements needed to produce the frontmatter -->
|
|
938
|
-
<xsl:template name="frontmatter-helpers">
|
|
939
|
-
<!-- If there is a <support> tag in an article, create a unnumbered footnote environment for it -->
|
|
940
|
-
<!-- NB: this is also part of the footnote-numbering named template (as of 2025-02-24), but we don't call that for -classic -->
|
|
941
|
-
<xsl:if test="$b-is-article and $bibinfo/support">
|
|
942
|
-
<xsl:text>%% add a \support command as unnumbered footnote
</xsl:text>
|
|
943
|
-
<xsl:text>\let\svdthefootnote\thefootnote%
</xsl:text>
|
|
944
|
-
<xsl:text>\newcommand\support[1]{%
</xsl:text>
|
|
945
|
-
<xsl:text> \let\thefootnote\relax%
</xsl:text>
|
|
946
|
-
<xsl:text> \footnotetext{#1}%
</xsl:text>
|
|
947
|
-
<xsl:text> \let\thefootnote\svdthefootnote%
</xsl:text>
|
|
948
|
-
<xsl:text>}
</xsl:text>
|
|
949
|
-
</xsl:if>
|
|
950
|
-
</xsl:template>
|
|
951
|
-
|
|
952
|
-
</xsl:stylesheet>
|
|
1
|
+
<?xml version='1.0'?>
|
|
2
|
+
|
|
3
|
+
<!--********************************************************************
|
|
4
|
+
Copyright 2020 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
|
+
|
|
23
|
+
<!-- WARNING: this is an experimental conversion for LaTeX -->
|
|
24
|
+
<!-- Use `pretext-latex.xsl` for the standard conversion. -->
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
<!-- Conveniences for classes of similar elements -->
|
|
28
|
+
<!DOCTYPE xsl:stylesheet [
|
|
29
|
+
<!ENTITY % entities SYSTEM "./entities.ent">
|
|
30
|
+
%entities;
|
|
31
|
+
]>
|
|
32
|
+
|
|
33
|
+
<!-- Identify as a stylesheet -->
|
|
34
|
+
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
|
|
35
|
+
xmlns:xml="http://www.w3.org/XML/1998/namespace"
|
|
36
|
+
>
|
|
37
|
+
|
|
38
|
+
<!-- We override specific templates of the common conversion -->
|
|
39
|
+
|
|
40
|
+
<xsl:import href="./pretext-latex-common.xsl" />
|
|
41
|
+
|
|
42
|
+
<!-- Note (2025-01-29): This is the start of a new "classic" -->
|
|
43
|
+
<!-- latex conversion that can be used to create journal-ready -->
|
|
44
|
+
<!-- latex documents. It is still a work in progress, although -->
|
|
45
|
+
<!-- it does now produce a working amsart latex file. -->
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
<xsl:template match="/">
|
|
49
|
+
<xsl:call-template name="banner-warning">
|
|
50
|
+
<xsl:with-param name="warning">You are using (a version of) the pretext-latex-classic conversion, which is still experimental and under development.</xsl:with-param>
|
|
51
|
+
</xsl:call-template>
|
|
52
|
+
<xsl:apply-imports />
|
|
53
|
+
</xsl:template>
|
|
54
|
+
|
|
55
|
+
<!-- Currently there are no changes for a book (or letter or memo), so we note this and exit -->
|
|
56
|
+
<xsl:template match="book|letter|memo">
|
|
57
|
+
<xsl:call-template name="banner-warning">
|
|
58
|
+
<xsl:with-param name="warning">You have selected a latex style designed for articles, but are not building an article. The resulting output will be identical to that of not specifying any latex style.</xsl:with-param>
|
|
59
|
+
</xsl:call-template>
|
|
60
|
+
</xsl:template>
|
|
61
|
+
|
|
62
|
+
<!-- Do not support exercises or reading questions or solutions -->
|
|
63
|
+
<xsl:template match="exercises|reading-questions|solutions">
|
|
64
|
+
<xsl:call-template name="banner-warning">
|
|
65
|
+
<xsl:with-param name="warning">Exercises divisions are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
66
|
+
</xsl:call-template>
|
|
67
|
+
</xsl:template>
|
|
68
|
+
|
|
69
|
+
<!-- Do not support glossary yet -->
|
|
70
|
+
<xsl:template match="glossary">
|
|
71
|
+
<xsl:call-template name="banner-warning">
|
|
72
|
+
<xsl:with-param name="warning">Glossary divisions are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
73
|
+
</xsl:call-template>
|
|
74
|
+
</xsl:template>
|
|
75
|
+
|
|
76
|
+
<xsl:template match="section//references">
|
|
77
|
+
<xsl:call-template name="banner-warning">
|
|
78
|
+
<xsl:with-param name="warning">References (bibliography) for individual sections are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken. You can still have a bibliography at the end of your article.</xsl:with-param>
|
|
79
|
+
</xsl:call-template>
|
|
80
|
+
</xsl:template>
|
|
81
|
+
|
|
82
|
+
<xsl:template match="worksheet">
|
|
83
|
+
<xsl:call-template name="banner-warning">
|
|
84
|
+
<xsl:with-param name="warning">Worksheets are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
85
|
+
</xsl:call-template>
|
|
86
|
+
</xsl:template>
|
|
87
|
+
|
|
88
|
+
<xsl:template match="handout">
|
|
89
|
+
<xsl:call-template name="banner-warning">
|
|
90
|
+
<xsl:with-param name="warning">Handouts are not yet supported in latex-classic conversions. No content of such a division will be included in your output, and xref's to such divisions will be broken.</xsl:with-param>
|
|
91
|
+
</xsl:call-template>
|
|
92
|
+
</xsl:template>
|
|
93
|
+
|
|
94
|
+
<!-- Defaults that can be overriden by style files -->
|
|
95
|
+
<xsl:variable name="documentclass" select="'article'"/>
|
|
96
|
+
<xsl:variable name="bibliographystyle" select="'amsplain'"/>
|
|
97
|
+
|
|
98
|
+
<!-- An article, LaTeX structure -->
|
|
99
|
+
<!-- One page, full of sections (with abstract, references) -->
|
|
100
|
+
<!-- Or, one page, totally unstructured, just lots of paragraphs, widgets, etc -->
|
|
101
|
+
<xsl:template match="article">
|
|
102
|
+
<xsl:call-template name="converter-blurb-latex"/>
|
|
103
|
+
<xsl:call-template name="snapshot-package-info"/>
|
|
104
|
+
<xsl:text>\documentclass[</xsl:text>
|
|
105
|
+
<xsl:call-template name="sidedness"/>
|
|
106
|
+
<xsl:text>,</xsl:text>
|
|
107
|
+
<xsl:value-of select="$font-size"/>
|
|
108
|
+
<xsl:text>,</xsl:text>
|
|
109
|
+
<xsl:if test="$b-latex-draft-mode" >
|
|
110
|
+
<xsl:text>draft,</xsl:text>
|
|
111
|
+
</xsl:if>
|
|
112
|
+
<xsl:text>]{</xsl:text>
|
|
113
|
+
<xsl:value-of select="$documentclass" />
|
|
114
|
+
<xsl:text>}
</xsl:text>
|
|
115
|
+
|
|
116
|
+
<xsl:call-template name="latex-preamble" />
|
|
117
|
+
|
|
118
|
+
<xsl:call-template name="bibinfo-pre-begin-document" />
|
|
119
|
+
<xsl:text>\begin{document}
</xsl:text>
|
|
120
|
+
<xsl:call-template name="bibinfo-post-begin-document" />
|
|
121
|
+
|
|
122
|
+
<xsl:apply-templates select="*"/>
|
|
123
|
+
|
|
124
|
+
<xsl:text>\end{document}
</xsl:text>
|
|
125
|
+
</xsl:template>
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
<xsl:template name="latex-preamble">
|
|
129
|
+
<!-- Some journal styles require specific packages be loaded right away -->
|
|
130
|
+
<xsl:call-template name="journal-packages"/>
|
|
131
|
+
<xsl:call-template name="frontmatter-helpers"/>
|
|
132
|
+
<xsl:call-template name="preamble-early"/>
|
|
133
|
+
<xsl:call-template name="cleardoublepage"/>
|
|
134
|
+
<xsl:call-template name="standard-packages"/>
|
|
135
|
+
<xsl:call-template name="latex-theorem-environments"/>
|
|
136
|
+
<xsl:call-template name="tcolorbox-init"/>
|
|
137
|
+
<xsl:call-template name="numberless-environments"/>
|
|
138
|
+
<xsl:call-template name="page-setup"/>
|
|
139
|
+
<xsl:call-template name="latex-engine-support"/>
|
|
140
|
+
<xsl:call-template name="font-support"/>
|
|
141
|
+
<xsl:call-template name="math-packages"/>
|
|
142
|
+
<xsl:call-template name="text-symbols"/>
|
|
143
|
+
<xsl:call-template name="pdfpages-package"/>
|
|
144
|
+
<!--<xsl:call-template name="division-titles"/>-->
|
|
145
|
+
<xsl:call-template name="semantic-macros"/>
|
|
146
|
+
<xsl:call-template name="exercises-and-solutions"/>
|
|
147
|
+
<xsl:call-template name="chapter-start-number"/>
|
|
148
|
+
<xsl:call-template name="equation-numbering"/>
|
|
149
|
+
<xsl:call-template name="image-tcolorbox"/>
|
|
150
|
+
<xsl:call-template name="tables"/>
|
|
151
|
+
<!--<xsl:call-template name="footnote-numbering"/> -->
|
|
152
|
+
<xsl:call-template name="font-awesome"/>
|
|
153
|
+
<xsl:call-template name="poetry-support"/>
|
|
154
|
+
<xsl:call-template name="music-support"/>
|
|
155
|
+
<xsl:call-template name="code-support"/>
|
|
156
|
+
<xsl:call-template name="list-layout"/>
|
|
157
|
+
<xsl:call-template name="load-configure-hyperref"/>
|
|
158
|
+
<xsl:call-template name="create-numbered-tcolorbox"/>
|
|
159
|
+
<xsl:call-template name="watermark"/>
|
|
160
|
+
<xsl:call-template name="showkeys"/>
|
|
161
|
+
<xsl:call-template name="latex-image-support"/>
|
|
162
|
+
<xsl:call-template name="sidebyside-environment"/>
|
|
163
|
+
<xsl:call-template name="kbd-keys"/>
|
|
164
|
+
<xsl:call-template name="late-preamble-adjustments"/>
|
|
165
|
+
</xsl:template>
|
|
166
|
+
|
|
167
|
+
<!-- No journal-packages by default; can be overridden by importing xsl -->
|
|
168
|
+
<xsl:template name="journal-packages"/>
|
|
169
|
+
|
|
170
|
+
<!-- paragraph and page setup -->
|
|
171
|
+
<!-- TODO: Clean this up with just what -classic needs. -->
|
|
172
|
+
<xsl:template name="page-setup">
|
|
173
|
+
<!-- This should save-off the indentation used for the first line of -->
|
|
174
|
+
<!-- a paragraph, in effect for the chosen document class. Then the -->
|
|
175
|
+
<!-- "parbox" used by "tcolorbox" can restore indentation rather than -->
|
|
176
|
+
<!-- run with none. Part of -->
|
|
177
|
+
<!-- https://tex.stackexchange.com/questions/250165/ -->
|
|
178
|
+
<!-- normal-body-text-within-tcolorbox -->
|
|
179
|
+
<!-- In a similar fashion we save/restore the parskip, only should -->
|
|
180
|
+
<!-- an ambitious publisher try to set it globally -->
|
|
181
|
+
<xsl:text>%% Save default paragraph indentation and parskip for use later, when adjusting parboxes
</xsl:text>
|
|
182
|
+
<xsl:text>\newlength{\ptxnormalparindent}
</xsl:text>
|
|
183
|
+
<xsl:text>\newlength{\ptxnormalparskip}
</xsl:text>
|
|
184
|
+
<xsl:text>\AtBeginDocument{\setlength{\ptxnormalparindent}{\parindent}}
</xsl:text>
|
|
185
|
+
<xsl:text>\AtBeginDocument{\setlength{\ptxnormalparskip}{\parskip}}
</xsl:text>
|
|
186
|
+
<xsl:text>\newcommand{\setparstyle}{\setlength{\parindent}{\ptxnormalparindent}\setlength{\parskip}{\ptxnormalparskip}}</xsl:text>
|
|
187
|
+
|
|
188
|
+
<!-- could condition on "subfigure-reps" -->
|
|
189
|
+
<xsl:if test="$b-has-sidebyside">
|
|
190
|
+
<xsl:text>%% shorter subnumbers in some side-by-side require manipulations
</xsl:text>
|
|
191
|
+
<xsl:text>\usepackage{xstring}
</xsl:text>
|
|
192
|
+
</xsl:if>
|
|
193
|
+
<!--<xsl:if test="$document-root//fn|$document-root//part">
|
|
194
|
+
<xsl:text>%% Footnote counters and part/chapter counters are manipulated
</xsl:text>
|
|
195
|
+
<xsl:text>%% April 2018: chngcntr commands now integrated into the kernel,
</xsl:text>
|
|
196
|
+
<xsl:text>%% but circa 2018/2019 the package would still try to redefine them,
</xsl:text>
|
|
197
|
+
<xsl:text>%% so we need to do the work of loading conditionally for old kernels.
</xsl:text>
|
|
198
|
+
<xsl:text>%% From version 1.1a, chngcntr should detect defintions made by LaTeX kernel.
</xsl:text>
|
|
199
|
+
<xsl:text>\ifdefined\counterwithin
</xsl:text>
|
|
200
|
+
<xsl:text>\else
</xsl:text>
|
|
201
|
+
<xsl:text> \usepackage{chngcntr}
</xsl:text>
|
|
202
|
+
<xsl:text>\fi
</xsl:text>-->
|
|
203
|
+
<!-- implies book/part -->
|
|
204
|
+
<!--<xsl:if test="$parts = 'structural'">
|
|
205
|
+
<xsl:text>%% Structural chapter numbers reset within parts
</xsl:text>
|
|
206
|
+
<xsl:text>%% Starred form will not prefix part number
</xsl:text>
|
|
207
|
+
<xsl:text>\counterwithin*{chapter}{part}
</xsl:text>
|
|
208
|
+
</xsl:if>-->
|
|
209
|
+
<!--</xsl:if>-->
|
|
210
|
+
<!-- Determine height of text block, assumes US letterpaper (11in height) -->
|
|
211
|
+
<!-- Could react to document type, paper, margin specs -->
|
|
212
|
+
<!--<xsl:variable name="text-height">
|
|
213
|
+
<xsl:text>9.0in</xsl:text>
|
|
214
|
+
</xsl:variable>-->
|
|
215
|
+
<!-- Bringhurst: 30x => 66 chars, so 34x => 75 chars -->
|
|
216
|
+
<!--<xsl:variable name="text-width">
|
|
217
|
+
<xsl:value-of select="34 * substring-before($font-size, 'pt')" />
|
|
218
|
+
<xsl:text>pt</xsl:text>
|
|
219
|
+
</xsl:variable>-->
|
|
220
|
+
<!--<xsl:text>%% Text height identically 9 inches, text width varies on point size
</xsl:text>
|
|
221
|
+
<xsl:text>%% See Bringhurst 2.1.1 on measure for recommendations
</xsl:text>
|
|
222
|
+
<xsl:text>%% 75 characters per line (count spaces, punctuation) is target
</xsl:text>
|
|
223
|
+
<xsl:text>%% which is the upper limit of Bringhurst's recommendations
</xsl:text>
|
|
224
|
+
<xsl:text>\geometry{letterpaper,total={</xsl:text>
|
|
225
|
+
<xsl:value-of select="$text-width" />
|
|
226
|
+
<xsl:text>,</xsl:text>
|
|
227
|
+
<xsl:value-of select="$text-height" />
|
|
228
|
+
<xsl:text>}}
</xsl:text>-->
|
|
229
|
+
<xsl:text>%% Custom Page Layout Adjustments (use publisher page-geometry entry)
</xsl:text>
|
|
230
|
+
<xsl:if test="$latex-page-geometry != ''">
|
|
231
|
+
<xsl:text>\geometry{</xsl:text>
|
|
232
|
+
<xsl:value-of select="$latex-page-geometry" />
|
|
233
|
+
<xsl:text>}
</xsl:text>
|
|
234
|
+
</xsl:if>
|
|
235
|
+
<!-- Crop marks, as independent of author tools -->
|
|
236
|
+
<!-- Always *after* geometry package, no driver selected, -->
|
|
237
|
+
<!-- since it should auto-detect. Tested with xelatex. -->
|
|
238
|
+
<!-- crop package suggests explicitly turning off driver -->
|
|
239
|
+
<!-- options for the geometery package. We don't. -->
|
|
240
|
+
<xsl:if test="$b-latex-crop-marks">
|
|
241
|
+
<xsl:text>\usepackage[</xsl:text>
|
|
242
|
+
<xsl:value-of select="$latex-crop-papersize"/>
|
|
243
|
+
<xsl:text>,cam,center]{crop}
</xsl:text>
|
|
244
|
+
</xsl:if>
|
|
245
|
+
<xsl:if test="$latex-right-alignment = 'ragged'">
|
|
246
|
+
<xsl:text>%% better handing of text alignment
</xsl:text>
|
|
247
|
+
<xsl:text>\usepackage{ragged2e}
</xsl:text>
|
|
248
|
+
</xsl:if>
|
|
249
|
+
</xsl:template>
|
|
250
|
+
|
|
251
|
+
<!-- By default, no bibinfo is included before the \begin{document}. -->
|
|
252
|
+
<!-- Other latex styles can override this to put some information there. -->
|
|
253
|
+
<xsl:template name="bibinfo-pre-begin-document">
|
|
254
|
+
<xsl:apply-templates select="$document-root" mode="article-title"/>
|
|
255
|
+
<!--<xsl:apply-templates select="$bibinfo/support" mode="article-frontmatter"/>-->
|
|
256
|
+
<xsl:call-template name="article-authors"/>
|
|
257
|
+
<xsl:apply-templates select="$bibinfo/date" mode="article-frontmatter"/>
|
|
258
|
+
</xsl:template>
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
<!-- By default, all bibinfo goes inside (after) \begin{document}. -->
|
|
262
|
+
<!-- Other latex styles can override this in combination with the pre-version. -->
|
|
263
|
+
<!-- Order of bibinfo elements after \begin{document} -->
|
|
264
|
+
<xsl:template name="bibinfo-post-begin-document">
|
|
265
|
+
<xsl:text>\maketitle
</xsl:text>
|
|
266
|
+
<xsl:apply-templates select="$document-root/frontmatter/abstract" mode="article-frontmatter"/>
|
|
267
|
+
</xsl:template>
|
|
268
|
+
|
|
269
|
+
<xsl:template match="*" mode="article-title">
|
|
270
|
+
<xsl:text>%% Title page information for article
</xsl:text>
|
|
271
|
+
<xsl:text>\title{</xsl:text>
|
|
272
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
273
|
+
<xsl:apply-templates select="$bibinfo/support" mode="article-frontmatter"/>
|
|
274
|
+
<xsl:if test="subtitle">
|
|
275
|
+
<xsl:text>\\
</xsl:text>
|
|
276
|
+
<!-- Trying to match author fontsize -->
|
|
277
|
+
<xsl:text>{\small </xsl:text>
|
|
278
|
+
<xsl:apply-templates select="." mode="subtitle"/>
|
|
279
|
+
<xsl:text>}</xsl:text>
|
|
280
|
+
</xsl:if>
|
|
281
|
+
<xsl:text>}
</xsl:text>
|
|
282
|
+
</xsl:template>
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
<!-- For now, this just wraps the common article-info for author in an \author{...} tag -->
|
|
286
|
+
<xsl:template name="article-authors">
|
|
287
|
+
<xsl:text>\author{</xsl:text>
|
|
288
|
+
<xsl:apply-templates select="$bibinfo/author" mode="article-frontmatter"/>
|
|
289
|
+
<xsl:text>}
</xsl:text>
|
|
290
|
+
</xsl:template>
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
<xsl:template match="author" mode="article-frontmatter">
|
|
294
|
+
<xsl:apply-templates select="personname" />
|
|
295
|
+
<xsl:if test="support">
|
|
296
|
+
<xsl:text>\thanks{</xsl:text>
|
|
297
|
+
<xsl:apply-templates select="support" />
|
|
298
|
+
<xsl:text>}</xsl:text>
|
|
299
|
+
</xsl:if>
|
|
300
|
+
<xsl:if test="affiliation">
|
|
301
|
+
<xsl:text>\\
</xsl:text>
|
|
302
|
+
<xsl:apply-templates select="affiliation" />
|
|
303
|
+
</xsl:if>
|
|
304
|
+
<xsl:if test="email">
|
|
305
|
+
<xsl:text>\\
</xsl:text>
|
|
306
|
+
<xsl:apply-templates select="email" mode="article-info"/>
|
|
307
|
+
</xsl:if>
|
|
308
|
+
<xsl:if test="following-sibling::author" >
|
|
309
|
+
<xsl:text>
\and</xsl:text>
|
|
310
|
+
</xsl:if>
|
|
311
|
+
<xsl:text>
</xsl:text>
|
|
312
|
+
</xsl:template>
|
|
313
|
+
|
|
314
|
+
|
|
315
|
+
<!-- Preprocessor always puts Department, Institution, and Address -->
|
|
316
|
+
<!-- inside Affiliation. This just adds line breaks between them as needed. -->
|
|
317
|
+
<xsl:template match="affiliation">
|
|
318
|
+
<xsl:param name="sep" select="'\\
'"/>
|
|
319
|
+
<xsl:param name="after"/>
|
|
320
|
+
<xsl:if test="department">
|
|
321
|
+
<xsl:apply-templates select="department">
|
|
322
|
+
<xsl:with-param name="sep" select="$sep"/>
|
|
323
|
+
</xsl:apply-templates>
|
|
324
|
+
<xsl:if test="department/following-sibling::*">
|
|
325
|
+
<xsl:value-of select="$sep"/>
|
|
326
|
+
</xsl:if>
|
|
327
|
+
</xsl:if>
|
|
328
|
+
<xsl:if test="institution">
|
|
329
|
+
<xsl:apply-templates select="institution">
|
|
330
|
+
<xsl:with-param name="sep" select="$sep"/>
|
|
331
|
+
</xsl:apply-templates>
|
|
332
|
+
<xsl:if test="institution/following-sibling::*">
|
|
333
|
+
<xsl:value-of select="$sep"/>
|
|
334
|
+
</xsl:if>
|
|
335
|
+
</xsl:if>
|
|
336
|
+
<xsl:if test="location">
|
|
337
|
+
<xsl:apply-templates select="location">
|
|
338
|
+
<xsl:with-param name="sep" select="$sep"/>
|
|
339
|
+
</xsl:apply-templates>
|
|
340
|
+
</xsl:if>
|
|
341
|
+
<!-- always end with a new line, after the `after` param if passed -->
|
|
342
|
+
<xsl:value-of select="$after"/>
|
|
343
|
+
<xsl:text>
</xsl:text>
|
|
344
|
+
</xsl:template>
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
<!-- override the default department[line] etc and line templates to use sep param -->
|
|
348
|
+
<xsl:template match="department[line]|institution[line]|location[line]">
|
|
349
|
+
<xsl:param name="sep" select="'\\
'"/>
|
|
350
|
+
<xsl:apply-templates select="line">
|
|
351
|
+
<xsl:with-param name="sep" select="$sep"/>
|
|
352
|
+
</xsl:apply-templates>
|
|
353
|
+
</xsl:template>
|
|
354
|
+
|
|
355
|
+
<xsl:template match="line">
|
|
356
|
+
<xsl:param name="sep" select="'\\
'"/>
|
|
357
|
+
<xsl:apply-templates/>
|
|
358
|
+
<xsl:if test="following-sibling::line">
|
|
359
|
+
<xsl:value-of select="$sep"/>
|
|
360
|
+
</xsl:if>
|
|
361
|
+
</xsl:template>
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
<xsl:template match="bibinfo/date" mode="article-frontmatter">
|
|
365
|
+
<xsl:text>\date{</xsl:text>
|
|
366
|
+
<xsl:apply-templates select="."/>
|
|
367
|
+
<xsl:text>}
</xsl:text>
|
|
368
|
+
</xsl:template>
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
<xsl:template match="bibinfo/support" mode="article-frontmatter">
|
|
372
|
+
<xsl:text>\support{</xsl:text>
|
|
373
|
+
<xsl:apply-templates select="$bibinfo/support" mode="article-info"/>
|
|
374
|
+
<xsl:text>}
</xsl:text>
|
|
375
|
+
</xsl:template>
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
<xsl:template match="frontmatter/abstract" mode="article-frontmatter">
|
|
379
|
+
<xsl:text>\begin{abstract}
</xsl:text>
|
|
380
|
+
<xsl:apply-templates select="*"/>
|
|
381
|
+
<xsl:apply-templates select="$bibinfo/keywords"/>
|
|
382
|
+
<xsl:text>\end{abstract}
</xsl:text>
|
|
383
|
+
</xsl:template>
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
<xsl:template match="email" mode="article-info">
|
|
387
|
+
<xsl:value-of select="." />
|
|
388
|
+
</xsl:template>
|
|
389
|
+
|
|
390
|
+
<!-- Since the bibinfo-post-begin-document takes care of all frontmatter, we kill the frontmatter as a separate thing here -->
|
|
391
|
+
<xsl:template match="article/frontmatter"/>
|
|
392
|
+
|
|
393
|
+
|
|
394
|
+
<!-- latex-common includes a title-page-info-article template, but latex-classic -->
|
|
395
|
+
<!-- does not use this. So we warn in case we forget and call it by mistake. -->
|
|
396
|
+
<xsl:template name="title-page-info-article">
|
|
397
|
+
<xsl:message>PTX:BUG: latex-classic based templates do not use title-page-info-article template.</xsl:message>
|
|
398
|
+
</xsl:template>
|
|
399
|
+
|
|
400
|
+
|
|
401
|
+
<!-- Theorems, Proofs, Definitions, Examples, Exercises -->
|
|
402
|
+
|
|
403
|
+
<!-- Theorems have statement/proof structure -->
|
|
404
|
+
<!-- Definitions have notation, which is handled elsewhere -->
|
|
405
|
+
<!-- Examples have no structure, or have statement and solution -->
|
|
406
|
+
<!-- Exercises have hints, answers and solutions -->
|
|
407
|
+
|
|
408
|
+
<!-- For preamble -->
|
|
409
|
+
<xsl:template name="latex-theorem-environments">
|
|
410
|
+
<xsl:text>%% Theorem-like environments
</xsl:text>
|
|
411
|
+
<xsl:text>%
% amsthm package: redundant if using amsart documentclass, but required otherwise.
</xsl:text>
|
|
412
|
+
<xsl:text>\usepackage{amsthm}%
%
</xsl:text>
|
|
413
|
+
<xsl:text>\theoremstyle{plain}
</xsl:text>
|
|
414
|
+
<!-- We need a counter, and want it to be "theorem" to agree with some journal styles -->
|
|
415
|
+
<!-- So if the document contains theorem's, we can create it. Otherwise we don't care-->
|
|
416
|
+
<!-- what it is called, so we can still use this and it will just have a blank name. -->
|
|
417
|
+
<xsl:text>\newtheorem{theorem}{</xsl:text>
|
|
418
|
+
<xsl:apply-templates select="($document-root//theorem)[1]" mode="type-name"/>
|
|
419
|
+
<xsl:text>}[section]
</xsl:text>
|
|
420
|
+
<!-- Now continue with the remaining elements, checking to see if they are present -->
|
|
421
|
+
<xsl:variable name="theoremstyle-plain" select="
|
|
422
|
+
($document-root//lemma)[1]|
|
|
423
|
+
($document-root//proposition)[1]|
|
|
424
|
+
($document-root//corollary)[1]|
|
|
425
|
+
($document-root//claim)[1]|
|
|
426
|
+
($document-root//fact)[1]|
|
|
427
|
+
($document-root//identity)[1]|
|
|
428
|
+
($document-root//conjecture)[1]
|
|
429
|
+
"/>
|
|
430
|
+
<xsl:for-each select="$theoremstyle-plain">
|
|
431
|
+
<xsl:apply-templates select="." mode="newtheorem"/>
|
|
432
|
+
</xsl:for-each>
|
|
433
|
+
<xsl:text>
</xsl:text>
|
|
434
|
+
|
|
435
|
+
<xsl:text>\theoremstyle{definition}
</xsl:text>
|
|
436
|
+
<xsl:variable name="theoremstyle-definition" select="
|
|
437
|
+
($document-root//definition)[1]|
|
|
438
|
+
($document-root//axiom)[1]|
|
|
439
|
+
($document-root//principle)[1]|
|
|
440
|
+
($document-root//heuristic)[1]|
|
|
441
|
+
($document-root//hypothesis)[1]|
|
|
442
|
+
($document-root//assumption)[1]|
|
|
443
|
+
($document-root//openproblem)[1]|
|
|
444
|
+
($document-root//openquestion)[1]|
|
|
445
|
+
($document-root//algorithm)[1]|
|
|
446
|
+
($document-root//question)[1]|
|
|
447
|
+
($document-root//activity)[1]|
|
|
448
|
+
($document-root//exercise)[1]|
|
|
449
|
+
($document-root//inlineexercise)[1]|
|
|
450
|
+
($document-root//investigation)[1]|
|
|
451
|
+
($document-root//exploration)[1]|
|
|
452
|
+
($document-root//problem)[1]|
|
|
453
|
+
($document-root//example)[1]|
|
|
454
|
+
($document-root//project)[1]
|
|
455
|
+
"/>
|
|
456
|
+
<xsl:for-each select="$theoremstyle-definition">
|
|
457
|
+
<xsl:apply-templates select="." mode="newtheorem"/>
|
|
458
|
+
</xsl:for-each>
|
|
459
|
+
<xsl:text>
</xsl:text>
|
|
460
|
+
|
|
461
|
+
<xsl:text>\theoremstyle{remark}
</xsl:text>
|
|
462
|
+
<xsl:variable name="theoremstyle-remark" select="
|
|
463
|
+
($document-root//convention)[1]|
|
|
464
|
+
($document-root//warning)[1]|
|
|
465
|
+
($document-root//remark)[1]|
|
|
466
|
+
($document-root//insight)[1]|
|
|
467
|
+
($document-root//note)[1]|
|
|
468
|
+
($document-root//observation)[1]|
|
|
469
|
+
($document-root//computation)[1]|
|
|
470
|
+
($document-root//technology)[1]|
|
|
471
|
+
($document-root//data)[1]
|
|
472
|
+
"/>
|
|
473
|
+
<xsl:for-each select="$theoremstyle-remark">
|
|
474
|
+
<xsl:apply-templates select="." mode="newtheorem"/>
|
|
475
|
+
</xsl:for-each>
|
|
476
|
+
<xsl:text>
</xsl:text>
|
|
477
|
+
</xsl:template>
|
|
478
|
+
|
|
479
|
+
<xsl:template match="*" mode="newtheorem">
|
|
480
|
+
<xsl:text>\newtheorem{</xsl:text>
|
|
481
|
+
<xsl:choose>
|
|
482
|
+
<!-- One exception for inline exercises -->
|
|
483
|
+
<xsl:when test="local-name(.) = 'exercise'">
|
|
484
|
+
<xsl:text>inlineexercise</xsl:text>
|
|
485
|
+
</xsl:when>
|
|
486
|
+
<xsl:otherwise>
|
|
487
|
+
<xsl:value-of select="local-name(.)"/>
|
|
488
|
+
</xsl:otherwise>
|
|
489
|
+
</xsl:choose>
|
|
490
|
+
<xsl:text>}[theorem]{</xsl:text>
|
|
491
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
492
|
+
<xsl:text>}
</xsl:text>
|
|
493
|
+
</xsl:template>
|
|
494
|
+
|
|
495
|
+
<!-- Preamble assemblage environment -->
|
|
496
|
+
|
|
497
|
+
<xsl:template name="numberless-environments">
|
|
498
|
+
<!-- Assemblages -->
|
|
499
|
+
<xsl:if test="$document-root//assemblage">
|
|
500
|
+
<xsl:apply-templates select="($document-root//assemblage)[1]" mode="environment"/>
|
|
501
|
+
</xsl:if>
|
|
502
|
+
<!-- ASIDE-LIKE -->
|
|
503
|
+
<xsl:variable name="aside-reps" select="
|
|
504
|
+
($document-root//aside)[1]|
|
|
505
|
+
($document-root//historical)[1]|
|
|
506
|
+
($document-root//biographical)[1]"/>
|
|
507
|
+
<xsl:if test="$aside-reps">
|
|
508
|
+
<xsl:text>%%
</xsl:text>
|
|
509
|
+
<xsl:text>%% tcolorbox, with styles, for ASIDE-LIKE
</xsl:text>
|
|
510
|
+
<xsl:text>%%
</xsl:text>
|
|
511
|
+
</xsl:if>
|
|
512
|
+
<xsl:for-each select="$aside-reps">
|
|
513
|
+
<xsl:apply-templates select="." mode="environment"/>
|
|
514
|
+
</xsl:for-each>
|
|
515
|
+
</xsl:template>
|
|
516
|
+
|
|
517
|
+
<!-- We need to redefine these to be more like regular environments -->
|
|
518
|
+
<xsl:template match="assemblage|&ASIDE-LIKE;" mode="environment">
|
|
519
|
+
<!-- Names of various pieces use the element name -->
|
|
520
|
+
<xsl:variable name="environment-name">
|
|
521
|
+
<xsl:value-of select="local-name(.)"/>
|
|
522
|
+
</xsl:variable>
|
|
523
|
+
<xsl:text>%% </xsl:text>
|
|
524
|
+
<xsl:value-of select="$environment-name"/>
|
|
525
|
+
<xsl:text>: fairly simple un-numbered block/structure
</xsl:text>
|
|
526
|
+
<xsl:text>\tcbset{ </xsl:text>
|
|
527
|
+
<xsl:value-of select="$environment-name"/>
|
|
528
|
+
<xsl:text>style/.style={</xsl:text>
|
|
529
|
+
<xsl:apply-templates select="." mode="tcb-style"/>
|
|
530
|
+
<xsl:text>} }
</xsl:text>
|
|
531
|
+
<xsl:text>\newtcolorbox{</xsl:text>
|
|
532
|
+
<xsl:value-of select="$environment-name"/>
|
|
533
|
+
<xsl:text>}[1][]{title={#1}, </xsl:text>
|
|
534
|
+
<xsl:text>breakable, before upper app={\setparstyle}, </xsl:text>
|
|
535
|
+
<xsl:value-of select="$environment-name"/>
|
|
536
|
+
<xsl:text>style}
</xsl:text>
|
|
537
|
+
</xsl:template>
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
<!-- In document -->
|
|
541
|
+
<xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&DEFINITION-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&ASIDE-LIKE;|exercise[boolean(&INLINE-EXERCISE-FILTER;)]|assemblage" mode="block-options">
|
|
542
|
+
<xsl:apply-templates select="." mode="env-title"/>
|
|
543
|
+
<xsl:text>\label{</xsl:text>
|
|
544
|
+
<xsl:apply-templates select="." mode="unique-id"/>
|
|
545
|
+
<xsl:text>}%
</xsl:text>
|
|
546
|
+
</xsl:template>
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
<!-- Proofs and cases are handled using amsthm; anything other than a proof gets a title or the name of the proof-like env. -->
|
|
551
|
+
<xsl:template match="&PROOF-LIKE;">
|
|
552
|
+
<xsl:text>\begin{proof}</xsl:text>
|
|
553
|
+
<xsl:choose>
|
|
554
|
+
<xsl:when test="title">
|
|
555
|
+
<xsl:text>[</xsl:text>
|
|
556
|
+
<xsl:apply-templates select="." mode="title-simple"/>
|
|
557
|
+
<xsl:text>]</xsl:text>
|
|
558
|
+
</xsl:when>
|
|
559
|
+
<xsl:when test="local-name(.)!='proof'">
|
|
560
|
+
<xsl:text>[</xsl:text>
|
|
561
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
562
|
+
<xsl:text>]</xsl:text>
|
|
563
|
+
</xsl:when>
|
|
564
|
+
</xsl:choose>
|
|
565
|
+
<xsl:text>\label{</xsl:text>
|
|
566
|
+
<xsl:apply-templates select="." mode="unique-id"/>
|
|
567
|
+
<xsl:text>}%
</xsl:text>
|
|
568
|
+
<xsl:apply-templates select="*"/>
|
|
569
|
+
<xsl:text>\end{proof}
</xsl:text>
|
|
570
|
+
</xsl:template>
|
|
571
|
+
|
|
572
|
+
<!-- Cases in proofs -->
|
|
573
|
+
<xsl:template match="case">
|
|
574
|
+
<xsl:text>\par\medskip%
</xsl:text>
|
|
575
|
+
<xsl:text>\noindent{}</xsl:text>
|
|
576
|
+
<xsl:if test="@direction">
|
|
577
|
+
<xsl:apply-templates select="." mode="case-direction"/>
|
|
578
|
+
<xsl:text> </xsl:text>
|
|
579
|
+
</xsl:if>
|
|
580
|
+
<xsl:if test="title">
|
|
581
|
+
<xsl:text>\textit{</xsl:text>
|
|
582
|
+
<xsl:apply-templates select="." mode="title-full" />
|
|
583
|
+
<xsl:text>}</xsl:text>
|
|
584
|
+
</xsl:if>
|
|
585
|
+
<xsl:if test="not(title) and not(@direction)">
|
|
586
|
+
<xsl:text>\textit{</xsl:text>
|
|
587
|
+
<xsl:apply-templates select="." mode="type-name"/>
|
|
588
|
+
<xsl:text>}</xsl:text>
|
|
589
|
+
</xsl:if>
|
|
590
|
+
<!-- label -->
|
|
591
|
+
<xsl:text>\label{</xsl:text>
|
|
592
|
+
<xsl:apply-templates select="." mode="unique-id" />
|
|
593
|
+
<xsl:text>}%
</xsl:text>
|
|
594
|
+
<xsl:apply-templates select="*"/>
|
|
595
|
+
</xsl:template>
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
<xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&DEFINITION-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|exercise[boolean(&INLINE-EXERCISE-FILTER;)]" mode="env-title">
|
|
599
|
+
<xsl:if test="title|creator">
|
|
600
|
+
<xsl:text>[</xsl:text>
|
|
601
|
+
<xsl:if test="title">
|
|
602
|
+
<!-- Title, but without punctuation. Or is there a smarter way? -->
|
|
603
|
+
<xsl:apply-templates select="." mode="title-xref"/>
|
|
604
|
+
</xsl:if>
|
|
605
|
+
<xsl:if test="(title) and (creator)">
|
|
606
|
+
<xsl:text> </xsl:text>
|
|
607
|
+
</xsl:if>
|
|
608
|
+
<xsl:if test="creator">
|
|
609
|
+
<xsl:apply-templates select="." mode="creator-full"/>
|
|
610
|
+
</xsl:if>
|
|
611
|
+
<xsl:text>]</xsl:text>
|
|
612
|
+
</xsl:if>
|
|
613
|
+
</xsl:template>
|
|
614
|
+
|
|
615
|
+
<xsl:template match="&ASIDE-LIKE;|assemblage" mode="env-title">
|
|
616
|
+
<xsl:if test="title">
|
|
617
|
+
<xsl:text>[</xsl:text>
|
|
618
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
619
|
+
<xsl:text>]</xsl:text>
|
|
620
|
+
</xsl:if>
|
|
621
|
+
</xsl:template>
|
|
622
|
+
|
|
623
|
+
<!-- Divisions -->
|
|
624
|
+
|
|
625
|
+
<xsl:template match="section|subsection|subsubsection|appendix">
|
|
626
|
+
<xsl:apply-templates select="." mode="console-typeout"/>
|
|
627
|
+
<xsl:text>\</xsl:text>
|
|
628
|
+
<xsl:value-of select="local-name(.)"/>
|
|
629
|
+
<xsl:text>{</xsl:text>
|
|
630
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
631
|
+
<xsl:text>}\label{</xsl:text>
|
|
632
|
+
<xsl:apply-templates select="." mode="unique-id" />
|
|
633
|
+
<xsl:text>}%
</xsl:text>
|
|
634
|
+
<xsl:apply-templates select="*"/>
|
|
635
|
+
<xsl:text>% end of </xsl:text>
|
|
636
|
+
<xsl:value-of select="local-name(.)"/>
|
|
637
|
+
<xsl:text>: </xsl:text>
|
|
638
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
639
|
+
<xsl:text>
</xsl:text>
|
|
640
|
+
</xsl:template>
|
|
641
|
+
|
|
642
|
+
<xsl:template match="subsubsubsection">
|
|
643
|
+
<xsl:apply-templates select="." mode="console-typeout"/>
|
|
644
|
+
<xsl:text>\paragraph</xsl:text>
|
|
645
|
+
<xsl:text>{</xsl:text>
|
|
646
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
647
|
+
<xsl:text>}\label{</xsl:text>
|
|
648
|
+
<xsl:apply-templates select="." mode="unique-id" />
|
|
649
|
+
<xsl:text>}%
</xsl:text>
|
|
650
|
+
<xsl:apply-templates select="*"/>
|
|
651
|
+
<xsl:text>% end of subsubsubsection: </xsl:text>
|
|
652
|
+
<xsl:apply-templates select="." mode="title-full"/>
|
|
653
|
+
<xsl:text>
</xsl:text>
|
|
654
|
+
</xsl:template>
|
|
655
|
+
|
|
656
|
+
<!-- Paragraphs -->
|
|
657
|
+
<!-- Use *-version of section/subsection/subsubsection/etc at a level one below parent -->
|
|
658
|
+
<xsl:template match="paragraphs">
|
|
659
|
+
<xsl:choose>
|
|
660
|
+
<xsl:when test="parent::article">
|
|
661
|
+
<xsl:text>\section*{</xsl:text>
|
|
662
|
+
</xsl:when>
|
|
663
|
+
<xsl:when test="parent::section">
|
|
664
|
+
<xsl:text>\subsection*{</xsl:text>
|
|
665
|
+
</xsl:when>
|
|
666
|
+
<xsl:when test="parent::subsection">
|
|
667
|
+
<xsl:text>\subsubsection*{</xsl:text>
|
|
668
|
+
</xsl:when>
|
|
669
|
+
<xsl:when test="parent::subsubsection">
|
|
670
|
+
<xsl:text>\paragraph*{</xsl:text>
|
|
671
|
+
</xsl:when>
|
|
672
|
+
<xsl:otherwise>
|
|
673
|
+
<xsl:text>\subparagraph*{</xsl:text>
|
|
674
|
+
</xsl:otherwise>
|
|
675
|
+
</xsl:choose>
|
|
676
|
+
<xsl:apply-templates select="." mode="title-full" />
|
|
677
|
+
<xsl:text>}</xsl:text>
|
|
678
|
+
<xsl:text>\label{</xsl:text>
|
|
679
|
+
<xsl:apply-templates select="." mode="unique-id" />
|
|
680
|
+
<xsl:text>}%
</xsl:text>
|
|
681
|
+
<xsl:apply-templates select="*"/>
|
|
682
|
+
<xsl:text>% end of paragraphs
</xsl:text>
|
|
683
|
+
</xsl:template>
|
|
684
|
+
|
|
685
|
+
<!-- Introductions and Conclusions -->
|
|
686
|
+
<!-- Introductions and conclusions are just their contents at their position. -->
|
|
687
|
+
<xsl:template match="article/introduction|chapter/introduction|section/introduction|subsection/introduction|appendix/introduction|exercises/introduction|solutions/introduction|worksheet/introduction|reading-questions/introduction|references/introduction">
|
|
688
|
+
<xsl:text>% Introduction
</xsl:text>
|
|
689
|
+
<xsl:apply-templates select="*"/>
|
|
690
|
+
<xsl:text>% end of introduction
</xsl:text>
|
|
691
|
+
</xsl:template>
|
|
692
|
+
|
|
693
|
+
<xsl:template match="article/conclusion|chapter/conclusion|section/conclusion|subsection/conclusion|appendix/conclusion|exercises/conclusion|solutions/conclusion|worksheet/conclusion|reading-questions/conclusion|references/conclusion">
|
|
694
|
+
<xsl:text>% Conclusion
</xsl:text>
|
|
695
|
+
<xsl:apply-templates select="*"/>
|
|
696
|
+
<xsl:text>% end of conclusion
</xsl:text>
|
|
697
|
+
</xsl:template>
|
|
698
|
+
|
|
699
|
+
|
|
700
|
+
|
|
701
|
+
<!-- ################### -->
|
|
702
|
+
<!-- References Sections -->
|
|
703
|
+
<!-- ################### -->
|
|
704
|
+
<!-- TODO: The following will certainly change when the bibliography work is completed -->
|
|
705
|
+
|
|
706
|
+
<xsl:template match="references">
|
|
707
|
+
<xsl:apply-templates select="." mode="console-typeout"/>
|
|
708
|
+
<xsl:text>\bibliographystyle{</xsl:text>
|
|
709
|
+
<xsl:value-of select="$bibliographystyle"/>
|
|
710
|
+
<xsl:text>}
</xsl:text>
|
|
711
|
+
<xsl:text>\begin{thebibliography}{99}
</xsl:text>
|
|
712
|
+
<xsl:apply-templates select="*"/>
|
|
713
|
+
<xsl:text>\end{thebibliography}
</xsl:text>
|
|
714
|
+
</xsl:template>
|
|
715
|
+
|
|
716
|
+
|
|
717
|
+
<xsl:template match="biblio[@type='raw'] | biblio[@type='bibtex']">
|
|
718
|
+
<xsl:text>\bibitem</xsl:text>
|
|
719
|
+
<!-- "label" (e.g. Jud99), or by default serial number -->
|
|
720
|
+
<!-- LaTeX's bibitem will provide the visual brackets -->
|
|
721
|
+
<xsl:text>[</xsl:text>
|
|
722
|
+
<xsl:apply-templates select="." mode="serial-number" />
|
|
723
|
+
<xsl:text>]</xsl:text>
|
|
724
|
+
<!-- "key" for cross-referencing -->
|
|
725
|
+
<xsl:text>{</xsl:text>
|
|
726
|
+
<xsl:apply-templates select="." mode="unique-id"/>
|
|
727
|
+
<xsl:text>}</xsl:text>
|
|
728
|
+
<xsl:apply-templates select="." mode="label" />
|
|
729
|
+
<xsl:apply-templates/>
|
|
730
|
+
<xsl:text>
</xsl:text>
|
|
731
|
+
</xsl:template>
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
<!-- A much smaller version from common: -->
|
|
735
|
+
<!-- TODO: Refactor this to give only what we need. -->
|
|
736
|
+
<xsl:template name="create-numbered-tcolorbox">
|
|
737
|
+
<!-- ################## -->
|
|
738
|
+
<!-- Division Numbering -->
|
|
739
|
+
<!-- ################## -->
|
|
740
|
+
<xsl:text>%% Division Numbering: Chapters, Sections, Subsections, etc
</xsl:text>
|
|
741
|
+
<xsl:text>%% Division numbers may be turned off at some level ("depth")
</xsl:text>
|
|
742
|
+
<xsl:text>%% A section *always* has depth 1, contrary to us counting from the document root
</xsl:text>
|
|
743
|
+
<xsl:text>%% The latex default is 3. If a larger number is present here, then
</xsl:text>
|
|
744
|
+
<xsl:text>%% removing this command may make some cross-references ambiguous
</xsl:text>
|
|
745
|
+
<xsl:text>%% The precursor variable $numbering-maxlevel is checked for consistency in the common XSL file
</xsl:text>
|
|
746
|
+
<xsl:text>\setcounter{secnumdepth}{</xsl:text>
|
|
747
|
+
<xsl:value-of select="$latex-numbering-maxlevel" />
|
|
748
|
+
<xsl:text>}
</xsl:text>
|
|
749
|
+
<xsl:text>%%
</xsl:text>
|
|
750
|
+
|
|
751
|
+
<!-- -->
|
|
752
|
+
<xsl:text>%%
</xsl:text>
|
|
753
|
+
<xsl:text>%% A faux tcolorbox whose only purpose is to provide common numbering
</xsl:text>
|
|
754
|
+
<xsl:text>%% facilities for most blocks (possibly not projects, 2D displays)
</xsl:text>
|
|
755
|
+
<xsl:text>%% Controlled by numbering.theorems.level processing parameter
</xsl:text>
|
|
756
|
+
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
757
|
+
<!-- control the levels of the numbering -->
|
|
758
|
+
<!-- global (no periods) is the default -->
|
|
759
|
+
<xsl:if test="not($numbering-blocks = 0)">
|
|
760
|
+
<xsl:text>, number within=</xsl:text>
|
|
761
|
+
<xsl:call-template name="level-to-name">
|
|
762
|
+
<xsl:with-param name="level" select="$numbering-blocks" />
|
|
763
|
+
</xsl:call-template>
|
|
764
|
+
</xsl:if>
|
|
765
|
+
<xsl:text>]{block}{}
</xsl:text>
|
|
766
|
+
<!-- should condition on $project-reps, but it is not defined yet -->
|
|
767
|
+
<xsl:if test="$b-number-project-distinct">
|
|
768
|
+
<xsl:text>%%
</xsl:text>
|
|
769
|
+
<xsl:text>%% This document is set to number PROJECT-LIKE on a separate numbering scheme
</xsl:text>
|
|
770
|
+
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
771
|
+
<xsl:text>%% Controlled by numbering.projects.level processing parameter
</xsl:text>
|
|
772
|
+
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
773
|
+
<!-- control the levels of the numbering -->
|
|
774
|
+
<!-- global (no periods) is the default -->
|
|
775
|
+
<xsl:if test="not($numbering-projects = 0)">
|
|
776
|
+
<xsl:text>, number within=</xsl:text>
|
|
777
|
+
<xsl:call-template name="level-to-name">
|
|
778
|
+
<xsl:with-param name="level" select="$numbering-projects" />
|
|
779
|
+
</xsl:call-template>
|
|
780
|
+
</xsl:if>
|
|
781
|
+
<xsl:text>]{project-distinct}{}
</xsl:text>
|
|
782
|
+
</xsl:if>
|
|
783
|
+
<xsl:if test="$b-number-exercise-distinct">
|
|
784
|
+
<xsl:text>%%
</xsl:text>
|
|
785
|
+
<xsl:text>%% This document is set to number inline exercises on a separate numbering scheme
</xsl:text>
|
|
786
|
+
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
787
|
+
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
788
|
+
<!-- control the levels of the numbering -->
|
|
789
|
+
<!-- global (no periods) is the default -->
|
|
790
|
+
<xsl:if test="not($numbering-exercises = 0)">
|
|
791
|
+
<xsl:text>, number within=</xsl:text>
|
|
792
|
+
<xsl:call-template name="level-to-name">
|
|
793
|
+
<xsl:with-param name="level" select="$numbering-exercises" />
|
|
794
|
+
</xsl:call-template>
|
|
795
|
+
</xsl:if>
|
|
796
|
+
<xsl:text>]{exercise-distinct}{}
</xsl:text>
|
|
797
|
+
</xsl:if>
|
|
798
|
+
<xsl:if test="$b-number-figure-distinct">
|
|
799
|
+
<xsl:text>%%
</xsl:text>
|
|
800
|
+
<xsl:text>%% This document is set to number figure, table, list, listing on a separate numbering scheme
</xsl:text>
|
|
801
|
+
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
802
|
+
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
803
|
+
<!-- control the levels of the numbering -->
|
|
804
|
+
<!-- global (no periods) is the default -->
|
|
805
|
+
<xsl:if test="not($numbering-figures = 0)">
|
|
806
|
+
<xsl:text>, number within=</xsl:text>
|
|
807
|
+
<xsl:call-template name="level-to-name">
|
|
808
|
+
<xsl:with-param name="level" select="$numbering-figures" />
|
|
809
|
+
</xsl:call-template>
|
|
810
|
+
</xsl:if>
|
|
811
|
+
<xsl:text>]{figure-distinct}{}
</xsl:text>
|
|
812
|
+
</xsl:if>
|
|
813
|
+
<xsl:if test="$b-number-openproblem-distinct">
|
|
814
|
+
<xsl:text>%%
</xsl:text>
|
|
815
|
+
<xsl:text>%% This document is set to number OPENPROBLEM-LIKE on a separate numbering scheme
</xsl:text>
|
|
816
|
+
<xsl:text>%% So, a faux tcolorbox whose only purpose is to provide this numbering
</xsl:text>
|
|
817
|
+
<xsl:text>%% Controlled by numbering.openproblems.level processing parameter
</xsl:text>
|
|
818
|
+
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
819
|
+
<!-- control the levels of the numbering -->
|
|
820
|
+
<!-- global (no periods) is the default -->
|
|
821
|
+
<xsl:if test="not($numbering-openproblems = 0)">
|
|
822
|
+
<xsl:text>, number within=</xsl:text>
|
|
823
|
+
<xsl:call-template name="level-to-name">
|
|
824
|
+
<xsl:with-param name="level" select="$numbering-openproblems" />
|
|
825
|
+
</xsl:call-template>
|
|
826
|
+
</xsl:if>
|
|
827
|
+
<xsl:text>]{openproblem-distinct}{}
</xsl:text>
|
|
828
|
+
</xsl:if>
|
|
829
|
+
<!-- TODO: condition of figure/*/figure-like, or $subfigure-reps -->
|
|
830
|
+
<xsl:text>%% A faux tcolorbox whose only purpose is to provide common numbering
</xsl:text>
|
|
831
|
+
<xsl:text>%% facilities for 2D displays which are subnumbered as part of a "sidebyside"
</xsl:text>
|
|
832
|
+
<!-- faux subdisplay requires manipulating low-level counters -->
|
|
833
|
+
<!-- TODO: condition on presence of (plain) 2-D displays to limit use? -->
|
|
834
|
+
<xsl:text>\makeatletter
</xsl:text>
|
|
835
|
+
<xsl:text>\newtcolorbox[auto counter</xsl:text>
|
|
836
|
+
<!-- control the levels of the numbering -->
|
|
837
|
+
<!-- global (no periods) is the default -->
|
|
838
|
+
<xsl:text>, number within=</xsl:text>
|
|
839
|
+
<xsl:choose>
|
|
840
|
+
<xsl:when test="$b-number-figure-distinct">
|
|
841
|
+
<xsl:text>tcb@cnt@figure-distinct</xsl:text>
|
|
842
|
+
</xsl:when>
|
|
843
|
+
<xsl:otherwise>
|
|
844
|
+
<xsl:text>tcb@cnt@block</xsl:text>
|
|
845
|
+
</xsl:otherwise>
|
|
846
|
+
</xsl:choose>
|
|
847
|
+
<xsl:text>, number freestyle={\noexpand\thetcb@cnt@block(\noexpand\alph{\tcbcounter})}</xsl:text>
|
|
848
|
+
<xsl:text>]{subdisplay}{}
</xsl:text>
|
|
849
|
+
<!-- faux subdisplay requires manipulating low-level counters -->
|
|
850
|
+
<xsl:text>\makeatother
</xsl:text>
|
|
851
|
+
<!-- Groups of environments/blocks -->
|
|
852
|
+
|
|
853
|
+
<!-- GOAL-LIKE -->
|
|
854
|
+
<xsl:variable name="goal-reps" select="
|
|
855
|
+
($document-root//objectives)[1]|
|
|
856
|
+
($document-root//outcomes)[1]"/>
|
|
857
|
+
<xsl:if test="$goal-reps">
|
|
858
|
+
<xsl:text>%%
</xsl:text>
|
|
859
|
+
<xsl:text>%% tcolorbox, with styles, for GOAL-LIKE
</xsl:text>
|
|
860
|
+
<xsl:text>%%
</xsl:text>
|
|
861
|
+
</xsl:if>
|
|
862
|
+
<xsl:for-each select="$goal-reps">
|
|
863
|
+
<xsl:apply-templates select="." mode="environment"/>
|
|
864
|
+
</xsl:for-each>
|
|
865
|
+
|
|
866
|
+
<!-- FIGURE-LIKE -->
|
|
867
|
+
<!-- FIGURE-LIKE come in three flavors: blocks (not in a side-by-side), -->
|
|
868
|
+
<!-- panels (in a side-by-side, but not in an overall "figure"), or -->
|
|
869
|
+
<!-- subnumbered (panel of a side-by-side, which is then in an overall -->
|
|
870
|
+
<!-- "figure'). Selections must be careful (not like dropping through -->
|
|
871
|
+
<!-- a choose/when). Environments need to consider title/caption -->
|
|
872
|
+
<!-- placement and counters. So we might create twelve different -->
|
|
873
|
+
<!-- environments here. In -common, see the "figure-placement" template -->
|
|
874
|
+
<!-- for another determination, and a more careful explanation. -->
|
|
875
|
+
<!-- (There was once a subtle bug when we were not so careful here.) -->
|
|
876
|
+
<xsl:variable name="figure-reps" select="
|
|
877
|
+
($document-root//figure[not(parent::sidebyside)])[1]|
|
|
878
|
+
($document-root//table[not(parent::sidebyside)])[1]|
|
|
879
|
+
($document-root//listing[not(parent::sidebyside)])[1]|
|
|
880
|
+
($document-root//list[not(parent::sidebyside)])[1]"/>
|
|
881
|
+
<xsl:if test="$figure-reps">
|
|
882
|
+
<xsl:text>%%
</xsl:text>
|
|
883
|
+
<xsl:text>%% tcolorbox, with styles, for FIGURE-LIKE
</xsl:text>
|
|
884
|
+
<xsl:text>%%
</xsl:text>
|
|
885
|
+
</xsl:if>
|
|
886
|
+
<xsl:for-each select="$figure-reps">
|
|
887
|
+
<xsl:apply-templates select="." mode="environment"/>
|
|
888
|
+
</xsl:for-each>
|
|
889
|
+
<!-- (PANEL)FIGURE-LIKE -->
|
|
890
|
+
<!-- sidebyside panel versions, if not contained by overall figure -->
|
|
891
|
+
<xsl:variable name="panel-reps" select="
|
|
892
|
+
($document-root//sidebyside/figure[not(ancestor::figure)])[1]|
|
|
893
|
+
($document-root//sidebyside/table[not(ancestor::figure)])[1]|
|
|
894
|
+
($document-root//sidebyside/listing[not(ancestor::figure)])[1]|
|
|
895
|
+
($document-root//sidebyside/list[not(ancestor::figure)])[1]"/>
|
|
896
|
+
<xsl:if test="$panel-reps">
|
|
897
|
+
<xsl:text>%%
</xsl:text>
|
|
898
|
+
<xsl:text>%% tcolorbox, with styles, for (PANEL)FIGURE-LIKE
</xsl:text>
|
|
899
|
+
<xsl:text>%%
</xsl:text>
|
|
900
|
+
</xsl:if>
|
|
901
|
+
<xsl:for-each select="$panel-reps">
|
|
902
|
+
<xsl:apply-templates select="." mode="environment"/>
|
|
903
|
+
</xsl:for-each>
|
|
904
|
+
<!-- (SUB)FIGURE-LIKE -->
|
|
905
|
+
<!-- subnumbered versions, if contained by overall figure -->
|
|
906
|
+
<xsl:variable name="subnumber-reps" select="
|
|
907
|
+
($document-root//figure/sidebyside/figure|$document-root//figure/sbsgroup/sidebyside/figure)[1]|
|
|
908
|
+
($document-root//figure/sidebyside/table|$document-root//figure/sbsgroup/sidebyside/table)[1]|
|
|
909
|
+
($document-root//figure/sidebyside/listing|$document-root//figure/sbsgroup/sidebyside/listing)[1]|
|
|
910
|
+
($document-root//figure/sidebyside/list|$document-root//figure/sbsgroup/sidebyside/list)[1]"/>
|
|
911
|
+
<xsl:if test="$subnumber-reps">
|
|
912
|
+
<xsl:text>%%
</xsl:text>
|
|
913
|
+
<xsl:text>%% tcolorbox, with styles, for (SUB)FIGURE-LIKE
</xsl:text>
|
|
914
|
+
<xsl:text>%%
</xsl:text>
|
|
915
|
+
</xsl:if>
|
|
916
|
+
<xsl:for-each select="$subnumber-reps">
|
|
917
|
+
<xsl:apply-templates select="." mode="environment"/>
|
|
918
|
+
</xsl:for-each>
|
|
919
|
+
|
|
920
|
+
<!-- MISCELLANEOUS -->
|
|
921
|
+
<!-- "paragraphs" are partly like a division, -->
|
|
922
|
+
<!-- but we include it here as a one-off -->
|
|
923
|
+
<xsl:variable name="miscellaneous-reps" select="
|
|
924
|
+
($document-root//gi)[1]|
|
|
925
|
+
($document-root//backmatter/colophon)[1]"/>
|
|
926
|
+
<xsl:if test="$miscellaneous-reps">
|
|
927
|
+
<xsl:text>%%
</xsl:text>
|
|
928
|
+
<xsl:text>%% tcolorbox, with styles, for miscellaneous environments
</xsl:text>
|
|
929
|
+
<xsl:text>%%
</xsl:text>
|
|
930
|
+
</xsl:if>
|
|
931
|
+
<xsl:for-each select="$miscellaneous-reps">
|
|
932
|
+
<xsl:apply-templates select="." mode="environment"/>
|
|
933
|
+
</xsl:for-each>
|
|
934
|
+
</xsl:template>
|
|
935
|
+
|
|
936
|
+
|
|
937
|
+
<!-- Preamble template for elements needed to produce the frontmatter -->
|
|
938
|
+
<xsl:template name="frontmatter-helpers">
|
|
939
|
+
<!-- If there is a <support> tag in an article, create a unnumbered footnote environment for it -->
|
|
940
|
+
<!-- NB: this is also part of the footnote-numbering named template (as of 2025-02-24), but we don't call that for -classic -->
|
|
941
|
+
<xsl:if test="$b-is-article and $bibinfo/support">
|
|
942
|
+
<xsl:text>%% add a \support command as unnumbered footnote
</xsl:text>
|
|
943
|
+
<xsl:text>\let\svdthefootnote\thefootnote%
</xsl:text>
|
|
944
|
+
<xsl:text>\newcommand\support[1]{%
</xsl:text>
|
|
945
|
+
<xsl:text> \let\thefootnote\relax%
</xsl:text>
|
|
946
|
+
<xsl:text> \footnotetext{#1}%
</xsl:text>
|
|
947
|
+
<xsl:text> \let\thefootnote\svdthefootnote%
</xsl:text>
|
|
948
|
+
<xsl:text>}
</xsl:text>
|
|
949
|
+
</xsl:if>
|
|
950
|
+
</xsl:template>
|
|
951
|
+
|
|
952
|
+
</xsl:stylesheet>
|