Skip to content

armgit / manim

Public Imported from GitHub
0

A community-maintained Python framework for creating mathematical animations.

Fix Sphinx exceptions when trying to build documentation via latex / as pdf (#4370)

Benjamin Hackl04503adb702b
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 821d58d85..bd55b2d34 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -156,6 +156,7 @@ html_title = f"Manim Community v{manim.__version__}"
# This specifies any additional css files that will override the theme's
html_css_files = ["custom.css"]
+latex_engine = "lualatex"
# external links
extlinks = {
diff --git a/manim/utils/docbuild/autocolor_directive.py b/manim/utils/docbuild/autocolor_directive.py
index 476dcb132..108d97ef1 100644
--- a/manim/utils/docbuild/autocolor_directive.py
+++ b/manim/utils/docbuild/autocolor_directive.py
@@ -79,15 +79,18 @@ class ManimColorModuleDocumenter(Directive):
for base_i in range(0, len(color_elements), num_color_cols):
row = nodes.row()
- for member_name, hex_code, font_color in color_elements[
- base_i : base_i + num_color_cols
- ]:
- col1 = nodes.literal(text=member_name)
- col2 = nodes.raw(
- "",
- 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>',
- format="html",
- )
+ for idx in range(base_i, base_i + num_color_cols):
+ if idx < len(color_elements):
+ member_name, hex_code, font_color = color_elements[idx]
+ col1 = nodes.literal(text=member_name)
+ col2 = nodes.raw(
+ "",
+ 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>',
+ format="html",
+ )
+ else:
+ col1 = nodes.literal(text="")
+ col2 = nodes.raw("", "", format="html")
row += nodes.entry("", col1)
row += nodes.entry("", col2)
tbody += row
diff --git a/manim/utils/docbuild/manim_directive.py b/manim/utils/docbuild/manim_directive.py
index b94b7386c..d2e8c74ae 100644
--- a/manim/utils/docbuild/manim_directive.py
+++ b/manim/utils/docbuild/manim_directive.py
@@ -399,7 +399,11 @@ def _delete_rendering_times(*args: tuple[Any]) -> None:
def setup(app: Sphinx) -> SetupMetadata:
- app.add_node(SkipManimNode, html=(visit, depart))
+ app.add_node(
+ SkipManimNode,
+ html=(visit, depart),
+ latex=(lambda a, b: None, lambda a, b: None),
+ )
setup.app = app # type: ignore[attr-defined]
setup.config = app.config # type: ignore[attr-defined]