使用Anaconda Sphinx创建PDF

时间:2019-01-29 13:34:18

标签: anaconda latex python-sphinx conda

我正在尝试使用狮身人面像创建文档。我没有sudo权限,但是在我的环境中确实安装了anaconda。我可以成功构建HTML,但是在构建PDF时出现错误,没有PDF。

步骤

conda create --name jeff-sphinx
conda activate jeff-sphinx
conda install sphinx texlive-core

还有更多,但是默认情况下会安装以下版本:

sphinx:                   1.8.2-py37_0           
sphinxcontrib:            1.0-py37_1             
sphinxcontrib-websupport: 1.1.0-py37_1    
texlive-core:             20180414-hc8d0b01_0 

我可以使用make html

成功构建HTML

拥有HTML是我成功的一半。我们还需要一些捆绑格式,可以将其发送给无法访问HTML的用户(因为文档中设置网络的说明)... Acrobat和MS Word是唯一可用的阅读器。

当我尝试运行make latexpdf时,出现错误消息:

------------
Running 'pdflatex   -recorder  "UserGuide.tex"'
------------
warning: kpathsea: configuration file texmf.cnf not found in these directories:
... many directories ...
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)

我还需要做一些其他配置来安装texlive-core并在我的环境中工作吗?

尝试自助

我确实在环境中搜索texmf.cnf,发现它 存在,但不在任何已配置的路径上。为了尝试解决该问题,我尝试创建一个符号链接来重新映射文​​件夹:

cd ~/.conda/envs/jeff-sphinx/share
ln -s ./texlive/texmf-dist texmf-dist

在导致有关

的错误消息后运行
------------
Running 'pdflatex   -recorder  "UserGuide.tex"'
------------
warning: ~/.conda/envs/jeff-sphinx/share/texmf-dist/web2c/texmf.cnf:540: (kpathsea) No cnf value on line: $SELFAUTOLOC ...more paths ...

在这一点上,我认为这是一条无效的路径,可以退出并退出。

我还尝试更改已安装的sphinxtexlive版本。通常,这会导致更糟的结果(例如,缺少pdflatex)。这可能是因为我的组合无效。

更多详细信息

完整输出

基于评论中的一些反馈,我包括了一个输出。我已经清理了路径。

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).
make[1]: Entering directory `/home/jeff/Documents/projects/docs/doc/_build/latex'
latexmk -pdf -dvi- -ps-  'UserGuide.tex'
Latexmk: This is Latexmk, John Collins, 17 Jan. 2018, version: 4.55.
Latexmk: applying rule 'pdflatex'...
Rule 'pdflatex': File changes, etc:
   Non-existent destination files:
      'UserGuide.pdf'
------------
Run number 1 of rule 'pdflatex'
------------
------------
Running 'pdflatex   -recorder  "UserGuide.tex"'
------------
warning: kpathsea: configuration file texmf.cnf not found in these directories: <many directories>.
This is pdfTeX, Version 3.14159265-2.6-1.40.19 (TeX Live 2018) (preloaded format=pdflatex)

kpathsea: Running mktexfmt pdflatex.fmt
warning: kpathsea: configuration file texmf.cnf not found in these directories: <many directories>.
/home/jeff/.conda/envs/jeff-sphinx/bin/mktexfmt: kpsewhich -var-value=TEXMFROOT failed, aborting early.
BEGIN failed--compilation aborted at /home/jeff/.conda/envs/jeff-sphinx/bin/mktexfmt line 25.
I can't find the format file `pdflatex.fmt'!
Latexmk: Errors, so I did not complete making targets
Collected error summary (may duplicate other messages):
  pdflatex: (Pdf)LaTeX failed to generate the expected log file 'UserGuide.log'
Latexmk: Did not finish processing file 'UserGuide.tex':
   (Pdf)LaTeX failed to generate the expected log file 'UserGuide.log'
Latexmk: Use the -f option to force complete processing,
 unless error was exceeding maximum runs of latex/pdflatex.
make[1]: *** [UserGuide.pdf] Error 12
make[1]: Leaving directory `/home/jeff/Documents/projects/docs/doc/_build/latex'
make: *** [latexpdf] Error 2

绑定路径

在某些实用程序上运行which

$ echo perl pdflatex latexmk | xargs "which"

/bin/perl
/home/jeff/.conda/envs/jeff-sphinx/bin/pdflatex
/home/jeff/.conda/envs/jeff-sphinx/bin/latexmk

1 个答案:

答案 0 :(得分:0)

似乎conda的texlive-core is not supposed提供了pdflatex。我不清楚如何使用它。

但是,可以将tectonic与conda的狮身人面像结合使用:

conda install -c conda-forge tectonic

然后在您的文档目录中,进行典型设置:

make latex
cd build/latex/
tectonic *.tex

这对我有用(尽管有一个非常简单的文档)。