Rendering Hebrew as Text Mobject #4432
Unanswered
SuperUser-Vermeylen
asked this question in
Q&A
Replies: 2 comments 1 reply
-
your code snippet is not working - the indentation is weird and there are undeclared variables. I tried to run your Hebrew words through LaTeX as well, and there I get a message about an unsupported unicode character in your strings, though I cannot figure out which, but I assume it is the same character which also causes problems in the class hebrew(Scene):
def construct(self):
myTexTemplate = TexTemplate(
tex_compiler="xelatex",
output_format='.xdv',
)
myTexTemplate.add_to_preamble(r"\usepackage{fontspec}\usepackage{polyglossia}\setmainlanguage{hebrew}\setmainfont{Times New Roman}")
MathTex.set_default(tex_template=myTexTemplate)
Tex.set_default(tex_template=myTexTemplate)
hebrew_translation = [
r"בְּרֵאשִׁ֖ית", r"אֱלֹהִים", r"בָּרָא", r"שָׁמַיִם", r"אֲרֶץ"
]
word_objs = VGroup(
Text(f"{i}") for i in range(len(hebrew_translation))
).arrange(RIGHT,buff=2)
self.add(word_objs)
hebrew_translation_tex = VGroup(
Tex(hebrew_tr, color=YELLOW)
for hebrew_tr in hebrew_translation
)
for i, word_obj in enumerate(word_objs):
word = Text(hebrew_translation[i], font_size=DEFAULT_FONT_SIZE * 0.8, color=YELLOW, font="sans-serif")
# Center under each remaining word
x = word_obj.get_center()[0]
y = -2
word.move_to([x, y, 0])
hebrew_translation_tex.add(word)
self.play(Write(word))
self.play(Write(Text("here!", font_size=24).next_to(word, DOWN)))
self.wait(2) |
Beta Was this translation helpful? Give feedback.
0 replies
-
I wonder if your problem is caused by the accented characters? |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I cannot get the hebrew text to render.
The first hebrew word renders, but the remaining go to zero (whatever that means).
I've been to this page, and I think it has something to do with the LTR and RTL, but I don't understand.
BrennerMethod.mp4
Beta Was this translation helpful? Give feedback.
All reactions