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