Repository: ManimCommunity/manim
File: manim/utils/tex_file_writing.py (Python)

Code before:
        )
        result.write_text(output, encoding="utf-8")
    return result


def tex_compilation_command(
    tex_compiler: str, output_format: str, tex_file: Path, tex_dir: Path
) -> list[str]:
    """Prepares the tex compilation command with all necessary cli flags

    Parameters
    ----------
    tex_compiler
        String containing the compiler to be used, e.g. ``pdflatex`` or ``lualatex``
    output_format
        String containing the output format generated by the compiler, e.g. ``.dvi`` or ``.pdf``
    tex_file
        File name of TeX file to be typeset.
    tex_dir
        Path to the directory where compiler output will be stored.

    Returns
    -------
    :class:`str`
        Compilation command according to given parameters
    """
    if tex_compiler in {"latex", "pdflatex", "luatex", "lualatex"}:
        args = [
            tex_compiler,
            "-interaction=batchmode",
            f"-output-format={output_format[1:]}",
            "-halt-on-error",
            f"-output-directory={tex_dir.as_posix()}",
            f"{tex_file.as_posix()}",
        ]
    elif tex_compiler == "xelatex":
        if output_format == ".xdv":
            outflag = ["-no-pdf"]
        elif output_format == ".pdf":
            outflag = []
        else:
            raise ValueError("xelatex output is either pdf or xdv")
        args = [
            "xelatex",
            *outflag,
            "-interaction=batchmode",
            "-halt-on-error",
            f"-output-directory={tex_dir.as_posix()}",
            f"{tex_file.as_posix()}",
        ]
    else:

Review comment (suggestion):
I can't select the line above this one (:class:\`str\`), but could you please change that one to :class:\`list\`[:class:\`str\`]?
```suggestion
        A list of arguments for the TeX compilation command, according to the given parameters.
```

Code after:
        )
        result.write_text(output, encoding="utf-8")
    return result


def make_tex_compilation_command(
    tex_compiler: str, output_format: str, tex_file: Path, tex_dir: Path
) -> list[str]:
    """Prepares the TeX compilation command, i.e. the TeX compiler name
    and all necessary CLI flags.

    Parameters
    ----------
    tex_compiler
        String containing the compiler to be used, e.g. ``pdflatex`` or ``lualatex``
    output_format
        String containing the output format generated by the compiler, e.g. ``.dvi`` or ``.pdf``
    tex_file
        File name of TeX file to be typeset.
    tex_dir
        Path to the directory where compiler output will be stored.

    Returns
    -------
    :class:`list[str]`
        Compilation command according to given parameters
    """
    if tex_compiler in {"latex", "pdflatex", "luatex", "lualatex"}:
        command = [
            tex_compiler,
            "-interaction=batchmode",
            f"-output-format={output_format[1:]}",
            "-halt-on-error",
            f"-output-directory={tex_dir.as_posix()}",
            f"{tex_file.as_posix()}",
        ]
    elif tex_compiler == "xelatex":
        if output_format == ".xdv":
            outflag = ["-no-pdf"]
        elif output_format == ".pdf":
            outflag = []
        else:
            raise ValueError("xelatex output is either pdf or xdv")
        command = [
            "xelatex",
            *outflag,
            "-interaction=batchmode",
            "-halt-on-error",
            f"-output-directory={tex_dir.as_posix()}",
            f"{tex_file.as_posix()}",
        ]