question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Make Positioning Related to Tex More Consistent

See original GitHub issue

Consider the following two images:

class HigherDot(Scene):
    def construct(self):
        text = Tex("Aa")
        dot = Dot()
        dot.next_to(text, RIGHT)
        self.add(text, dot)
class LowerDot(Scene):
    def construct(self):
        text = Tex("ga")
        dot = Dot()
        dot.next_to(text, RIGHT)
        self.add(text, dot)

HigherDot: HigherDot

LowerDot: LowerDot

You can see that the dot is aligned differently relative to the “a” because the top and bottom of each Tex object is different. I feel like there needs to be some way of consistently positioning things relative to (Math)Tex objects. I can’t think of any simple way to do it, but I still feel like it should be done somehow.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
cobordismcommented, Oct 13, 2020

I fear this isn’t possible. When we compile the tex and import it to manim as SVGs, we just have a bunch of paths… and there is no way for the “ga” bit to know how high an “A” would have been (and the A can’t know where the bottom of the g would be). The next_to command only know the top, bottom, left edge, right edge, and center of the shape “ga”.

But on the other hand, this all feels backward to me in a sense. TeX is the most powerful typesetting engine we have. Why render two pieces individually and then try to typeset them in python by hand? Why not use TeX? There’s \bullet and \cdot and there’s \textbullet and \centerdot and \medbullet and \sqbullet and \smallblackcircle and … (and that “…” is \ldots btw).

The point is: let latex do what latex does best. typesetting. Try maybe

tex = Tex(“ga”, “$\bullet$”) and tex = Tex(“Aa”, “$\bullet$”)

you can even follow this with text = tex[0] dot = tex[1]

and continue on from there exactly as before.

complete list of latex symbols: http://mirrors.ctan.org/info/symbols/comprehensive/symbols-a4.pdf

0reactions
cobordismcommented, Oct 18, 2020

I will tag this as ‘wontfix’ because there is nothing we can do until SVG handling has been rewritten. Until then you’d need to either use LaTeX for alignment, or mess around by hand. (see comments above)

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to maintain consistent text and image positioning using ...
I would like to control the positioning of the text and image so both are always a set distance from the top of...
Read more >
Change text alignment, indentation, and spacing in PowerPoint
To change the horizontal placement of text, in the Alignment box, choose Left, Center, Right, Justified, or Distributed. Justified adds spacing between words...
Read more >
12 Examples of Positioning Statements & How to Craft Your Own
Positioning statements are important brand and culture drivers. Learn how to write one and gain inspiration from these awesome examples.
Read more >
Align or justify text in Adobe InDesign
Text can be aligned with one or both edges (or insets) of a text frame. Text is said to be justified when it...
Read more >
12 secrets to make a presentation look consistent
How to make interesting your powerpoint presentations? I will show you 12 techniques that will help you make a presentation look consistent.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found