summaryrefslogtreecommitdiff
path: root/sphinx
diff options
context:
space:
mode:
authorAkihiro Uchida <uchida@ike-dyn.ritsumei.ac.jp>2011-11-09 20:51:48 +0900
committerAkihiro Uchida <uchida@ike-dyn.ritsumei.ac.jp>2011-11-09 20:51:48 +0900
commit6b22eb99829c3ef36d306657fd6b4b5cd02d7af3 (patch)
treec24249a91fc288dd8e62ec334e3c5d23c904cbfc /sphinx
parent9ee282995b60455905bf2eefd6fd88f5d1969dab (diff)
downloadsphinx-6b22eb99829c3ef36d306657fd6b4b5cd02d7af3.tar.gz
support pTeX and dvipdfmx with sphinx.sty
Diffstat (limited to 'sphinx')
-rw-r--r--sphinx/texinputs/sphinx.sty22
-rw-r--r--sphinx/writers/latex.py11
2 files changed, 26 insertions, 7 deletions
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 08adec9e..01a642a9 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -45,6 +45,13 @@
%\renewcommand{\paperwidth}{8.5in} % typical squarish manual
%\renewcommand{\paperwidth}{7in} % O'Reilly ``Programmming Python''
+% use pdfoutput for pTeX and dvipdfmx
+\ifx\kanjiskip\undefined\else
+ \ifx\Gin@driver{dvipdfmx.def}\undefined\else
+ \newcount\pdfoutput\pdfoutput=0
+ \fi
+\fi
+
% For graphicx, check if we are compiling under latex or pdflatex.
\ifx\pdftexversion\undefined
\usepackage{graphicx}
@@ -419,6 +426,21 @@
\addcontentsline{toc}{chapter}{\indexname}
}
+% to make pdf with correct encoded bookmarks in Japanese
+% this should precede the hyperref package
+\ifx\kanjiskip\undefined\else
+ \usepackage{atbegshi}
+ \ifx\ucs\undefined
+ \ifnum 42146=\euc"A4A2
+ \AtBeginShipoutFirst{\special{pdf:tounicode EUC-UCS2}}
+ \else
+ \AtBeginShipoutFirst{\special{pdf:tounicode 90ms-RKSJ-UCS2}}
+ \fi
+ \else
+ \AtBeginShipoutFirst{\special{pdf:tounicode UTF8-UCS2}}
+ \fi
+\fi
+
% Include hyperref last.
\RequirePackage[colorlinks,breaklinks,
linkcolor=InnerLinkColor,filecolor=OuterLinkColor,
diff --git a/sphinx/writers/latex.py b/sphinx/writers/latex.py
index e5ef3a61..a3f33cac 100644
--- a/sphinx/writers/latex.py
+++ b/sphinx/writers/latex.py
@@ -205,13 +205,10 @@ class LaTeXTranslator(nodes.NodeVisitor):
# pTeX (Japanese TeX) for support
if builder.config.language == 'ja':
- self.elements['classoptions'] = ',dvipdfm'
- # found elements of babel, but this should be above sphinx.sty.
- # because pTeX (Japanese TeX) cannot handle this count.
- self.elements['babel'] = r'\newcount\pdfoutput\pdfoutput=0'
- # to make the pdf with correct encoded hyperref bookmarks
- self.elements['preamble'] += \
- r'\AtBeginDvi{\special{pdf:tounicode EUC-UCS2}}'
+ # use dvipdfmx as default class option in Japanese
+ self.elements['classoptions'] = ',dvipdfmx'
+ # disable babel which has not publishing quality in Japanese
+ self.elements['babel'] = ''
else:
self.elements['classoptions'] += ',english'
# allow the user to override them all