我想在通过 pyLaTeX 生成的文档中添加带有超链接的文本。在 LaTeX 中,这将通过以下方式执行:
\href{http://www.sharelatex.com}{Something Linky}
我找到了包含 Marker 对象和 Hyperref 对象的labelref 文档,但我似乎无法让它工作。
from pylatex import Document, Hyperref
doc = Document()
doc.append("Example text a link should go ")
# i was hoping the hyperlink would work like i'm showing below
doc.append(Hyperref("https://jeltef.github.io/PyLaTeX", "here"))
doc.generate_pdf("Example_document", clean_tex=True)
运行以下代码会生成没有错误的 pdf 文档。生成的文件的图像
虽然我期望的是“这里”这个词是一个超链接,并以蓝色显示。