Skip to content

Commit 389108c

Browse files
authored
add beamer support (#1187)
* add beamer support * Update slideshow templates * update tests * update schema * build rng
1 parent a7d91b1 commit 389108c

14 files changed

Lines changed: 1047 additions & 52 deletions

File tree

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,13 @@ Instructions: Add a subsection under `[Unreleased]` for additions, fixes, change
99

1010
## [Unreleased]
1111

12+
### Added
13+
- Experimental support for beamer format builds (from a `<slideshow>`). Use `<target name="slides" format="beamer"/>` in the manifest to build a beamer PDF.
14+
- Publication variable to use cdn javascript/css for HTML output instead of local copies.
15+
16+
### Fixed
17+
- Better heading levels for HTML output to improve accessibility.
18+
1219
## [2.43.2] - 2026-07-07
1320

1421
Includes updates to core through commit: [ad605bb](https://github.com/PreTeXtBook/pretext/commit/ad605bb27faf9f12c2bcb3b98ea953533f1aacb4)

poetry.lock

Lines changed: 10 additions & 39 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pretext/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818

1919
VERSION = get_version("pretext", Path(__file__).parent.parent)
2020

21-
22-
CORE_COMMIT = "ad605bb27faf9f12c2bcb3b98ea953533f1aacb4"
21+
CORE_COMMIT = "07c8b5c9a9a55e95ec27073e88bd5c9c61b9c161"
2322

2423

2524
def activate() -> None:

pretext/constants.py

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
"kindle",
1313
"braille",
1414
"revealjs",
15+
"beamer",
1516
"webwork",
1617
"custom",
1718
]
@@ -123,6 +124,20 @@
123124
"datafile",
124125
"myopenmath",
125126
],
127+
"beamer": [
128+
"webwork",
129+
"sageplot",
130+
"asymptote",
131+
"prefigure",
132+
"youtube",
133+
"codelens",
134+
"datafile",
135+
"interactive",
136+
"qrcode",
137+
"mermaid",
138+
"myopenmath",
139+
"dynamic-subs",
140+
],
126141
"webwork": [
127142
"webwork",
128143
],
@@ -239,6 +254,13 @@
239254
"sageplot": ["html", "svg"],
240255
"prefigure": ["svg"],
241256
},
257+
"beamer": {
258+
"asymptote": ["pdf"],
259+
"latex-image": [],
260+
"sageplot": ["pdf", "png"],
261+
"prefigure": ["pdf"],
262+
"mermaid": ["png"],
263+
},
242264
"webwork": {
243265
"asymptote": [],
244266
"latex-image": [],

pretext/project/__init__.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ class Format(str, Enum):
5656
KINDLE = "kindle"
5757
BRAILLE = "braille"
5858
REVEALJS = "revealjs"
59+
BEAMER = "beamer"
5960
WEBWORK = "webwork"
6061
CUSTOM = "custom"
6162

@@ -67,6 +68,7 @@ class Format(str, Enum):
6768
Format.EPUB: ".epub",
6869
Format.KINDLE: ".epub",
6970
Format.BRAILLE: ".brl",
71+
Format.BEAMER: ".pdf",
7072
}
7173

7274

@@ -874,6 +876,7 @@ def build(
874876
dest_dir=self.output_dir_abspath().as_posix(),
875877
method=self.pdf_method,
876878
outputs="all" if latex else "pdf-only",
879+
format_xsl=None,
877880
)
878881
elif self.format == Format.LATEX:
879882
core.pdf(
@@ -885,6 +888,7 @@ def build(
885888
dest_dir=self.output_dir_abspath().as_posix(),
886889
method=self.pdf_method,
887890
outputs="prebuild",
891+
format_xsl=None,
888892
)
889893
elif self.format == Format.EPUB:
890894
utils.mjsre_npm_install()
@@ -930,6 +934,17 @@ def build(
930934
out_file=out_file,
931935
dest_dir=self.output_dir_abspath().as_posix(),
932936
)
937+
elif self.format == Format.BEAMER:
938+
core.beamer(
939+
xml=self.source_abspath(),
940+
pub_file=self.publication_abspath().as_posix(),
941+
stringparams=stringparams_copy,
942+
extra_xsl=custom_xsl,
943+
out_file=out_file,
944+
dest_dir=self.output_dir_abspath().as_posix(),
945+
method=self.pdf_method,
946+
outputs="all" if latex else "pdf-only",
947+
)
933948
elif self.format == Format.BRAILLE:
934949
log.warning(
935950
"Braille output is still experimental, and requires additional libraries from liblouis (specifically the file2brl software)."

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ plastex = "^3"
4545
jinja2 = "^3"
4646
coloraide = "^4"
4747
pelican = { extras = ["markdown"], version = "^4.10", optional = true }
48-
prefig = { extras = ["text"], version = "^0.6.5", optional = true }
48+
prefig = { extras = ["text"], version = "^0.6.7", optional = true }
4949
citeproc-py = "^0"
5050

5151

schema/project-ptx.rnc

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,14 +44,15 @@ Target = element target {
4444
## Unique identifier for this build target. This is the name you pass on the
4545
## command line when building via the `pretext` CLI.
4646
attribute name { text },
47-
## the required format can be `html`, `pdf`, `latex`, `epub`, `kindle`, `braille`, `revealjs`, `webwork`, or `custom`.
47+
## the required format can be `html`, `pdf`, `latex`, `epub`, `kindle`, `braille`, `revealjs`, `beamer`, `webwork`, or `custom`.
4848
(
4949
HtmlAttributes
5050
| PdfAttributes
5151
| LatexAttributes
5252
| EpubAttributes
5353
| BrailleAttributes
5454
| RevealjsAttributes
55+
| BeamerAttributes
5556
| WebworkAttributes
5657
| CustomAttributes
5758
),
@@ -81,6 +82,7 @@ HtmlAttributes = (
8182

8283
PdfAttributes = (
8384
attribute format { "pdf" },
85+
attribute pdf-method { "xelatex" | "pdflatex" | "latex" | "pdf-fo"}?,
8486
attribute latex-engine { "xelatex" | "pdflatex" | "latex" }?,
8587
attribute output-filename { text }?
8688
)
@@ -105,6 +107,11 @@ RevealjsAttributes = (
105107
attribute output-filename { text }?
106108
)
107109

110+
BeamerAttributes = (
111+
attribute format { "beamer" },
112+
attribute output-filename { text }?
113+
)
114+
108115
WebworkAttributes = (
109116
attribute format { "webwork" },
110117
attribute compression { "zip" }?
@@ -127,4 +134,4 @@ Stringparams = element stringparams {
127134
attribute html.css.extra { text }?
128135
}
129136

130-
}
137+
}

schema/project-ptx.rng

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,13 +74,14 @@
7474
command line when building via the `pretext` CLI.</a:documentation>
7575
</attribute>
7676
<choice>
77-
<a:documentation>the required format can be `html`, `pdf`, `latex`, `epub`, `kindle`, `braille`, `revealjs`, `webwork`, or `custom`.</a:documentation>
77+
<a:documentation>the required format can be `html`, `pdf`, `latex`, `epub`, `kindle`, `braille`, `revealjs`, `beamer`, `webwork`, or `custom`.</a:documentation>
7878
<ref name="HtmlAttributes"/>
7979
<ref name="PdfAttributes"/>
8080
<ref name="LatexAttributes"/>
8181
<ref name="EpubAttributes"/>
8282
<ref name="BrailleAttributes"/>
8383
<ref name="RevealjsAttributes"/>
84+
<ref name="BeamerAttributes"/>
8485
<ref name="WebworkAttributes"/>
8586
<ref name="CustomAttributes"/>
8687
</choice>
@@ -158,6 +159,16 @@ These parameters are rarely used by content authors.</a:documentation>
158159
<attribute name="format">
159160
<value>pdf</value>
160161
</attribute>
162+
<optional>
163+
<attribute name="pdf-method">
164+
<choice>
165+
<value>xelatex</value>
166+
<value>pdflatex</value>
167+
<value>latex</value>
168+
<value>pdf-fo</value>
169+
</choice>
170+
</attribute>
171+
</optional>
161172
<optional>
162173
<attribute name="latex-engine">
163174
<choice>
@@ -211,6 +222,14 @@ These parameters are rarely used by content authors.</a:documentation>
211222
<attribute name="output-filename"/>
212223
</optional>
213224
</define>
225+
<define name="BeamerAttributes">
226+
<attribute name="format">
227+
<value>beamer</value>
228+
</attribute>
229+
<optional>
230+
<attribute name="output-filename"/>
231+
</optional>
232+
</define>
214233
<define name="WebworkAttributes">
215234
<attribute name="format">
216235
<value>webwork</value>
11.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)