manim/tests/module/mobject
Henrik Skov Midtiby 357bb3fbba
Rewrite MathTex to make it more robust regarding splitting (#4515)
* Extracted the method get_mob_from_shape_element

* Moved more functionality to get_mob_from_shape_element

* More cleanup

* Parse the svg file while maintaining the group structure.

* Make the svg groups available

* Handle PERF401 issue

* [pre-commit.ci] pre-commit autoupdate (#4506)

updates:
- [github.com/astral-sh/ruff-pre-commit: v0.14.7 → v0.14.8](https://github.com/astral-sh/ruff-pre-commit/compare/v0.14.7...v0.14.8)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>

* Added an example of the issue

* Experimenting with coloring elements from the latex equation

* ...

* Regular expression can now match more than one object

* Process the string by applying the substrings in the order they match

* Code refactoring and added type annotations

* ...

* Added a lot of test cases

* More examples

* More examples

* Use matched_strings_and_ids to simplify existing methods

* Remove unused code

* Update get_part_by_tex to use matched_strings_and_ids

* This is required for test_MathTable to pass

* Ensure that self.texstring is set.

* Added more examples from exising issues in the github repo

* Ensure that latex groups are maintained by adding an additional pair of curly braces around the extracted part

* ExampleScene -> Scene

* Added comment

* _break_up_by_substrings

* Refactor code

* Added comment to example

* Handle integer inputs well.

* Expose the original tex_string

* Do not treat the content of substrings_to_isolate as regular expressions.

* Updated examples

* Update examples

* Fix SVMobject caching issue.

* Remove traces from brace_notation_split_occurred

* Simplify MathTex::_break_up_by_substrings

* Fix small issue in tex that in some cases moved elements a tiny bit around

* No use of regular expressions for locate substrings.

* Updated notes to the set of test cases

* Handle issues with the center environment.

* Add example

* Fix issue with rectangles (e.g. from sqrt)

* ConvertToOpenGL

* Reduce the number of nesting levels.

* Use the specified arg_seperator

* Deal with the double curly brace markup

* Code cleanup

* Code cleanup

* Rollback a few changes

* Code cleanup

* Adjust paths the generated artefacts in tests that rely on MathTex

* Added a remark to the using text guide on enclosing snippets in curly braces for substrings_to_isolate to work

* Added space around the numerator argument to frac to avoid having double curly braces in the example.

This would otherwise trigger MathTex to split the string at that location.

* Log errors properly and display some information about the errors and their context.

* Code refactoring as suggested by Benjamin

---------

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Benjamin Hackl <devel@benjamin-hackl.at>
2026-02-16 14:22:56 +01:00
..
geometry Enable strict=True for zip() where safe (#4547) 2026-02-11 10:39:25 +01:00
graphing Enable strict=True for zip() where safe (#4547) 2026-02-11 10:39:25 +01:00
mobject Resolve more race conditions potentially happening during directory creation (#4589) 2026-02-12 08:18:26 +01:00
svg [pre-commit.ci] pre-commit autoupdate (#4140) 2025-02-02 17:28:20 +01:00
text Rewrite MathTex to make it more robust regarding splitting (#4515) 2026-02-16 14:22:56 +01:00
types/vectorized_mobject Enable strict=True for zip() where safe (#4547) 2026-02-11 10:39:25 +01:00
test_boolean_ops.py Use ruff for pytest style (#3872) 2024-07-21 14:37:57 +00:00
test_graph.py Add ruff rules PERF for performance (#4492) 2025-12-01 10:42:46 +00:00
test_image.py Replace legacy numpy usage ruff rule NPY002 (#4516) 2026-01-13 17:23:34 +01:00
test_matrix.py test: add matrix tests (#4279) 2025-06-11 09:48:39 +02:00
test_table.py fix: infinite recursion caused by accessing color of a highlighted Ta… (#4435) 2026-01-25 16:47:58 +01:00
test_value_tracker.py Add support for arithmetic operators //, %, *, ** and / on `ValueTracker` (#4351) 2025-07-26 17:45:05 +00:00