You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

sphinx.sty 69 kB

5 years ago
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684
  1. %
  2. % sphinx.sty
  3. %
  4. % Adapted from the old python.sty, mostly written by Fred Drake,
  5. % by Georg Brandl.
  6. %
  7. \NeedsTeXFormat{LaTeX2e}[1995/12/01]
  8. \ProvidesPackage{sphinx}[2018/07/18 v1.8 LaTeX package (Sphinx markup)]
  9. % provides \ltx@ifundefined
  10. % (many packages load ltxcmds: graphicx does for pdftex and lualatex but
  11. % not xelatex, and anyhow kvoptions does, but it may be needed in future to
  12. % use \sphinxdeprecationwarning earlier, and it needs \ltx@ifundefined)
  13. \RequirePackage{ltxcmds}
  14. %% for deprecation warnings
  15. \newcommand\sphinxdeprecationwarning[4]{% #1 the deprecated macro or name,
  16. % #2 = when deprecated, #3 = when removed, #4 = additional info
  17. \edef\spx@tempa{\detokenize{#1}}%
  18. \ltx@ifundefined{sphinx_depr_\spx@tempa}{%
  19. \global\expandafter\let\csname sphinx_depr_\spx@tempa\endcsname\spx@tempa
  20. \expandafter\AtEndDocument\expandafter{\expandafter\let\expandafter
  21. \sphinxdeprecatedmacro\csname sphinx_depr_\spx@tempa\endcsname
  22. \PackageWarningNoLine{sphinx}{^^J**** SPHINX DEPRECATION WARNING:^^J
  23. \sphinxdeprecatedmacro^^J
  24. \@spaces- is deprecated at Sphinx #2^^J
  25. \@spaces- and removed at Sphinx #3.^^J
  26. #4^^J****}}%
  27. }{% warning already emitted (at end of latex log), don't repeat
  28. }}
  29. %% PACKAGES
  30. %
  31. % we delay handling of options to after having loaded packages, because
  32. % of the need to use \definecolor.
  33. \RequirePackage{graphicx}
  34. \@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
  35. % for \text macro and \iffirstchoice@ conditional even if amsmath not loaded
  36. \RequirePackage{amstext}
  37. \RequirePackage{textcomp}% "warn" option issued from template
  38. \RequirePackage{titlesec}
  39. \@ifpackagelater{titlesec}{2016/03/15}%
  40. {\@ifpackagelater{titlesec}{2016/03/21}%
  41. {}%
  42. {\newif\ifsphinx@ttlpatch@ok
  43. \IfFileExists{etoolbox.sty}{%
  44. \RequirePackage{etoolbox}%
  45. \patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}%
  46. {\sphinx@ttlpatch@oktrue}{}%
  47. \ifsphinx@ttlpatch@ok
  48. \patchcmd{\ttlh@hang}{\noindent}{}{}{\sphinx@ttlpatch@okfalse}%
  49. \fi
  50. }{}%
  51. \ifsphinx@ttlpatch@ok
  52. \typeout{^^J Package Sphinx Info: ^^J
  53. **** titlesec 2.10.1 successfully patched for bugfix ****^^J}%
  54. \else
  55. \AtEndDocument{\PackageWarningNoLine{sphinx}{^^J%
  56. ******** titlesec 2.10.1 has a bug, (section numbers disappear) ......|^^J%
  57. ******** and Sphinx could not patch it, perhaps because your local ...|^^J%
  58. ******** copy is already fixed without a changed release date. .......|^^J%
  59. ******** If not, you must update titlesec! ...........................|}}%
  60. \fi
  61. }%
  62. }{}
  63. \RequirePackage{tabulary}
  64. % tabulary has a bug with its re-definition of \multicolumn in its first pass
  65. % which is not \long. But now Sphinx does not use LaTeX's \multicolumn but its
  66. % own macro. Hence we don't even need to patch tabulary. See sphinxmulticell.sty
  67. % X or S (Sphinx) may have meanings if some table package is loaded hence
  68. % \X was chosen to avoid possibility of conflict
  69. \newcolumntype{\X}[2]{p{\dimexpr
  70. (\linewidth-\arrayrulewidth)*#1/#2-\tw@\tabcolsep-\arrayrulewidth\relax}}
  71. \newcolumntype{\Y}[1]{p{\dimexpr
  72. #1\dimexpr\linewidth-\arrayrulewidth\relax-\tw@\tabcolsep-\arrayrulewidth\relax}}
  73. % using here T (for Tabulary) feels less of a problem than the X could be
  74. \newcolumntype{T}{J}%
  75. % For tables allowing pagebreaks
  76. \RequirePackage{longtable}
  77. % User interface to set-up whitespace before and after tables:
  78. \newcommand*\sphinxtablepre {0pt}%
  79. \newcommand*\sphinxtablepost{\medskipamount}%
  80. \newcommand*\sphinxbelowcaptionspace{.5\sphinxbaselineskip}%
  81. % as one can not use \baselineskip from inside longtable (it is zero there)
  82. % we need \sphinxbaselineskip, which defaults to \baselineskip
  83. \def\sphinxbaselineskip{\baselineskip}%
  84. % These commands are inserted by the table templates
  85. \def\sphinxatlongtablestart
  86. {\par
  87. \vskip\parskip
  88. \vskip\dimexpr\sphinxtablepre\relax % adjust vertical position
  89. \vbox{}% get correct baseline from above
  90. \LTpre\z@skip\LTpost\z@skip % set to zero longtable's own skips
  91. \edef\sphinxbaselineskip{\dimexpr\the\dimexpr\baselineskip\relax\relax}%
  92. }%
  93. \def\sphinxatlongtableend{\prevdepth\z@\vskip\sphinxtablepost\relax}%
  94. \def\sphinxlongtablecapskipadjust
  95. {\dimexpr-\dp\strutbox-\sphinxbaselineskip+\sphinxbelowcaptionspace\relax}%
  96. % Now for tables not using longtable
  97. \def\sphinxattablestart
  98. {\par
  99. \vskip\dimexpr\sphinxtablepre\relax
  100. }%
  101. \let\sphinxattableend\sphinxatlongtableend
  102. % longtable's wraps captions to a maximal width of \LTcapwidth
  103. % so we do the same for all tables
  104. \newcommand*\sphinxcapstartof[1]{%
  105. \vskip\parskip
  106. \vbox{}% force baselineskip for good positioning by capstart of hyperanchor
  107. \def\@captype{#1}%
  108. \capstart
  109. % move back vertically to compensate space inserted by next paragraph
  110. \vskip-\baselineskip\vskip-\parskip
  111. }%
  112. % use \LTcapwidth (default is 4in) to wrap caption (if line width is bigger)
  113. \newcommand\sphinxcaption[2][\LTcapwidth]{%
  114. \noindent\hb@xt@\linewidth{\hss
  115. \vtop{\@tempdima\dimexpr#1\relax
  116. % don't exceed linewidth for the caption width
  117. \ifdim\@tempdima>\linewidth\hsize\linewidth\else\hsize\@tempdima\fi
  118. % longtable ignores \abovecaptionskip/\belowcaptionskip, so add hooks here
  119. % to uniformize control of caption distance to tables
  120. \abovecaptionskip\sphinxabovecaptionskip
  121. \belowcaptionskip\sphinxbelowcaptionskip
  122. \caption[{#2}]%
  123. {\strut\ignorespaces#2\ifhmode\unskip\@finalstrut\strutbox\fi}%
  124. }\hss}%
  125. \par\prevdepth\dp\strutbox
  126. }%
  127. \def\spx@abovecaptionskip{\abovecaptionskip}
  128. \newcommand*\sphinxabovecaptionskip{\z@skip}
  129. \newcommand*\sphinxbelowcaptionskip{\z@skip}
  130. \newcommand\sphinxaftercaption
  131. {% this default definition serves with a caption *above* a table, to make sure
  132. % its last baseline is \sphinxbelowcaptionspace above table top
  133. \nobreak
  134. \vskip\dimexpr\sphinxbelowcaptionspace\relax
  135. \vskip-\baselineskip\vskip-\parskip
  136. }%
  137. % varwidth is crucial for our handling of general contents in merged cells
  138. \RequirePackage{varwidth}
  139. % but addition of a compatibility patch with hyperref is needed
  140. % (tested with varwidth v 0.92 Mar 2009)
  141. \AtBeginDocument {%
  142. \let\@@vwid@Hy@raisedlink\Hy@raisedlink
  143. \long\def\@vwid@Hy@raisedlink#1{\@vwid@wrap{\@@vwid@Hy@raisedlink{#1}}}%
  144. \edef\@vwid@setup{%
  145. \let\noexpand\Hy@raisedlink\noexpand\@vwid@Hy@raisedlink % HYPERREF !
  146. \unexpanded\expandafter{\@vwid@setup}}%
  147. }%
  148. % Homemade package to handle merged cells
  149. \RequirePackage{sphinxmulticell}
  150. \RequirePackage{makeidx}
  151. % For framing code-blocks and warning type notices, and shadowing topics
  152. \RequirePackage{framed}
  153. % The xcolor package draws better fcolorboxes around verbatim code
  154. \IfFileExists{xcolor.sty}{
  155. \RequirePackage{xcolor}
  156. }{
  157. \RequirePackage{color}
  158. }
  159. % For highlighted code.
  160. \RequirePackage{fancyvrb}
  161. \define@key{FV}{hllines}{\def\sphinx@verbatim@checkifhl##1{\in@{, ##1,}{#1}}}
  162. % For hyperlinked footnotes in tables; also for gathering footnotes from
  163. % topic and warning blocks. Also to allow code-blocks in footnotes.
  164. \RequirePackage{footnotehyper-sphinx}
  165. % For the H specifier. Do not \restylefloat{figure}, it breaks Sphinx code
  166. % for allowing figures in tables.
  167. \RequirePackage{float}
  168. % For floating figures in the text. Better to load after float.
  169. \RequirePackage{wrapfig}
  170. % Separate paragraphs by space by default.
  171. \RequirePackage{parskip}
  172. % For parsed-literal blocks.
  173. \RequirePackage{alltt}
  174. % Display "real" single quotes in literal blocks.
  175. \RequirePackage{upquote}
  176. % control caption around literal-block
  177. \RequirePackage{capt-of}
  178. \RequirePackage{needspace}
  179. % LaTeX 2018-04-01 and later provides \@removefromreset
  180. \ltx@ifundefined{@removefromreset}
  181. {\RequirePackage{remreset}}
  182. {}% avoid warning
  183. % to make pdf with correct encoded bookmarks in Japanese
  184. % this should precede the hyperref package
  185. \ifx\kanjiskip\@undefined
  186. % for non-Japanese: make sure bookmarks are ok also with lualatex
  187. \PassOptionsToPackage{pdfencoding=unicode}{hyperref}
  188. \else
  189. \RequirePackage{atbegshi}
  190. \ifx\ucs\@undefined
  191. \ifnum 42146=\euc"A4A2
  192. \AtBeginShipoutFirst{\special{pdf:tounicode EUC-UCS2}}
  193. \else
  194. \AtBeginShipoutFirst{\special{pdf:tounicode 90ms-RKSJ-UCS2}}
  195. \fi
  196. \else
  197. \AtBeginShipoutFirst{\special{pdf:tounicode UTF8-UCS2}}
  198. \fi
  199. \fi
  200. \ifx\@jsc@uplatextrue\@undefined\else
  201. \PassOptionsToPackage{setpagesize=false}{hyperref}
  202. \fi
  203. % These options can be overriden inside 'hyperref' key
  204. % or by later use of \hypersetup.
  205. \PassOptionsToPackage{colorlinks,breaklinks,%
  206. linkcolor=InnerLinkColor,filecolor=OuterLinkColor,%
  207. menucolor=OuterLinkColor,urlcolor=OuterLinkColor,%
  208. citecolor=InnerLinkColor}{hyperref}
  209. % stylesheet for highlighting with pygments
  210. \RequirePackage{sphinxhighlight}
  211. % fix baseline increase from Pygments latex formatter in case of error tokens
  212. % and keep \fboxsep's scope local via added braces
  213. \def\PYG@tok@err{%
  214. \def\PYG@bc##1{{\setlength{\fboxsep}{-\fboxrule}%
  215. \fcolorbox[rgb]{1.00,0.00,0.00}{1,1,1}{\strut ##1}}}%
  216. }
  217. \def\PYG@tok@cs{%
  218. \def\PYG@tc##1{\textcolor[rgb]{0.25,0.50,0.56}{##1}}%
  219. \def\PYG@bc##1{{\setlength{\fboxsep}{0pt}%
  220. \colorbox[rgb]{1.00,0.94,0.94}{\strut ##1}}}%
  221. }%
  222. %% OPTIONS
  223. %
  224. % Handle options via "kvoptions" (later loaded by hyperref anyhow)
  225. \RequirePackage{kvoptions}
  226. \SetupKeyvalOptions{prefix=spx@opt@} % use \spx@opt@ prefix
  227. % Sphinx legacy text layout: 1in margins on all four sides
  228. \ifx\@jsc@uplatextrue\@undefined
  229. \DeclareStringOption[1in]{hmargin}
  230. \DeclareStringOption[1in]{vmargin}
  231. \DeclareStringOption[.5in]{marginpar}
  232. \else
  233. % Japanese standard document classes handle \mag in a special way
  234. \DeclareStringOption[\inv@mag in]{hmargin}
  235. \DeclareStringOption[\inv@mag in]{vmargin}
  236. \DeclareStringOption[.5\dimexpr\inv@mag in\relax]{marginpar}
  237. \fi
  238. \DeclareStringOption[0]{maxlistdepth}% \newcommand*\spx@opt@maxlistdepth{0}
  239. \DeclareStringOption[-1]{numfigreset}
  240. \DeclareBoolOption[false]{nonumfigreset}
  241. \DeclareBoolOption[false]{mathnumfig}
  242. % \DeclareBoolOption[false]{usespart}% not used
  243. % dimensions, we declare the \dimen registers here.
  244. \newdimen\sphinxverbatimsep
  245. \newdimen\sphinxverbatimborder
  246. \newdimen\sphinxshadowsep
  247. \newdimen\sphinxshadowsize
  248. \newdimen\sphinxshadowrule
  249. % \DeclareStringOption is not convenient for the handling of these dimensions
  250. % because we want to assign the values to the corresponding registers. Even if
  251. % we added the code to the key handler it would be too late for the initial
  252. % set-up and we would need to do initial assignments explicitely. We end up
  253. % using \define@key directly.
  254. % verbatim
  255. \sphinxverbatimsep=\fboxsep
  256. \define@key{sphinx}{verbatimsep}{\sphinxverbatimsep\dimexpr #1\relax}
  257. \sphinxverbatimborder=\fboxrule
  258. \define@key{sphinx}{verbatimborder}{\sphinxverbatimborder\dimexpr #1\relax}
  259. % topic boxes
  260. \sphinxshadowsep =5pt
  261. \define@key{sphinx}{shadowsep}{\sphinxshadowsep\dimexpr #1\relax}
  262. \sphinxshadowsize=4pt
  263. \define@key{sphinx}{shadowsize}{\sphinxshadowsize\dimexpr #1\relax}
  264. \sphinxshadowrule=\fboxrule
  265. \define@key{sphinx}{shadowrule}{\sphinxshadowrule\dimexpr #1\relax}
  266. % verbatim
  267. \DeclareBoolOption[true]{verbatimwithframe}
  268. \DeclareBoolOption[true]{verbatimwrapslines}
  269. \DeclareBoolOption[true]{verbatimhintsturnover}
  270. \DeclareBoolOption[true]{inlineliteralwraps}
  271. \DeclareStringOption[t]{literalblockcappos}
  272. \DeclareStringOption[r]{verbatimcontinuedalign}
  273. \DeclareStringOption[r]{verbatimcontinuesalign}
  274. % parsed literal
  275. \DeclareBoolOption[true]{parsedliteralwraps}
  276. % \textvisiblespace for compatibility with fontspec+XeTeX/LuaTeX
  277. \DeclareStringOption[\textcolor{red}{\textvisiblespace}]{verbatimvisiblespace}
  278. \DeclareStringOption % must use braces to hide the brackets
  279. [{\makebox[2\fontcharwd\font`\x][r]{\textcolor{red}{\tiny$\m@th\hookrightarrow$}}}]%
  280. {verbatimcontinued}
  281. % notices/admonitions
  282. % the dimensions for notices/admonitions are kept as macros and assigned to
  283. % \spx@notice@border at time of use, hence \DeclareStringOption is ok for this
  284. \newdimen\spx@notice@border
  285. \DeclareStringOption[0.5pt]{noteborder}
  286. \DeclareStringOption[0.5pt]{hintborder}
  287. \DeclareStringOption[0.5pt]{importantborder}
  288. \DeclareStringOption[0.5pt]{tipborder}
  289. \DeclareStringOption[1pt]{warningborder}
  290. \DeclareStringOption[1pt]{cautionborder}
  291. \DeclareStringOption[1pt]{attentionborder}
  292. \DeclareStringOption[1pt]{dangerborder}
  293. \DeclareStringOption[1pt]{errorborder}
  294. % footnotes
  295. \DeclareStringOption[\mbox{ }]{AtStartFootnote}
  296. % we need a public macro name for direct use in latex file
  297. \newcommand*{\sphinxAtStartFootnote}{\spx@opt@AtStartFootnote}
  298. % no such need for this one, as it is used inside other macros
  299. \DeclareStringOption[\leavevmode\unskip]{BeforeFootnote}
  300. % some font styling.
  301. \DeclareStringOption[\sffamily\bfseries]{HeaderFamily}
  302. % colours
  303. % same problems as for dimensions: we want the key handler to use \definecolor.
  304. % first, some colours with no prefix, for backwards compatibility
  305. \newcommand*{\sphinxDeclareColorOption}[2]{%
  306. \definecolor{#1}#2%
  307. \define@key{sphinx}{#1}{\definecolor{#1}##1}%
  308. }%
  309. \sphinxDeclareColorOption{TitleColor}{{rgb}{0.126,0.263,0.361}}
  310. \sphinxDeclareColorOption{InnerLinkColor}{{rgb}{0.208,0.374,0.486}}
  311. \sphinxDeclareColorOption{OuterLinkColor}{{rgb}{0.216,0.439,0.388}}
  312. \sphinxDeclareColorOption{VerbatimColor}{{rgb}{1,1,1}}
  313. \sphinxDeclareColorOption{VerbatimBorderColor}{{rgb}{0,0,0}}
  314. % now the colours defined with "sphinx" prefix in their names
  315. \newcommand*{\sphinxDeclareSphinxColorOption}[2]{%
  316. % set the initial default
  317. \definecolor{sphinx#1}#2%
  318. % set the key handler. The "value" ##1 must be acceptable by \definecolor.
  319. \define@key{sphinx}{#1}{\definecolor{sphinx#1}##1}%
  320. }%
  321. % Default color chosen to be as in minted.sty LaTeX package!
  322. \sphinxDeclareSphinxColorOption{VerbatimHighlightColor}{{rgb}{0.878,1,1}}
  323. % admonition boxes, "light" style
  324. \sphinxDeclareSphinxColorOption{noteBorderColor}{{rgb}{0,0,0}}
  325. \sphinxDeclareSphinxColorOption{hintBorderColor}{{rgb}{0,0,0}}
  326. \sphinxDeclareSphinxColorOption{importantBorderColor}{{rgb}{0,0,0}}
  327. \sphinxDeclareSphinxColorOption{tipBorderColor}{{rgb}{0,0,0}}
  328. % admonition boxes, "heavy" style
  329. \sphinxDeclareSphinxColorOption{warningBorderColor}{{rgb}{0,0,0}}
  330. \sphinxDeclareSphinxColorOption{cautionBorderColor}{{rgb}{0,0,0}}
  331. \sphinxDeclareSphinxColorOption{attentionBorderColor}{{rgb}{0,0,0}}
  332. \sphinxDeclareSphinxColorOption{dangerBorderColor}{{rgb}{0,0,0}}
  333. \sphinxDeclareSphinxColorOption{errorBorderColor}{{rgb}{0,0,0}}
  334. \sphinxDeclareSphinxColorOption{warningBgColor}{{rgb}{1,1,1}}
  335. \sphinxDeclareSphinxColorOption{cautionBgColor}{{rgb}{1,1,1}}
  336. \sphinxDeclareSphinxColorOption{attentionBgColor}{{rgb}{1,1,1}}
  337. \sphinxDeclareSphinxColorOption{dangerBgColor}{{rgb}{1,1,1}}
  338. \sphinxDeclareSphinxColorOption{errorBgColor}{{rgb}{1,1,1}}
  339. \DeclareDefaultOption{\@unknownoptionerror}
  340. \ProcessKeyvalOptions*
  341. % don't allow use of maxlistdepth via \sphinxsetup.
  342. \DisableKeyvalOption{sphinx}{maxlistdepth}
  343. \DisableKeyvalOption{sphinx}{numfigreset}
  344. \DisableKeyvalOption{sphinx}{nonumfigreset}
  345. \DisableKeyvalOption{sphinx}{mathnumfig}
  346. % user interface: options can be changed midway in a document!
  347. \newcommand\sphinxsetup[1]{\setkeys{sphinx}{#1}}
  348. %% MAXLISTDEPTH
  349. %
  350. % remove LaTeX's cap on nesting depth if 'maxlistdepth' key used.
  351. % This is a hack, which works with the standard classes: it assumes \@toodeep
  352. % is always used in "true" branches: "\if ... \@toodeep \else .. \fi."
  353. % will force use the "false" branch (if there is one)
  354. \def\spx@toodeep@hack{\fi\iffalse}
  355. % do nothing if 'maxlistdepth' key not used or if package enumitem loaded.
  356. \ifnum\spx@opt@maxlistdepth=\z@\expandafter\@gobbletwo\fi
  357. \AtBeginDocument{%
  358. \@ifpackageloaded{enumitem}{\remove@to@nnil}{}%
  359. \let\spx@toodeepORI\@toodeep
  360. \def\@toodeep{%
  361. \ifnum\@listdepth<\spx@opt@maxlistdepth\relax
  362. \expandafter\spx@toodeep@hack
  363. \else
  364. \expandafter\spx@toodeepORI
  365. \fi}%
  366. % define all missing \@list... macros
  367. \count@\@ne
  368. \loop
  369. \ltx@ifundefined{@list\romannumeral\the\count@}
  370. {\iffalse}{\iftrue\advance\count@\@ne}%
  371. \repeat
  372. \loop
  373. \ifnum\count@>\spx@opt@maxlistdepth\relax\else
  374. \expandafter\let
  375. \csname @list\romannumeral\the\count@\expandafter\endcsname
  376. \csname @list\romannumeral\the\numexpr\count@-\@ne\endcsname
  377. % workaround 2.6--3.2d babel-french issue (fixed in 3.2e; no change needed)
  378. \ltx@ifundefined{leftmargin\romannumeral\the\count@}
  379. {\expandafter\let
  380. \csname leftmargin\romannumeral\the\count@\expandafter\endcsname
  381. \csname leftmargin\romannumeral\the\numexpr\count@-\@ne\endcsname}{}%
  382. \advance\count@\@ne
  383. \repeat
  384. % define all missing enum... counters and \labelenum... macros and \p@enum..
  385. \count@\@ne
  386. \loop
  387. \ltx@ifundefined{c@enum\romannumeral\the\count@}
  388. {\iffalse}{\iftrue\advance\count@\@ne}%
  389. \repeat
  390. \loop
  391. \ifnum\count@>\spx@opt@maxlistdepth\relax\else
  392. \newcounter{enum\romannumeral\the\count@}%
  393. \expandafter\def
  394. \csname labelenum\romannumeral\the\count@\expandafter\endcsname
  395. \expandafter
  396. {\csname theenum\romannumeral\the\numexpr\count@\endcsname.}%
  397. \expandafter\def
  398. \csname p@enum\romannumeral\the\count@\expandafter\endcsname
  399. \expandafter
  400. {\csname p@enum\romannumeral\the\numexpr\count@-\@ne\expandafter
  401. \endcsname\csname theenum\romannumeral\the\numexpr\count@-\@ne\endcsname.}%
  402. \advance\count@\@ne
  403. \repeat
  404. % define all missing labelitem... macros
  405. \count@\@ne
  406. \loop
  407. \ltx@ifundefined{labelitem\romannumeral\the\count@}
  408. {\iffalse}{\iftrue\advance\count@\@ne}%
  409. \repeat
  410. \loop
  411. \ifnum\count@>\spx@opt@maxlistdepth\relax\else
  412. \expandafter\let
  413. \csname labelitem\romannumeral\the\count@\expandafter\endcsname
  414. \csname labelitem\romannumeral\the\numexpr\count@-\@ne\endcsname
  415. \advance\count@\@ne
  416. \repeat
  417. \PackageInfo{sphinx}{maximal list depth extended to \spx@opt@maxlistdepth}%
  418. \@gobble\@nnil
  419. }
  420. %% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS
  421. %
  422. % fix the double index and bibliography on the table of contents
  423. % in jsclasses (Japanese standard document classes)
  424. \ifx\@jsc@uplatextrue\@undefined\else
  425. \renewenvironment{sphinxtheindex}
  426. {\cleardoublepage\phantomsection
  427. \begin{theindex}}
  428. {\end{theindex}}
  429. \renewenvironment{sphinxthebibliography}[1]
  430. {\cleardoublepage% \phantomsection % not needed here since TeXLive 2010's hyperref
  431. \begin{thebibliography}{#1}}
  432. {\end{thebibliography}}
  433. \fi
  434. % disable \@chappos in Appendix in pTeX
  435. \ifx\kanjiskip\@undefined\else
  436. \let\py@OldAppendix=\appendix
  437. \renewcommand{\appendix}{
  438. \py@OldAppendix
  439. \gdef\@chappos{}
  440. }
  441. \fi
  442. % make commands known to non-Sphinx document classes
  443. \providecommand*{\sphinxtableofcontents}{\tableofcontents}
  444. \ltx@ifundefined{sphinxthebibliography}
  445. {\newenvironment
  446. {sphinxthebibliography}{\begin{thebibliography}}{\end{thebibliography}}%
  447. }
  448. {}% else clause of \ltx@ifundefined
  449. \ltx@ifundefined{sphinxtheindex}
  450. {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}%
  451. {}% else clause of \ltx@ifundefined
  452. % for usage with xindy: this string gets internationalized in preamble
  453. \newcommand*{\sphinxnonalphabeticalgroupname}{}
  454. % redefined in preamble, headings for makeindex produced index
  455. \newcommand*{\sphinxsymbolsname}{}
  456. \newcommand*{\sphinxnumbersname}{}
  457. %% COLOR (general)
  458. %
  459. % FIXME: \normalcolor should probably be used in place of \py@NormalColor
  460. % elsewhere, and \py@NormalColor should never be defined. \normalcolor
  461. % switches to the colour from last \color call in preamble.
  462. \def\py@NormalColor{\color{black}}
  463. % FIXME: it is probably better to use \color{TitleColor}, as TitleColor
  464. % can be customized from 'sphinxsetup', and drop usage of \py@TitleColor
  465. \def\py@TitleColor{\color{TitleColor}}
  466. % FIXME: this line should be dropped, as "9" is default anyhow.
  467. \ifdefined\pdfcompresslevel\pdfcompresslevel = 9 \fi
  468. %% PAGE STYLING
  469. %
  470. % Style parameters and macros used by most documents here
  471. \raggedbottom
  472. \sloppy
  473. \hbadness = 5000 % don't print trivial gripes
  474. \pagestyle{empty} % start this way
  475. % Redefine the 'normal' header/footer style when using "fancyhdr" package:
  476. % Note: this presupposes "twoside". If "oneside" class option, there will be warnings.
  477. \ltx@ifundefined{fancyhf}{}{
  478. % Use \pagestyle{normal} as the primary pagestyle for text.
  479. \fancypagestyle{normal}{
  480. \fancyhf{}
  481. % (for \py@HeaderFamily cf "TITLES")
  482. \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
  483. \fancyfoot[LO]{{\py@HeaderFamily\nouppercase{\rightmark}}}
  484. \fancyfoot[RE]{{\py@HeaderFamily\nouppercase{\leftmark}}}
  485. \fancyhead[LE,RO]{{\py@HeaderFamily \@title\sphinxheadercomma\py@release}}
  486. \renewcommand{\headrulewidth}{0.4pt}
  487. \renewcommand{\footrulewidth}{0.4pt}
  488. % define chaptermark with \@chappos when \@chappos is available for Japanese
  489. \ltx@ifundefined{@chappos}{}
  490. {\def\chaptermark##1{\markboth{\@chapapp\space\thechapter\space\@chappos\space ##1}{}}}
  491. }
  492. % Update the plain style so we get the page number & footer line,
  493. % but not a chapter or section title. This is to keep the first
  494. % page of a chapter and the blank page between chapters `clean.'
  495. \fancypagestyle{plain}{
  496. \fancyhf{}
  497. \fancyfoot[LE,RO]{{\py@HeaderFamily\thepage}}
  498. \renewcommand{\headrulewidth}{0pt}
  499. \renewcommand{\footrulewidth}{0.4pt}
  500. }
  501. }
  502. % geometry
  503. \ifx\kanjiskip\@undefined
  504. \PassOptionsToPackage{%
  505. hmargin={\unexpanded{\spx@opt@hmargin}},%
  506. vmargin={\unexpanded{\spx@opt@vmargin}},%
  507. marginpar=\unexpanded{\spx@opt@marginpar}}
  508. {geometry}
  509. \else
  510. % set text width for Japanese documents to be integer multiple of 1zw
  511. % and text height to be integer multiple of \baselineskip
  512. % the execution is delayed to \sphinxsetup then geometry.sty
  513. \normalsize\normalfont
  514. \newcommand*\sphinxtextwidthja[1]{%
  515. \if@twocolumn\tw@\fi
  516. \dimexpr
  517. \numexpr\dimexpr\paperwidth-\tw@\dimexpr#1\relax\relax/
  518. \dimexpr\if@twocolumn\tw@\else\@ne\fi zw\relax
  519. zw\relax}%
  520. \newcommand*\sphinxmarginparwidthja[1]{%
  521. \dimexpr\numexpr\dimexpr#1\relax/\dimexpr1zw\relax zw\relax}%
  522. \newcommand*\sphinxtextlinesja[1]{%
  523. \numexpr\@ne+\dimexpr\paperheight-\topskip-\tw@\dimexpr#1\relax\relax/
  524. \baselineskip\relax}%
  525. \ifx\@jsc@uplatextrue\@undefined\else
  526. % the way we found in order for the papersize special written by
  527. % geometry in the dvi file to be correct in case of jsbook class
  528. \ifnum\mag=\@m\else % do nothing special if nomag class option or 10pt
  529. \PassOptionsToPackage{truedimen}{geometry}%
  530. \fi
  531. \fi
  532. \PassOptionsToPackage{%
  533. hmarginratio={1:1},%
  534. textwidth=\unexpanded{\sphinxtextwidthja{\spx@opt@hmargin}},%
  535. vmarginratio={1:1},%
  536. lines=\unexpanded{\sphinxtextlinesja{\spx@opt@vmargin}},%
  537. marginpar=\unexpanded{\sphinxmarginparwidthja{\spx@opt@marginpar}},%
  538. footskip=2\baselineskip,%
  539. }{geometry}%
  540. \AtBeginDocument
  541. {% update a dimension used by the jsclasses
  542. \ifx\@jsc@uplatextrue\@undefined\else\fullwidth\textwidth\fi
  543. % for some reason, jreport normalizes all dimensions with \@settopoint
  544. \@ifclassloaded{jreport}
  545. {\@settopoint\textwidth\@settopoint\textheight\@settopoint\marginparwidth}
  546. {}% <-- "false" clause of \@ifclassloaded
  547. }%
  548. \fi
  549. % fix fncychap's bug which uses prematurely the \textwidth value
  550. \@ifpackagewith{fncychap}{Bjornstrup}
  551. {\AtBeginDocument{\mylen\textwidth\advance\mylen-2\myhi}}%
  552. {}% <-- "false" clause of \@ifpackagewith
  553. %% TITLES
  554. %
  555. % Since Sphinx 1.5, users should use HeaderFamily key to 'sphinxsetup' rather
  556. % than defining their own \py@HeaderFamily command (which is still possible).
  557. % Memo: \py@HeaderFamily is also used by \maketitle as defined in
  558. % sphinxmanual.cls/sphinxhowto.cls
  559. \newcommand{\py@HeaderFamily}{\spx@opt@HeaderFamily}
  560. % This sets up the fancy chapter headings that make the documents look
  561. % at least a little better than the usual LaTeX output.
  562. \@ifpackagewith{fncychap}{Bjarne}{
  563. \ChNameVar {\raggedleft\normalsize \py@HeaderFamily}
  564. \ChNumVar {\raggedleft\Large \py@HeaderFamily}
  565. \ChTitleVar{\raggedleft\Large \py@HeaderFamily}
  566. % This creates (numbered) chapter heads without the leading \vspace*{}:
  567. \def\@makechapterhead#1{%
  568. {\parindent \z@ \raggedright \normalfont
  569. \ifnum \c@secnumdepth >\m@ne
  570. \if@mainmatter
  571. \DOCH
  572. \fi
  573. \fi
  574. \interlinepenalty\@M
  575. \if@mainmatter
  576. \DOTI{#1}%
  577. \else%
  578. \DOTIS{#1}%
  579. \fi
  580. }}
  581. }{}% <-- "false" clause of \@ifpackagewith
  582. % Augment the sectioning commands used to get our own font family in place,
  583. % and reset some internal data items (\titleformat from titlesec package)
  584. \titleformat{\section}{\Large\py@HeaderFamily}%
  585. {\py@TitleColor\thesection}{0.5em}{\py@TitleColor}{\py@NormalColor}
  586. \titleformat{\subsection}{\large\py@HeaderFamily}%
  587. {\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
  588. \titleformat{\subsubsection}{\py@HeaderFamily}%
  589. {\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}{\py@NormalColor}
  590. % By default paragraphs (and subsubsections) will not be numbered because
  591. % sphinxmanual.cls and sphinxhowto.cls set secnumdepth to 2
  592. \titleformat{\paragraph}{\py@HeaderFamily}%
  593. {\py@TitleColor\theparagraph}{0.5em}{\py@TitleColor}{\py@NormalColor}
  594. \titleformat{\subparagraph}{\py@HeaderFamily}%
  595. {\py@TitleColor\thesubparagraph}{0.5em}{\py@TitleColor}{\py@NormalColor}
  596. %% GRAPHICS
  597. %
  598. % \sphinxincludegraphics defined to resize images larger than the line width,
  599. % except if height or width option present.
  600. %
  601. % If scale is present, rescale before fitting to line width. (since 1.5)
  602. \newbox\spx@image@box
  603. \newcommand*{\sphinxincludegraphics}[2][]{%
  604. \in@{height}{#1}\ifin@\else\in@{width}{#1}\fi
  605. \ifin@ % height or width present
  606. \includegraphics[#1]{#2}%
  607. \else % no height nor width (but #1 may be "scale=...")
  608. \setbox\spx@image@box\hbox{\includegraphics[#1,draft]{#2}}%
  609. \ifdim \wd\spx@image@box>\linewidth
  610. \setbox\spx@image@box\box\voidb@x % clear memory
  611. \includegraphics[#1,width=\linewidth]{#2}%
  612. \else
  613. \includegraphics[#1]{#2}%
  614. \fi
  615. \fi
  616. }
  617. %% FIGURE IN TABLE
  618. %
  619. \newenvironment{sphinxfigure-in-table}[1][\linewidth]{%
  620. \def\@captype{figure}%
  621. \sphinxsetvskipsforfigintablecaption
  622. \begin{minipage}{#1}%
  623. }{\end{minipage}}
  624. % store original \caption macro for use with figures in longtable and tabulary
  625. \AtBeginDocument{\let\spx@originalcaption\caption}
  626. \newcommand*\sphinxfigcaption
  627. {\ifx\equation$%$% this is trick to identify tabulary first pass
  628. \firstchoice@false\else\firstchoice@true\fi
  629. \spx@originalcaption }
  630. \newcommand*\sphinxsetvskipsforfigintablecaption
  631. {\abovecaptionskip\smallskipamount
  632. \belowcaptionskip\smallskipamount}
  633. %% CITATIONS
  634. %
  635. \protected\def\sphinxcite{\cite}
  636. %% FOOTNOTES
  637. %
  638. % Support large numbered footnotes in minipage
  639. % But now obsolete due to systematic use of \savenotes/\spewnotes
  640. % when minipages are in use in the various macro definitions next.
  641. \def\thempfootnote{\arabic{mpfootnote}}
  642. %% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS
  643. \ltx@ifundefined{c@chapter}
  644. {\newcounter{literalblock}}%
  645. {\newcounter{literalblock}[chapter]%
  646. \def\theliteralblock{\ifnum\c@chapter>\z@\arabic{chapter}.\fi
  647. \arabic{literalblock}}%
  648. }%
  649. \ifspx@opt@nonumfigreset
  650. \ltx@ifundefined{c@chapter}{}{%
  651. \@removefromreset{figure}{chapter}%
  652. \@removefromreset{table}{chapter}%
  653. \@removefromreset{literalblock}{chapter}%
  654. \ifspx@opt@mathnumfig
  655. \@removefromreset{equation}{chapter}%
  656. \fi
  657. }%
  658. \def\thefigure{\arabic{figure}}%
  659. \def\thetable {\arabic{table}}%
  660. \def\theliteralblock{\arabic{literalblock}}%
  661. \ifspx@opt@mathnumfig
  662. \def\theequation{\arabic{equation}}%
  663. \fi
  664. \else
  665. \let\spx@preAthefigure\@empty
  666. \let\spx@preBthefigure\@empty
  667. % \ifspx@opt@usespart % <-- LaTeX writer could pass such a 'usespart' boolean
  668. % % as sphinx.sty package option
  669. % If document uses \part, (triggered in Sphinx by latex_toplevel_sectioning)
  670. % LaTeX core per default does not reset chapter or section
  671. % counters at each part.
  672. % But if we modify this, we need to redefine \thechapter, \thesection to
  673. % include the part number and this will cause problems in table of contents
  674. % because of too wide numbering. Simplest is to do nothing.
  675. % \fi
  676. \ifnum\spx@opt@numfigreset>0
  677. \ltx@ifundefined{c@chapter}
  678. {}
  679. {\g@addto@macro\spx@preAthefigure{\ifnum\c@chapter>\z@\arabic{chapter}.}%
  680. \g@addto@macro\spx@preBthefigure{\fi}}%
  681. \fi
  682. \ifnum\spx@opt@numfigreset>1
  683. \@addtoreset{figure}{section}%
  684. \@addtoreset{table}{section}%
  685. \@addtoreset{literalblock}{section}%
  686. \ifspx@opt@mathnumfig
  687. \@addtoreset{equation}{section}%
  688. \fi
  689. \g@addto@macro\spx@preAthefigure{\ifnum\c@section>\z@\arabic{section}.}%
  690. \g@addto@macro\spx@preBthefigure{\fi}%
  691. \fi
  692. \ifnum\spx@opt@numfigreset>2
  693. \@addtoreset{figure}{subsection}%
  694. \@addtoreset{table}{subsection}%
  695. \@addtoreset{literalblock}{subsection}%
  696. \ifspx@opt@mathnumfig
  697. \@addtoreset{equation}{subsection}%
  698. \fi
  699. \g@addto@macro\spx@preAthefigure{\ifnum\c@subsection>\z@\arabic{subsection}.}%
  700. \g@addto@macro\spx@preBthefigure{\fi}%
  701. \fi
  702. \ifnum\spx@opt@numfigreset>3
  703. \@addtoreset{figure}{subsubsection}%
  704. \@addtoreset{table}{subsubsection}%
  705. \@addtoreset{literalblock}{subsubsection}%
  706. \ifspx@opt@mathnumfig
  707. \@addtoreset{equation}{subsubsection}%
  708. \fi
  709. \g@addto@macro\spx@preAthefigure{\ifnum\c@subsubsection>\z@\arabic{subsubsection}.}%
  710. \g@addto@macro\spx@preBthefigure{\fi}%
  711. \fi
  712. \ifnum\spx@opt@numfigreset>4
  713. \@addtoreset{figure}{paragraph}%
  714. \@addtoreset{table}{paragraph}%
  715. \@addtoreset{literalblock}{paragraph}%
  716. \ifspx@opt@mathnumfig
  717. \@addtoreset{equation}{paragraph}%
  718. \fi
  719. \g@addto@macro\spx@preAthefigure{\ifnum\c@subparagraph>\z@\arabic{subparagraph}.}%
  720. \g@addto@macro\spx@preBthefigure{\fi}%
  721. \fi
  722. \ifnum\spx@opt@numfigreset>5
  723. \@addtoreset{figure}{subparagraph}%
  724. \@addtoreset{table}{subparagraph}%
  725. \@addtoreset{literalblock}{subparagraph}%
  726. \ifspx@opt@mathnumfig
  727. \@addtoreset{equation}{subparagraph}%
  728. \fi
  729. \g@addto@macro\spx@preAthefigure{\ifnum\c@subsubparagraph>\z@\arabic{subsubparagraph}.}%
  730. \g@addto@macro\spx@preBthefigure{\fi}%
  731. \fi
  732. \expandafter\g@addto@macro
  733. \expandafter\spx@preAthefigure\expandafter{\spx@preBthefigure}%
  734. \let\thefigure\spx@preAthefigure
  735. \let\thetable\spx@preAthefigure
  736. \let\theliteralblock\spx@preAthefigure
  737. \g@addto@macro\thefigure{\arabic{figure}}%
  738. \g@addto@macro\thetable{\arabic{table}}%
  739. \g@addto@macro\theliteralblock{\arabic{literalblock}}%
  740. \ifspx@opt@mathnumfig
  741. \let\theequation\spx@preAthefigure
  742. \g@addto@macro\theequation{\arabic{equation}}%
  743. \fi
  744. \fi
  745. %% LITERAL BLOCKS
  746. %
  747. % Based on use of "fancyvrb.sty"'s Verbatim.
  748. % - with framing allowing page breaks ("framed.sty")
  749. % - with breaking of long lines (exploits Pygments mark-up),
  750. % - with possibly of a top caption, non-separable by pagebreak.
  751. % - and usable inside tables or footnotes ("footnotehyper-sphinx").
  752. % For extensions which use \OriginalVerbatim and compatibility with Sphinx <
  753. % 1.5, we define and use these when (unmodified) Verbatim will be needed. But
  754. % Sphinx >= 1.5 does not modify the \Verbatim macro anymore.
  755. \let\OriginalVerbatim \Verbatim
  756. \let\endOriginalVerbatim\endVerbatim
  757. % for captions of literal blocks
  758. % at start of caption title
  759. \newcommand*{\fnum@literalblock}{\literalblockname\nobreakspace\theliteralblock}
  760. % this will be overwritten in document preamble by Babel translation
  761. \newcommand*{\literalblockname}{Listing }
  762. % file extension needed for \caption's good functioning, the file is created
  763. % only if a \listof{literalblock}{foo} command is encountered, which is
  764. % analogous to \listoffigures, but for the code listings (foo = chosen title.)
  765. \newcommand*{\ext@literalblock}{lol}
  766. \newif\ifspx@inframed % flag set if we are already in a framed environment
  767. % if forced use of minipage encapsulation is needed (e.g. table cells)
  768. \newif\ifsphinxverbatimwithminipage \sphinxverbatimwithminipagefalse
  769. % Framing macro for use with framed.sty's \FrameCommand
  770. % - it obeys current indentation,
  771. % - frame is \fboxsep separated from the contents,
  772. % - the contents use the full available text width,
  773. % - #1 = color of frame, #2 = color of background,
  774. % - #3 = above frame, #4 = below frame, #5 = within frame,
  775. % - #3 and #4 must be already typeset boxes; they must issue \normalcolor
  776. % or similar, else, they are under scope of color #1
  777. \long\def\spx@fcolorbox #1#2#3#4#5{%
  778. \hskip\@totalleftmargin
  779. \hskip-\fboxsep\hskip-\fboxrule
  780. % use of \color@b@x here is compatible with both xcolor.sty and color.sty
  781. \color@b@x {\color{#1}\spx@CustomFBox{#3}{#4}}{\color{#2}}{#5}%
  782. \hskip-\fboxsep\hskip-\fboxrule
  783. \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth
  784. }%
  785. % #1 = for material above frame, such as a caption or a "continued" hint
  786. % #2 = for material below frame, such as a caption or "continues on next page"
  787. % #3 = actual contents, which will be typeset with a background color
  788. \long\def\spx@CustomFBox#1#2#3{%
  789. \begingroup
  790. \setbox\@tempboxa\hbox{{#3}}% inner braces to avoid color leaks
  791. \vbox{#1% above frame
  792. % draw frame border _latest_ to avoid pdf viewer issue
  793. \kern\fboxrule
  794. \hbox{\kern\fboxrule
  795. \copy\@tempboxa
  796. \kern-\wd\@tempboxa\kern-\fboxrule
  797. \vrule\@width\fboxrule
  798. \kern\wd\@tempboxa
  799. \vrule\@width\fboxrule}%
  800. \kern-\dimexpr\ht\@tempboxa+\dp\@tempboxa+\fboxrule\relax
  801. \hrule\@height\fboxrule
  802. \kern\dimexpr\ht\@tempboxa+\dp\@tempboxa\relax
  803. \hrule\@height\fboxrule
  804. #2% below frame
  805. }%
  806. \endgroup
  807. }%
  808. \def\spx@fcolorbox@put@c#1{% hide width from framed.sty measuring
  809. \moveright\dimexpr\fboxrule+.5\wd\@tempboxa\hb@xt@\z@{\hss#1\hss}%
  810. }%
  811. \def\spx@fcolorbox@put@r#1{% right align with contents, width hidden
  812. \moveright\dimexpr\fboxrule+\wd\@tempboxa-\fboxsep\hb@xt@\z@{\hss#1}%
  813. }%
  814. \def\spx@fcolorbox@put@l#1{% left align with contents, width hidden
  815. \moveright\dimexpr\fboxrule+\fboxsep\hb@xt@\z@{#1\hss}%
  816. }%
  817. %
  818. \def\sphinxVerbatim@Continued
  819. {\csname spx@fcolorbox@put@\spx@opt@verbatimcontinuedalign\endcsname
  820. {\normalcolor\sphinxstylecodecontinued\literalblockcontinuedname}}%
  821. \def\sphinxVerbatim@Continues
  822. {\csname spx@fcolorbox@put@\spx@opt@verbatimcontinuesalign\endcsname
  823. {\normalcolor\sphinxstylecodecontinues\literalblockcontinuesname}}%
  824. \def\sphinxVerbatim@Title
  825. {\spx@fcolorbox@put@c{\unhcopy\sphinxVerbatim@TitleBox}}%
  826. \let\sphinxVerbatim@Before\@empty
  827. \let\sphinxVerbatim@After\@empty
  828. % Defaults are redefined in document preamble according to language
  829. \newcommand*\literalblockcontinuedname{continued from previous page}%
  830. \newcommand*\literalblockcontinuesname{continues on next page}%
  831. %
  832. \def\spx@verbatimfcolorbox{\spx@fcolorbox{VerbatimBorderColor}{VerbatimColor}}%
  833. \def\sphinxVerbatim@FrameCommand
  834. {\spx@verbatimfcolorbox\sphinxVerbatim@Before\sphinxVerbatim@After}%
  835. \def\sphinxVerbatim@FirstFrameCommand
  836. {\spx@verbatimfcolorbox\sphinxVerbatim@Before\sphinxVerbatim@Continues}%
  837. \def\sphinxVerbatim@MidFrameCommand
  838. {\spx@verbatimfcolorbox\sphinxVerbatim@Continued\sphinxVerbatim@Continues}%
  839. \def\sphinxVerbatim@LastFrameCommand
  840. {\spx@verbatimfcolorbox\sphinxVerbatim@Continued\sphinxVerbatim@After}%
  841. % For linebreaks inside Verbatim environment from package fancyvrb.
  842. \newbox\sphinxcontinuationbox
  843. \newbox\sphinxvisiblespacebox
  844. \newcommand*\sphinxafterbreak {\copy\sphinxcontinuationbox}
  845. % Take advantage of the already applied Pygments mark-up to insert
  846. % potential linebreaks for TeX processing.
  847. % {, <, #, %, $, ' and ": go to next line.
  848. % _, }, ^, &, >, - and ~: stay at end of broken line.
  849. % Use of \textquotesingle for straight quote.
  850. % FIXME: convert this to package options ?
  851. \newcommand*\sphinxbreaksbeforelist {%
  852. \do\PYGZob\{\do\PYGZlt\<\do\PYGZsh\#\do\PYGZpc\%% {, <, #, %,
  853. \do\PYGZdl\$\do\PYGZdq\"% $, "
  854. \def\PYGZsq
  855. {\discretionary{}{\sphinxafterbreak\textquotesingle}{\textquotesingle}}% '
  856. }
  857. \newcommand*\sphinxbreaksafterlist {%
  858. \do\PYGZus\_\do\PYGZcb\}\do\PYGZca\^\do\PYGZam\&% _, }, ^, &,
  859. \do\PYGZgt\>\do\PYGZhy\-\do\PYGZti\~% >, -, ~
  860. }
  861. \newcommand*\sphinxbreaksatspecials {%
  862. \def\do##1##2%
  863. {\def##1{\discretionary{}{\sphinxafterbreak\char`##2}{\char`##2}}}%
  864. \sphinxbreaksbeforelist
  865. \def\do##1##2%
  866. {\def##1{\discretionary{\char`##2}{\sphinxafterbreak}{\char`##2}}}%
  867. \sphinxbreaksafterlist
  868. }
  869. \def\sphinx@verbatim@nolig@list {\do \`}%
  870. % Some characters . , ; ? ! / are not pygmentized.
  871. % This macro makes them "active" and they will insert potential linebreaks.
  872. % Not compatible with math mode (cf \sphinxunactivateextras).
  873. \newcommand*\sphinxbreaksbeforeactivelist {}% none
  874. \newcommand*\sphinxbreaksafteractivelist {\do\.\do\,\do\;\do\?\do\!\do\/}
  875. \newcommand*\sphinxbreaksviaactive {%
  876. \def\do##1{\lccode`\~`##1%
  877. \lowercase{\def~}{\discretionary{}{\sphinxafterbreak\char`##1}{\char`##1}}%
  878. \catcode`##1\active}%
  879. \sphinxbreaksbeforeactivelist
  880. \def\do##1{\lccode`\~`##1%
  881. \lowercase{\def~}{\discretionary{\char`##1}{\sphinxafterbreak}{\char`##1}}%
  882. \catcode`##1\active}%
  883. \sphinxbreaksafteractivelist
  884. \lccode`\~`\~
  885. }
  886. % If the linebreak is at a space, the latter will be displayed as visible
  887. % space at end of first line, and a continuation symbol starts next line.
  888. \def\spx@verbatim@space {%
  889. \nobreak\hskip\z@skip
  890. \discretionary{\copy\sphinxvisiblespacebox}{\sphinxafterbreak}
  891. {\kern\fontdimen2\font}%
  892. }%
  893. % if the available space on page is less than \literalblockneedspace, insert pagebreak
  894. \newcommand{\sphinxliteralblockneedspace}{5\baselineskip}
  895. \newcommand{\sphinxliteralblockwithoutcaptionneedspace}{1.5\baselineskip}
  896. % The title (caption) is specified from outside as macro \sphinxVerbatimTitle.
  897. % \sphinxVerbatimTitle is reset to empty after each use of Verbatim.
  898. \newcommand*\sphinxVerbatimTitle {}
  899. % This box to typeset the caption before framed.sty multiple passes for framing.
  900. \newbox\sphinxVerbatim@TitleBox
  901. % This is a workaround to a "feature" of French lists, when literal block
  902. % follows immediately; usable generally (does only \par then), a priori...
  903. \newcommand*\sphinxvspacefixafterfrenchlists{%
  904. \ifvmode\ifdim\lastskip<\z@ \vskip\parskip\fi\else\par\fi
  905. }
  906. % Holder macro for labels of literal blocks. Set-up by LaTeX writer.
  907. \newcommand*\sphinxLiteralBlockLabel {}
  908. \newcommand*\sphinxSetupCaptionForVerbatim [1]
  909. {%
  910. \sphinxvspacefixafterfrenchlists
  911. \needspace{\sphinxliteralblockneedspace}%
  912. % insert a \label via \sphinxLiteralBlockLabel
  913. % reset to normal the color for the literal block caption
  914. \def\sphinxVerbatimTitle
  915. {\py@NormalColor\sphinxcaption{\sphinxLiteralBlockLabel #1}}%
  916. }
  917. \newcommand*\sphinxSetupCodeBlockInFootnote {%
  918. \fvset{fontsize=\footnotesize}\let\caption\sphinxfigcaption
  919. \sphinxverbatimwithminipagetrue % reduces vertical spaces
  920. % we counteract (this is in a group) the \@normalsize from \caption
  921. \let\normalsize\footnotesize\let\@parboxrestore\relax
  922. \def\spx@abovecaptionskip{\sphinxverbatimsmallskipamount}%
  923. }
  924. % needed to create wrapper environments of fancyvrb's Verbatim
  925. \newcommand*{\sphinxVerbatimEnvironment}{\gdef\FV@EnvironName{sphinxVerbatim}}
  926. \newcommand*{\sphinxverbatimsmallskipamount}{\smallskipamount}
  927. % serves to implement line highlighting and line wrapping
  928. \newcommand\sphinxFancyVerbFormatLine[1]{%
  929. \expandafter\sphinx@verbatim@checkifhl\expandafter{\the\FV@CodeLineNo}%
  930. \ifin@
  931. \sphinxVerbatimHighlightLine{#1}%
  932. \else
  933. \sphinxVerbatimFormatLine{#1}%
  934. \fi
  935. }%
  936. \newcommand\sphinxVerbatimHighlightLine[1]{%
  937. \edef\sphinxrestorefboxsep{\fboxsep\the\fboxsep\relax}%
  938. \fboxsep0pt\relax % cf LaTeX bug graphics/4524
  939. \colorbox{sphinxVerbatimHighlightColor}%
  940. {\sphinxrestorefboxsep\sphinxVerbatimFormatLine{#1}}%
  941. % no need to restore \fboxsep here, as this ends up in a \hbox from fancyvrb
  942. }%
  943. % \sphinxVerbatimFormatLine will be set locally to one of those two:
  944. \newcommand\sphinxVerbatimFormatLineWrap[1]{%
  945. \hsize\linewidth
  946. \vtop{\raggedright\hyphenpenalty\z@\exhyphenpenalty\z@
  947. \doublehyphendemerits\z@\finalhyphendemerits\z@
  948. \strut #1\strut}%
  949. }%
  950. \newcommand\sphinxVerbatimFormatLineNoWrap[1]{\hb@xt@\linewidth{\strut #1\hss}}%
  951. \g@addto@macro\FV@SetupFont{%
  952. \sbox\sphinxcontinuationbox {\spx@opt@verbatimcontinued}%
  953. \sbox\sphinxvisiblespacebox {\spx@opt@verbatimvisiblespace}%
  954. }%
  955. \newenvironment{sphinxVerbatim}{%
  956. % first, let's check if there is a caption
  957. \ifx\sphinxVerbatimTitle\empty
  958. \sphinxvspacefixafterfrenchlists
  959. \parskip\z@skip
  960. \vskip\sphinxverbatimsmallskipamount
  961. % there was no caption. Check if nevertheless a label was set.
  962. \ifx\sphinxLiteralBlockLabel\empty\else
  963. % we require some space to be sure hyperlink target from \phantomsection
  964. % will not be separated from upcoming verbatim by a page break
  965. \needspace{\sphinxliteralblockwithoutcaptionneedspace}%
  966. \phantomsection\sphinxLiteralBlockLabel
  967. \fi
  968. \else
  969. \parskip\z@skip
  970. \if t\spx@opt@literalblockcappos
  971. \vskip\spx@abovecaptionskip
  972. \def\sphinxVerbatim@Before
  973. {\sphinxVerbatim@Title\nointerlineskip
  974. \kern\dimexpr-\dp\strutbox+\sphinxbelowcaptionspace\relax}%
  975. \else
  976. \vskip\sphinxverbatimsmallskipamount
  977. \def\sphinxVerbatim@After
  978. {\nointerlineskip\kern\dp\strutbox\sphinxVerbatim@Title}%
  979. \fi
  980. \def\@captype{literalblock}%
  981. \capstart
  982. % \sphinxVerbatimTitle must reset color
  983. \setbox\sphinxVerbatim@TitleBox
  984. \hbox{\begin{minipage}{\linewidth}%
  985. \sphinxVerbatimTitle
  986. \end{minipage}}%
  987. \fi
  988. \global\let\sphinxLiteralBlockLabel\empty
  989. \global\let\sphinxVerbatimTitle\empty
  990. \fboxsep\sphinxverbatimsep \fboxrule\sphinxverbatimborder
  991. \ifspx@opt@verbatimwithframe\else\fboxrule\z@\fi
  992. \let\FrameCommand \sphinxVerbatim@FrameCommand
  993. \let\FirstFrameCommand\sphinxVerbatim@FirstFrameCommand
  994. \let\MidFrameCommand \sphinxVerbatim@MidFrameCommand
  995. \let\LastFrameCommand \sphinxVerbatim@LastFrameCommand
  996. \ifspx@opt@verbatimhintsturnover\else
  997. \let\sphinxVerbatim@Continued\@empty
  998. \let\sphinxVerbatim@Continues\@empty
  999. \fi
  1000. \ifspx@opt@verbatimwrapslines
  1001. % fancyvrb's Verbatim puts each input line in (unbreakable) horizontal boxes.
  1002. % This customization wraps each line from the input in a \vtop, thus
  1003. % allowing it to wrap and display on two or more lines in the latex output.
  1004. % - The codeline counter will be increased only once.
  1005. % - The wrapped material will not break across pages, it is impossible
  1006. % to achieve this without extensive rewrite of fancyvrb.
  1007. % - The (not used in sphinx) obeytabs option to Verbatim is
  1008. % broken by this change (showtabs and tabspace work).
  1009. \let\sphinxVerbatimFormatLine\sphinxVerbatimFormatLineWrap
  1010. \let\FV@Space\spx@verbatim@space
  1011. % Allow breaks at special characters using \PYG... macros.
  1012. \sphinxbreaksatspecials
  1013. % Breaks at punctuation characters . , ; ? ! and / (needs catcode activation)
  1014. \fvset{codes*=\sphinxbreaksviaactive}%
  1015. \else % end of conditional code for wrapping long code lines
  1016. \let\sphinxVerbatimFormatLine\sphinxVerbatimFormatLineNoWrap
  1017. \fi
  1018. \let\FancyVerbFormatLine\sphinxFancyVerbFormatLine
  1019. % workaround to fancyvrb's check of \@currenvir
  1020. \let\VerbatimEnvironment\sphinxVerbatimEnvironment
  1021. % workaround to fancyvrb's check of current list depth
  1022. \def\@toodeep {\advance\@listdepth\@ne}%
  1023. % The list environment is needed to control perfectly the vertical space.
  1024. % Note: \OuterFrameSep used by framed.sty is later set to \topsep hence 0pt.
  1025. % - if caption: distance from last text baseline to caption baseline is
  1026. % A+(B-F)+\ht\strutbox, A = \abovecaptionskip (default 10pt), B =
  1027. % \baselineskip, F is the framed.sty \FrameHeightAdjust macro, default 6pt.
  1028. % Formula valid for F < 10pt.
  1029. % - distance of baseline of caption to top of frame is like for tables:
  1030. % \sphinxbelowcaptionspace (=0.5\baselineskip)
  1031. % - if no caption: distance of last text baseline to code frame is S+(B-F),
  1032. % with S = \sphinxverbatimtopskip (=\smallskip)
  1033. % - and distance from bottom of frame to next text baseline is
  1034. % \baselineskip+\parskip.
  1035. % The \trivlist is used to avoid possible "too deeply nested" error.
  1036. \itemsep \z@skip
  1037. \topsep \z@skip
  1038. \partopsep \z@skip
  1039. % trivlist will set \parsep to \parskip = zero
  1040. % \leftmargin will be set to zero by trivlist
  1041. \rightmargin\z@
  1042. \parindent \z@% becomes \itemindent. Default zero, but perhaps overwritten.
  1043. \trivlist\item\relax
  1044. \ifsphinxverbatimwithminipage\spx@inframedtrue\fi
  1045. % use a minipage if we are already inside a framed environment
  1046. \ifspx@inframed\noindent\begin{minipage}{\linewidth}\fi
  1047. \MakeFramed {% adapted over from framed.sty's snugshade environment
  1048. \advance\hsize-\width\@totalleftmargin\z@\linewidth\hsize\@setminipage
  1049. }%
  1050. % For grid placement from \strut's in \FancyVerbFormatLine
  1051. \lineskip\z@skip
  1052. % active comma should not be overwritten by \@noligs
  1053. \ifspx@opt@verbatimwrapslines
  1054. \let\verbatim@nolig@list \sphinx@verbatim@nolig@list
  1055. \fi
  1056. % will fetch its optional arguments if any
  1057. \OriginalVerbatim
  1058. }
  1059. {%
  1060. \endOriginalVerbatim
  1061. \par\unskip\@minipagefalse\endMakeFramed % from framed.sty snugshade
  1062. \ifspx@inframed\end{minipage}\fi
  1063. \endtrivlist
  1064. }
  1065. \newenvironment {sphinxVerbatimNoFrame}
  1066. {\spx@opt@verbatimwithframefalse
  1067. % needed for fancyvrb as literal code will end in \end{sphinxVerbatimNoFrame}
  1068. \def\sphinxVerbatimEnvironment{\gdef\FV@EnvironName{sphinxVerbatimNoFrame}}%
  1069. \begin{sphinxVerbatim}}
  1070. {\end{sphinxVerbatim}}
  1071. \newenvironment {sphinxVerbatimintable}
  1072. {% don't use a frame if in a table cell
  1073. \spx@opt@verbatimwithframefalse
  1074. \sphinxverbatimwithminipagetrue
  1075. % the literal block caption uses \sphinxcaption which is wrapper of \caption,
  1076. % but \caption must be modified because longtable redefines it to work only
  1077. % for the own table caption, and tabulary has multiple passes
  1078. \let\caption\sphinxfigcaption
  1079. % reduce above caption skip
  1080. \def\spx@abovecaptionskip{\sphinxverbatimsmallskipamount}%
  1081. \def\sphinxVerbatimEnvironment{\gdef\FV@EnvironName{sphinxVerbatimintable}}%
  1082. \begin{sphinxVerbatim}}
  1083. {\end{sphinxVerbatim}}
  1084. %% PARSED LITERALS
  1085. % allow long lines to wrap like they do in code-blocks
  1086. % this should be kept in sync with definitions in sphinx.util.texescape
  1087. \newcommand*\sphinxbreaksattexescapedchars{%
  1088. \def\do##1##2% put potential break point before character
  1089. {\def##1{\discretionary{}{\sphinxafterbreak\char`##2}{\char`##2}}}%
  1090. \do\{\{\do\textless\<\do\#\#\do\%\%\do\$\$% {, <, #, %, $
  1091. \def\do##1##2% put potential break point after character
  1092. {\def##1{\discretionary{\char`##2}{\sphinxafterbreak}{\char`##2}}}%
  1093. \do\_\_\do\}\}\do\textasciicircum\^\do\&\&% _, }, ^, &,
  1094. \do\textgreater\>\do\textasciitilde\~% >, ~
  1095. }
  1096. \newcommand*\sphinxbreaksviaactiveinparsedliteral{%
  1097. \sphinxbreaksviaactive % by default handles . , ; ? ! /
  1098. \do\-% we need also the hyphen character (ends up "as is" in parsed-literal)
  1099. \lccode`\~`\~ %
  1100. % update \dospecials as it is used by \url
  1101. % but deactivation will already have been done hence this is unneeded:
  1102. % \expandafter\def\expandafter\dospecials\expandafter{\dospecials
  1103. % \sphinxbreaksbeforeactivelist\sphinxbreaksafteractivelist\do\-}%
  1104. }
  1105. \newcommand*\sphinxbreaksatspaceinparsedliteral{%
  1106. \lccode`~32 \lowercase{\let~}\spx@verbatim@space\lccode`\~`\~
  1107. }
  1108. \newcommand*{\sphinxunactivateextras}{\let\do\@makeother
  1109. \sphinxbreaksbeforeactivelist\sphinxbreaksafteractivelist\do\-}%
  1110. % the \catcode13=5\relax (deactivate end of input lines) is left to callers
  1111. \newcommand*{\sphinxunactivateextrasandspace}{\catcode32=10\relax
  1112. \sphinxunactivateextras}%
  1113. % now for the modified alltt environment
  1114. \newenvironment{sphinxalltt}
  1115. {% at start of next line to workaround Emacs/AUCTeX issue with this file
  1116. \begin{alltt}%
  1117. \ifspx@opt@parsedliteralwraps
  1118. \sbox\sphinxcontinuationbox {\spx@opt@verbatimcontinued}%
  1119. \sbox\sphinxvisiblespacebox {\spx@opt@verbatimvisiblespace}%
  1120. \sphinxbreaksattexescapedchars
  1121. \sphinxbreaksviaactiveinparsedliteral
  1122. \sphinxbreaksatspaceinparsedliteral
  1123. % alltt takes care of the ' as derivative ("prime") in math mode
  1124. \everymath\expandafter{\the\everymath\sphinxunactivateextrasandspace
  1125. \catcode`\<=12\catcode`\>=12\catcode`\^=7\catcode`\_=8 }%
  1126. % not sure if displayed math (align,...) can end up in parsed-literal, anyway
  1127. \everydisplay\expandafter{\the\everydisplay
  1128. \catcode13=5 \sphinxunactivateextrasandspace
  1129. \catcode`\<=12\catcode`\>=12\catcode`\^=7\catcode`\_=8 }%
  1130. \fi }
  1131. {\end{alltt}}
  1132. % Protect \href's first argument in contexts such as sphinxalltt (or
  1133. % \sphinxcode). Sphinx uses \#, \%, \& ... always inside \sphinxhref.
  1134. \protected\def\sphinxhref#1#2{{%
  1135. \sphinxunactivateextrasandspace % never do \scantokens with active space!
  1136. \endlinechar\m@ne\everyeof{{#2}}% keep catcode regime for #2
  1137. \scantokens{\href{#1}}% normalise it for #1 during \href expansion
  1138. }}
  1139. % Same for \url. And also \nolinkurl for coherence.
  1140. \protected\def\sphinxurl#1{{%
  1141. \sphinxunactivateextrasandspace\everyeof{}% (<- precaution for \scantokens)
  1142. \endlinechar\m@ne\scantokens{\url{#1}}%
  1143. }}
  1144. \protected\def\sphinxnolinkurl#1{{%
  1145. \sphinxunactivateextrasandspace\everyeof{}%
  1146. \endlinechar\m@ne\scantokens{\nolinkurl{#1}}%
  1147. }}
  1148. %% TOPIC AND CONTENTS BOXES
  1149. %
  1150. % Again based on use of "framed.sty", this allows breakable framed boxes.
  1151. \long\def\spx@ShadowFBox#1{%
  1152. \leavevmode\begingroup
  1153. % first we frame the box #1
  1154. \setbox\@tempboxa
  1155. \hbox{\vrule\@width\sphinxshadowrule
  1156. \vbox{\hrule\@height\sphinxshadowrule
  1157. \kern\sphinxshadowsep
  1158. \hbox{\kern\sphinxshadowsep #1\kern\sphinxshadowsep}%
  1159. \kern\sphinxshadowsep
  1160. \hrule\@height\sphinxshadowrule}%
  1161. \vrule\@width\sphinxshadowrule}%
  1162. % Now we add the shadow, like \shadowbox from fancybox.sty would do
  1163. \dimen@\dimexpr.5\sphinxshadowrule+\sphinxshadowsize\relax
  1164. \hbox{\vbox{\offinterlineskip
  1165. \hbox{\copy\@tempboxa\kern-.5\sphinxshadowrule
  1166. % add shadow on right side
  1167. \lower\sphinxshadowsize
  1168. \hbox{\vrule\@height\ht\@tempboxa \@width\dimen@}%
  1169. }%
  1170. \kern-\dimen@ % shift back vertically to bottom of frame
  1171. % and add shadow at bottom
  1172. \moveright\sphinxshadowsize
  1173. \vbox{\hrule\@width\wd\@tempboxa \@height\dimen@}%
  1174. }%
  1175. % move left by the size of right shadow so shadow adds no width
  1176. \kern-\sphinxshadowsize
  1177. }%
  1178. \endgroup
  1179. }
  1180. % use framed.sty to allow page breaks in frame+shadow
  1181. % works well inside Lists and Quote-like environments
  1182. % produced by ``topic'' directive (or local contents)
  1183. % could nest if LaTeX writer authorized it
  1184. \newenvironment{sphinxShadowBox}
  1185. {\def\FrameCommand {\spx@ShadowFBox }%
  1186. % configure framed.sty not to add extra vertical spacing
  1187. \ltx@ifundefined{OuterFrameSep}{}{\OuterFrameSep\z@skip}%
  1188. % the \trivlist will add the vertical spacing on top and bottom which is
  1189. % typical of center environment as used in Sphinx <= 1.4.1
  1190. % the \noindent has the effet of an extra blank line on top, to
  1191. % imitate closely the layout from Sphinx <= 1.4.1; the \FrameHeightAdjust
  1192. % will put top part of frame on this baseline.
  1193. \def\FrameHeightAdjust {\baselineskip}%
  1194. % use package footnote to handle footnotes
  1195. \savenotes
  1196. \trivlist\item\noindent
  1197. % use a minipage if we are already inside a framed environment
  1198. \ifspx@inframed\begin{minipage}{\linewidth}\fi
  1199. \MakeFramed {\spx@inframedtrue
  1200. % framed.sty puts into "\width" the added width (=2shadowsep+2shadowrule)
  1201. % adjust \hsize to what the contents must use
  1202. \advance\hsize-\width
  1203. % adjust LaTeX parameters to behave properly in indented/quoted contexts
  1204. \FrameRestore
  1205. % typeset the contents as in a minipage (Sphinx <= 1.4.1 used a minipage and
  1206. % itemize/enumerate are therein typeset more tightly, we want to keep
  1207. % that). We copy-paste from LaTeX source code but don't do a real minipage.
  1208. \@pboxswfalse
  1209. \let\@listdepth\@mplistdepth \@mplistdepth\z@
  1210. \@minipagerestore
  1211. \@setminipage
  1212. }%
  1213. }%
  1214. {% insert the "endminipage" code
  1215. \par\unskip
  1216. \@minipagefalse
  1217. \endMakeFramed
  1218. \ifspx@inframed\end{minipage}\fi
  1219. \endtrivlist
  1220. % output the stored footnotes
  1221. \spewnotes
  1222. }
  1223. %% NOTICES AND ADMONITIONS
  1224. %
  1225. % Some are quite plain
  1226. % the spx@notice@bordercolor etc are set in the sphinxadmonition environment
  1227. \newenvironment{sphinxlightbox}{%
  1228. \par\allowbreak
  1229. \noindent{\color{spx@notice@bordercolor}%
  1230. \rule{\linewidth}{\spx@notice@border}}\par\nobreak
  1231. {\parskip\z@skip\noindent}%
  1232. }
  1233. {%
  1234. % counteract previous possible negative skip (French lists!):
  1235. % (we can't cancel that any earlier \vskip introduced a potential pagebreak)
  1236. \sphinxvspacefixafterfrenchlists
  1237. \nobreak\vbox{\noindent\kern\@totalleftmargin
  1238. {\color{spx@notice@bordercolor}%
  1239. \rule[\dimexpr.4\baselineskip-\spx@notice@border\relax]
  1240. {\linewidth}{\spx@notice@border}}\hss}\allowbreak
  1241. }% end of sphinxlightbox environment definition
  1242. % may be renewenvironment'd by user for complete customization
  1243. \newenvironment{sphinxnote}[1]
  1244. {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
  1245. \newenvironment{sphinxhint}[1]
  1246. {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
  1247. \newenvironment{sphinximportant}[1]
  1248. {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
  1249. \newenvironment{sphinxtip}[1]
  1250. {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
  1251. % or just use the package options
  1252. % these are needed for common handling by notice environment of lightbox
  1253. % and heavybox but they are currently not used by lightbox environment
  1254. % and there is consequently no corresponding package option
  1255. \definecolor{sphinxnoteBgColor}{rgb}{1,1,1}
  1256. \definecolor{sphinxhintBgColor}{rgb}{1,1,1}
  1257. \definecolor{sphinximportantBgColor}{rgb}{1,1,1}
  1258. \definecolor{sphinxtipBgColor}{rgb}{1,1,1}
  1259. % Others get more distinction
  1260. % Code adapted from framed.sty's "snugshade" environment.
  1261. % Nesting works (inner frames do not allow page breaks).
  1262. \newenvironment{sphinxheavybox}{\par
  1263. \setlength{\FrameRule}{\spx@notice@border}%
  1264. \setlength{\FrameSep}{\dimexpr.6\baselineskip-\FrameRule\relax}
  1265. % configure framed.sty's parameters to obtain same vertical spacing
  1266. % as for "light" boxes. We need for this to manually insert parskip glue and
  1267. % revert a skip done by framed before the frame.
  1268. \ltx@ifundefined{OuterFrameSep}{}{\OuterFrameSep\z@skip}%
  1269. \vspace{\FrameHeightAdjust}
  1270. % copied/adapted from framed.sty's snugshade
  1271. \def\FrameCommand##1{\hskip\@totalleftmargin
  1272. \fboxsep\FrameSep \fboxrule\FrameRule
  1273. \fcolorbox{spx@notice@bordercolor}{spx@notice@bgcolor}{##1}%
  1274. \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
  1275. \savenotes
  1276. % use a minipage if we are already inside a framed environment
  1277. \ifspx@inframed
  1278. \noindent\begin{minipage}{\linewidth}
  1279. \else
  1280. % handle case where notice is first thing in a list item (or is quoted)
  1281. \if@inlabel
  1282. \noindent\par\vspace{-\baselineskip}
  1283. \else
  1284. \vspace{\parskip}
  1285. \fi
  1286. \fi
  1287. \MakeFramed {\spx@inframedtrue
  1288. \advance\hsize-\width \@totalleftmargin\z@ \linewidth\hsize
  1289. % minipage initialization copied from LaTeX source code.
  1290. \@pboxswfalse
  1291. \let\@listdepth\@mplistdepth \@mplistdepth\z@
  1292. \@minipagerestore
  1293. \@setminipage }%
  1294. }
  1295. {%
  1296. \par\unskip
  1297. \@minipagefalse
  1298. \endMakeFramed
  1299. \ifspx@inframed\end{minipage}\fi
  1300. % set footnotes at bottom of page
  1301. \spewnotes
  1302. % arrange for similar spacing below frame as for "light" boxes.
  1303. \vskip .4\baselineskip
  1304. }% end of sphinxheavybox environment definition
  1305. % may be renewenvironment'd by user for complete customization
  1306. \newenvironment{sphinxwarning}[1]
  1307. {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
  1308. \newenvironment{sphinxcaution}[1]
  1309. {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
  1310. \newenvironment{sphinxattention}[1]
  1311. {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
  1312. \newenvironment{sphinxdanger}[1]
  1313. {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
  1314. \newenvironment{sphinxerror}[1]
  1315. {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
  1316. % or just use package options
  1317. % the \colorlet of xcolor (if at all loaded) is overkill for our use case
  1318. \newcommand{\sphinxcolorlet}[2]
  1319. {\expandafter\let\csname\@backslashchar color@#1\expandafter\endcsname
  1320. \csname\@backslashchar color@#2\endcsname }
  1321. % the main dispatch for all types of notices
  1322. \newenvironment{sphinxadmonition}[2]{% #1=type, #2=heading
  1323. % can't use #1 directly in definition of end part
  1324. \def\spx@noticetype {#1}%
  1325. % set parameters of heavybox/lightbox
  1326. \sphinxcolorlet{spx@notice@bordercolor}{sphinx#1BorderColor}%
  1327. \sphinxcolorlet{spx@notice@bgcolor}{sphinx#1BgColor}%
  1328. \spx@notice@border \dimexpr\csname spx@opt@#1border\endcsname\relax
  1329. % start specific environment, passing the heading as argument
  1330. \begin{sphinx#1}{#2}}
  1331. % workaround some LaTeX "feature" of \end command
  1332. {\edef\spx@temp{\noexpand\end{sphinx\spx@noticetype}}\spx@temp}
  1333. %% PYTHON DOCS MACROS AND ENVIRONMENTS
  1334. % (some macros here used by \maketitle in sphinxmanual.cls and sphinxhowto.cls)
  1335. % \moduleauthor{name}{email}
  1336. \newcommand{\moduleauthor}[2]{}
  1337. % \sectionauthor{name}{email}
  1338. \newcommand{\sectionauthor}[2]{}
  1339. % Allow the release number to be specified independently of the
  1340. % \date{}. This allows the date to reflect the document's date and
  1341. % release to specify the release that is documented.
  1342. %
  1343. \newcommand{\py@release}{\releasename\space\version}
  1344. \newcommand{\version}{}% part of \py@release, used by title page and headers
  1345. % \releaseinfo is used on titlepage (sphinxmanual.cls, sphinxhowto.cls)
  1346. \newcommand{\releaseinfo}{}
  1347. \newcommand{\setreleaseinfo}[1]{\renewcommand{\releaseinfo}{#1}}
  1348. % this is inserted via template and #1=release config variable
  1349. \newcommand{\release}[1]{\renewcommand{\version}{#1}}
  1350. % this is defined by template to 'releasename' latex_elements key
  1351. \newcommand{\releasename}{}
  1352. % Fix issue in case release and releasename deliberately left blank
  1353. \newcommand{\sphinxheadercomma}{, }% used in fancyhdr header definition
  1354. \newcommand{\sphinxifemptyorblank}[1]{%
  1355. % test after one expansion of macro #1 if contents is empty or spaces
  1356. \if&\expandafter\@firstofone\detokenize\expandafter{#1}&%
  1357. \expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi}%
  1358. \AtBeginDocument {%
  1359. \sphinxifemptyorblank{\releasename}
  1360. {\sphinxifemptyorblank{\version}{\let\sphinxheadercomma\empty}{}}
  1361. {}%
  1362. }%
  1363. % Allow specification of the author's address separately from the
  1364. % author's name. This can be used to format them differently, which
  1365. % is a good thing.
  1366. %
  1367. \newcommand{\py@authoraddress}{}
  1368. \newcommand{\authoraddress}[1]{\renewcommand{\py@authoraddress}{#1}}
  1369. % {fulllineitems} is the main environment for object descriptions.
  1370. %
  1371. \newcommand{\py@itemnewline}[1]{%
  1372. \kern\labelsep
  1373. \@tempdima\linewidth
  1374. \advance\@tempdima \labelwidth\makebox[\@tempdima][l]{#1}%
  1375. \kern-\labelsep
  1376. }
  1377. \newenvironment{fulllineitems}{%
  1378. \begin{list}{}{\labelwidth \leftmargin
  1379. \rightmargin \z@ \topsep -\parskip \partopsep \parskip
  1380. \itemsep -\parsep
  1381. \let\makelabel=\py@itemnewline}%
  1382. }{\end{list}}
  1383. % Signatures, possibly multi-line
  1384. %
  1385. \newlength{\py@argswidth}
  1386. \newcommand{\py@sigparams}[2]{%
  1387. \parbox[t]{\py@argswidth}{#1\sphinxcode{)}#2}}
  1388. \newcommand{\pysigline}[1]{\item[{#1}]}
  1389. \newcommand{\pysiglinewithargsret}[3]{%
  1390. \settowidth{\py@argswidth}{#1\sphinxcode{(}}%
  1391. \addtolength{\py@argswidth}{-2\py@argswidth}%
  1392. \addtolength{\py@argswidth}{\linewidth}%
  1393. \item[{#1\sphinxcode{(}\py@sigparams{#2}{#3}}]}
  1394. \newcommand{\pysigstartmultiline}{%
  1395. \def\pysigstartmultiline{\vskip\smallskipamount\parskip\z@skip\itemsep\z@skip}%
  1396. \edef\pysigstopmultiline
  1397. {\noexpand\leavevmode\parskip\the\parskip\relax\itemsep\the\itemsep\relax}%
  1398. \parskip\z@skip\itemsep\z@skip
  1399. }
  1400. % Production lists
  1401. %
  1402. \newenvironment{productionlist}{%
  1403. % \def\sphinxoptional##1{{\Large[}##1{\Large]}}
  1404. \def\production##1##2{\\\sphinxcode{\sphinxupquote{##1}}&::=&\sphinxcode{\sphinxupquote{##2}}}%
  1405. \def\productioncont##1{\\& &\sphinxcode{\sphinxupquote{##1}}}%
  1406. \parindent=2em
  1407. \indent
  1408. \setlength{\LTpre}{0pt}%
  1409. \setlength{\LTpost}{0pt}%
  1410. \begin{longtable}[l]{lcl}
  1411. }{%
  1412. \end{longtable}
  1413. }
  1414. % Definition lists; requested by AMK for HOWTO documents. Probably useful
  1415. % elsewhere as well, so keep in in the general style support.
  1416. %
  1417. \newenvironment{definitions}{%
  1418. \begin{description}%
  1419. \def\term##1{\item[{##1}]\mbox{}\\*[0mm]}%
  1420. }{%
  1421. \end{description}%
  1422. }
  1423. %% FROM DOCTUTILS LATEX WRITER
  1424. %
  1425. % The following is stuff copied from docutils' latex writer.
  1426. %
  1427. \newcommand{\optionlistlabel}[1]{\normalfont\bfseries #1 \hfill}% \bf deprecated
  1428. \newenvironment{optionlist}[1]
  1429. {\begin{list}{}
  1430. {\setlength{\labelwidth}{#1}
  1431. \setlength{\rightmargin}{1cm}
  1432. \setlength{\leftmargin}{\rightmargin}
  1433. \addtolength{\leftmargin}{\labelwidth}
  1434. \addtolength{\leftmargin}{\labelsep}
  1435. \renewcommand{\makelabel}{\optionlistlabel}}
  1436. }{\end{list}}
  1437. \newlength{\lineblockindentation}
  1438. \setlength{\lineblockindentation}{2.5em}
  1439. \newenvironment{lineblock}[1]
  1440. {\begin{list}{}
  1441. {\setlength{\partopsep}{\parskip}
  1442. \addtolength{\partopsep}{\baselineskip}
  1443. \topsep0pt\itemsep0.15\baselineskip\parsep0pt
  1444. \leftmargin#1\relax}
  1445. \raggedright}
  1446. {\end{list}}
  1447. % From docutils.writers.latex2e
  1448. % inline markup (custom roles)
  1449. % \DUrole{#1}{#2} tries \DUrole#1{#2}
  1450. \providecommand*{\DUrole}[2]{%
  1451. \ifcsname DUrole\detokenize{#1}\endcsname
  1452. \csname DUrole\detokenize{#1}\endcsname{#2}%
  1453. \else% backwards compatibility: try \docutilsrole#1{#2}
  1454. \ifcsname docutilsrole\detokenize{#1}\endcsname
  1455. \csname docutilsrole\detokenize{#1}\endcsname{#2}%
  1456. \else
  1457. #2%
  1458. \fi
  1459. \fi
  1460. }
  1461. \providecommand*{\DUprovidelength}[2]{%
  1462. \ifdefined#1\else\newlength{#1}\setlength{#1}{#2}\fi
  1463. }
  1464. \DUprovidelength{\DUlineblockindent}{2.5em}
  1465. \ifdefined\DUlineblock\else
  1466. \newenvironment{DUlineblock}[1]{%
  1467. \list{}{\setlength{\partopsep}{\parskip}
  1468. \addtolength{\partopsep}{\baselineskip}
  1469. \setlength{\topsep}{0pt}
  1470. \setlength{\itemsep}{0.15\baselineskip}
  1471. \setlength{\parsep}{0pt}
  1472. \setlength{\leftmargin}{#1}}
  1473. \raggedright
  1474. }
  1475. {\endlist}
  1476. \fi
  1477. %% TEXT STYLING
  1478. %
  1479. % to obtain straight quotes we execute \@noligs as patched by upquote, and
  1480. % \scantokens is needed in cases where it would be too late for the macro to
  1481. % first set catcodes and then fetch its argument. We also make the contents
  1482. % breakable at non-escaped . , ; ? ! / using \sphinxbreaksviaactive.
  1483. % the macro must be protected if it ends up used in moving arguments,
  1484. % in 'alltt' \@noligs is done already, and the \scantokens must be avoided.
  1485. \protected\def\sphinxupquote#1{{\def\@tempa{alltt}%
  1486. \ifx\@tempa\@currenvir\else
  1487. \ifspx@opt@inlineliteralwraps
  1488. \sphinxbreaksviaactive\let\sphinxafterbreak\empty
  1489. % do not overwrite the comma set-up
  1490. \let\verbatim@nolig@list\sphinx@literal@nolig@list
  1491. \fi
  1492. % fix a space-gobbling issue due to LaTeX's original \do@noligs
  1493. \let\do@noligs\sphinx@do@noligs
  1494. \@noligs\endlinechar\m@ne\everyeof{}% (<- in case inside \sphinxhref)
  1495. \expandafter\scantokens
  1496. \fi {{#1}}}}% extra brace pair to fix end-space gobbling issue...
  1497. \def\sphinx@do@noligs #1{\catcode`#1\active\begingroup\lccode`\~`#1\relax
  1498. \lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1 }}}
  1499. \def\sphinx@literal@nolig@list {\do\`\do\<\do\>\do\'\do\-}%
  1500. % Some custom font markup commands.
  1501. \protected\def\sphinxstrong#1{\textbf{#1}}
  1502. \protected\def\sphinxcode#1{\texttt{#1}}
  1503. \protected\def\sphinxbfcode#1{\textbf{\sphinxcode{#1}}}
  1504. \protected\def\sphinxemail#1{\textsf{#1}}
  1505. \protected\def\sphinxtablecontinued#1{\textsf{#1}}
  1506. \protected\def\sphinxtitleref#1{\emph{#1}}
  1507. \protected\def\sphinxmenuselection#1{\emph{#1}}
  1508. \protected\def\sphinxguilabel#1{\emph{#1}}
  1509. \protected\def\sphinxaccelerator#1{\underline{#1}}
  1510. \protected\def\sphinxcrossref#1{\emph{#1}}
  1511. \protected\def\sphinxtermref#1{\emph{#1}}
  1512. % \optional is used for ``[, arg]``, i.e. desc_optional nodes.
  1513. \long\protected\def\sphinxoptional#1{%
  1514. {\textnormal{\Large[}}{#1}\hspace{0.5mm}{\textnormal{\Large]}}}
  1515. % additional customizable styling
  1516. \def\sphinxstyleindexentry #1{\texttt{#1}}
  1517. \def\sphinxstyleindexextra #1{ \emph{(#1)}}
  1518. \def\sphinxstyleindexpageref #1{, \pageref{#1}}
  1519. \def\sphinxstyleindexlettergroup #1%
  1520. {{\Large\sffamily#1}\nopagebreak\vspace{1mm}}
  1521. \def\sphinxstyleindexlettergroupDefault #1%
  1522. {{\Large\sffamily\sphinxnonalphabeticalgroupname}\nopagebreak\vspace{1mm}}
  1523. \protected\def\sphinxstyletopictitle #1{\textbf{#1}\par\medskip}
  1524. \let\sphinxstylesidebartitle\sphinxstyletopictitle
  1525. \protected\def\sphinxstyleothertitle #1{\textbf{#1}}
  1526. \protected\def\sphinxstylesidebarsubtitle #1{~\\\textbf{#1} \smallskip}
  1527. % \text.. commands do not allow multiple paragraphs
  1528. \protected\def\sphinxstyletheadfamily {\sffamily}
  1529. \protected\def\sphinxstyleemphasis #1{\emph{#1}}
  1530. \protected\def\sphinxstyleliteralemphasis#1{\emph{\sphinxcode{#1}}}
  1531. \protected\def\sphinxstylestrong #1{\textbf{#1}}
  1532. \protected\def\sphinxstyleliteralstrong#1{\sphinxbfcode{#1}}
  1533. \protected\def\sphinxstyleabbreviation #1{\textsc{#1}}
  1534. \protected\def\sphinxstyleliteralintitle#1{\sphinxcode{#1}}
  1535. \newcommand*\sphinxstylecodecontinued[1]{\footnotesize(#1)}%
  1536. \newcommand*\sphinxstylecodecontinues[1]{\footnotesize(#1)}%
  1537. % figure legend comes after caption and may contain arbitrary body elements
  1538. \newenvironment{sphinxlegend}{\par\small}{\par}
  1539. % reduce hyperref "Token not allowed in a PDF string" warnings on PDF builds
  1540. \AtBeginDocument{\pdfstringdefDisableCommands{%
  1541. % all "protected" macros possibly ending up in section titles should be here
  1542. \let\sphinxstyleemphasis \@firstofone
  1543. \let\sphinxstyleliteralemphasis \@firstofone
  1544. \let\sphinxstylestrong \@firstofone
  1545. \let\sphinxstyleliteralstrong \@firstofone
  1546. \let\sphinxstyleabbreviation \@firstofone
  1547. \let\sphinxstyleliteralintitle \@firstofone
  1548. \let\sphinxupquote \@firstofone
  1549. \let\sphinxstrong \@firstofone
  1550. \let\sphinxcode \@firstofone
  1551. \let\sphinxbfcode \@firstofone
  1552. \let\sphinxemail \@firstofone
  1553. \let\sphinxcrossref \@firstofone
  1554. \let\sphinxtermref \@firstofone
  1555. }}
  1556. % For curly braces inside \index macro
  1557. \def\sphinxleftcurlybrace{\{}
  1558. \def\sphinxrightcurlybrace{\}}
  1559. % Declare Unicode characters used by linux tree command to pdflatex utf8/utf8x
  1560. \def\spx@bd#1#2{%
  1561. \leavevmode
  1562. \begingroup
  1563. \ifx\spx@bd@height \@undefined\def\spx@bd@height{\baselineskip}\fi
  1564. \ifx\spx@bd@width \@undefined\setbox0\hbox{0}\def\spx@bd@width{\wd0 }\fi
  1565. \ifx\spx@bd@thickness\@undefined\def\spx@bd@thickness{.6\p@}\fi
  1566. \ifx\spx@bd@lower \@undefined\def\spx@bd@lower{\dp\strutbox}\fi
  1567. \lower\spx@bd@lower#1{#2}%
  1568. \endgroup
  1569. }%
  1570. \@namedef{sphinx@u2500}% BOX DRAWINGS LIGHT HORIZONTAL
  1571. {\spx@bd{\vbox to\spx@bd@height}
  1572. {\vss\hrule\@height\spx@bd@thickness
  1573. \@width\spx@bd@width\vss}}%
  1574. \@namedef{sphinx@u2502}% BOX DRAWINGS LIGHT VERTICAL
  1575. {\spx@bd{\hb@xt@\spx@bd@width}
  1576. {\hss\vrule\@height\spx@bd@height
  1577. \@width \spx@bd@thickness\hss}}%
  1578. \@namedef{sphinx@u2514}% BOX DRAWINGS LIGHT UP AND RIGHT
  1579. {\spx@bd{\hb@xt@\spx@bd@width}
  1580. {\hss\raise.5\spx@bd@height
  1581. \hb@xt@\z@{\hss\vrule\@height.5\spx@bd@height
  1582. \@width \spx@bd@thickness\hss}%
  1583. \vbox to\spx@bd@height{\vss\hrule\@height\spx@bd@thickness
  1584. \@width.5\spx@bd@width\vss}}}%
  1585. \@namedef{sphinx@u251C}% BOX DRAWINGS LIGHT VERTICAL AND RIGHT
  1586. {\spx@bd{\hb@xt@\spx@bd@width}
  1587. {\hss
  1588. \hb@xt@\z@{\hss\vrule\@height\spx@bd@height
  1589. \@width \spx@bd@thickness\hss}%
  1590. \vbox to\spx@bd@height{\vss\hrule\@height\spx@bd@thickness
  1591. \@width.5\spx@bd@width\vss}}}%
  1592. \protected\def\sphinxunichar#1{\@nameuse{sphinx@u#1}}%
  1593. % Tell TeX about pathological hyphenation cases:
  1594. \hyphenation{Base-HTTP-Re-quest-Hand-ler}
  1595. \endinput

A Python package for graph kernels, graph edit distances and graph pre-image problem.