问题描述
如果我有一个使用pylatex设置的简单文档...
import pylatex as pl
geometry_options = {
"head": "1pt",
"margin": "0.2in",
"bottom": "0.2in",
"includeheadfoot": False}
doc = pl.Document(geometry_options=geometry_options)
doc.append("text")
...如何在文本块后添加一定厚度的黑色水平分隔线?
1楼
在问同一件事时找到了您未解决的问题。
从在TeX NoEscape
上的帖子中获得 ,您可以使用NoEscape
合并它。
您还可以使用其他示例,只需将它们插入原始字符串( r""
)。
import pylatex as pl
from pylatex.utils import NoEscape
from pylatex.basic import NewLine
geometry_options = {
"head": "1pt",
"margin": "0.2in",
"bottom": "0.2in",
"includeheadfoot": False}
doc = pl.Document(geometry_options=geometry_options)
doc.append("text")
doc.append(NewLine())
doc.append(NoEscape(r"\noindent\rule{\textwidth}{1pt}"))
doc.append(NewLine())
doc.append("Text under the rule.")
我仍在弄清楚LaTeX,所以我敢肯定有一种比强制这样的NewLine()
更干净的方法,但这是正确间距的唯一方法。