@pretextbook/pretext-html 0.2.0 → 0.4.0
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 +37 -6
- package/assets/preview-html.xsl +8 -4
- package/assets/upstream.json +1 -1
- package/assets/xsl/README.md +25 -24
- package/assets/xsl/entities.ent +20 -0
- package/assets/xsl/extract-biblio-csl.xsl +1 -1
- package/assets/xsl/extract-pg.xsl +111 -297
- package/assets/xsl/extract-qrcode.xsl +11 -1
- package/assets/xsl/extract-sageplot.xsl +1 -1
- package/assets/xsl/latex/pretext-latex-texstyle.xsl +1 -2
- package/assets/xsl/localizations/README.md +24 -24
- package/assets/xsl/pretext-assembly.xsl +101 -11
- package/assets/xsl/pretext-beamer.xsl +43 -146
- package/assets/xsl/pretext-braille-preprint.xsl +457 -201
- package/assets/xsl/pretext-common.xsl +388 -423
- package/assets/xsl/pretext-epub.xsl +301 -72
- package/assets/xsl/pretext-fo.xsl +70 -86
- package/assets/xsl/pretext-html.xsl +331 -259
- package/assets/xsl/pretext-jupyter.xsl +534 -322
- package/assets/xsl/pretext-latex-classic.xsl +14 -15
- package/assets/xsl/pretext-latex-common.xsl +385 -2389
- package/assets/xsl/pretext-latex.xsl +1995 -5
- package/assets/xsl/pretext-markdown.xsl +919 -0
- package/assets/xsl/pretext-numbers.xsl +22 -4
- package/assets/xsl/pretext-revealjs.xsl +241 -33
- package/assets/xsl/pretext-runestone-fitb.xsl +20 -22
- package/assets/xsl/pretext-runestone.xsl +3 -3
- package/assets/xsl/pretext-sage-doctest.xsl +2 -2
- package/assets/xsl/pretext-text-utilities.xsl +69 -1
- package/assets/xsl/pretext-text.xsl +1077 -107
- package/assets/xsl/publisher-variables.xsl +396 -452
- package/assets/xsl/support/play-button/README.md +1 -3
- package/assets/xsl/tests/README.md +1 -1
- package/assets/xsl/utilities/README.md +6 -8
- package/assets/xsl/utilities/report-publisher-variables.xsl +15 -0
- package/assets/xsl-bundle.json +1 -1
- package/dist/assets.d.ts +43 -0
- package/dist/assets.js +76 -0
- package/dist/cli-Cp6C0sif.js +654 -0
- package/dist/cli.js +1 -1
- package/dist/index.browser.js +367 -307
- package/dist/index.d.ts +5 -0
- package/dist/index.js +16 -11
- package/dist/missing-asset.d.ts +31 -0
- package/dist/publication.d.ts +36 -1
- package/dist/renderer.d.ts +49 -0
- package/package.json +9 -1
- package/dist/cli-B2LiKunq.js +0 -588
|
@@ -140,32 +140,12 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
140
140
|
<xsl:when test="$root/letter">0</xsl:when>
|
|
141
141
|
<xsl:when test="$root/memo">0</xsl:when>
|
|
142
142
|
<xsl:otherwise>
|
|
143
|
-
<xsl:message>PTX:
|
|
143
|
+
<xsl:message>PTX:BUG: Table of Contents level (for LaTeX conversion) not determined</xsl:message>
|
|
144
144
|
</xsl:otherwise>
|
|
145
145
|
</xsl:choose>
|
|
146
146
|
</xsl:variable>
|
|
147
147
|
<xsl:variable name="toc-level" select="number($toc-level-override)"/>
|
|
148
148
|
|
|
149
|
-
<!-- font-size also dictates document class for -->
|
|
150
|
-
<!-- those provided by extsizes, but we can get -->
|
|
151
|
-
<!-- these by just inserting the "ext" prefix -->
|
|
152
|
-
<!-- We don't load the package, the classes -->
|
|
153
|
-
<!-- are incorporated in the documentclass[]{} -->
|
|
154
|
-
<!-- and only if we need the extreme values -->
|
|
155
|
-
|
|
156
|
-
<!-- A convenient shortcut/hack that might need expansion later -->
|
|
157
|
-
<!-- insert "ext" or nothing in front of "regular" document class -->
|
|
158
|
-
<xsl:variable name="document-class-prefix">
|
|
159
|
-
<xsl:choose>
|
|
160
|
-
<xsl:when test="$font-size='10pt'"></xsl:when>
|
|
161
|
-
<xsl:when test="$font-size='12pt'"></xsl:when>
|
|
162
|
-
<xsl:when test="$font-size='11pt'"></xsl:when>
|
|
163
|
-
<xsl:otherwise>
|
|
164
|
-
<xsl:text>ext</xsl:text>
|
|
165
|
-
</xsl:otherwise>
|
|
166
|
-
</xsl:choose>
|
|
167
|
-
</xsl:variable>
|
|
168
|
-
|
|
169
149
|
<!-- Including page numbers in cross-references defaults to -->
|
|
170
150
|
<!-- 'yes' for an electronic PDF and to 'no' for a print PDF, -->
|
|
171
151
|
<!-- and of course can be switched away from the default at will -->
|
|
@@ -230,145 +210,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
230
210
|
<xsl:apply-templates select="article|book|letter|memo"/>
|
|
231
211
|
</xsl:template>
|
|
232
212
|
|
|
233
|
-
<!-- TODO: combine article, book, letter, templates -->
|
|
234
|
-
<!-- with abstract templates for latex classes, page sizes -->
|
|
235
|
-
|
|
236
|
-
<!-- An article, LaTeX structure -->
|
|
237
|
-
<!-- One page, full of sections (with abstract, references) -->
|
|
238
|
-
<!-- Or, one page, totally unstructured, just lots of paragraphs, widgets, etc -->
|
|
239
|
-
<xsl:template match="article">
|
|
240
|
-
<xsl:call-template name="converter-blurb-latex" />
|
|
241
|
-
<xsl:call-template name="snapshot-package-info"/>
|
|
242
|
-
<xsl:text>\documentclass[</xsl:text>
|
|
243
|
-
<xsl:call-template name="sidedness"/>
|
|
244
|
-
<xsl:text>,</xsl:text>
|
|
245
|
-
<xsl:value-of select="$font-size" />
|
|
246
|
-
<xsl:text>,</xsl:text>
|
|
247
|
-
<xsl:if test="$b-latex-draft-mode" >
|
|
248
|
-
<xsl:text>draft,</xsl:text>
|
|
249
|
-
</xsl:if>
|
|
250
|
-
<xsl:text>]{</xsl:text>
|
|
251
|
-
<xsl:value-of select="$document-class-prefix" />
|
|
252
|
-
<xsl:text>article}
</xsl:text>
|
|
253
|
-
<xsl:call-template name="latex-preamble" />
|
|
254
|
-
<!-- parameterize preamble template with "page-geometry" template conditioned on self::article etc -->
|
|
255
|
-
<xsl:call-template name="title-page-info-article" />
|
|
256
|
-
<xsl:text>\begin{document}
</xsl:text>
|
|
257
|
-
<xsl:call-template name="text-alignment"/>
|
|
258
|
-
<xsl:call-template name="front-cover"/>
|
|
259
|
-
<!-- Target for xref to top-level element -->
|
|
260
|
-
<!-- immediately, or first in ToC -->
|
|
261
|
-
<xsl:choose>
|
|
262
|
-
<xsl:when test="$b-has-toc">
|
|
263
|
-
<xsl:text>%% Target for xref to top-level element is ToC
</xsl:text>
|
|
264
|
-
<xsl:text>\addtocontents{toc}{</xsl:text>
|
|
265
|
-
<xsl:if test="$b-pageref">
|
|
266
|
-
<xsl:text>\protect\label{</xsl:text>
|
|
267
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
268
|
-
<xsl:text>}</xsl:text>
|
|
269
|
-
</xsl:if>
|
|
270
|
-
<xsl:text>\protect\hypertarget{</xsl:text>
|
|
271
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
272
|
-
<xsl:text>}{}</xsl:text>
|
|
273
|
-
<xsl:text>}
</xsl:text>
|
|
274
|
-
</xsl:when>
|
|
275
|
-
<xsl:otherwise>
|
|
276
|
-
<xsl:text>%% Target for xref to top-level element is document start
</xsl:text>
|
|
277
|
-
<xsl:if test="$b-pageref">
|
|
278
|
-
<xsl:text>\label{</xsl:text>
|
|
279
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
280
|
-
<xsl:text>}</xsl:text>
|
|
281
|
-
</xsl:if>
|
|
282
|
-
<xsl:text>\hypertarget{</xsl:text>
|
|
283
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
284
|
-
<xsl:text>}{}
</xsl:text>
|
|
285
|
-
</xsl:otherwise>
|
|
286
|
-
</xsl:choose>
|
|
287
|
-
<!-- If no frontmatter/titlepage, then title is not printed -->
|
|
288
|
-
<!-- so we make sure it happens here, else triggered by titlepage -->
|
|
289
|
-
<!-- If a title, we know it is page 1, so use empty style -->
|
|
290
|
-
<xsl:if test="title and not(frontmatter/titlepage)">
|
|
291
|
-
<xsl:text>\maketitle
</xsl:text>
|
|
292
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
293
|
-
</xsl:if>
|
|
294
|
-
<xsl:apply-templates select="*"/>
|
|
295
|
-
<xsl:call-template name="back-cover"/>
|
|
296
|
-
<xsl:text>\end{document}
</xsl:text>
|
|
297
|
-
</xsl:template>
|
|
298
|
-
|
|
299
|
-
<!-- A book, LaTeX structure -->
|
|
300
|
-
<!-- The ordering of the frontmatter is from -->
|
|
301
|
-
<!-- "Bookmaking", 3rd Edition, Marshall Lee, Chapter 27 -->
|
|
302
|
-
<xsl:template match="book">
|
|
303
|
-
<xsl:call-template name="converter-blurb-latex" />
|
|
304
|
-
<xsl:call-template name="snapshot-package-info"/>
|
|
305
|
-
<xsl:text>\documentclass[</xsl:text>
|
|
306
|
-
<xsl:call-template name="sidedness"/>
|
|
307
|
-
<xsl:text>,</xsl:text>
|
|
308
|
-
<xsl:value-of select="$font-size" />
|
|
309
|
-
<xsl:text>,</xsl:text>
|
|
310
|
-
<xsl:if test="$b-latex-draft-mode" >
|
|
311
|
-
<xsl:text>draft,</xsl:text>
|
|
312
|
-
</xsl:if>
|
|
313
|
-
<xsl:text>]{</xsl:text>
|
|
314
|
-
<xsl:value-of select="$document-class-prefix" />
|
|
315
|
-
<xsl:text>book}
</xsl:text>
|
|
316
|
-
<xsl:call-template name="latex-preamble" />
|
|
317
|
-
<xsl:text>\begin{document}
</xsl:text>
|
|
318
|
-
<xsl:call-template name="text-alignment"/>
|
|
319
|
-
<!-- Front cover before \frontmatter is OK, -->
|
|
320
|
-
<!-- since we do not number the page (main role -->
|
|
321
|
-
<!-- of \frontmatter is to use Roman numerals) -->
|
|
322
|
-
<xsl:call-template name="front-cover"/>
|
|
323
|
-
<xsl:apply-templates select="*"/>
|
|
324
|
-
<xsl:call-template name="back-cover"/>
|
|
325
|
-
<xsl:text>\end{document}
</xsl:text>
|
|
326
|
-
</xsl:template>
|
|
327
|
-
|
|
328
|
-
<!-- A letter, LaTeX structure -->
|
|
329
|
-
<xsl:template match="letter">
|
|
330
|
-
<xsl:call-template name="converter-blurb-latex" />
|
|
331
|
-
<xsl:call-template name="snapshot-package-info"/>
|
|
332
|
-
<xsl:text>\documentclass[</xsl:text>
|
|
333
|
-
<xsl:call-template name="sidedness"/>
|
|
334
|
-
<xsl:text>,</xsl:text>
|
|
335
|
-
<xsl:value-of select="$font-size" />
|
|
336
|
-
<xsl:text>,</xsl:text>
|
|
337
|
-
<xsl:if test="$b-latex-draft-mode" >
|
|
338
|
-
<xsl:text>draft,</xsl:text>
|
|
339
|
-
</xsl:if>
|
|
340
|
-
<xsl:text>]{</xsl:text>
|
|
341
|
-
<xsl:value-of select="$document-class-prefix" />
|
|
342
|
-
<xsl:text>article}
</xsl:text>
|
|
343
|
-
<xsl:call-template name="latex-preamble" />
|
|
344
|
-
<xsl:text>\begin{document}
</xsl:text>
|
|
345
|
-
<xsl:call-template name="text-alignment"/>
|
|
346
|
-
<xsl:apply-templates select="*"/>
|
|
347
|
-
<xsl:text>\end{document}
</xsl:text>
|
|
348
|
-
</xsl:template>
|
|
349
|
-
|
|
350
|
-
<!-- A memo, LaTeX structure -->
|
|
351
|
-
<xsl:template match="memo">
|
|
352
|
-
<xsl:call-template name="converter-blurb-latex" />
|
|
353
|
-
<xsl:call-template name="snapshot-package-info"/>
|
|
354
|
-
<xsl:text>\documentclass[</xsl:text>
|
|
355
|
-
<xsl:call-template name="sidedness"/>
|
|
356
|
-
<xsl:text>,</xsl:text>
|
|
357
|
-
<xsl:value-of select="$font-size" />
|
|
358
|
-
<xsl:text>,</xsl:text>
|
|
359
|
-
<xsl:if test="$b-latex-draft-mode" >
|
|
360
|
-
<xsl:text>draft,</xsl:text>
|
|
361
|
-
</xsl:if>
|
|
362
|
-
<xsl:text>]{</xsl:text>
|
|
363
|
-
<xsl:value-of select="$document-class-prefix" />
|
|
364
|
-
<xsl:text>article}
</xsl:text>
|
|
365
|
-
<xsl:call-template name="latex-preamble" />
|
|
366
|
-
<xsl:text>\begin{document}
</xsl:text>
|
|
367
|
-
<xsl:call-template name="text-alignment"/>
|
|
368
|
-
<xsl:apply-templates select="*"/>
|
|
369
|
-
<xsl:text>\end{document}
</xsl:text>
|
|
370
|
-
</xsl:template>
|
|
371
|
-
|
|
372
213
|
<!-- We write "snapshot" information into <job>.dep, primarily for -->
|
|
373
214
|
<!-- developer's use to see what possible (dependent) packages are -->
|
|
374
215
|
<!-- loaded. Some authors may be able to copy this information out of -->
|
|
@@ -383,68 +224,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
383
224
|
</xsl:if>
|
|
384
225
|
</xsl:template>
|
|
385
226
|
|
|
386
|
-
<!-- LaTeX preamble is common for both books, articles, memos and letters -->
|
|
387
|
-
<!-- Except: title info allows an "event" for an article (presentation) -->
|
|
388
|
-
<xsl:template name="latex-preamble">
|
|
389
|
-
<xsl:call-template name="preamble-early"/>
|
|
390
|
-
<xsl:call-template name="cleardoublepage"/>
|
|
391
|
-
<xsl:call-template name="standard-packages"/>
|
|
392
|
-
<xsl:call-template name="tcolorbox-init"/>
|
|
393
|
-
<xsl:call-template name="page-setup"/>
|
|
394
|
-
<xsl:call-template name="latex-engine-support"/>
|
|
395
|
-
<xsl:call-template name="font-support"/>
|
|
396
|
-
<xsl:call-template name="math-packages"/>
|
|
397
|
-
<xsl:call-template name="text-symbols"/>
|
|
398
|
-
<xsl:call-template name="pdfpages-package"/>
|
|
399
|
-
<xsl:call-template name="division-titles"/>
|
|
400
|
-
<xsl:call-template name="semantic-macros"/>
|
|
401
|
-
<xsl:call-template name="exercises-and-solutions"/>
|
|
402
|
-
<xsl:call-template name="chapter-start-number"/>
|
|
403
|
-
<xsl:call-template name="equation-numbering"/>
|
|
404
|
-
<xsl:call-template name="image-tcolorbox"/>
|
|
405
|
-
<xsl:call-template name="tables"/>
|
|
406
|
-
<xsl:call-template name="footnote-numbering"/>
|
|
407
|
-
<xsl:call-template name="font-awesome"/>
|
|
408
|
-
<xsl:call-template name="poetry-support"/>
|
|
409
|
-
<xsl:call-template name="music-support"/>
|
|
410
|
-
<xsl:call-template name="code-support"/>
|
|
411
|
-
<xsl:call-template name="list-layout"/>
|
|
412
|
-
<!-- This is the place to add part numbers to the numbering, which -->
|
|
413
|
-
<!-- is *not* the default LaTeX behavior. The \p@section scheme -->
|
|
414
|
-
<!-- is complicated, leading to about ten constructions like -->
|
|
415
|
-
<!-- -->
|
|
416
|
-
<!-- \ifdefined\p@namedlist\renewcommand{\p@namedlist}{\thepart.}\fi -->
|
|
417
|
-
<!-- -->
|
|
418
|
-
<!-- Advice is to redefine these *before* loading hyperref -->
|
|
419
|
-
<!-- https://tex.stackexchange.com/questions/172962 -->
|
|
420
|
-
<!-- (hyperref-include-part-number-for-cross-references-to-chapters) -->
|
|
421
|
-
<!-- Easier is to just adjust the chapter number, which filters down -->
|
|
422
|
-
<!-- into anything that uses the chapter, though perhaps per-part -->
|
|
423
|
-
<!-- numbering will still need something? -->
|
|
424
|
-
<!-- -->
|
|
425
|
-
<!-- \renewcommand{\thechapter}{\thepart.\arabic{chapter}} -->
|
|
426
|
-
<!-- -->
|
|
427
|
-
<xsl:call-template name="load-configure-hyperref"/>
|
|
428
|
-
<!-- We create counters and numbered tcolorbox environments -->
|
|
429
|
-
<!-- *after* loading the hyperref package, so as to avoid a -->
|
|
430
|
-
<!-- pdfTeX warning about duplicate identifiers. -->
|
|
431
|
-
<xsl:call-template name="create-numbered-tcolorbox"/>
|
|
432
|
-
<!-- The "xwatermark" package has way more options, including the -->
|
|
433
|
-
<!-- possibility of putting the watermark onto the foreground -->
|
|
434
|
-
<!-- (above shaded/colored "tcolorbox"). But on 2018-10-24, -->
|
|
435
|
-
<!-- xwatermark was at v1.5.2d, 2012-10-23, and draftwatermark -->
|
|
436
|
-
<!-- was at v1.2, 2015-02-19. -->
|
|
437
|
-
|
|
438
|
-
<xsl:call-template name="watermark"/>
|
|
439
|
-
<xsl:call-template name="showkeys"/>
|
|
440
|
-
<xsl:call-template name="latex-image-support"/>
|
|
441
|
-
<xsl:call-template name="sidebyside-environment"/>
|
|
442
|
-
<xsl:call-template name="kbd-keys"/>
|
|
443
|
-
<xsl:call-template name="late-preamble-adjustments"/>
|
|
444
|
-
|
|
445
|
-
</xsl:template>
|
|
446
|
-
|
|
447
|
-
|
|
448
227
|
<!--####################-->
|
|
449
228
|
<!-- Preamble Templates -->
|
|
450
229
|
<!--####################-->
|
|
@@ -577,17 +356,17 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
577
356
|
<!-- In a similar fashion we save/restore the parskip, only should -->
|
|
578
357
|
<!-- an ambitious publisher try to set it globally -->
|
|
579
358
|
<xsl:text>%% Save default paragraph indentation and parskip for use later, when adjusting parboxes
</xsl:text>
|
|
580
|
-
<xsl:text>\newlength{\
|
|
581
|
-
<xsl:text>\newlength{\
|
|
359
|
+
<xsl:text>\newlength{\ptxnormalparindent}
</xsl:text>
|
|
360
|
+
<xsl:text>\newlength{\ptxnormalparskip}
</xsl:text>
|
|
582
361
|
<xsl:text>%% Prescribe the paragraph indent to the value shared with the
</xsl:text>
|
|
583
362
|
<xsl:text>%% XSL-FO conversion, so the two agree, rather than accepting the
</xsl:text>
|
|
584
|
-
<xsl:text>%% document class default; "\
|
|
363
|
+
<xsl:text>%% document class default; "\ptxnormalparindent" then captures it
</xsl:text>
|
|
585
364
|
<xsl:text>\AtBeginDocument{\setlength{\parindent}{</xsl:text>
|
|
586
365
|
<xsl:value-of select="$paragraph-indentation"/>
|
|
587
366
|
<xsl:text>em}}
</xsl:text>
|
|
588
|
-
<xsl:text>\AtBeginDocument{\setlength{\
|
|
589
|
-
<xsl:text>\AtBeginDocument{\setlength{\
|
|
590
|
-
<xsl:text>\newcommand{\
|
|
367
|
+
<xsl:text>\AtBeginDocument{\setlength{\ptxnormalparindent}{\parindent}}
</xsl:text>
|
|
368
|
+
<xsl:text>\AtBeginDocument{\setlength{\ptxnormalparskip}{\parskip}}
</xsl:text>
|
|
369
|
+
<xsl:text>\newcommand{\ptxsetparstyle}{\setlength{\parindent}{\ptxnormalparindent}\setlength{\parskip}{\ptxnormalparskip}}</xsl:text>
|
|
591
370
|
<xsl:text>%% Hyperref should be here, but likes to be loaded late
</xsl:text>
|
|
592
371
|
<xsl:text>%%
</xsl:text>
|
|
593
372
|
<xsl:text>%% Inline math delimiters, \(, \), need to be robust
</xsl:text>
|
|
@@ -686,6 +465,29 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
686
465
|
<xsl:text>%%
</xsl:text>
|
|
687
466
|
</xsl:template>
|
|
688
467
|
|
|
468
|
+
<!-- The style-writer font hooks. Shared preamble pieces presume -->
|
|
469
|
+
<!-- these are defined: "tcolorbox-init" (runintitlestyle employs -->
|
|
470
|
+
<!-- \blocktitlefont), "sidebyside-environment" (sbspanelstyle), -->
|
|
471
|
+
<!-- the "tabular" templates (\tabularfont), cross-references and -->
|
|
472
|
+
<!-- the index (\xreffont). A separate named template, so another -->
|
|
473
|
+
<!-- LaTeX-based conversion (e.g. Beamer) can establish the same -->
|
|
474
|
+
<!-- contract without adopting "font-support" wholesale. -->
|
|
475
|
+
<xsl:template name="automatic-font-control">
|
|
476
|
+
<xsl:text>%% Automatic Font Control
</xsl:text>
|
|
477
|
+
<xsl:text>%% Portions of a document, are, or may, be affected by defined commands
</xsl:text>
|
|
478
|
+
<xsl:text>%% These are perhaps more flexible when using xelatex rather than pdflatex
</xsl:text>
|
|
479
|
+
<xsl:text>%% The following definitions are meant to be re-defined in a style, using \renewcommand
</xsl:text>
|
|
480
|
+
<xsl:text>%% They are scoped when employed (in a TeX group), and so should not be defined with an argument
</xsl:text>
|
|
481
|
+
<xsl:text>\newcommand{\divisionfont}{\relax}
</xsl:text>
|
|
482
|
+
<xsl:text>\newcommand{\blocktitlefont}{\relax}
</xsl:text>
|
|
483
|
+
<xsl:text>\newcommand{\contentsfont}{\relax}
</xsl:text>
|
|
484
|
+
<xsl:text>\newcommand{\pagefont}{\relax}
</xsl:text>
|
|
485
|
+
<xsl:text>\newcommand{\tabularfont}{\relax}
</xsl:text>
|
|
486
|
+
<xsl:text>\newcommand{\xreffont}{\relax}
</xsl:text>
|
|
487
|
+
<xsl:text>\newcommand{\titlepagefont}{\relax}
</xsl:text>
|
|
488
|
+
<xsl:text>%%
</xsl:text>
|
|
489
|
+
</xsl:template>
|
|
490
|
+
|
|
689
491
|
<!-- Font support (conditional on engine) -->
|
|
690
492
|
<xsl:template name="font-support">
|
|
691
493
|
<xsl:text>%% Fonts. Conditional on LaTex engine employed.
</xsl:text>
|
|
@@ -709,19 +511,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
709
511
|
<xsl:text>%% xelatex,lualatex: add OTF StylisticSet 3 for upright quotes
</xsl:text>
|
|
710
512
|
<xsl:text>%%
</xsl:text>
|
|
711
513
|
</xsl:if>
|
|
712
|
-
<xsl:
|
|
713
|
-
<xsl:text>%% Portions of a document, are, or may, be affected by defined commands
</xsl:text>
|
|
714
|
-
<xsl:text>%% These are perhaps more flexible when using xelatex rather than pdflatex
</xsl:text>
|
|
715
|
-
<xsl:text>%% The following definitions are meant to be re-defined in a style, using \renewcommand
</xsl:text>
|
|
716
|
-
<xsl:text>%% They are scoped when employed (in a TeX group), and so should not be defined with an argument
</xsl:text>
|
|
717
|
-
<xsl:text>\newcommand{\divisionfont}{\relax}
</xsl:text>
|
|
718
|
-
<xsl:text>\newcommand{\blocktitlefont}{\relax}
</xsl:text>
|
|
719
|
-
<xsl:text>\newcommand{\contentsfont}{\relax}
</xsl:text>
|
|
720
|
-
<xsl:text>\newcommand{\pagefont}{\relax}
</xsl:text>
|
|
721
|
-
<xsl:text>\newcommand{\tabularfont}{\relax}
</xsl:text>
|
|
722
|
-
<xsl:text>\newcommand{\xreffont}{\relax}
</xsl:text>
|
|
723
|
-
<xsl:text>\newcommand{\titlepagefont}{\relax}
</xsl:text>
|
|
724
|
-
<xsl:text>%%
</xsl:text>
|
|
514
|
+
<xsl:call-template name="automatic-font-control"/>
|
|
725
515
|
<xsl:text>\ifthenelse{\boolean{xetex} \or \boolean{luatex}}{%
</xsl:text>
|
|
726
516
|
<xsl:text>%% begin: font setup and configuration for use with xelatex
</xsl:text>
|
|
727
517
|
<!-- -->
|
|
@@ -977,134 +767,67 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
977
767
|
<xsl:text>%%
</xsl:text>
|
|
978
768
|
</xsl:template>
|
|
979
769
|
|
|
980
|
-
<!--
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
($document-root//chapter)[1]|
|
|
1042
|
-
($document-root//section)[1]|
|
|
1043
|
-
($document-root//subsection)[1]|
|
|
1044
|
-
($document-root//subsubsection)[1]|
|
|
1045
|
-
($document-root//subsubsection)[1]|
|
|
1046
|
-
($root/book/backmatter/appendix|$root/article/backmatter/appendix)[1]|
|
|
1047
|
-
($document-root//index)[1]|
|
|
1048
|
-
($document-root//chapter/exercises|$root/book/backmatter/appendix/exercises|$root/article/exercises)[1]|
|
|
1049
|
-
($document-root//section/exercises|$root/article/backmatter/appendix/exercises)[1]|
|
|
1050
|
-
($document-root//subsection/exercises)[1]|
|
|
1051
|
-
($document-root//subsubsection/exercises)[1]|
|
|
1052
|
-
($root/book/backmatter/solutions)[1]|
|
|
1053
|
-
($document-root//chapter/solutions|$root/article/solutions|$root/article/backmatter/solutions)[1]|
|
|
1054
|
-
($document-root//section/solutions)[1]|
|
|
1055
|
-
($document-root//subsection/solutions)[1]|
|
|
1056
|
-
($document-root//subsubsection/solutions)[1]|
|
|
1057
|
-
($document-root//chapter/worksheet|$root/article/worksheet)[1]|
|
|
1058
|
-
($document-root//section/worksheet)[1]|
|
|
1059
|
-
($document-root//subsection/worksheet)[1]|
|
|
1060
|
-
($document-root//subsubsection/worksheet)[1]|
|
|
1061
|
-
($document-root//chapter/handout|$root/article/handout)[1]|
|
|
1062
|
-
($document-root//section/handout)[1]|
|
|
1063
|
-
($document-root//subsection/handout)[1]|
|
|
1064
|
-
($document-root//subsubsection/handout)[1]|
|
|
1065
|
-
($document-root//chapter/reading-questions|$root/article/reading-questions)[1]|
|
|
1066
|
-
($document-root//section/reading-questions)[1]|
|
|
1067
|
-
($document-root//subsection/reading-questions)[1]|
|
|
1068
|
-
($document-root//subsubsection/reading-questions)[1]|
|
|
1069
|
-
($root/book/backmatter/glossary)[1]|
|
|
1070
|
-
($document-root//chapter/glossary|$root/article/backmatter/glossary|$root/book/backmatter/appendix/glossary)[1]|
|
|
1071
|
-
($document-root//section/glossary|$root/article/backmatter/appendix/glossary)[1]|
|
|
1072
|
-
($document-root//subsection/glossary)[1]|
|
|
1073
|
-
($document-root//subsubsection/glossary)[1]|
|
|
1074
|
-
($root/book/backmatter/references)[1]|
|
|
1075
|
-
($document-root//chapter/references|$root/article/references|$root/article/backmatter/references|$root/book/backmatter/appendix/references)[1]|
|
|
1076
|
-
($document-root//section/references|$root/article/backmatter/appendix/references)[1]|
|
|
1077
|
-
($document-root//subsection/references)[1]|
|
|
1078
|
-
($document-root//subsubsection/references)[1]"/>
|
|
1079
|
-
<xsl:text>%% Create environments for possible occurences of each division
</xsl:text>
|
|
1080
|
-
<xsl:for-each select="$division-reps">
|
|
1081
|
-
<xsl:apply-templates select="." mode="environment"/>
|
|
1082
|
-
</xsl:for-each>
|
|
1083
|
-
<xsl:text>%%
</xsl:text>
|
|
1084
|
-
<xsl:text>%% Styles for six traditional LaTeX divisions
</xsl:text>
|
|
1085
|
-
<!-- Create six title styles, part to paragraph -->
|
|
1086
|
-
<!-- NB: paragraph is like a "subsubsubsection" -->
|
|
1087
|
-
<!-- "titlesec" works on a level basis, so -->
|
|
1088
|
-
<!-- we just build all six named styles -->
|
|
1089
|
-
<!-- N.B.: we are using the LaTeX "subparagraph" -->
|
|
1090
|
-
<!-- traditional division for a PTX "paragraphs", -->
|
|
1091
|
-
<!-- but perhaps we can fake that with a tcolorbox, -->
|
|
1092
|
-
<!-- since we don't allow it to be styled. -->
|
|
1093
|
-
<xsl:call-template name="titlesec-part-style"/>
|
|
1094
|
-
<xsl:call-template name="titlesec-chapter-style"/>
|
|
1095
|
-
<xsl:call-template name="titlesec-section-style"/>
|
|
1096
|
-
<xsl:call-template name="titlesec-subsection-style"/>
|
|
1097
|
-
<xsl:call-template name="titlesec-subsubsection-style"/>
|
|
1098
|
-
<xsl:call-template name="titlesec-paragraph-style"/>
|
|
1099
|
-
<xsl:text>%%
</xsl:text>
|
|
1100
|
-
<xsl:text>%% Styles for five traditional LaTeX divisions
</xsl:text>
|
|
1101
|
-
<!-- Create five title styles, part to subsubsection -->
|
|
1102
|
-
<xsl:call-template name="titletoc-part-style"/>
|
|
1103
|
-
<xsl:call-template name="titletoc-chapter-style"/>
|
|
1104
|
-
<xsl:call-template name="titletoc-section-style"/>
|
|
1105
|
-
<xsl:call-template name="titletoc-subsection-style"/>
|
|
1106
|
-
<xsl:call-template name="titletoc-subsubsection-style"/>
|
|
1107
|
-
<xsl:text>%%
</xsl:text>
|
|
770
|
+
<!-- Support for the "quantity" element: the siunitx package, -->
|
|
771
|
+
<!-- its version-dependent configuration, and the non-SI units -->
|
|
772
|
+
<!-- PreTeXt provides. A named template, shared by the regular -->
|
|
773
|
+
<!-- and Beamer preambles. -->
|
|
774
|
+
<xsl:template name="quantity-support">
|
|
775
|
+
<xsl:if test="$document-root//quantity">
|
|
776
|
+
<xsl:text>%% Used for units and number formatting
</xsl:text>
|
|
777
|
+
<xsl:text>\usepackage[per-mode=fraction]{siunitx}
</xsl:text>
|
|
778
|
+
<!-- v2 -> v3 is a major upgrade, we need to accomodate both -->
|
|
779
|
+
<!-- Eventually we may want to just fail on version 2 and warn. -->
|
|
780
|
+
<!-- Kernel test is actually "equal or later" according to -->
|
|
781
|
+
<!-- https://tex.stackexchange.com/questions/47743/ -->
|
|
782
|
+
<!-- require-a-certain-or-later-version-of-a-package -->
|
|
783
|
+
<!-- IfPackageAtLeastTF: maybe only available since 2020-10-01? -->
|
|
784
|
+
<xsl:text>%% v3 dated 2021-05-17, fix major behavior change
</xsl:text>
|
|
785
|
+
<xsl:text>\makeatletter%
</xsl:text>
|
|
786
|
+
<xsl:text>\@ifpackagelater{siunitx}{2021/05/17}
</xsl:text>
|
|
787
|
+
<xsl:text>{%
</xsl:text>
|
|
788
|
+
<xsl:text>\typeout{PTX: discovered siunitx v3, >= 2021-05-17}%
</xsl:text>
|
|
789
|
+
<xsl:text>\sisetup{parse-numbers = false}%
</xsl:text>
|
|
790
|
+
<xsl:text>}
</xsl:text>
|
|
791
|
+
<xsl:text>{%
</xsl:text>
|
|
792
|
+
<xsl:text>\typeout{PTX: discovered siunitx v2, < 2021-05-17}%
</xsl:text>
|
|
793
|
+
<xsl:text>}%
</xsl:text>
|
|
794
|
+
<xsl:text>\makeatother%
</xsl:text>
|
|
795
|
+
<xsl:text>\sisetup{inter-unit-product=\cdot}
</xsl:text>
|
|
796
|
+
<xsl:text>\ifxetex\sisetup{math-micro=\text{µ},text-micro=µ}\fi
</xsl:text>
|
|
797
|
+
<xsl:text>\ifluatex\sisetup{math-micro=\text{µ},text-micro=µ}\fi
</xsl:text>
|
|
798
|
+
<xsl:text>%% Common non-SI units
</xsl:text>
|
|
799
|
+
<xsl:for-each select="document('pretext-units.xsl')//base[@siunitx]">
|
|
800
|
+
<xsl:text>\DeclareSIUnit\</xsl:text>
|
|
801
|
+
<xsl:value-of select="@full" />
|
|
802
|
+
<xsl:text>{</xsl:text>
|
|
803
|
+
<xsl:choose>
|
|
804
|
+
<xsl:when test="@siunitx='none'">
|
|
805
|
+
<xsl:value-of select="@short" />
|
|
806
|
+
</xsl:when>
|
|
807
|
+
<xsl:otherwise>
|
|
808
|
+
<xsl:value-of select="@siunitx" />
|
|
809
|
+
</xsl:otherwise>
|
|
810
|
+
</xsl:choose>
|
|
811
|
+
<xsl:text>}
</xsl:text>
|
|
812
|
+
</xsl:for-each>
|
|
813
|
+
</xsl:if>
|
|
814
|
+
</xsl:template>
|
|
815
|
+
|
|
816
|
+
<!-- The funding/support acknowledgment ("bibinfo/support") is an -->
|
|
817
|
+
<!-- unnumbered footnote on an article's title page: temporarily -->
|
|
818
|
+
<!-- hijack \thefootnote to suppress the mark, then restore it. -->
|
|
819
|
+
<!-- Shared: the regular conversion employs this via its -->
|
|
820
|
+
<!-- "footnote-numbering", classic via its "frontmatter-helpers" -->
|
|
821
|
+
<xsl:template name="support-footnote">
|
|
822
|
+
<xsl:if test="$b-is-article and $bibinfo/support">
|
|
823
|
+
<xsl:text>%% add a \ptxsupport command as unnumbered footnote
</xsl:text>
|
|
824
|
+
<xsl:text>\let\ptxsavedfootnote\thefootnote%
</xsl:text>
|
|
825
|
+
<xsl:text>\newcommand\ptxsupport[1]{%
</xsl:text>
|
|
826
|
+
<xsl:text> \let\thefootnote\relax%
</xsl:text>
|
|
827
|
+
<xsl:text> \footnotetext{#1}%
</xsl:text>
|
|
828
|
+
<xsl:text> \let\thefootnote\ptxsavedfootnote%
</xsl:text>
|
|
829
|
+
<xsl:text>}
</xsl:text>
|
|
830
|
+
</xsl:if>
|
|
1108
831
|
</xsl:template>
|
|
1109
832
|
|
|
1110
833
|
<!-- Semantic Macros -->
|
|
@@ -1112,20 +835,20 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1112
835
|
<xsl:text>%% Begin: Semantic Macros
</xsl:text>
|
|
1113
836
|
<xsl:text>%% To preserve meaning in a LaTeX file
</xsl:text>
|
|
1114
837
|
<xsl:text>%%
</xsl:text>
|
|
1115
|
-
<xsl:text>%% \
|
|
838
|
+
<xsl:text>%% \ptxmono macro for content of "c", "cd", "tag", etc elements
</xsl:text>
|
|
1116
839
|
<xsl:text>%% Also used automatically in other constructions
</xsl:text>
|
|
1117
840
|
<xsl:text>%% Simply an alias for \texttt
</xsl:text>
|
|
1118
841
|
<xsl:text>%% Always defined, even if there is no need, or if a specific tt font is not loaded
</xsl:text>
|
|
1119
|
-
<xsl:text>\newcommand{\
|
|
842
|
+
<xsl:text>\newcommand{\ptxmono}[1]{\texttt{#1}}
</xsl:text>
|
|
1120
843
|
<xsl:text>%%
</xsl:text>
|
|
1121
|
-
<!-- \
|
|
844
|
+
<!-- \ptxlinkhilite macro for highlighting hyperlinks (xref, url) -->
|
|
1122
845
|
<!-- Only defined when needed, i.e. when not "none" -->
|
|
1123
846
|
<!-- "underline": wraps with \underline -->
|
|
1124
847
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
1125
|
-
<xsl:text>%% \
|
|
848
|
+
<xsl:text>%% \ptxlinkhilite macro: wraps hyperlink visible text for highlighting
</xsl:text>
|
|
1126
849
|
<xsl:choose>
|
|
1127
850
|
<xsl:when test="$latex-link-highlight = 'underline'">
|
|
1128
|
-
<xsl:text>\newcommand{\
|
|
851
|
+
<xsl:text>\newcommand{\ptxlinkhilite}[1]{\underline{#1}}
</xsl:text>
|
|
1129
852
|
</xsl:when>
|
|
1130
853
|
</xsl:choose>
|
|
1131
854
|
</xsl:if>
|
|
@@ -1144,16 +867,16 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1144
867
|
</xsl:for-each>
|
|
1145
868
|
<xsl:if test="$document-root//alert">
|
|
1146
869
|
<xsl:text>%% Used for warnings, typically bold and italic
</xsl:text>
|
|
1147
|
-
<xsl:text>\newcommand{\
|
|
870
|
+
<xsl:text>\newcommand{\ptxalert}[1]{\textbf{\textit{#1}}}
</xsl:text>
|
|
1148
871
|
</xsl:if>
|
|
1149
872
|
<xsl:if test="$document-root//term">
|
|
1150
873
|
<xsl:text>%% Used for inline definitions of terms
</xsl:text>
|
|
1151
|
-
<xsl:text>\newcommand{\
|
|
874
|
+
<xsl:text>\newcommand{\ptxterminology}[1]{\textbf{#1}}
</xsl:text>
|
|
1152
875
|
</xsl:if>
|
|
1153
876
|
<!-- 2018-02-05: "booktitle" deprecated -->
|
|
1154
877
|
<xsl:if test="$document-root//pubtitle">
|
|
1155
878
|
<xsl:text>%% Titles of longer works (e.g. books, versus articles)
</xsl:text>
|
|
1156
|
-
<xsl:text>\newcommand{\
|
|
879
|
+
<xsl:text>\newcommand{\ptxpubtitle}[1]{\textsl{#1}}
</xsl:text>
|
|
1157
880
|
</xsl:if>
|
|
1158
881
|
<!-- http://tex.stackexchange.com/questions/23711/strikethrough-text -->
|
|
1159
882
|
<!-- http://tex.stackexchange.com/questions/287599/thickness-for-sout-strikethrough-command-from-ulem-package -->
|
|
@@ -1166,32 +889,32 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1166
889
|
<xsl:text>%% Macros will use colors for "electronic" version (the default)
</xsl:text>
|
|
1167
890
|
<xsl:if test="$document-root//insert">
|
|
1168
891
|
<xsl:text>%% Used for an edit that is an addition
</xsl:text>
|
|
1169
|
-
<xsl:text>\newcommand{\
|
|
892
|
+
<xsl:text>\newcommand{\ptxinsertthick}{.1ex}
</xsl:text>
|
|
1170
893
|
<xsl:choose>
|
|
1171
894
|
<xsl:when test="$b-latex-print">
|
|
1172
|
-
<xsl:text>\newcommand{\
|
|
895
|
+
<xsl:text>\newcommand{\ptxinserted}[1]{\renewcommand{\ULthickness}{\ptxinsertthick}\uline{#1}}
</xsl:text>
|
|
1173
896
|
</xsl:when>
|
|
1174
897
|
<xsl:otherwise>
|
|
1175
|
-
<xsl:text>\newcommand{\
|
|
898
|
+
<xsl:text>\newcommand{\ptxinserted}[1]{\renewcommand{\ULthickness}{\ptxinsertthick}\textcolor{green}{\uline{#1}}}
</xsl:text>
|
|
1176
899
|
</xsl:otherwise>
|
|
1177
900
|
</xsl:choose>
|
|
1178
901
|
</xsl:if>
|
|
1179
902
|
<xsl:if test="$document-root//delete">
|
|
1180
903
|
<xsl:text>%% Used for an edit that is a deletion
</xsl:text>
|
|
1181
|
-
<xsl:text>\newcommand{\
|
|
904
|
+
<xsl:text>\newcommand{\ptxdeletethick}{.25ex}
</xsl:text>
|
|
1182
905
|
<xsl:choose>
|
|
1183
906
|
<xsl:when test="$b-latex-print">
|
|
1184
|
-
<xsl:text>\newcommand{\
|
|
907
|
+
<xsl:text>\newcommand{\ptxdeleted}[1]{\renewcommand{\ULthickness}{\ptxdeletethick}\sout{#1}}
</xsl:text>
|
|
1185
908
|
</xsl:when>
|
|
1186
909
|
<xsl:otherwise>
|
|
1187
|
-
<xsl:text>\newcommand{\
|
|
910
|
+
<xsl:text>\newcommand{\ptxdeleted}[1]{\renewcommand{\ULthickness}{\ptxdeletethick}\textcolor{red}{\sout{#1}}}
</xsl:text>
|
|
1188
911
|
</xsl:otherwise>
|
|
1189
912
|
</xsl:choose>
|
|
1190
913
|
</xsl:if>
|
|
1191
914
|
<xsl:if test="$document-root//stale">
|
|
1192
915
|
<xsl:text>%% Used for inline irrelevant or obsolete text
</xsl:text>
|
|
1193
|
-
<xsl:text>\newcommand{\
|
|
1194
|
-
<xsl:text>\newcommand{\
|
|
916
|
+
<xsl:text>\newcommand{\ptxstalethick}{.1ex}
</xsl:text>
|
|
917
|
+
<xsl:text>\newcommand{\ptxstale}[1]{\renewcommand{\ULthickness}{\ptxstalethick}\sout{#1}}
</xsl:text>
|
|
1195
918
|
</xsl:if>
|
|
1196
919
|
</xsl:if>
|
|
1197
920
|
<xsl:if test="$document-root//fillin[not(parent::m or parent::mrow)]">
|
|
@@ -1203,192 +926,21 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1203
926
|
<!-- http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/ -->
|
|
1204
927
|
<xsl:if test="$document-root//swungdash">
|
|
1205
928
|
<xsl:text>%% A character like a tilde, but different
</xsl:text>
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
<xsl:if test="$document-root//quantity">
|
|
1209
|
-
<xsl:text>%% Used for units and number formatting
</xsl:text>
|
|
1210
|
-
<xsl:text>\usepackage[per-mode=fraction]{siunitx}
</xsl:text>
|
|
1211
|
-
<!-- v2 -> v3 is a major upgrade, we need to accomodate both -->
|
|
1212
|
-
<!-- Eventually we may want to just fail on version 2 and warn. -->
|
|
1213
|
-
<!-- Kernel test is actually "equal or later" according to -->
|
|
1214
|
-
<!-- https://tex.stackexchange.com/questions/47743/ -->
|
|
1215
|
-
<!-- require-a-certain-or-later-version-of-a-package -->
|
|
1216
|
-
<!-- IfPackageAtLeastTF: maybe only available since 2020-10-01? -->
|
|
1217
|
-
<xsl:text>%% v3 dated 2021-05-17, fix major behavior change
</xsl:text>
|
|
1218
|
-
<xsl:text>\makeatletter%
</xsl:text>
|
|
1219
|
-
<xsl:text>\@ifpackagelater{siunitx}{2021/05/17}
</xsl:text>
|
|
1220
|
-
<xsl:text>{%
</xsl:text>
|
|
1221
|
-
<xsl:text>\typeout{PTX: discovered siunitx v3, >= 2021-05-17}%
</xsl:text>
|
|
1222
|
-
<xsl:text>\sisetup{parse-numbers = false}%
</xsl:text>
|
|
1223
|
-
<xsl:text>}
</xsl:text>
|
|
1224
|
-
<xsl:text>{%
</xsl:text>
|
|
1225
|
-
<xsl:text>\typeout{PTX: discovered siunitx v2, < 2021-05-17}%
</xsl:text>
|
|
1226
|
-
<xsl:text>}%
</xsl:text>
|
|
1227
|
-
<xsl:text>\makeatother%
</xsl:text>
|
|
1228
|
-
<xsl:text>\sisetup{inter-unit-product=\cdot}
</xsl:text>
|
|
1229
|
-
<xsl:text>\ifxetex\sisetup{math-micro=\text{µ},text-micro=µ}\fi</xsl:text>
|
|
1230
|
-
<xsl:text>\ifluatex\sisetup{math-micro=\text{µ},text-micro=µ}\fi</xsl:text>
|
|
1231
|
-
<xsl:text>%% Common non-SI units
</xsl:text>
|
|
1232
|
-
<xsl:for-each select="document('pretext-units.xsl')//base[@siunitx]">
|
|
1233
|
-
<xsl:text>\DeclareSIUnit\</xsl:text>
|
|
1234
|
-
<xsl:value-of select="@full" />
|
|
1235
|
-
<xsl:text>{</xsl:text>
|
|
1236
|
-
<xsl:choose>
|
|
1237
|
-
<xsl:when test="@siunitx='none'">
|
|
1238
|
-
<xsl:value-of select="@short" />
|
|
1239
|
-
</xsl:when>
|
|
1240
|
-
<xsl:otherwise>
|
|
1241
|
-
<xsl:value-of select="@siunitx" />
|
|
1242
|
-
</xsl:otherwise>
|
|
1243
|
-
</xsl:choose>
|
|
1244
|
-
<xsl:text>}
</xsl:text>
|
|
1245
|
-
</xsl:for-each>
|
|
929
|
+
<!-- http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/ -->
|
|
930
|
+
<xsl:text>\newcommand{\ptxswungdash}{\raisebox{-2.25ex}{\scalebox{2}{\~{}}}}
</xsl:text>
|
|
1246
931
|
</xsl:if>
|
|
932
|
+
<xsl:call-template name="quantity-support"/>
|
|
1247
933
|
<xsl:if test="$document-root//ol/li/title|$document-root//ul/li/title|$document-root//task/title">
|
|
1248
934
|
<!-- Styling: expose this macro to easier overriding for style work -->
|
|
1249
935
|
<!-- NB: needs a rename (and duplication) before exposing publicly -->
|
|
1250
936
|
<!-- conditional can be split for list items v. tasks -->
|
|
1251
937
|
<xsl:text>%% Style of a title on a list item, for ordered and unordered lists
</xsl:text>
|
|
1252
938
|
<xsl:text>%% Also "task" of exercise, PROJECT-LIKE, EXAMPLE-LIKE
</xsl:text>
|
|
1253
|
-
<xsl:text>\newcommand{\
|
|
939
|
+
<xsl:text>\newcommand{\ptxlititle}[1]{{\slshape#1}}
</xsl:text>
|
|
1254
940
|
</xsl:if>
|
|
1255
941
|
<xsl:text>%% End: Semantic Macros
</xsl:text>
|
|
1256
942
|
</xsl:template>
|
|
1257
943
|
|
|
1258
|
-
<!-- Exercises and solutions setup -->
|
|
1259
|
-
<xsl:template name="exercises-and-solutions">
|
|
1260
|
-
<xsl:if test="$document-root//solutions or $b-needs-solution-styles">
|
|
1261
|
-
<xsl:text>%% begin: environments for duplicates in solutions divisions
</xsl:text>
|
|
1262
|
-
<!-- Solutions present, check for exercise types -->
|
|
1263
|
-
<!-- This may have false positives, but no real harm -->
|
|
1264
|
-
<!-- -->
|
|
1265
|
-
<!-- solutions to inline exercises -->
|
|
1266
|
-
<xsl:if test="$document-root//exercise[boolean(&INLINE-EXERCISE-FILTER;)]">
|
|
1267
|
-
<xsl:text>%% Solutions to inline exercises, style and environment
</xsl:text>
|
|
1268
|
-
<xsl:text>\tcbset{ inlinesolutionstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, after title={\space}, breakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1269
|
-
<xsl:text>\newtcolorbox{inlinesolution}[4]</xsl:text>
|
|
1270
|
-
<xsl:text>{inlinesolutionstyle, title={\hyperref[#4]{#1~#2}\notblank{#3}{\space#3}{}}}
</xsl:text>
|
|
1271
|
-
</xsl:if>
|
|
1272
|
-
<!-- Division Solution -->
|
|
1273
|
-
<!-- Explicitly breakable, run-in title -->
|
|
1274
|
-
<xsl:if test="$document-root//exercises//exercise[not(ancestor::exercisegroup)]|$document-root//worksheet//exercise[not(ancestor::exercisegroup)]|$document-root//reading-questions//exercise[not(ancestor::exercisegroup)]">
|
|
1275
|
-
<xsl:text>%% Solutions to division exercises, not in exercise group
</xsl:text>
|
|
1276
|
-
<xsl:text>%% Parameter #1 is type-name and is ignored
</xsl:text>
|
|
1277
|
-
<xsl:text>\tcbset{ divisionsolutionstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, after title={\space}, breakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1278
|
-
<xsl:text>\newtcolorbox{divisionsolution}[4]</xsl:text>
|
|
1279
|
-
<xsl:text>{divisionsolutionstyle, title={\hyperlink{#4}{#2}.\notblank{#3}{\space#3}{}}}
</xsl:text>
|
|
1280
|
-
</xsl:if>
|
|
1281
|
-
<!-- Division Solution, Exercise Group -->
|
|
1282
|
-
<!-- Explicitly breakable, run-in title -->
|
|
1283
|
-
<xsl:if test="$document-root//exercisegroup[not(@cols)]">
|
|
1284
|
-
<xsl:text>%% Solutions to division exercises, in exercise group, no columns
</xsl:text>
|
|
1285
|
-
<xsl:text>%% Parameter #1 is type-name and is ignored
</xsl:text>
|
|
1286
|
-
<xsl:text>\tcbset{ divisionsolutionegstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, after title={\space}, left skip=\egindent, breakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1287
|
-
<xsl:text>\newtcolorbox{divisionsolutioneg}[4]</xsl:text>
|
|
1288
|
-
<xsl:text>{divisionsolutionegstyle, title={\hyperlink{#4}{#2}.\notblank{#3}{\space#3}{}}}
</xsl:text>
|
|
1289
|
-
</xsl:if>
|
|
1290
|
-
<!-- Division Solution, Exercise Group, Columnar -->
|
|
1291
|
-
<!-- Explicity unbreakable, to behave in multicolumn tcbraster -->
|
|
1292
|
-
<xsl:if test="$document-root//exercisegroup/@cols">
|
|
1293
|
-
<xsl:text>%% Solutions to division exercises, in exercise group with columns
</xsl:text>
|
|
1294
|
-
<xsl:text>%% Parameter #1 is type-name and is ignored
</xsl:text>
|
|
1295
|
-
<xsl:text>\tcbset{ divisionsolutionegcolstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, after title={\space}, halign=flush left, unbreakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1296
|
-
<xsl:text>\newtcolorbox{divisionsolutionegcol}[4]</xsl:text>
|
|
1297
|
-
<xsl:text>{divisionsolutionegcolstyle, title={\hyperlink{#4}{#2}.\notblank{#3}{\space#3}{}}}
</xsl:text>
|
|
1298
|
-
</xsl:if>
|
|
1299
|
-
<!-- solutions to PROJECT-LIKE -->
|
|
1300
|
-
<!-- "project-rep" variable defined twice (each local) -->
|
|
1301
|
-
<xsl:variable name="project-reps" select="
|
|
1302
|
-
($document-root//project)[1]|
|
|
1303
|
-
($document-root//activity)[1]|
|
|
1304
|
-
($document-root//exploration)[1]|
|
|
1305
|
-
($document-root//investigation)[1]"/>
|
|
1306
|
-
<xsl:for-each select="$project-reps">
|
|
1307
|
-
<xsl:variable name="elt-name">
|
|
1308
|
-
<xsl:value-of select="local-name(.)"/>
|
|
1309
|
-
</xsl:variable>
|
|
1310
|
-
<!-- set the style -->
|
|
1311
|
-
<xsl:text>\tcbset{ </xsl:text>
|
|
1312
|
-
<xsl:value-of select="$elt-name"/>
|
|
1313
|
-
<xsl:text>solutionstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, after title={\space}, breakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1314
|
-
<!-- create the environment -->
|
|
1315
|
-
<xsl:text>\newtcolorbox{</xsl:text>
|
|
1316
|
-
<xsl:value-of select="$elt-name"/>
|
|
1317
|
-
<xsl:text>solution}[4]</xsl:text>
|
|
1318
|
-
<xsl:text>{</xsl:text>
|
|
1319
|
-
<xsl:value-of select="$elt-name"/>
|
|
1320
|
-
<xsl:text>solutionstyle, title={\hyperref[#4]{#1~#2}\notblank{#3}{\space#3}{}}}
</xsl:text>
|
|
1321
|
-
</xsl:for-each>
|
|
1322
|
-
</xsl:if>
|
|
1323
|
-
<!-- Generic exercise lead-in -->
|
|
1324
|
-
<xsl:if test="$document-root//exercises//exercise|$document-root//worksheet//exercise|$document-root//reading-questions//exercise">
|
|
1325
|
-
<xsl:text>%% Divisional exercises (and worksheet) as LaTeX environments
</xsl:text>
|
|
1326
|
-
<xsl:text>%% Third argument is option for extra workspace in worksheets
</xsl:text>
|
|
1327
|
-
<xsl:text>%% Hanging indent occupies a 5ex width slot prior to left margin
</xsl:text>
|
|
1328
|
-
<xsl:text>%% Experimentally this seems just barely sufficient for a bold "888."
</xsl:text>
|
|
1329
|
-
</xsl:if>
|
|
1330
|
-
<!-- Division Exercise -->
|
|
1331
|
-
<!-- Numbered, styled with a hanging indent -->
|
|
1332
|
-
<xsl:if test="$document-root//exercises//exercise[not(ancestor::exercisegroup)]|$document-root//worksheet//exercise[not(ancestor::exercisegroup)]|$document-root//reading-questions//exercise[not(ancestor::exercisegroup)]">
|
|
1333
|
-
<xsl:text>%% Division exercises, not in exercise group
</xsl:text>
|
|
1334
|
-
<!-- Outdenting the problem number requires an "\hspace*" to avoid an edge case -->
|
|
1335
|
-
<!-- https://tex.stackexchange.com/questions/722329/unwanted-space-in-tcbraster -->
|
|
1336
|
-
<!-- https://tex.stackexchange.com/questions/89082/hspace-vs-hspace -->
|
|
1337
|
-
<xsl:text>\tcbset{ divisionexercisestyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, left=5ex, breakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1338
|
-
<xsl:text>\newtcolorbox{divisionexercise}[4]</xsl:text>
|
|
1339
|
-
<xsl:text>{divisionexercisestyle, before title={\hspace*{-5ex}\makebox[5ex][l]{#1.}}, title={\notblank{#2}{#2}{}}, after title={\notblank{#2}{\space}{}}, phantom={</xsl:text>
|
|
1340
|
-
<xsl:if test="$b-pageref">
|
|
1341
|
-
<xsl:text>\label{#4}</xsl:text>
|
|
1342
|
-
</xsl:if>
|
|
1343
|
-
<xsl:text>\hypertarget{#4}{}}, after={\notblank{#3}{\par\rule{\workspacestrutwidth}{#3}\par\vfill}{\par}}}
</xsl:text>
|
|
1344
|
-
</xsl:if>
|
|
1345
|
-
<!-- Division Exercise, Exercise Group -->
|
|
1346
|
-
<!-- The exercise itself carries the indentation, hence we can use breakable -->
|
|
1347
|
-
<!-- boxes and get good page breaks (as these problems could be long) -->
|
|
1348
|
-
<xsl:if test="$document-root//exercisegroup[not(@cols)]">
|
|
1349
|
-
<xsl:text>%% Division exercises, in exercise group, no columns
</xsl:text>
|
|
1350
|
-
<!-- Outdenting the problem number requires an "\hspace*" to avoid an edge case -->
|
|
1351
|
-
<!-- https://tex.stackexchange.com/questions/722329/unwanted-space-in-tcbraster -->
|
|
1352
|
-
<!-- https://tex.stackexchange.com/questions/89082/hspace-vs-hspace -->
|
|
1353
|
-
<xsl:text>\tcbset{ divisionexerciseegstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, left=5ex, left skip=\egindent, breakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1354
|
-
<xsl:text>\newtcolorbox{divisionexerciseeg}[4]</xsl:text>
|
|
1355
|
-
<xsl:text>{divisionexerciseegstyle, before title={\hspace*{-5ex}\makebox[5ex][l]{#1.}}, title={\notblank{#2}{#2}{}}, after title={\notblank{#2}{\space}{}}, phantom={</xsl:text>
|
|
1356
|
-
<xsl:if test="$b-pageref">
|
|
1357
|
-
<xsl:text>\label{#4}</xsl:text>
|
|
1358
|
-
</xsl:if>
|
|
1359
|
-
<xsl:text>\hypertarget{#4}{}}, after={\notblank{#3}{\par\rule{\workspacestrutwidth}{#3}\par\vfill}{\par}}}
</xsl:text>
|
|
1360
|
-
</xsl:if>
|
|
1361
|
-
<!-- Division Exercise, Exercise Group, Columnar -->
|
|
1362
|
-
<!-- Explicity unbreakable, to behave in multicolumn tcbraster -->
|
|
1363
|
-
<xsl:if test="$document-root//exercisegroup/@cols">
|
|
1364
|
-
<xsl:text>%% Division exercises, in exercise group with columns
</xsl:text>
|
|
1365
|
-
<!-- Outdenting the problem number requires an "\hspace*" to avoid an edge case -->
|
|
1366
|
-
<!-- https://tex.stackexchange.com/questions/722329/unwanted-space-in-tcbraster -->
|
|
1367
|
-
<!-- https://tex.stackexchange.com/questions/89082/hspace-vs-hspace -->
|
|
1368
|
-
<xsl:text>\tcbset{ divisionexerciseegcolstyle/.style={bwminimalstyle, runintitlestyle, exercisespacingstyle, left=5ex, halign=flush left, unbreakable, before upper app={\setparstyle} } }
</xsl:text>
|
|
1369
|
-
<xsl:text>\newtcolorbox{divisionexerciseegcol}[4]</xsl:text>
|
|
1370
|
-
<xsl:text>{divisionexerciseegcolstyle, before title={\hspace*{-5ex}\makebox[5ex][l]{#1.}}, title={\notblank{#2}{#2}{}}, after title={\notblank{#2}{\space}{}}, phantom={</xsl:text>
|
|
1371
|
-
<xsl:if test="$b-pageref">
|
|
1372
|
-
<xsl:text>\label{#4}</xsl:text>
|
|
1373
|
-
</xsl:if>
|
|
1374
|
-
<xsl:text>\hypertarget{#4}{}}, after upper={\notblank{#3}{\par\rule{\workspacestrutwidth}{#3}\par\vfill}{\par}}}
</xsl:text>
|
|
1375
|
-
</xsl:if>
|
|
1376
|
-
<xsl:if test="$document-root//@workspace">
|
|
1377
|
-
<xsl:text>%% Worksheets and handouts children may have workspaces
</xsl:text>
|
|
1378
|
-
<xsl:text>\newlength{\workspacestrutwidth}
</xsl:text>
|
|
1379
|
-
<xsl:choose>
|
|
1380
|
-
<xsl:when test="$b-latex-draft-mode">
|
|
1381
|
-
<xsl:text>%% LaTeX draft mode, @workspace strut is visible
</xsl:text>
|
|
1382
|
-
<xsl:text>\setlength{\workspacestrutwidth}{2pt}
</xsl:text>
|
|
1383
|
-
</xsl:when>
|
|
1384
|
-
<xsl:otherwise>
|
|
1385
|
-
<xsl:text>%% @workspace strut is invisible
</xsl:text>
|
|
1386
|
-
<xsl:text>\setlength{\workspacestrutwidth}{0pt}
</xsl:text>
|
|
1387
|
-
</xsl:otherwise>
|
|
1388
|
-
</xsl:choose>
|
|
1389
|
-
</xsl:if>
|
|
1390
|
-
</xsl:template>
|
|
1391
|
-
|
|
1392
944
|
<!-- Chapter start number -->
|
|
1393
945
|
<xsl:template name="chapter-start-number">
|
|
1394
946
|
<!-- Publishers can start chapter numbering at will. Chapter 0 for -->
|
|
@@ -1452,7 +1004,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1452
1004
|
<xsl:text>%% Fourth argument, if nonempty, is a vertical space adjustment
</xsl:text>
|
|
1453
1005
|
<xsl:text>%% and implies image will be preceded by \leavevmode\nopagebreak
</xsl:text>
|
|
1454
1006
|
<xsl:text>%% Intended use is for alignment with a list marker
</xsl:text>
|
|
1455
|
-
<xsl:text>\NewDocumentEnvironment{image}{mmmm}{\notblank{#4}{\leavevmode\nopagebreak\vspace{#4}}{}\begin{tcbimage}{#1}{#2}{#3}}{\end{tcbimage}%
}
|
|
1007
|
+
<xsl:text>\NewDocumentEnvironment{image}{mmmm}{\notblank{#4}{\leavevmode\nopagebreak\vspace{#4}}{}\begin{tcbimage}{#1}{#2}{#3}}{\end{tcbimage}%
}
</xsl:text>
|
|
1456
1008
|
</xsl:if>
|
|
1457
1009
|
</xsl:template>
|
|
1458
1010
|
|
|
@@ -1467,9 +1019,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1467
1019
|
<xsl:text>%% Define variable thickness horizontal rules, full and partial
</xsl:text>
|
|
1468
1020
|
<xsl:text>%% Thicknesses are 0.03, 0.05, 0.08 in the booktabs package
</xsl:text>
|
|
1469
1021
|
<!-- http://tex.stackexchange.com/questions/119153/table-with-different-rule-widths -->
|
|
1470
|
-
<xsl:text>\newcommand{\
|
|
1471
|
-
<xsl:text>\newcommand{\
|
|
1472
|
-
<xsl:text>\newcommand{\
|
|
1022
|
+
<xsl:text>\newcommand{\ptxhrulethin} {\noalign{\hrule height 0.04em}}
</xsl:text>
|
|
1023
|
+
<xsl:text>\newcommand{\ptxhrulemedium}{\noalign{\hrule height 0.07em}}
</xsl:text>
|
|
1024
|
+
<xsl:text>\newcommand{\ptxhrulethick} {\noalign{\hrule height 0.11em}}
</xsl:text>
|
|
1473
1025
|
<!-- http://tex.stackexchange.com/questions/24549/horizontal-rule-with-adjustable-height-behaving-like-clinen-m -->
|
|
1474
1026
|
<!-- Could preserve/restore \arrayrulewidth on entry/exit to tabular -->
|
|
1475
1027
|
<!-- But we'll get cleaner source with this built into macros -->
|
|
@@ -1477,20 +1029,20 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1477
1029
|
<!-- arrows (see discussion below) -->
|
|
1478
1030
|
<xsl:text>%% We preserve a copy of the \setlength package before other
</xsl:text>
|
|
1479
1031
|
<xsl:text>%% packages (extpfeil) get a chance to load packages that redefine it
</xsl:text>
|
|
1480
|
-
<xsl:text>\let\
|
|
1481
|
-
<xsl:text>\newlength{\
|
|
1482
|
-
<xsl:text>\newcommand{\
|
|
1483
|
-
<xsl:text>{\noalign{\global\
|
|
1484
|
-
<xsl:text>\noalign{\global\
|
|
1485
|
-
<xsl:text>\noalign{\global\
|
|
1486
|
-
<xsl:text>\newcommand{\
|
|
1487
|
-
<xsl:text>{\noalign{\global\
|
|
1488
|
-
<xsl:text>\noalign{\global\
|
|
1489
|
-
<xsl:text>\noalign{\global\
|
|
1490
|
-
<xsl:text>\newcommand{\
|
|
1491
|
-
<xsl:text>{\noalign{\global\
|
|
1492
|
-
<xsl:text>\noalign{\global\
|
|
1493
|
-
<xsl:text>\noalign{\global\
|
|
1032
|
+
<xsl:text>\let\ptxoldsetlength\setlength
</xsl:text>
|
|
1033
|
+
<xsl:text>\newlength{\ptxOldarrayrulewidth}
</xsl:text>
|
|
1034
|
+
<xsl:text>\newcommand{\ptxcrulethin}[1]%
</xsl:text>
|
|
1035
|
+
<xsl:text>{\noalign{\global\ptxoldsetlength{\ptxOldarrayrulewidth}{\arrayrulewidth}}%
</xsl:text>
|
|
1036
|
+
<xsl:text>\noalign{\global\ptxoldsetlength{\arrayrulewidth}{0.04em}}\cline{#1}%
</xsl:text>
|
|
1037
|
+
<xsl:text>\noalign{\global\ptxoldsetlength{\arrayrulewidth}{\ptxOldarrayrulewidth}}}%
</xsl:text>
|
|
1038
|
+
<xsl:text>\newcommand{\ptxcrulemedium}[1]%
</xsl:text>
|
|
1039
|
+
<xsl:text>{\noalign{\global\ptxoldsetlength{\ptxOldarrayrulewidth}{\arrayrulewidth}}%
</xsl:text>
|
|
1040
|
+
<xsl:text>\noalign{\global\ptxoldsetlength{\arrayrulewidth}{0.07em}}\cline{#1}%
</xsl:text>
|
|
1041
|
+
<xsl:text>\noalign{\global\ptxoldsetlength{\arrayrulewidth}{\ptxOldarrayrulewidth}}}
</xsl:text>
|
|
1042
|
+
<xsl:text>\newcommand{\ptxcrulethick}[1]%
</xsl:text>
|
|
1043
|
+
<xsl:text>{\noalign{\global\ptxoldsetlength{\ptxOldarrayrulewidth}{\arrayrulewidth}}%
</xsl:text>
|
|
1044
|
+
<xsl:text>\noalign{\global\ptxoldsetlength{\arrayrulewidth}{0.11em}}\cline{#1}%
</xsl:text>
|
|
1045
|
+
<xsl:text>\noalign{\global\ptxoldsetlength{\arrayrulewidth}{\ptxOldarrayrulewidth}}}
</xsl:text>
|
|
1494
1046
|
<!-- http://tex.stackexchange.com/questions/119153/table-with-different-rule-widths -->
|
|
1495
1047
|
<xsl:text>%% Single letter column specifiers defined via array package
</xsl:text>
|
|
1496
1048
|
<xsl:text>\newcolumntype{A}{!{\vrule width 0.04em}}
</xsl:text>
|
|
@@ -1502,45 +1054,11 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1502
1054
|
<xsl:text>\newtcolorbox{tabularbox}[3]{tabularboxstyle, left skip=#1\linewidth, width=#2\linewidth,}
</xsl:text>
|
|
1503
1055
|
</xsl:if>
|
|
1504
1056
|
<xsl:if test="$document-root//cell/line">
|
|
1505
|
-
<xsl:text>\newcommand{\
|
|
1057
|
+
<xsl:text>\newcommand{\ptxtablecelllines}[3]%
</xsl:text>
|
|
1506
1058
|
<xsl:text>{\begin{tabular}[#2]{@{}#1@{}}#3\end{tabular}}
</xsl:text>
|
|
1507
1059
|
</xsl:if>
|
|
1508
1060
|
</xsl:template>
|
|
1509
1061
|
|
|
1510
|
-
<!-- Numbering Footnotes -->
|
|
1511
|
-
<xsl:template name="footnote-numbering">
|
|
1512
|
-
<xsl:if test="$document-root//fn">
|
|
1513
|
-
<xsl:text>%% Footnote Numbering
</xsl:text>
|
|
1514
|
-
<xsl:text>%% Specified by numbering.footnotes.level
</xsl:text>
|
|
1515
|
-
<xsl:if test="$b-is-book">
|
|
1516
|
-
<xsl:text>%% Undo counter reset by chapter for a book
</xsl:text>
|
|
1517
|
-
<xsl:text>\counterwithout{footnote}{chapter}
</xsl:text>
|
|
1518
|
-
</xsl:if>
|
|
1519
|
-
<xsl:choose>
|
|
1520
|
-
<xsl:when test="$numbering-footnotes = 0">
|
|
1521
|
-
<xsl:text>%% Global numbering, since numbering.footnotes.level = 0
</xsl:text>
|
|
1522
|
-
</xsl:when>
|
|
1523
|
-
<xsl:otherwise>
|
|
1524
|
-
<xsl:text>\counterwithin*{footnote}{</xsl:text>
|
|
1525
|
-
<xsl:call-template name="level-to-name">
|
|
1526
|
-
<xsl:with-param name="level" select="$numbering-footnotes" />
|
|
1527
|
-
</xsl:call-template>
|
|
1528
|
-
<xsl:text>}
</xsl:text>
|
|
1529
|
-
</xsl:otherwise>
|
|
1530
|
-
</xsl:choose>
|
|
1531
|
-
</xsl:if>
|
|
1532
|
-
<!-- If there is a <support> tag in an article, create a unnumbered footnote environment for it -->
|
|
1533
|
-
<xsl:if test="$b-is-article and $bibinfo/support">
|
|
1534
|
-
<xsl:text>%% add a \support command as unnumbered footnote
</xsl:text>
|
|
1535
|
-
<xsl:text>\let\svdthefootnote\thefootnote%
</xsl:text>
|
|
1536
|
-
<xsl:text>\newcommand\support[1]{%
</xsl:text>
|
|
1537
|
-
<xsl:text> \let\thefootnote\relax%
</xsl:text>
|
|
1538
|
-
<xsl:text> \footnotetext{#1}%
</xsl:text>
|
|
1539
|
-
<xsl:text> \let\thefootnote\svdthefootnote%
</xsl:text>
|
|
1540
|
-
<xsl:text>}
</xsl:text>
|
|
1541
|
-
</xsl:if>
|
|
1542
|
-
</xsl:template>
|
|
1543
|
-
|
|
1544
1062
|
<!-- Font Awesome package -->
|
|
1545
1063
|
<xsl:template name="font-awesome">
|
|
1546
1064
|
<xsl:if test="$b-has-icon">
|
|
@@ -1555,16 +1073,16 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1555
1073
|
<xsl:if test="$document-root//poem">
|
|
1556
1074
|
<xsl:text>%% Poetry Support
</xsl:text>
|
|
1557
1075
|
<xsl:text>\newenvironment{poem}{\setlength{\parindent}{0em}}{}
</xsl:text>
|
|
1558
|
-
<xsl:text>\newcommand{\
|
|
1559
|
-
<xsl:text>\newcommand{\
|
|
1076
|
+
<xsl:text>\newcommand{\ptxpoemTitle}[1]{\begin{center}\large\textbf{#1}\end{center}}
</xsl:text>
|
|
1077
|
+
<xsl:text>\newcommand{\ptxpoemIndent}{\hspace{2 em}}
</xsl:text>
|
|
1560
1078
|
<xsl:text>\newenvironment{stanza}{\vspace{0.25 em}\hangindent=4em}{\vspace{1 em}}
</xsl:text>
|
|
1561
|
-
<xsl:text>\newcommand{\
|
|
1562
|
-
<xsl:text>\newcommand{\
|
|
1563
|
-
<xsl:text>\newcommand{\
|
|
1564
|
-
<xsl:text>\newcommand{\
|
|
1565
|
-
<xsl:text>\newcommand{\
|
|
1566
|
-
<xsl:text>\newcommand{\
|
|
1567
|
-
<xsl:text>\newcommand{\
|
|
1079
|
+
<xsl:text>\newcommand{\ptxstanzaTitle}[1]{{\centering\textbf{#1}\par}\vspace{-\parskip}}
</xsl:text>
|
|
1080
|
+
<xsl:text>\newcommand{\ptxpoemauthorleft}[1]{\vspace{-1em}\begin{flushleft}\textit{#1}\end{flushleft}}
</xsl:text>
|
|
1081
|
+
<xsl:text>\newcommand{\ptxpoemauthorcenter}[1]{\vspace{-1em}\begin{center}\textit{#1}\end{center}}
</xsl:text>
|
|
1082
|
+
<xsl:text>\newcommand{\ptxpoemauthorright}[1]{\vspace{-1em}\begin{flushright}\textit{#1}\end{flushright}}
</xsl:text>
|
|
1083
|
+
<xsl:text>\newcommand{\ptxpoemlineleft}[1]{{\raggedright{#1}\par}\vspace{-\parskip}}
</xsl:text>
|
|
1084
|
+
<xsl:text>\newcommand{\ptxpoemlinecenter}[1]{{\centering{#1}\par}\vspace{-\parskip}}
</xsl:text>
|
|
1085
|
+
<xsl:text>\newcommand{\ptxpoemlineright}[1]{{\raggedleft{#1}\par}\vspace{-\parskip}}
</xsl:text>
|
|
1568
1086
|
</xsl:if>
|
|
1569
1087
|
</xsl:template>
|
|
1570
1088
|
|
|
@@ -1577,11 +1095,11 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1577
1095
|
<xsl:text>%% For Ubuntu/Debian use the texlive-music package
</xsl:text>
|
|
1578
1096
|
<!-- Note: package's shorthand macros \fl, \sh, \na might conflict with authors' macros? -->
|
|
1579
1097
|
<xsl:text>\usepackage{musicography}
</xsl:text>
|
|
1580
|
-
<xsl:text>\
|
|
1581
|
-
<xsl:text>\newcommand{\
|
|
1582
|
-
<xsl:text>\
|
|
1583
|
-
<xsl:text>\newcommand{\
|
|
1584
|
-
<xsl:text>\
|
|
1098
|
+
<xsl:text>\newcommand{\ptxflat}{\musFlat}
</xsl:text>
|
|
1099
|
+
<xsl:text>\newcommand{\ptxdoubleflat}{\musDoubleFlat}
</xsl:text>
|
|
1100
|
+
<xsl:text>\newcommand{\ptxsharp}{\musSharp}
</xsl:text>
|
|
1101
|
+
<xsl:text>\newcommand{\ptxdoublesharp}{\musDoubleSharp}
</xsl:text>
|
|
1102
|
+
<xsl:text>\newcommand{\ptxnatural}{\musNatural}
</xsl:text>
|
|
1585
1103
|
<xsl:text>%%
</xsl:text>
|
|
1586
1104
|
</xsl:if>
|
|
1587
1105
|
</xsl:template>
|
|
@@ -1770,13 +1288,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1770
1288
|
<xsl:text>\newtcblisting{programnumbered}[4]{programboxnumberedstyle, left skip=#2\linewidth, width=#3\linewidth, listing options={language=#1, style=programcodenumberedstyle}}
</xsl:text>
|
|
1771
1289
|
<!-- Arguments: language, body text. body text must start and end with a -->
|
|
1772
1290
|
<!-- single character delimeter not in the text itself. -->
|
|
1773
|
-
<xsl:text>\newcommand{\
|
|
1291
|
+
<xsl:text>\newcommand{\ptxprogramfragment}[2]{\lstinline[language=#1, style=programcodestyle, basicstyle=\ttfamily]#2}
</xsl:text>
|
|
1774
1292
|
</xsl:if>
|
|
1775
1293
|
<xsl:if test="$document-root//console">
|
|
1776
1294
|
<xsl:text>%% Console session with prompt, input, output
</xsl:text>
|
|
1777
1295
|
<xsl:text>%% listings allows for escape sequences to enable LateX,
</xsl:text>
|
|
1778
1296
|
<xsl:text>%% so we bold the input commands via the following macro
</xsl:text>
|
|
1779
|
-
<xsl:text>\newcommand{\
|
|
1297
|
+
<xsl:text>\newcommand{\ptxconsoleinput}[1]{\textbf{#1}}
</xsl:text>
|
|
1780
1298
|
<!-- https://tex.stackexchange.com/questions/299401/bold-just-one-line-inside-of-lstlisting/299406 -->
|
|
1781
1299
|
<!-- Syntax highlighting is not so great for "language=bash" -->
|
|
1782
1300
|
<!-- Line-breaking off to match old behavior, prebreak option fails inside LaTeX for input -->
|
|
@@ -1861,21 +1379,21 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1861
1379
|
<xsl:text>%% Description lists as tcolorbox sidebyside
</xsl:text>
|
|
1862
1380
|
<xsl:text>%% "dli" short for "description list item"
</xsl:text>
|
|
1863
1381
|
<!-- title widths, gaps, from David Farmer, ~2021-09-15, pretext-support, "inline titles" -->
|
|
1864
|
-
<xsl:text>\newlength{\
|
|
1865
|
-
<xsl:text>\newlength{\
|
|
1866
|
-
<xsl:text>\newlength{\
|
|
1867
|
-
<xsl:text>\newlength{\
|
|
1382
|
+
<xsl:text>\newlength{\ptxdlititlewidth}
</xsl:text>
|
|
1383
|
+
<xsl:text>\newlength{\ptxdlimaxnarrowtitle}\setlength{\ptxdlimaxnarrowtitle}{11ex}
</xsl:text>
|
|
1384
|
+
<xsl:text>\newlength{\ptxdlimaxmediumtitle}\setlength{\ptxdlimaxmediumtitle}{18ex}
</xsl:text>
|
|
1385
|
+
<xsl:text>\newlength{\ptxdlimaxwidetitle}\setlength{\ptxdlimaxwidetitle}{25ex}
</xsl:text>
|
|
1868
1386
|
<!-- "top seam" alignment works better for titles that are display math -->
|
|
1869
1387
|
<!-- halign applies only to "upper", which is "right" in sidebyside -->
|
|
1870
|
-
<xsl:text>\tcbset{ dlistyle/.style={sidebyside, sidebyside align=top seam, lower separated=false, bwminimalstyle, bottomtitle=0.75ex, after skip=1.5ex, boxsep=0pt, left=0pt, right=0pt, top=0pt, bottom=0pt, before lower app={\
|
|
1871
|
-
<xsl:text>\tcbset{ dlinarrowstyle/.style={dlistyle, lefthand width=\
|
|
1872
|
-
<xsl:text>\tcbset{ dlimediumstyle/.style={dlistyle, lefthand width=\
|
|
1873
|
-
<xsl:text>\tcbset{ dliwidestyle/.style={dlistyle, lefthand width=\
|
|
1388
|
+
<xsl:text>\tcbset{ dlistyle/.style={sidebyside, sidebyside align=top seam, lower separated=false, bwminimalstyle, bottomtitle=0.75ex, after skip=1.5ex, boxsep=0pt, left=0pt, right=0pt, top=0pt, bottom=0pt, before lower app={\ptxsetparstyle\noindent}} }
</xsl:text>
|
|
1389
|
+
<xsl:text>\tcbset{ dlinarrowstyle/.style={dlistyle, lefthand width=\ptxdlimaxnarrowtitle, sidebyside gap=1ex, halign=flush left, righttitle=10ex} }
</xsl:text>
|
|
1390
|
+
<xsl:text>\tcbset{ dlimediumstyle/.style={dlistyle, lefthand width=\ptxdlimaxmediumtitle, sidebyside gap=4ex, halign=flush right} }
</xsl:text>
|
|
1391
|
+
<xsl:text>\tcbset{ dliwidestyle/.style={dlistyle, lefthand width=\ptxdlimaxwidetitle, sidebyside gap=4ex, halign=flush right} }
</xsl:text>
|
|
1874
1392
|
<xsl:text>\NewDocumentEnvironment{descriptionlist}{}{\par\vspace*{1.5ex}}{\par\vspace*{1.5ex}}%
</xsl:text>
|
|
1875
1393
|
<xsl:text>%% begin enviroment has an if/then to open the tcolorbox
</xsl:text>
|
|
1876
1394
|
<xsl:text>\NewDocumentEnvironment{dlinarrow}{mm}{%
</xsl:text>
|
|
1877
|
-
<xsl:text>\settowidth{\
|
|
1878
|
-
<xsl:text>\ifthenelse{\
|
|
1395
|
+
<xsl:text>\settowidth{\ptxdlititlewidth}{{\textbf{#1}}}%
</xsl:text>
|
|
1396
|
+
<xsl:text>\ifthenelse{\ptxdlititlewidth > \ptxdlimaxnarrowtitle}%
</xsl:text>
|
|
1879
1397
|
<xsl:text>{\begin{tcolorbox}[title={\textbf{#1}}, phantom={\hypertarget{#2}{}}, dlinarrowstyle]\tcblower}%
</xsl:text>
|
|
1880
1398
|
<xsl:text>{\begin{tcolorbox}[dlinarrowstyle, phantom={\hypertarget{#2}{}}]\textbf{#1}\tcblower}%
</xsl:text>
|
|
1881
1399
|
<xsl:text>}%
</xsl:text>
|
|
@@ -1892,10 +1410,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1892
1410
|
<xsl:if test="$document-root//exercisegroup">
|
|
1893
1411
|
<xsl:text>%% Indented groups of "exercise" within an "exercises" division
</xsl:text>
|
|
1894
1412
|
<xsl:text>%% Lengths control the indentation (always) and gaps (multi-column)
</xsl:text>
|
|
1895
|
-
<xsl:text>\newlength{\
|
|
1413
|
+
<xsl:text>\newlength{\ptxegindent}\setlength{\ptxegindent}{</xsl:text>
|
|
1896
1414
|
<xsl:value-of select="$exercisegroup-indentation"/>
|
|
1897
1415
|
<xsl:text>\linewidth}
</xsl:text>
|
|
1898
|
-
<xsl:text>\newlength{\
|
|
1416
|
+
<xsl:text>\newlength{\ptxexggap}\setlength{\ptxexggap}{0.05\linewidth}
</xsl:text>
|
|
1899
1417
|
<xsl:if test="$document-root//exercisegroup[not(@cols)]">
|
|
1900
1418
|
<xsl:text>%% Thin "xparse" environments will represent the entire exercise
</xsl:text>
|
|
1901
1419
|
<xsl:text>%% group, in the case when it does not hold multiple columns.
</xsl:text>
|
|
@@ -1914,7 +1432,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
1914
1432
|
<!-- raster equal height: boxes of same *row* have same height -->
|
|
1915
1433
|
<!-- raster left skip: indentation of all exercises -->
|
|
1916
1434
|
<!-- raster columns: controls layout, so no line separators, etc. -->
|
|
1917
|
-
<xsl:text>\tcbset{ exgroupcolstyle/.style={raster equal height=rows, raster left skip=\
|
|
1435
|
+
<xsl:text>\tcbset{ exgroupcolstyle/.style={raster equal height=rows, raster left skip=\ptxegindent, raster column skip=\ptxexggap} }
</xsl:text>
|
|
1918
1436
|
<xsl:text>\NewDocumentEnvironment{exercisegroupcol}{m}
</xsl:text>
|
|
1919
1437
|
<xsl:text>{\begin{tcbraster}[exgroupcolstyle,raster columns=#1]}{\end{tcbraster}}
</xsl:text>
|
|
1920
1438
|
</xsl:if>
|
|
@@ -2498,7 +2016,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2498
2016
|
<!-- "frame empty" is needed to counteract very faint outlines in some PDF viewers -->
|
|
2499
2017
|
<!-- framecol=white is inadvisable, "frame hidden" is ineffective for default skin -->
|
|
2500
2018
|
<xsl:text>\tcbset{ sbsstyle/.style={raster before skip=2.0ex, raster equal height=rows, raster force size=false, raster after skip=0.7\baselineskip} }
</xsl:text>
|
|
2501
|
-
<xsl:text>\tcbset{ sbspanelstyle/.style={bwminimalstyle, fonttitle=\blocktitlefont, before upper app={\
|
|
2019
|
+
<xsl:text>\tcbset{ sbspanelstyle/.style={bwminimalstyle, fonttitle=\blocktitlefont, before upper app={\ptxsetparstyle}} }
</xsl:text>
|
|
2502
2020
|
</xsl:otherwise>
|
|
2503
2021
|
</xsl:choose>
|
|
2504
2022
|
<xsl:text>%% Enviroments for side-by-side and components
</xsl:text>
|
|
@@ -2533,7 +2051,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2533
2051
|
<!-- https://tex.stackexchange.com/questions/96300/how-to-change-the-style-of-menukeys -->
|
|
2534
2052
|
<xsl:text>\renewmenumacro{\keys}{shadowedroundedkeys}
</xsl:text>
|
|
2535
2053
|
<!-- Seemingly extra braces protect comma that kbdkeys package uses -->
|
|
2536
|
-
<xsl:text>\newcommand{\
|
|
2054
|
+
<xsl:text>\newcommand{\ptxkbd}[1]{\keys{{#1}}}
</xsl:text>
|
|
2537
2055
|
</xsl:if>
|
|
2538
2056
|
</xsl:template>
|
|
2539
2057
|
|
|
@@ -2600,47 +2118,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2600
2118
|
</xsl:if>
|
|
2601
2119
|
<xsl:if test="$document-root//contributors">
|
|
2602
2120
|
<xsl:text>%% Semantic macros for contributor list
</xsl:text>
|
|
2603
|
-
<xsl:text>\newcommand{\
|
|
2604
|
-
<xsl:text>\newcommand{\
|
|
2605
|
-
<xsl:text>\newcommand{\
|
|
2121
|
+
<xsl:text>\newcommand{\ptxcontributor}[1]{\parbox{\linewidth}{#1}\par\bigskip}
</xsl:text>
|
|
2122
|
+
<xsl:text>\newcommand{\ptxcontributorname}[1]{\textsc{#1}\\[0.25\baselineskip]}
</xsl:text>
|
|
2123
|
+
<xsl:text>\newcommand{\ptxcontributorinfo}[1]{\hspace*{0.05\linewidth}\parbox{0.95\linewidth}{\textsl{#1}}}
</xsl:text>
|
|
2606
2124
|
</xsl:if>
|
|
2607
2125
|
</xsl:template>
|
|
2608
2126
|
|
|
2609
2127
|
<!-- End of Preamble Templates -->
|
|
2610
2128
|
|
|
2611
2129
|
|
|
2612
|
-
<!-- Text Alignment, Right and Bottom -->
|
|
2613
|
-
<!-- \RaggedRight is from the "ragged2e" package, and -->
|
|
2614
|
-
<!-- will allow for some hypenation (vs. \raggedright) -->
|
|
2615
|
-
<!-- Bottom varies by oneside/twoside, and by -->
|
|
2616
|
-
<!-- book/article, so we just make it explicit no -->
|
|
2617
|
-
<!-- matter what (breaking that dichotomy) -->
|
|
2618
|
-
<!-- See: https://www.sascha-frank.com/page-break.html -->
|
|
2619
|
-
<!-- N.B. Perhaps this template should be used in the -->
|
|
2620
|
-
<!-- LaTeX preamble, perhaps with \AtBeginDocument{} -->
|
|
2621
|
-
<!-- https://tex.stackexchange.com/questions/33913/ -->
|
|
2622
|
-
<!-- global-ragged-right-justification-of-report -->
|
|
2623
|
-
<xsl:template name="text-alignment">
|
|
2624
|
-
<!-- horizontal/right first -->
|
|
2625
|
-
<xsl:choose>
|
|
2626
|
-
<xsl:when test="$latex-right-alignment = 'ragged'">
|
|
2627
|
-
<xsl:text>\RaggedRight
</xsl:text>
|
|
2628
|
-
</xsl:when>
|
|
2629
|
-
<!-- Flush right is default LaTeX -->
|
|
2630
|
-
<xsl:when test="$latex-right-alignment = 'flush'"/>
|
|
2631
|
-
</xsl:choose>
|
|
2632
|
-
<!-- vertical/bottom -->
|
|
2633
|
-
<xsl:text>%% bottom alignment is explicit, since it normally depends on oneside, twoside
</xsl:text>
|
|
2634
|
-
<xsl:choose>
|
|
2635
|
-
<xsl:when test="$latex-bottom-alignment = 'ragged'">
|
|
2636
|
-
<xsl:text>\raggedbottom
</xsl:text>
|
|
2637
|
-
</xsl:when>
|
|
2638
|
-
<xsl:when test="$latex-bottom-alignment = 'flush'">
|
|
2639
|
-
<xsl:text>\flushbottom
</xsl:text>
|
|
2640
|
-
</xsl:when>
|
|
2641
|
-
</xsl:choose>
|
|
2642
|
-
</xsl:template>
|
|
2643
|
-
|
|
2644
2130
|
<!-- Sidedness -->
|
|
2645
2131
|
<!-- \documentclass option, no comma -->
|
|
2646
2132
|
<xsl:template name="sidedness">
|
|
@@ -2654,63 +2140,33 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2654
2140
|
</xsl:choose>
|
|
2655
2141
|
</xsl:template>
|
|
2656
2142
|
|
|
2657
|
-
<!-- For a "book" place *before* \frontmatter so -->
|
|
2658
|
-
<!-- as to not disrupt Roman numeral numbering -->
|
|
2659
|
-
<xsl:template name="front-cover">
|
|
2660
|
-
<xsl:if test="$b-has-latex-front-cover">
|
|
2661
|
-
<xsl:text>%% Cover image, not numbered
</xsl:text>
|
|
2662
|
-
<xsl:text>\setcounter{page}{0}%
</xsl:text>
|
|
2663
|
-
<xsl:text>\includepdf[noautoscale=false]{</xsl:text>
|
|
2664
|
-
<xsl:value-of select="$latex-front-cover-filename"/>
|
|
2665
|
-
<xsl:text>}%
</xsl:text>
|
|
2666
|
-
<xsl:if test="$latex-sides= 'two'">
|
|
2667
|
-
<xsl:text>%% Blank obverse for 2-sided version
</xsl:text>
|
|
2668
|
-
<xsl:text>\thispagestyle{empty}\hbox{}\setcounter{page}{0}\cleardoublepage%
</xsl:text>
|
|
2669
|
-
</xsl:if>
|
|
2670
|
-
</xsl:if>
|
|
2671
|
-
</xsl:template>
|
|
2672
|
-
|
|
2673
|
-
<xsl:template name="back-cover">
|
|
2674
|
-
<xsl:if test="$b-has-latex-back-cover">
|
|
2675
|
-
<xsl:text>%% Back cover image, not numbered
</xsl:text>
|
|
2676
|
-
<xsl:text>\cleardoublepage%
</xsl:text>
|
|
2677
|
-
<xsl:if test="$latex-sides= 'two'">
|
|
2678
|
-
<xsl:text>%% 2-sided, and at end of even page, so add odd page
</xsl:text>
|
|
2679
|
-
<xsl:text>\thispagestyle{empty}\hbox{}\newpage%
</xsl:text>
|
|
2680
|
-
</xsl:if>
|
|
2681
|
-
<xsl:text>\includepdf[noautoscale=false]{</xsl:text>
|
|
2682
|
-
<xsl:value-of select="$latex-back-cover-filename"/>
|
|
2683
|
-
<xsl:text>}%
</xsl:text>
|
|
2684
|
-
</xsl:if>
|
|
2685
|
-
</xsl:template>
|
|
2686
|
-
|
|
2687
2143
|
<!-- Fill-in-the-blank in text content -->
|
|
2688
2144
|
<xsl:template name="fillin-text">
|
|
2689
2145
|
<xsl:text>%% Used for fillin answer blank in text
</xsl:text>
|
|
2690
2146
|
<xsl:text>%% Relies on calc package, loaded via tcolorbox
</xsl:text>
|
|
2691
2147
|
<xsl:text>%% Argument is intended number of characters of blank
</xsl:text>
|
|
2692
2148
|
<xsl:text>%% Length may compress for output to fit in one line
</xsl:text>
|
|
2693
|
-
<xsl:text>\newlength{\
|
|
2694
|
-
<xsl:text>\newlength{\
|
|
2695
|
-
<xsl:text>\newlength{\
|
|
2696
|
-
<xsl:text>\newlength{\
|
|
2697
|
-
<xsl:text>\newlength{\
|
|
2149
|
+
<xsl:text>\newlength{\ptxfillinmaxwidth}
</xsl:text>
|
|
2150
|
+
<xsl:text>\newlength{\ptxfillincontract}
</xsl:text>
|
|
2151
|
+
<xsl:text>\newlength{\ptxcharmaxwidth}\setlength{\ptxcharmaxwidth}{0.5em}
</xsl:text>
|
|
2152
|
+
<xsl:text>\newlength{\ptxcharminwidth}\setlength{\ptxcharminwidth}{0.1em}
</xsl:text>
|
|
2153
|
+
<xsl:text>\newlength{\ptxfillinheight}
</xsl:text>
|
|
2698
2154
|
<xsl:if test="$fillin-text-style = 'shade'">
|
|
2699
2155
|
<xsl:text>\definecolor{fillintextshade}{gray}{0.9}</xsl:text>
|
|
2700
2156
|
</xsl:if>
|
|
2701
|
-
<xsl:text>\newcommand{\
|
|
2702
|
-
<xsl:text>\setlength{\
|
|
2703
|
-
<xsl:text>\setlength{\
|
|
2704
|
-
<xsl:text>\setlength{\
|
|
2157
|
+
<xsl:text>\newcommand{\ptxfillintext}[1]{%
</xsl:text>
|
|
2158
|
+
<xsl:text>\setlength{\ptxfillinmaxwidth}{#1\ptxcharmaxwidth}%
</xsl:text>
|
|
2159
|
+
<xsl:text>\setlength{\ptxfillincontract}{#1\ptxcharminwidth}%
</xsl:text>
|
|
2160
|
+
<xsl:text>\setlength{\ptxfillinheight}{\baselineskip}\addtolength{\ptxfillinheight}{1.2pt}%
</xsl:text>
|
|
2705
2161
|
<xsl:choose>
|
|
2706
2162
|
<xsl:when test="$fillin-text-style = 'underline'">
|
|
2707
|
-
<xsl:text>\strut\nobreak\leaders\vbox{\hrule width 0.3pt height 0.3pt \vskip -1.2pt}\hskip 1\
|
|
2163
|
+
<xsl:text>\strut\nobreak\leaders\vbox{\hrule width 0.3pt height 0.3pt \vskip -1.2pt}\hskip 1\ptxfillinmaxwidth minus \ptxfillincontract\nobreak\strut%
</xsl:text>
|
|
2708
2164
|
</xsl:when>
|
|
2709
2165
|
<xsl:when test="$fillin-text-style = 'box'">
|
|
2710
|
-
<xsl:text>\rule[-1.2pt]{0.3pt}{\heightof{\strut}+1.8pt}\nobreak\hspace{-0.3pt}\nobreak\leaders\vbox{\hrule width 0.3pt height 0.3pt \vskip \
|
|
2166
|
+
<xsl:text>\rule[-1.2pt]{0.3pt}{\heightof{\strut}+1.8pt}\nobreak\hspace{-0.3pt}\nobreak\leaders\vbox{\hrule width 0.3pt height 0.3pt \vskip \ptxfillinheight \hrule width 0.3pt height 0.3pt \vskip -1.2pt}\hskip 1\ptxfillinmaxwidth minus \ptxfillincontract\nobreak\hspace{-0.3pt}\rule[-1.2pt]{0.3pt}{\heightof{\strut}+1.8pt}%
</xsl:text>
|
|
2711
2167
|
</xsl:when>
|
|
2712
2168
|
<xsl:when test="$fillin-text-style = 'shade'">
|
|
2713
|
-
<xsl:text>{\color{fillintextshade}\strut\nobreak\leaders\vbox{\hrule width 0.3pt height \
|
|
2169
|
+
<xsl:text>{\color{fillintextshade}\strut\nobreak\leaders\vbox{\hrule width 0.3pt height \ptxfillinheight \vskip -1.2pt}\hskip 1\ptxfillinmaxwidth minus \ptxfillincontract}%
</xsl:text>
|
|
2714
2170
|
</xsl:when>
|
|
2715
2171
|
</xsl:choose>
|
|
2716
2172
|
<xsl:text>}
</xsl:text>
|
|
@@ -2722,7 +2178,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2722
2178
|
<xsl:apply-templates select="." mode="sanitize-workspace"/>
|
|
2723
2179
|
</xsl:variable>
|
|
2724
2180
|
<xsl:if test="not($vertical-space = '')">
|
|
2725
|
-
<xsl:text>\par\rule{\
|
|
2181
|
+
<xsl:text>\par\rule{\ptxworkspacestrutwidth}{</xsl:text>
|
|
2726
2182
|
<xsl:value-of select="$vertical-space"/>
|
|
2727
2183
|
<xsl:text>}%
</xsl:text>
|
|
2728
2184
|
</xsl:if>
|
|
@@ -2751,7 +2207,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2751
2207
|
|
|
2752
2208
|
<!-- Abbreviations, Acronyms, Initialisms, -->
|
|
2753
2209
|
<!-- "abbr", "acro", "init" -->
|
|
2754
|
-
<!-- Body: \
|
|
2210
|
+
<!-- Body: \ptxabbreviation{ABC} -->
|
|
2755
2211
|
<!-- Titles: \abbreviationuntitle{ABC} -->
|
|
2756
2212
|
<!-- PDF navigation panels has titles as simple strings, -->
|
|
2757
2213
|
<!-- devoid of any formatting, so we just give up, as any -->
|
|
@@ -2761,7 +2217,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2761
2217
|
<!-- Obstacle is that sc shape does not come in bold, -->
|
|
2762
2218
|
<!-- http://tex.stackexchange.com/questions/17830/using-textsc-within-section -->
|
|
2763
2219
|
<xsl:template match="abbr" mode="tex-macro">
|
|
2764
|
-
<xsl:text>\newcommand{\
|
|
2220
|
+
<xsl:text>\newcommand{\ptxabbreviation}[1]{</xsl:text>
|
|
2765
2221
|
<xsl:text>%% Used to markup abbreviations, text or titles
</xsl:text>
|
|
2766
2222
|
<xsl:apply-templates select="." mode="tex-macro-style"/>
|
|
2767
2223
|
<xsl:text>}
</xsl:text>
|
|
@@ -2769,14 +2225,14 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2769
2225
|
</xsl:template>
|
|
2770
2226
|
<xsl:template match="acro" mode="tex-macro">
|
|
2771
2227
|
<xsl:text>%% Used to markup acronyms, text or titles
</xsl:text>
|
|
2772
|
-
<xsl:text>\newcommand{\
|
|
2228
|
+
<xsl:text>\newcommand{\ptxacronym}[1]{</xsl:text>
|
|
2773
2229
|
<xsl:apply-templates select="." mode="tex-macro-style"/>
|
|
2774
2230
|
<xsl:text>}
</xsl:text>
|
|
2775
2231
|
<xsl:text>\DeclareRobustCommand{\acronymintitle}[1]{\texorpdfstring{#1}{#1}}
</xsl:text>
|
|
2776
2232
|
</xsl:template>
|
|
2777
2233
|
<xsl:template match="init" mode="tex-macro">
|
|
2778
2234
|
<xsl:text>%% Used to markup initialisms, text or titles
</xsl:text>
|
|
2779
|
-
<xsl:text>\newcommand{\
|
|
2235
|
+
<xsl:text>\newcommand{\ptxinitialism}[1]{</xsl:text>
|
|
2780
2236
|
<xsl:apply-templates select="." mode="tex-macro-style"/>
|
|
2781
2237
|
<xsl:text>}
</xsl:text>
|
|
2782
2238
|
<xsl:text>\DeclareRobustCommand{\initialismintitle}[1]{\texorpdfstring{#1}{#1}}
</xsl:text>
|
|
@@ -2796,7 +2252,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2796
2252
|
<!-- reasonably expected toto be organized as -->
|
|
2797
2253
|
<!-- paragraphs we add to the style: -->
|
|
2798
2254
|
<!-- -->
|
|
2799
|
-
<!-- before upper app={\
|
|
2255
|
+
<!-- before upper app={\ptxsetparstyle} -->
|
|
2800
2256
|
<!-- -->
|
|
2801
2257
|
<!-- which *appends* to the "before upper" code -->
|
|
2802
2258
|
<!-- and requires the tcolorbox "hooks" library. -->
|
|
@@ -2906,7 +2362,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
2906
2362
|
</xsl:template>
|
|
2907
2363
|
|
|
2908
2364
|
<xsl:template match="*" mode="division-environment-name">
|
|
2909
|
-
<xsl:message>
|
|
2365
|
+
<xsl:message>PTX:BUG: an element ("<xsl:value-of select="local-name(.)"/>") lacks a LaTeX division environment name</xsl:message>
|
|
2910
2366
|
</xsl:template>
|
|
2911
2367
|
|
|
2912
2368
|
<!-- Possibly numberless? When employed, we can tell if a specialized -->
|
|
@@ -3018,7 +2474,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3018
2474
|
</xsl:if>
|
|
3019
2475
|
<xsl:text>\hypertarget{#3}{}}, breakable, after={\par}, </xsl:text>
|
|
3020
2476
|
<xsl:value-of select="$proof-name"/>
|
|
3021
|
-
<xsl:text>style, before upper app={\
|
|
2477
|
+
<xsl:text>style, before upper app={\ptxsetparstyle} }
</xsl:text>
|
|
3022
2478
|
</xsl:template>
|
|
3023
2479
|
|
|
3024
2480
|
<!-- PROOF-LIKE (solutions, minor) -->
|
|
@@ -3058,7 +2514,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3058
2514
|
<xsl:text>\tcbset{ objectivesstyle/.style={</xsl:text>
|
|
3059
2515
|
<xsl:apply-templates select="." mode="tcb-style" />
|
|
3060
2516
|
<xsl:text>} }
</xsl:text>
|
|
3061
|
-
<xsl:text>\newtcolorbox{objectives}[2]{title={#1}, phantomlabel={#2}, breakable, objectivesstyle, before upper app={\
|
|
2517
|
+
<xsl:text>\newtcolorbox{objectives}[2]{title={#1}, phantomlabel={#2}, breakable, objectivesstyle, before upper app={\ptxsetparstyle}}
</xsl:text>
|
|
3062
2518
|
</xsl:template>
|
|
3063
2519
|
|
|
3064
2520
|
<!-- "outcomes" -->
|
|
@@ -3069,7 +2525,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3069
2525
|
<xsl:text>\tcbset{ outcomesstyle/.style={</xsl:text>
|
|
3070
2526
|
<xsl:apply-templates select="." mode="tcb-style" />
|
|
3071
2527
|
<xsl:text>} }
</xsl:text>
|
|
3072
|
-
<xsl:text>\newtcolorbox{outcomes}[2]{title={#1}, phantomlabel={#2}, breakable, outcomesstyle, before upper app={\
|
|
2528
|
+
<xsl:text>\newtcolorbox{outcomes}[2]{title={#1}, phantomlabel={#2}, breakable, outcomesstyle, before upper app={\ptxsetparstyle}}
</xsl:text>
|
|
3073
2529
|
</xsl:template>
|
|
3074
2530
|
|
|
3075
2531
|
<!-- back "colophon" -->
|
|
@@ -3083,7 +2539,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3083
2539
|
<xsl:if test="$b-pageref">
|
|
3084
2540
|
<xsl:text>\label{#2}</xsl:text>
|
|
3085
2541
|
</xsl:if>
|
|
3086
|
-
<xsl:text>\hypertarget{#2}{}}, breakable, backcolophonstyle, before upper app={\
|
|
2542
|
+
<xsl:text>\hypertarget{#2}{}}, breakable, backcolophonstyle, before upper app={\ptxsetparstyle}}
</xsl:text>
|
|
3087
2543
|
</xsl:template>
|
|
3088
2544
|
|
|
3089
2545
|
<!-- "assemblage" -->
|
|
@@ -3106,7 +2562,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3106
2562
|
<xsl:text>}[3]{title={\notblank{#2}{#2}{}}, </xsl:text>
|
|
3107
2563
|
<xsl:text>phantomlabel={#3}, breakable, </xsl:text>
|
|
3108
2564
|
<xsl:value-of select="$environment-name"/>
|
|
3109
|
-
<xsl:text>style, before upper app={\
|
|
2565
|
+
<xsl:text>style, before upper app={\ptxsetparstyle}}
</xsl:text>
|
|
3110
2566
|
</xsl:template>
|
|
3111
2567
|
|
|
3112
2568
|
<!-- "gi" -->
|
|
@@ -3117,7 +2573,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3117
2573
|
<xsl:text>\tcbset{ glossaryitemstyle/.style={</xsl:text>
|
|
3118
2574
|
<xsl:apply-templates select="." mode="tcb-style" />
|
|
3119
2575
|
<xsl:text>} }
</xsl:text>
|
|
3120
|
-
<xsl:text>\newtcolorbox{glossaryitem}[2]{title={#1}, after title={\notblank{#1}{\space}{}}, phantomlabel={#2}, breakable, glossaryitemstyle, before upper app={\
|
|
2576
|
+
<xsl:text>\newtcolorbox{glossaryitem}[2]{title={#1}, after title={\notblank{#1}{\space}{}}, phantomlabel={#2}, breakable, glossaryitemstyle, before upper app={\ptxsetparstyle}}
</xsl:text>
|
|
3121
2577
|
</xsl:template>
|
|
3122
2578
|
|
|
3123
2579
|
<!-- "paragraphs" -->
|
|
@@ -3162,7 +2618,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3162
2618
|
<xsl:text>}[3]{title={\notblank{#2}{#2}{}}, </xsl:text>
|
|
3163
2619
|
<xsl:text>phantomlabel={#3}, breakable, </xsl:text>
|
|
3164
2620
|
<xsl:value-of select="$environment-name"/>
|
|
3165
|
-
<xsl:text>style, before upper app={\
|
|
2621
|
+
<xsl:text>style, before upper app={\ptxsetparstyle}}
</xsl:text>
|
|
3166
2622
|
</xsl:template>
|
|
3167
2623
|
|
|
3168
2624
|
|
|
@@ -3420,7 +2876,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3420
2876
|
<xsl:value-of select="$environment-name"/>
|
|
3421
2877
|
<xsl:text>style, </xsl:text>
|
|
3422
2878
|
<xsl:if test="self::list">
|
|
3423
|
-
<xsl:text>before upper app={\
|
|
2879
|
+
<xsl:text>before upper app={\ptxsetparstyle}, </xsl:text>
|
|
3424
2880
|
</xsl:if>
|
|
3425
2881
|
<xsl:text>}
</xsl:text>
|
|
3426
2882
|
<!-- end: options -->
|
|
@@ -3564,15 +3020,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3564
3020
|
<!-- in that markers are inserted with "after upper" -->
|
|
3565
3021
|
<!-- to indicate the end of the environment. -->
|
|
3566
3022
|
<xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&OPENPROBLEM-LIKE;|&PROJECT-LIKE;|exercise[boolean(&INLINE-EXERCISE-FILTER;)]|&ASIDE-LIKE;" mode="tcb-style">
|
|
3567
|
-
<xsl:text>bwminimalstyle, runintitlestyle, blockspacingstyle, after title={\space}, before upper app={\
|
|
3023
|
+
<xsl:text>bwminimalstyle, runintitlestyle, blockspacingstyle, after title={\space}, before upper app={\ptxsetparstyle}, </xsl:text>
|
|
3568
3024
|
</xsl:template>
|
|
3569
3025
|
|
|
3570
3026
|
<xsl:template match="&DEFINITION-LIKE;" mode="tcb-style">
|
|
3571
|
-
<xsl:text>bwminimalstyle, runintitlestyle, blockspacingstyle, after title={\space}, after upper={\space\space\hspace*{\stretch{1}}\ptxdiamond}, before upper app={\
|
|
3027
|
+
<xsl:text>bwminimalstyle, runintitlestyle, blockspacingstyle, after title={\space}, after upper={\space\space\hspace*{\stretch{1}}\ptxdiamond}, before upper app={\ptxsetparstyle}, </xsl:text>
|
|
3572
3028
|
</xsl:template>
|
|
3573
3029
|
|
|
3574
3030
|
<xsl:template match="&EXAMPLE-LIKE;" mode="tcb-style">
|
|
3575
|
-
<xsl:text>bwminimalstyle, runintitlestyle, blockspacingstyle, after title={\space}, after upper={\space\space\hspace*{\stretch{1}}\ptxtriangle}, before upper app={\
|
|
3031
|
+
<xsl:text>bwminimalstyle, runintitlestyle, blockspacingstyle, after title={\space}, after upper={\space\space\hspace*{\stretch{1}}\ptxtriangle}, before upper app={\ptxsetparstyle}, </xsl:text>
|
|
3576
3032
|
</xsl:template>
|
|
3577
3033
|
|
|
3578
3034
|
<!-- FIGURE-LIKE: -->
|
|
@@ -3634,35 +3090,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3634
3090
|
<!-- It is convenient for development, testing, and convenience -->
|
|
3635
3091
|
<xsl:template match="*" mode="tcb-style" />
|
|
3636
3092
|
|
|
3637
|
-
<!-- ################### -->
|
|
3638
|
-
<!-- Titles of Divisions -->
|
|
3639
|
-
<!-- ################### -->
|
|
3640
|
-
|
|
3641
|
-
<!-- Section 9.2 of the "titlesec" package has default parameters -->
|
|
3642
|
-
<!-- which mimic LaTeX style and spacing. We use those here, so -->
|
|
3643
|
-
<!-- we can integrate an author credit into the heading/title -->
|
|
3644
|
-
<!-- before any spacing happens. Authors are one fontsize smaller, -->
|
|
3645
|
-
<!-- and placed in the optional "after-code" argument. -->
|
|
3646
|
-
<!-- We provide variants for the "numberless" case, which are only -->
|
|
3647
|
-
<!-- primarily necessary for chapter-level items (eg "preface"), -->
|
|
3648
|
-
<!-- but might also occur due to one-count specialized divisions, -->
|
|
3649
|
-
<!-- present in "unstructured" divisions. "chapter" has a "display" -->
|
|
3650
|
-
<!-- format, to mimic the LaTeX two-line look, even for multiline -->
|
|
3651
|
-
<!-- titles. For finer divisions, when numbered, we use a "hang" -->
|
|
3652
|
-
<!-- format, so any extra lines begin aligned with the first line -->
|
|
3653
|
-
<!-- (whether they are authored-too long and then wtap, or if -->
|
|
3654
|
-
<!-- structured with a "line" element and so earning dedicated "\\" -->
|
|
3655
|
-
<!-- automatically. For "numberless" variants the "block" shape -->
|
|
3656
|
-
<!-- seems sufficient as there is no label. If more elaborate -->
|
|
3657
|
-
<!-- styling is employed, it may be necessary to put titles into -->
|
|
3658
|
-
<!-- "minipage" environments, or other LaTex boxes -->
|
|
3659
|
-
<!-- NB: since have elected to use the "explicit" package option -->
|
|
3660
|
-
<!-- of titlesec, we need to *explicity* place a parameter #1. -->
|
|
3661
|
-
<!-- This will allow maximum flexibility for style writers. -->
|
|
3662
|
-
<!-- Simple use (as here) will be as the last thing in the -->
|
|
3663
|
-
<!-- "before-code" argument. -->
|
|
3664
|
-
<!-- TODO: integrate "epigraph" package perhaps -->
|
|
3665
|
-
|
|
3666
3093
|
<!-- Pretty much everything for actually manipulating titles -->
|
|
3667
3094
|
<!-- happens in the -common template. But when structured by -->
|
|
3668
3095
|
<!-- "line" we need to implement an abstract variable with a -->
|
|
@@ -3670,201 +3097,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
3670
3097
|
<!-- NB: \\ works better than \newline in a \centering -->
|
|
3671
3098
|
<xsl:variable name="title-separator" select="'\\'"/>
|
|
3672
3099
|
|
|
3673
|
-
<!-- This is adapted from the chapter format, and -->
|
|
3674
|
-
<!-- could be simpler than desired, specifically -->
|
|
3675
|
-
<!-- * no "number-less" version -->
|
|
3676
|
-
<!-- * no \titlespacing needed for full page -->
|
|
3677
|
-
<!-- * author placement is untested -->
|
|
3678
|
-
<!-- * otherwise, jut a bit grander, and centered -->
|
|
3679
|
-
<!-- There must be a \titleformat{\part} to get -->
|
|
3680
|
-
<!-- consistent entries in the ToC files -->
|
|
3681
|
-
<xsl:template name="titlesec-part-style">
|
|
3682
|
-
<xsl:text>\titleformat{\part}[display]
</xsl:text>
|
|
3683
|
-
<xsl:text>{\divisionfont\Huge\bfseries\centering}{\divisionnameptx\space\thepart}{30pt}{\Huge#1}
</xsl:text>
|
|
3684
|
-
<xsl:text>[{\Large\centering\authorsptx}]
</xsl:text>
|
|
3685
|
-
</xsl:template>
|
|
3686
|
-
|
|
3687
|
-
<!-- Note the use of "\divisionnameptx" macro -->
|
|
3688
|
-
<!-- A multiline title should be fine in a "display" shape -->
|
|
3689
|
-
<xsl:template name="titlesec-chapter-style">
|
|
3690
|
-
<xsl:text>\titleformat{\chapter}[display]
</xsl:text>
|
|
3691
|
-
<xsl:text>{\divisionfont\huge\bfseries}{\divisionnameptx\space\thechapter}{20pt}{\Huge#1}
</xsl:text>
|
|
3692
|
-
<xsl:text>[{\Large\authorsptx}]
</xsl:text>
|
|
3693
|
-
<xsl:text>\titleformat{name=\chapter,numberless}[display]
</xsl:text>
|
|
3694
|
-
<xsl:text>{\divisionfont\huge\bfseries}{}{0pt}{#1}
</xsl:text>
|
|
3695
|
-
<xsl:text>[{\Large\authorsptx}]
</xsl:text>
|
|
3696
|
-
<xsl:text>\titlespacing*{\chapter}{0pt}{50pt}{40pt}
</xsl:text>
|
|
3697
|
-
</xsl:template>
|
|
3698
|
-
|
|
3699
|
-
<!-- Refences, and especially Index, are unnumbered -->
|
|
3700
|
-
<!-- section-level items in the back matter -->
|
|
3701
|
-
<xsl:template name="titlesec-section-style">
|
|
3702
|
-
<xsl:text>\titleformat{\section}[hang]
</xsl:text>
|
|
3703
|
-
<xsl:text>{\divisionfont\Large\bfseries}{\thesection}{1ex}{#1}
</xsl:text>
|
|
3704
|
-
<xsl:text>[{\large\authorsptx}]
</xsl:text>
|
|
3705
|
-
<xsl:text>\titleformat{name=\section,numberless}[block]
</xsl:text>
|
|
3706
|
-
<xsl:text>{\divisionfont\Large\bfseries}{}{0pt}{#1}
</xsl:text>
|
|
3707
|
-
<xsl:text>[{\large\authorsptx}]
</xsl:text>
|
|
3708
|
-
<xsl:text>\titlespacing*{\section}{0pt}{3.5ex plus 1ex minus .2ex}{2.3ex plus .2ex}
</xsl:text>
|
|
3709
|
-
</xsl:template>
|
|
3710
|
-
|
|
3711
|
-
<xsl:template name="titlesec-subsection-style">
|
|
3712
|
-
<xsl:text>\titleformat{\subsection}[hang]
</xsl:text>
|
|
3713
|
-
<xsl:text>{\divisionfont\large\bfseries}{\thesubsection}{1ex}{#1}
</xsl:text>
|
|
3714
|
-
<xsl:text>[{\normalsize\authorsptx}]
</xsl:text>
|
|
3715
|
-
<xsl:text>\titleformat{name=\subsection,numberless}[block]
</xsl:text>
|
|
3716
|
-
<xsl:text>{\divisionfont\large\bfseries}{}{0pt}{#1}
</xsl:text>
|
|
3717
|
-
<xsl:text>[{\normalsize\authorsptx}]
</xsl:text>
|
|
3718
|
-
<xsl:text>\titlespacing*{\subsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
</xsl:text>
|
|
3719
|
-
</xsl:template>
|
|
3720
|
-
|
|
3721
|
-
<xsl:template name="titlesec-subsubsection-style">
|
|
3722
|
-
<xsl:text>\titleformat{\subsubsection}[hang]
</xsl:text>
|
|
3723
|
-
<xsl:text>{\divisionfont\normalsize\bfseries}{\thesubsubsection}{1em}{#1}
</xsl:text>
|
|
3724
|
-
<xsl:text>[{\small\authorsptx}]
</xsl:text>
|
|
3725
|
-
<xsl:text>\titleformat{name=\subsubsection,numberless}[block]
</xsl:text>
|
|
3726
|
-
<xsl:text>{\divisionfont\normalsize\bfseries}{}{0pt}{#1}
</xsl:text>
|
|
3727
|
-
<xsl:text>[{\normalsize\authorsptx}]
</xsl:text>
|
|
3728
|
-
<xsl:text>\titlespacing*{\subsubsection}{0pt}{3.25ex plus 1ex minus .2ex}{1.5ex plus .2ex}
</xsl:text>
|
|
3729
|
-
</xsl:template>
|
|
3730
|
-
|
|
3731
|
-
<!-- We stick with LaTeX names for the hierarchy, so "paragraph" is next. -->
|
|
3732
|
-
<!-- This will be used for single (hence numberless only) specialized -->
|
|
3733
|
-
<!-- divisions (e.g. "exercises") contained within a PTX subsubsection. -->
|
|
3734
|
-
<xsl:template name="titlesec-paragraph-style">
|
|
3735
|
-
<xsl:text>\titleformat{\paragraph}[hang]
</xsl:text>
|
|
3736
|
-
<xsl:text>{\divisionfont\normalsize\bfseries}{\theparagraph}{1em}{#1}
</xsl:text>
|
|
3737
|
-
<xsl:text>[{\small\authorsptx}]
</xsl:text>
|
|
3738
|
-
<xsl:text>\titleformat{name=\paragraph,numberless}[block]
</xsl:text>
|
|
3739
|
-
<xsl:text>{\divisionfont\normalsize\bfseries}{}{0pt}{#1}
</xsl:text>
|
|
3740
|
-
<xsl:text>[{\normalsize\authorsptx}]
</xsl:text>
|
|
3741
|
-
<xsl:text>\titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{1.5em}
</xsl:text>
|
|
3742
|
-
</xsl:template>
|
|
3743
|
-
|
|
3744
|
-
<!-- ################# -->
|
|
3745
|
-
<!-- Table of Contents -->
|
|
3746
|
-
<!-- ################# -->
|
|
3747
|
-
|
|
3748
|
-
<!-- Like division headings, the entries of the Table of -->
|
|
3749
|
-
<!-- Contents can be styled on a per-division basis -->
|
|
3750
|
-
|
|
3751
|
-
<!-- As normally written into LaTeX's *.toc file, the Roman -->
|
|
3752
|
-
<!-- number/label is tightly bound to the title and so it -->
|
|
3753
|
-
<!-- would be the "number-less" argument in control. Instead, -->
|
|
3754
|
-
<!-- we load the titlesec package with the "newparttoc" -->
|
|
3755
|
-
<!-- option and get ToC entries that use LaTeX's "\numberline" -->
|
|
3756
|
-
<!-- macro, and so look to titlesec as numbered divisions. -->
|
|
3757
|
-
<!-- Hence the formatting here is the numbered argument. -->
|
|
3758
|
-
<!-- -->
|
|
3759
|
-
<!-- We drop page numbers for the parts as being redundant, -->
|
|
3760
|
-
<!-- since there *must* be a chapter starting on the next page. -->
|
|
3761
|
-
<xsl:template name="titletoc-part-style">
|
|
3762
|
-
<xsl:text>\titlecontents{part}%
</xsl:text>
|
|
3763
|
-
<xsl:text>[0pt]{\contentsmargin{0em}\addvspace{1pc}\contentsfont\bfseries}%
</xsl:text>
|
|
3764
|
-
<xsl:text>{\Large\thecontentslabel\enspace}{\Large}%
</xsl:text>
|
|
3765
|
-
<xsl:text>{}%
</xsl:text>
|
|
3766
|
-
<xsl:text>[\addvspace{.5pc}]%
</xsl:text>
|
|
3767
|
-
</xsl:template>
|
|
3768
|
-
|
|
3769
|
-
<!-- This should be mostly self-explanatory -->
|
|
3770
|
-
<xsl:template name="titletoc-chapter-style">
|
|
3771
|
-
<xsl:text>\titlecontents{chapter}%
</xsl:text>
|
|
3772
|
-
<xsl:text>[0pt]{\contentsmargin{0em}\addvspace{1pc}\contentsfont\bfseries}%
</xsl:text>
|
|
3773
|
-
<xsl:text>{\large\thecontentslabel\enspace}{\large}%
</xsl:text>
|
|
3774
|
-
<xsl:text>{\hfill\bfseries\thecontentspage}%
</xsl:text>
|
|
3775
|
-
<xsl:text>[\addvspace{.5pc}]%
</xsl:text>
|
|
3776
|
-
</xsl:template>
|
|
3777
|
-
|
|
3778
|
-
<!-- The indent, and space for the number/label are straight -->
|
|
3779
|
-
<!-- from the titletoc documentation, which says they match -->
|
|
3780
|
-
<!-- the LaTeX book class -->
|
|
3781
|
-
<xsl:template name="titletoc-section-style">
|
|
3782
|
-
<xsl:text>\dottedcontents{section}[3.8em]{\contentsfont}{2.3em}{1pc}%
</xsl:text>
|
|
3783
|
-
</xsl:template>
|
|
3784
|
-
|
|
3785
|
-
<!-- The indent, and space for the number/label are straight -->
|
|
3786
|
-
<!-- from the titletoc documentation, which says they match -->
|
|
3787
|
-
<!-- the LaTeX book class -->
|
|
3788
|
-
<xsl:template name="titletoc-subsection-style">
|
|
3789
|
-
<xsl:text>\dottedcontents{subsection}[6.1em]{\contentsfont}{3.2em}{1pc}%
</xsl:text>
|
|
3790
|
-
</xsl:template>
|
|
3791
|
-
|
|
3792
|
-
<!-- Each successive indent is increased by the maximum width -->
|
|
3793
|
-
<!-- of the preceding label, so we just continue that pattern -->
|
|
3794
|
-
<xsl:template name="titletoc-subsubsection-style">
|
|
3795
|
-
<xsl:text>\dottedcontents{subsubsection}[9.3em]{\contentsfont}{4.3em}{1pc}%
</xsl:text>
|
|
3796
|
-
</xsl:template>
|
|
3797
|
-
|
|
3798
|
-
|
|
3799
|
-
<!-- ############################ -->
|
|
3800
|
-
<!-- Page Styles, Headers/Footers -->
|
|
3801
|
-
<!-- ############################ -->
|
|
3802
|
-
|
|
3803
|
-
<!-- These definitions are just default LaTeX. Why? To insert the -->
|
|
3804
|
-
<!-- \pagefont font-change command into just the right places -->
|
|
3805
|
-
<!-- (later we can add color). -->
|
|
3806
|
-
<!-- -->
|
|
3807
|
-
<!-- In more general use, make new page styles, or renew the "empty", -->
|
|
3808
|
-
<!-- "plain", "headings", and/or "myheadings" styles. *Always* finish -->
|
|
3809
|
-
<!-- by declaring a \pagestyle to be in effect. But note, LaTeX will -->
|
|
3810
|
-
<!-- automagically decide some pages are plain or some are empty. And -->
|
|
3811
|
-
<!-- if you adjust "headings" or "myheadings" by doing something like -->
|
|
3812
|
-
<!-- changing a font, you might want to also change "plain" so that -->
|
|
3813
|
-
<!-- the (presumably) simple numbers or other information will be in -->
|
|
3814
|
-
<!-- a matching font. -->
|
|
3815
|
-
|
|
3816
|
-
<!-- N.B. This would be a natural place for \geometry{} commands -->
|
|
3817
|
-
<!-- N.B. We use an XSL variable to make the LaTeX output specific to -->
|
|
3818
|
-
<!-- one-sided or two-sided output. Conceivably this *could* be done -->
|
|
3819
|
-
<!-- with a LaTeX conditional (at the cost of extraneous code) -->
|
|
3820
|
-
<!-- NB: the \ifthechapter conditional stops a "Chapter 0" -->
|
|
3821
|
-
<!-- appearing in the front matter -->
|
|
3822
|
-
<!-- NB: titlesec (not titleps) provides \chaptertitlename so that the -->
|
|
3823
|
-
<!-- LaTeX \chaptername and \appendixname (which we internationalize) -->
|
|
3824
|
-
<!-- are used in the right places -->
|
|
3825
|
-
<!-- N.B. Investigate the "textcase" package for a more capable -->
|
|
3826
|
-
<!-- "\MakeTextUppercase" (or similar) -->
|
|
3827
|
-
<!-- TODO: redefine article, memo, letter correctly -->
|
|
3828
|
-
<xsl:template match="book" mode="titleps-style">
|
|
3829
|
-
<xsl:text>%% Plain pages should have the same font for page numbers
</xsl:text>
|
|
3830
|
-
<xsl:text>\renewpagestyle{plain}{%
</xsl:text>
|
|
3831
|
-
<xsl:text>\setfoot{}{\pagefont\thepage}{}%
</xsl:text>
|
|
3832
|
-
<xsl:text>}%
</xsl:text>
|
|
3833
|
-
<xsl:choose>
|
|
3834
|
-
<xsl:when test="not($b-latex-two-sides)">
|
|
3835
|
-
<!-- Every "regular" page has number top right -->
|
|
3836
|
-
<!-- CHAPTER 8. TITLE 234 -->
|
|
3837
|
-
<xsl:text>%% Single pages as in default LaTeX
</xsl:text>
|
|
3838
|
-
<xsl:text>\renewpagestyle{headings}{%
</xsl:text>
|
|
3839
|
-
<xsl:text>\sethead{\pagefont\slshape\MakeUppercase{\ifthechapter{\chaptertitlename\space\thechapter.\space}{}\chaptertitle}}{}{\pagefont\thepage}%
</xsl:text>
|
|
3840
|
-
<xsl:text>}%
</xsl:text>
|
|
3841
|
-
</xsl:when>
|
|
3842
|
-
<xsl:when test="$b-latex-two-sides">
|
|
3843
|
-
<!-- Two-page spread: (Section empty if not in use) -->
|
|
3844
|
-
<!-- 234 CHAPTER 8. TITLE || SECTION 8.4 TITLE 235 -->
|
|
3845
|
-
<xsl:text>%% Two-page spread as in default LaTeX
</xsl:text>
|
|
3846
|
-
<xsl:text>\renewpagestyle{headings}{%
</xsl:text>
|
|
3847
|
-
<xsl:text>\sethead%
</xsl:text>
|
|
3848
|
-
<xsl:text>[\pagefont\thepage]%
</xsl:text>
|
|
3849
|
-
<xsl:text>[]
</xsl:text>
|
|
3850
|
-
<xsl:text>[\pagefont\slshape\MakeUppercase{\ifthechapter{\chaptertitlename\space\thechapter.\space}{}\chaptertitle}]%
</xsl:text>
|
|
3851
|
-
<!-- LaTeX book style lacks \sectionname -->
|
|
3852
|
-
<!-- 2022-12-14: we tried our own \sectionnameptx but it was not satisfactory -->
|
|
3853
|
-
<!-- (a) need to handle specialized divisions at the section level -->
|
|
3854
|
-
<!-- (b) still got mismatches like running head with "References 2.6 Exercises" -->
|
|
3855
|
-
<!-- (where the 2.6 is for the Exercises, but 2.7 on the same page is "references" -->
|
|
3856
|
-
<xsl:text>{\pagefont\slshape\MakeUppercase{\ifthesection{\thesection.\space\sectiontitle}{}}}%
</xsl:text>
|
|
3857
|
-
<xsl:text>{}%
</xsl:text>
|
|
3858
|
-
<xsl:text>{\pagefont\thepage}%
</xsl:text>
|
|
3859
|
-
<xsl:text>}%
</xsl:text>
|
|
3860
|
-
</xsl:when>
|
|
3861
|
-
</xsl:choose>
|
|
3862
|
-
<xsl:text>\pagestyle{headings}
</xsl:text>
|
|
3863
|
-
</xsl:template>
|
|
3864
|
-
|
|
3865
|
-
<xsl:template match="article|letter|memo" mode="titleps-style">
|
|
3866
|
-
<xsl:text>\pagestyle{plain}
</xsl:text>
|
|
3867
|
-
</xsl:template>
|
|
3868
3100
|
|
|
3869
3101
|
|
|
3870
3102
|
<!-- ##### -->
|
|
@@ -4050,347 +3282,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4050
3282
|
<!-- End: LaTeX Styling -->
|
|
4051
3283
|
<!-- ################## -->
|
|
4052
3284
|
|
|
4053
|
-
<!-- Tack in a graphic with initials -->
|
|
4054
|
-
<!-- Height is just enough to not disrupt line spacing -->
|
|
4055
|
-
<!-- Place inline, no carriage returns -->
|
|
4056
|
-
<xsl:template match="initial">
|
|
4057
|
-
<xsl:text>\hspace*{-0.75ex}{}</xsl:text>
|
|
4058
|
-
<xsl:text>\raisebox{0.2\baselineskip}{\includegraphics[height=0.55\baselineskip]{</xsl:text>
|
|
4059
|
-
<xsl:apply-templates select="@source" />
|
|
4060
|
-
<xsl:text></xsl:text>
|
|
4061
|
-
<xsl:text>}}\hspace*{-0.75ex}{}</xsl:text>
|
|
4062
|
-
</xsl:template>
|
|
4063
|
-
|
|
4064
|
-
<!-- Includes an "event" for presentations -->
|
|
4065
|
-
<xsl:template name="title-page-info-article">
|
|
4066
|
-
<xsl:text>%% Title page information for article
</xsl:text>
|
|
4067
|
-
<xsl:text>\title{</xsl:text>
|
|
4068
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
4069
|
-
<xsl:if test="subtitle">
|
|
4070
|
-
<xsl:text>\\
</xsl:text>
|
|
4071
|
-
<!-- Trying to match author fontsize -->
|
|
4072
|
-
<xsl:text>{\large </xsl:text>
|
|
4073
|
-
<xsl:apply-templates select="." mode="subtitle" />
|
|
4074
|
-
<xsl:text>}</xsl:text>
|
|
4075
|
-
</xsl:if>
|
|
4076
|
-
<xsl:if test="$docinfo/event">
|
|
4077
|
-
<xsl:if test="title">
|
|
4078
|
-
<xsl:text>\\</xsl:text>
|
|
4079
|
-
</xsl:if>
|
|
4080
|
-
<xsl:apply-templates select="$docinfo/event" />
|
|
4081
|
-
</xsl:if>
|
|
4082
|
-
<xsl:if test="$bibinfo/support">
|
|
4083
|
-
<xsl:text>\support{</xsl:text>
|
|
4084
|
-
<xsl:apply-templates select="$bibinfo/support" mode="article-info"/>
|
|
4085
|
-
<xsl:text>}
</xsl:text>
|
|
4086
|
-
</xsl:if>
|
|
4087
|
-
<xsl:text>}
</xsl:text>
|
|
4088
|
-
<xsl:if test="$bibinfo/author or $bibinfo/editor">
|
|
4089
|
-
<xsl:text>\author{</xsl:text>
|
|
4090
|
-
<xsl:apply-templates select="$bibinfo/author" mode="article-info"/>
|
|
4091
|
-
<xsl:apply-templates select="$bibinfo/editor" mode="article-info"/>
|
|
4092
|
-
<xsl:text>}
</xsl:text>
|
|
4093
|
-
</xsl:if>
|
|
4094
|
-
<xsl:text>\date{</xsl:text><xsl:apply-templates select="$bibinfo/date" /><xsl:text>}
</xsl:text>
|
|
4095
|
-
</xsl:template>
|
|
4096
|
-
|
|
4097
|
-
<!-- "half-title" is leading page with -->
|
|
4098
|
-
<!-- title only, at about 1:2 split -->
|
|
4099
|
-
<xsl:template match="book" mode="half-title-ad-card" >
|
|
4100
|
-
<xsl:text>%% begin: half-title
</xsl:text>
|
|
4101
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4102
|
-
<xsl:text>{\titlepagefont\centering
</xsl:text>
|
|
4103
|
-
<xsl:text>\vspace*{0.28\textheight}
</xsl:text>
|
|
4104
|
-
<xsl:text>{\Huge </xsl:text>
|
|
4105
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
4106
|
-
<xsl:text>}\\</xsl:text> <!-- always end line inside centering -->
|
|
4107
|
-
<xsl:if test="subtitle">
|
|
4108
|
-
<xsl:text>[2\baselineskip]
</xsl:text> <!-- extend line break if subtitle -->
|
|
4109
|
-
<xsl:text>{\LARGE </xsl:text>
|
|
4110
|
-
<xsl:apply-templates select="." mode="subtitle"/>
|
|
4111
|
-
<xsl:text>}\\
</xsl:text>
|
|
4112
|
-
</xsl:if>
|
|
4113
|
-
<xsl:text>}
</xsl:text> <!-- finish centering, title page font -->
|
|
4114
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4115
|
-
<xsl:text>%% end: half-title
</xsl:text>
|
|
4116
|
-
<!-- ad-card may very well be blank, and otherwise -->
|
|
4117
|
-
<!-- requires some customization -->
|
|
4118
|
-
<xsl:variable name="the-ad-card">
|
|
4119
|
-
<xsl:apply-templates select="." mode="ad-card"/>
|
|
4120
|
-
</xsl:variable>
|
|
4121
|
-
<xsl:choose>
|
|
4122
|
-
<!-- Additional page for non-empty ad-card, -->
|
|
4123
|
-
<!-- sideness is irrelevant -->
|
|
4124
|
-
<xsl:when test="not($the-ad-card = '')">
|
|
4125
|
-
<xsl:text>%% begin: adcard
</xsl:text>
|
|
4126
|
-
<xsl:value-of select="$the-ad-card"/>
|
|
4127
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4128
|
-
<xsl:text>%% end: adcard
</xsl:text>
|
|
4129
|
-
</xsl:when>
|
|
4130
|
-
<!-- need an empty page, obverse of half-title -->
|
|
4131
|
-
<!-- could also be left-side of title page spread -->
|
|
4132
|
-
<xsl:when test="($b-latex-two-sides) or ($latex-open-odd = 'add-blanks')">
|
|
4133
|
-
<xsl:text>%% begin: adcard (empty)
</xsl:text>
|
|
4134
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4135
|
-
<xsl:text>\null%
</xsl:text>
|
|
4136
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4137
|
-
<xsl:text>%% end: adcard (empty)
</xsl:text>
|
|
4138
|
-
</xsl:when>
|
|
4139
|
-
<!-- no content, and one-sided, do nothing -->
|
|
4140
|
-
<xsl:otherwise/>
|
|
4141
|
-
</xsl:choose>
|
|
4142
|
-
</xsl:template>
|
|
4143
|
-
|
|
4144
|
-
<!-- Ad card is the obverse of half-title, and may contain a list -->
|
|
4145
|
-
<!-- of other books by the author, or in a two-sided version, it -->
|
|
4146
|
-
<!-- can be used as the left-side of a title page spread. Send -->
|
|
4147
|
-
<!-- a feature request if you need/want both. This template is as -->
|
|
4148
|
-
<!-- a hook meant to be overidden as part of custom XSL provided -->
|
|
4149
|
-
<!-- by a knowledgeable publisher, so empty in typical use. When -->
|
|
4150
|
-
<!-- overridden, it should produce a complete page, but without -->
|
|
4151
|
-
<!-- a \clearpage at the bottom, that happens automatically. -->
|
|
4152
|
-
<!-- The macro \titlepagefont can be used (scoped to the page) -->
|
|
4153
|
-
<!-- for harmony with the actual title page, which appears next. -->
|
|
4154
|
-
<xsl:template match="book" mode="ad-card"/>
|
|
4155
|
-
|
|
4156
|
-
<!-- LaTeX's title page is not very robust, so we totally redo it -->
|
|
4157
|
-
<!-- Template produces a single page, followed by a \clearpage -->
|
|
4158
|
-
<!-- Customize with an override of this template in an imported stylesheet -->
|
|
4159
|
-
<!-- For a two-page spread, consider modifying the "ad-card" template -->
|
|
4160
|
-
<!-- For "\centering" to work properly, obey the following scheme: -->
|
|
4161
|
-
<!-- Each group, but first, should begin with [<length>]
 as vertical break -->
|
|
4162
|
-
<!-- Each group, should end with only \\ as prelude to vertical break -->
|
|
4163
|
-
<xsl:template match="book" mode="title-page">
|
|
4164
|
-
<xsl:text>%% begin: title page
</xsl:text>
|
|
4165
|
-
<xsl:text>%% Inspired by Peter Wilson's "titleDB" in "titlepages" CTAN package
</xsl:text>
|
|
4166
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4167
|
-
<xsl:text>{\titlepagefont\centering
</xsl:text>
|
|
4168
|
-
<xsl:text>\vspace*{0.14\textheight}
</xsl:text>
|
|
4169
|
-
<!-- Target for xref to top-level element -->
|
|
4170
|
-
<!-- immediately, or first in ToC -->
|
|
4171
|
-
<xsl:choose>
|
|
4172
|
-
<xsl:when test="$b-has-toc">
|
|
4173
|
-
<!-- N.B. A font change command for the entire ToC -->
|
|
4174
|
-
<!-- could be inserted here with something like -->
|
|
4175
|
-
<!-- \addtocontents{toc}{\protect\contentsfont} -->
|
|
4176
|
-
<!-- but I wanted to document it in place and could -->
|
|
4177
|
-
<!-- not determine how to add a comment into the -->
|
|
4178
|
-
<!-- *.toc file. Perhaps best to just employ the -->
|
|
4179
|
-
<!-- font in the titletoc style templates anyway. -->
|
|
4180
|
-
<xsl:text>%% Target for xref to top-level element is ToC
</xsl:text>
|
|
4181
|
-
<xsl:text>\addtocontents{toc}{</xsl:text>
|
|
4182
|
-
<xsl:if test="$b-pageref">
|
|
4183
|
-
<xsl:text>\protect\label{</xsl:text>
|
|
4184
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
4185
|
-
<xsl:text>}</xsl:text>
|
|
4186
|
-
</xsl:if>
|
|
4187
|
-
<xsl:text>\protect\hypertarget{</xsl:text>
|
|
4188
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
4189
|
-
<xsl:text>}{}</xsl:text>
|
|
4190
|
-
<xsl:text>}
</xsl:text>
|
|
4191
|
-
</xsl:when>
|
|
4192
|
-
<xsl:otherwise>
|
|
4193
|
-
<xsl:text>%% Target for xref to top-level element is document start
</xsl:text>
|
|
4194
|
-
<xsl:if test="$b-pageref">
|
|
4195
|
-
<xsl:text>\label{</xsl:text>
|
|
4196
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
4197
|
-
<xsl:text>}</xsl:text>
|
|
4198
|
-
</xsl:if>
|
|
4199
|
-
<xsl:text>\hypertarget{</xsl:text>
|
|
4200
|
-
<xsl:apply-templates select="." mode="unique-id" />
|
|
4201
|
-
<xsl:text>}{}
</xsl:text>
|
|
4202
|
-
</xsl:otherwise>
|
|
4203
|
-
</xsl:choose>
|
|
4204
|
-
<xsl:text>{\Huge </xsl:text>
|
|
4205
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
4206
|
-
<xsl:text>}\\</xsl:text> <!-- end line inside centering -->
|
|
4207
|
-
<xsl:if test="subtitle">
|
|
4208
|
-
<xsl:text>[\baselineskip]
</xsl:text> <!-- extend if subtitle -->
|
|
4209
|
-
<xsl:text>{\LARGE </xsl:text>
|
|
4210
|
-
<xsl:apply-templates select="." mode="subtitle" />
|
|
4211
|
-
<xsl:text>}\\</xsl:text>
|
|
4212
|
-
</xsl:if>
|
|
4213
|
-
<xsl:apply-templates select="frontmatter/titlepage/titlepage-items" />
|
|
4214
|
-
<xsl:text>}
</xsl:text> <!-- finish centering, titlepage font -->
|
|
4215
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4216
|
-
<xsl:text>%% end: title page
</xsl:text>
|
|
4217
|
-
</xsl:template>
|
|
4218
|
-
|
|
4219
|
-
<xsl:template match="titlepage-items">
|
|
4220
|
-
<xsl:apply-templates select="$bibinfo/author" mode="title-page"/>
|
|
4221
|
-
<xsl:apply-templates select="$bibinfo/editor" mode="title-page" />
|
|
4222
|
-
<xsl:apply-templates select="$bibinfo/credit[title]" mode="title-page" />
|
|
4223
|
-
<xsl:apply-templates select="$bibinfo/date" mode="title-page" />
|
|
4224
|
-
</xsl:template>
|
|
4225
|
-
|
|
4226
|
-
<xsl:template match="author|editor" mode="title-page">
|
|
4227
|
-
<xsl:text>[3\baselineskip]
</xsl:text>
|
|
4228
|
-
<xsl:text>{\Large </xsl:text>
|
|
4229
|
-
<xsl:apply-templates select="personname" />
|
|
4230
|
-
<xsl:if test="self::editor">
|
|
4231
|
-
<xsl:text>, </xsl:text>
|
|
4232
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
4233
|
-
</xsl:if>
|
|
4234
|
-
<xsl:text>}\\</xsl:text>
|
|
4235
|
-
<xsl:if test="affiliation/institution">
|
|
4236
|
-
<xsl:text>[0.5\baselineskip]
</xsl:text>
|
|
4237
|
-
<xsl:text>{\Large </xsl:text>
|
|
4238
|
-
<xsl:apply-templates select="affiliation/institution" />
|
|
4239
|
-
<xsl:text>}\\</xsl:text>
|
|
4240
|
-
</xsl:if>
|
|
4241
|
-
</xsl:template>
|
|
4242
|
-
|
|
4243
|
-
<!-- One "title" per-credit, but multiple authors are OK -->
|
|
4244
|
-
<xsl:template match="credit" mode="title-page">
|
|
4245
|
-
<xsl:text>[3\baselineskip]
</xsl:text>
|
|
4246
|
-
<xsl:text>{\Large </xsl:text>
|
|
4247
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
4248
|
-
<xsl:text>}\\[0.5\baselineskip]
</xsl:text>
|
|
4249
|
-
<xsl:for-each select="author">
|
|
4250
|
-
<xsl:text>{\normalsize </xsl:text>
|
|
4251
|
-
<xsl:apply-templates select="personname" />
|
|
4252
|
-
<xsl:text>}\\</xsl:text>
|
|
4253
|
-
<xsl:if test="affiliation/institution">
|
|
4254
|
-
<xsl:text>[0.25\baselineskip]
</xsl:text>
|
|
4255
|
-
<xsl:apply-templates select="affiliation/institution" />
|
|
4256
|
-
<xsl:text>\\</xsl:text>
|
|
4257
|
-
</xsl:if>
|
|
4258
|
-
<xsl:if test="following-sibling::author">
|
|
4259
|
-
<xsl:text>[0.5\baselineskip]
</xsl:text>
|
|
4260
|
-
</xsl:if>
|
|
4261
|
-
<xsl:text>
</xsl:text>
|
|
4262
|
-
</xsl:for-each>
|
|
4263
|
-
</xsl:template>
|
|
4264
|
-
|
|
4265
|
-
<xsl:template match="date" mode="title-page">
|
|
4266
|
-
<xsl:text>[3\baselineskip]
</xsl:text>
|
|
4267
|
-
<xsl:text>{\Large </xsl:text>
|
|
4268
|
-
<xsl:apply-templates/>
|
|
4269
|
-
<xsl:text>}\\</xsl:text>
|
|
4270
|
-
</xsl:template>
|
|
4271
|
-
|
|
4272
|
-
<!-- Copyright page is obverse of title page -->
|
|
4273
|
-
<!-- Lots of stuff here, much of it optional -->
|
|
4274
|
-
<!-- But we assume an author eventually states -->
|
|
4275
|
-
<!-- their copyright, so do not handle the case -->
|
|
4276
|
-
<!-- of this content ever being empty (such as -->
|
|
4277
|
-
<!-- with the ad-card). So a LaTeX label is OK -->
|
|
4278
|
-
<!-- as well. A final "\null" is just -->
|
|
4279
|
-
<!-- protection for a non-mature project. -->
|
|
4280
|
-
<xsl:template match="book" mode="copyright-page" >
|
|
4281
|
-
<!-- TODO: split out sections like "website" -->
|
|
4282
|
-
<!-- ISBN, Cover Design, Publisher -->
|
|
4283
|
-
<xsl:text>%% begin: copyright-page
</xsl:text>
|
|
4284
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4285
|
-
<!-- This is the most obvious place for -->
|
|
4286
|
-
<!-- a target to the front colophon -->
|
|
4287
|
-
<!-- NB: only a book has a front colophon -->
|
|
4288
|
-
<xsl:apply-templates select="frontmatter/colophon" mode="label" />
|
|
4289
|
-
<xsl:if test="not(../docinfo/author-biographies/@length = 'long')">
|
|
4290
|
-
<xsl:apply-templates select="frontmatter/biography" mode="copyright-page" />
|
|
4291
|
-
</xsl:if>
|
|
4292
|
-
<xsl:text>\vspace*{\stretch{2}}
</xsl:text>
|
|
4293
|
-
|
|
4294
|
-
<xsl:if test="$bibinfo/credit[role]">
|
|
4295
|
-
<xsl:text>\par\noindent
</xsl:text>
|
|
4296
|
-
</xsl:if>
|
|
4297
|
-
<!-- We accomodate multiple "credit" with a context shift -->
|
|
4298
|
-
<xsl:for-each select="$bibinfo/credit[role]">
|
|
4299
|
-
<xsl:text>\textbf{</xsl:text>
|
|
4300
|
-
<xsl:apply-templates select="role" />
|
|
4301
|
-
<xsl:text>}:\ \ </xsl:text>
|
|
4302
|
-
<xsl:apply-templates select="entity" />
|
|
4303
|
-
<xsl:if test="following-sibling::credit">
|
|
4304
|
-
<xsl:text>\\</xsl:text>
|
|
4305
|
-
</xsl:if>
|
|
4306
|
-
<xsl:text>
</xsl:text>
|
|
4307
|
-
</xsl:for-each>
|
|
4308
|
-
<xsl:if test="$bibinfo/credit[role]">
|
|
4309
|
-
<xsl:text>\par\vspace*{\stretch{2}}
</xsl:text>
|
|
4310
|
-
</xsl:if>
|
|
4311
|
-
|
|
4312
|
-
<!-- A book cannot be multiple editions, and if -->
|
|
4313
|
-
<!-- attempted this will produce a mish-mash. -->
|
|
4314
|
-
<xsl:if test="$bibinfo/edition" >
|
|
4315
|
-
<xsl:text>\noindent{\bfseries </xsl:text>
|
|
4316
|
-
<xsl:apply-templates select="$bibinfo/edition" mode="type-name"/>
|
|
4317
|
-
<xsl:text>}: </xsl:text>
|
|
4318
|
-
<xsl:apply-templates select="$bibinfo/edition" />
|
|
4319
|
-
<xsl:text>\par\medskip
</xsl:text>
|
|
4320
|
-
</xsl:if>
|
|
4321
|
-
|
|
4322
|
-
<!-- We accomodate zero to many "website". -->
|
|
4323
|
-
<xsl:apply-templates select="$bibinfo/website"/>
|
|
4324
|
-
|
|
4325
|
-
<!-- There may be multiple copyrights (a fork under the GFDL -->
|
|
4326
|
-
<!-- requires as much). This accomodates zero to many. The -->
|
|
4327
|
-
<!-- "for-each" enacts a context shift so we know we are -->
|
|
4328
|
-
<!-- mining one "copyright" element at a time. -->
|
|
4329
|
-
<xsl:for-each select="$bibinfo/copyright">
|
|
4330
|
-
<xsl:text>\noindent</xsl:text>
|
|
4331
|
-
<xsl:call-template name="copyright-character"/>
|
|
4332
|
-
<xsl:apply-templates select="year" />
|
|
4333
|
-
<xsl:text>\quad{}</xsl:text>
|
|
4334
|
-
<xsl:apply-templates select="holder" />
|
|
4335
|
-
<xsl:if test="shortlicense">
|
|
4336
|
-
<xsl:text>\\[0.5\baselineskip]
</xsl:text>
|
|
4337
|
-
<xsl:apply-templates select="shortlicense" />
|
|
4338
|
-
</xsl:if>
|
|
4339
|
-
<xsl:text>\par\medskip
</xsl:text>
|
|
4340
|
-
</xsl:for-each>
|
|
4341
|
-
|
|
4342
|
-
<xsl:text>\vspace*{\stretch{1}}
</xsl:text>
|
|
4343
|
-
<!-- Add support statement from bibinfo if present. -->
|
|
4344
|
-
<xsl:if test="$bibinfo/support">
|
|
4345
|
-
<xsl:apply-templates select="$bibinfo/support" mode="copyright-page"/>
|
|
4346
|
-
</xsl:if>
|
|
4347
|
-
<!-- Something so page is not totally nothing -->
|
|
4348
|
-
<xsl:text>\null\clearpage
</xsl:text>
|
|
4349
|
-
<xsl:text>%% end: copyright-page
</xsl:text>
|
|
4350
|
-
</xsl:template>
|
|
4351
|
-
|
|
4352
|
-
<!-- Only for a book with a colophon, we put the statement of support at the bottom of the colophon -->
|
|
4353
|
-
<xsl:template match="bibinfo/support" mode="copyright-page">
|
|
4354
|
-
<xsl:text>%% Funding/Support statement:</xsl:text>
|
|
4355
|
-
<xsl:text>\par\medskip
</xsl:text>
|
|
4356
|
-
<xsl:text>\noindent{}</xsl:text>
|
|
4357
|
-
<xsl:apply-templates select="*" />
|
|
4358
|
-
<xsl:text>\par
</xsl:text>
|
|
4359
|
-
<xsl:text>\vspace*{\stretch{1}}
</xsl:text>
|
|
4360
|
-
</xsl:template>
|
|
4361
|
-
|
|
4362
|
-
<!-- URL for canonical project website -->
|
|
4363
|
-
<xsl:template match="frontmatter/bibinfo/website">
|
|
4364
|
-
<xsl:text>\noindent{\bfseries </xsl:text>
|
|
4365
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
4366
|
-
<xsl:text>}: </xsl:text>
|
|
4367
|
-
<!-- NB: interior of "website" is a "url" in author's -->
|
|
4368
|
-
<!-- source, but the pre-processor adds a footnote -->
|
|
4369
|
-
<!-- Only one presumed, and thus enforced here -->
|
|
4370
|
-
<xsl:apply-templates select="url[1]|fn[1]" />
|
|
4371
|
-
<xsl:text>\par\medskip
</xsl:text>
|
|
4372
|
-
</xsl:template>
|
|
4373
|
-
|
|
4374
|
-
|
|
4375
|
-
<!-- Author biographies -->
|
|
4376
|
-
<!-- Verso of title page, we call this the front colophon -->
|
|
4377
|
-
<!-- Title is optional, presumably for a single author -->
|
|
4378
|
-
<xsl:template match="biography" mode="copyright-page">
|
|
4379
|
-
<xsl:if test="preceding-sibling::*[self::biography]">
|
|
4380
|
-
<xsl:text>\bigskip</xsl:text>
|
|
4381
|
-
</xsl:if>
|
|
4382
|
-
<xsl:text>\noindent</xsl:text>
|
|
4383
|
-
<xsl:if test="title">
|
|
4384
|
-
<xsl:text>\textbf{</xsl:text>
|
|
4385
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
4386
|
-
<xsl:text>}\space\space</xsl:text>
|
|
4387
|
-
</xsl:if>
|
|
4388
|
-
<xsl:text>
</xsl:text>
|
|
4389
|
-
<xsl:apply-templates select="*"/>
|
|
4390
|
-
<!-- drop a par, for next bio, or for big vspace -->
|
|
4391
|
-
<xsl:text>\par
</xsl:text>
|
|
4392
|
-
</xsl:template>
|
|
4393
|
-
|
|
4394
3285
|
<!-- Authors, editors, info for article info to \maketitle -->
|
|
4395
3286
|
<!-- http://stackoverflow.com/questions/2817664/xsl-how-to-tell-if-element-is-last-in-series -->
|
|
4396
3287
|
<xsl:template match="author" mode="article-info">
|
|
@@ -4464,55 +3355,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4464
3355
|
<xsl:apply-templates select="line" />
|
|
4465
3356
|
</xsl:template>
|
|
4466
3357
|
|
|
4467
|
-
<!-- ###################### -->
|
|
4468
|
-
<!-- Front Matter, Articles -->
|
|
4469
|
-
<!-- ###################### -->
|
|
4470
|
-
|
|
4471
|
-
<!-- The DTD should enforce order(titlepage|abstract) -->
|
|
4472
|
-
<!-- An optional ToC follows and is final decoration -->
|
|
4473
|
-
<xsl:template match="article/frontmatter">
|
|
4474
|
-
<xsl:apply-templates select="titlepage|abstract" />
|
|
4475
|
-
<xsl:if test="$latex-toc-level > 0">
|
|
4476
|
-
<xsl:text>%% Adjust Table of Contents
</xsl:text>
|
|
4477
|
-
<xsl:text>\setcounter{tocdepth}{</xsl:text>
|
|
4478
|
-
<xsl:value-of select="$latex-toc-level" />
|
|
4479
|
-
<xsl:text>}
</xsl:text>
|
|
4480
|
-
<xsl:text>\renewcommand*\contentsname{</xsl:text>
|
|
4481
|
-
<xsl:apply-templates select="." mode="type-name">
|
|
4482
|
-
<xsl:with-param name="string-id" select="'toc'"/>
|
|
4483
|
-
</xsl:apply-templates>
|
|
4484
|
-
<xsl:text>}
</xsl:text>
|
|
4485
|
-
<xsl:text>\tableofcontents
</xsl:text>
|
|
4486
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4487
|
-
</xsl:if>
|
|
4488
|
-
</xsl:template>
|
|
4489
|
-
|
|
4490
|
-
<!-- Title information handling is a bit ad-hoc -->
|
|
4491
|
-
<!-- We should perhaps roll-our-own here -->
|
|
4492
|
-
<!-- Instead we assume the title-page-info-article has set *something* -->
|
|
4493
|
-
<!-- NB: it is possible for there to be no article/title -->
|
|
4494
|
-
<xsl:template match="article/frontmatter/titlepage">
|
|
4495
|
-
<xsl:text>\maketitle
</xsl:text>
|
|
4496
|
-
<!-- If a title, we know it is page 1, so use empty style -->
|
|
4497
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4498
|
-
</xsl:template>
|
|
4499
|
-
|
|
4500
|
-
<!-- Articles may have an abstract in the frontmatter. We -->
|
|
4501
|
-
<!-- accept the LaTeX article class approach and switch -->
|
|
4502
|
-
<!-- to a localization of the heading just prior to use. -->
|
|
4503
|
-
<!-- Keywords are placed inside the abstract, at the end. -->
|
|
4504
|
-
<xsl:template match="article/frontmatter/abstract">
|
|
4505
|
-
<xsl:text>\renewcommand*{\abstractname}{</xsl:text>
|
|
4506
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
4507
|
-
<xsl:text>}
</xsl:text>
|
|
4508
|
-
<xsl:text>\begin{abstract}
</xsl:text>
|
|
4509
|
-
<xsl:apply-templates select="*"/>
|
|
4510
|
-
<xsl:if test="$bibinfo/keywords">
|
|
4511
|
-
<xsl:apply-templates select="$bibinfo/keywords"/>
|
|
4512
|
-
</xsl:if>
|
|
4513
|
-
<xsl:text>\end{abstract}
</xsl:text>
|
|
4514
|
-
</xsl:template>
|
|
4515
|
-
|
|
4516
3358
|
<xsl:template match="bibinfo/keywords">
|
|
4517
3359
|
<xsl:text>\par\medskip
</xsl:text>
|
|
4518
3360
|
<xsl:text>\noindent{\bfseries </xsl:text>
|
|
@@ -4523,277 +3365,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
4523
3365
|
</xsl:template>
|
|
4524
3366
|
|
|
4525
3367
|
|
|
4526
|
-
<!-- ################### -->
|
|
4527
|
-
<!-- Front Matter, Books -->
|
|
4528
|
-
<!-- ################### -->
|
|
4529
|
-
|
|
4530
|
-
<!-- The <colophon> portion of <frontmatter> generally -->
|
|
4531
|
-
<!-- gets mined to migrate various places, so we kill -->
|
|
4532
|
-
<!-- it as part of processing the front matter element. -->
|
|
4533
|
-
<!-- Author biography migrates to the obverse of the -->
|
|
4534
|
-
<!-- copyright page in LaTeX, sans any provided title. -->
|
|
4535
|
-
<!-- So we kill this part of the front matter as -->
|
|
4536
|
-
<!-- a section of its own. (In HTML the material -->
|
|
4537
|
-
<!-- is its own titled division). -->
|
|
4538
|
-
<xsl:template match="book/frontmatter">
|
|
4539
|
-
<!-- DTD: does the next line presume <frontmatter> is required? -->
|
|
4540
|
-
<xsl:text>\frontmatter
</xsl:text>
|
|
4541
|
-
<xsl:apply-templates select="*[not(self::colophon or self::biography)]" />
|
|
4542
|
-
<xsl:text>%% begin: table of contents
</xsl:text>
|
|
4543
|
-
<xsl:if test="$latex-toc-level > -1">
|
|
4544
|
-
<xsl:text>%% Adjust Table of Contents
</xsl:text>
|
|
4545
|
-
<xsl:text>\setcounter{tocdepth}{</xsl:text>
|
|
4546
|
-
<xsl:value-of select="$latex-toc-level" />
|
|
4547
|
-
<xsl:text>}
</xsl:text>
|
|
4548
|
-
<xsl:text>\renewcommand*\contentsname{</xsl:text>
|
|
4549
|
-
<xsl:apply-templates select="." mode="type-name">
|
|
4550
|
-
<xsl:with-param name="string-id" select="'toc'"/>
|
|
4551
|
-
</xsl:apply-templates>
|
|
4552
|
-
<xsl:text>}
</xsl:text>
|
|
4553
|
-
<xsl:text>\tableofcontents
</xsl:text>
|
|
4554
|
-
<xsl:text>%% end: table of contents
</xsl:text>
|
|
4555
|
-
</xsl:if>
|
|
4556
|
-
<!-- Potentially: list of illustrations, etc. -->
|
|
4557
|
-
<!-- Potentially: introduction, second half-title -->
|
|
4558
|
-
<!-- if we have a \frontmatter, we must end it with \mainmatter -->
|
|
4559
|
-
<xsl:text>\mainmatter
</xsl:text>
|
|
4560
|
-
</xsl:template>
|
|
4561
|
-
|
|
4562
|
-
<!-- A huge decoration, spanning many pages -->
|
|
4563
|
-
<!-- Not structural, titlepage element is just a signal -->
|
|
4564
|
-
<!-- Includes items from the colophon -->
|
|
4565
|
-
<xsl:template match="book/frontmatter/titlepage">
|
|
4566
|
-
<!-- first page, half-title only; obverse -->
|
|
4567
|
-
<!-- of half-title is possible adcard -->
|
|
4568
|
-
<xsl:apply-templates select="../.." mode="half-title-ad-card" />
|
|
4569
|
-
<!-- title page -->
|
|
4570
|
-
<xsl:apply-templates select="../.." mode="title-page" />
|
|
4571
|
-
<!-- title page obverse is copyright, assumed non-empty -->
|
|
4572
|
-
<xsl:apply-templates select="../.." mode="copyright-page" />
|
|
4573
|
-
<!-- long biographies come earliest, since normally on copyright page -->
|
|
4574
|
-
<!-- short biographies are part of the copyright-page template -->
|
|
4575
|
-
<xsl:if test="$docinfo/author-biographies/@length = 'long' and ../biography">
|
|
4576
|
-
<xsl:apply-templates select="../.." mode="author-biography-subdivision" />
|
|
4577
|
-
</xsl:if>
|
|
4578
|
-
</xsl:template>
|
|
4579
|
-
|
|
4580
|
-
<xsl:template match="book" mode="author-biography-subdivision">
|
|
4581
|
-
<xsl:variable name="number-authors" select="count(frontmatter/biography)" />
|
|
4582
|
-
<xsl:variable name="title-string">
|
|
4583
|
-
<xsl:choose>
|
|
4584
|
-
<xsl:when test="$number-authors > 1">
|
|
4585
|
-
<xsl:apply-templates select="frontmatter" mode="type-name">
|
|
4586
|
-
<xsl:with-param name="string-id" select="'about-authors'"/>
|
|
4587
|
-
</xsl:apply-templates>
|
|
4588
|
-
</xsl:when>
|
|
4589
|
-
<xsl:otherwise>
|
|
4590
|
-
<xsl:apply-templates select="frontmatter" mode="type-name">
|
|
4591
|
-
<xsl:with-param name="string-id" select="'about-author'"/>
|
|
4592
|
-
</xsl:apply-templates>
|
|
4593
|
-
</xsl:otherwise>
|
|
4594
|
-
</xsl:choose>
|
|
4595
|
-
</xsl:variable>
|
|
4596
|
-
<xsl:text>%% begin: author biography (long)
</xsl:text>
|
|
4597
|
-
<xsl:text>\chapter*{</xsl:text>
|
|
4598
|
-
<xsl:value-of select="$title-string" />
|
|
4599
|
-
<xsl:text>}
</xsl:text>
|
|
4600
|
-
<xsl:text>\addcontentsline{toc}{chapter}{</xsl:text>
|
|
4601
|
-
<xsl:value-of select="$title-string" />
|
|
4602
|
-
<xsl:text>}
</xsl:text>
|
|
4603
|
-
<xsl:choose>
|
|
4604
|
-
<xsl:when test="$number-authors > 1">
|
|
4605
|
-
<xsl:apply-templates select="frontmatter/biography" mode="biography-subdivision" />
|
|
4606
|
-
</xsl:when>
|
|
4607
|
-
<xsl:otherwise>
|
|
4608
|
-
<xsl:if test="frontmatter/biography/title">
|
|
4609
|
-
<xsl:text>\section*{</xsl:text>
|
|
4610
|
-
<xsl:apply-templates select="frontmatter/biography" mode="title-full" />
|
|
4611
|
-
<xsl:text>}
</xsl:text>
|
|
4612
|
-
</xsl:if>
|
|
4613
|
-
<!-- else don't bother titling-->
|
|
4614
|
-
<xsl:apply-templates select="frontmatter/biography/*" />
|
|
4615
|
-
</xsl:otherwise>
|
|
4616
|
-
</xsl:choose>
|
|
4617
|
-
<xsl:text>\cleardoublepage</xsl:text>
|
|
4618
|
-
<xsl:text>%% end: author biography (long)
</xsl:text>
|
|
4619
|
-
</xsl:template>
|
|
4620
|
-
|
|
4621
|
-
<xsl:template match="biography" mode="biography-subdivision">
|
|
4622
|
-
<xsl:text>\section*{</xsl:text>
|
|
4623
|
-
<xsl:choose>
|
|
4624
|
-
<xsl:when test="title">
|
|
4625
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
4626
|
-
</xsl:when>
|
|
4627
|
-
<xsl:otherwise>
|
|
4628
|
-
<xsl:text>DEFAULT TO FULL NAME HERE</xsl:text>
|
|
4629
|
-
</xsl:otherwise>
|
|
4630
|
-
</xsl:choose>
|
|
4631
|
-
<xsl:text>}
</xsl:text>
|
|
4632
|
-
<xsl:apply-templates select="*"/>
|
|
4633
|
-
</xsl:template>
|
|
4634
|
-
|
|
4635
|
-
<!-- Dedication page is very plain, with a blank obverse -->
|
|
4636
|
-
<!-- Accomodates multiple recipient (eg if multiple authors) -->
|
|
4637
|
-
<xsl:template match="dedication">
|
|
4638
|
-
<xsl:text>%% begin: dedication-page
</xsl:text>
|
|
4639
|
-
<xsl:text>\cleardoublepage
</xsl:text>
|
|
4640
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4641
|
-
<xsl:text>\vspace*{\stretch{1}}
</xsl:text>
|
|
4642
|
-
<!-- paragraphs only, one per dedication -->
|
|
4643
|
-
<xsl:apply-templates select="p"/>
|
|
4644
|
-
<xsl:text>\vspace*{\stretch{2}}
</xsl:text>
|
|
4645
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4646
|
-
<xsl:text>%% end: dedication-page
</xsl:text>
|
|
4647
|
-
<xsl:if test="$b-latex-two-sides">
|
|
4648
|
-
<xsl:text>%% begin: obverse-dedication-page (empty)
</xsl:text>
|
|
4649
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4650
|
-
<xsl:text>\null%
</xsl:text>
|
|
4651
|
-
<xsl:text>\clearpage
</xsl:text>
|
|
4652
|
-
<xsl:text>%% end: obverse-dedication-page (empty)
</xsl:text>
|
|
4653
|
-
</xsl:if>
|
|
4654
|
-
</xsl:template>
|
|
4655
|
-
|
|
4656
|
-
<!-- Dedications are meant to be very short -->
|
|
4657
|
-
<!-- so are each a single paragraph and -->
|
|
4658
|
-
<!-- are centered on a page of their own -->
|
|
4659
|
-
<!-- The center environment provides good -->
|
|
4660
|
-
<!-- vertical break between multiple instances -->
|
|
4661
|
-
<!-- Each "p" may be structured by "line" -->
|
|
4662
|
-
<!-- The p[1] elsewhere is the default, -->
|
|
4663
|
-
<!-- hence we use the priority mechanism (>0.5) -->
|
|
4664
|
-
<xsl:template match="dedication/p|dedication/p[1]" priority="1">
|
|
4665
|
-
<xsl:text>\begin{center}\Large%
</xsl:text>
|
|
4666
|
-
<xsl:apply-templates/>
|
|
4667
|
-
<xsl:text>%
</xsl:text>
|
|
4668
|
-
<xsl:text>\end{center}
</xsl:text>
|
|
4669
|
-
</xsl:template>
|
|
4670
|
-
|
|
4671
|
-
<!-- ##################### -->
|
|
4672
|
-
<!-- Front Matter, Letters -->
|
|
4673
|
-
<!-- ##################### -->
|
|
4674
|
-
|
|
4675
|
-
<xsl:template match="letter/frontmatter">
|
|
4676
|
-
<!-- Logos (letterhead images) immediately -->
|
|
4677
|
-
<xsl:apply-templates select="$docinfo/logo" />
|
|
4678
|
-
<xsl:text>\vspace*{\stretch{1}}
</xsl:text>
|
|
4679
|
-
<xsl:text>\thispagestyle{empty}
</xsl:text>
|
|
4680
|
-
<!-- Push down some on first page to accomodate letterhead -->
|
|
4681
|
-
<xsl:text>\vspace*{0.75in}
</xsl:text>
|
|
4682
|
-
<!-- Stretchy vertical space if page 1 does not fill -->
|
|
4683
|
-
<xsl:text>\vspace*{\stretch{1}}
%
</xsl:text>
|
|
4684
|
-
<!-- Sender's address, sans name typically -->
|
|
4685
|
-
<!-- and if not already on letterhead -->
|
|
4686
|
-
<!-- Structured as lines, always -->
|
|
4687
|
-
<!-- http://tex.stackexchange.com/questions/13542/flush-a-left-flushed-box-right -->
|
|
4688
|
-
<xsl:if test="from or date">
|
|
4689
|
-
<xsl:text>\hfill\begin{tabular}{l@{}}
</xsl:text>
|
|
4690
|
-
<xsl:if test="from">
|
|
4691
|
-
<xsl:apply-templates select="from/line" />
|
|
4692
|
-
<xsl:if test="date">
|
|
4693
|
-
<!-- end from -->
|
|
4694
|
-
<xsl:text>\\
</xsl:text>
|
|
4695
|
-
<!-- introduce a blank line -->
|
|
4696
|
-
<xsl:text>\mbox{}\\
</xsl:text>
|
|
4697
|
-
</xsl:if>
|
|
4698
|
-
</xsl:if>
|
|
4699
|
-
<!-- Date -->
|
|
4700
|
-
<xsl:if test="date">
|
|
4701
|
-
<xsl:apply-templates select="date" />
|
|
4702
|
-
</xsl:if>
|
|
4703
|
-
<xsl:text>
\end{tabular}\\\par
</xsl:text>
|
|
4704
|
-
</xsl:if>
|
|
4705
|
-
<!-- Destination address, flush left -->
|
|
4706
|
-
<!-- Structured as lines, always -->
|
|
4707
|
-
<xsl:if test="to">
|
|
4708
|
-
<xsl:text>\noindent{}</xsl:text>
|
|
4709
|
-
<xsl:apply-templates select="to/line" />
|
|
4710
|
-
<xsl:text>\\\par</xsl:text>
|
|
4711
|
-
<!-- extra comment line before salutation/body -->
|
|
4712
|
-
<xsl:text>
%
</xsl:text>
|
|
4713
|
-
</xsl:if>
|
|
4714
|
-
<!-- Salutation, flush left -->
|
|
4715
|
-
<!-- No punctuation (author's responsibility) -->
|
|
4716
|
-
<xsl:if test="salutation">
|
|
4717
|
-
<xsl:text>\noindent{}</xsl:text>
|
|
4718
|
-
<xsl:apply-templates select="salutation" />
|
|
4719
|
-
<xsl:text>\\\par</xsl:text>
|
|
4720
|
-
<xsl:text>
</xsl:text>
|
|
4721
|
-
</xsl:if>
|
|
4722
|
-
</xsl:template>
|
|
4723
|
-
|
|
4724
|
-
<!-- Final lines of from/to address get treated carefully above -->
|
|
4725
|
-
<!-- Differentiate from memo versions -->
|
|
4726
|
-
<xsl:template match="letter/frontmatter/from/line|letter/frontmatter/to/line">
|
|
4727
|
-
<xsl:apply-templates/>
|
|
4728
|
-
<!-- is there a following line to separate? -->
|
|
4729
|
-
<xsl:if test="following-sibling::*">
|
|
4730
|
-
<xsl:text>\\
</xsl:text>
|
|
4731
|
-
</xsl:if>
|
|
4732
|
-
</xsl:template>
|
|
4733
|
-
|
|
4734
|
-
<!-- ################### -->
|
|
4735
|
-
<!-- Front Matter, Memos -->
|
|
4736
|
-
<!-- ################### -->
|
|
4737
|
-
|
|
4738
|
-
<xsl:template match="memo/frontmatter">
|
|
4739
|
-
<xsl:text>\thispagestyle{empty}
%
</xsl:text>
|
|
4740
|
-
<!-- Logos (letterhead images) to first page -->
|
|
4741
|
-
<xsl:apply-templates select="$docinfo/logo" />
|
|
4742
|
-
<!-- Get width of widest out-dented text -->
|
|
4743
|
-
<xsl:text>\newlength{\subjectwidth}
</xsl:text>
|
|
4744
|
-
<xsl:text>\settowidth{\subjectwidth}{\textsf{Subject:}}
</xsl:text>
|
|
4745
|
-
<!-- Push down some on first page to accomodate letterhead -->
|
|
4746
|
-
<xsl:text>\vspace*{0.75in}
</xsl:text>
|
|
4747
|
-
<!-- Outdent experimentally, scales well at 10pt, 11pt, 12pt -->
|
|
4748
|
-
<!-- Control separation -->
|
|
4749
|
-
<xsl:text>\hspace*{-1.87\subjectwidth}%
</xsl:text>
|
|
4750
|
-
<xsl:text>{\setlength{\tabcolsep}{1ex}%
</xsl:text>
|
|
4751
|
-
<!-- Second column at textwidth is slightly too much -->
|
|
4752
|
-
<xsl:text>\begin{tabular}{rp{0.97\textwidth}}
</xsl:text>
|
|
4753
|
-
<xsl:text>\textsf{To:}</xsl:text>
|
|
4754
|
-
<xsl:choose>
|
|
4755
|
-
<!-- multiline structured -->
|
|
4756
|
-
<xsl:when test="to/line">
|
|
4757
|
-
<xsl:apply-templates select="to/line" />
|
|
4758
|
-
</xsl:when>
|
|
4759
|
-
<!-- always a newline, even if blank -->
|
|
4760
|
-
<xsl:otherwise>
|
|
4761
|
-
<xsl:text>&</xsl:text>
|
|
4762
|
-
<xsl:apply-templates select="to" />
|
|
4763
|
-
<xsl:text>\\
</xsl:text>
|
|
4764
|
-
</xsl:otherwise>
|
|
4765
|
-
</xsl:choose>
|
|
4766
|
-
<xsl:text>\textsf{From:}</xsl:text>
|
|
4767
|
-
<xsl:choose>
|
|
4768
|
-
<!-- multiline structured -->
|
|
4769
|
-
<xsl:when test="from/line">
|
|
4770
|
-
<xsl:apply-templates select="from/line" />
|
|
4771
|
-
</xsl:when>
|
|
4772
|
-
<!-- always a newline, even if blank -->
|
|
4773
|
-
<xsl:otherwise>
|
|
4774
|
-
<xsl:text>&</xsl:text>
|
|
4775
|
-
<xsl:apply-templates select="from" />
|
|
4776
|
-
<xsl:text>\\
</xsl:text>
|
|
4777
|
-
</xsl:otherwise>
|
|
4778
|
-
</xsl:choose>
|
|
4779
|
-
<xsl:text>\textsf{Date:}&</xsl:text>
|
|
4780
|
-
<xsl:apply-templates select="date" /><xsl:text>\\
</xsl:text>
|
|
4781
|
-
<xsl:text>\textsf{Subject:}&</xsl:text>
|
|
4782
|
-
<xsl:apply-templates select="subject" /><xsl:text>
</xsl:text>
|
|
4783
|
-
<xsl:text>\end{tabular}%
</xsl:text>
|
|
4784
|
-
<xsl:text>}%
</xsl:text>
|
|
4785
|
-
<!-- And drop a bit -->
|
|
4786
|
-
<xsl:text>\par\bigskip
</xsl:text>
|
|
4787
|
-
</xsl:template>
|
|
4788
|
-
|
|
4789
|
-
<!-- Differentiate from letter versions -->
|
|
4790
|
-
<xsl:template match="memo/frontmatter/from/line|memo/frontmatter/to/line">
|
|
4791
|
-
<xsl:text>&</xsl:text>
|
|
4792
|
-
<xsl:apply-templates/>
|
|
4793
|
-
<!-- part of a big block, use newline everywhere -->
|
|
4794
|
-
<xsl:text>\\
</xsl:text>
|
|
4795
|
-
</xsl:template>
|
|
4796
|
-
|
|
4797
3368
|
<!-- ############ -->
|
|
4798
3369
|
<!-- Back Matter -->
|
|
4799
3370
|
<!-- ############ -->
|
|
@@ -5197,81 +3768,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5197
3768
|
</xsl:template>
|
|
5198
3769
|
|
|
5199
3770
|
|
|
5200
|
-
<!-- ####################################### -->
|
|
5201
|
-
<!-- Solutions Divisions, Content Generation -->
|
|
5202
|
-
<!-- ####################################### -->
|
|
5203
|
-
|
|
5204
|
-
<!-- The "division-in-solutions" modal template from -common -->
|
|
5205
|
-
<!-- calls the "duplicate-heading" modal template. -->
|
|
5206
|
-
<!-- Stacked headings all share one size, fixed by the level -->
|
|
5207
|
-
<!-- of the originating "solutions" division, regardless of -->
|
|
5208
|
-
<!-- the depth each entry reflects. This is consistent with -->
|
|
5209
|
-
<!-- treating stacked headings as a single "squashed" heading. -->
|
|
5210
|
-
|
|
5211
|
-
<xsl:template match="*" mode="duplicate-heading">
|
|
5212
|
-
<xsl:param name="heading-level"/>
|
|
5213
|
-
<xsl:param name="heading-stack" select="."/>
|
|
5214
|
-
<xsl:variable name="text-size">
|
|
5215
|
-
<xsl:call-template name="get-heading-text-size">
|
|
5216
|
-
<xsl:with-param name="heading-level" select="$heading-level"/>
|
|
5217
|
-
</xsl:call-template>
|
|
5218
|
-
</xsl:variable>
|
|
5219
|
-
<xsl:text>\par\medskip
\noindent\textbf{</xsl:text>
|
|
5220
|
-
<xsl:value-of select="$text-size"/>
|
|
5221
|
-
<xsl:text>{}</xsl:text>
|
|
5222
|
-
<xsl:apply-templates select="$heading-stack" mode="duplicate-heading-content">
|
|
5223
|
-
<xsl:with-param name="heading-stack" select="$heading-stack"/>
|
|
5224
|
-
</xsl:apply-templates>
|
|
5225
|
-
<xsl:text>}
</xsl:text>
|
|
5226
|
-
</xsl:template>
|
|
5227
|
-
|
|
5228
|
-
<xsl:template match="*" mode="duplicate-heading-content">
|
|
5229
|
-
<xsl:param name="heading-stack"/>
|
|
5230
|
-
<xsl:variable name="show-number">
|
|
5231
|
-
<xsl:apply-templates select="." mode="duplicate-heading-show-number"/>
|
|
5232
|
-
</xsl:variable>
|
|
5233
|
-
<xsl:choose>
|
|
5234
|
-
<xsl:when test="$show-number = 'false'">
|
|
5235
|
-
<xsl:text>\textperiodcentered\space{}</xsl:text>
|
|
5236
|
-
</xsl:when>
|
|
5237
|
-
<xsl:otherwise>
|
|
5238
|
-
<xsl:apply-templates select="." mode="number" />
|
|
5239
|
-
<xsl:text>\space\textperiodcentered\space{}</xsl:text>
|
|
5240
|
-
</xsl:otherwise>
|
|
5241
|
-
</xsl:choose>
|
|
5242
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
5243
|
-
<!-- line break, but not on last -->
|
|
5244
|
-
<xsl:if test="count(descendant::*[count(.|$heading-stack) = count($heading-stack)]) > 0">
|
|
5245
|
-
<xsl:text>\\
</xsl:text>
|
|
5246
|
-
</xsl:if>
|
|
5247
|
-
</xsl:template>
|
|
5248
|
-
|
|
5249
|
-
<xsl:template name="get-heading-text-size">
|
|
5250
|
-
<xsl:param name="heading-level" select="6"/>
|
|
5251
|
-
<xsl:choose>
|
|
5252
|
-
<xsl:when test="$heading-level = 1">
|
|
5253
|
-
<xsl:text>\Huge</xsl:text>
|
|
5254
|
-
</xsl:when>
|
|
5255
|
-
<xsl:when test="$heading-level = 2">
|
|
5256
|
-
<xsl:text>\huge</xsl:text>
|
|
5257
|
-
</xsl:when>
|
|
5258
|
-
<xsl:when test="$heading-level = 3">
|
|
5259
|
-
<xsl:text>\Large</xsl:text>
|
|
5260
|
-
</xsl:when>
|
|
5261
|
-
<xsl:when test="$heading-level = 4">
|
|
5262
|
-
<xsl:text>\large</xsl:text>
|
|
5263
|
-
</xsl:when>
|
|
5264
|
-
<xsl:when test="$heading-level = 5">
|
|
5265
|
-
<xsl:text>\normalsize</xsl:text>
|
|
5266
|
-
</xsl:when>
|
|
5267
|
-
<xsl:otherwise>
|
|
5268
|
-
<xsl:text>\normalsize</xsl:text>
|
|
5269
|
-
</xsl:otherwise>
|
|
5270
|
-
</xsl:choose>
|
|
5271
|
-
</xsl:template>
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
3771
|
<!-- ############### -->
|
|
5276
3772
|
<!-- Arbitrary Lists -->
|
|
5277
3773
|
<!-- ############### -->
|
|
@@ -5354,13 +3850,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5354
3850
|
<xsl:template match="contributor">
|
|
5355
3851
|
<xsl:apply-templates select="." mode="label" />
|
|
5356
3852
|
<xsl:text>%
</xsl:text>
|
|
5357
|
-
<xsl:text>\
|
|
3853
|
+
<xsl:text>\ptxcontributor{</xsl:text>
|
|
5358
3854
|
<xsl:text>%
</xsl:text>
|
|
5359
|
-
<xsl:text>\
|
|
3855
|
+
<xsl:text>\ptxcontributorname{</xsl:text>
|
|
5360
3856
|
<xsl:apply-templates select="personname" />
|
|
5361
3857
|
<xsl:text>}%
</xsl:text>
|
|
5362
3858
|
<xsl:if test="affiliation|email">
|
|
5363
|
-
<xsl:text>\
|
|
3859
|
+
<xsl:text>\ptxcontributorinfo{</xsl:text>
|
|
5364
3860
|
<xsl:if test="affiliation/department">
|
|
5365
3861
|
<xsl:apply-templates select="affiliation/department" />
|
|
5366
3862
|
<xsl:if test="affiliation/department/following-sibling::*">
|
|
@@ -5384,7 +3880,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5384
3880
|
</xsl:if>
|
|
5385
3881
|
<xsl:if test="email">
|
|
5386
3882
|
<!-- switch to node-set with "c" if characters need escaping -->
|
|
5387
|
-
<xsl:text>\
|
|
3883
|
+
<xsl:text>\ptxmono{</xsl:text>
|
|
5388
3884
|
<xsl:apply-templates select="email" />
|
|
5389
3885
|
<xsl:text>}</xsl:text>
|
|
5390
3886
|
</xsl:if>
|
|
@@ -5394,98 +3890,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5394
3890
|
</xsl:template>
|
|
5395
3891
|
|
|
5396
3892
|
|
|
5397
|
-
<!-- #################### -->
|
|
5398
|
-
<!-- Back Matter, Letters -->
|
|
5399
|
-
<!-- #################### -->
|
|
5400
|
-
|
|
5401
|
-
<xsl:template match="letter/backmatter">
|
|
5402
|
-
<xsl:text>%
</xsl:text>
|
|
5403
|
-
<xsl:if test="closing">
|
|
5404
|
-
<xsl:text>\par
</xsl:text>
|
|
5405
|
-
<xsl:text>\vspace*{1.5\baselineskip}\noindent
</xsl:text>
|
|
5406
|
-
<xsl:text>\hspace{\stretch{2}}
</xsl:text>
|
|
5407
|
-
<xsl:text>\begin{tabular}{l@{}}
</xsl:text>
|
|
5408
|
-
<xsl:apply-templates select="closing" />
|
|
5409
|
-
<xsl:choose>
|
|
5410
|
-
<xsl:when test="graphic-signature">
|
|
5411
|
-
<xsl:text>\\[1ex]
</xsl:text>
|
|
5412
|
-
<xsl:text>\includegraphics[height=</xsl:text>
|
|
5413
|
-
<xsl:choose>
|
|
5414
|
-
<xsl:when test="graphic-signature/@height">
|
|
5415
|
-
<xsl:value-of select="graphic-signature/@height" />
|
|
5416
|
-
</xsl:when>
|
|
5417
|
-
<xsl:otherwise>24pt</xsl:otherwise>
|
|
5418
|
-
</xsl:choose>
|
|
5419
|
-
<xsl:text>]{</xsl:text>
|
|
5420
|
-
<xsl:value-of select="graphic-signature/@source" />
|
|
5421
|
-
<xsl:text>}\\[0.5ex]
</xsl:text>
|
|
5422
|
-
</xsl:when>
|
|
5423
|
-
<xsl:otherwise>
|
|
5424
|
-
<!-- About two blank lines for written signature -->
|
|
5425
|
-
<xsl:text>\\[5.5ex]
</xsl:text>
|
|
5426
|
-
</xsl:otherwise>
|
|
5427
|
-
</xsl:choose>
|
|
5428
|
-
<xsl:apply-templates select="signature/line" />
|
|
5429
|
-
<xsl:text>
\end{tabular}
</xsl:text>
|
|
5430
|
-
<xsl:text>\hspace{\stretch{1}}
</xsl:text>
|
|
5431
|
-
</xsl:if>
|
|
5432
|
-
<!-- Stretchy vertical space, useful if still on page 1 -->
|
|
5433
|
-
<xsl:text>\par\vspace*{\stretch{2}}
%
</xsl:text>
|
|
5434
|
-
</xsl:template>
|
|
5435
|
-
|
|
5436
|
-
<!-- Final line of signature get treated carefully above -->
|
|
5437
|
-
<xsl:template match="signature/line">
|
|
5438
|
-
<xsl:apply-templates/>
|
|
5439
|
-
<!-- is there a following line to separate? -->
|
|
5440
|
-
<xsl:if test="following-sibling::*">
|
|
5441
|
-
<xsl:text>\\
</xsl:text>
|
|
5442
|
-
</xsl:if>
|
|
5443
|
-
</xsl:template>
|
|
5444
|
-
|
|
5445
|
-
|
|
5446
|
-
<!-- ################## -->
|
|
5447
|
-
<!-- Back Matter, Memos -->
|
|
5448
|
-
<!-- ################## -->
|
|
5449
|
-
|
|
5450
|
-
<!-- No such thing yet -->
|
|
5451
|
-
<!-- TODO: add "cc" block like to/from -->
|
|
5452
|
-
<xsl:template match="memo/backmatter" />
|
|
5453
|
-
|
|
5454
|
-
|
|
5455
|
-
<!-- ####################### -->
|
|
5456
|
-
<!-- Logos (image placements) -->
|
|
5457
|
-
<!-- ####################### -->
|
|
5458
|
-
|
|
5459
|
-
<!-- Fine-grained placement of graphics files on pages -->
|
|
5460
|
-
<!-- May be placed anywhere on current page -->
|
|
5461
|
-
<!-- Page coordinates are measured in "true" points -->
|
|
5462
|
-
<!-- (72.27 points to the inch) -->
|
|
5463
|
-
<!-- (0,0) is the lower left corner of the page -->
|
|
5464
|
-
<!-- llx, lly: places lower-left corner of graphic -->
|
|
5465
|
-
<!-- at the specified coordinates of the page -->
|
|
5466
|
-
<!-- Use width, in fixed units (eg cm), to optionally scale -->
|
|
5467
|
-
<!-- pages='first|all' controls repetition, default: first -->
|
|
5468
|
-
<xsl:template match="docinfo/logo" >
|
|
5469
|
-
<xsl:text>\AddToShipoutPicture</xsl:text>
|
|
5470
|
-
<xsl:if test="not(@pages) or @pages='first'">
|
|
5471
|
-
<xsl:text>*</xsl:text>
|
|
5472
|
-
</xsl:if>
|
|
5473
|
-
<xsl:text>{\put(</xsl:text>
|
|
5474
|
-
<xsl:value-of select="@llx" />
|
|
5475
|
-
<xsl:text>,</xsl:text>
|
|
5476
|
-
<xsl:value-of select="@lly" />
|
|
5477
|
-
<xsl:text>){\includegraphics</xsl:text>
|
|
5478
|
-
<xsl:if test="@width">
|
|
5479
|
-
<xsl:text>[width=</xsl:text>
|
|
5480
|
-
<xsl:value-of select="@width" />
|
|
5481
|
-
<xsl:text>]</xsl:text>
|
|
5482
|
-
</xsl:if>
|
|
5483
|
-
<xsl:text>{</xsl:text>
|
|
5484
|
-
<xsl:value-of select="@source" />
|
|
5485
|
-
<xsl:text>}}}
</xsl:text>
|
|
5486
|
-
</xsl:template>
|
|
5487
|
-
|
|
5488
|
-
|
|
5489
3893
|
<!-- ################ -->
|
|
5490
3894
|
<!-- Structural Nodes -->
|
|
5491
3895
|
<!-- ################ -->
|
|
@@ -5730,6 +4134,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5730
4134
|
<xsl:text>{</xsl:text>
|
|
5731
4135
|
<xsl:apply-templates select="." mode="title-full" />
|
|
5732
4136
|
<xsl:text>}</xsl:text>
|
|
4137
|
+
<!-- an authored @xml:id suggests a cross-reference target -->
|
|
4138
|
+
<xsl:if test="@xml:id">
|
|
4139
|
+
<xsl:apply-templates select="." mode="label"/>
|
|
4140
|
+
</xsl:if>
|
|
5733
4141
|
<xsl:text>%
</xsl:text>
|
|
5734
4142
|
<xsl:apply-templates select="*"/>
|
|
5735
4143
|
<xsl:text>\end{introduction}%
</xsl:text>
|
|
@@ -5750,6 +4158,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5750
4158
|
<xsl:text>{</xsl:text>
|
|
5751
4159
|
<xsl:apply-templates select="." mode="title-full" />
|
|
5752
4160
|
<xsl:text>}</xsl:text>
|
|
4161
|
+
<!-- an authored @xml:id suggests a cross-reference target -->
|
|
4162
|
+
<xsl:if test="@xml:id">
|
|
4163
|
+
<xsl:apply-templates select="." mode="label"/>
|
|
4164
|
+
</xsl:if>
|
|
5753
4165
|
<xsl:text>%
</xsl:text>
|
|
5754
4166
|
<xsl:apply-templates select="*"/>
|
|
5755
4167
|
<xsl:text>\end{conclusion}%
</xsl:text>
|
|
@@ -5994,199 +4406,63 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
5994
4406
|
<xsl:text>\end{case}
</xsl:text>
|
|
5995
4407
|
</xsl:template>
|
|
5996
4408
|
|
|
5997
|
-
<!--
|
|
5998
|
-
<!--
|
|
5999
|
-
<!--
|
|
6000
|
-
|
|
6001
|
-
<!-- ############ -->
|
|
6002
|
-
<!-- Subexercises -->
|
|
6003
|
-
<!-- ############ -->
|
|
6004
|
-
|
|
6005
|
-
<!-- A minimal division within an "exercises" division. -->
|
|
4409
|
+
<!-- ####################################### -->
|
|
4410
|
+
<!-- Unimplemented Constructs, Warning Stubs -->
|
|
4411
|
+
<!-- ####################################### -->
|
|
6006
4412
|
|
|
6007
|
-
|
|
6008
|
-
|
|
6009
|
-
|
|
6010
|
-
|
|
6011
|
-
|
|
6012
|
-
|
|
6013
|
-
|
|
6014
|
-
|
|
6015
|
-
|
|
6016
|
-
|
|
6017
|
-
|
|
6018
|
-
|
|
6019
|
-
|
|
6020
|
-
|
|
6021
|
-
|
|
6022
|
-
|
|
6023
|
-
|
|
4413
|
+
<!-- The LaTeX realization of "subexercises" and "exercisegroup" -->
|
|
4414
|
+
<!-- structure within an "exercises" division, and of the content -->
|
|
4415
|
+
<!-- generated for a "solutions" division, lives in pretext-latex.xsl. -->
|
|
4416
|
+
<!-- A conversion importing this stylesheet directly does not -->
|
|
4417
|
+
<!-- implement these constructs, yet shared machinery (the structural -->
|
|
4418
|
+
<!-- dispatch above, the solutions generator of pretext-common.xsl) -->
|
|
4419
|
+
<!-- may still apply templates to them. Each template below catches -->
|
|
4420
|
+
<!-- one such application, alerts the author, and contributes nothing -->
|
|
4421
|
+
<!-- to the output; otherwise the XSLT built-in rules would dump raw -->
|
|
4422
|
+
<!-- text into the LaTeX. The real templates in pretext-latex.xsl -->
|
|
4423
|
+
<!-- override each of these stubs by import precedence. (The classic -->
|
|
4424
|
+
<!-- conversion, and texstyle importing it, intercept the containing -->
|
|
4425
|
+
<!-- divisions with banner warnings, so these stubs serve future -->
|
|
4426
|
+
<!-- conversions without such guards.) -->
|
|
4427
|
+
|
|
4428
|
+
<!-- Generic processing of an "exercises" division reaches these -->
|
|
4429
|
+
<xsl:template match="subexercises|exercisegroup">
|
|
4430
|
+
<xsl:message>
|
|
4431
|
+
<xsl:text>PTX:WARNING: this conversion does not implement "</xsl:text>
|
|
4432
|
+
<xsl:value-of select="local-name(.)"/>
|
|
4433
|
+
<xsl:text>" structure within an "exercises" division, so its content will be missing from your LaTeX output</xsl:text>
|
|
4434
|
+
</xsl:message>
|
|
4435
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
6024
4436
|
</xsl:template>
|
|
6025
4437
|
|
|
6026
|
-
<!-- The
|
|
6027
|
-
|
|
6028
|
-
<xsl:
|
|
6029
|
-
|
|
6030
|
-
|
|
6031
|
-
|
|
6032
|
-
|
|
6033
|
-
|
|
6034
|
-
<!-- keep optional title if LaTeX source is re-purposed -->
|
|
6035
|
-
<xsl:text>[{</xsl:text>
|
|
6036
|
-
<xsl:apply-templates select="." mode="title-short" />
|
|
6037
|
-
<xsl:text>}]</xsl:text>
|
|
6038
|
-
<xsl:text>{</xsl:text>
|
|
6039
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
6040
|
-
<xsl:text>}</xsl:text>
|
|
6041
|
-
<!-- no label, as this is a duplicate -->
|
|
6042
|
-
<!-- no title, no heading, so only line-break here -->
|
|
6043
|
-
<xsl:text>
</xsl:text>
|
|
6044
|
-
</xsl:if>
|
|
6045
|
-
<xsl:if test="$b-has-statement">
|
|
6046
|
-
<xsl:apply-templates select="introduction" />
|
|
6047
|
-
</xsl:if>
|
|
6048
|
-
<xsl:copy-of select="$content"/>
|
|
6049
|
-
<xsl:if test="$b-has-statement">
|
|
6050
|
-
<xsl:apply-templates select="conclusion" />
|
|
6051
|
-
</xsl:if>
|
|
6052
|
-
<xsl:text>\par\medskip\noindent
</xsl:text>
|
|
4438
|
+
<!-- The solutions generator duplicates headings of intervening divisions -->
|
|
4439
|
+
<xsl:template match="*" mode="duplicate-heading">
|
|
4440
|
+
<xsl:message>
|
|
4441
|
+
<xsl:text>PTX:WARNING: this conversion does not implement a "solutions" division, so a heading duplicated from the "</xsl:text>
|
|
4442
|
+
<xsl:value-of select="local-name(.)"/>
|
|
4443
|
+
<xsl:text>" will be missing from your LaTeX output</xsl:text>
|
|
4444
|
+
</xsl:message>
|
|
4445
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
6053
4446
|
</xsl:template>
|
|
6054
4447
|
|
|
6055
|
-
<!--
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
|
|
6060
|
-
|
|
6061
|
-
|
|
6062
|
-
|
|
6063
|
-
|
|
6064
|
-
<xsl:template match="exercisegroup">
|
|
6065
|
-
<!-- Determine the number of columns -->
|
|
6066
|
-
<!-- Restrict to 1-6 via the schema -->
|
|
6067
|
-
<xsl:variable name="ncols">
|
|
6068
|
-
<xsl:choose>
|
|
6069
|
-
<xsl:when test="@cols">
|
|
6070
|
-
<xsl:value-of select="@cols"/>
|
|
6071
|
-
</xsl:when>
|
|
6072
|
-
<xsl:otherwise>
|
|
6073
|
-
<xsl:text>1</xsl:text>
|
|
6074
|
-
</xsl:otherwise>
|
|
6075
|
-
</xsl:choose>
|
|
6076
|
-
</xsl:variable>
|
|
6077
|
-
<!-- build it -->
|
|
6078
|
-
<xsl:apply-templates select="." mode="newpage"/>
|
|
6079
|
-
<xsl:text>\par\medskip\noindent%
</xsl:text>
|
|
6080
|
-
<xsl:text>\textbf{</xsl:text>
|
|
6081
|
-
<!-- title may be default title -->
|
|
6082
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
6083
|
-
<xsl:text>}\space\space</xsl:text>
|
|
6084
|
-
<xsl:apply-templates select="." mode="optional-label"/>
|
|
6085
|
-
<xsl:text>%
</xsl:text>
|
|
6086
|
-
<xsl:apply-templates select="introduction" />
|
|
6087
|
-
<xsl:choose>
|
|
6088
|
-
<xsl:when test="$ncols = 1">
|
|
6089
|
-
<xsl:text>\begin{exercisegroup}
</xsl:text>
|
|
6090
|
-
</xsl:when>
|
|
6091
|
-
<xsl:otherwise>
|
|
6092
|
-
<xsl:text>\begin{exercisegroupcol}</xsl:text>
|
|
6093
|
-
<xsl:text>{</xsl:text>
|
|
6094
|
-
<xsl:value-of select="$ncols"/>
|
|
6095
|
-
<xsl:text>}
</xsl:text>
|
|
6096
|
-
</xsl:otherwise>
|
|
6097
|
-
</xsl:choose>
|
|
6098
|
-
<!-- Each "idx" produces its own newline -->
|
|
6099
|
-
<xsl:apply-templates select="idx"/>
|
|
6100
|
-
<!-- an exercisegroup can only appear in an "exercises" division, -->
|
|
6101
|
-
<!-- the template for exercises//exercise will consult switches for -->
|
|
6102
|
-
<!-- visibility of components when born (not doing "solutions" here) -->
|
|
6103
|
-
<xsl:apply-templates select="exercise"/>
|
|
6104
|
-
<xsl:choose>
|
|
6105
|
-
<xsl:when test="$ncols = 1">
|
|
6106
|
-
<xsl:text>\end{exercisegroup}
</xsl:text>
|
|
6107
|
-
</xsl:when>
|
|
6108
|
-
<xsl:otherwise>
|
|
6109
|
-
<xsl:text>\end{exercisegroupcol}
</xsl:text>
|
|
6110
|
-
</xsl:otherwise>
|
|
6111
|
-
</xsl:choose>
|
|
6112
|
-
<xsl:if test="conclusion">
|
|
6113
|
-
<xsl:text>\par\noindent%
</xsl:text>
|
|
6114
|
-
<xsl:apply-templates select="conclusion" />
|
|
6115
|
-
</xsl:if>
|
|
6116
|
-
<xsl:text>\par\medskip\noindent
</xsl:text>
|
|
6117
|
-
</xsl:template>
|
|
6118
|
-
|
|
6119
|
-
<!-- Exercise Group (in solutions division) -->
|
|
6120
|
-
<!-- Nothing produced if there is no content -->
|
|
6121
|
-
<!-- Otherwise, no label, since duplicate -->
|
|
6122
|
-
<!-- Introduction and conclusion iff with statements -->
|
|
6123
|
-
<!-- Echoed in a "solutions" division; the generic driver in -->
|
|
6124
|
-
<!-- pretext-common.xsl decides if anything appears at all, and -->
|
|
6125
|
-
<!-- renders the items; the wrapping here -->
|
|
6126
|
-
<xsl:template match="exercisegroup" mode="present-solutions-container">
|
|
6127
|
-
<xsl:param name="b-has-statement"/>
|
|
6128
|
-
<xsl:param name="content"/>
|
|
4448
|
+
<!-- The solutions generator wraps duplicated container structure -->
|
|
4449
|
+
<xsl:template match="subexercises|exercisegroup" mode="present-solutions-container">
|
|
4450
|
+
<xsl:message>
|
|
4451
|
+
<xsl:text>PTX:WARNING: this conversion does not implement a "solutions" division, so content duplicated within the "</xsl:text>
|
|
4452
|
+
<xsl:value-of select="local-name(.)"/>
|
|
4453
|
+
<xsl:text>" will be missing from your LaTeX output</xsl:text>
|
|
4454
|
+
</xsl:message>
|
|
4455
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
4456
|
+
</xsl:template>
|
|
6129
4457
|
|
|
6130
|
-
|
|
6131
|
-
|
|
6132
|
-
|
|
6133
|
-
|
|
6134
|
-
<xsl:
|
|
6135
|
-
|
|
6136
|
-
|
|
6137
|
-
|
|
6138
|
-
<xsl:when test="@cols">
|
|
6139
|
-
<xsl:value-of select="@cols"/>
|
|
6140
|
-
</xsl:when>
|
|
6141
|
-
<xsl:otherwise>
|
|
6142
|
-
<xsl:text>1</xsl:text>
|
|
6143
|
-
</xsl:otherwise>
|
|
6144
|
-
</xsl:choose>
|
|
6145
|
-
</xsl:variable>
|
|
6146
|
-
<xsl:if test="title">
|
|
6147
|
-
<xsl:text>\subparagraph</xsl:text>
|
|
6148
|
-
<!-- keep optional title if LaTeX source is re-purposed -->
|
|
6149
|
-
<xsl:text>[{</xsl:text>
|
|
6150
|
-
<xsl:apply-templates select="." mode="title-short" />
|
|
6151
|
-
<xsl:text>}]</xsl:text>
|
|
6152
|
-
<xsl:text>{</xsl:text>
|
|
6153
|
-
<xsl:apply-templates select="." mode="title-full" />
|
|
6154
|
-
<xsl:text>}</xsl:text>
|
|
6155
|
-
<!-- no label, as this is a duplicate -->
|
|
6156
|
-
<!-- no title, no heading, so only line-break here -->
|
|
6157
|
-
<xsl:text>
</xsl:text>
|
|
6158
|
-
</xsl:if>
|
|
6159
|
-
<xsl:if test="$b-has-statement">
|
|
6160
|
-
<xsl:apply-templates select="introduction" />
|
|
6161
|
-
</xsl:if>
|
|
6162
|
-
<!-- the container for the exercisegroup does not need to change -->
|
|
6163
|
-
<!-- when in a solutions list. The indentation might look odd -->
|
|
6164
|
-
<!-- without an introduction (when there are no statements), or -->
|
|
6165
|
-
<!-- it might remind the reader of the grouping -->
|
|
6166
|
-
<xsl:choose>
|
|
6167
|
-
<xsl:when test="$ncols = 1">
|
|
6168
|
-
<xsl:text>\begin{exercisegroup}
</xsl:text>
|
|
6169
|
-
</xsl:when>
|
|
6170
|
-
<xsl:otherwise>
|
|
6171
|
-
<xsl:text>\begin{exercisegroupcol}</xsl:text>
|
|
6172
|
-
<xsl:text>{</xsl:text>
|
|
6173
|
-
<xsl:value-of select="$ncols"/>
|
|
6174
|
-
<xsl:text>}
</xsl:text>
|
|
6175
|
-
</xsl:otherwise>
|
|
6176
|
-
</xsl:choose>
|
|
6177
|
-
<xsl:copy-of select="$content"/>
|
|
6178
|
-
<xsl:choose>
|
|
6179
|
-
<xsl:when test="$ncols = 1">
|
|
6180
|
-
<xsl:text>\end{exercisegroup}
</xsl:text>
|
|
6181
|
-
</xsl:when>
|
|
6182
|
-
<xsl:otherwise>
|
|
6183
|
-
<xsl:text>\end{exercisegroupcol}
</xsl:text>
|
|
6184
|
-
</xsl:otherwise>
|
|
6185
|
-
</xsl:choose>
|
|
6186
|
-
<xsl:if test="$b-has-statement">
|
|
6187
|
-
<xsl:apply-templates select="conclusion" />
|
|
6188
|
-
</xsl:if>
|
|
6189
|
-
<xsl:text>\par\medskip\noindent
</xsl:text>
|
|
4458
|
+
<!-- The solutions generator duplicates components of exercises and projects -->
|
|
4459
|
+
<xsl:template match="exercise|&PROJECT-LIKE;" mode="solutions">
|
|
4460
|
+
<xsl:message>
|
|
4461
|
+
<xsl:text>PTX:WARNING: this conversion does not implement a "solutions" division, so components duplicated from an exercise or project ("</xsl:text>
|
|
4462
|
+
<xsl:value-of select="local-name(.)"/>
|
|
4463
|
+
<xsl:text>") will be missing from your LaTeX output</xsl:text>
|
|
4464
|
+
</xsl:message>
|
|
4465
|
+
<xsl:apply-templates select="." mode="location-report"/>
|
|
6190
4466
|
</xsl:template>
|
|
6191
4467
|
|
|
6192
4468
|
<!-- ###################### -->
|
|
@@ -6364,159 +4640,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6364
4640
|
</xsl:if>
|
|
6365
4641
|
</xsl:template>
|
|
6366
4642
|
|
|
6367
|
-
<!-- ############################################## -->
|
|
6368
|
-
<!-- Exercises and Projects for Solutions Divisions -->
|
|
6369
|
-
<!-- ############################################## -->
|
|
6370
|
-
|
|
6371
|
-
<!-- A template formulates the various possible environments -->
|
|
6372
|
-
<!-- Just as above, but now a different mode -->
|
|
6373
|
-
<xsl:template match="exercise|&PROJECT-LIKE;" mode="solutions-environment-name">
|
|
6374
|
-
<xsl:choose>
|
|
6375
|
-
<!-- projects sit in divisions according to schema, -->
|
|
6376
|
-
<!-- just like inline exercises, so we catch them -->
|
|
6377
|
-
<!-- first, before differentiating exercises based -->
|
|
6378
|
-
<!-- on placement, just recycle PreTeXt element name -->
|
|
6379
|
-
<xsl:when test="&PROJECT-FILTER;">
|
|
6380
|
-
<xsl:value-of select="local-name(.)" />
|
|
6381
|
-
<xsl:text>solution</xsl:text>
|
|
6382
|
-
</xsl:when>
|
|
6383
|
-
<!-- must now be an "exercise" -->
|
|
6384
|
-
<xsl:when test="&INLINE-EXERCISE-FILTER;">
|
|
6385
|
-
<xsl:text>inlinesolution</xsl:text>
|
|
6386
|
-
</xsl:when>
|
|
6387
|
-
<xsl:when test="ancestor::exercises or ancestor::worksheet or ancestor::reading-questions">
|
|
6388
|
-
<xsl:text>divisionsolution</xsl:text>
|
|
6389
|
-
<!-- "exercisegroup" and "exercisegroup/@cols" become -->
|
|
6390
|
-
<!-- progressively more complicated to organize -->
|
|
6391
|
-
<xsl:if test="ancestor::exercisegroup">
|
|
6392
|
-
<xsl:text>eg</xsl:text>
|
|
6393
|
-
</xsl:if>
|
|
6394
|
-
<xsl:if test="ancestor::exercisegroup/@cols">
|
|
6395
|
-
<xsl:text>col</xsl:text>
|
|
6396
|
-
</xsl:if>
|
|
6397
|
-
</xsl:when>
|
|
6398
|
-
<xsl:otherwise>
|
|
6399
|
-
<xsl:text>exercise-solution-without-environment-name</xsl:text>
|
|
6400
|
-
</xsl:otherwise>
|
|
6401
|
-
</xsl:choose>
|
|
6402
|
-
</xsl:template>
|
|
6403
|
-
|
|
6404
|
-
<!-- Exercises and projects (as above) in solutions-->
|
|
6405
|
-
<!-- Nothing produced if there is no content -->
|
|
6406
|
-
<!-- Otherwise, no label, since duplicate -->
|
|
6407
|
-
<!-- Different environment, with hard-coded number -->
|
|
6408
|
-
<!-- Switches for solutions are generated -->
|
|
6409
|
-
<!-- elsewhere and always supplied in call -->
|
|
6410
|
-
<!-- NB: switches originate in solutions generator -->
|
|
6411
|
-
<xsl:template match="exercise[boolean(&INLINE-EXERCISE-FILTER;)]|&PROJECT-LIKE;|exercises//exercise|worksheet//exercise|reading-questions//exercise" mode="solutions">
|
|
6412
|
-
<xsl:param name="purpose"/>
|
|
6413
|
-
<xsl:param name="admit"/>
|
|
6414
|
-
<xsl:param name="b-component-heading"/>
|
|
6415
|
-
<xsl:param name="b-has-statement" />
|
|
6416
|
-
<xsl:param name="b-has-hint" />
|
|
6417
|
-
<xsl:param name="b-has-answer" />
|
|
6418
|
-
<xsl:param name="b-has-solution" />
|
|
6419
|
-
|
|
6420
|
-
<!-- Subsetting, especially in the back matter can yield no content at all -->
|
|
6421
|
-
<!-- Schema says there is always some sort of statement, explicit or implicit -->
|
|
6422
|
-
<!-- We frequently build collections of "dry-run" output to determine if a -->
|
|
6423
|
-
<!-- collection of exercises (e.g. in an "exercisegroup") is empty or not. -->
|
|
6424
|
-
<!-- So it is *critical* that we get zero output for an exercise that has -->
|
|
6425
|
-
<!-- no content due to settings of switches. -->
|
|
6426
|
-
|
|
6427
|
-
<xsl:variable name="dry-run">
|
|
6428
|
-
<xsl:apply-templates select="." mode="dry-run">
|
|
6429
|
-
<xsl:with-param name="admit" select="$admit"/>
|
|
6430
|
-
<xsl:with-param name="b-has-statement" select="$b-has-statement" />
|
|
6431
|
-
<xsl:with-param name="b-has-hint" select="$b-has-hint" />
|
|
6432
|
-
<xsl:with-param name="b-has-answer" select="$b-has-answer" />
|
|
6433
|
-
<xsl:with-param name="b-has-solution" select="$b-has-solution" />
|
|
6434
|
-
</xsl:apply-templates>
|
|
6435
|
-
</xsl:variable>
|
|
6436
|
-
|
|
6437
|
-
<xsl:if test="not($dry-run = '')">
|
|
6438
|
-
<!-- no project-like prelude, as duplicating in solutions division -->
|
|
6439
|
-
<!-- The exact environment depends on the placement of the -->
|
|
6440
|
-
<!-- "exercise" when located in an "exercises" division -->
|
|
6441
|
-
<xsl:variable name="env-name">
|
|
6442
|
-
<xsl:apply-templates select="." mode="solutions-environment-name"/>
|
|
6443
|
-
</xsl:variable>
|
|
6444
|
-
<xsl:text>\begin{</xsl:text>
|
|
6445
|
-
<xsl:value-of select="$env-name"/>
|
|
6446
|
-
<xsl:text>}</xsl:text>
|
|
6447
|
-
<!-- Always supply a type-name, even if the -->
|
|
6448
|
-
<!-- receiving environment does not utilize it. -->
|
|
6449
|
-
<!-- Five categories, four are "exercise". -->
|
|
6450
|
-
<xsl:text>{</xsl:text>
|
|
6451
|
-
<xsl:choose>
|
|
6452
|
-
<!--divisional exercise -->
|
|
6453
|
-
<xsl:when test="self::exercise and ancestor::exercises">
|
|
6454
|
-
<xsl:apply-templates select="." mode="type-name">
|
|
6455
|
-
<xsl:with-param name="string-id" select="'divisionalexercise'"/>
|
|
6456
|
-
</xsl:apply-templates>
|
|
6457
|
-
</xsl:when>
|
|
6458
|
-
<!-- worksheet exercise -->
|
|
6459
|
-
<xsl:when test="self::exercise and ancestor::worksheet">
|
|
6460
|
-
<xsl:apply-templates select="." mode="type-name">
|
|
6461
|
-
<xsl:with-param name="string-id" select="'worksheetexercise'"/>
|
|
6462
|
-
</xsl:apply-templates>
|
|
6463
|
-
</xsl:when>
|
|
6464
|
-
<!-- reading question -->
|
|
6465
|
-
<xsl:when test="self::exercise and ancestor::reading-questions">
|
|
6466
|
-
<xsl:apply-templates select="." mode="type-name">
|
|
6467
|
-
<xsl:with-param name="string-id" select="'readingquestion'"/>
|
|
6468
|
-
</xsl:apply-templates>
|
|
6469
|
-
</xsl:when>
|
|
6470
|
-
<!-- inline exercise ("Checkpoint") by elimination -->
|
|
6471
|
-
<xsl:when test="self::exercise">
|
|
6472
|
-
<xsl:apply-templates select="." mode="type-name">
|
|
6473
|
-
<xsl:with-param name="string-id" select="'inlineexercise'"/>
|
|
6474
|
-
</xsl:apply-templates>
|
|
6475
|
-
</xsl:when>
|
|
6476
|
-
<!-- now PROJECT-LIKE by elimination, don't need $string-id -->
|
|
6477
|
-
<xsl:otherwise>
|
|
6478
|
-
<xsl:apply-templates select="." mode="type-name"/>
|
|
6479
|
-
</xsl:otherwise>
|
|
6480
|
-
</xsl:choose>
|
|
6481
|
-
<xsl:text>}</xsl:text>
|
|
6482
|
-
<!-- Always a hard-coded full number, never any workspace -->
|
|
6483
|
-
<!-- indication, so unified across the four types -->
|
|
6484
|
-
<xsl:text>{</xsl:text>
|
|
6485
|
-
<xsl:apply-templates select="." mode="number" />
|
|
6486
|
-
<xsl:text>}</xsl:text>
|
|
6487
|
-
<xsl:text>{</xsl:text>
|
|
6488
|
-
<xsl:apply-templates select="." mode="title-full"/>
|
|
6489
|
-
<xsl:text>}</xsl:text>
|
|
6490
|
-
<!-- label of the exercise, to link back to it -->
|
|
6491
|
-
<xsl:text>{</xsl:text>
|
|
6492
|
-
<xsl:apply-templates select="." mode="unique-id"/>
|
|
6493
|
-
<xsl:text>}</xsl:text>
|
|
6494
|
-
<xsl:text>%
</xsl:text>
|
|
6495
|
-
<!-- Now the guts of the exercise, inside of its -->
|
|
6496
|
-
<!-- (variable) identification, environment, etc. -->
|
|
6497
|
-
<!-- NB: this is where we say goodbye to the -->
|
|
6498
|
-
<!-- "solutions" modal templates and switch to -->
|
|
6499
|
-
<!-- the "exercise-components"templates with the -->
|
|
6500
|
-
<!-- $b-original flag. -->
|
|
6501
|
-
<xsl:apply-templates select="." mode="exercise-components">
|
|
6502
|
-
<xsl:with-param name="b-original" select="false()" />
|
|
6503
|
-
<xsl:with-param name="purpose" select="$purpose" />
|
|
6504
|
-
<xsl:with-param name="b-component-heading" select="$b-component-heading"/>
|
|
6505
|
-
<xsl:with-param name="b-has-statement" select="$b-has-statement" />
|
|
6506
|
-
<xsl:with-param name="b-has-hint" select="$b-has-hint" />
|
|
6507
|
-
<xsl:with-param name="b-has-answer" select="$b-has-answer" />
|
|
6508
|
-
<xsl:with-param name="b-has-solution" select="$b-has-solution" />
|
|
6509
|
-
</xsl:apply-templates>
|
|
6510
|
-
<!-- closing % necessary, as newline between adjacent environments -->
|
|
6511
|
-
<!-- will cause a slight indent on trailing exercise -->
|
|
6512
|
-
<xsl:text>\end{</xsl:text>
|
|
6513
|
-
<xsl:value-of select="$env-name"/>
|
|
6514
|
-
<xsl:text>}%
</xsl:text>
|
|
6515
|
-
<!-- no project-like postlude, as duplicating in solutions division -->
|
|
6516
|
-
</xsl:if>
|
|
6517
|
-
</xsl:template>
|
|
6518
|
-
|
|
6519
|
-
|
|
6520
4643
|
<!-- ######################### -->
|
|
6521
4644
|
<!-- Components of an Exercise -->
|
|
6522
4645
|
<!-- ######################### -->
|
|
@@ -6631,7 +4754,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
6631
4754
|
<!-- Something is being output, so include an (optional) title -->
|
|
6632
4755
|
<!-- Semantic macro defined in preamble, mostly for font change -->
|
|
6633
4756
|
<xsl:if test="title">
|
|
6634
|
-
<xsl:text>\
|
|
4757
|
+
<xsl:text>\ptxlititle{</xsl:text>
|
|
6635
4758
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
6636
4759
|
<xsl:text>}\par%
</xsl:text>
|
|
6637
4760
|
</xsl:if>
|
|
@@ -7138,7 +5261,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7138
5261
|
</xsl:choose>
|
|
7139
5262
|
<!-- Semantic macro defined in preamble, mostly for font change -->
|
|
7140
5263
|
<xsl:if test="title">
|
|
7141
|
-
<xsl:text>\
|
|
5264
|
+
<xsl:text>\ptxlititle{</xsl:text>
|
|
7142
5265
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
7143
5266
|
<xsl:text>}\par%
</xsl:text>
|
|
7144
5267
|
</xsl:if>
|
|
@@ -7650,7 +5773,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7650
5773
|
<!-- "title" only possible for structured version of a list item -->
|
|
7651
5774
|
<!-- Semantic macro defined in preamble, mostly for font change -->
|
|
7652
5775
|
<xsl:if test="title">
|
|
7653
|
-
<xsl:text>\
|
|
5776
|
+
<xsl:text>\ptxlititle{</xsl:text>
|
|
7654
5777
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
7655
5778
|
<xsl:text>}\par%
</xsl:text>
|
|
7656
5779
|
</xsl:if>
|
|
@@ -7668,7 +5791,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7668
5791
|
<!-- "title" only possible for structured version of a list item -->
|
|
7669
5792
|
<!-- Semantic macro defined in preamble, mostly for font change -->
|
|
7670
5793
|
<xsl:if test="title">
|
|
7671
|
-
<xsl:text>\
|
|
5794
|
+
<xsl:text>\ptxlititle{</xsl:text>
|
|
7672
5795
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
7673
5796
|
<xsl:text>}\par%
</xsl:text>
|
|
7674
5797
|
</xsl:if>
|
|
@@ -7721,7 +5844,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7721
5844
|
<!-- https://musescore.org/user/{usernumber}/scores/{scorenumber}/embed -->
|
|
7722
5845
|
<!-- into an iframe with width and height (todo) -->
|
|
7723
5846
|
<xsl:template match="score[@musescoreuser and @musescore]">
|
|
7724
|
-
<xsl:text>[\
|
|
5847
|
+
<xsl:text>[\ptxmono{\nolinkurl{https://musescore.org/user/</xsl:text>
|
|
7725
5848
|
<xsl:value-of select="@musescoreuser" />
|
|
7726
5849
|
<xsl:text>/scores/</xsl:text>
|
|
7727
5850
|
<xsl:value-of select="@musescore" />
|
|
@@ -7815,7 +5938,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7815
5938
|
<xsl:text>\nopagebreak\par%
</xsl:text>
|
|
7816
5939
|
<xsl:text>\hfill</xsl:text>
|
|
7817
5940
|
<xsl:if test="parent::blockquote">
|
|
7818
|
-
<xsl:call-template name="
|
|
5941
|
+
<xsl:call-template name="character">
|
|
5942
|
+
<xsl:with-param name="name" select="'mdash'"/>
|
|
5943
|
+
</xsl:call-template>
|
|
7819
5944
|
<!-- remove the left-side column spacing -->
|
|
7820
5945
|
<xsl:text>{\setlength{\tabcolsep}{0pt}</xsl:text>
|
|
7821
5946
|
</xsl:if>
|
|
@@ -7845,59 +5970,59 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7845
5970
|
</xsl:template>
|
|
7846
5971
|
|
|
7847
5972
|
<!-- Alert -->
|
|
7848
|
-
<!-- \
|
|
5973
|
+
<!-- \ptxalert{} defined in preamble as semantic macro -->
|
|
7849
5974
|
<xsl:template match="alert">
|
|
7850
|
-
<xsl:text>\
|
|
5975
|
+
<xsl:text>\ptxalert{</xsl:text>
|
|
7851
5976
|
<xsl:apply-templates/>
|
|
7852
5977
|
<xsl:text>}</xsl:text>
|
|
7853
5978
|
</xsl:template>
|
|
7854
5979
|
|
|
7855
5980
|
<!-- Insert (an edit) -->
|
|
7856
|
-
<!-- \
|
|
5981
|
+
<!-- \ptxinserted{} defined in preamble as semantic macro -->
|
|
7857
5982
|
<xsl:template match="insert">
|
|
7858
|
-
<xsl:text>\
|
|
5983
|
+
<xsl:text>\ptxinserted{</xsl:text>
|
|
7859
5984
|
<xsl:apply-templates/>
|
|
7860
5985
|
<xsl:text>}</xsl:text>
|
|
7861
5986
|
</xsl:template>
|
|
7862
5987
|
<!-- Protect the version of the macro appearing in titles -->
|
|
7863
5988
|
<xsl:template match="title//insert|shortitle//insert">
|
|
7864
|
-
<xsl:text>\protect\
|
|
5989
|
+
<xsl:text>\protect\ptxinserted{</xsl:text>
|
|
7865
5990
|
<xsl:apply-templates/>
|
|
7866
5991
|
<xsl:text>}</xsl:text>
|
|
7867
5992
|
</xsl:template>
|
|
7868
5993
|
|
|
7869
5994
|
<!-- Delete (an edit) -->
|
|
7870
|
-
<!-- \
|
|
5995
|
+
<!-- \ptxdeleted{} defined in preamble as semantic macro -->
|
|
7871
5996
|
<xsl:template match="delete">
|
|
7872
|
-
<xsl:text>\
|
|
5997
|
+
<xsl:text>\ptxdeleted{</xsl:text>
|
|
7873
5998
|
<xsl:apply-templates/>
|
|
7874
5999
|
<xsl:text>}</xsl:text>
|
|
7875
6000
|
</xsl:template>
|
|
7876
6001
|
<!-- Protect the version of the macro appearing in titles -->
|
|
7877
6002
|
<xsl:template match="title//delete|shortitle//delete">
|
|
7878
|
-
<xsl:text>\protect\
|
|
6003
|
+
<xsl:text>\protect\ptxdeleted{</xsl:text>
|
|
7879
6004
|
<xsl:apply-templates/>
|
|
7880
6005
|
<xsl:text>}</xsl:text>
|
|
7881
6006
|
</xsl:template>
|
|
7882
6007
|
|
|
7883
6008
|
<!-- Stale (no longer relevant) -->
|
|
7884
|
-
<!-- \
|
|
6009
|
+
<!-- \ptxstale{} defined in preamble as semantic macro -->
|
|
7885
6010
|
<xsl:template match="stale">
|
|
7886
|
-
<xsl:text>\
|
|
6011
|
+
<xsl:text>\ptxstale{</xsl:text>
|
|
7887
6012
|
<xsl:apply-templates/>
|
|
7888
6013
|
<xsl:text>}</xsl:text>
|
|
7889
6014
|
</xsl:template>
|
|
7890
6015
|
<!-- Protect the version of the macro appearing in titles -->
|
|
7891
6016
|
<xsl:template match="title//stale|shorttitle//stale">
|
|
7892
|
-
<xsl:text>\protect\
|
|
6017
|
+
<xsl:text>\protect\ptxstale{</xsl:text>
|
|
7893
6018
|
<xsl:apply-templates/>
|
|
7894
6019
|
<xsl:text>}</xsl:text>
|
|
7895
6020
|
</xsl:template>
|
|
7896
6021
|
|
|
7897
6022
|
<!-- Term (defined terms) -->
|
|
7898
|
-
<!-- \
|
|
6023
|
+
<!-- \ptxterminology{} defined in preamble as semantic macro -->
|
|
7899
6024
|
<xsl:template match="term">
|
|
7900
|
-
<xsl:text>\
|
|
6025
|
+
<xsl:text>\ptxterminology{</xsl:text>
|
|
7901
6026
|
<xsl:apply-templates/>
|
|
7902
6027
|
<xsl:text>}</xsl:text>
|
|
7903
6028
|
</xsl:template>
|
|
@@ -7912,19 +6037,19 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
7912
6037
|
<!-- if next char is a char, use macro for .\@ -->
|
|
7913
6038
|
<!-- BUT if new sentence, then just leave the period alone -->
|
|
7914
6039
|
<xsl:template match="abbr">
|
|
7915
|
-
<xsl:text>\
|
|
6040
|
+
<xsl:text>\ptxabbreviation{</xsl:text>
|
|
7916
6041
|
<xsl:apply-templates/>
|
|
7917
6042
|
<xsl:text>}</xsl:text>
|
|
7918
6043
|
</xsl:template>
|
|
7919
6044
|
|
|
7920
6045
|
<xsl:template match="acro">
|
|
7921
|
-
<xsl:text>\
|
|
6046
|
+
<xsl:text>\ptxacronym{</xsl:text>
|
|
7922
6047
|
<xsl:apply-templates/>
|
|
7923
6048
|
<xsl:text>}</xsl:text>
|
|
7924
6049
|
</xsl:template>
|
|
7925
6050
|
|
|
7926
6051
|
<xsl:template match="init">
|
|
7927
|
-
<xsl:text>\
|
|
6052
|
+
<xsl:text>\ptxinitialism{</xsl:text>
|
|
7928
6053
|
<xsl:apply-templates/>
|
|
7929
6054
|
<xsl:text>}</xsl:text>
|
|
7930
6055
|
</xsl:template>
|
|
@@ -8021,12 +6146,12 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8021
6146
|
<!-- "\nolinkurl{}" else the *.out file gets messed up -->
|
|
8022
6147
|
<!-- (PDF bookmarks?) -->
|
|
8023
6148
|
<xsl:when test="@visual">
|
|
8024
|
-
<xsl:text>\
|
|
6149
|
+
<xsl:text>\ptxmono{</xsl:text>
|
|
8025
6150
|
<xsl:value-of select="@visual"/>
|
|
8026
6151
|
<xsl:text>}</xsl:text>
|
|
8027
6152
|
</xsl:when>
|
|
8028
6153
|
<xsl:otherwise>
|
|
8029
|
-
<xsl:text>\
|
|
6154
|
+
<xsl:text>\ptxmono{</xsl:text>
|
|
8030
6155
|
<xsl:value-of select="$uri"/>
|
|
8031
6156
|
<xsl:text>}</xsl:text>
|
|
8032
6157
|
</xsl:otherwise>
|
|
@@ -8044,7 +6169,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8044
6169
|
<!-- the visible clickable -->
|
|
8045
6170
|
<xsl:text>{</xsl:text>
|
|
8046
6171
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
8047
|
-
<xsl:text>\
|
|
6172
|
+
<xsl:text>\ptxlinkhilite{</xsl:text>
|
|
8048
6173
|
</xsl:if>
|
|
8049
6174
|
<xsl:copy-of select="$visible-text"/>
|
|
8050
6175
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
@@ -8083,7 +6208,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8083
6208
|
<xsl:template name="code-wrapper">
|
|
8084
6209
|
<xsl:param name="content"/>
|
|
8085
6210
|
|
|
8086
|
-
<xsl:text>\
|
|
6211
|
+
<xsl:text>\ptxmono{</xsl:text>
|
|
8087
6212
|
<xsl:call-template name="escape-text-to-latex">
|
|
8088
6213
|
<xsl:with-param name="text" select="$content" />
|
|
8089
6214
|
</xsl:call-template>
|
|
@@ -8258,107 +6383,38 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8258
6383
|
</xsl:apply-templates>
|
|
8259
6384
|
</xsl:template>
|
|
8260
6385
|
|
|
8261
|
-
<!--
|
|
8262
|
-
|
|
8263
|
-
|
|
8264
|
-
|
|
8265
|
-
|
|
8266
|
-
<!--
|
|
8267
|
-
|
|
8268
|
-
|
|
8269
|
-
|
|
8270
|
-
|
|
8271
|
-
|
|
8272
|
-
<xsl:
|
|
8273
|
-
|
|
8274
|
-
</xsl:
|
|
8275
|
-
|
|
8276
|
-
|
|
8277
|
-
<xsl:template name="
|
|
8278
|
-
|
|
8279
|
-
</xsl:template>
|
|
8280
|
-
|
|
8281
|
-
|
|
8282
|
-
<!-- Bringhurst: a "pipe" is a broken bar -->
|
|
8283
|
-
<!-- Exists as \textbrokenbar -->
|
|
8284
|
-
<xsl:template name="bar-character">
|
|
8285
|
-
<xsl:text>\textbar{}</xsl:text>
|
|
6386
|
+
<!-- Each character is a LaTeX macro or construction, read from -->
|
|
6387
|
+
<!-- the representation table in pretext-common.xsl. Per the -->
|
|
6388
|
+
<!-- note above, an argument-less macro finishes with an empty -->
|
|
6389
|
+
<!-- group, supplied here; a row declares latex-ending="no" when -->
|
|
6390
|
+
<!-- its value is not such a macro -->
|
|
6391
|
+
<!-- TODO: Perhaps use LaTeX double and triple hyphen variants of -->
|
|
6392
|
+
<!-- en-dash and em-dash under some option for human-variant LaTeX -->
|
|
6393
|
+
<xsl:template match="char" mode="character">
|
|
6394
|
+
<xsl:choose>
|
|
6395
|
+
<xsl:when test="@latex">
|
|
6396
|
+
<xsl:value-of select="@latex"/>
|
|
6397
|
+
<xsl:if test="not(@latex-ending = 'no')">
|
|
6398
|
+
<xsl:text>{}</xsl:text>
|
|
6399
|
+
</xsl:if>
|
|
6400
|
+
</xsl:when>
|
|
6401
|
+
<xsl:otherwise>
|
|
6402
|
+
<xsl:call-template name="warn-unimplemented-character">
|
|
6403
|
+
<xsl:with-param name="char-name" select="@name"/>
|
|
6404
|
+
</xsl:call-template>
|
|
6405
|
+
</xsl:otherwise>
|
|
6406
|
+
</xsl:choose>
|
|
8286
6407
|
</xsl:template>
|
|
8287
6408
|
|
|
8288
6409
|
<!-- Other Miscellaneous Symbols, Constructions -->
|
|
8289
6410
|
|
|
8290
|
-
<!-- Ellipsis (dots), for text, not math -->
|
|
8291
|
-
<xsl:template name="ellipsis-character">
|
|
8292
|
-
<xsl:text>\textellipsis{}</xsl:text>
|
|
8293
|
-
</xsl:template>
|
|
8294
|
-
|
|
8295
|
-
<!-- Midpoint -->
|
|
8296
|
-
<!-- A centered dot used sometimes like a decorative dash -->
|
|
8297
|
-
<!-- http://tex.stackexchange.com/questions/19180/which-dot-character-to-use-in-which-context -->
|
|
8298
|
-
<xsl:template name="midpoint-character">
|
|
8299
|
-
<xsl:text>\textperiodcentered{}</xsl:text>
|
|
8300
|
-
</xsl:template>
|
|
8301
|
-
|
|
8302
|
-
<!-- Swung Dash -->
|
|
8303
|
-
<!-- A decorative dash, like a tilde, but bigger, and centered -->
|
|
8304
|
-
<!-- http://andrewmccarthy.ie/2014/11/06/swung-dash-in-latex/ -->
|
|
8305
|
-
<xsl:template name="swungdash-character">
|
|
8306
|
-
<xsl:text>\swungdash{}</xsl:text>
|
|
8307
|
-
</xsl:template>
|
|
8308
6411
|
<!-- Protect the version of the macro appearing in titles -->
|
|
8309
6412
|
<!-- This is an override of the base *template* -->
|
|
8310
6413
|
<xsl:template match="title//swungdash|shortitle//swungdash">
|
|
8311
6414
|
<xsl:text>\protect</xsl:text>
|
|
8312
|
-
<xsl:call-template name="
|
|
8313
|
-
|
|
8314
|
-
|
|
8315
|
-
<!-- Per Mille -->
|
|
8316
|
-
<!-- Or, per thousand, like a percent sign -->
|
|
8317
|
-
<xsl:template name="permille-character">
|
|
8318
|
-
<xsl:text>\textperthousand{}</xsl:text>
|
|
8319
|
-
</xsl:template>
|
|
8320
|
-
|
|
8321
|
-
<!-- Pilcrow -->
|
|
8322
|
-
<!-- Often used to mark the start of a paragraph -->
|
|
8323
|
-
<xsl:template name="pilcrow-character">
|
|
8324
|
-
<xsl:text>\textpilcrow{}</xsl:text>
|
|
8325
|
-
</xsl:template>
|
|
8326
|
-
|
|
8327
|
-
<!-- Section Mark -->
|
|
8328
|
-
<!-- The stylized double-S to indicate section numbers -->
|
|
8329
|
-
<xsl:template name="section-mark-character">
|
|
8330
|
-
<xsl:text>\textsection{}</xsl:text>
|
|
8331
|
-
</xsl:template>
|
|
8332
|
-
|
|
8333
|
-
<!-- Minus -->
|
|
8334
|
-
<!-- A hyphen/dash for use in text as subtraction or negation-->
|
|
8335
|
-
<xsl:template name="minus-character">
|
|
8336
|
-
<xsl:text>\textminus{}</xsl:text>
|
|
8337
|
-
</xsl:template>
|
|
8338
|
-
|
|
8339
|
-
<!-- Times -->
|
|
8340
|
-
<!-- A "multiplication sign" symbol for use in text -->
|
|
8341
|
-
<xsl:template name="times-character">
|
|
8342
|
-
<xsl:text>\texttimes{}</xsl:text>
|
|
8343
|
-
</xsl:template>
|
|
8344
|
-
|
|
8345
|
-
<!-- Solidus -->
|
|
8346
|
-
<!-- Fraction bar, not as steep as a forward slash -->
|
|
8347
|
-
<!-- This should not allow a linebreak, not tested -->
|
|
8348
|
-
<xsl:template name="solidus-character">
|
|
8349
|
-
<xsl:text>\textfractionsolidus{}</xsl:text>
|
|
8350
|
-
</xsl:template>
|
|
8351
|
-
|
|
8352
|
-
<!-- Obelus -->
|
|
8353
|
-
<!-- A "division" symbol for use in text -->
|
|
8354
|
-
<xsl:template name="obelus-character">
|
|
8355
|
-
<xsl:text>\textdiv{}</xsl:text>
|
|
8356
|
-
</xsl:template>
|
|
8357
|
-
|
|
8358
|
-
<!-- Plus/Minus -->
|
|
8359
|
-
<!-- The combined symbol -->
|
|
8360
|
-
<xsl:template name="plusminus-character">
|
|
8361
|
-
<xsl:text>\textpm{}</xsl:text>
|
|
6415
|
+
<xsl:call-template name="character">
|
|
6416
|
+
<xsl:with-param name="name" select="'swungdash'"/>
|
|
6417
|
+
</xsl:call-template>
|
|
8362
6418
|
</xsl:template>
|
|
8363
6419
|
|
|
8364
6420
|
<!-- All Latin abbreviations are defined in -common -->
|
|
@@ -8379,59 +6435,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8379
6435
|
<xsl:text>.\@</xsl:text>
|
|
8380
6436
|
</xsl:template>
|
|
8381
6437
|
|
|
8382
|
-
<!-- Copyright symbol -->
|
|
8383
|
-
<!-- http://tex.stackexchange.com/questions/1676/ -->
|
|
8384
|
-
<!-- how-to-get-good-looking-copyright-and-registered-symbols -->
|
|
8385
|
-
<xsl:template name="copyright-character">
|
|
8386
|
-
<xsl:text>\textcopyright{}</xsl:text>
|
|
8387
|
-
</xsl:template>
|
|
8388
|
-
|
|
8389
|
-
<!-- Phonomark symbol -->
|
|
8390
|
-
<xsl:template name="phonomark-character">
|
|
8391
|
-
<xsl:text>\textcircledP{}</xsl:text>
|
|
8392
|
-
</xsl:template>
|
|
8393
|
-
|
|
8394
|
-
<!-- Copyleft symbol -->
|
|
8395
|
-
<xsl:template name="copyleft-character">
|
|
8396
|
-
<xsl:text>\textcopyleft{}</xsl:text>
|
|
8397
|
-
</xsl:template>
|
|
8398
|
-
|
|
8399
|
-
<!-- Registered symbol -->
|
|
8400
|
-
<xsl:template name="registered-character">
|
|
8401
|
-
<xsl:text>\textregistered{}</xsl:text>
|
|
8402
|
-
</xsl:template>
|
|
8403
|
-
|
|
8404
|
-
<!-- Trademark symbol -->
|
|
8405
|
-
<xsl:template name="trademark-character">
|
|
8406
|
-
<xsl:text>\texttrademark{}</xsl:text>
|
|
8407
|
-
</xsl:template>
|
|
8408
|
-
|
|
8409
|
-
<!-- Servicemark symbol -->
|
|
8410
|
-
<xsl:template name="servicemark-character">
|
|
8411
|
-
<xsl:text>\textservicemark{}</xsl:text>
|
|
8412
|
-
</xsl:template>
|
|
8413
|
-
|
|
8414
|
-
<!-- Degree -->
|
|
8415
|
-
<xsl:template name="degree-character">
|
|
8416
|
-
<xsl:text>\textdegree{}</xsl:text>
|
|
8417
|
-
</xsl:template>
|
|
8418
|
-
|
|
8419
|
-
<!-- Prime -->
|
|
8420
|
-
<!-- A construction such as \(^{\prime}\) looks much better, -->
|
|
8421
|
-
<!-- but will require a lot of extra care in the "text-processing" -->
|
|
8422
|
-
<!-- template since all this math-mode will need to be protected -->
|
|
8423
|
-
<!-- at the outset. Bringhurst opines that many text fonts lack -->
|
|
8424
|
-
<!-- a prime and/or double-prime glyph, and LaTeX does not seem -->
|
|
8425
|
-
<!-- to have any good way to realize them without using math-mode. -->
|
|
8426
|
-
<xsl:template name="prime-character">
|
|
8427
|
-
<xsl:text>\textquotesingle{}</xsl:text>
|
|
8428
|
-
</xsl:template>
|
|
8429
|
-
|
|
8430
|
-
<!-- Double Prime -->
|
|
8431
|
-
<xsl:template name="dblprime-character">
|
|
8432
|
-
<xsl:text>\textquotesingle\textquotesingle{}</xsl:text>
|
|
8433
|
-
</xsl:template>
|
|
8434
|
-
|
|
8435
6438
|
<!-- Characters for Tagging Equations -->
|
|
8436
6439
|
|
|
8437
6440
|
<xsl:template name="tag-star">
|
|
@@ -8456,7 +6459,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8456
6459
|
</xsl:template>
|
|
8457
6460
|
|
|
8458
6461
|
<!-- Fill-in blank -->
|
|
8459
|
-
<!-- \
|
|
6462
|
+
<!-- \ptxfillintext{} defined in preamble as semantic macro -->
|
|
8460
6463
|
<!-- Argument is intended number of characters -->
|
|
8461
6464
|
<xsl:template match="fillin[not(parent::m or parent::mrow)]">
|
|
8462
6465
|
<xsl:variable name="characters">
|
|
@@ -8469,7 +6472,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8469
6472
|
</xsl:otherwise>
|
|
8470
6473
|
</xsl:choose>
|
|
8471
6474
|
</xsl:variable>
|
|
8472
|
-
<xsl:text>\
|
|
6475
|
+
<xsl:text>\ptxfillintext{</xsl:text>
|
|
8473
6476
|
<xsl:value-of select="$characters" />
|
|
8474
6477
|
<xsl:text>}</xsl:text>
|
|
8475
6478
|
<xsl:if test="@rows or @cols">
|
|
@@ -8553,7 +6556,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8553
6556
|
<!-- ############## -->
|
|
8554
6557
|
|
|
8555
6558
|
<xsl:template match="kbd[not(@name)]">
|
|
8556
|
-
<xsl:text>\
|
|
6559
|
+
<xsl:text>\ptxkbd{</xsl:text>
|
|
8557
6560
|
<xsl:call-template name="escape-text-to-latex">
|
|
8558
6561
|
<xsl:with-param name="text" select="." />
|
|
8559
6562
|
</xsl:call-template>
|
|
@@ -8566,7 +6569,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8566
6569
|
<xsl:value-of select="@name"/>
|
|
8567
6570
|
</xsl:variable>
|
|
8568
6571
|
|
|
8569
|
-
<xsl:text>\
|
|
6572
|
+
<xsl:text>\ptxkbd{</xsl:text>
|
|
8570
6573
|
<!-- for-each is just one node, but sets context for key() -->
|
|
8571
6574
|
<xsl:for-each select="$kbdkey-table">
|
|
8572
6575
|
<xsl:value-of select="key('kbdkey-key', $kbdkey-name)/@latex" />
|
|
@@ -8612,10 +6615,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8612
6615
|
<!-- and other freestanding works are italicized; titles -->
|
|
8613
6616
|
<!-- of articles, chapters, and other shorter works -->
|
|
8614
6617
|
<!-- are set in roman and enclosed in quotation marks. -->
|
|
8615
|
-
<!-- \
|
|
6618
|
+
<!-- \ptxpubtitle is a semantic macro defined only if -->
|
|
8616
6619
|
<!-- "pubtitle" is employed. -->
|
|
8617
6620
|
<xsl:template match="pubtitle">
|
|
8618
|
-
<xsl:text>\
|
|
6621
|
+
<xsl:text>\ptxpubtitle{</xsl:text>
|
|
8619
6622
|
<xsl:apply-templates/>
|
|
8620
6623
|
<xsl:text>}</xsl:text>
|
|
8621
6624
|
</xsl:template>
|
|
@@ -8626,37 +6629,6 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8626
6629
|
<xsl:apply-templates select="." mode="rq-character"/>
|
|
8627
6630
|
</xsl:template>
|
|
8628
6631
|
|
|
8629
|
-
<!-- ################-->
|
|
8630
|
-
<!-- Other Characters -->
|
|
8631
|
-
<!-- ################ -->
|
|
8632
|
-
|
|
8633
|
-
<!-- These are specific instances of abstract templates -->
|
|
8634
|
-
<!-- See the similar section of pretext-common.xsl for more -->
|
|
8635
|
-
|
|
8636
|
-
<!-- TODO: Perhaps use LaTeX double and triple hyphen variants of -->
|
|
8637
|
-
<!-- en-dash and em-dash under some option for human-variant LaTeX -->
|
|
8638
|
-
|
|
8639
|
-
<xsl:template name="nbsp-character">
|
|
8640
|
-
<xsl:text>~</xsl:text>
|
|
8641
|
-
</xsl:template>
|
|
8642
|
-
|
|
8643
|
-
<xsl:template name="ndash-character">
|
|
8644
|
-
<xsl:text>\textendash{}</xsl:text>
|
|
8645
|
-
</xsl:template>
|
|
8646
|
-
|
|
8647
|
-
<xsl:template name="mdash-character">
|
|
8648
|
-
<xsl:text>\textemdash{}</xsl:text>
|
|
8649
|
-
</xsl:template>
|
|
8650
|
-
|
|
8651
|
-
<!-- The abstract template for "mdash" consults a publisher option -->
|
|
8652
|
-
<!-- for thin space, or no space, surrounding an em-dash. So the -->
|
|
8653
|
-
<!-- "thin-space-character" is needed for that purpose, and does -->
|
|
8654
|
-
<!-- not have an associated empty PTX element. -->
|
|
8655
|
-
|
|
8656
|
-
<xsl:template name="thin-space-character">
|
|
8657
|
-
<xsl:text>\,</xsl:text>
|
|
8658
|
-
</xsl:template>
|
|
8659
|
-
|
|
8660
6632
|
<!-- Sage Cells -->
|
|
8661
6633
|
|
|
8662
6634
|
<!-- An abstract named template accepts input text and -->
|
|
@@ -8719,7 +6691,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8719
6691
|
<xsl:with-param name="charset" select="concat('`~^|#',&SIMPLECHAR;)"/>
|
|
8720
6692
|
</xsl:call-template>
|
|
8721
6693
|
</xsl:variable>
|
|
8722
|
-
<xsl:text>\
|
|
6694
|
+
<xsl:text>\ptxprogramfragment{</xsl:text>
|
|
8723
6695
|
<xsl:value-of select="$language"/>
|
|
8724
6696
|
<xsl:text>}{</xsl:text>
|
|
8725
6697
|
<xsl:value-of select="$delimiter"/>
|
|
@@ -8954,8 +6926,8 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
8954
6926
|
<xsl:with-param name="text" select="$prefix" />
|
|
8955
6927
|
</xsl:call-template>
|
|
8956
6928
|
</xsl:if>
|
|
8957
|
-
<!-- Then employ \
|
|
8958
|
-
<xsl:text>(*\
|
|
6929
|
+
<!-- Then employ \ptxconsoleinput macro on the line -->
|
|
6930
|
+
<xsl:text>(*\ptxconsoleinput{</xsl:text>
|
|
8959
6931
|
<xsl:call-template name="escape-console-input-to-latex">
|
|
8960
6932
|
<xsl:with-param name="text" select="$text" />
|
|
8961
6933
|
</xsl:call-template>
|
|
@@ -9003,7 +6975,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9003
6975
|
<xsl:template match="interactive[@geogebra]" mode="info-text">
|
|
9004
6976
|
<xsl:text>Geogebra: \href{https://www.geogebra.org/m/</xsl:text>
|
|
9005
6977
|
<xsl:value-of select="@geogebra" />
|
|
9006
|
-
<xsl:text>}{\
|
|
6978
|
+
<xsl:text>}{\ptxmono{www.geogebra.org/m/</xsl:text>
|
|
9007
6979
|
<xsl:value-of select="@geogebra" />
|
|
9008
6980
|
<xsl:text>}}</xsl:text>
|
|
9009
6981
|
</xsl:template>
|
|
@@ -9012,7 +6984,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9012
6984
|
<xsl:template match="interactive[@desmos]" mode="info-text">
|
|
9013
6985
|
<xsl:text>Desmos: \href{https://www.desmos.com/calculator/</xsl:text>
|
|
9014
6986
|
<xsl:value-of select="@desmos" />
|
|
9015
|
-
<xsl:text>}{\
|
|
6987
|
+
<xsl:text>}{\ptxmono{www.desmos.com/calculator/</xsl:text>
|
|
9016
6988
|
<xsl:value-of select="@desmos" />
|
|
9017
6989
|
<xsl:text>}}
</xsl:text>
|
|
9018
6990
|
</xsl:template>
|
|
@@ -9021,7 +6993,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9021
6993
|
<xsl:template match="interactive[@platform='calcplot3d']" mode="info-text">
|
|
9022
6994
|
<!-- code/url too much to include! -->
|
|
9023
6995
|
<xsl:text>CalcPlot3D: \href{https://c3d.libretexts.org/CalcPlot3D/index.html}</xsl:text>
|
|
9024
|
-
<xsl:text>{\
|
|
6996
|
+
<xsl:text>{\ptxmono{c3d.libretexts.org/CalcPlot3D/index.html}}
</xsl:text>
|
|
9025
6997
|
</xsl:template>
|
|
9026
6998
|
|
|
9027
6999
|
<!-- JSXGraph -->
|
|
@@ -9060,7 +7032,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9060
7032
|
</xsl:when>
|
|
9061
7033
|
<xsl:when test="$fig-placement = 'block'"/>
|
|
9062
7034
|
<xsl:otherwise>
|
|
9063
|
-
<xsl:message>PTX:BUG: figure placement not recognized,
|
|
7035
|
+
<xsl:message>PTX:BUG: figure placement not recognized, please report me</xsl:message>
|
|
9064
7036
|
</xsl:otherwise>
|
|
9065
7037
|
</xsl:choose>
|
|
9066
7038
|
<!-- always element name and suffix -->
|
|
@@ -9203,8 +7175,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
9203
7175
|
</xsl:template>
|
|
9204
7176
|
|
|
9205
7177
|
|
|
9206
|
-
<!--
|
|
9207
|
-
<!--
|
|
7178
|
+
<!-- The finished panels arrive as one block of text and are -->
|
|
7179
|
+
<!-- placed, untouched, inside the "sidebyside" environment, whose -->
|
|
7180
|
+
<!-- arguments carry the whole layout: panel count, margins, and -->
|
|
7181
|
+
<!-- gap. The "sbspanel" sub-environments produced by -->
|
|
7182
|
+
<!-- "panel-panel" carry each panel's width and vertical alignment, -->
|
|
7183
|
+
<!-- so wrapping the panels as a unit is exactly the right -->
|
|
7184
|
+
<!-- granularity. -->
|
|
9208
7185
|
<xsl:template match="sidebyside" mode="compose-panels">
|
|
9209
7186
|
<xsl:param name="layout" />
|
|
9210
7187
|
<xsl:param name="panels" />
|
|
@@ -10197,13 +8174,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10197
8174
|
<xsl:text></xsl:text>
|
|
10198
8175
|
</xsl:when>
|
|
10199
8176
|
<xsl:when test="$width='minor'">
|
|
10200
|
-
<xsl:text>\
|
|
8177
|
+
<xsl:text>\ptxhrulethin</xsl:text>
|
|
10201
8178
|
</xsl:when>
|
|
10202
8179
|
<xsl:when test="$width='medium'">
|
|
10203
|
-
<xsl:text>\
|
|
8180
|
+
<xsl:text>\ptxhrulemedium</xsl:text>
|
|
10204
8181
|
</xsl:when>
|
|
10205
8182
|
<xsl:when test="$width='major'">
|
|
10206
|
-
<xsl:text>\
|
|
8183
|
+
<xsl:text>\ptxhrulethick</xsl:text>
|
|
10207
8184
|
</xsl:when>
|
|
10208
8185
|
</xsl:choose>
|
|
10209
8186
|
</xsl:template>
|
|
@@ -10219,13 +8196,13 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10219
8196
|
<xsl:text></xsl:text>
|
|
10220
8197
|
</xsl:when>
|
|
10221
8198
|
<xsl:when test="$width='minor'">
|
|
10222
|
-
<xsl:text>\
|
|
8199
|
+
<xsl:text>\ptxcrulethin</xsl:text>
|
|
10223
8200
|
</xsl:when>
|
|
10224
8201
|
<xsl:when test="$width='medium'">
|
|
10225
|
-
<xsl:text>\
|
|
8202
|
+
<xsl:text>\ptxcrulemedium</xsl:text>
|
|
10226
8203
|
</xsl:when>
|
|
10227
8204
|
<xsl:when test="$width='major'">
|
|
10228
|
-
<xsl:text>\
|
|
8205
|
+
<xsl:text>\ptxcrulethick</xsl:text>
|
|
10229
8206
|
</xsl:when>
|
|
10230
8207
|
</xsl:choose>
|
|
10231
8208
|
<!-- span -->
|
|
@@ -10294,7 +8271,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10294
8271
|
<xsl:choose>
|
|
10295
8272
|
<xsl:when test="line">
|
|
10296
8273
|
<!-- macro for multiline cell -->
|
|
10297
|
-
<xsl:text>\
|
|
8274
|
+
<xsl:text>\ptxtablecelllines{</xsl:text>
|
|
10298
8275
|
<xsl:call-template name="halign-specification">
|
|
10299
8276
|
<xsl:with-param name="align" select="$halign" />
|
|
10300
8277
|
</xsl:call-template>
|
|
@@ -10391,7 +8368,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10391
8368
|
|
|
10392
8369
|
<!-- Any target of a PreTeXt cross-reference, which is not naturally -->
|
|
10393
8370
|
<!-- numbered by a LaTeX \label{} command, needs to go here. -->
|
|
10394
|
-
<xsl:template match="exercises//exercise|worksheet//exercise|reading-questions//exercise|biblio|biblio/note|&PROOF-LIKE;|case|ol/li|dl/li|&SOLUTION-LIKE;|subexercises|exercisegroup|p|paragraphs|blockquote|contributor|colophon|book|article" mode="xref-as-ref">
|
|
8371
|
+
<xsl:template match="exercises//exercise|worksheet//exercise|reading-questions//exercise|biblio|biblio/note|&PROOF-LIKE;|case|ol/li|dl/li|&SOLUTION-LIKE;|subexercises|exercisegroup|p|paragraphs|blockquote|contributor|colophon|book|article|introduction|conclusion" mode="xref-as-ref">
|
|
10395
8372
|
<xsl:value-of select="false()" />
|
|
10396
8373
|
</xsl:template>
|
|
10397
8374
|
|
|
@@ -10549,6 +8526,17 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10549
8526
|
</xsl:apply-templates>
|
|
10550
8527
|
</xsl:template>
|
|
10551
8528
|
|
|
8529
|
+
<!-- A division companion ("introduction"/"conclusion" of a -->
|
|
8530
|
+
<!-- structured division) has its parent's number, which the -->
|
|
8531
|
+
<!-- LaTeX label/ref system cannot produce, so it is hardcoded -->
|
|
8532
|
+
<xsl:template match="introduction[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]|conclusion[parent::article or parent::chapter or parent::appendix or parent::section or parent::subsection]" mode="xref-number">
|
|
8533
|
+
<xsl:param name="xref" select="/.." />
|
|
8534
|
+
|
|
8535
|
+
<xsl:apply-templates select="." mode="xref-number-hardcoded">
|
|
8536
|
+
<xsl:with-param name="xref" select="$xref"/>
|
|
8537
|
+
</xsl:apply-templates>
|
|
8538
|
+
</xsl:template>
|
|
8539
|
+
|
|
10552
8540
|
<!-- A specialized division in an unstructured division may -->
|
|
10553
8541
|
<!-- not be numbered correctly via LaTeX's label/ref system, -->
|
|
10554
8542
|
<!-- so we will use the hypertarget/hyperlink system -->
|
|
@@ -10681,7 +8669,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10681
8669
|
<xsl:apply-templates select="$target" mode="unique-id" />
|
|
10682
8670
|
<xsl:text>]{</xsl:text>
|
|
10683
8671
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
10684
|
-
<xsl:text>\
|
|
8672
|
+
<xsl:text>\ptxlinkhilite{</xsl:text>
|
|
10685
8673
|
</xsl:if>
|
|
10686
8674
|
<xsl:value-of select="$content" />
|
|
10687
8675
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
@@ -10694,7 +8682,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10694
8682
|
<xsl:apply-templates select="$target" mode="unique-id" />
|
|
10695
8683
|
<xsl:text>}{</xsl:text>
|
|
10696
8684
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
10697
|
-
<xsl:text>\
|
|
8685
|
+
<xsl:text>\ptxlinkhilite{</xsl:text>
|
|
10698
8686
|
</xsl:if>
|
|
10699
8687
|
<xsl:value-of select="$content" />
|
|
10700
8688
|
<xsl:if test="$latex-link-highlight != 'none'">
|
|
@@ -10841,7 +8829,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10841
8829
|
<xsl:text>\begin{poem}</xsl:text>
|
|
10842
8830
|
<xsl:apply-templates select="." mode="optional-label"/>
|
|
10843
8831
|
<xsl:text>%
</xsl:text>
|
|
10844
|
-
<xsl:text>\
|
|
8832
|
+
<xsl:text>\ptxpoemTitle{</xsl:text>
|
|
10845
8833
|
<xsl:apply-templates select="." mode="title-full" />
|
|
10846
8834
|
<xsl:text>}
</xsl:text>
|
|
10847
8835
|
<xsl:apply-templates select="stanza|idx"/>
|
|
@@ -10853,7 +8841,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10853
8841
|
<xsl:variable name="alignment">
|
|
10854
8842
|
<xsl:apply-templates select="." mode="poem-halign"/>
|
|
10855
8843
|
</xsl:variable>
|
|
10856
|
-
<xsl:text>\
|
|
8844
|
+
<xsl:text>\ptxpoemauthor</xsl:text>
|
|
10857
8845
|
<xsl:value-of select="$alignment"/>
|
|
10858
8846
|
<xsl:text>{</xsl:text>
|
|
10859
8847
|
<xsl:apply-templates/>
|
|
@@ -10862,7 +8850,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10862
8850
|
|
|
10863
8851
|
<xsl:template match="stanza">
|
|
10864
8852
|
<xsl:if test="title">
|
|
10865
|
-
<xsl:text>\
|
|
8853
|
+
<xsl:text>\ptxstanzaTitle{</xsl:text>
|
|
10866
8854
|
<xsl:apply-templates select="." mode="title-full" />
|
|
10867
8855
|
<xsl:text>}
</xsl:text>
|
|
10868
8856
|
</xsl:if>
|
|
@@ -10881,7 +8869,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10881
8869
|
<xsl:apply-templates select="." mode="poem-indent"/>
|
|
10882
8870
|
</xsl:variable>
|
|
10883
8871
|
<!-- Apply Alignment and Indentation -->
|
|
10884
|
-
<xsl:text>\
|
|
8872
|
+
<xsl:text>\ptxpoemline</xsl:text>
|
|
10885
8873
|
<xsl:value-of select="$alignment"/>
|
|
10886
8874
|
<xsl:text>{</xsl:text>
|
|
10887
8875
|
<xsl:if test="$alignment='left'"><!-- Left Alignment: Indent from Left -->
|
|
@@ -10895,7 +8883,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10895
8883
|
<xsl:with-param name="count"><xsl:value-of select="$indentation"/></xsl:with-param>
|
|
10896
8884
|
</xsl:call-template>
|
|
10897
8885
|
<!-- Latex seems to "eat" one indentation while right aligned, so we add one extra -->
|
|
10898
|
-
<xsl:text>\
|
|
8886
|
+
<xsl:text>\ptxpoemIndent{}</xsl:text>
|
|
10899
8887
|
</xsl:if>
|
|
10900
8888
|
<xsl:text>}
</xsl:text>
|
|
10901
8889
|
</xsl:template>
|
|
@@ -10905,7 +8893,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10905
8893
|
<xsl:choose>
|
|
10906
8894
|
<xsl:when test="(0 >= $count)"/>
|
|
10907
8895
|
<xsl:otherwise>
|
|
10908
|
-
<xsl:text>\
|
|
8896
|
+
<xsl:text>\ptxpoemIndent{}</xsl:text>
|
|
10909
8897
|
<xsl:call-template name="poem-line-indenting">
|
|
10910
8898
|
<xsl:with-param name="count" select="$count - 1"/>
|
|
10911
8899
|
</xsl:call-template>
|
|
@@ -10936,10 +8924,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10936
8924
|
<xsl:template name="doublesharp">
|
|
10937
8925
|
<xsl:choose>
|
|
10938
8926
|
<xsl:when test="ancestor::title|ancestor::subtitle">
|
|
10939
|
-
<xsl:text>\protect\
|
|
8927
|
+
<xsl:text>\protect\ptxdoublesharp</xsl:text>
|
|
10940
8928
|
</xsl:when>
|
|
10941
8929
|
<xsl:otherwise>
|
|
10942
|
-
<xsl:text>{\
|
|
8930
|
+
<xsl:text>{\ptxdoublesharp}</xsl:text>
|
|
10943
8931
|
</xsl:otherwise>
|
|
10944
8932
|
</xsl:choose>
|
|
10945
8933
|
</xsl:template>
|
|
@@ -10948,10 +8936,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10948
8936
|
<xsl:template name="sharp">
|
|
10949
8937
|
<xsl:choose>
|
|
10950
8938
|
<xsl:when test="ancestor::title|ancestor::subtitle">
|
|
10951
|
-
<xsl:text>\protect\
|
|
8939
|
+
<xsl:text>\protect\ptxsharp</xsl:text>
|
|
10952
8940
|
</xsl:when>
|
|
10953
8941
|
<xsl:otherwise>
|
|
10954
|
-
<xsl:text>{\
|
|
8942
|
+
<xsl:text>{\ptxsharp}</xsl:text>
|
|
10955
8943
|
</xsl:otherwise>
|
|
10956
8944
|
</xsl:choose>
|
|
10957
8945
|
</xsl:template>
|
|
@@ -10960,10 +8948,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10960
8948
|
<xsl:template name="natural">
|
|
10961
8949
|
<xsl:choose>
|
|
10962
8950
|
<xsl:when test="ancestor::title|ancestor::subtitle">
|
|
10963
|
-
<xsl:text>\protect\
|
|
8951
|
+
<xsl:text>\protect\ptxnatural</xsl:text>
|
|
10964
8952
|
</xsl:when>
|
|
10965
8953
|
<xsl:otherwise>
|
|
10966
|
-
<xsl:text>{\
|
|
8954
|
+
<xsl:text>{\ptxnatural}</xsl:text>
|
|
10967
8955
|
</xsl:otherwise>
|
|
10968
8956
|
</xsl:choose>
|
|
10969
8957
|
</xsl:template>
|
|
@@ -10972,10 +8960,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10972
8960
|
<xsl:template name="flat">
|
|
10973
8961
|
<xsl:choose>
|
|
10974
8962
|
<xsl:when test="ancestor::title|ancestor::subtitle">
|
|
10975
|
-
<xsl:text>\protect\
|
|
8963
|
+
<xsl:text>\protect\ptxflat</xsl:text>
|
|
10976
8964
|
</xsl:when>
|
|
10977
8965
|
<xsl:otherwise>
|
|
10978
|
-
<xsl:text>{\
|
|
8966
|
+
<xsl:text>{\ptxflat}</xsl:text>
|
|
10979
8967
|
</xsl:otherwise>
|
|
10980
8968
|
</xsl:choose>
|
|
10981
8969
|
</xsl:template>
|
|
@@ -10984,10 +8972,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
10984
8972
|
<xsl:template name="doubleflat">
|
|
10985
8973
|
<xsl:choose>
|
|
10986
8974
|
<xsl:when test="ancestor::title|ancestor::subtitle">
|
|
10987
|
-
<xsl:text>\protect\
|
|
8975
|
+
<xsl:text>\protect\ptxdoubleflat</xsl:text>
|
|
10988
8976
|
</xsl:when>
|
|
10989
8977
|
<xsl:otherwise>
|
|
10990
|
-
<xsl:text>{\
|
|
8978
|
+
<xsl:text>{\ptxdoubleflat}</xsl:text>
|
|
10991
8979
|
</xsl:otherwise>
|
|
10992
8980
|
</xsl:choose>
|
|
10993
8981
|
</xsl:template>
|
|
@@ -11099,11 +9087,15 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11099
9087
|
<!-- always possible to label (universal PTX capability) -->
|
|
11100
9088
|
<xsl:text>\noindent\phantomsection</xsl:text>
|
|
11101
9089
|
<xsl:apply-templates select="." mode="label"/>
|
|
11102
|
-
<xsl:call-template name="
|
|
9090
|
+
<xsl:call-template name="character">
|
|
9091
|
+
<xsl:with-param name="name" select="'langle'"/>
|
|
9092
|
+
</xsl:call-template>
|
|
11103
9093
|
<xsl:apply-templates select="." mode="number"/>
|
|
11104
9094
|
<xsl:text> </xsl:text>
|
|
11105
9095
|
<xsl:apply-templates select="." mode="title-full"/>
|
|
11106
|
-
<xsl:call-template name="
|
|
9096
|
+
<xsl:call-template name="character">
|
|
9097
|
+
<xsl:with-param name="name" select="'rangle'"/>
|
|
9098
|
+
</xsl:call-template>
|
|
11107
9099
|
<xsl:text> </xsl:text>
|
|
11108
9100
|
<xsl:call-template name="inline-math-wrapper">
|
|
11109
9101
|
<xsl:with-param name="math" select="'\equiv'"/>
|
|
@@ -11118,10 +9110,10 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11118
9110
|
<!-- special case, root node with filename -->
|
|
11119
9111
|
<xsl:if test="@filename">
|
|
11120
9112
|
<xsl:text>Root of file: </xsl:text>
|
|
11121
|
-
<xsl:text>\
|
|
9113
|
+
<xsl:text>\ptxmono{</xsl:text>
|
|
11122
9114
|
<xsl:value-of select="@filename" />
|
|
11123
9115
|
<xsl:text>}</xsl:text>
|
|
11124
|
-
<xsl:text>\index{file root!\
|
|
9116
|
+
<xsl:text>\index{file root!\ptxmono{</xsl:text>
|
|
11125
9117
|
<xsl:value-of select="@filename" />
|
|
11126
9118
|
<xsl:text>}}</xsl:text>
|
|
11127
9119
|
<xsl:text>\\
</xsl:text>
|
|
@@ -11132,7 +9124,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11132
9124
|
|
|
11133
9125
|
<!-- wrap code in a Verbatim environment, though perhaps another -->
|
|
11134
9126
|
<!-- LaTeX environment or a tcolor box would work better -->
|
|
11135
|
-
<!-- Simple \
|
|
9127
|
+
<!-- Simple \ptxmono{} needs escapes, won't line break -->
|
|
11136
9128
|
<!-- Drop whitespace only text() nodes -->
|
|
11137
9129
|
<xsl:template match="fragment/code">
|
|
11138
9130
|
<xsl:variable name="normalized-frag" select="normalize-space(.)"/>
|
|
@@ -11151,7 +9143,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11151
9143
|
<!-- with a hyperlink to the target (as a page number for print) -->
|
|
11152
9144
|
<xsl:template match="fragref">
|
|
11153
9145
|
<xsl:variable name="target" select="id(@ref)"/>
|
|
11154
|
-
<xsl:call-template name="
|
|
9146
|
+
<xsl:call-template name="character">
|
|
9147
|
+
<xsl:with-param name="name" select="'langle'"/>
|
|
9148
|
+
</xsl:call-template>
|
|
11155
9149
|
<xsl:apply-templates select="$target" mode="title-full"/>
|
|
11156
9150
|
<xsl:text> </xsl:text>
|
|
11157
9151
|
<xsl:text>{\scriptsize </xsl:text>
|
|
@@ -11160,7 +9154,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11160
9154
|
<xsl:apply-templates select="$target" mode="unique-id"/>
|
|
11161
9155
|
<xsl:text>}]</xsl:text>
|
|
11162
9156
|
<xsl:text>}</xsl:text>
|
|
11163
|
-
<xsl:call-template name="
|
|
9157
|
+
<xsl:call-template name="character">
|
|
9158
|
+
<xsl:with-param name="name" select="'rangle'"/>
|
|
9159
|
+
</xsl:call-template>
|
|
11164
9160
|
<xsl:text>\\
</xsl:text>
|
|
11165
9161
|
</xsl:template>
|
|
11166
9162
|
|
|
@@ -11229,9 +9225,9 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11229
9225
|
<xsl:text>}</xsl:text>
|
|
11230
9226
|
</xsl:template>
|
|
11231
9227
|
|
|
11232
|
-
<!-- \
|
|
9228
|
+
<!-- \ptxmono{} macro *always* defined in preamble -->
|
|
11233
9229
|
<xsl:template match="*" mode="monospace">
|
|
11234
|
-
<xsl:text>\
|
|
9230
|
+
<xsl:text>\ptxmono{</xsl:text>
|
|
11235
9231
|
<xsl:apply-templates/>
|
|
11236
9232
|
<xsl:text>}</xsl:text>
|
|
11237
9233
|
</xsl:template>
|
|
@@ -11430,7 +9426,7 @@ along with MathBook XML. If not, see <http://www.gnu.org/licenses/>.
|
|
|
11430
9426
|
<!-- \, {, } all need replacement, and also occur in some -->
|
|
11431
9427
|
<!-- replacements. So order, and some care, is necessary. -->
|
|
11432
9428
|
<!-- Generally this is a "cleaner" template , prior to -->
|
|
11433
|
-
<!--wrapping in our \
|
|
9429
|
+
<!--wrapping in our \ptxmono macro, implemented with \texttt. -->
|
|
11434
9430
|
<!-- http://tex.stackexchange.com/questions/34580/ -->
|
|
11435
9431
|
<xsl:template name="escape-text-to-latex">
|
|
11436
9432
|
<xsl:param name="text" />
|