Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sphinx PDF output using latexpdf

I am trying to build Sphinx doc output as PDF rather than HTML. I can only use the tools which come with Sphinx, i.e. I cannot download additionl tools like rst2pdf. I have tried using 'make latexpdf', per the Sphinx documentation, which states it will produce pdf in addition to the .tex files. However I am only getting .tex. What am I missing? The Sphinx documentation states that PDF files will be produced.

like image 216
Trekkie Avatar asked Mar 20 '15 17:03

Trekkie


People also ask

Does Sphinx support markdown?

To support Markdown-based documentation, Sphinx can use MyST-Parser. MyST-Parser is a Docutils bridge to markdown-it-py, a Python package for parsing the CommonMark Markdown flavor.

Does Sphinx support LaTeX?

With Sphinx, also LaTeX and PDF output can be generated. The command for generating LaTeX output is make latex and for generating PDF of the documentation- make latexpdf. Similar to the HTML output a LaTeX output directory will appear in the build directory, containing the generated files.


1 Answers

Sphinx uses Latex to export the documentation as a PDF file.
Thus one needs the basic Latex dependencies used to write a pdf on the system.

For example, on a system running Ubuntu 16.04, they can be downloaded and installed by :

apt-get install texlive-latex-recommended texlive-latex-extra texlive-fonts-recommended

If running Sphinx 1.6 or above on GNU/Linux or OSX, you may also need the latexmk package.
Reference: sphinx.builders.latex.LaTeXBuilder documentation.

After installing the above packages, running make latexpdf in the sphinx project directory generates the documentation output as the PDF file ./_build/latex/<sphinx-project-name>.pdf>


Note: In the current scenario where you do not see a PDF file on your system after running make latexpdf, check the output of the command for any errors regarding missing latex tools/files. Use the system package manager to identify the missing packages and install them.

like image 128
TheCodeArtist Avatar answered Sep 28 '22 13:09

TheCodeArtist