皮拉特斯添加水平线



如果我有一个简单的文档设置了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")

。如何在文本块后添加一定粗细的黑色水平分隔线?

在问同样的事情时发现了你未回答的问题。从Gonzalo Medina在TeX StackExchange帖子上的回答中收获,您可以使用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"noindentrule{textwidth}{1pt}"))
doc.append(NewLine())
doc.append("Text under the rule.")

我仍在研究 LaTeX,所以我确信有一种比强制这样的NewLine()更干净的方法,但这是正确间隔的唯一方法。

最新更新