Skip to content
Discussion options

You must be logged in to vote

Alright, padding with white (same color as background) dots seems to work now...

        padding_chars = "." * ((100 - len(full_str)) // 2)
        # Use textcolor with custom template that includes xcolor
        padded_str = rf"\textcolor{{white}}{{{padding_chars}}}{full_str}\textcolor{{white}}{{{padding_chars}}}"

        # Create custom TexTemplate with xcolor package
        custom_template = TexTemplate()
        custom_template.add_to_preamble(r"\usepackage{xcolor}")

        tex = MathTex(
            padded_str,
            color=BLACK,
            font_size=30,
            tex_template=custom_template,
        ).move_to(DOWN * 6)
        return tex
ReproAnimation.mp4

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by balopat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant