首页 > 解决方案 > python pylatex 字符串中的行距、单位和数学方程

问题描述

我有一个文本块作为包含一些 SI 单位和方程的字符串。例如,我如何在字符串中使用上标数字(例如 10^-10 m^2)和数学方程?希腊字母和例如 ± 符号可以正常工作。

from pylatex import Document, Section, Subsection, Command, Figure
from pylatex.utils import italic, bold, NoEscape

doc = Document('Test', geometry_options = {"head": "2cm","margin": "2cm","bottom": "2cm"})

with doc.create(Section('Header 1')):
    doc.append('The average area is less than 10m^2 (±0.5m^2).')
doc.generate_pdf(clean_tex = False,compiler='pdflatex')

我也想知道如何在 pylatex 中定义行距(linespread)。

标签: equationspacingunits-of-measurementpylatex

解决方案


推荐阅读