summaryrefslogtreecommitdiff
path: root/sphinx/texinputs
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2012-10-28 18:01:57 +0100
committerGeorg Brandl <georg@python.org>2012-10-28 18:01:57 +0100
commit37fb2785f646d91ab4300b9e1791083160b700b2 (patch)
treee043f82e1c3aa26f5283bd582b7176a5d3b77460 /sphinx/texinputs
parent0f043f68a08f0a93da6dc4c07b215a5ae7b8680d (diff)
parentc8258288b45ad20b8dde3a932cf874a11244219b (diff)
downloadsphinx-37fb2785f646d91ab4300b9e1791083160b700b2.tar.gz
merge with stable
Diffstat (limited to 'sphinx/texinputs')
-rw-r--r--sphinx/texinputs/Makefile4
-rw-r--r--sphinx/texinputs/sphinx.sty68
2 files changed, 66 insertions, 6 deletions
diff --git a/sphinx/texinputs/Makefile b/sphinx/texinputs/Makefile
index 76e7c3e2..6b87ad88 100644
--- a/sphinx/texinputs/Makefile
+++ b/sphinx/texinputs/Makefile
@@ -16,11 +16,11 @@ all-ps: all-dvi
for f in *.dvi; do dvips $$f; done
all-pdf-ja:
- for f in *.pdf *.png *.gif *.jpg *.jpeg; do ebb $$f; done
+ for f in *.pdf *.png *.gif *.jpg *.jpeg; do extractbb $$f; done
for f in *.tex; do platex -kanji=utf8 $(LATEXOPTS) $$f; done
for f in *.tex; do platex -kanji=utf8 $(LATEXOPTS) $$f; done
for f in *.tex; do platex -kanji=utf8 $(LATEXOPTS) $$f; done
- for f in *.idx; do mendex -U -f -d "`basename $$f .idx`.dic" -s python.ist $$f; done
+ -for f in *.idx; do mendex -U -f -d "`basename $$f .idx`.dic" -s python.ist $$f; done
for f in *.tex; do platex -kanji=utf8 $(LATEXOPTS) $$f; done
for f in *.tex; do platex -kanji=utf8 $(LATEXOPTS) $$f; done
for f in *.dvi; do dvipdfmx $$f; done
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index 08adec9e..5a422677 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}
@@ -111,6 +118,10 @@
\fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}}
\renewcommand{\headrulewidth}{0.4pt}
\renewcommand{\footrulewidth}{0.4pt}
+ % define chaptermark with \@chappos when \@chappos is available for Japanese
+ \ifx\@chappos\undefined\else
+ \def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}}
+ \fi
}
% Update the plain style so we get the page number & footer line,
% but not a chapter or section title. This is to keep the first
@@ -243,7 +254,7 @@
\addtolength{\py@noticelength}{-2\fboxsep}
\addtolength{\py@noticelength}{-2\fboxrule}
%\setlength{\shadowsize}{3pt}
- \Sbox
+ \noindent\Sbox
\minipage{\py@noticelength}
}
\newcommand{\py@endheavybox}{
@@ -254,12 +265,12 @@
\newcommand{\py@lightbox}{{%
\setlength\parskip{0pt}\par
- \rule[0ex]{\linewidth}{0.5pt}%
- \par\vspace{-0.5ex}%
+ \noindent\rule[0ex]{\linewidth}{0.5pt}%
+ \par\noindent\vspace{-0.5ex}%
}}
\newcommand{\py@endlightbox}{{%
\setlength{\parskip}{0pt}%
- \par\rule[0.5ex]{\linewidth}{0.5pt}%
+ \par\noindent\rule[0.5ex]{\linewidth}{0.5pt}%
\par\vspace{-0.5ex}%
}}
@@ -419,6 +430,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,
@@ -476,3 +502,37 @@
\@gobble
}
\def\FN@sf@gobble@twobracket[#1]#2{}
+
+% adjust the margins for footer,
+% this works with the jsclasses only (Japanese standard document classes)
+\ifx\@jsc@uplatextrue\undefined\else
+ \hypersetup{setpagesize=false}
+ \setlength\footskip{2\baselineskip}
+ \addtolength{\textheight}{-2\baselineskip}
+\fi
+
+% fix the double index and bibliography on the table of contents
+% in jsclasses (Japanese standard document classes)
+\ifx\@jsc@uplatextrue\undefined\else
+ \renewcommand{\theindex}{
+ \cleardoublepage
+ \phantomsection
+ \py@OldTheindex
+ }
+ \renewcommand{\thebibliography}[1]{
+ \cleardoublepage
+ \phantomsection
+ \py@OldThebibliography{1}
+ }
+\fi
+
+% do not use \@chappos in Appendix in pTeX
+\ifx\kanjiskip\undefined\else
+ \renewcommand{\appendix}{\par
+ \setcounter{chapter}{0}
+ \setcounter{section}{0}
+ \gdef\@chapapp{\appendixname}
+ \gdef\@chappos{}
+ \gdef\thechapter{\@Alph\c@chapter}
+ }
+\fi