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.
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With