问题描述
我要使用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 \\$$',escape=False))
TypeError: append() takes 2 positional arguments but 3 were given
我应该如何解决我的问题?
解决方法
这个答案来晚了,但我想没有坏处: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')
输出: