sphinxのPDF出力ではまった

sphinxのPDF出力ではまったのでメモ。

環境

  • Mac OS X 10.6
  • python2.6(標準でつんでるやつ)
  • Sphinx1.0.8
  • texlive2011

作業メモ

Sphinxのrootディレクトリでmake latexを実行した。

yuito@yuito.local> make latex

Markup is unsupported in LaTeX:
syntax:: column or row spanning cells are not yet implemented.
make: *** [latex] Error 1

AAで書いた表が悪さしていたみたいで、探しだして撲滅した。

+---------------------+
|aaa                  |
+========+============+
|bbb     |ccc         |
+        +------------+
|        |dd          |
+--------+------------+

こんなやつです。list-tableを使って書くよう徹底しようと思った。

latexディレクトリに移動してmake all-pdfを実行した。

yuito@yuito.local> cd build/latex
yuito@yuito.local> make all-pdf
for f in *.pdf *.png *.gif *.jpg *.jpeg; do ebb $f; done
        .
        .
        .
# 下記のように止まった場合はr[Enter]と入力すればいい
! Undefined control sequence.
l.204 ...n}{0.5em}{\py@TitleColor}{\py@NormalColor

?
        .
        .
        .
Output written on hogehoge.dvi (183 pages, 916844 bytes).
Transcript written on hogehoge.log.
make: *** [all-pdf-ja] Error 1 

とりあえずdviできたのでpdf作ってみた。

yuito@yuito.local> dvipdfmx hogehoge.dvi

結果画像とかおかしな位置にあったり、表が崩れていたりして綺麗に出力されていない。

日本語のときはplatexでしょJK

ごめんなさいごめんさない。

で、以下が成功例。
追記: make all-pdfを使っていたのでmake all-pdf-jaを使うようにした。
make latexで作成が完了したあとlatexディレクトリにあるsphinx.styを修正。

diff --git a/sphinx.sty b/sphinx.sty
--- a/sphinx.sty
+++ b/sphinx.sty
@@ -47,7 +47,7 @@
 
 % For graphicx, check if we are compiling under latex or pdflatex.
 \ifx\pdftexversion\undefined
-  \usepackage{graphicx}
+  \usepackage[dvipdfm]{graphicx}
 \else
   \usepackage[pdftex]{graphicx}
 \fi
yuito@yuito.local> make all-pdf-ja

yuito@yuito.local> dvipdfmx hogehoge.dvi

うまくいきました。