manim 0.18.0__py3-none-any.whl → 0.18.1__py3-none-any.whl
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.
Potentially problematic release.
This version of manim might be problematic. Click here for more details.
- manim/__init__.py +3 -6
- manim/__main__.py +18 -10
- manim/_config/__init__.py +5 -2
- manim/_config/cli_colors.py +12 -8
- manim/_config/default.cfg +1 -1
- manim/_config/logger_utils.py +9 -8
- manim/_config/utils.py +637 -449
- manim/animation/animation.py +9 -2
- manim/animation/composition.py +78 -40
- manim/animation/creation.py +12 -6
- manim/animation/fading.py +0 -1
- manim/animation/indication.py +10 -21
- manim/animation/movement.py +1 -2
- manim/animation/rotation.py +1 -1
- manim/animation/specialized.py +1 -1
- manim/animation/speedmodifier.py +7 -2
- manim/animation/transform_matching_parts.py +1 -1
- manim/camera/camera.py +13 -4
- manim/cli/cfg/group.py +18 -8
- manim/cli/checkhealth/checks.py +2 -0
- manim/cli/checkhealth/commands.py +2 -0
- manim/cli/default_group.py +13 -5
- manim/cli/init/commands.py +4 -1
- manim/cli/plugins/commands.py +3 -0
- manim/cli/render/commands.py +27 -20
- manim/cli/render/ease_of_access_options.py +4 -3
- manim/cli/render/global_options.py +9 -7
- manim/cli/render/output_options.py +6 -5
- manim/cli/render/render_options.py +13 -13
- manim/constants.py +54 -15
- manim/gui/gui.py +2 -0
- manim/mobject/geometry/arc.py +4 -4
- manim/mobject/geometry/boolean_ops.py +13 -9
- manim/mobject/geometry/line.py +16 -8
- manim/mobject/geometry/polygram.py +17 -5
- manim/mobject/geometry/tips.py +2 -2
- manim/mobject/graph.py +379 -106
- manim/mobject/graphing/coordinate_systems.py +17 -20
- manim/mobject/graphing/functions.py +14 -10
- manim/mobject/graphing/number_line.py +1 -1
- manim/mobject/mobject.py +175 -72
- manim/mobject/opengl/opengl_compatibility.py +2 -0
- manim/mobject/opengl/opengl_geometry.py +26 -1
- manim/mobject/opengl/opengl_image_mobject.py +2 -0
- manim/mobject/opengl/opengl_mobject.py +3 -0
- manim/mobject/opengl/opengl_point_cloud_mobject.py +2 -0
- manim/mobject/opengl/opengl_surface.py +2 -0
- manim/mobject/opengl/opengl_three_dimensions.py +2 -0
- manim/mobject/opengl/opengl_vectorized_mobject.py +19 -14
- manim/mobject/svg/brace.py +2 -0
- manim/mobject/svg/svg_mobject.py +10 -12
- manim/mobject/table.py +0 -1
- manim/mobject/text/code_mobject.py +2 -0
- manim/mobject/text/numbers.py +2 -0
- manim/mobject/text/tex_mobject.py +1 -1
- manim/mobject/text/text_mobject.py +43 -6
- manim/mobject/three_d/three_d_utils.py +4 -4
- manim/mobject/three_d/three_dimensions.py +4 -4
- manim/mobject/types/image_mobject.py +5 -1
- manim/mobject/types/point_cloud_mobject.py +2 -0
- manim/mobject/types/vectorized_mobject.py +124 -29
- manim/mobject/value_tracker.py +3 -3
- manim/mobject/vector_field.py +3 -1
- manim/plugins/__init__.py +15 -1
- manim/plugins/plugins_flags.py +11 -5
- manim/renderer/cairo_renderer.py +12 -2
- manim/renderer/opengl_renderer.py +2 -3
- manim/renderer/opengl_renderer_window.py +2 -0
- manim/renderer/shader_wrapper.py +2 -0
- manim/renderer/vectorized_mobject_rendering.py +5 -0
- manim/scene/scene.py +22 -6
- manim/scene/scene_file_writer.py +3 -1
- manim/scene/section.py +2 -0
- manim/scene/three_d_scene.py +5 -6
- manim/scene/vector_space_scene.py +21 -5
- manim/typing.py +567 -67
- manim/utils/bezier.py +9 -18
- manim/utils/caching.py +2 -0
- manim/utils/color/BS381.py +1 -0
- manim/utils/color/XKCD.py +1 -0
- manim/utils/color/core.py +31 -13
- manim/utils/commands.py +8 -1
- manim/utils/debug.py +0 -1
- manim/utils/deprecation.py +3 -2
- manim/utils/docbuild/__init__.py +17 -0
- manim/utils/docbuild/autoaliasattr_directive.py +197 -0
- manim/utils/docbuild/autocolor_directive.py +9 -4
- manim/utils/docbuild/manim_directive.py +18 -9
- manim/utils/docbuild/module_parsing.py +198 -0
- manim/utils/exceptions.py +6 -0
- manim/utils/family.py +2 -0
- manim/utils/family_ops.py +5 -0
- manim/utils/file_ops.py +6 -2
- manim/utils/hashing.py +2 -0
- manim/utils/ipython_magic.py +2 -0
- manim/utils/module_ops.py +2 -0
- manim/utils/opengl.py +14 -0
- manim/utils/parameter_parsing.py +31 -0
- manim/utils/paths.py +12 -20
- manim/utils/rate_functions.py +6 -8
- manim/utils/space_ops.py +81 -36
- manim/utils/testing/__init__.py +17 -0
- manim/utils/testing/frames_comparison.py +7 -5
- manim/utils/tex.py +124 -196
- manim/utils/tex_file_writing.py +2 -0
- manim/utils/tex_templates.py +1 -0
- {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/LICENSE.community +1 -1
- {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/METADATA +29 -35
- {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/RECORD +112 -112
- {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/WHEEL +1 -1
- manim/cli/new/__init__.py +0 -0
- manim/cli/new/group.py +0 -189
- manim/plugins/import_plugins.py +0 -43
- {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/LICENSE +0 -0
- {manim-0.18.0.dist-info → manim-0.18.1.dist-info}/entry_points.txt +0 -0
|
@@ -214,11 +214,13 @@ def _make_test_comparing_frames(
|
|
|
214
214
|
# If you pass a custom renderer to the Scene, the Camera class given as an argument in the Scene
|
|
215
215
|
# is not passed to the renderer. See __init__ of Scene.
|
|
216
216
|
# This potentially prevents OpenGL testing.
|
|
217
|
-
test_renderer=
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
217
|
+
test_renderer=(
|
|
218
|
+
testRenderer(file_writer_class=file_writer_class)
|
|
219
|
+
if base_scene is not ThreeDScene
|
|
220
|
+
else testRenderer(
|
|
221
|
+
file_writer_class=file_writer_class,
|
|
222
|
+
camera_class=ThreeDCamera,
|
|
223
|
+
)
|
|
222
224
|
), # testRenderer(file_writer_class=file_writer_class),
|
|
223
225
|
)
|
|
224
226
|
scene_tested = sceneTested(skip_animations=True)
|
manim/utils/tex.py
CHANGED
|
@@ -4,162 +4,132 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
__all__ = [
|
|
6
6
|
"TexTemplate",
|
|
7
|
-
"TexTemplateFromFile",
|
|
8
7
|
]
|
|
9
8
|
|
|
10
9
|
import copy
|
|
11
|
-
import os
|
|
12
10
|
import re
|
|
11
|
+
import warnings
|
|
12
|
+
from dataclasses import dataclass, field
|
|
13
13
|
from pathlib import Path
|
|
14
|
+
from typing import TYPE_CHECKING, Any
|
|
14
15
|
|
|
16
|
+
if TYPE_CHECKING:
|
|
17
|
+
from typing_extensions import Self
|
|
15
18
|
|
|
16
|
-
|
|
17
|
-
"""TeX templates are used for creating Tex() and MathTex() objects.
|
|
18
|
-
|
|
19
|
-
Parameters
|
|
20
|
-
----------
|
|
21
|
-
tex_compiler
|
|
22
|
-
The TeX compiler to be used, e.g. ``latex``, ``pdflatex`` or ``lualatex``
|
|
23
|
-
output_format
|
|
24
|
-
The output format resulting from compilation, e.g. ``.dvi`` or ``.pdf``
|
|
25
|
-
documentclass
|
|
26
|
-
The command defining the documentclass, e.g. ``\\documentclass[preview]{standalone}``
|
|
27
|
-
preamble
|
|
28
|
-
The document's preamble, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
|
29
|
-
placeholder_text
|
|
30
|
-
Text in the document that will be replaced by the expression to be rendered
|
|
31
|
-
post_doc_commands
|
|
32
|
-
Text (definitions, commands) to be inserted at right after ``\\begin{document}``, e.g. ``\\boldmath``
|
|
33
|
-
|
|
34
|
-
Attributes
|
|
35
|
-
----------
|
|
36
|
-
tex_compiler : :class:`str`
|
|
37
|
-
The TeX compiler to be used, e.g. ``latex``, ``pdflatex`` or ``lualatex``
|
|
38
|
-
output_format : :class:`str`
|
|
39
|
-
The output format resulting from compilation, e.g. ``.dvi`` or ``.pdf``
|
|
40
|
-
documentclass : :class:`str`
|
|
41
|
-
The command defining the documentclass, e.g. ``\\documentclass[preview]{standalone}``
|
|
42
|
-
preamble : :class:`str`
|
|
43
|
-
The document's preamble, i.e. the part between ``\\documentclass`` and ``\\begin{document}``
|
|
44
|
-
placeholder_text : :class:`str`
|
|
45
|
-
Text in the document that will be replaced by the expression to be rendered
|
|
46
|
-
post_doc_commands : :class:`str`
|
|
47
|
-
Text (definitions, commands) to be inserted at right after ``\\begin{document}``, e.g. ``\\boldmath``
|
|
48
|
-
"""
|
|
19
|
+
from manim.typing import StrPath
|
|
49
20
|
|
|
50
|
-
|
|
51
|
-
default_preamble = r"""
|
|
52
|
-
\usepackage[english]{babel}
|
|
21
|
+
_DEFAULT_PREAMBLE = r"""\usepackage[english]{babel}
|
|
53
22
|
\usepackage{amsmath}
|
|
54
|
-
\usepackage{amssymb}
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
default_post_doc_commands = ""
|
|
60
|
-
|
|
61
|
-
def __init__(
|
|
62
|
-
self,
|
|
63
|
-
tex_compiler: str | None = None,
|
|
64
|
-
output_format: str | None = None,
|
|
65
|
-
documentclass: str | None = None,
|
|
66
|
-
preamble: str | None = None,
|
|
67
|
-
placeholder_text: str | None = None,
|
|
68
|
-
post_doc_commands: str | None = None,
|
|
69
|
-
**kwargs,
|
|
70
|
-
):
|
|
71
|
-
self.tex_compiler = (
|
|
72
|
-
tex_compiler
|
|
73
|
-
if tex_compiler is not None
|
|
74
|
-
else TexTemplate.default_tex_compiler
|
|
75
|
-
)
|
|
76
|
-
self.output_format = (
|
|
77
|
-
output_format
|
|
78
|
-
if output_format is not None
|
|
79
|
-
else TexTemplate.default_output_format
|
|
80
|
-
)
|
|
81
|
-
self.documentclass = (
|
|
82
|
-
documentclass
|
|
83
|
-
if documentclass is not None
|
|
84
|
-
else TexTemplate.default_documentclass
|
|
85
|
-
)
|
|
86
|
-
self.preamble = (
|
|
87
|
-
preamble if preamble is not None else TexTemplate.default_preamble
|
|
88
|
-
)
|
|
89
|
-
self.placeholder_text = (
|
|
90
|
-
placeholder_text
|
|
91
|
-
if placeholder_text is not None
|
|
92
|
-
else TexTemplate.default_placeholder_text
|
|
93
|
-
)
|
|
94
|
-
self.post_doc_commands = (
|
|
95
|
-
post_doc_commands
|
|
96
|
-
if post_doc_commands is not None
|
|
97
|
-
else TexTemplate.default_post_doc_commands
|
|
98
|
-
)
|
|
99
|
-
self._rebuild()
|
|
100
|
-
|
|
101
|
-
def __eq__(self, other: TexTemplate) -> bool:
|
|
102
|
-
return (
|
|
103
|
-
self.body == other.body
|
|
104
|
-
and self.tex_compiler == other.tex_compiler
|
|
105
|
-
and self.output_format == other.output_format
|
|
106
|
-
and self.post_doc_commands == other.post_doc_commands
|
|
107
|
-
)
|
|
23
|
+
\usepackage{amssymb}"""
|
|
24
|
+
|
|
25
|
+
_BEGIN_DOCUMENT = r"\begin{document}"
|
|
26
|
+
_END_DOCUMENT = r"\end{document}"
|
|
27
|
+
|
|
108
28
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
29
|
+
@dataclass(eq=True)
|
|
30
|
+
class TexTemplate:
|
|
31
|
+
"""TeX templates are used to create ``Tex`` and ``MathTex`` objects."""
|
|
32
|
+
|
|
33
|
+
_body: str = field(default="", init=False)
|
|
34
|
+
"""A custom body, can be set from a file."""
|
|
35
|
+
|
|
36
|
+
tex_compiler: str = "latex"
|
|
37
|
+
"""The TeX compiler to be used, e.g. ``latex``, ``pdflatex`` or ``lualatex``."""
|
|
38
|
+
|
|
39
|
+
output_format: str = ".dvi"
|
|
40
|
+
"""The output format resulting from compilation, e.g. ``.dvi`` or ``.pdf``."""
|
|
41
|
+
|
|
42
|
+
documentclass: str = r"\documentclass[preview]{standalone}"
|
|
43
|
+
r"""The command defining the documentclass, e.g. ``\documentclass[preview]{standalone}``."""
|
|
44
|
+
|
|
45
|
+
preamble: str = _DEFAULT_PREAMBLE
|
|
46
|
+
r"""The document's preamble, i.e. the part between ``\documentclass`` and ``\begin{document}``."""
|
|
47
|
+
|
|
48
|
+
placeholder_text: str = "YourTextHere"
|
|
49
|
+
"""Text in the document that will be replaced by the expression to be rendered."""
|
|
50
|
+
|
|
51
|
+
post_doc_commands: str = ""
|
|
52
|
+
r"""Text (definitions, commands) to be inserted at right after ``\begin{document}``, e.g. ``\boldmath``."""
|
|
53
|
+
|
|
54
|
+
@property
|
|
55
|
+
def body(self) -> str:
|
|
56
|
+
"""The entire TeX template."""
|
|
57
|
+
return self._body or "\n".join(
|
|
58
|
+
filter(
|
|
59
|
+
None,
|
|
60
|
+
[
|
|
61
|
+
self.documentclass,
|
|
62
|
+
self.preamble,
|
|
63
|
+
_BEGIN_DOCUMENT,
|
|
64
|
+
self.post_doc_commands,
|
|
65
|
+
self.placeholder_text,
|
|
66
|
+
_END_DOCUMENT,
|
|
67
|
+
],
|
|
68
|
+
)
|
|
125
69
|
)
|
|
126
70
|
|
|
127
|
-
|
|
128
|
-
|
|
71
|
+
@body.setter
|
|
72
|
+
def body(self, value: str) -> None:
|
|
73
|
+
self._body = value
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def from_file(cls, file: StrPath = "tex_template.tex", **kwargs: Any) -> Self:
|
|
77
|
+
"""Create an instance by reading the content of a file.
|
|
78
|
+
|
|
79
|
+
Using the ``add_to_preamble`` and ``add_to_document`` methods on this instance
|
|
80
|
+
will have no effect, as the body is read from the file.
|
|
81
|
+
"""
|
|
82
|
+
instance = cls(**kwargs)
|
|
83
|
+
instance.body = Path(file).read_text(encoding="utf-8")
|
|
84
|
+
return instance
|
|
85
|
+
|
|
86
|
+
def add_to_preamble(self, txt: str, prepend: bool = False) -> Self:
|
|
87
|
+
r"""Adds text to the TeX template's preamble (e.g. definitions, packages). Text can be inserted at the beginning or at the end of the preamble.
|
|
129
88
|
|
|
130
89
|
Parameters
|
|
131
90
|
----------
|
|
132
91
|
txt
|
|
133
|
-
String containing the text to be added, e.g.
|
|
92
|
+
String containing the text to be added, e.g. ``\usepackage{hyperref}``.
|
|
134
93
|
prepend
|
|
135
|
-
Whether the text should be added at the beginning of the preamble, i.e. right after
|
|
94
|
+
Whether the text should be added at the beginning of the preamble, i.e. right after ``\documentclass``.
|
|
95
|
+
Default is to add it at the end of the preamble, i.e. right before ``\begin{document}``.
|
|
136
96
|
"""
|
|
97
|
+
if self._body:
|
|
98
|
+
warnings.warn(
|
|
99
|
+
"This TeX template was created with a fixed body, trying to add text the preamble will have no effect.",
|
|
100
|
+
UserWarning,
|
|
101
|
+
stacklevel=2,
|
|
102
|
+
)
|
|
137
103
|
if prepend:
|
|
138
104
|
self.preamble = txt + "\n" + self.preamble
|
|
139
105
|
else:
|
|
140
106
|
self.preamble += "\n" + txt
|
|
141
|
-
self._rebuild()
|
|
142
107
|
return self
|
|
143
108
|
|
|
144
|
-
def add_to_document(self, txt: str):
|
|
145
|
-
"""Adds
|
|
109
|
+
def add_to_document(self, txt: str) -> Self:
|
|
110
|
+
r"""Adds text to the TeX template just after \begin{document}, e.g. ``\boldmath``.
|
|
146
111
|
|
|
147
112
|
Parameters
|
|
148
113
|
----------
|
|
149
114
|
txt
|
|
150
115
|
String containing the text to be added.
|
|
151
116
|
"""
|
|
152
|
-
self.
|
|
153
|
-
|
|
117
|
+
if self._body:
|
|
118
|
+
warnings.warn(
|
|
119
|
+
"This TeX template was created with a fixed body, trying to add text the document will have no effect.",
|
|
120
|
+
UserWarning,
|
|
121
|
+
stacklevel=2,
|
|
122
|
+
)
|
|
123
|
+
self.post_doc_commands += txt
|
|
154
124
|
return self
|
|
155
125
|
|
|
156
|
-
def get_texcode_for_expression(self, expression: str):
|
|
157
|
-
"""Inserts expression verbatim into TeX template.
|
|
126
|
+
def get_texcode_for_expression(self, expression: str) -> str:
|
|
127
|
+
r"""Inserts expression verbatim into TeX template.
|
|
158
128
|
|
|
159
129
|
Parameters
|
|
160
130
|
----------
|
|
161
131
|
expression
|
|
162
|
-
The string containing the expression to be typeset, e.g.
|
|
132
|
+
The string containing the expression to be typeset, e.g. ``$\sqrt{2}$``
|
|
163
133
|
|
|
164
134
|
Returns
|
|
165
135
|
-------
|
|
@@ -168,102 +138,60 @@ class TexTemplate:
|
|
|
168
138
|
"""
|
|
169
139
|
return self.body.replace(self.placeholder_text, expression)
|
|
170
140
|
|
|
171
|
-
def
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
Parameters
|
|
176
|
-
----------
|
|
177
|
-
environment
|
|
178
|
-
The tex_environment as a string. Acceptable formats include:
|
|
179
|
-
``{align*}``, ``align*``, ``{tabular}[t]{cccl}``, ``tabular}{cccl``, ``\\begin{tabular}[t]{cccl}``.
|
|
180
|
-
|
|
181
|
-
Returns
|
|
182
|
-
-------
|
|
183
|
-
Tuple[:class:`str`, :class:`str`]
|
|
184
|
-
A pair of strings representing the opening and closing of the tex environment, e.g.
|
|
185
|
-
``\\begin{tabular}{cccl}`` and ``\\end{tabular}``
|
|
186
|
-
"""
|
|
187
|
-
|
|
188
|
-
# If the environment starts with \begin, remove it
|
|
189
|
-
if environment[0:6] == r"\begin":
|
|
190
|
-
environment = environment[6:]
|
|
191
|
-
|
|
192
|
-
# If environment begins with { strip it
|
|
193
|
-
if environment[0] == r"{":
|
|
194
|
-
environment = environment[1:]
|
|
195
|
-
|
|
196
|
-
# The \begin command takes everything and closes with a brace
|
|
197
|
-
begin = r"\begin{" + environment
|
|
198
|
-
if (
|
|
199
|
-
begin[-1] != r"}" and begin[-1] != r"]"
|
|
200
|
-
): # If it doesn't end on } or ], assume missing }
|
|
201
|
-
begin += r"}"
|
|
202
|
-
|
|
203
|
-
# While the \end command terminates at the first closing brace
|
|
204
|
-
split_at_brace = re.split(r"}", environment, 1)
|
|
205
|
-
end = r"\end{" + split_at_brace[0] + r"}"
|
|
206
|
-
|
|
207
|
-
return begin, end
|
|
208
|
-
|
|
209
|
-
def get_texcode_for_expression_in_env(self, expression: str, environment: str):
|
|
210
|
-
r"""Inserts expression into TeX template wrapped in \begin{environment} and \end{environment}
|
|
141
|
+
def get_texcode_for_expression_in_env(
|
|
142
|
+
self, expression: str, environment: str
|
|
143
|
+
) -> str:
|
|
144
|
+
r"""Inserts expression into TeX template wrapped in ``\begin{environment}`` and ``\end{environment}``.
|
|
211
145
|
|
|
212
146
|
Parameters
|
|
213
147
|
----------
|
|
214
148
|
expression
|
|
215
|
-
The string containing the expression to be typeset, e.g.
|
|
149
|
+
The string containing the expression to be typeset, e.g. ``$\sqrt{2}$``.
|
|
216
150
|
environment
|
|
217
|
-
The string containing the environment in which the expression should be typeset, e.g. ``align
|
|
151
|
+
The string containing the environment in which the expression should be typeset, e.g. ``align*``.
|
|
218
152
|
|
|
219
153
|
Returns
|
|
220
154
|
-------
|
|
221
155
|
:class:`str`
|
|
222
156
|
LaTeX code based on template, containing the given expression inside its environment, ready for typesetting
|
|
223
157
|
"""
|
|
224
|
-
begin, end =
|
|
225
|
-
return self.body.replace(
|
|
158
|
+
begin, end = _texcode_for_environment(environment)
|
|
159
|
+
return self.body.replace(
|
|
160
|
+
self.placeholder_text, "\n".join([begin, expression, end])
|
|
161
|
+
)
|
|
226
162
|
|
|
227
|
-
def copy(self) ->
|
|
163
|
+
def copy(self) -> Self:
|
|
164
|
+
"""Create a deep copy of the TeX template instance."""
|
|
228
165
|
return copy.deepcopy(self)
|
|
229
166
|
|
|
230
167
|
|
|
231
|
-
|
|
232
|
-
"""
|
|
168
|
+
def _texcode_for_environment(environment: str) -> tuple[str, str]:
|
|
169
|
+
r"""Processes the tex_environment string to return the correct ``\begin{environment}[extra]{extra}`` and
|
|
170
|
+
``\end{environment}`` strings.
|
|
233
171
|
|
|
234
172
|
Parameters
|
|
235
173
|
----------
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
body : :class:`str`
|
|
246
|
-
Content of the TeX template file
|
|
247
|
-
tex_compiler : :class:`str`
|
|
248
|
-
The TeX compiler to be used, e.g. ``latex``, ``pdflatex`` or ``lualatex``
|
|
249
|
-
output_format : :class:`str`
|
|
250
|
-
The output format resulting from compilation, e.g. ``.dvi`` or ``.pdf``
|
|
174
|
+
environment
|
|
175
|
+
The tex_environment as a string. Acceptable formats include:
|
|
176
|
+
``{align*}``, ``align*``, ``{tabular}[t]{cccl}``, ``tabular}{cccl``, ``\begin{tabular}[t]{cccl}``.
|
|
177
|
+
|
|
178
|
+
Returns
|
|
179
|
+
-------
|
|
180
|
+
Tuple[:class:`str`, :class:`str`]
|
|
181
|
+
A pair of strings representing the opening and closing of the tex environment, e.g.
|
|
182
|
+
``\begin{tabular}{cccl}`` and ``\end{tabular}``
|
|
251
183
|
"""
|
|
252
184
|
|
|
253
|
-
|
|
254
|
-
self, *, tex_filename: str | os.PathLike = "tex_template.tex", **kwargs
|
|
255
|
-
):
|
|
256
|
-
self.template_file = Path(tex_filename)
|
|
257
|
-
super().__init__(**kwargs)
|
|
258
|
-
|
|
259
|
-
def _rebuild(self):
|
|
260
|
-
self.body = self.template_file.read_text()
|
|
185
|
+
environment.removeprefix(r"\begin").removeprefix("{")
|
|
261
186
|
|
|
262
|
-
|
|
263
|
-
|
|
187
|
+
# The \begin command takes everything and closes with a brace
|
|
188
|
+
begin = r"\begin{" + environment
|
|
189
|
+
# If it doesn't end on } or ], assume missing }
|
|
190
|
+
if not begin.endswith(("}", "]")):
|
|
191
|
+
begin += "}"
|
|
264
192
|
|
|
265
|
-
|
|
266
|
-
|
|
193
|
+
# While the \end command terminates at the first closing brace
|
|
194
|
+
split_at_brace = re.split("}", environment, 1)
|
|
195
|
+
end = r"\end{" + split_at_brace[0] + "}"
|
|
267
196
|
|
|
268
|
-
|
|
269
|
-
self.file_not_mutable()
|
|
197
|
+
return begin, end
|
manim/utils/tex_file_writing.py
CHANGED
manim/utils/tex_templates.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) 2024, the Manim Community Developers
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -1,59 +1,53 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: manim
|
|
3
|
-
Version: 0.18.
|
|
3
|
+
Version: 0.18.1
|
|
4
4
|
Summary: Animation engine for explanatory math videos.
|
|
5
5
|
Home-page: https://www.manim.community/
|
|
6
6
|
License: MIT
|
|
7
7
|
Author: The Manim Community Developers
|
|
8
8
|
Author-email: contact@manim.community
|
|
9
|
-
Requires-Python: >=3.
|
|
9
|
+
Requires-Python: >=3.9,<3.13
|
|
10
10
|
Classifier: Development Status :: 4 - Beta
|
|
11
11
|
Classifier: License :: OSI Approved :: MIT License
|
|
12
12
|
Classifier: Natural Language :: English
|
|
13
13
|
Classifier: Programming Language :: Python :: 3
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.9
|
|
16
15
|
Classifier: Programming Language :: Python :: 3.10
|
|
17
16
|
Classifier: Programming Language :: Python :: 3.11
|
|
18
17
|
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
19
19
|
Classifier: Topic :: Multimedia :: Graphics
|
|
20
20
|
Classifier: Topic :: Multimedia :: Video
|
|
21
21
|
Classifier: Topic :: Scientific/Engineering
|
|
22
22
|
Provides-Extra: gui
|
|
23
23
|
Provides-Extra: jupyterlab
|
|
24
|
-
Requires-Dist: Pillow (>=9.1
|
|
25
|
-
Requires-Dist: Pygments (>=2.
|
|
26
|
-
Requires-Dist:
|
|
27
|
-
Requires-Dist:
|
|
28
|
-
Requires-Dist:
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
Requires-Dist:
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist: isosurfaces (==0.1.0)
|
|
34
|
-
Requires-Dist: jupyterlab (>=3.0,<4.0) ; extra == "jupyterlab"
|
|
24
|
+
Requires-Dist: Pillow (>=9.1)
|
|
25
|
+
Requires-Dist: Pygments (>=2.0.0)
|
|
26
|
+
Requires-Dist: click (>=8.0)
|
|
27
|
+
Requires-Dist: cloup (>=2.0.0)
|
|
28
|
+
Requires-Dist: dearpygui (>=1.0.0) ; extra == "gui"
|
|
29
|
+
Requires-Dist: decorator (>=4.3.2)
|
|
30
|
+
Requires-Dist: importlib-metadata (>=3.6) ; python_full_version <= "3.9.0"
|
|
31
|
+
Requires-Dist: isosurfaces (>=0.1.0)
|
|
32
|
+
Requires-Dist: jupyterlab (>=3.0.0) ; extra == "jupyterlab"
|
|
35
33
|
Requires-Dist: manimpango (>=0.5.0,<1.0.0)
|
|
36
|
-
Requires-Dist: mapbox-earcut (>=1.0.0
|
|
37
|
-
Requires-Dist: moderngl (>=5.
|
|
38
|
-
Requires-Dist: moderngl-window (>=2.
|
|
39
|
-
Requires-Dist: networkx (>=2.
|
|
40
|
-
Requires-Dist: notebook (>=6.
|
|
41
|
-
Requires-Dist: numpy (>=1.
|
|
42
|
-
Requires-Dist:
|
|
43
|
-
Requires-Dist:
|
|
44
|
-
Requires-Dist:
|
|
45
|
-
Requires-Dist:
|
|
46
|
-
Requires-Dist:
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist:
|
|
49
|
-
Requires-Dist:
|
|
50
|
-
Requires-Dist:
|
|
51
|
-
Requires-Dist:
|
|
52
|
-
Requires-Dist:
|
|
53
|
-
Requires-Dist: svgelements (>=1.8.0,<2.0.0)
|
|
54
|
-
Requires-Dist: tqdm (>=4.62.3,<5.0.0)
|
|
55
|
-
Requires-Dist: typing-extensions (>=4.7.1,<5.0.0)
|
|
56
|
-
Requires-Dist: watchdog (>=2.1,<=3.0.0)
|
|
34
|
+
Requires-Dist: mapbox-earcut (>=1.0.0)
|
|
35
|
+
Requires-Dist: moderngl (>=5.0.0,<6.0.0)
|
|
36
|
+
Requires-Dist: moderngl-window (>=2.0.0)
|
|
37
|
+
Requires-Dist: networkx (>=2.6)
|
|
38
|
+
Requires-Dist: notebook (>=6.0.0) ; extra == "jupyterlab"
|
|
39
|
+
Requires-Dist: numpy (>=1.26)
|
|
40
|
+
Requires-Dist: pycairo (>=1.13,<2.0.0)
|
|
41
|
+
Requires-Dist: pydub (>=0.20.0)
|
|
42
|
+
Requires-Dist: rich (>=12.0.0)
|
|
43
|
+
Requires-Dist: scipy (>=1.6.0)
|
|
44
|
+
Requires-Dist: screeninfo (>=0.7)
|
|
45
|
+
Requires-Dist: skia-pathops (>=0.7.0)
|
|
46
|
+
Requires-Dist: srt (>=3.0.0)
|
|
47
|
+
Requires-Dist: svgelements (>=1.8.0)
|
|
48
|
+
Requires-Dist: tqdm (>=4.0.0)
|
|
49
|
+
Requires-Dist: typing-extensions (>=4.0.0)
|
|
50
|
+
Requires-Dist: watchdog (>=2.0.0)
|
|
57
51
|
Project-URL: Bug Tracker, https://github.com/ManimCommunity/manim/issues
|
|
58
52
|
Project-URL: Changelog, https://docs.manim.community/en/stable/changelog.html
|
|
59
53
|
Project-URL: Documentation, https://docs.manim.community/
|