Repository: ManimCommunity/manim
File: manim/mobject/text/tex_mobject.py (Python)

Code before:
        buff: float = MED_LARGE_BUFF,
        dot_scale_factor: float = 2,
        tex_environment: str | None = None,
        **kwargs: Any,
    ):
        self.buff = buff
        self.dot_scale_factor = dot_scale_factor
        self.tex_environment = tex_environment
        line_separated_items = [s + "\\\\" for s in items]
        super().__init__(
            *line_separated_items,
            tex_environment=tex_environment,
            **kwargs,
        )
        for part in self:
            dot = MathTex("\\cdot").scale(self.dot_scale_factor)
            dot.next_to(part[0], LEFT, SMALL_BUFF)
            part.add_to_back(dot)
        self.arrange(DOWN, aligned_edge=LEFT, buff=self.buff)

    def fade_all_but(self, index_or_string: int | str, opacity: float = 0.5) -> None:
        arg = index_or_string
        if isinstance(arg, str):
            part: VGroup | VMobject | None = self.get_part_by_tex(arg)
            if part is None:
                raise Exception("Could not locate part by provided tex string")
        elif isinstance(arg, int):
            part = self.submobjects[arg]
        else:
            raise TypeError(f"Expected int or string, got {arg}")
        for other_part in self.submobjects:
            if other_part is part:
                other_part.set_fill(opacity=1)
            else:
                other_part.set_fill(opacity=opacity)


class Title(Tex):
    """A mobject representing an underlined title.

    Examples
    --------
    .. manim:: TitleExample
        :save_last_frame:

        import manim

        class TitleExample(Scene):
            def construct(self):
                banner = ManimBanner()
                title = Title(f"Manim version {manim.__version__}")

Review comment (suggestion):
I like this addition! Could you please also include the given TeX string in the error?

Would it make sense that this was a `KeyError`? `arg` is sort of a key to look for in the TeX, but this is not really a mapping...
```suggestion
                raise Exception(f"Could not locate part by provided tex string '{arg}'.")
```

Code after:
        buff: float = MED_LARGE_BUFF,
        dot_scale_factor: float = 2,
        tex_environment: str | None = None,
        **kwargs: Any,
    ):
        self.buff = buff
        self.dot_scale_factor = dot_scale_factor
        self.tex_environment = tex_environment
        line_separated_items = [s + "\\\\" for s in items]
        super().__init__(
            *line_separated_items,
            tex_environment=tex_environment,
            **kwargs,
        )
        for part in self:
            dot = MathTex("\\cdot").scale(self.dot_scale_factor)
            dot.next_to(part[0], LEFT, SMALL_BUFF)
            part.add_to_back(dot)
        self.arrange(DOWN, aligned_edge=LEFT, buff=self.buff)

    def fade_all_but(self, index_or_string: int | str, opacity: float = 0.5) -> None:
        arg = index_or_string
        if isinstance(arg, str):
            part: VGroup | VMobject | None = self.get_part_by_tex(arg)
            if part is None:
                raise Exception(
                    f"Could not locate part by provided tex string '{arg}'."
                )
        elif isinstance(arg, int):
            part = self.submobjects[arg]
        else:
            raise TypeError(f"Expected int or string, got {arg}")
        for other_part in self.submobjects:
            if other_part is part:
                other_part.set_fill(opacity=1)
            else:
                other_part.set_fill(opacity=opacity)


class Title(Tex):
    """A mobject representing an underlined title.

    Examples
    --------
    .. manim:: TitleExample
        :save_last_frame:

        import manim

        class TitleExample(Scene):
            def construct(self):