Skip to content

Commit 04503ad

Browse files
Fix Sphinx exceptions when trying to build documentation via latex / as pdf (#4370)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
1 parent 9c9ebf4 commit 04503ad

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
# This specifies any additional css files that will override the theme's
157157
html_css_files = ["custom.css"]
158158

159+
latex_engine = "lualatex"
159160

160161
# external links
161162
extlinks = {

manim/utils/docbuild/autocolor_directive.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -79,15 +79,18 @@ def run(self) -> list[nodes.Element]:
7979

8080
for base_i in range(0, len(color_elements), num_color_cols):
8181
row = nodes.row()
82-
for member_name, hex_code, font_color in color_elements[
83-
base_i : base_i + num_color_cols
84-
]:
85-
col1 = nodes.literal(text=member_name)
86-
col2 = nodes.raw(
87-
"",
88-
f'<div style="background-color:{hex_code};padding: 0.25rem 0;border-radius:8px;margin: 0.5rem 0.2rem"><code style="color:{font_color};">{hex_code}</code></div>',
89-
format="html",
90-
)
82+
for idx in range(base_i, base_i + num_color_cols):
83+
if idx < len(color_elements):
84+
member_name, hex_code, font_color = color_elements[idx]
85+
col1 = nodes.literal(text=member_name)
86+
col2 = nodes.raw(
87+
"",
88+
f'<div style="background-color:{hex_code};padding: 0.25rem 0;border-radius:8px;margin: 0.5rem 0.2rem"><code style="color:{font_color};">{hex_code}</code></div>',
89+
format="html",
90+
)
91+
else:
92+
col1 = nodes.literal(text="")
93+
col2 = nodes.raw("", "", format="html")
9194
row += nodes.entry("", col1)
9295
row += nodes.entry("", col2)
9396
tbody += row

manim/utils/docbuild/manim_directive.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,11 @@ def _delete_rendering_times(*args: tuple[Any]) -> None:
399399

400400

401401
def setup(app: Sphinx) -> SetupMetadata:
402-
app.add_node(SkipManimNode, html=(visit, depart))
402+
app.add_node(
403+
SkipManimNode,
404+
html=(visit, depart),
405+
latex=(lambda a, b: None, lambda a, b: None),
406+
)
403407

404408
setup.app = app # type: ignore[attr-defined]
405409
setup.config = app.config # type: ignore[attr-defined]

0 commit comments

Comments
 (0)