ManimCommunity / ManimCommunity/manim
Don't do automatic line breaks within LaTeX
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 40.9k
- Forks
- 3.1k
- Avg merge
- 3d 12h
- Merged PRs (30d)
- 25
Description
### Context
If we make a long line of text `Tex("this is a long line of text... perhaps")` then the output will contain a line break if the line in question is longer than a full line in the tex document (as defined by the tex template). It bears absolutely no relation to the width of the screen in manim.
We have plenty of options for breaking up strings in manim and arranging and aligning them left to right or top to bottom ... we can either use LaTeX for layout or we can use manim. It is unclean if we use both.
Now if you encounter a line-break in LaTeX that you do not want, you have work to do.
You can try to change your code to `Tex("line1", "line2")` and then arrange the two parts by hand (but the spacing will be off).
You can change your tex code (for example including everything in an \mbox) but you'd no longer be able to break up the mobject by substrings.
### Suggested improvement
I suggest that we include in the default text template the geometry package, specifying an extremely wide page width so that we avoid LaTeX based automatic line breaks entirely - manual line breaks will of course work without issue. (More info perhaps here https://tex.stackexchange.com/questions/35753/how-create-a-paper-of-x-y-dimensions-size ).
One might be tempted to say we should just try to match the page width in TeX, width the video width in manim, but this is a fool's errand as we can and do scale mobjects within manim after they have left the tex->dvi->svg->mobject pipeline.
Alternate idea: make it a keyword argument to Tex() and let users play around with the value depending on the needs of their scene.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Tex() entry point and inspect the default text template used for LaTeX rendering. Confirm how the template controls page width and how manual breaks and substring splitting behave; done means long lines no longer receive automatic LaTeX breaks while explicit breaks still work.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- latex, python
- Domain
- computer-graphics
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100