1*7f2fe78bSCy Schubert% 2*7f2fe78bSCy Schubert% sphinx.sty 3*7f2fe78bSCy Schubert% 4*7f2fe78bSCy Schubert% Adapted from the old python.sty, mostly written by Fred Drake, 5*7f2fe78bSCy Schubert% by Georg Brandl. 6*7f2fe78bSCy Schubert% 7*7f2fe78bSCy Schubert 8*7f2fe78bSCy Schubert\NeedsTeXFormat{LaTeX2e}[1995/12/01] 9*7f2fe78bSCy Schubert\ProvidesPackage{sphinx}[2021/01/27 v4.0.0 LaTeX package (Sphinx markup)] 10*7f2fe78bSCy Schubert 11*7f2fe78bSCy Schubert% provides \ltx@ifundefined 12*7f2fe78bSCy Schubert% (many packages load ltxcmds: graphicx does for pdftex and lualatex but 13*7f2fe78bSCy Schubert% not xelatex, and anyhow kvoptions does, but it may be needed in future to 14*7f2fe78bSCy Schubert% use \sphinxdeprecationwarning earlier, and it needs \ltx@ifundefined) 15*7f2fe78bSCy Schubert\RequirePackage{ltxcmds} 16*7f2fe78bSCy Schubert 17*7f2fe78bSCy Schubert%% for deprecation warnings 18*7f2fe78bSCy Schubert\newcommand\sphinxdeprecationwarning[4]{% #1 the deprecated macro or name, 19*7f2fe78bSCy Schubert% #2 = when deprecated, #3 = when removed, #4 = additional info 20*7f2fe78bSCy Schubert \edef\spx@tempa{\detokenize{#1}}% 21*7f2fe78bSCy Schubert \ltx@ifundefined{sphinx_depr_\spx@tempa}{% 22*7f2fe78bSCy Schubert \global\expandafter\let\csname sphinx_depr_\spx@tempa\endcsname\spx@tempa 23*7f2fe78bSCy Schubert \expandafter\AtEndDocument\expandafter{\expandafter\let\expandafter 24*7f2fe78bSCy Schubert \sphinxdeprecatedmacro\csname sphinx_depr_\spx@tempa\endcsname 25*7f2fe78bSCy Schubert \PackageWarningNoLine{sphinx}{^^J**** SPHINX DEPRECATION WARNING:^^J 26*7f2fe78bSCy Schubert \sphinxdeprecatedmacro^^J 27*7f2fe78bSCy Schubert \@spaces- is deprecated at Sphinx #2^^J 28*7f2fe78bSCy Schubert \@spaces- and removed at Sphinx #3.^^J 29*7f2fe78bSCy Schubert #4^^J****}}% 30*7f2fe78bSCy Schubert }{% warning already emitted (at end of latex log), don't repeat 31*7f2fe78bSCy Schubert }} 32*7f2fe78bSCy Schubert 33*7f2fe78bSCy Schubert 34*7f2fe78bSCy Schubert%% OPTION HANDLING 35*7f2fe78bSCy Schubert% 36*7f2fe78bSCy Schubert 37*7f2fe78bSCy Schubert% We first handle options then load packages, but we need \definecolor from 38*7f2fe78bSCy Schubert% xcolor/color. 39*7f2fe78bSCy Schubert 40*7f2fe78bSCy Schubert% FIXME: we should \RequirePackage{xcolor} always now 41*7f2fe78bSCy Schubert% The xcolor package draws better fcolorboxes around verbatim code 42*7f2fe78bSCy Schubert\IfFileExists{xcolor.sty}{ 43*7f2fe78bSCy Schubert \RequirePackage{xcolor} 44*7f2fe78bSCy Schubert}{ 45*7f2fe78bSCy Schubert \RequirePackage{color} 46*7f2fe78bSCy Schubert} 47*7f2fe78bSCy Schubert 48*7f2fe78bSCy Schubert% Handle options via "kvoptions" (later loaded by hyperref anyhow) 49*7f2fe78bSCy Schubert\RequirePackage{kvoptions} 50*7f2fe78bSCy Schubert\SetupKeyvalOptions{prefix=spx@opt@} % use \spx@opt@ prefix 51*7f2fe78bSCy Schubert 52*7f2fe78bSCy Schubert% Sphinx legacy text layout: 1in margins on all four sides 53*7f2fe78bSCy Schubert\ifx\@jsc@uplatextrue\@undefined 54*7f2fe78bSCy Schubert\DeclareStringOption[1in]{hmargin} 55*7f2fe78bSCy Schubert\DeclareStringOption[1in]{vmargin} 56*7f2fe78bSCy Schubert\DeclareStringOption[.5in]{marginpar} 57*7f2fe78bSCy Schubert\else 58*7f2fe78bSCy Schubert% Japanese standard document classes handle \mag in a special way 59*7f2fe78bSCy Schubert\DeclareStringOption[\inv@mag in]{hmargin} 60*7f2fe78bSCy Schubert\DeclareStringOption[\inv@mag in]{vmargin} 61*7f2fe78bSCy Schubert\DeclareStringOption[.5\dimexpr\inv@mag in\relax]{marginpar} 62*7f2fe78bSCy Schubert\fi 63*7f2fe78bSCy Schubert 64*7f2fe78bSCy Schubert\DeclareStringOption[0]{maxlistdepth}% \newcommand*\spx@opt@maxlistdepth{0} 65*7f2fe78bSCy Schubert\DeclareStringOption[-1]{numfigreset} 66*7f2fe78bSCy Schubert\DeclareBoolOption[false]{nonumfigreset} 67*7f2fe78bSCy Schubert\DeclareBoolOption[false]{mathnumfig} 68*7f2fe78bSCy Schubert\define@key{sphinx}{bookmarksdepth}{\AtBeginDocument{\hypersetup{bookmarksdepth=#1}}} 69*7f2fe78bSCy Schubert\AtBeginDocument{\define@key{sphinx}{bookmarksdepth}{\hypersetup{bookmarksdepth=#1}}} 70*7f2fe78bSCy Schubert% \DeclareBoolOption[false]{usespart}% not used 71*7f2fe78bSCy Schubert% dimensions, we declare the \dimen registers here. 72*7f2fe78bSCy Schubert\newdimen\sphinxverbatimsep 73*7f2fe78bSCy Schubert\newdimen\sphinxverbatimborder 74*7f2fe78bSCy Schubert\newdimen\sphinxshadowsep 75*7f2fe78bSCy Schubert\newdimen\sphinxshadowsize 76*7f2fe78bSCy Schubert\newdimen\sphinxshadowrule 77*7f2fe78bSCy Schubert% \DeclareStringOption is not convenient for the handling of these dimensions 78*7f2fe78bSCy Schubert% because we want to assign the values to the corresponding registers. Even if 79*7f2fe78bSCy Schubert% we added the code to the key handler it would be too late for the initial 80*7f2fe78bSCy Schubert% set-up and we would need to do initial assignments explicitly. We end up 81*7f2fe78bSCy Schubert% using \define@key directly. 82*7f2fe78bSCy Schubert% verbatim 83*7f2fe78bSCy Schubert\sphinxverbatimsep=\fboxsep 84*7f2fe78bSCy Schubert \define@key{sphinx}{verbatimsep}{\sphinxverbatimsep\dimexpr #1\relax} 85*7f2fe78bSCy Schubert\sphinxverbatimborder=\fboxrule 86*7f2fe78bSCy Schubert \define@key{sphinx}{verbatimborder}{\sphinxverbatimborder\dimexpr #1\relax} 87*7f2fe78bSCy Schubert% topic boxes 88*7f2fe78bSCy Schubert\sphinxshadowsep =5pt 89*7f2fe78bSCy Schubert \define@key{sphinx}{shadowsep}{\sphinxshadowsep\dimexpr #1\relax} 90*7f2fe78bSCy Schubert\sphinxshadowsize=4pt 91*7f2fe78bSCy Schubert \define@key{sphinx}{shadowsize}{\sphinxshadowsize\dimexpr #1\relax} 92*7f2fe78bSCy Schubert\sphinxshadowrule=\fboxrule 93*7f2fe78bSCy Schubert \define@key{sphinx}{shadowrule}{\sphinxshadowrule\dimexpr #1\relax} 94*7f2fe78bSCy Schubert% verbatim 95*7f2fe78bSCy Schubert\DeclareBoolOption[true]{verbatimwithframe} 96*7f2fe78bSCy Schubert\DeclareBoolOption[true]{verbatimwrapslines} 97*7f2fe78bSCy Schubert\DeclareBoolOption[false]{verbatimforcewraps} 98*7f2fe78bSCy Schubert\DeclareStringOption[3]{verbatimmaxoverfull} 99*7f2fe78bSCy Schubert\DeclareStringOption[100]{verbatimmaxunderfull} 100*7f2fe78bSCy Schubert\DeclareBoolOption[true]{verbatimhintsturnover} 101*7f2fe78bSCy Schubert\DeclareBoolOption[true]{inlineliteralwraps} 102*7f2fe78bSCy Schubert\DeclareStringOption[t]{literalblockcappos} 103*7f2fe78bSCy Schubert\DeclareStringOption[r]{verbatimcontinuedalign} 104*7f2fe78bSCy Schubert\DeclareStringOption[r]{verbatimcontinuesalign} 105*7f2fe78bSCy Schubert% parsed literal 106*7f2fe78bSCy Schubert\DeclareBoolOption[true]{parsedliteralwraps} 107*7f2fe78bSCy Schubert% \textvisiblespace for compatibility with fontspec+XeTeX/LuaTeX 108*7f2fe78bSCy Schubert\DeclareStringOption[\textcolor{red}{\textvisiblespace}]{verbatimvisiblespace} 109*7f2fe78bSCy Schubert\DeclareStringOption % must use braces to hide the brackets 110*7f2fe78bSCy Schubert [{\makebox[2\fontcharwd\font`\x][r]{\textcolor{red}{\tiny$\m@th\hookrightarrow$}}}]% 111*7f2fe78bSCy Schubert {verbatimcontinued} 112*7f2fe78bSCy Schubert% notices/admonitions 113*7f2fe78bSCy Schubert% the dimensions for notices/admonitions are kept as macros and assigned to 114*7f2fe78bSCy Schubert% \spx@notice@border at time of use, hence \DeclareStringOption is ok for this 115*7f2fe78bSCy Schubert\newdimen\spx@notice@border 116*7f2fe78bSCy Schubert\DeclareStringOption[0.5pt]{noteborder} 117*7f2fe78bSCy Schubert\DeclareStringOption[0.5pt]{hintborder} 118*7f2fe78bSCy Schubert\DeclareStringOption[0.5pt]{importantborder} 119*7f2fe78bSCy Schubert\DeclareStringOption[0.5pt]{tipborder} 120*7f2fe78bSCy Schubert\DeclareStringOption[1pt]{warningborder} 121*7f2fe78bSCy Schubert\DeclareStringOption[1pt]{cautionborder} 122*7f2fe78bSCy Schubert\DeclareStringOption[1pt]{attentionborder} 123*7f2fe78bSCy Schubert\DeclareStringOption[1pt]{dangerborder} 124*7f2fe78bSCy Schubert\DeclareStringOption[1pt]{errorborder} 125*7f2fe78bSCy Schubert% footnotes 126*7f2fe78bSCy Schubert\DeclareStringOption[\mbox{ }]{AtStartFootnote} 127*7f2fe78bSCy Schubert% we need a public macro name for direct use in latex file 128*7f2fe78bSCy Schubert\newcommand*{\sphinxAtStartFootnote}{\spx@opt@AtStartFootnote} 129*7f2fe78bSCy Schubert% no such need for this one, as it is used inside other macros 130*7f2fe78bSCy Schubert\DeclareStringOption[\leavevmode\unskip]{BeforeFootnote} 131*7f2fe78bSCy Schubert% some font styling. 132*7f2fe78bSCy Schubert\DeclareStringOption[\sffamily\bfseries]{HeaderFamily} 133*7f2fe78bSCy Schubert% colours 134*7f2fe78bSCy Schubert% same problems as for dimensions: we want the key handler to use \definecolor. 135*7f2fe78bSCy Schubert% first, some colours with no prefix, for backwards compatibility 136*7f2fe78bSCy Schubert\newcommand*{\sphinxDeclareColorOption}[2]{% 137*7f2fe78bSCy Schubert \definecolor{#1}#2% 138*7f2fe78bSCy Schubert \define@key{sphinx}{#1}{\definecolor{#1}##1}% 139*7f2fe78bSCy Schubert}% 140*7f2fe78bSCy Schubert\sphinxDeclareColorOption{TitleColor}{{rgb}{0.126,0.263,0.361}} 141*7f2fe78bSCy Schubert\sphinxDeclareColorOption{InnerLinkColor}{{rgb}{0.208,0.374,0.486}} 142*7f2fe78bSCy Schubert\sphinxDeclareColorOption{OuterLinkColor}{{rgb}{0.216,0.439,0.388}} 143*7f2fe78bSCy Schubert\sphinxDeclareColorOption{VerbatimColor}{{rgb}{1,1,1}} 144*7f2fe78bSCy Schubert\sphinxDeclareColorOption{VerbatimBorderColor}{{rgb}{0,0,0}} 145*7f2fe78bSCy Schubert% now the colours defined with "sphinx" prefix in their names 146*7f2fe78bSCy Schubert\newcommand*{\sphinxDeclareSphinxColorOption}[2]{% 147*7f2fe78bSCy Schubert % set the initial default 148*7f2fe78bSCy Schubert \definecolor{sphinx#1}#2% 149*7f2fe78bSCy Schubert % set the key handler. The "value" ##1 must be acceptable by \definecolor. 150*7f2fe78bSCy Schubert \define@key{sphinx}{#1}{\definecolor{sphinx#1}##1}% 151*7f2fe78bSCy Schubert}% 152*7f2fe78bSCy Schubert% Default color chosen to be as in minted.sty LaTeX package! 153*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{VerbatimHighlightColor}{{rgb}{0.878,1,1}} 154*7f2fe78bSCy Schubert% admonition boxes, "light" style 155*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{noteBorderColor}{{rgb}{0,0,0}} 156*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{hintBorderColor}{{rgb}{0,0,0}} 157*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{importantBorderColor}{{rgb}{0,0,0}} 158*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{tipBorderColor}{{rgb}{0,0,0}} 159*7f2fe78bSCy Schubert% admonition boxes, "heavy" style 160*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{warningBorderColor}{{rgb}{0,0,0}} 161*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{cautionBorderColor}{{rgb}{0,0,0}} 162*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{attentionBorderColor}{{rgb}{0,0,0}} 163*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{dangerBorderColor}{{rgb}{0,0,0}} 164*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{errorBorderColor}{{rgb}{0,0,0}} 165*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{warningBgColor}{{rgb}{1,1,1}} 166*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{cautionBgColor}{{rgb}{1,1,1}} 167*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{attentionBgColor}{{rgb}{1,1,1}} 168*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{dangerBgColor}{{rgb}{1,1,1}} 169*7f2fe78bSCy Schubert\sphinxDeclareSphinxColorOption{errorBgColor}{{rgb}{1,1,1}} 170*7f2fe78bSCy Schubert 171*7f2fe78bSCy Schubert\DeclareDefaultOption{\@unknownoptionerror} 172*7f2fe78bSCy Schubert\ProcessKeyvalOptions* 173*7f2fe78bSCy Schubert% don't allow use of maxlistdepth via \sphinxsetup. 174*7f2fe78bSCy Schubert\DisableKeyvalOption{sphinx}{maxlistdepth} 175*7f2fe78bSCy Schubert\DisableKeyvalOption{sphinx}{numfigreset} 176*7f2fe78bSCy Schubert\DisableKeyvalOption{sphinx}{nonumfigreset} 177*7f2fe78bSCy Schubert\DisableKeyvalOption{sphinx}{mathnumfig} 178*7f2fe78bSCy Schubert% FIXME: this is unrelated to an option, move this elsewhere 179*7f2fe78bSCy Schubert% To allow hyphenation of first word in narrow contexts; no option, 180*7f2fe78bSCy Schubert% customization to be done via 'preamble' key 181*7f2fe78bSCy Schubert\newcommand*\sphinxAtStartPar{\leavevmode\nobreak\hskip\z@skip} 182*7f2fe78bSCy Schubert% No need for the \hspace{0pt} trick (\hskip\z@skip) with luatex 183*7f2fe78bSCy Schubert\ifdefined\directlua\let\sphinxAtStartPar\@empty\fi 184*7f2fe78bSCy Schubert% user interface: options can be changed midway in a document! 185*7f2fe78bSCy Schubert\newcommand\sphinxsetup[1]{\setkeys{sphinx}{#1}} 186*7f2fe78bSCy Schubert 187*7f2fe78bSCy Schubert 188*7f2fe78bSCy Schubert%% MISCELLANEOUS CONTEXT 189*7f2fe78bSCy Schubert% 190*7f2fe78bSCy Schubert% flag to be set in a framed environment 191*7f2fe78bSCy Schubert% (defined here as currently needed by three sphinxlatex....sty files and 192*7f2fe78bSCy Schubert% even if not needed if such files are replaced, the definition does no harm) 193*7f2fe78bSCy Schubert\newif\ifspx@inframed 194*7f2fe78bSCy Schubert% 195*7f2fe78bSCy Schubert% \spx@ifcaptionpackage (defined at begin document) 196*7f2fe78bSCy Schubert% is needed currently in macros from: 197*7f2fe78bSCy Schubert% sphinxlatexliterals.sty (sphinxVerbatim) 198*7f2fe78bSCy Schubert% sphinxlatextables.sty (for some macros used in the table templates) 199*7f2fe78bSCy Schubert% 200*7f2fe78bSCy Schubert% \sphinxcaption is mark-up injected by the tabular and tabulary templates 201*7f2fe78bSCy Schubert% it is defined in sphinxlatextables.sty 202*7f2fe78bSCy Schubert% 203*7f2fe78bSCy Schubert% store the original \caption macro for usage with figures inside longtable 204*7f2fe78bSCy Schubert% and tabulary cells. Make sure we get the final \caption in presence of 205*7f2fe78bSCy Schubert% caption package, whether the latter was loaded before or after sphinx. 206*7f2fe78bSCy Schubert\AtBeginDocument{% 207*7f2fe78bSCy Schubert \let\spx@originalcaption\caption 208*7f2fe78bSCy Schubert \@ifpackageloaded{caption} 209*7f2fe78bSCy Schubert {\let\spx@ifcaptionpackage\@firstoftwo 210*7f2fe78bSCy Schubert \caption@AtBeginDocument*{\let\spx@originalcaption\caption}% 211*7f2fe78bSCy Schubert% in presence of caption package, drop our own \sphinxcaption whose aim was to 212*7f2fe78bSCy Schubert% ensure same width of caption to all kinds of tables (tabular(y), longtable), 213*7f2fe78bSCy Schubert% because caption package has its own width (or margin) option 214*7f2fe78bSCy Schubert \def\sphinxcaption{\caption}% 215*7f2fe78bSCy Schubert }% 216*7f2fe78bSCy Schubert {\let\spx@ifcaptionpackage\@secondoftwo}% 217*7f2fe78bSCy Schubert} 218*7f2fe78bSCy Schubert 219*7f2fe78bSCy Schubert%% PASS OPTIONS 220*7f2fe78bSCy Schubert% 221*7f2fe78bSCy Schubert% pass options to hyperref; it must not have been loaded already 222*7f2fe78bSCy Schubert\input{sphinxoptionshyperref.sty} 223*7f2fe78bSCy Schubert% pass options to geometry; it must not have been loaded already 224*7f2fe78bSCy Schubert\input{sphinxoptionsgeometry.sty} 225*7f2fe78bSCy Schubert 226*7f2fe78bSCy Schubert 227*7f2fe78bSCy Schubert%% COLOR (general) 228*7f2fe78bSCy Schubert% 229*7f2fe78bSCy Schubert% FIXME: these two should be deprecated 230*7f2fe78bSCy Schubert% 231*7f2fe78bSCy Schubert% FIXME: \normalcolor should be used and \py@NormalColor never defined 232*7f2fe78bSCy Schubert\def\py@NormalColor{\color{black}} 233*7f2fe78bSCy Schubert% FIXME: \color{TitleColor} should be used directly and \py@TitleColor 234*7f2fe78bSCy Schubert% should never get defined. 235*7f2fe78bSCy Schubert\def\py@TitleColor{\color{TitleColor}} 236*7f2fe78bSCy Schubert 237*7f2fe78bSCy Schubert 238*7f2fe78bSCy Schubert%% PACKAGES 239*7f2fe78bSCy Schubert% 240*7f2fe78bSCy Schubert% as will be indicated below, secondary style files load some more packages 241*7f2fe78bSCy Schubert% 242*7f2fe78bSCy Schubert% For \text macro (sphinx.util.texescape) 243*7f2fe78bSCy Schubert% also for usage of \firstchoice@true(false) in sphinxlatexgraphics.sty 244*7f2fe78bSCy Schubert\RequirePackage{amstext} 245*7f2fe78bSCy Schubert% It was passed "warn" option from latex template in case it is already loaded 246*7f2fe78bSCy Schubert% via some other package before \usepackage{sphinx} in preamble 247*7f2fe78bSCy Schubert\RequirePackage{textcomp} 248*7f2fe78bSCy Schubert% For the H specifier. Do not \restylefloat{figure}, it breaks Sphinx code 249*7f2fe78bSCy Schubert% for allowing figures in tables. 250*7f2fe78bSCy Schubert\RequirePackage{float} 251*7f2fe78bSCy Schubert% For floating figures in the text. Better to load after float. 252*7f2fe78bSCy Schubert\RequirePackage{wrapfig} 253*7f2fe78bSCy Schubert% Provides \captionof, used once by latex writer (\captionof{figure}) 254*7f2fe78bSCy Schubert\RequirePackage{capt-of} 255*7f2fe78bSCy Schubert% Support hlist directive 256*7f2fe78bSCy Schubert\RequirePackage{multicol} 257*7f2fe78bSCy Schubert 258*7f2fe78bSCy Schubert 259*7f2fe78bSCy Schubert%% GRAPHICS 260*7f2fe78bSCy Schubert% 261*7f2fe78bSCy Schubert% It will always be needed, so let's load it here 262*7f2fe78bSCy Schubert\RequirePackage{graphicx} 263*7f2fe78bSCy Schubert\input{sphinxlatexgraphics.sty} 264*7f2fe78bSCy Schubert 265*7f2fe78bSCy Schubert 266*7f2fe78bSCy Schubert%% FRAMED ENVIRONMENTS 267*7f2fe78bSCy Schubert% 268*7f2fe78bSCy Schubert\input{sphinxlatexadmonitions.sty} 269*7f2fe78bSCy Schubert\input{sphinxlatexliterals.sty} 270*7f2fe78bSCy Schubert\input{sphinxlatexshadowbox.sty} 271*7f2fe78bSCy Schubert 272*7f2fe78bSCy Schubert 273*7f2fe78bSCy Schubert%% CONTAINERS 274*7f2fe78bSCy Schubert% 275*7f2fe78bSCy Schubert\input{sphinxlatexcontainers.sty} 276*7f2fe78bSCy Schubert 277*7f2fe78bSCy Schubert 278*7f2fe78bSCy Schubert%% PYGMENTS 279*7f2fe78bSCy Schubert% stylesheet for highlighting with pygments 280*7f2fe78bSCy Schubert\RequirePackage{sphinxhighlight} 281*7f2fe78bSCy Schubert 282*7f2fe78bSCy Schubert 283*7f2fe78bSCy Schubert%% TABLES 284*7f2fe78bSCy Schubert% 285*7f2fe78bSCy Schubert\input{sphinxlatextables.sty} 286*7f2fe78bSCy Schubert 287*7f2fe78bSCy Schubert 288*7f2fe78bSCy Schubert%% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS 289*7f2fe78bSCy Schubert% 290*7f2fe78bSCy Schubert\input{sphinxlatexnumfig.sty} 291*7f2fe78bSCy Schubert 292*7f2fe78bSCy Schubert 293*7f2fe78bSCy Schubert%% LISTS 294*7f2fe78bSCy Schubert% 295*7f2fe78bSCy Schubert\input{sphinxlatexlists.sty} 296*7f2fe78bSCy Schubert 297*7f2fe78bSCy Schubert 298*7f2fe78bSCy Schubert%% FOOTNOTES 299*7f2fe78bSCy Schubert% 300*7f2fe78bSCy Schubert% Support scopes for footnote numbering 301*7f2fe78bSCy Schubert\newcounter{sphinxscope} 302*7f2fe78bSCy Schubert\newcommand{\sphinxstepscope}{\stepcounter{sphinxscope}} 303*7f2fe78bSCy Schubert% Explicitly numbered footnotes may be referred to, and for this to be 304*7f2fe78bSCy Schubert% clickable we need to have only one target. So we will step this at each 305*7f2fe78bSCy Schubert% explicit footnote and let \thesphinxscope take it into account 306*7f2fe78bSCy Schubert\newcounter{sphinxexplicit} 307*7f2fe78bSCy Schubert\newcommand{\sphinxstepexplicit}{\stepcounter{sphinxexplicit}} 308*7f2fe78bSCy Schubert% Some babel/polyglossia languages fiddle with \@arabic, so let's be extra 309*7f2fe78bSCy Schubert% cautious and redefine \thesphinxscope with \number not \@arabic. 310*7f2fe78bSCy Schubert% Memo: we expect some subtle redefinition of \thesphinxscope to be a part of page 311*7f2fe78bSCy Schubert% scoping for footnotes, when we shall implement it. 312*7f2fe78bSCy Schubert\renewcommand{\thesphinxscope}{\number\value{sphinxscope}.\number\value{sphinxexplicit}} 313*7f2fe78bSCy Schubert\newcommand\sphinxthefootnotemark[2]{% 314*7f2fe78bSCy Schubert % this is used to make reference to an explicitly numbered footnote not on same page 315*7f2fe78bSCy Schubert % #1=label of footnote text, #2=page number where footnote text was printed 316*7f2fe78bSCy Schubert \ifdefined\pagename 317*7f2fe78bSCy Schubert \pagename\space#2, % <- space 318*7f2fe78bSCy Schubert \else 319*7f2fe78bSCy Schubert p. #2, % <- space 320*7f2fe78bSCy Schubert \fi #1% no space 321*7f2fe78bSCy Schubert} 322*7f2fe78bSCy Schubert% support large numbered footnotes in minipage; but this is now obsolete 323*7f2fe78bSCy Schubert% from systematic use of savenotes environment around minipages 324*7f2fe78bSCy Schubert\def\thempfootnote{\arabic{mpfootnote}} 325*7f2fe78bSCy Schubert% This package is needed to support hyperlinked footnotes in tables and 326*7f2fe78bSCy Schubert% framed contents, and to allow code-blocks in footnotes. 327*7f2fe78bSCy Schubert\RequirePackage{sphinxpackagefootnote} 328*7f2fe78bSCy Schubert 329*7f2fe78bSCy Schubert 330*7f2fe78bSCy Schubert%% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS 331*7f2fe78bSCy Schubert% 332*7f2fe78bSCy Schubert\input{sphinxlatexindbibtoc.sty} 333*7f2fe78bSCy Schubert 334*7f2fe78bSCy Schubert 335*7f2fe78bSCy Schubert%% STYLING 336*7f2fe78bSCy Schubert% 337*7f2fe78bSCy Schubert\input{sphinxlatexstylepage.sty} 338*7f2fe78bSCy Schubert\input{sphinxlatexstyleheadings.sty} 339*7f2fe78bSCy Schubert\input{sphinxlatexstyletext.sty} 340*7f2fe78bSCy Schubert 341*7f2fe78bSCy Schubert 342*7f2fe78bSCy Schubert%% MODULE RELEASE DATA AND OBJECT DESCRIPTIONS 343*7f2fe78bSCy Schubert% 344*7f2fe78bSCy Schubert\input{sphinxlatexobjects.sty} 345*7f2fe78bSCy Schubert 346*7f2fe78bSCy Schubert 347*7f2fe78bSCy Schubert% FIXME: this line should be dropped, as "9" is default anyhow. 348*7f2fe78bSCy Schubert\ifdefined\pdfcompresslevel\pdfcompresslevel = 9 \fi 349*7f2fe78bSCy Schubert 350*7f2fe78bSCy Schubert 351*7f2fe78bSCy Schubert\endinput 352