[Python] How to avoid braces in \usepackage generated with pylatex for package names...

Discussão em 'Python' iniciado por Stack, Fevereiro 2, 2025.

  1. Stack

    Stack Membro Participativo

    I need to create a LaTeX document with the package "tikz-feynman" in Python.

    I use pylatex but, when I try to create the file like this

    doc = Document("my_diagram")
    doc.packages.append((Package("tikz-feynman", options=["compat = 1.0.0"])))
    doc.append("Some text...")
    doc.generate_tex()


    it can't compile. This is because of a pair of braces in the name of the package tikz-feynman. When I run the code the .tex file has the header

    \documentclass{article}%
    \usepackage[T1]{fontenc}%
    \usepackage[utf8]{inputenc}%
    \usepackage{lmodern}%
    \usepackage{textcomp}%
    \usepackage{lastpage}%
    \usepackage[compat = 1.0.0]{tikz{-}feynman}%


    instead of

    \documentclass{article}%
    \usepackage[T1]{fontenc}%
    \usepackage[utf8]{inputenc}%
    \usepackage{lmodern}%
    \usepackage{textcomp}%
    \usepackage{lastpage}%
    \usepackage[compat = 1.0.0]{tikz-feynman}%


    How can I avoid those braces from occuring?

    Continue reading...

Compartilhe esta Página