2

I am attempting to create documentation using sphinx. I do not have sudo permissions, but do have anaconda installed in my environment. I can successfully build HTML, but when I build PDF I am receiving errors and no PDF.

Steps

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

There is more, but the versions that get installed by default:

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

I can successfully build HTML with make html

Having HTML is half my battle. We also need some bundled format that can be sent to users that do not have access to HTML (because the instructions for setting up your network are in the documentation)... Acrobat and MS Word are the only readers available.

When I attempt to run make latexpdf, I receive an error:

------------
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)

Is there some other configuration I need to do get texlive-core installed and working in my environment?

Attempts at Self-Help

I did do a search for texmf.cnf in the environment and found that it is present, but not on any of the configured paths. To try to circumvent the problem, I tried creating a symlink to remap the folders:

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

Runs after this resulted in error messages about

------------
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 ...

At this point I assumed this was an invalid path to follow and backed out.

I also tried changing the sphinx and texlive versions that were installed. Generally, this resulted in worse results (missing pdflatex for example). This could be because I had invalid combinations.

More Detail

Full Output

Based on some feedback in the comments, I am including a output. I have sanitized paths.

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

Bin Paths

Running which on some utilities

$ echo perl pdflatex latexmk | xargs "which"

/bin/perl
/home/jeff/.conda/envs/jeff-sphinx/bin/pdflatex
/home/jeff/.conda/envs/jeff-sphinx/bin/latexmk
Jefferey Cave
  • 2,507
  • 1
  • 27
  • 46
  • A few diagnostic questions: How is LaTeX installed? What is the result of `which pdflatex`? Can you compile a simple LaTeX file with pdflatex? – Pierre de Buyl Jan 29 '19 at 20:54
  • You should remove the custom symbolic link, this will likely not help and make it harder to diagnose. – Pierre de Buyl Jan 29 '19 at 20:55
  • LaTex was installed through `conda install texlive-core`. Any attempts to use pdflatex result in the same error message. Custom symbolic link is gone. (I'll have to wait until I have access to the machine to test `which pdflatex`) – Jefferey Cave Jan 29 '19 at 21:42
  • 2
    None of those are error messages, they're warnings and not even particularly severe ones. Do you get a PDF as output? What's the actual problem here? – darthbith Jan 29 '19 at 21:48
  • "they're warnings": that's a fair point. No, I do not get a PDF as output, and will include (perhaps) more relevant messages. It's possible I am being distracted by the verbosity and not reading the messages correctly. – Jefferey Cave Jan 29 '19 at 22:39
  • Sphinx's `latexpdf` uses `pdflatex`, which itself runs Perl script called [`latexmk`](https://mg.readthedocs.io/latexmk.html). Can you check if you have Perl as well as the `latexmk` package installed? – gehbiszumeis Jan 30 '19 at 09:47
  • updated question with new information – Jefferey Cave Jan 30 '19 at 19:50
  • 1
    OK, here is the error: `I can't find the format file \`pdflatex.fmt'!` It looks like conda's install of LaTeX is broken. Can you install it at the system level and remove the one conda installed? – darthbith Feb 02 '19 at 01:05
  • 1
    See this issue: https://github.com/conda-forge/texlive-core-feedstock/issues/19 – darthbith Feb 02 '19 at 01:07

1 Answers1

1

It seems that conda's texlive-core is not supposed to provide pdflatex. It is not clear to me how to use it.

However, it is possible to use tectonic in combination with conda's sphinx:

conda install -c conda-forge tectonic

Then in your document directory, assuming a typical setup:

make latex
cd build/latex/
tectonic *.tex

This works for me (with a very simple document though).

BlackShift
  • 2,296
  • 2
  • 19
  • 27