【问题标题】:How to use Sphinx to generate PDF如何使用 Sphinx 生成 PDF
【发布时间】:2020-08-11 04:35:45
【问题描述】:

我正在尝试学习 Sphinx 文档创建工具。我能够生成 html 文档。现在,为了创建 (html) 文档的离线版本,我一直在尝试从我的项目中生成 pdf 文件。

为了实现这个目标,到目前为止,我已经尝试了以下方法(使用网络上可用的资源,包括 Sphinx 文档):

conf.py 中添加了以下内容:

# conf.py options for Latex
latex_engine = 'pdflatex'
latex_elements = {
    'papersize': 'a4paper',
    'pointsize': '10pt',
    }

随后在终端使用命令make latexpdf,于是在终端收到如下信息:

/Users/.../.../.../.../.../urls.py:docstring of lead.urls:5: WARNING: Definition list ends without a blank line; unexpected unindent.
/Users/.../urls.py:docstring of lead.urls:7: WARNING: Unexpected indentation.
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
processing lead.tex... index modules/... 
resolving references...
done
writing... done
copying TeX support files... copying TeX support files...
done
build succeeded, () warnings.

The LaTeX files are in _build/latex.
Run 'make' in that directory to run these through (pdf)latex
(use `make latexpdf' here to do that automatically).
latexmk -pdf -dvi- -ps-  'lead.tex'
make[1]: latexmk: No such file or directory
make[1]: *** [lead.pdf] Error 1
make: *** [latexpdf] Error 2

创建了一个新文件夹latex,其中包含许多文件,其中一个名为<project_name>.tex(上面的错误日志中为lead.tex)和一个批处理文件make.bat

但是,运行命令make 只会产生以下错误:

latexmk -pdf -dvi- -ps-  'lead.tex'
make: latexmk: No such file or directory
make: *** [lead.pdf] Error 1

根据latexmk 上的一些线索(网上提供的材料),尝试从Tex site 安装BasicTex 包。

但是,可用的软件包仅适用于 macOS 10.13 及更高版本。我在10.12.6

所以我被困住了。有人可以告诉我我的困境有什么解决办法吗?

【问题讨论】:

    标签: macos python-sphinx pdflatex


    【解决方案1】:

    https://www.tug.org/mactex/faq/3-4.html 在 macOS 10.12.6 上为我工作。

    【讨论】:

    • 是的,我找到了来源(链接位于 MaxTex 主页的末尾,有点精美的印刷品)。但是,在“成功”安装后,我仍然收到sudo: tlmgr: command not found。我意识到这可能是一个访问问题。如何让我的 mac 识别 tlmgr?谢谢。
    • 应该是 2016 年,而不是 2019 年。安装出现问题。我建议查看安装文档以获得洞察力。我不知道还能尝试什么。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-03-02
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多