@pretextbook/pretext-html 0.16.0 → 0.17.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.
Files changed (60) hide show
  1. package/README.md +77 -3
  2. package/assets/preview-html.xsl +56 -0
  3. package/assets/upstream.json +2 -2
  4. package/assets/xsl/entities.ent +14 -1
  5. package/assets/xsl/latex/pretext-latex-texstyle.xsl +5 -2
  6. package/assets/xsl/localizations/README.md +1 -1
  7. package/assets/xsl/localizations/af-ZA.xml +5 -6
  8. package/assets/xsl/localizations/bg-BG.xml +5 -6
  9. package/assets/xsl/localizations/ca-ES.xml +5 -6
  10. package/assets/xsl/localizations/cs-CZ.xml +5 -6
  11. package/assets/xsl/localizations/de-DE.xml +108 -108
  12. package/assets/xsl/localizations/en-US.xml +18 -17
  13. package/assets/xsl/localizations/es-ES.xml +5 -6
  14. package/assets/xsl/localizations/fi-FI.xml +5 -6
  15. package/assets/xsl/localizations/fr-CA.xml +5 -6
  16. package/assets/xsl/localizations/fr-FR.xml +5 -6
  17. package/assets/xsl/localizations/hu-HU.xml +5 -6
  18. package/assets/xsl/localizations/it-IT.xml +7 -7
  19. package/assets/xsl/localizations/ku-CKB.xml +5 -6
  20. package/assets/xsl/localizations/nl-NL.xml +5 -6
  21. package/assets/xsl/localizations/pt-BR.xml +4 -5
  22. package/assets/xsl/localizations/pt-PT.xml +4 -5
  23. package/assets/xsl/localizations/zh-HANS.xml +5 -6
  24. package/assets/xsl/pretext-assembly.xsl +154 -29
  25. package/assets/xsl/pretext-beamer.xsl +112 -10
  26. package/assets/xsl/pretext-braille-preprint.xsl +22 -3
  27. package/assets/xsl/pretext-common.xsl +117 -42
  28. package/assets/xsl/pretext-epub.xsl +74 -87
  29. package/assets/xsl/pretext-fo.xsl +115 -41
  30. package/assets/xsl/pretext-html.xsl +333 -102
  31. package/assets/xsl/pretext-latex-classic.xsl +48 -35
  32. package/assets/xsl/pretext-latex-common.xsl +160 -98
  33. package/assets/xsl/pretext-latex.xsl +12 -10
  34. package/assets/xsl/pretext-markdown.xsl +5 -3
  35. package/assets/xsl/pretext-numbers.xsl +28 -2
  36. package/assets/xsl/pretext-revealjs.xsl +44 -2
  37. package/assets/xsl/pretext-runestone-static.xsl +27 -4
  38. package/assets/xsl/pretext-runestone.xsl +112 -0
  39. package/assets/xsl/pretext-text.xsl +21 -14
  40. package/assets/xsl/publisher-variables.xsl +187 -47
  41. package/assets/xsl/support/extract-math.xsl +22 -2
  42. package/assets/xsl/support/package-math.xsl +9 -8
  43. package/assets/xsl/utilities/report-publisher-variables.xsl +4 -0
  44. package/assets/xsl-bundle.json +1 -1
  45. package/dist/cli-C0JwLhuv.js +1456 -0
  46. package/dist/cli.js +3 -3
  47. package/dist/html-static.d.ts +2 -2
  48. package/dist/index.browser.d.ts +9 -4
  49. package/dist/index.browser.js +1151 -841
  50. package/dist/index.d.ts +9 -3
  51. package/dist/index.js +50 -46
  52. package/dist/publication.d.ts +21 -0
  53. package/dist/renderer.d.ts +134 -13
  54. package/dist/skeleton.d.ts +68 -7
  55. package/dist/source-cache.d.ts +36 -0
  56. package/dist/sourcemap.d.ts +11 -1
  57. package/dist/subtree.d.ts +79 -0
  58. package/dist/xinclude.d.ts +40 -3
  59. package/package.json +1 -1
  60. package/dist/cli-ox-z2TCZ.js +0 -1145
@@ -824,23 +824,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
824
824
  </xsl:if>
825
825
  </xsl:template>
826
826
 
827
- <!-- The funding/support acknowledgment ("bibinfo/support") is an -->
828
- <!-- unnumbered footnote on an article's title page: temporarily -->
829
- <!-- hijack \thefootnote to suppress the mark, then restore it. -->
830
- <!-- Shared: the regular conversion employs this via its -->
831
- <!-- "footnote-numbering", classic via its "frontmatter-helpers" -->
832
- <xsl:template name="support-footnote">
833
- <xsl:if test="$b-is-article and $bibinfo/support">
834
- <xsl:text>%% add a \ptxsupport command as unnumbered footnote&#xa;</xsl:text>
835
- <xsl:text>\let\ptxsavedfootnote\thefootnote%&#xa;</xsl:text>
836
- <xsl:text>\newcommand\ptxsupport[1]{%&#xa;</xsl:text>
837
- <xsl:text> \let\thefootnote\relax%&#xa;</xsl:text>
838
- <xsl:text> \footnotetext{#1}%&#xa;</xsl:text>
839
- <xsl:text> \let\thefootnote\ptxsavedfootnote%&#xa;</xsl:text>
840
- <xsl:text>}&#xa;</xsl:text>
841
- </xsl:if>
842
- </xsl:template>
843
-
844
827
  <!-- Semantic Macros -->
845
828
  <xsl:template name="semantic-macros">
846
829
  <xsl:text>%% Begin: Semantic Macros&#xa;</xsl:text>
@@ -1629,6 +1612,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1629
1612
  </xsl:call-template>
1630
1613
  </xsl:if>
1631
1614
  <xsl:text>]{block}{}&#xa;</xsl:text>
1615
+ <!-- tcolorbox names each auto counter after its box, so the names -->
1616
+ <!-- below reappear in the LaTeX as counters, "tcb@cnt@figuredistinct" -->
1617
+ <!-- for one, and as macros, "\thetcb@cnt@figuredistinct", which -->
1618
+ <!-- subfigure captions write out directly. A control sequence name -->
1619
+ <!-- cannot contain a hyphen, so none of the box names does. -->
1632
1620
  <!-- should condition on $project-reps, but it is not defined yet -->
1633
1621
  <xsl:if test="$b-number-project-distinct">
1634
1622
  <xsl:text>%%&#xa;</xsl:text>
@@ -1644,7 +1632,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1644
1632
  <xsl:with-param name="level" select="$numbering-projects" />
1645
1633
  </xsl:call-template>
1646
1634
  </xsl:if>
1647
- <xsl:text>]{project-distinct}{}&#xa;</xsl:text>
1635
+ <xsl:text>]{projectdistinct}{}&#xa;</xsl:text>
1648
1636
  </xsl:if>
1649
1637
  <xsl:if test="$b-number-exercise-distinct">
1650
1638
  <xsl:text>%%&#xa;</xsl:text>
@@ -1659,7 +1647,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1659
1647
  <xsl:with-param name="level" select="$numbering-exercises" />
1660
1648
  </xsl:call-template>
1661
1649
  </xsl:if>
1662
- <xsl:text>]{exercise-distinct}{}&#xa;</xsl:text>
1650
+ <xsl:text>]{exercisedistinct}{}&#xa;</xsl:text>
1663
1651
  </xsl:if>
1664
1652
  <xsl:if test="$b-number-figure-distinct">
1665
1653
  <xsl:text>%%&#xa;</xsl:text>
@@ -1674,7 +1662,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1674
1662
  <xsl:with-param name="level" select="$numbering-figures" />
1675
1663
  </xsl:call-template>
1676
1664
  </xsl:if>
1677
- <xsl:text>]{figure-distinct}{}&#xa;</xsl:text>
1665
+ <xsl:text>]{figuredistinct}{}&#xa;</xsl:text>
1678
1666
  </xsl:if>
1679
1667
  <xsl:if test="$b-number-openproblem-distinct">
1680
1668
  <xsl:text>%%&#xa;</xsl:text>
@@ -1690,7 +1678,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1690
1678
  <xsl:with-param name="level" select="$numbering-openproblems" />
1691
1679
  </xsl:call-template>
1692
1680
  </xsl:if>
1693
- <xsl:text>]{openproblem-distinct}{}&#xa;</xsl:text>
1681
+ <xsl:text>]{openproblemdistinct}{}&#xa;</xsl:text>
1694
1682
  </xsl:if>
1695
1683
  <!-- TODO: condition of figure/*/figure-like, or $subfigure-reps -->
1696
1684
  <xsl:text>%% A faux tcolorbox whose only purpose is to provide common numbering&#xa;</xsl:text>
@@ -1701,16 +1689,24 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1701
1689
  <xsl:text>\newtcolorbox[auto counter</xsl:text>
1702
1690
  <!-- control the levels of the numbering -->
1703
1691
  <!-- global (no periods) is the default -->
1692
+ <!-- The subnumbers nest within the counter that numbers figures, -->
1693
+ <!-- and the full number, a figure number followed by a letter, -->
1694
+ <!-- is built from that same counter -->
1695
+ <xsl:variable name="figure-counter">
1696
+ <xsl:choose>
1697
+ <xsl:when test="$b-number-figure-distinct">
1698
+ <xsl:text>tcb@cnt@figuredistinct</xsl:text>
1699
+ </xsl:when>
1700
+ <xsl:otherwise>
1701
+ <xsl:text>tcb@cnt@block</xsl:text>
1702
+ </xsl:otherwise>
1703
+ </xsl:choose>
1704
+ </xsl:variable>
1704
1705
  <xsl:text>, number within=</xsl:text>
1705
- <xsl:choose>
1706
- <xsl:when test="$b-number-figure-distinct">
1707
- <xsl:text>tcb@cnt@figure-distinct</xsl:text>
1708
- </xsl:when>
1709
- <xsl:otherwise>
1710
- <xsl:text>tcb@cnt@block</xsl:text>
1711
- </xsl:otherwise>
1712
- </xsl:choose>
1713
- <xsl:text>, number freestyle={\noexpand\thetcb@cnt@block(\noexpand\alph{\tcbcounter})}</xsl:text>
1706
+ <xsl:value-of select="$figure-counter"/>
1707
+ <xsl:text>, number freestyle={\noexpand\the</xsl:text>
1708
+ <xsl:value-of select="$figure-counter"/>
1709
+ <xsl:text>(\noexpand\alph{\tcbcounter})}</xsl:text>
1714
1710
  <xsl:text>]{subdisplay}{}&#xa;</xsl:text>
1715
1711
  <!-- faux subdisplay requires manipulating low-level counters -->
1716
1712
  <xsl:text>\makeatother&#xa;</xsl:text>
@@ -1918,14 +1914,15 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1918
1914
  <!-- FIGURE-LIKE come in three flavors: blocks (not in a side-by-side), -->
1919
1915
  <!-- panels (in a side-by-side, but not in an overall "figure"), or -->
1920
1916
  <!-- subnumbered (panel of a side-by-side, which is then in an overall -->
1921
- <!-- "figure'). Selections must be careful (not like dropping through -->
1917
+ <!-- "figure", or a "figure" in a "stack" that is the content of an -->
1918
+ <!-- overall "figure"). Selections must be careful (not dropping through -->
1922
1919
  <!-- a choose/when). Environments need to consider title/caption -->
1923
1920
  <!-- placement and counters. So we might create twelve different -->
1924
1921
  <!-- environments here. In -common, see the "figure-placement" template -->
1925
1922
  <!-- for another determination, and a more careful explanation. -->
1926
1923
  <!-- (There was once a subtle bug when we were not so careful here.) -->
1927
1924
  <xsl:variable name="figure-reps" select="
1928
- ($document-root//figure[not(parent::sidebyside)])[1]|
1925
+ ($document-root//figure[not(parent::sidebyside or parent::stack/parent::figure)])[1]|
1929
1926
  ($document-root//table[not(parent::sidebyside)])[1]|
1930
1927
  ($document-root//listing[not(parent::sidebyside)])[1]|
1931
1928
  ($document-root//list[not(parent::sidebyside)])[1]"/>
@@ -1955,7 +1952,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1955
1952
  <!-- (SUB)FIGURE-LIKE -->
1956
1953
  <!-- subnumbered versions, if contained by overall figure -->
1957
1954
  <xsl:variable name="subnumber-reps" select="
1958
- ($document-root//figure/sidebyside/figure|$document-root//figure/sbsgroup/sidebyside/figure)[1]|
1955
+ ($document-root//figure/sidebyside/figure|$document-root//figure/sbsgroup/sidebyside/figure|$document-root//figure/stack/figure)[1]|
1959
1956
  ($document-root//figure/sidebyside/table|$document-root//figure/sbsgroup/sidebyside/table)[1]|
1960
1957
  ($document-root//figure/sidebyside/listing|$document-root//figure/sbsgroup/sidebyside/listing)[1]|
1961
1958
  ($document-root//figure/sidebyside/list|$document-root//figure/sbsgroup/sidebyside/list)[1]"/>
@@ -2355,6 +2352,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2355
2352
  <!-- tcolorbox would *automatically* be made unbreakable, and the result -->
2356
2353
  <!-- was really bad page breaks, or worse, the potential for the interior -->
2357
2354
  <!-- box dribbling off the bottom of the page. -->
2355
+ <!-- The begin-clauses open a paragraph with a run-in title, and -->
2356
+ <!-- the first "p" inside continues that very line. This idiom -->
2357
+ <!-- is why a "p" may not open with an unconditional "\par" - it -->
2358
+ <!-- would strand every run-in title on a line of its own. Note -->
2359
+ <!-- the division of labor: the conclusion's own "\par\medskip" -->
2360
+ <!-- closes its predecessor, boundary material belonging to the -->
2361
+ <!-- environment, not to the neighbors. -->
2358
2362
  <xsl:template match="introduction|conclusion" mode="environment">
2359
2363
  <xsl:variable name="environment-name">
2360
2364
  <xsl:value-of select="local-name(.)"/>
@@ -2547,6 +2551,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2547
2551
  <!-- cross-reference. Not stylable, though we -->
2548
2552
  <!-- could use a macro for the tombstone/Halmos/QED -->
2549
2553
  <!-- so that could be set. -->
2554
+ <!-- The end-clause appends the tombstone to the last paragraph -->
2555
+ <!-- of the proof: stretchy glue and the symbol ride the final -->
2556
+ <!-- line. This idiom is why no element may end its content -->
2557
+ <!-- with "\par" - a closing "\par" here would strand the -->
2558
+ <!-- tombstone on a line of its own. -->
2550
2559
  <xsl:template match="*[&PROOF-FILTER;][&SOLUTION-PROOF-FILTER;]" mode="environment">
2551
2560
  <xsl:text>\NewDocumentEnvironment{solution</xsl:text>
2552
2561
  <xsl:value-of select="local-name(.)"/>
@@ -2559,6 +2568,10 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2559
2568
  <!-- Title comes with punctuation, always. -->
2560
2569
  <!-- TODO: move implication definitions here, and -->
2561
2570
  <!-- pass semantic strings out of the construction -->
2571
+ <!-- The begin-clause opens a paragraph with a run-in heading -->
2572
+ <!-- (implication arrows, or a title); the "case" text continues -->
2573
+ <!-- that line. So "case" appears in the leaves-paragraph-open -->
2574
+ <!-- authority, and a following "p" closes the paragraph. -->
2562
2575
  <xsl:template match="case" mode="environment">
2563
2576
  <xsl:text>\NewDocumentEnvironment{case}{mmmm}&#xa;</xsl:text>
2564
2577
  <xsl:text>{\par\medskip\noindent\notblank{#2}{#2\space{}}{}\textit{\notblank{#3}{#3\space{}}{}\notblank{#2#3}{}{#1.\space{}}}</xsl:text>
@@ -2722,13 +2735,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2722
2735
  <xsl:variable name="counter">
2723
2736
  <xsl:choose>
2724
2737
  <xsl:when test="(&PROJECT-FILTER;) and $b-number-project-distinct">
2725
- <xsl:text>project-distinct</xsl:text>
2738
+ <xsl:text>projectdistinct</xsl:text>
2726
2739
  </xsl:when>
2727
2740
  <xsl:when test="self::exercise and boolean(&INLINE-EXERCISE-FILTER;) and $b-number-exercise-distinct">
2728
- <xsl:text>exercise-distinct</xsl:text>
2741
+ <xsl:text>exercisedistinct</xsl:text>
2729
2742
  </xsl:when>
2730
2743
  <xsl:when test="(&OPENPROBLEM-FILTER;) and $b-number-openproblem-distinct">
2731
- <xsl:text>openproblem-distinct</xsl:text>
2744
+ <xsl:text>openproblemdistinct</xsl:text>
2732
2745
  </xsl:when>
2733
2746
  <xsl:otherwise>
2734
2747
  <xsl:text>block</xsl:text>
@@ -2758,7 +2771,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2758
2771
  <xsl:text>}</xsl:text>
2759
2772
  <!-- number of arguments -->
2760
2773
  <xsl:choose>
2761
- <xsl:when test="&THEOREM-FILTER; or &AXIOM-FILTER;">
2774
+ <xsl:when test="&THEOREM-FILTER; or &AXIOM-FILTER; or &DEFINITION-FILTER; or &OPENPROBLEM-FILTER;">
2762
2775
  <xsl:text>[4]</xsl:text>
2763
2776
  </xsl:when>
2764
2777
  <xsl:otherwise>
@@ -2770,7 +2783,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2770
2783
  <!-- begin: title construction -->
2771
2784
  <xsl:text>title={{#1~\thetcbcounter</xsl:text>
2772
2785
  <xsl:choose>
2773
- <xsl:when test="&THEOREM-FILTER; or &AXIOM-FILTER;">
2786
+ <xsl:when test="&THEOREM-FILTER; or &AXIOM-FILTER; or &DEFINITION-FILTER; or &OPENPROBLEM-FILTER;">
2774
2787
  <!-- first space of double space -->
2775
2788
  <xsl:text>\notblank{#2#3}{\space}{}</xsl:text>
2776
2789
  <xsl:text>\notblank{#2}{\space#2}{}</xsl:text>
@@ -2784,7 +2797,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2784
2797
  <!-- end: title construction -->
2785
2798
  <!-- label in argument 3 or argument 4 -->
2786
2799
  <xsl:choose>
2787
- <xsl:when test="&THEOREM-FILTER; or &AXIOM-FILTER;">
2800
+ <xsl:when test="&THEOREM-FILTER; or &AXIOM-FILTER; or &DEFINITION-FILTER; or &OPENPROBLEM-FILTER;">
2788
2801
  <xsl:text>phantomlabel={#4}, </xsl:text>
2789
2802
  </xsl:when>
2790
2803
  <xsl:otherwise>
@@ -2818,7 +2831,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2818
2831
  <xsl:text>subdisplay</xsl:text>
2819
2832
  </xsl:when>
2820
2833
  <xsl:when test="$b-number-figure-distinct">
2821
- <xsl:text>figure-distinct</xsl:text>
2834
+ <xsl:text>figuredistinct</xsl:text>
2822
2835
  </xsl:when>
2823
2836
  <xsl:otherwise>
2824
2837
  <xsl:text>block</xsl:text>
@@ -2855,10 +2868,11 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2855
2868
  <xsl:text>{</xsl:text>
2856
2869
  <!-- begin: title/caption construction -->
2857
2870
  <xsl:choose>
2858
- <!-- Captions/titlesof 2D displays within panels of figure/sidebyside -->
2871
+ <!-- Captions/titles of 2D displays within panels of figure/sidebyside -->
2872
+ <!-- or of figures stacked within a figure. -->
2859
2873
  <!-- \thetcbcounter comes from subdisplay, looks like 25.3(b), -->
2860
2874
  <!-- and this is what will render in a cross-reference via \label/\ref -->
2861
- <!-- The enclosing figure is numbered from block or figure-distinct. -->
2875
+ <!-- The enclosing figure is numbered from block or figuredistinct. -->
2862
2876
  <!-- We us the "xstring" package to strip out this number (e.g. 25.3) -->
2863
2877
  <!-- and leave just the sub-numbering (e.g, (b)). -->
2864
2878
  <!-- NB: parameter #3 is a hardcoded number supplied by the -common -->
@@ -2872,7 +2886,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
2872
2886
  <xsl:text>before lower={{</xsl:text>
2873
2887
  <xsl:choose>
2874
2888
  <xsl:when test="$b-number-figure-distinct">
2875
- <xsl:text>\textbf{\StrSubstitute{\thetcbcounter}{\thetcb@cnt@figure-distinct}{}}</xsl:text>
2889
+ <xsl:text>\textbf{\StrSubstitute{\thetcbcounter}{\thetcb@cnt@figuredistinct}{}}</xsl:text>
2876
2890
  </xsl:when>
2877
2891
  <xsl:otherwise>
2878
2892
  <xsl:text>\textbf{\StrSubstitute{\thetcbcounter}{\thetcb@cnt@block}{}}</xsl:text>
@@ -3348,6 +3362,15 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3348
3362
  <!-- http://stackoverflow.com/questions/2817664/xsl-how-to-tell-if-element-is-last-in-series -->
3349
3363
  <xsl:template match="author" mode="article-info">
3350
3364
  <xsl:apply-templates select="personname" />
3365
+ <!-- A support statement is a "\thanks" footnote off the name. The -->
3366
+ <!-- "\author" block is set as a one-column tabular, where a "\\" -->
3367
+ <!-- row cannot wrap: a sentence of ordinary length overflows the -->
3368
+ <!-- page and carries the name, affiliation and email with it. -->
3369
+ <xsl:if test="support">
3370
+ <xsl:text>\thanks{</xsl:text>
3371
+ <xsl:apply-templates select="support" />
3372
+ <xsl:text>}</xsl:text>
3373
+ </xsl:if>
3351
3374
  <xsl:if test="affiliation">
3352
3375
  <xsl:apply-templates select="affiliation" />
3353
3376
  </xsl:if>
@@ -3355,10 +3378,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3355
3378
  <xsl:text>\\&#xa;</xsl:text>
3356
3379
  <xsl:apply-templates select="email" />
3357
3380
  </xsl:if>
3358
- <xsl:if test="support">
3359
- <xsl:text>\\&#xa;</xsl:text>
3360
- <xsl:apply-templates select="support" />
3361
- </xsl:if>
3362
3381
  <xsl:if test="following-sibling::author" >
3363
3382
  <xsl:text>&#xa;\and</xsl:text>
3364
3383
  </xsl:if>
@@ -3403,14 +3422,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
3403
3422
  </xsl:if>
3404
3423
  </xsl:template>
3405
3424
 
3406
- <xsl:template match="bibinfo/support" mode="article-info">
3407
- <xsl:apply-templates select="*"/>
3408
- </xsl:template>
3409
-
3410
- <xsl:template match="bibinfo/support" mode="article-info">
3411
- <xsl:apply-templates select="*"/>
3412
- </xsl:template>
3413
-
3414
3425
  <!-- Departments, Institutions, and Addresses are free-form, or sequences of lines -->
3415
3426
  <!-- Line breaks are inserted above, due to \and, etc, so do not end last line here -->
3416
3427
  <xsl:template match="position|department|institution|location">
@@ -4315,20 +4326,21 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
4315
4326
  <!-- Examples have no structure, or have statement and solution -->
4316
4327
  <!-- Exercises have hints, answers and solutions -->
4317
4328
 
4318
- <!-- Environments/blocks implemented with tcolorbox -->
4319
- <!-- expect certain arguments. This template provides them. -->
4320
- <!-- -->
4321
- <!-- 1. title, with punctuation as needed -->
4322
- <!-- 2. the "unique-id", which suffices for -->
4323
- <!-- the LaTeX label/ref mechanism -->
4324
- <!-- -->
4325
- <!-- Or, for THEOREM-LIKE and AXIOM-LIKE, -->
4326
- <!-- -->
4327
- <!-- 1. title, right now we add punctuation as needed -->
4328
- <!-- 2. a list of creator(s) -->
4329
- <!-- 3. the "unique-id", which suffices for -->
4330
- <!-- the LaTeX label/ref mechanism -->
4331
- <!-- N.B.: "objectives", "outcomes" need to use this -->
4329
+ <!-- Environments/blocks implemented with tcolorbox -->
4330
+ <!-- expect certain arguments. This template provides them. -->
4331
+ <!-- -->
4332
+ <!-- 1. title, with punctuation as needed -->
4333
+ <!-- 2. the "unique-id", which suffices for -->
4334
+ <!-- the LaTeX label/ref mechanism -->
4335
+ <!-- -->
4336
+ <!-- Or, for the mathematical blocks (THEOREM-LIKE, AXIOM-LIKE, -->
4337
+ <!-- DEFINITION-LIKE, OPENPROBLEM-LIKE), -->
4338
+ <!-- -->
4339
+ <!-- 1. title, right now we add punctuation as needed -->
4340
+ <!-- 2. the attribution: creator and origins, comma-separated -->
4341
+ <!-- 3. the "unique-id", which suffices for -->
4342
+ <!-- the LaTeX label/ref mechanism -->
4343
+ <!-- N.B.: "objectives", "outcomes" need to use this -->
4332
4344
  <xsl:template match="&THEOREM-LIKE;|&AXIOM-LIKE;|&DEFINITION-LIKE;|&REMARK-LIKE;|&COMPUTATION-LIKE;|&OPENPROBLEM-LIKE;|&EXAMPLE-LIKE;|&PROJECT-LIKE;|&ASIDE-LIKE;|exercise[boolean(&INLINE-EXERCISE-FILTER;)]|assemblage" mode="block-options">
4333
4345
  <xsl:text>{</xsl:text>
4334
4346
  <xsl:apply-templates select="." mode="type-name"/>
@@ -4336,9 +4348,9 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
4336
4348
  <xsl:text>{</xsl:text>
4337
4349
  <xsl:apply-templates select="." mode="title-full"/>
4338
4350
  <xsl:text>}</xsl:text>
4339
- <xsl:if test="&THEOREM-FILTER; or &AXIOM-FILTER;">
4351
+ <xsl:if test="&THEOREM-FILTER; or &AXIOM-FILTER; or &DEFINITION-FILTER; or &OPENPROBLEM-FILTER;">
4340
4352
  <xsl:text>{</xsl:text>
4341
- <xsl:apply-templates select="." mode="creator-full" />
4353
+ <xsl:apply-templates select="." mode="attribution-full"/>
4342
4354
  <xsl:text>}</xsl:text>
4343
4355
  </xsl:if>
4344
4356
  <!-- unique-id destined for tcolorbox phantomlabel= option -->
@@ -5406,6 +5418,28 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
5406
5418
  </xsl:template>
5407
5419
 
5408
5420
 
5421
+ <!-- The LaTeX realization of some elements ends with a paragraph -->
5422
+ <!-- still open: a "p" never closes its own paragraph, and the -->
5423
+ <!-- run-in heading of a proof "case" opens one for the text that -->
5424
+ <!-- follows it. A follower that starts a fresh paragraph must -->
5425
+ <!-- close its predecessor's with "\par" - separation is the -->
5426
+ <!-- FOLLOWER's job. It cannot be the other way around: an -->
5427
+ <!-- environment may legitimately append to its final paragraph -->
5428
+ <!-- (a "proof" ends with a tombstone riding the last line, a -->
5429
+ <!-- workspace ends with a strut) or open its first one (an -->
5430
+ <!-- "introduction" begins with a run-in title), so no element -->
5431
+ <!-- may close its own paragraphs unconditionally. This template -->
5432
+ <!-- is the single authority on which elements leave a paragraph -->
5433
+ <!-- open; to admit a new element, extend the match here - never -->
5434
+ <!-- grow a private list at a call site. -->
5435
+ <xsl:template match="p|paragraphs|sidebyside|case" mode="leaves-paragraph-open">
5436
+ <xsl:text>true</xsl:text>
5437
+ </xsl:template>
5438
+
5439
+ <xsl:template match="*" mode="leaves-paragraph-open">
5440
+ <xsl:text>false</xsl:text>
5441
+ </xsl:template>
5442
+
5409
5443
  <!-- Paragraphs -->
5410
5444
  <!-- \par *separates* paragraphs So look backward for -->
5411
5445
  <!-- cases where a paragraph would have been the previous -->
@@ -5424,8 +5458,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
5424
5458
  <xsl:template match="p">
5425
5459
  <xsl:apply-templates select="." mode="newpage"/>
5426
5460
  <xsl:variable name="node-preceding-current" select="preceding-sibling::*[not(&SUBDIVISION-METADATA-FILTER;)][1]" />
5427
- <xsl:if test="$node-preceding-current[self::p or self::paragraphs or self::sidebyside or self::case]">
5461
+ <xsl:variable name="predecessor-leaves-paragraph-open">
5462
+ <xsl:apply-templates select="$node-preceding-current" mode="leaves-paragraph-open"/>
5463
+ </xsl:variable>
5464
+ <xsl:if test="$predecessor-leaves-paragraph-open = 'true'">
5428
5465
  <xsl:text>\par</xsl:text>
5466
+ <!-- spacing policy, not separation: a bit of extra room -->
5467
+ <!-- after these two, in addition to the paragraph break -->
5429
5468
  <xsl:if test="$node-preceding-current[self::paragraphs or self::case]">
5430
5469
  <xsl:text>\medskip</xsl:text>
5431
5470
  </xsl:if>
@@ -5776,10 +5815,13 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
5776
5815
  <xsl:if test="@marker or ($format-code = '0') or ancestor::exercises or ancestor::worksheet or ancestor::handout or ancestor::reading-questions or ancestor::references">
5777
5816
  <xsl:text>[label={</xsl:text>
5778
5817
  <xsl:apply-templates select="." mode="latex-list-label" />
5818
+ <xsl:text>}</xsl:text>
5819
+ <!-- The braces delimit the replacement text of the "label" key. -->
5820
+ <!-- "start" is a key in its own right, so it follows them. -->
5779
5821
  <xsl:if test="$format-code = '0'">
5780
5822
  <xsl:text>, start=0</xsl:text>
5781
5823
  </xsl:if>
5782
- <xsl:text>}]</xsl:text>
5824
+ <xsl:text>]</xsl:text>
5783
5825
  </xsl:if>
5784
5826
  <xsl:text>&#xa;</xsl:text>
5785
5827
  <xsl:apply-templates select="li"/>
@@ -7082,17 +7124,18 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7082
7124
  <xsl:text>\par\smallskip\centerline{A deprecated JSXGraph interactive demonstration goes here in interactive output.}\smallskip&#xa;</xsl:text>
7083
7125
  </xsl:template>
7084
7126
 
7085
- <!-- We sometimes need to explicitly leave LaTeX's vertical mode. -->
7086
- <!-- But we try to be judicious about using this. Overuse makes -->
7087
- <!-- for bad spacing. -->
7088
- <!-- Explanation: http://tex.stackexchange.com/questions/22852/ -->
7089
- <!-- function-and-usage-of-leavevmode -->
7090
- <!-- "Use \leavevmode for all macros which could be used at -->
7091
- <!-- the begin of the paragraph and add horizontal boxes -->
7092
- <!-- by themselves (e.g. in form of text)." -->
7093
- <!-- Potential alternate solution: write a leading "empty" \mbox{} -->
7094
- <!-- http://tex.stackexchange.com/questions/171220/ -->
7095
- <!-- include-non-floating-graphic-in-a-theorem-environment -->
7127
+ <!-- A "sidebyside" as the first content of "paragraphs" follows -->
7128
+ <!-- the run-in title, and each token below is load-bearing, by -->
7129
+ <!-- measurement: dropping "\leavevmode" un-indents the first -->
7130
+ <!-- panel line, and reducing the whole to "\par" tightens the -->
7131
+ <!-- layout by one "\parskip". Together they mean: break the -->
7132
+ <!-- title's line, add a paragraph of separation, and set the -->
7133
+ <!-- panels at the paragraph-indent position. Whether that is -->
7134
+ <!-- the intended look has never been decided deliberately, so -->
7135
+ <!-- change this only on purpose, re-measuring. -->
7136
+ <!-- Background on the primitive: -->
7137
+ <!-- http://tex.stackexchange.com/questions/22852/ -->
7138
+ <!-- function-and-usage-of-leavevmode -->
7096
7139
  <xsl:template match="sidebyside" mode="leave-vertical-mode">
7097
7140
  <xsl:if test="not(preceding-sibling::*[not(&SUBDIVISION-METADATA-FILTER;)]) and parent::paragraphs">
7098
7141
  <xsl:text>\leavevmode\par\noindent%&#xa;</xsl:text>
@@ -7151,7 +7194,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7151
7194
  <!-- likewise, sidebyside and tabular will center themselves -->
7152
7195
  <!-- Eventually everything in a figure should control itself -->
7153
7196
  <!-- TODO: need to investigate more (poem? etc) -->
7154
- <xsl:if test="self::figure and not(image or sidebyside or tabular)">
7197
+ <xsl:if test="self::figure and not(image or sidebyside or tabular or stack)">
7155
7198
  <xsl:text>\centering&#xa;</xsl:text>
7156
7199
  </xsl:if>
7157
7200
  <!-- TODO: process meta-data, then restrict contents -->
@@ -7168,6 +7211,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7168
7211
  <xsl:call-template name="end-saved-footnotes"/>
7169
7212
  </xsl:template>
7170
7213
 
7214
+ <!-- A "stack" within a "figure" holds subfigures: each is a -->
7215
+ <!-- "figure" set in the subnumbered environment, one after -->
7216
+ <!-- another at full width, and the enclosing figure supplies -->
7217
+ <!-- the caption for the whole. -->
7218
+ <xsl:template match="figure/stack">
7219
+ <xsl:apply-templates select="figure"/>
7220
+ </xsl:template>
7221
+
7171
7222
  <!-- Tables, (Named) Lists -->
7172
7223
  <!-- 0: enviroment name may be prefixed with "sub" -->
7173
7224
  <!-- 1: title text, bolded here, not in environment -->
@@ -7305,10 +7356,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7305
7356
  <!-- Images -->
7306
7357
  <!-- ###### -->
7307
7358
 
7308
- <!-- First: images in full-width contexts -->
7309
- <!-- naked images go into a tcolorbox for layout control -->
7310
- <!-- figure/image (not in a sidebyside) into same tcolorbox -->
7311
- <xsl:template match="image[not(ancestor::sidebyside)]">
7359
+ <!-- First: images in full-width contexts -->
7360
+ <!-- naked images go into a tcolorbox for layout control -->
7361
+ <!-- figure/image (not in a sidebyside) into same tcolorbox -->
7362
+ <!-- An image more deeply within a "sidebyside" (in an -->
7363
+ <!-- "exercise" panel or a list item, say) is here too: the -->
7364
+ <!-- tcolorbox measures from "\linewidth", the available -->
7365
+ <!-- width where the image sits. -->
7366
+ <xsl:template match="image[not(&SBS-LAYOUT-FILTER;)]">
7312
7367
  <xsl:apply-templates select="." mode="newpage"/>
7313
7368
  <xsl:variable name="rtf-layout">
7314
7369
  <xsl:apply-templates select="." mode="layout-parameters" />
@@ -7345,14 +7400,21 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7345
7400
  </xsl:choose>
7346
7401
  </xsl:template>
7347
7402
 
7403
+ <!-- An "image" or a "tabular" in a side-by-side panel is set as a -->
7404
+ <!-- bare box with a leading "\noindent", so a paragraph already in -->
7405
+ <!-- progress must be broken before it, and the box's own line must -->
7406
+ <!-- be closed before any successor. Within a panel this needs no -->
7407
+ <!-- analysis of the neighbors: panels hold no run-in headings and -->
7408
+ <!-- no trailing tombstones, so a redundant "\par" lands in vertical -->
7409
+ <!-- mode, where it is a no-op. So bracket every such box with a -->
7410
+ <!-- "\par" on each side, unconditionally. -->
7411
+
7348
7412
  <!-- Second: images already constrained by side-by-side panels -->
7349
- <xsl:template match="image[ancestor::sidebyside]">
7350
- <!-- get a newline if inside a "stack" -->
7351
- <xsl:if test="parent::stack and preceding-sibling::*">
7352
- <xsl:text>\par&#xa;</xsl:text>
7353
- </xsl:if>
7413
+ <xsl:template match="image[&SBS-LAYOUT-FILTER;]">
7414
+ <xsl:text>\par&#xa;</xsl:text>
7354
7415
  <xsl:text>\noindent</xsl:text>
7355
7416
  <xsl:apply-templates select="." mode="image-inclusion" />
7417
+ <xsl:text>\par&#xa;</xsl:text>
7356
7418
  </xsl:template>
7357
7419
 
7358
7420
  <!-- Various versions of images have their width set to the -->
@@ -7595,12 +7657,16 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7595
7657
  </xsl:template>
7596
7658
 
7597
7659
  <xsl:template match="tabular[ancestor::sidebyside]">
7660
+ <!-- bracketing "\par" pair: see the panel rule at the "image" -->
7661
+ <!-- template for side-by-side panels -->
7662
+ <xsl:text>\par&#xa;</xsl:text>
7598
7663
  <!-- with layout control (inside sidebyside), scale down, but not up -->
7599
7664
  <!-- https://tex.stackexchange.com/questions/327887/ -->
7600
7665
  <!-- resizing-or-scaling-table-only-if-it-is-larger-than-column-width -->
7601
7666
  <xsl:text>\noindent\resizebox{\ifdim\width > \linewidth\linewidth\else\width\fi}{!}{%&#xa;</xsl:text>
7602
7667
  <xsl:apply-templates select="." mode="tabular-inclusion"/>
7603
7668
  <xsl:text>}%&#xa;</xsl:text>
7669
+ <xsl:text>\par&#xa;</xsl:text>
7604
7670
  </xsl:template>
7605
7671
 
7606
7672
  <xsl:template match="tabular" mode="tabular-inclusion">
@@ -7661,10 +7727,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
7661
7727
  </xsl:otherwise>
7662
7728
  </xsl:choose>
7663
7729
  </xsl:variable>
7664
- <!-- get a newline if inside a "stack" -->
7665
- <xsl:if test="parent::stack and preceding-sibling::*">
7666
- <xsl:text>\par&#xa;</xsl:text>
7667
- </xsl:if>
7668
7730
  <!-- center within a sidebyside if by itself -->
7669
7731
  <!-- \centering needs a closing \par within a -->
7670
7732
  <!-- defensive group if it is to be effective -->
@@ -428,7 +428,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
428
428
  </xsl:otherwise>
429
429
  </xsl:choose>
430
430
  </xsl:if>
431
- <xsl:call-template name="support-footnote"/>
432
431
  </xsl:template>
433
432
 
434
433
  <!-- Text Alignment, Right and Bottom -->
@@ -498,6 +497,14 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
498
497
  <xsl:text>%% Title page information for article&#xa;</xsl:text>
499
498
  <xsl:text>\title{</xsl:text>
500
499
  <xsl:apply-templates select="." mode="title-full" />
500
+ <!-- The article-level support statement is a "\thanks" on the -->
501
+ <!-- title: a marked footnote on the title page, so it reads apart -->
502
+ <!-- from the per-author statements, which are "\thanks" off names -->
503
+ <xsl:if test="$bibinfo/support">
504
+ <xsl:text>\thanks{</xsl:text>
505
+ <xsl:apply-templates select="$bibinfo/support"/>
506
+ <xsl:text>}</xsl:text>
507
+ </xsl:if>
501
508
  <xsl:if test="subtitle">
502
509
  <xsl:text>\\&#xa;</xsl:text>
503
510
  <!-- Trying to match author fontsize -->
@@ -511,11 +518,6 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
511
518
  </xsl:if>
512
519
  <xsl:apply-templates select="$bibinfo/event" />
513
520
  </xsl:if>
514
- <xsl:if test="$bibinfo/support">
515
- <xsl:text>\ptxsupport{</xsl:text>
516
- <xsl:apply-templates select="$bibinfo/support" mode="article-info"/>
517
- <xsl:text>}&#xa;</xsl:text>
518
- </xsl:if>
519
521
  <xsl:text>}&#xa;</xsl:text>
520
522
  <xsl:if test="$bibinfo/author or $bibinfo/editor">
521
523
  <xsl:text>\author{</xsl:text>
@@ -1980,25 +1982,25 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
1980
1982
  <!--divisional exercise -->
1981
1983
  <xsl:when test="self::exercise and ancestor::exercises">
1982
1984
  <xsl:apply-templates select="." mode="type-name">
1983
- <xsl:with-param name="string-id" select="'divisionalexercise'"/>
1985
+ <xsl:with-param name="string-id" select="'exercise-divisional'"/>
1984
1986
  </xsl:apply-templates>
1985
1987
  </xsl:when>
1986
1988
  <!-- worksheet exercise -->
1987
1989
  <xsl:when test="self::exercise and ancestor::worksheet">
1988
1990
  <xsl:apply-templates select="." mode="type-name">
1989
- <xsl:with-param name="string-id" select="'worksheetexercise'"/>
1991
+ <xsl:with-param name="string-id" select="'exercise-worksheet'"/>
1990
1992
  </xsl:apply-templates>
1991
1993
  </xsl:when>
1992
1994
  <!-- reading question -->
1993
1995
  <xsl:when test="self::exercise and ancestor::reading-questions">
1994
1996
  <xsl:apply-templates select="." mode="type-name">
1995
- <xsl:with-param name="string-id" select="'readingquestion'"/>
1997
+ <xsl:with-param name="string-id" select="'exercise-reading'"/>
1996
1998
  </xsl:apply-templates>
1997
1999
  </xsl:when>
1998
2000
  <!-- inline exercise ("Checkpoint") by elimination -->
1999
2001
  <xsl:when test="self::exercise">
2000
2002
  <xsl:apply-templates select="." mode="type-name">
2001
- <xsl:with-param name="string-id" select="'inlineexercise'"/>
2003
+ <xsl:with-param name="string-id" select="'exercise-inline'"/>
2002
2004
  </xsl:apply-templates>
2003
2005
  </xsl:when>
2004
2006
  <!-- now PROJECT-LIKE by elimination, don't need $string-id -->
@@ -587,7 +587,7 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
587
587
  <!-- centering wins -->
588
588
  <xsl:variable name="alignment">
589
589
  <xsl:choose>
590
- <xsl:when test="ancestor::sidebyside"/>
590
+ <xsl:when test="&SBS-LAYOUT-FILTER;"/>
591
591
  <xsl:when test="@margins and (number($layout/left-margin) &lt;= 10)">
592
592
  <xsl:text>left</xsl:text>
593
593
  </xsl:when>
@@ -603,10 +603,12 @@ along with PreTeXt. If not, see <http://www.gnu.org/licenses/>.
603
603
  <!-- carries a percentage (a bare number would be pixels).-->
604
604
  <!-- A panel image takes its width from the enclosing -->
605
605
  <!-- "sidebyside" layout, locating its panel as -common -->
606
- <!-- does (a "figure" or "stack" wrapper is the panel) -->
606
+ <!-- does (a "figure" or "stack" wrapper is the panel). -->
607
+ <!-- An image more deeply within a "sidebyside" has its -->
608
+ <!-- own layout, as outside of one. -->
607
609
  <xsl:variable name="width">
608
610
  <xsl:choose>
609
- <xsl:when test="ancestor::sidebyside">
611
+ <xsl:when test="&SBS-LAYOUT-FILTER;">
610
612
  <xsl:variable name="rtf-sbs-layout">
611
613
  <xsl:apply-templates select="ancestor::sidebyside" mode="layout-parameters"/>
612
614
  </xsl:variable>