[PYTHON] PDF output with Latex extension in Sphinx

How to output the created document as pdf using Latex

PDF output using rst2pdf extension (Note about Sphinx Part 2 (PDF output using rst2pdf extension)), so PDF output even with Latex I tried to.

I felt that the output via Latex was considerably cleaner than the output using rst2pdf. Compared to rst2pdf, Latex seems to be able to tweak the design in detail, so I thought that it would be better to use Latex for PDF.

environment

OS:Mac OS X 10.9.5 Python:Ver.2.7.7

Latex installation

$ sudo port selfup
$ sudo port install texlive +full
・ ・ ・ ・
--->  Installing texlive @2014_0+doc+full
--->  Activating texlive @2014_0+doc+full

The "full" installation of TeX Live was selected. This is a full installation of all TeX Live packages, including all languages and their
associated documentation.

--->  Cleaning texlive
--->  Updating database of binaries
--->  Scanning binaries for linking errors
--->  No broken files found.
$

When it was over, there was a log like this.

Change project settings

Modify conf.py

language = 'ja'

latex_docclass = {'manual': 'jsbook'}

Add the above two lines

Build

$ make latexpdfja

Generated in the _build / latex folder.

If you get an error

Part 1 Latex is being installed

・ ・ ・ ・
--->  Attempting to fetch texlive-latex-34192-run.tar.xz from http://fco.it.distfiles.macports.org/mirrors/macports-distfiles/texlive-latex
--->  Attempting to fetch texlive-latex-34192-run.tar.xz from http://giraffe.cs.washington.edu/texlive/
--->  Attempting to fetch texlive-latex-34192-run.tar.xz from http://ykf.ca.distfiles.macports.org/MacPorts/mpdistfiles/texlive-latex
--->  Attempting to fetch texlive-latex-34192-run.tar.xz from http://svn.macports.org/repository/macports/distfiles/texlive-latex
Error: org.macports.fetch for port texlive-latex returned: fetch failed
Error: Failed to install texlive-latex
Please see the log file for port texlive-latex for details:
    /opt/local/var/macports/logs/_opt_local_var_macports_sources_rsync.macports.org_release_ports_tex_texlive-latex/texlive-latex/main.log
Error: The following dependencies were not installed: texlive-bibtex-extra texlive-latex texlive-bin-extra detex dvipng gd2 libvpx t1lib latexdiff p5.16-algorithm-diff latexmk pdfjam texlive-latex-recommended pgf texlive-context texlive-fonts-recommended texlive-math-extra texlive-metapost texlive-xetex texlive-generic-recommended texlive-fonts-extra texlive-fontutils lcdf-typetools ps2eps psutils t1utils texlive-formats-extra texlive-games texlive-generic-extra texlive-htmlxml texlive-humanities texlive-lang-african texlive-lang-arabic texlive-lang-chinese texlive-lang-cjk texlive-lang-cyrillic texlive-lang-czechslovak texlive-lang-english texlive-lang-european texlive-lang-french texlive-lang-german texlive-lang-greek texlive-lang-indic texlive-lang-italian texlive-lang-japanese texlive-lang-korean texlive-lang-other texlive-lang-polish texlive-lang-portuguese texlive-lang-spanish texlive-latex-extra texlive-pictures texlive-luatex texlive-music texlive-omega texlive-plain-extra texlive-pstricks texlive-publishers texlive-science
To report a bug, follow the instructions in the guide:
    http://guide.macports.org/#project.tickets
Error: Processing of port texlive failed

Part 2 during build

・ ・ ・ ・
! LaTeX Error: Missing \begin{document}.

See the LaTeX manual or LaTeX Companion for explanation.
Type  H <return>  for immediate help.
 ...

l.26

?

If the following part of conf.py is incorrect, it will appear, so check if there are any extra half-width characters.

language = 'ja'
latex_docclass = {'manual': 'jsbook'}

Recommended Posts

PDF output with Latex extension in Sphinx
How to output a document in pdf format with Sphinx
Output PDF with Django
Output PDF with WeasyPrint
Memo about Sphinx Part 2 (PDF output using rst2pdf extension)
Number chapters and sections when PDF output (rst2pdf) with Sphinx
Write documentation in Sphinx with Python Livereload
[Automation] Extract the table in PDF with Python
Read table data in PDF file with Python
Get standard output in real time with Python subprocess
Convert the image in .zip to PDF with Python
Output log in JSON format with Python standard logging
Output a character string with line breaks in PyYAML
Japanese output when dealing with python in visual studio
Markdown output with Django
Rasterize PDF in Python
View PDF with fbterm
Japanese output in Python
English PDF in Japanese
Flow of extracting text in PDF with Cloud Vision API
How to put a hyperlink to "file: // hogehoge" with sphinx-> pdf
Easy with just Python! Output Graphviz figures in draw.io format!
Dynamically generate graphs with matplotlib and embed in PDF with reporlab