Skip to content

Can we write combinations (nCr) like \frac{}{} ? #4708

@Alamin-H-M

Description

@Alamin-H-M

Hey, I'm using Manim for probability/statistics videos. To write combination notation right now I have to do this:

from manim import *

class Sample_slide(Scene):
    def construct(self):
        problem = MathTex(r"P(x) = {}^{n}C_{x}\,  p^x q^{n-x}")
        self.play(Write(problem))
        self.wait()

The {}^{x+r}C_{r}\, part is really messy just for a single symbol. It would be much cleaner if Manim had a built-in command like \ncr{}{} so I could just write:

MathTex(r"P(x) = \ncr{x+r}{r} p^x q^{n-x}")

like how \frac{}{} works. Would it be possible to add this to Manim's default LaTeX template?

Thanks


Metadata

Metadata

Assignees

No one assigned

    Labels

    new featureEnhancement specifically adding a new feature (feature request should be used for issues instead)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions