我想将latex中的一些公式保存为pdf格式
from pylatex import Document, Section, Subsection, Command,Package, Alignat
doc = Document(default_filepath='basic.tex', documentclass='article')
doc.append('Solve the equation:')
doc.append(r'$$\frac{x}{10} = 0 \\$$',Alignat(numbering=False, escape=False))
doc.generate_pdf("test", clean_tex=True)但我得到一个错误:
doc.append(r'$$\frac{x}{10} = 0 \\$$',Alignat(numbering=False, escape=False))
TypeError: append() takes 2 positional arguments but 3 were given我该如何解决我的问题呢?
发布于 2021-04-30 23:45:44
这个答案来得太晚了,但我猜这没有什么坏处:不能像这样将Alignat环境传递给append,而是将附加的公式包含在其中。而且它是一个数学环境,所以$$是不必要的。
from pylatex import Document, Section, Subsection, Command,Package, Alignat
doc = Document(default_filepath='basic.tex', documentclass='article')
doc.append('Solve the equation:')
with doc.create(Alignat(numbering=False, escape=False)) as agn:
agn.append(r'\frac{x}{10} = 0')输出:

https://stackoverflow.com/questions/64643905
复制相似问题