Skip to content
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

How to add a new line when using TextMobject like arrays #940

Closed
nosnakeob opened this issue Mar 27, 2020 · 6 comments
Closed

How to add a new line when using TextMobject like arrays #940

nosnakeob opened this issue Mar 27, 2020 · 6 comments

Comments

@nosnakeob
Copy link

When I use:

t = TextMobject('aaaaa', '''a
        
 a''', 'aaaaa')

批注 2020-03-27 173840

but when I use:
t = TextMobject('aaaaaaaaa', '\n\n', 'aaaaaaa')
or:

t = TextMobject('aaaaa', '''

         ''', 'aaaaa')

批注 2020-03-27 173932

It's not what I want. Are there other ways to add a new line when using TextMobject like arrays?

@nosnakeob nosnakeob changed the title How to add a new line when using TexMobject like arrays How to add a new line when using TextMobject like arrays Mar 27, 2020
@qo4on
Copy link

qo4on commented Mar 27, 2020

'\n'.join(['First_line', 'Second_line', 'Third_line'])
TextMobject('First_line\nSecond_line\nThird_line')

@nosnakeob
Copy link
Author

'\n'.join(['First_line', 'Second_line', 'Third_line'])
TextMobject('First_line\nSecond_line\nThird_line')

sorry for replying too late

but it doesn't work

image

and they're in the same list index

I can't use ApplyMethord for one of them

@TonyCrane
Copy link
Collaborator

@nosnakeob
TextMobject(“First\_line\\\\”, “Second\_line\\\\”, “Third\_line”)

TextMobject use LaTeX to display text, so you need to obey the rule of LaTeX.

@TonyCrane
Copy link
Collaborator

I think this is much better:

text = VGroup(
    TextMobject(“First\_line”),
    TextMobject(“Second\_line”),
    TextMobject(“Third\_line”)
).arrange(DOWN, aligned_edge=LEFT)

If you want to use “\n”, Text() class supports it.
Text(“a\nb\nc”, font=“your font”)

@qo4on
Copy link

qo4on commented May 10, 2020

Yes, I made a mistake: replace TextMobject with Text:

'\n'.join(['First_line', 'Second_line', 'Third_line'])
Text('First_line\nSecond_line\nThird_line', font='Arial', stroke_width=0)

@nosnakeob
Copy link
Author

I think this is much better:

text = VGroup(
    TextMobject(“First\_line”),
    TextMobject(“Second\_line”),
    TextMobject(“Third\_line”)
).arrange(DOWN, aligned_edge=LEFT)

If you want to use “\n”, Text() class supports it.
Text(“a\nb\nc”, font=“your font”)

That's useful, Thanks.

eulertour pushed a commit to eulertour/manim-3b1b that referenced this issue Jan 18, 2021
…eeDAxes' (3b1b#941)

As described in 3b1bgh-940, there is no direct way of setting the x-axis and y-axis limits through the 'ThreeDAxes' constructor. This commit adds 'x_min', 'x_max', 'y_min' and 'y_max' as parameters to the constructor of 'ThreeDAxes' to let the user explicitly pass those limits.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants