-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Using braces #941
Comments
Have you installed LaTeX? You also need quite a few LaTeX packages with it as well. |
I certainly have. This is the basic LaTeX code, I just wanna write the braces separately. Here the traceback: Thanks! |
Hmm, the traceback points to a log file in `./media\Tex\0447ed74899f41fb.log`. Could you please post the contents of that as well?
Also, I've heard people saying that it isn't possible to write a single brace in LaTeX. You use Brace() for that, but you say you have tried that as well.
In any case, the contents of the log file would be mighty helpful.
… On 28-Mar-2020, at 17:53, mvfs314 ***@***.***> wrote:
I certainly have. This is the basic LaTeX code, I just wanna write the braces separately.
Here the traceback:
Traceback (most recent call last): File "C:\Manim\manim-master\manimlib\extract_scene.py", line 155, in main scene = SceneClass(**scene_kwargs) File "C:\Manim\manim-master\manimlib\scene\scene.py", line 53, in __init__ self.construct() File "1.py", line 170, in construct self.numeros_naturais() File "1.py", line 241, in numeros_naturais "\\}" File "C:\Manim\manim-master\manimlib\mobject\svg\tex_mobject.py", line 153, in __init__ self.break_up_by_substrings() File "C:\Manim\manim-master\manimlib\mobject\svg\tex_mobject.py", line 184, in break_up_by_substrings sub_tex_mob = SingleStringTexMobject(tex_string, **config) File "C:\Manim\manim-master\manimlib\mobject\svg\tex_mobject.py", line 44, in __init__ self.template_tex_file_body File "C:\Manim\manim-master\manimlib\utils\tex_file_writing.py", line 19, in tex_to_svg_file dvi_file = tex_to_dvi(tex_file) File "C:\Manim\manim-master\manimlib\utils\tex_file_writing.py", line 67, in tex_to_dvi "See log output above or the log file: %s" % log_file) Exception: Latex error converting to dvi. See log output above or the log file: ./media\Tex\0447ed74899f41fb.log
Thanks!
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub <#941 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AH5H6JBA2UIU6JM4LV7UW6TRJXT35ANCNFSM4LVIZ2FA>.
|
Here all the log file: ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\xkeyval. ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/generic/xkeyval\keyval.t ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/standalone\standal ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/generic/luatex85\luatex8
("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/arabi\bblopts.cfg" ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/generic/babel\txtbabel.d ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/amsmath\amstext.st ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/amsfonts\amsfonts. ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3packages/xparse ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/l3backend\l3backen ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-cfg\color ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/graphics-def\dvips LaTeX Info: Redefining \lsstyle on input line 914. LaTeX Font Info: Checking defaults for OML/cmm/m/it on input line 24. ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/amsfonts\umsa.fd" ("C:\Users\mvfs3\AppData\Local\Programs\MiKTeX 2.9\tex/latex/amsfonts\umsb.fd" Here is how much of TeX's memory you used: No pages of output. |
And, about the |
This appears to be a LaTeX specific problem. You simply cannot use a single brace separately in LaTeX, and the way manim renders LaTeX (it uses \align a lot), the parser keeps thinking it is seeing a single brace. For the time being, i suggest you use two Brace()es, which is tedious, but perhaps someone more experienced with LaTeX can help you out. If you feel like probing the problem deeper, you can modify tex_template.tex, and see if you can get it to work. All the best ;) |
in LaTeX you can't use a single curly bracket. <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 136 324" style="enable-background:new 0 0 136 324;" xml:space="preserve">
<g id="_x23_ffffffff">
<path d="M72.6,18.3c13.6-9.2,30.4-13,46.6-12.8c4-0.6,6.5,5.8,1.9,6.7c-9.4,0.7-19.2,2.5-27,8.2c-9.7,6.6-14.8,18.5-14.9,30
c-0.1,19.4,0,38.7,0,58.1c0,8.5,1.2,17.3-1.6,25.5c-2.3,7.6-7.9,13.9-14.5,18c-6.6,4.2-13.9,7-21.1,9.9
c10.5,3.3,21.4,7.5,28.6,16.3c5.5,6.4,8.7,14.8,8.9,23.3c-0.5,25.2-0.2,50.4-0.2,75.5c-0.3,9,4.3,17.6,11,23.4
c8.4,7.3,19.5,10.7,30.4,11.2c4.7,0.5,2.8,7.2-1.3,6.8c-13.7,0.2-27.7-2.4-40-8.5c-9.2-4.6-17.3-12.3-20.4-22.3
c-2-7.2-1.6-14.8-1.7-22.2c0-21.7,0.1-43.4-0.1-65.1c-0.4-14.8-11.8-27.6-25.5-32.2c-6.4-2.1-13.6-1.4-19.4-5
c0.5-1.6,0.6-3.9,2.7-4.2c11.3-1.8,23.3-4.5,31.9-12.6c7.2-6.7,10.2-16.7,10.3-26.3c0.2-24.6-0.2-49.2,0.2-73.8
C57.6,35.2,63.3,24.5,72.6,18.3z"/>
</g>
</svg> 'RightCurlyBracket.svg' <?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 21.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 136 324" style="enable-background:new 0 0 136 324;" xml:space="preserve">
<g id="_x23_ffffffff">
<path d="M72.6,18.3c13.6-9.2,30.4-13,46.6-12.8c4-0.6,6.5,5.8,1.9,6.7c-9.4,0.7-19.2,2.5-27,8.2c-9.7,6.6-14.8,18.5-14.9,30
c-0.1,19.4,0,38.7,0,58.1c0,8.5,1.2,17.3-1.6,25.5c-2.3,7.6-7.9,13.9-14.5,18c-6.6,4.2-13.9,7-21.1,9.9
c10.5,3.3,21.4,7.5,28.6,16.3c5.5,6.4,8.7,14.8,8.9,23.3c-0.5,25.2-0.2,50.4-0.2,75.5c-0.3,9,4.3,17.6,11,23.4
c8.4,7.3,19.5,10.7,30.4,11.2c4.7,0.5,2.8,7.2-1.3,6.8c-13.7,0.2-27.7-2.4-40-8.5c-9.2-4.6-17.3-12.3-20.4-22.3
c-2-7.2-1.6-14.8-1.7-22.2c0-21.7,0.1-43.4-0.1-65.1c-0.4-14.8-11.8-27.6-25.5-32.2c-6.4-2.1-13.6-1.4-19.4-5
c0.5-1.6,0.6-3.9,2.7-4.2c11.3-1.8,23.3-4.5,31.9-12.6c7.2-6.7,10.2-16.7,10.3-26.3c0.2-24.6-0.2-49.2,0.2-73.8
C57.6,35.2,63.3,24.5,72.6,18.3z"/>
</g>
</svg> Save those files to the media directory 'manim\assets\svg_images' temp_char = TextMobject("(")
text = TextMobject("any text")
if char == "{":
cb = SVGMobject("LeftCurlyBracket.svg", color=RED).set_height(temp_char.get_height())
else:
cb = SVGMobject("RightCurlyBracket.svg", color=RED).set_height(temp_char.get_height())
#you can place it at the end of text as follow
cb.move_to(text.get_right()+np.array([self.temp_char.get_width()*2, 0, 0]))
self.play(Write(text))
self.play(Write(cb),run_time=0.3) Or you can use Brace() temp_char = TextMobject("(")
cb = Brace(temp_char,LEFT,width_multiplier=8)
text = TextMobject("any text")
cb.move_to(text.get_right()+np.array([self.temp_char.get_width()*2, 0, 0]))
self.play(Write(text))
self.play(Write(cb),run_time=0.3) i created a method that returns appropriate width_multiplier according to text_scale_factor. def get_braces_scale_factor_acc_to_text_scale_factor(text_scale_factor):
if text_scale_factor <= 0.6:
return 9
elif 0.6 < text_scale_factor <=1:
return 6.5
elif 1 < text_scale_factor <=1.5:
return 5
elif 1.5 < text_scale_factor <= 2:
return 3.5
elif 2<text_scale_factor<=2.5:
return 2.5
elif 2.5<text_scale_factor:
return 2 you can use it like text = TextMobject("any text").scale(3)
cb = Brace(temp_char,LEFT,width_multiplier=get_braces_scale_factor_acc_to_text_scale_factor(3)) it don't work for text_scale_factor less than 0.5 so you can rescale windows's size by following code fh = 17.0 #this is number of coordinates along y-axis (move_to(np.array([x,y,0])))
fw = fh * DEFAULT_PIXEL_WIDTH / DEFAULT_PIXEL_HEIGHT
class codex(Scene):
CONFIG = {
"camera_config":
{"frame_height": fh,
"frame_width": fw, }
}
def construct(self):
text = TextMobject("any text").scale(3)
cb = Brace(temp_char,LEFT,width_multiplier=get_braces_scale_factor_acc_to_text_scale_factor(3)) |
use temp_char = TextMobject("(")
cb =TextMobject("{")
text = TextMobject("any text")
cb.move_to(text.get_right()+np.array([self.temp_char.get_width()*2, 0, 0])) |
class colorBetterApproach(Scene):
def construct(self):
# if you want to color "{" or "}" braces character separately
numeros4 = TexMobject( "\\mathbb{N}=\\{1,2,3,\\ldots\\}")
# coloring first 2 characters
numeros4[0][0:2].set_color(GREEN)
# coloring 3rd character
numeros4[0][2].set_color(RED)
self.add(numeros4)
self.wait() |
I was able to use single curly brace in single line with custom color using Brace() and dummy text. See if this helps you
|
…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.
I'd like to run the code:
numeros4 = TexMobject( "\\mathbb{N}", "=", "\\{", "1", ",", "2", ",", "3", ",", "\\ldots", "\\}" )
cause I wish I could change the color of the braces separately. But I got this error:
Exception: Latex error converting to dvi.
I've already tried using the command
Brace()
or the ideas found at reddit, but it didn't work at all. Is there a way to make it possible?Thanks!
The text was updated successfully, but these errors were encountered: