如何使用Sphinx生成PDF

问题描述

我正在尝试学习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)和一个批处理文件{{1} }。

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

make

遵循latexmk -pdf -dvi- -ps- 'lead.tex' make: latexmk: No such file or directory make: *** [lead.pdf] Error 1 上的一些线索(网上有资料),试图从Tex site安装latexmk软件包。

但是,可用的软件包仅适用于macO 10.13和更高版本。我在BasicTex上。

所以我被困住了。有人可以让我知道是否可以解决我的困境吗?

解决方法

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

相关问答

错误1:Request method ‘DELETE‘ not supported 错误还原:...
错误1:启动docker镜像时报错:Error response from daemon:...
错误1:private field ‘xxx‘ is never assigned 按Alt...
报错如下,通过源不能下载,最后警告pip需升级版本 Requirem...