-
Notifications
You must be signed in to change notification settings - Fork 2.3k
feat: preserve original TeX colors #3903
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: preserve original TeX colors #3903
Conversation
Hey, thanks for your interest in contributing to Manim! |
Hi @JasonGrace2282, the main benefit I see the flexibility in being able to more easily color parts of a Tex mobject, particularly for long tex_strings or equations where indexing characters by position is cumbersome, or where you want to color only one occurrence of a string that appears multiple times in the
I have also seen a couple of posts, here and elsewhere, either requesting this or initially confused by the current behavior of overriding the original TeX colors, so this may have the benefit of reducing such queries. e.g. #3783, #3577 (I think this may also help with some issues around isolating substrings in expressions such as |
Currently failing on test I believe this would remove the breaking change. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice change!
Do you mind adding a short (maybe a sentence or so) note in the doc string of Tex
that tells people that you can use \textcolor
for coloring substrings?
Otherwise, I think it's all good :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the delay - this seems fine to me!
Left one comment regarding the formatting of the docstring, but it shouldn't be too hard to fix.
Co-authored-by: Aarush Deshpande <[email protected]>
for more information, see https://pre-commit.ci
Just as a reminder for us, in case we ever get around to it: in case we should ever change the implementation of I've recently read about grouping via proper parsing of the DVI file, that might actually be the nicest solution. |
Overview: What does this pull request change?
tex_string
(as set by, for example,\textcolor
), while continuing to support colors set bycolor
kwarg andset_color_by_tex
method.color
as an explicit kwarg ofSingleStringMathTex
with default valueWHITE
(possible breaking change?)Motivation and Explanation: Why and how do your changes improve the library?
TeX
text orMathTex
formulas.Links to added or changed documentation pages
Further Information and Comments
TeX
color so this may be a breaking change somewhere that I'm not aware of?WHITE
but this may be better specified by some constant or config value?Reviewer Checklist