Show More
@@ -0,0 +1,12 b'' | |||||
|
1 | c = get_config() | |||
|
2 | ||||
|
3 | c.ConverterTemplate.extract_figures=True | |||
|
4 | c.ConverterTemplate.template_file='latex_sphinx' | |||
|
5 | c.ConverterTemplate.tex_environement=True | |||
|
6 | c.ConverterTemplate.display_data_priority=['latex', 'svg', 'png', 'jpg', 'jpeg' , 'text'] | |||
|
7 | c.ExtractFigureTransformer.display_data_priority=['latex', 'svg', 'png', 'jpg', 'jpeg'] | |||
|
8 | c.NbconvertApp.fileext='tex' | |||
|
9 | c.NbconvertApp.write=True | |||
|
10 | ||||
|
11 | c.ExtractFigureTransformer.extra_ext_map={'svg':'pdf'} | |||
|
12 | c.ExtractFigureTransformer.enabled=True |
@@ -0,0 +1,59 b'' | |||||
|
1 | ((*- extends 'latex_base.tplx' -*)) | |||
|
2 | ||||
|
3 | ((= Header =)) | |||
|
4 | ((* block header *)) | |||
|
5 | %% Generated by Sphinx (not really.) | |||
|
6 | \usepackage{sphinx} | |||
|
7 | ||||
|
8 | %% Removed, TODO fix this | |||
|
9 | %%\def\sphinxdocclass{%(docclass)s} | |||
|
10 | ||||
|
11 | \documentclass[%(papersize)s,%(pointsize)s%(classoptions)s]{%(wrapperclass)s} | |||
|
12 | ||||
|
13 | \begin{comment} | |||
|
14 | %% TODO: This stuff needs to be filled in | |||
|
15 | %(inputenc)s | |||
|
16 | %(utf8extra)s | |||
|
17 | %(fontenc)s | |||
|
18 | %(babel)s | |||
|
19 | %(fontpkg)s | |||
|
20 | %(fncychap)s | |||
|
21 | %(longtable)s | |||
|
22 | \end{comment} | |||
|
23 | ||||
|
24 | \usepackage{sphinx} | |||
|
25 | \usepackage{multirow} | |||
|
26 | ||||
|
27 | %%TODO: uncomment and fill this in. | |||
|
28 | %%(preamble)s | |||
|
29 | \title{(((nb.metadata.name)))} | |||
|
30 | \date{(((now.strftime("%B %-d, %Y"))))} | |||
|
31 | ||||
|
32 | \begin{comment} | |||
|
33 | Not used by nbconvert yet! | |||
|
34 | \release{%(release)s} | |||
|
35 | \author{%(author)s} | |||
|
36 | \newcommand{\sphinxlogo}{%(logo)s} | |||
|
37 | \renewcommand{\releasename}{%(releasename)s} | |||
|
38 | %(makeindex)s | |||
|
39 | \end{comment} | |||
|
40 | ((* endblock *)) | |||
|
41 | ||||
|
42 | ((= Begining of the document =)) | |||
|
43 | ((= | |||
|
44 | \begin{document} | |||
|
45 | ||||
|
46 | \begin{comment} | |||
|
47 | Not used by nbconvert yet! | |||
|
48 | %(shorthandoff)s | |||
|
49 | %(maketitle)s | |||
|
50 | %(tableofcontents)s | |||
|
51 | \end{comment} | |||
|
52 | =)) | |||
|
53 | ((= End of the document =)) | |||
|
54 | ((= | |||
|
55 | \renewcommand{\indexname} | |||
|
56 | \begin{comment}{%(indexname)s} | |||
|
57 | %(printindex)s | |||
|
58 | \end{comment} | |||
|
59 | \end{document}=)) |
This diff has been collapsed as it changes many lines, (542 lines changed) Show them Hide them | |||||
@@ -0,0 +1,542 b'' | |||||
|
1 | % | |||
|
2 | % sphinx.sty | |||
|
3 | % | |||
|
4 | % Adapted from the old python.sty, mostly written by Fred Drake, | |||
|
5 | % by Georg Brandl. | |||
|
6 | % | |||
|
7 | ||||
|
8 | \NeedsTeXFormat{LaTeX2e}[1995/12/01] | |||
|
9 | \ProvidesPackage{sphinx}[2010/01/15 LaTeX package (Sphinx markup)] | |||
|
10 | ||||
|
11 | \@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}} | |||
|
12 | ||||
|
13 | \RequirePackage{textcomp} | |||
|
14 | \RequirePackage{fancybox} | |||
|
15 | \RequirePackage{titlesec} | |||
|
16 | \RequirePackage{tabulary} | |||
|
17 | \RequirePackage{amsmath} % for \text | |||
|
18 | \RequirePackage{makeidx} | |||
|
19 | \RequirePackage{framed} | |||
|
20 | \RequirePackage{ifthen} | |||
|
21 | \RequirePackage{color} | |||
|
22 | % For highlighted code. | |||
|
23 | \RequirePackage{fancyvrb} | |||
|
24 | % For table captions. | |||
|
25 | \RequirePackage{threeparttable} | |||
|
26 | % Handle footnotes in tables. | |||
|
27 | \RequirePackage{footnote} | |||
|
28 | \makesavenoteenv{tabulary} | |||
|
29 | % For floating figures in the text. | |||
|
30 | \RequirePackage{wrapfig} | |||
|
31 | % Separate paragraphs by space by default. | |||
|
32 | \RequirePackage{parskip} | |||
|
33 | ||||
|
34 | % Redefine these colors to your liking in the preamble. | |||
|
35 | \definecolor{TitleColor}{rgb}{0.126,0.263,0.361} | |||
|
36 | \definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486} | |||
|
37 | \definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388} | |||
|
38 | % Redefine these colors to something not white if you want to have colored | |||
|
39 | % background and border for code examples. | |||
|
40 | \definecolor{VerbatimColor}{rgb}{1,1,1} | |||
|
41 | \definecolor{VerbatimBorderColor}{rgb}{1,1,1} | |||
|
42 | ||||
|
43 | % Uncomment these two lines to ignore the paper size and make the page | |||
|
44 | % size more like a typical published manual. | |||
|
45 | %\renewcommand{\paperheight}{9in} | |||
|
46 | %\renewcommand{\paperwidth}{8.5in} % typical squarish manual | |||
|
47 | %\renewcommand{\paperwidth}{7in} % O'Reilly ``Programmming Python'' | |||
|
48 | ||||
|
49 | % use pdfoutput for pTeX and dvipdfmx | |||
|
50 | \ifx\kanjiskip\undefined\else | |||
|
51 | \ifx\Gin@driver{dvipdfmx.def}\undefined\else | |||
|
52 | \newcount\pdfoutput\pdfoutput=0 | |||
|
53 | \fi | |||
|
54 | \fi | |||
|
55 | ||||
|
56 | % For graphicx, check if we are compiling under latex or pdflatex. | |||
|
57 | \ifx\pdftexversion\undefined | |||
|
58 | \usepackage{graphicx} | |||
|
59 | \else | |||
|
60 | \usepackage[pdftex]{graphicx} | |||
|
61 | \fi | |||
|
62 | ||||
|
63 | % for PDF output, use colors and maximal compression | |||
|
64 | \newif\ifsphinxpdfoutput\sphinxpdfoutputfalse | |||
|
65 | \ifx\pdfoutput\undefined\else\ifcase\pdfoutput | |||
|
66 | \let\py@NormalColor\relax | |||
|
67 | \let\py@TitleColor\relax | |||
|
68 | \else | |||
|
69 | \sphinxpdfoutputtrue | |||
|
70 | \input{pdfcolor} | |||
|
71 | \def\py@NormalColor{\color[rgb]{0.0,0.0,0.0}} | |||
|
72 | \def\py@TitleColor{\color{TitleColor}} | |||
|
73 | \pdfcompresslevel=9 | |||
|
74 | \fi\fi | |||
|
75 | ||||
|
76 | % XeLaTeX can do colors, too | |||
|
77 | \ifx\XeTeXrevision\undefined\else | |||
|
78 | \def\py@NormalColor{\color[rgb]{0.0,0.0,0.0}} | |||
|
79 | \def\py@TitleColor{\color{TitleColor}} | |||
|
80 | \fi | |||
|
81 | ||||
|
82 | % Increase printable page size (copied from fullpage.sty) | |||
|
83 | \topmargin 0pt | |||
|
84 | \advance \topmargin by -\headheight | |||
|
85 | \advance \topmargin by -\headsep | |||
|
86 | ||||
|
87 | % attempt to work a little better for A4 users | |||
|
88 | \textheight \paperheight | |||
|
89 | \advance\textheight by -2in | |||
|
90 | ||||
|
91 | \oddsidemargin 0pt | |||
|
92 | \evensidemargin 0pt | |||
|
93 | %\evensidemargin -.25in % for ``manual size'' documents | |||
|
94 | \marginparwidth 0.5in | |||
|
95 | ||||
|
96 | \textwidth \paperwidth | |||
|
97 | \advance\textwidth by -2in | |||
|
98 | ||||
|
99 | ||||
|
100 | % Style parameters and macros used by most documents here | |||
|
101 | \raggedbottom | |||
|
102 | \sloppy | |||
|
103 | \hbadness = 5000 % don't print trivial gripes | |||
|
104 | ||||
|
105 | \pagestyle{empty} % start this way; change for | |||
|
106 | \pagenumbering{roman} % ToC & chapters | |||
|
107 | ||||
|
108 | % Use this to set the font family for headers and other decor: | |||
|
109 | \newcommand{\py@HeaderFamily}{\sffamily\bfseries} | |||
|
110 | ||||
|
111 | % Redefine the 'normal' header/footer style when using "fancyhdr" package: | |||
|
112 | \@ifundefined{fancyhf}{}{ | |||
|
113 | % Use \pagestyle{normal} as the primary pagestyle for text. | |||
|
114 | \fancypagestyle{normal}{ | |||
|
115 | \fancyhf{} | |||
|
116 | \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}} | |||
|
117 | \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}} | |||
|
118 | \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}} | |||
|
119 | \fancyhead[LE,RO]{{\py@HeaderFamily \@title, \py@release}} | |||
|
120 | \renewcommand{\headrulewidth}{0.4pt} | |||
|
121 | \renewcommand{\footrulewidth}{0.4pt} | |||
|
122 | % define chaptermark with \@chappos when \@chappos is available for Japanese | |||
|
123 | \ifx\@chappos\undefined\else | |||
|
124 | \def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}} | |||
|
125 | \fi | |||
|
126 | } | |||
|
127 | % Update the plain style so we get the page number & footer line, | |||
|
128 | % but not a chapter or section title. This is to keep the first | |||
|
129 | % page of a chapter and the blank page between chapters `clean.' | |||
|
130 | \fancypagestyle{plain}{ | |||
|
131 | \fancyhf{} | |||
|
132 | \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}} | |||
|
133 | \renewcommand{\headrulewidth}{0pt} | |||
|
134 | \renewcommand{\footrulewidth}{0.4pt} | |||
|
135 | } | |||
|
136 | } | |||
|
137 | ||||
|
138 | % Some custom font markup commands. | |||
|
139 | % | |||
|
140 | \newcommand{\strong}[1]{{\textbf{#1}}} | |||
|
141 | \newcommand{\code}[1]{\texttt{#1}} | |||
|
142 | \newcommand{\bfcode}[1]{\code{\bfseries#1}} | |||
|
143 | \newcommand{\email}[1]{\textsf{#1}} | |||
|
144 | ||||
|
145 | % Redefine the Verbatim environment to allow border and background colors. | |||
|
146 | % The original environment is still used for verbatims within tables. | |||
|
147 | \let\OriginalVerbatim=\Verbatim | |||
|
148 | \let\endOriginalVerbatim=\endVerbatim | |||
|
149 | ||||
|
150 | % Play with vspace to be able to keep the indentation. | |||
|
151 | \newlength\distancetoright | |||
|
152 | \def\mycolorbox#1{% | |||
|
153 | \setlength\distancetoright{\linewidth}% | |||
|
154 | \advance\distancetoright -\@totalleftmargin % | |||
|
155 | \fcolorbox{VerbatimBorderColor}{VerbatimColor}{% | |||
|
156 | \begin{minipage}{\distancetoright}% | |||
|
157 | #1 | |||
|
158 | \end{minipage}% | |||
|
159 | }% | |||
|
160 | } | |||
|
161 | \def\FrameCommand{\mycolorbox} | |||
|
162 | ||||
|
163 | \renewcommand{\Verbatim}[1][1]{% | |||
|
164 | % list starts new par, but we don't want it to be set apart vertically | |||
|
165 | \bgroup\parskip=0pt% | |||
|
166 | \smallskip% | |||
|
167 | % The list environement is needed to control perfectly the vertical | |||
|
168 | % space. | |||
|
169 | \list{}{% | |||
|
170 | \setlength\parskip{0pt}% | |||
|
171 | \setlength\itemsep{0ex}% | |||
|
172 | \setlength\topsep{0ex}% | |||
|
173 | \setlength\partopsep{0pt}% | |||
|
174 | \setlength\leftmargin{0pt}% | |||
|
175 | }% | |||
|
176 | \item\MakeFramed {\FrameRestore}% | |||
|
177 | \small% | |||
|
178 | \OriginalVerbatim[#1]% | |||
|
179 | } | |||
|
180 | \renewcommand{\endVerbatim}{% | |||
|
181 | \endOriginalVerbatim% | |||
|
182 | \endMakeFramed% | |||
|
183 | \endlist% | |||
|
184 | % close group to restore \parskip | |||
|
185 | \egroup% | |||
|
186 | } | |||
|
187 | ||||
|
188 | ||||
|
189 | % \moduleauthor{name}{email} | |||
|
190 | \newcommand{\moduleauthor}[2]{} | |||
|
191 | ||||
|
192 | % \sectionauthor{name}{email} | |||
|
193 | \newcommand{\sectionauthor}[2]{} | |||
|
194 | ||||
|
195 | % Augment the sectioning commands used to get our own font family in place, | |||
|
196 | % and reset some internal data items: | |||
|
197 | \titleformat{\section}{\Large\py@HeaderFamily}% | |||
|
198 | {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor} | |||
|
199 | \titleformat{\subsection}{\large\py@HeaderFamily}% | |||
|
200 | {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} | |||
|
201 | \titleformat{\subsubsection}{\py@HeaderFamily}% | |||
|
202 | {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor} | |||
|
203 | \titleformat{\paragraph}{\small\py@HeaderFamily}% | |||
|
204 | {\py@TitleColor}{0em}{\py@TitleColor}{\py@NormalColor} | |||
|
205 | ||||
|
206 | % {fulllineitems} is the main environment for object descriptions. | |||
|
207 | % | |||
|
208 | \newcommand{\py@itemnewline}[1]{% | |||
|
209 | \@tempdima\linewidth% | |||
|
210 | \advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}% | |||
|
211 | } | |||
|
212 | ||||
|
213 | \newenvironment{fulllineitems}{ | |||
|
214 | \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt | |||
|
215 | \rightmargin 0pt \topsep -\parskip \partopsep \parskip | |||
|
216 | \itemsep -\parsep | |||
|
217 | \let\makelabel=\py@itemnewline} | |||
|
218 | }{\end{list}} | |||
|
219 | ||||
|
220 | % \optional is used for ``[, arg]``, i.e. desc_optional nodes. | |||
|
221 | \newcommand{\optional}[1]{% | |||
|
222 | {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}} | |||
|
223 | ||||
|
224 | \newlength{\py@argswidth} | |||
|
225 | \newcommand{\py@sigparams}[2]{% | |||
|
226 | \parbox[t]{\py@argswidth}{#1\code{)}#2}} | |||
|
227 | \newcommand{\pysigline}[1]{\item[#1]\nopagebreak} | |||
|
228 | \newcommand{\pysiglinewithargsret}[3]{% | |||
|
229 | \settowidth{\py@argswidth}{#1\code{(}}% | |||
|
230 | \addtolength{\py@argswidth}{-2\py@argswidth}% | |||
|
231 | \addtolength{\py@argswidth}{\linewidth}% | |||
|
232 | \item[#1\code{(}\py@sigparams{#2}{#3}]} | |||
|
233 | ||||
|
234 | % Production lists | |||
|
235 | % | |||
|
236 | \newenvironment{productionlist}{ | |||
|
237 | % \def\optional##1{{\Large[}##1{\Large]}} | |||
|
238 | \def\production##1##2{\\\code{##1}&::=&\code{##2}} | |||
|
239 | \def\productioncont##1{\\& &\code{##1}} | |||
|
240 | \parindent=2em | |||
|
241 | \indent | |||
|
242 | \begin{tabular}{lcl} | |||
|
243 | }{% | |||
|
244 | \end{tabular} | |||
|
245 | } | |||
|
246 | ||||
|
247 | % Notices / Admonitions | |||
|
248 | % | |||
|
249 | \newlength{\py@noticelength} | |||
|
250 | ||||
|
251 | \newcommand{\py@heavybox}{ | |||
|
252 | \setlength{\fboxrule}{1pt} | |||
|
253 | \setlength{\fboxsep}{6pt} | |||
|
254 | \setlength{\py@noticelength}{\linewidth} | |||
|
255 | \addtolength{\py@noticelength}{-2\fboxsep} | |||
|
256 | \addtolength{\py@noticelength}{-2\fboxrule} | |||
|
257 | %\setlength{\shadowsize}{3pt} | |||
|
258 | \noindent\Sbox | |||
|
259 | \minipage{\py@noticelength} | |||
|
260 | } | |||
|
261 | \newcommand{\py@endheavybox}{ | |||
|
262 | \endminipage | |||
|
263 | \endSbox | |||
|
264 | \fbox{\TheSbox} | |||
|
265 | } | |||
|
266 | ||||
|
267 | \newcommand{\py@lightbox}{{% | |||
|
268 | \setlength\parskip{0pt}\par | |||
|
269 | \noindent\rule[0ex]{\linewidth}{0.5pt}% | |||
|
270 | \par\noindent\vspace{-0.5ex}% | |||
|
271 | }} | |||
|
272 | \newcommand{\py@endlightbox}{{% | |||
|
273 | \setlength{\parskip}{0pt}% | |||
|
274 | \par\noindent\rule[0.5ex]{\linewidth}{0.5pt}% | |||
|
275 | \par\vspace{-0.5ex}% | |||
|
276 | }} | |||
|
277 | ||||
|
278 | % Some are quite plain: | |||
|
279 | \newcommand{\py@noticestart@note}{\py@lightbox} | |||
|
280 | \newcommand{\py@noticeend@note}{\py@endlightbox} | |||
|
281 | \newcommand{\py@noticestart@hint}{\py@lightbox} | |||
|
282 | \newcommand{\py@noticeend@hint}{\py@endlightbox} | |||
|
283 | \newcommand{\py@noticestart@important}{\py@lightbox} | |||
|
284 | \newcommand{\py@noticeend@important}{\py@endlightbox} | |||
|
285 | \newcommand{\py@noticestart@tip}{\py@lightbox} | |||
|
286 | \newcommand{\py@noticeend@tip}{\py@endlightbox} | |||
|
287 | ||||
|
288 | % Others gets more visible distinction: | |||
|
289 | \newcommand{\py@noticestart@warning}{\py@heavybox} | |||
|
290 | \newcommand{\py@noticeend@warning}{\py@endheavybox} | |||
|
291 | \newcommand{\py@noticestart@caution}{\py@heavybox} | |||
|
292 | \newcommand{\py@noticeend@caution}{\py@endheavybox} | |||
|
293 | \newcommand{\py@noticestart@attention}{\py@heavybox} | |||
|
294 | \newcommand{\py@noticeend@attention}{\py@endheavybox} | |||
|
295 | \newcommand{\py@noticestart@danger}{\py@heavybox} | |||
|
296 | \newcommand{\py@noticeend@danger}{\py@endheavybox} | |||
|
297 | \newcommand{\py@noticestart@error}{\py@heavybox} | |||
|
298 | \newcommand{\py@noticeend@error}{\py@endheavybox} | |||
|
299 | ||||
|
300 | \newenvironment{notice}[2]{ | |||
|
301 | \def\py@noticetype{#1} | |||
|
302 | \csname py@noticestart@#1\endcsname | |||
|
303 | \strong{#2} | |||
|
304 | }{\csname py@noticeend@\py@noticetype\endcsname} | |||
|
305 | ||||
|
306 | % Allow the release number to be specified independently of the | |||
|
307 | % \date{}. This allows the date to reflect the document's date and | |||
|
308 | % release to specify the release that is documented. | |||
|
309 | % | |||
|
310 | \newcommand{\py@release}{} | |||
|
311 | \newcommand{\version}{} | |||
|
312 | \newcommand{\shortversion}{} | |||
|
313 | \newcommand{\releaseinfo}{} | |||
|
314 | \newcommand{\releasename}{Release} | |||
|
315 | \newcommand{\release}[1]{% | |||
|
316 | \renewcommand{\py@release}{\releasename\space\version}% | |||
|
317 | \renewcommand{\version}{#1}} | |||
|
318 | \newcommand{\setshortversion}[1]{% | |||
|
319 | \renewcommand{\shortversion}{#1}} | |||
|
320 | \newcommand{\setreleaseinfo}[1]{% | |||
|
321 | \renewcommand{\releaseinfo}{#1}} | |||
|
322 | ||||
|
323 | % Allow specification of the author's address separately from the | |||
|
324 | % author's name. This can be used to format them differently, which | |||
|
325 | % is a good thing. | |||
|
326 | % | |||
|
327 | \newcommand{\py@authoraddress}{} | |||
|
328 | \newcommand{\authoraddress}[1]{\renewcommand{\py@authoraddress}{#1}} | |||
|
329 | ||||
|
330 | % This sets up the fancy chapter headings that make the documents look | |||
|
331 | % at least a little better than the usual LaTeX output. | |||
|
332 | % | |||
|
333 | \@ifundefined{ChTitleVar}{}{ | |||
|
334 | \ChNameVar{\raggedleft\normalsize\py@HeaderFamily} | |||
|
335 | \ChNumVar{\raggedleft \bfseries\Large\py@HeaderFamily} | |||
|
336 | \ChTitleVar{\raggedleft \textrm{\Huge\py@HeaderFamily}} | |||
|
337 | % This creates chapter heads without the leading \vspace*{}: | |||
|
338 | \def\@makechapterhead#1{% | |||
|
339 | {\parindent \z@ \raggedright \normalfont | |||
|
340 | \ifnum \c@secnumdepth >\m@ne | |||
|
341 | \DOCH | |||
|
342 | \fi | |||
|
343 | \interlinepenalty\@M | |||
|
344 | \DOTI{#1} | |||
|
345 | } | |||
|
346 | } | |||
|
347 | } | |||
|
348 | ||||
|
349 | % Redefine description environment so that it is usable inside fulllineitems. | |||
|
350 | % | |||
|
351 | \renewcommand{\description}{% | |||
|
352 | \list{}{\labelwidth\z@% | |||
|
353 | \itemindent-\leftmargin% | |||
|
354 | \labelsep5pt% | |||
|
355 | \let\makelabel=\descriptionlabel}} | |||
|
356 | ||||
|
357 | % Definition lists; requested by AMK for HOWTO documents. Probably useful | |||
|
358 | % elsewhere as well, so keep in in the general style support. | |||
|
359 | % | |||
|
360 | \newenvironment{definitions}{% | |||
|
361 | \begin{description}% | |||
|
362 | \def\term##1{\item[##1]\mbox{}\\*[0mm]} | |||
|
363 | }{% | |||
|
364 | \end{description}% | |||
|
365 | } | |||
|
366 | ||||
|
367 | % Tell TeX about pathological hyphenation cases: | |||
|
368 | \hyphenation{Base-HTTP-Re-quest-Hand-ler} | |||
|
369 | ||||
|
370 | ||||
|
371 | % The following is stuff copied from docutils' latex writer. | |||
|
372 | % | |||
|
373 | \newcommand{\optionlistlabel}[1]{\bf #1 \hfill} | |||
|
374 | \newenvironment{optionlist}[1] | |||
|
375 | {\begin{list}{} | |||
|
376 | {\setlength{\labelwidth}{#1} | |||
|
377 | \setlength{\rightmargin}{1cm} | |||
|
378 | \setlength{\leftmargin}{\rightmargin} | |||
|
379 | \addtolength{\leftmargin}{\labelwidth} | |||
|
380 | \addtolength{\leftmargin}{\labelsep} | |||
|
381 | \renewcommand{\makelabel}{\optionlistlabel}} | |||
|
382 | }{\end{list}} | |||
|
383 | ||||
|
384 | \newlength{\lineblockindentation} | |||
|
385 | \setlength{\lineblockindentation}{2.5em} | |||
|
386 | \newenvironment{lineblock}[1] | |||
|
387 | {\begin{list}{} | |||
|
388 | {\setlength{\partopsep}{\parskip} | |||
|
389 | \addtolength{\partopsep}{\baselineskip} | |||
|
390 | \topsep0pt\itemsep0.15\baselineskip\parsep0pt | |||
|
391 | \leftmargin#1} | |||
|
392 | \raggedright} | |||
|
393 | {\end{list}} | |||
|
394 | ||||
|
395 | % Redefine includgraphics for avoiding images larger than the screen size | |||
|
396 | % If the size is not specified. | |||
|
397 | \let\py@Oldincludegraphics\includegraphics | |||
|
398 | ||||
|
399 | \newbox\image@box% | |||
|
400 | \newdimen\image@width% | |||
|
401 | \renewcommand\includegraphics[2][\@empty]{% | |||
|
402 | \ifx#1\@empty% | |||
|
403 | \setbox\image@box=\hbox{\py@Oldincludegraphics{#2}}% | |||
|
404 | \image@width\wd\image@box% | |||
|
405 | \ifdim \image@width>\linewidth% | |||
|
406 | \setbox\image@box=\hbox{\py@Oldincludegraphics[width=\linewidth]{#2}}% | |||
|
407 | \box\image@box% | |||
|
408 | \else% | |||
|
409 | \py@Oldincludegraphics{#2}% | |||
|
410 | \fi% | |||
|
411 | \else% | |||
|
412 | \py@Oldincludegraphics[#1]{#2}% | |||
|
413 | \fi% | |||
|
414 | } | |||
|
415 | ||||
|
416 | ||||
|
417 | % Fix the index environment to add an entry to the Table of | |||
|
418 | % Contents; this is much nicer than just having to jump to the end of the book | |||
|
419 | % and flip around, especially with multiple indexes. | |||
|
420 | % The memoir class already does this, so we don't duplicate it in that case. | |||
|
421 | % | |||
|
422 | % A similiar fix must be done to the bibliography environment, although | |||
|
423 | % dependant on document class. In particular, the '\addcontentsline' command | |||
|
424 | % should use 'chapter' for a report and 'section' for an article. | |||
|
425 | % See sphinxmanual.cls and sphinxhowto.cls for specific fixes. | |||
|
426 | % | |||
|
427 | \@ifclassloaded{memoir}{}{ | |||
|
428 | \let\py@OldTheindex=\theindex | |||
|
429 | \renewcommand{\theindex}{ | |||
|
430 | \cleardoublepage | |||
|
431 | \phantomsection | |||
|
432 | \py@OldTheindex | |||
|
433 | \addcontentsline{toc}{chapter}{\indexname} | |||
|
434 | } | |||
|
435 | } | |||
|
436 | ||||
|
437 | % to make pdf with correct encoded bookmarks in Japanese | |||
|
438 | % this should precede the hyperref package | |||
|
439 | \ifx\kanjiskip\undefined\else | |||
|
440 | \usepackage{atbegshi} | |||
|
441 | \ifx\ucs\undefined | |||
|
442 | \ifnum 42146=\euc"A4A2 | |||
|
443 | \AtBeginShipoutFirst{\special{pdf:tounicode EUC-UCS2}} | |||
|
444 | \else | |||
|
445 | \AtBeginShipoutFirst{\special{pdf:tounicode 90ms-RKSJ-UCS2}} | |||
|
446 | \fi | |||
|
447 | \else | |||
|
448 | \AtBeginShipoutFirst{\special{pdf:tounicode UTF8-UCS2}} | |||
|
449 | \fi | |||
|
450 | \fi | |||
|
451 | ||||
|
452 | % Include hyperref last. | |||
|
453 | \RequirePackage[colorlinks,breaklinks, | |||
|
454 | linkcolor=InnerLinkColor,filecolor=OuterLinkColor, | |||
|
455 | menucolor=OuterLinkColor,urlcolor=OuterLinkColor, | |||
|
456 | citecolor=InnerLinkColor]{hyperref} | |||
|
457 | % Fix anchor placement for figures with captions. | |||
|
458 | % (Note: we don't use a package option here; instead, we give an explicit | |||
|
459 | % \capstart for figures that actually have a caption.) | |||
|
460 | \RequirePackage{hypcap} | |||
|
461 | ||||
|
462 | % From docutils.writers.latex2e | |||
|
463 | \providecommand{\DUspan}[2]{% | |||
|
464 | {% group ("span") to limit the scope of styling commands | |||
|
465 | \@for\node@class@name:=#1\do{% | |||
|
466 | \ifcsname docutilsrole\node@class@name\endcsname% | |||
|
467 | \csname docutilsrole\node@class@name\endcsname% | |||
|
468 | \fi% | |||
|
469 | }% | |||
|
470 | {#2}% node content | |||
|
471 | }% close "span" | |||
|
472 | } | |||
|
473 | ||||
|
474 | \providecommand*{\DUprovidelength}[2]{ | |||
|
475 | \ifthenelse{\isundefined{#1}}{\newlength{#1}\setlength{#1}{#2}}{} | |||
|
476 | } | |||
|
477 | ||||
|
478 | \DUprovidelength{\DUlineblockindent}{2.5em} | |||
|
479 | \ifthenelse{\isundefined{\DUlineblock}}{ | |||
|
480 | \newenvironment{DUlineblock}[1]{% | |||
|
481 | \list{}{\setlength{\partopsep}{\parskip} | |||
|
482 | \addtolength{\partopsep}{\baselineskip} | |||
|
483 | \setlength{\topsep}{0pt} | |||
|
484 | \setlength{\itemsep}{0.15\baselineskip} | |||
|
485 | \setlength{\parsep}{0pt} | |||
|
486 | \setlength{\leftmargin}{#1}} | |||
|
487 | \raggedright | |||
|
488 | } | |||
|
489 | {\endlist} | |||
|
490 | }{} | |||
|
491 | ||||
|
492 | ||||
|
493 | % From footmisc.sty: allows footnotes in titles | |||
|
494 | \let\FN@sf@@footnote\footnote | |||
|
495 | \def\footnote{\ifx\protect\@typeset@protect | |||
|
496 | \expandafter\FN@sf@@footnote | |||
|
497 | \else | |||
|
498 | \expandafter\FN@sf@gobble@opt | |||
|
499 | \fi | |||
|
500 | } | |||
|
501 | \edef\FN@sf@gobble@opt{\noexpand\protect | |||
|
502 | \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname} | |||
|
503 | \expandafter\def\csname FN@sf@gobble@opt \endcsname{% | |||
|
504 | \@ifnextchar[%] | |||
|
505 | \FN@sf@gobble@twobracket | |||
|
506 | \@gobble | |||
|
507 | } | |||
|
508 | \def\FN@sf@gobble@twobracket[#1]#2{} | |||
|
509 | ||||
|
510 | % adjust the margins for footer, | |||
|
511 | % this works with the jsclasses only (Japanese standard document classes) | |||
|
512 | \ifx\@jsc@uplatextrue\undefined\else | |||
|
513 | \hypersetup{setpagesize=false} | |||
|
514 | \setlength\footskip{2\baselineskip} | |||
|
515 | \addtolength{\textheight}{-2\baselineskip} | |||
|
516 | \fi | |||
|
517 | ||||
|
518 | % fix the double index and bibliography on the table of contents | |||
|
519 | % in jsclasses (Japanese standard document classes) | |||
|
520 | \ifx\@jsc@uplatextrue\undefined\else | |||
|
521 | \renewcommand{\theindex}{ | |||
|
522 | \cleardoublepage | |||
|
523 | \phantomsection | |||
|
524 | \py@OldTheindex | |||
|
525 | } | |||
|
526 | \renewcommand{\thebibliography}[1]{ | |||
|
527 | \cleardoublepage | |||
|
528 | \phantomsection | |||
|
529 | \py@OldThebibliography{1} | |||
|
530 | } | |||
|
531 | \fi | |||
|
532 | ||||
|
533 | % do not use \@chappos in Appendix in pTeX | |||
|
534 | \ifx\kanjiskip\undefined\else | |||
|
535 | \renewcommand{\appendix}{\par | |||
|
536 | \setcounter{chapter}{0} | |||
|
537 | \setcounter{section}{0} | |||
|
538 | \gdef\@chapapp{\appendixname} | |||
|
539 | \gdef\@chappos{} | |||
|
540 | \gdef\thechapter{\@Alph\c@chapter} | |||
|
541 | } | |||
|
542 | \fi |
General Comments 0
You need to be logged in to leave comments.
Login now