Merge pull request #8790 from jfbu/latex_refactor_style_files

Refactor LaTeX style files
This commit is contained in:
Jean-François B 2021-01-31 14:39:58 +01:00 committed by GitHub
commit 4a85caeffe
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
19 changed files with 820 additions and 613 deletions

View File

@ -31,11 +31,238 @@
}} }}
%% OPTION HANDLING
%
% We first handle options then load packages, but we need \definecolor from
% xcolor/color.
% FIXME: we should \RequirePackage{xcolor} always now
% The xcolor package draws better fcolorboxes around verbatim code
\IfFileExists{xcolor.sty}{
\RequirePackage{xcolor}
}{
\RequirePackage{color}
}
% Handle options via "kvoptions" (later loaded by hyperref anyhow)
\RequirePackage{kvoptions}
\SetupKeyvalOptions{prefix=spx@opt@} % use \spx@opt@ prefix
% Sphinx legacy text layout: 1in margins on all four sides
\ifx\@jsc@uplatextrue\@undefined
\DeclareStringOption[1in]{hmargin}
\DeclareStringOption[1in]{vmargin}
\DeclareStringOption[.5in]{marginpar}
\else
% Japanese standard document classes handle \mag in a special way
\DeclareStringOption[\inv@mag in]{hmargin}
\DeclareStringOption[\inv@mag in]{vmargin}
\DeclareStringOption[.5\dimexpr\inv@mag in\relax]{marginpar}
\fi
\DeclareStringOption[0]{maxlistdepth}% \newcommand*\spx@opt@maxlistdepth{0}
\DeclareStringOption[-1]{numfigreset}
\DeclareBoolOption[false]{nonumfigreset}
\DeclareBoolOption[false]{mathnumfig}
% \DeclareBoolOption[false]{usespart}% not used
% dimensions, we declare the \dimen registers here.
\newdimen\sphinxverbatimsep
\newdimen\sphinxverbatimborder
\newdimen\sphinxshadowsep
\newdimen\sphinxshadowsize
\newdimen\sphinxshadowrule
% \DeclareStringOption is not convenient for the handling of these dimensions
% because we want to assign the values to the corresponding registers. Even if
% we added the code to the key handler it would be too late for the initial
% set-up and we would need to do initial assignments explicitely. We end up
% using \define@key directly.
% verbatim
\sphinxverbatimsep=\fboxsep
\define@key{sphinx}{verbatimsep}{\sphinxverbatimsep\dimexpr #1\relax}
\sphinxverbatimborder=\fboxrule
\define@key{sphinx}{verbatimborder}{\sphinxverbatimborder\dimexpr #1\relax}
% topic boxes
\sphinxshadowsep =5pt
\define@key{sphinx}{shadowsep}{\sphinxshadowsep\dimexpr #1\relax}
\sphinxshadowsize=4pt
\define@key{sphinx}{shadowsize}{\sphinxshadowsize\dimexpr #1\relax}
\sphinxshadowrule=\fboxrule
\define@key{sphinx}{shadowrule}{\sphinxshadowrule\dimexpr #1\relax}
% verbatim
\DeclareBoolOption[true]{verbatimwithframe}
\DeclareBoolOption[true]{verbatimwrapslines}
\DeclareBoolOption[true]{verbatimhintsturnover}
\DeclareBoolOption[true]{inlineliteralwraps}
\DeclareStringOption[t]{literalblockcappos}
\DeclareStringOption[r]{verbatimcontinuedalign}
\DeclareStringOption[r]{verbatimcontinuesalign}
% parsed literal
\DeclareBoolOption[true]{parsedliteralwraps}
% \textvisiblespace for compatibility with fontspec+XeTeX/LuaTeX
\DeclareStringOption[\textcolor{red}{\textvisiblespace}]{verbatimvisiblespace}
\DeclareStringOption % must use braces to hide the brackets
[{\makebox[2\fontcharwd\font`\x][r]{\textcolor{red}{\tiny$\m@th\hookrightarrow$}}}]%
{verbatimcontinued}
% notices/admonitions
% the dimensions for notices/admonitions are kept as macros and assigned to
% \spx@notice@border at time of use, hence \DeclareStringOption is ok for this
\newdimen\spx@notice@border
\DeclareStringOption[0.5pt]{noteborder}
\DeclareStringOption[0.5pt]{hintborder}
\DeclareStringOption[0.5pt]{importantborder}
\DeclareStringOption[0.5pt]{tipborder}
\DeclareStringOption[1pt]{warningborder}
\DeclareStringOption[1pt]{cautionborder}
\DeclareStringOption[1pt]{attentionborder}
\DeclareStringOption[1pt]{dangerborder}
\DeclareStringOption[1pt]{errorborder}
% footnotes
\DeclareStringOption[\mbox{ }]{AtStartFootnote}
% we need a public macro name for direct use in latex file
\newcommand*{\sphinxAtStartFootnote}{\spx@opt@AtStartFootnote}
% no such need for this one, as it is used inside other macros
\DeclareStringOption[\leavevmode\unskip]{BeforeFootnote}
% some font styling.
\DeclareStringOption[\sffamily\bfseries]{HeaderFamily}
% colours
% same problems as for dimensions: we want the key handler to use \definecolor.
% first, some colours with no prefix, for backwards compatibility
\newcommand*{\sphinxDeclareColorOption}[2]{%
\definecolor{#1}#2%
\define@key{sphinx}{#1}{\definecolor{#1}##1}%
}%
\sphinxDeclareColorOption{TitleColor}{{rgb}{0.126,0.263,0.361}}
\sphinxDeclareColorOption{InnerLinkColor}{{rgb}{0.208,0.374,0.486}}
\sphinxDeclareColorOption{OuterLinkColor}{{rgb}{0.216,0.439,0.388}}
\sphinxDeclareColorOption{VerbatimColor}{{rgb}{1,1,1}}
\sphinxDeclareColorOption{VerbatimBorderColor}{{rgb}{0,0,0}}
% now the colours defined with "sphinx" prefix in their names
\newcommand*{\sphinxDeclareSphinxColorOption}[2]{%
% set the initial default
\definecolor{sphinx#1}#2%
% set the key handler. The "value" ##1 must be acceptable by \definecolor.
\define@key{sphinx}{#1}{\definecolor{sphinx#1}##1}%
}%
% Default color chosen to be as in minted.sty LaTeX package!
\sphinxDeclareSphinxColorOption{VerbatimHighlightColor}{{rgb}{0.878,1,1}}
% admonition boxes, "light" style
\sphinxDeclareSphinxColorOption{noteBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{hintBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{importantBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{tipBorderColor}{{rgb}{0,0,0}}
% admonition boxes, "heavy" style
\sphinxDeclareSphinxColorOption{warningBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{cautionBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{attentionBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{dangerBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{errorBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{warningBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{cautionBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{attentionBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{dangerBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{errorBgColor}{{rgb}{1,1,1}}
\DeclareDefaultOption{\@unknownoptionerror}
\ProcessKeyvalOptions*
% don't allow use of maxlistdepth via \sphinxsetup.
\DisableKeyvalOption{sphinx}{maxlistdepth}
\DisableKeyvalOption{sphinx}{numfigreset}
\DisableKeyvalOption{sphinx}{nonumfigreset}
\DisableKeyvalOption{sphinx}{mathnumfig}
% FIXME: this is unrelated to an option, move this elsewhere
% To allow hyphenation of first word in narrow contexts; no option,
% customization to be done via 'preamble' key
\newcommand*\sphinxAtStartPar{\nobreak\hskip\z@skip}
% No need for the \hspace{0pt} trick (\hskip\z@skip) with luatex
\ifdefined\directlua\let\sphinxAtStartPar\@empty\fi
% user interface: options can be changed midway in a document!
\newcommand\sphinxsetup[1]{\setkeys{sphinx}{#1}}
%% MISCELLANEOUS CONTEXT
%
% flag to be set in a framed environment
% (defined here as currently needed by three sphinxlatex....sty files and
% even if not needed if such files are replaced, the definition does no harm)
\newif\ifspx@inframed
%
% \spx@ifcaptionpackage (defined at begin document)
% is needed currently in macros from:
% sphinxlatexliterals.sty (sphinxVerbatim)
% sphinxlatextables.sty (for some macros used in the table templates)
%
% \sphinxcaption is mark-up injected by the tabular and tabulary templates
% it is defined in sphinxlatextables.sty
%
% store the original \caption macro for usage with figures inside longtable
% and tabulary cells. Make sure we get the final \caption in presence of
% caption package, whether the latter was loaded before or after sphinx.
\AtBeginDocument{%
\let\spx@originalcaption\caption
\@ifpackageloaded{caption}
{\let\spx@ifcaptionpackage\@firstoftwo
\caption@AtBeginDocument*{\let\spx@originalcaption\caption}%
% in presence of caption package, drop our own \sphinxcaption whose aim was to
% ensure same width of caption to all kinds of tables (tabular(y), longtable),
% because caption package has its own width (or margin) option
\def\sphinxcaption{\caption}%
}%
{\let\spx@ifcaptionpackage\@secondoftwo}%
}
%% PASS OPTIONS
%
% pass options to hyperref; it must not have been loaded already
\input{sphinxoptionshyperref.sty}
% pass options to geometry; it must not have been loaded already
\input{sphinxoptionsgeometry.sty}
%% COLOR (general)
%
% FIXME: these two should be deprecated
%
% FIXME: \normalcolor should be used and \py@NormalColor never defined
\def\py@NormalColor{\color{black}}
% FIXME: \color{TitleColor} should be used directly and \py@TitleColor
% should never get defined.
\def\py@TitleColor{\color{TitleColor}}
%% PACKAGES %% PACKAGES
% %
% we delay handling of options to after having loaded packages, because % as will be indicated below, secondary style files load some more packages
% of the need to use \definecolor. %
\input{sphinxlatexrequirepackages.sty} % For \text macro (sphinx.util.texescape)
% also for usage of \firstchoice@true(false) in sphinxlatexgraphics.sty
\RequirePackage{amstext}
% It was passed "warn" option from latex template in case it is already loaded
% via some other package before \usepackage{sphinx} in preamble
\RequirePackage{textcomp}
% For the H specifier. Do not \restylefloat{figure}, it breaks Sphinx code
% for allowing figures in tables.
\RequirePackage{float}
% For floating figures in the text. Better to load after float.
\RequirePackage{wrapfig}
% Provides \captionof, used once by latex writer (\captionof{figure})
\RequirePackage{capt-of}
% Support hlist directive
\RequirePackage{multicol}
%% GRAPHICS
%
% It will always be needed, so let's load it here
\RequirePackage{graphicx}
\input{sphinxlatexgraphics.sty}
%% FRAMED ENVIRONMENTS
%
\input{sphinxlatexadmonitions.sty}
\input{sphinxlatexliterals.sty}
\input{sphinxlatexshadowbox.sty}
%% PYGMENTS %% PYGMENTS
@ -54,82 +281,50 @@
}% }%
%% OPTION HANDLING %% TABLES
% %
\input{sphinxlatexoptionhandling.sty} \input{sphinxlatextables.sty}
%% LISTS
%
\input{sphinxlatexmisclists.sty}
%% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS
%
\input{sphinxlatexenvindbibtoc.sty}
%% FIXME STUFF
%
\input{sphinxlatexmiscfixme.sty}
%% PAGE STYLING
%
\input{sphinxlatexstylepage.sty}
%% TITLES
%
\input{sphinxlatexstyleheadings.sty}
%% GRAPHICS
%
\input{sphinxlatexgraphics.sty}
%% CITATIONS
%
\protected\def\sphinxcite{\cite}
%% FOOTNOTES
%
% Support large numbered footnotes in minipage
% But now obsolete due to systematic use of \savenotes/\spewnotes
% when minipages are in use in the various macro definitions next.
\def\thempfootnote{\arabic{mpfootnote}}
%% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS %% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS
% %
\input{sphinxlatexmiscnumbering.sty} \input{sphinxlatexnumfig.sty}
%% LITERAL BLOCKS %% LISTS
% %
\input{sphinxlatexenvliteral.sty} \input{sphinxlatexlists.sty}
%% TOPIC AND CONTENTS BOXES %% FOOTNOTES
% %
\input{sphinxlatexenvshadowbox.sty} % support large numbered footnotes in minipage; but this is now obsolete
% from systematic use of savenotes environment around minipages
\def\thempfootnote{\arabic{mpfootnote}}
% This package is needed to support hyperlinked footnotes in tables and
% framed contents, and to allow code-blocks in footnotes.
\RequirePackage{sphinxpackagefootnote}
%% NOTICES AND ADMONITIONS %% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS
% %
\input{sphinxlatexenvadmonitions.sty} \input{sphinxlatexindbibtoc.sty}
%% PYTHON DOCS MACROS AND ENVIRONMENTS %% STYLING
%
\input{sphinxlatexenvdocs.sty}
%% TEXT STYLING
% %
\input{sphinxlatexstylepage.sty}
\input{sphinxlatexstyleheadings.sty}
\input{sphinxlatexstyletext.sty} \input{sphinxlatexstyletext.sty}
%% MODULE RELEASE DATA AND OBJECT DESCRIPTIONS
%
\input{sphinxlatexobjects.sty}
% FIXME: this line should be dropped, as "9" is default anyhow.
\ifdefined\pdfcompresslevel\pdfcompresslevel = 9 \fi
\endinput \endinput

View File

@ -1,7 +1,33 @@
%% NOTICES AND ADMONITIONS %% NOTICES AND ADMONITIONS
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexenvadmonitions.sty}[2021/01/27 admonitions] \ProvidesFile{sphinxlatexadmonitions.sty}[2021/01/27 admonitions]
% Provides support for this output mark-up from Sphinx latex writer:
%
% - sphinxadmonition (environment)
% This is a dispatch supporting
%
% - note, hint, important, tip (via sphinxlightbox)
% - warning, caution, attention, danger, error (via sphinxheavybox)
%
% Each sphinx<notice name> environment can be redefined by user.
% The defaults are customizable via various colour and dimension
% settings, cf sphinx docs (latex customization).
%
% Requires:
\RequirePackage{framed}% used by sphinxheavybox
%
% Dependencies (they do not need to be defined at time of loading):
% - of course the various colour and dimension options handled via sphinx.sty
% - \sphinxstrong (for sphinxlightbox and sphinxheavybox)
% - dimension register \spx@image@maxheight from sphinxlatexgraphics.sty
% - \savenotes/\spewnotes from sphinxpackagefootnote (for sphinxheavybox)
% Provides: (also in sphinxlatexliterals.sty)
\providecommand*\sphinxvspacefixafterfrenchlists{%
\ifvmode\ifdim\lastskip<\z@ \vskip\parskip\fi\else\par\fi
}
% Some are quite plain % Some are quite plain
% the spx@notice@bordercolor etc are set in the sphinxadmonition environment % the spx@notice@bordercolor etc are set in the sphinxadmonition environment

View File

@ -3,6 +3,30 @@
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexgraphics.sty}[2021/01/27 graphics] \ProvidesFile{sphinxlatexgraphics.sty}[2021/01/27 graphics]
% Provides support for this output mark-up from Sphinx latex writer:
%
% - macros:
%
% - \sphinxfigcaption
% - \sphinxincludegraphics
%
% - environments:
%
% - sphinxfigure-in-table
%
% May change:
%
% - \sphinxcaption (at begin document)
%
% Also provides:
%
% - \sphinxsafeincludegraphics (default of \sphinxincludegraphics since 2.0)
% - \spx@image@maxheight dimension (used by sphinxlatexadmonitions.sty)
%
% Requires:
% \RequirePackage{graphicx}% done in sphinx.sty
\RequirePackage{amstext}% needed for \firstchoice@true(false)
% \sphinxincludegraphics resizes images larger than the TeX \linewidth (which % \sphinxincludegraphics resizes images larger than the TeX \linewidth (which
% is adjusted in indented environments), or taller than a certain maximal % is adjusted in indented environments), or taller than a certain maximal
% height (usually \textheight and this is reduced in the environments which use % height (usually \textheight and this is reduced in the environments which use
@ -85,21 +109,6 @@
\sphinxsetvskipsforfigintablecaption \sphinxsetvskipsforfigintablecaption
\begin{minipage}{#1}% \begin{minipage}{#1}%
}{\end{minipage}} }{\end{minipage}}
% store the original \caption macro for usage with figures inside longtable
% and tabulary cells. Make sure we get the final \caption in presence of
% caption package, whether the latter was loaded before or after sphinx.
\AtBeginDocument{%
\let\spx@originalcaption\caption
\@ifpackageloaded{caption}
{\let\spx@ifcaptionpackage\@firstoftwo
\caption@AtBeginDocument*{\let\spx@originalcaption\caption}%
% in presence of caption package, drop our own \sphinxcaption whose aim was to
% ensure same width of caption to all kinds of tables (tabular(y), longtable),
% because caption package has its own width (or margin) option
\def\sphinxcaption{\caption}%
}%
{\let\spx@ifcaptionpackage\@secondoftwo}%
}
% tabulary expands twice contents, we need to prevent double counter stepping % tabulary expands twice contents, we need to prevent double counter stepping
\newcommand*\sphinxfigcaption \newcommand*\sphinxfigcaption
{\ifx\equation$%$% this is trick to identify tabulary first pass {\ifx\equation$%$% this is trick to identify tabulary first pass

View File

@ -1,7 +1,26 @@
%% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS %% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexenvindbibtoc.sty}[2021/01/27 index, bib., toc] \ProvidesFile{sphinxlatexindbibtoc.sty}[2021/01/27 index, bib., toc]
% Provides support for this output mark-up from Sphinx latex writer:
%
% - environments: (backup defaults or get redefined)
%
% - sphinxtheindex (direct mark-up or via python.ist or sphinx.xdy)
% - sphinxthebibliography
%
% - macros: (defines defaults)
%
% - \sphinxmaketitle
% - \sphinxtableofcontents
% - \sphinxnonalphabeticalgroupname
% - \sphinxsymbolsname
% - \sphinxnumbersname
% - \sphinxcite
%
% Requires:
\RequirePackage{makeidx}
% fix the double index and bibliography on the table of contents % fix the double index and bibliography on the table of contents
% in jsclasses (Japanese standard document classes) % in jsclasses (Japanese standard document classes)
@ -44,4 +63,7 @@
\newcommand*{\sphinxsymbolsname}{} \newcommand*{\sphinxsymbolsname}{}
\newcommand*{\sphinxnumbersname}{} \newcommand*{\sphinxnumbersname}{}
\protected\def\sphinxcite{\cite}
\endinput \endinput

View File

@ -1,7 +1,12 @@
%% ALPHANUMERIC LIST ITEMS %% ALPHANUMERIC LIST ITEMS
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexmisclists.sty}[2021/01/27 lists] \ProvidesFile{sphinxlatexlists.sty}[2021/01/27 lists]
% Provides support for this output mark-up from Sphinx latex writer:
% - \sphinxsetlistlabels
% Dependencies: the \spx@opt@maxlistdepth from sphinx.sty
\newcommand\sphinxsetlistlabels[5] \newcommand\sphinxsetlistlabels[5]
{% #1 = style, #2 = enum, #3 = enumnext, #4 = prefix, #5 = suffix {% #1 = style, #2 = enum, #3 = enumnext, #4 = prefix, #5 = suffix

View File

@ -1,7 +1,64 @@
%% LITERAL BLOCKS %% LITERAL BLOCKS
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexenvliteral.sty}[2021/01/27 code-blocks and parsed literals] \ProvidesFile{sphinxlatexliterals.sty}[2021/01/27 code-blocks and parsed literals]
% Provides support for this output mark-up from Sphinx latex writer:
%
% - macros:
% - \sphinxLiteralBlockLabel
% - \sphinxSetupCaptionForVerbatim
% - \sphinxSetupCodeBlockInFootnote
% - \sphinxhref
% - \sphinxnolinkurl
% - \sphinxresetverbatimhllines
% - \sphinxunactivateextrasandspace
% - \sphinxupquote
% - \sphinxurl
%
% - environments:
% - sphinxVerbatim
% - sphinxVerbatimintable
% - sphinxalltt
%
% Dependency:
%
% - hyperref (for \phantomsection and \capstart) (loaded later)
%
% Executes \RequirePackage for:
%
% - framed
% - fancyvrb
% - alltt
% - upquote
% - needspace
% also in sphinxlatexadmonitions.sty:
% This is a workaround to a "feature" of French lists, when literal block
% follows immediately; usable generally (does only \par then), a priori...
\providecommand*\sphinxvspacefixafterfrenchlists{%
\ifvmode\ifdim\lastskip<\z@ \vskip\parskip\fi\else\par\fi
}
% For framing allowing pagebreaks
\RequirePackage{framed}
% For source code
% MEMO: fancyvrb is used mainly to
% 1- control horizontal and vertical spacing
% 2- optional line numbering
% 3- optional line emphasizing
% 4- while still allowing expansion of Pygments latex mark-up
% Other aspects such as framing, caption handling, codeline wrapping are
% added on top of it. We should stop using fancyvrb and implement
% 1, 2, 3, 4 by own Sphinx fully native Verbatim. This would allow to solve
% limitations with wrapped long code line not allowing page break.
\RequirePackage{fancyvrb}
% For parsed-literal blocks.
\RequirePackage{alltt}
% Display "real" single quotes in literal blocks.
\RequirePackage{upquote}
% Skip to next page if not enough space at bottom
\RequirePackage{needspace}
% Based on use of "fancyvrb.sty"'s Verbatim. % Based on use of "fancyvrb.sty"'s Verbatim.
% - with framing allowing page breaks ("framed.sty") % - with framing allowing page breaks ("framed.sty")
@ -9,6 +66,12 @@
% - with possibly of a top caption, non-separable by pagebreak. % - with possibly of a top caption, non-separable by pagebreak.
% - and usable inside tables or footnotes ("sphinxpackagefootnote.sty"). % - and usable inside tables or footnotes ("sphinxpackagefootnote.sty").
% for emphasizing lines
\define@key{FV}{hllines}{\def\sphinx@verbatim@checkifhl##1{\in@{, ##1,}{#1}}}
% sphinxVerbatim must be usable by third party without requiring hllines set-up
\def\sphinxresetverbatimhllines{\def\sphinx@verbatim@checkifhl##1{\in@false}}
\sphinxresetverbatimhllines
% Prior to Sphinx 1.5, \Verbatim and \endVerbatim were modified by Sphinx. % Prior to Sphinx 1.5, \Verbatim and \endVerbatim were modified by Sphinx.
% The aliases defined here are used in sphinxVerbatim environment and can % The aliases defined here are used in sphinxVerbatim environment and can
% serve as hook-points with no need to modify \Verbatim itself. % serve as hook-points with no need to modify \Verbatim itself.
@ -25,7 +88,6 @@
% analogous to \listoffigures, but for the code listings (foo = chosen title.) % analogous to \listoffigures, but for the code listings (foo = chosen title.)
\newcommand*{\ext@literalblock}{lol} \newcommand*{\ext@literalblock}{lol}
\newif\ifspx@inframed % flag set if we are already in a framed environment
% if forced use of minipage encapsulation is needed (e.g. table cells) % if forced use of minipage encapsulation is needed (e.g. table cells)
\newif\ifsphinxverbatimwithminipage \sphinxverbatimwithminipagefalse \newif\ifsphinxverbatimwithminipage \sphinxverbatimwithminipagefalse
@ -170,11 +232,6 @@
% This box to measure contents if nested as inner \MakeFramed requires then % This box to measure contents if nested as inner \MakeFramed requires then
% minipage encapsulation but too long contents then break outer \MakeFramed % minipage encapsulation but too long contents then break outer \MakeFramed
\newbox\sphinxVerbatim@ContentsBox \newbox\sphinxVerbatim@ContentsBox
% This is a workaround to a "feature" of French lists, when literal block
% follows immediately; usable generally (does only \par then), a priori...
\newcommand*\sphinxvspacefixafterfrenchlists{%
\ifvmode\ifdim\lastskip<\z@ \vskip\parskip\fi\else\par\fi
}
% Holder macro for labels of literal blocks. Set-up by LaTeX writer. % Holder macro for labels of literal blocks. Set-up by LaTeX writer.
\newcommand*\sphinxLiteralBlockLabel {} \newcommand*\sphinxLiteralBlockLabel {}
\newcommand*\sphinxSetupCaptionForVerbatim [1] \newcommand*\sphinxSetupCaptionForVerbatim [1]
@ -459,6 +516,10 @@
\fi } \fi }
{\end{alltt}} {\end{alltt}}
%% INLINE MARK-UP
%
% Protect \href's first argument in contexts such as sphinxalltt (or % Protect \href's first argument in contexts such as sphinxalltt (or
% \sphinxcode). Sphinx uses \#, \%, \& ... always inside \sphinxhref. % \sphinxcode). Sphinx uses \#, \%, \& ... always inside \sphinxhref.
\protected\def\sphinxhref#1#2{{% \protected\def\sphinxhref#1#2{{%
@ -477,4 +538,49 @@
\endlinechar\m@ne\scantokens{\nolinkurl{#1}}% \endlinechar\m@ne\scantokens{\nolinkurl{#1}}%
}} }}
% \sphinxupquote
% to obtain straight quotes we execute \@noligs as patched by upquote, and
% \scantokens is needed in cases where it would be too late for the macro to
% first set catcodes and then fetch its argument. We also make the contents
% breakable at non-escaped . , ; ? ! / using \sphinxbreaksviaactive,
% and also at \ character (which is escaped to \textbackslash{}).
\protected\def\sphinxtextbackslashbreakbefore
{\discretionary{}{\sphinxafterbreak\sphinx@textbackslash}{\sphinx@textbackslash}}
\protected\def\sphinxtextbackslashbreakafter
{\discretionary{\sphinx@textbackslash}{\sphinxafterbreak}{\sphinx@textbackslash}}
\let\sphinxtextbackslash\sphinxtextbackslashbreakafter
% the macro must be protected if it ends up used in moving arguments,
% in 'alltt' \@noligs is done already, and the \scantokens must be avoided.
\protected\def\sphinxupquote#1{{\def\@tempa{alltt}%
\ifx\@tempa\@currenvir\else
\ifspx@opt@inlineliteralwraps
% break at . , ; ? ! /
\sphinxbreaksviaactive
% break also at \
\let\sphinx@textbackslash\textbackslash
\let\textbackslash\sphinxtextbackslash
% by default, no continuation symbol on next line but may be added
\let\sphinxafterbreak\sphinxafterbreakofinlineliteral
% do not overwrite the comma set-up
\let\verbatim@nolig@list\sphinx@literal@nolig@list
\fi
% fix a space-gobbling issue due to LaTeX's original \do@noligs
% TODO: using \@noligs as patched by upquote.sty is now unneeded because
% either ` and ' are escaped (non-unicode engines) or they don't build
% ligatures (unicode engines). Thus remove this and unify handling of `, <, >,
% ' and - with the characters . , ; ? ! / as handled via
% \sphinxbreaksviaactive.
% Hence \sphinx@do@noligs will be removed, or rather replaced with code
% inserting discretionaries, as they allow a continuation symbol on start of
% next line to achieve common design with code-blocks.
\let\do@noligs\sphinx@do@noligs
\@noligs\endlinechar\m@ne\everyeof{}% (<- in case inside \sphinxhref)
\expandafter\scantokens
\fi {{#1}}}}% extra brace pair to fix end-space gobbling issue...
\def\sphinx@do@noligs #1{\catcode`#1\active\begingroup\lccode`\~`#1\relax
\lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1 }}}
\def\sphinx@literal@nolig@list {\do\`\do\<\do\>\do\'\do\-}%
\let\sphinxafterbreakofinlineliteral\empty
\endinput \endinput

View File

@ -1,18 +0,0 @@
%% FIXME STUFF attention, changes here may necessitate changes elsewhere
%
% change this info string if making any custom modification
\ProvidesFile{sphinxlatexmiscfixme.sty}[2021/01/27 latex to be removed at some point]
%% COLOR (general)
%
% FIXME: \normalcolor should probably be used in place of \py@NormalColor
% elsewhere, and \py@NormalColor should never be defined. \normalcolor
% switches to the colour from last \color call in preamble.
\def\py@NormalColor{\color{black}}
% FIXME: it is probably better to use \color{TitleColor}, as TitleColor
% can be customized from 'sphinxsetup', and drop usage of \py@TitleColor
\def\py@TitleColor{\color{TitleColor}}
% FIXME: this line should be dropped, as "9" is default anyhow.
\ifdefined\pdfcompresslevel\pdfcompresslevel = 9 \fi
\endinput

View File

@ -1,8 +1,15 @@
%% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS %% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexmiscnumbering.sty}[2021/01/27 numbering] \ProvidesFile{sphinxlatexnumfig.sty}[2021/01/27 numbering]
% Requires: remreset (old LaTeX only)
% relates to numfig and numfig_secnum_depth configuration variables
% LaTeX 2018-04-01 and later provides \@removefromreset
\ltx@ifundefined{@removefromreset}
{\RequirePackage{remreset}}
{}% avoid warning
% Everything is delayed to \begin{document} to allow hyperref patches into % Everything is delayed to \begin{document} to allow hyperref patches into
% \newcounter to solve duplicate label problems for internal hyperlinks to % \newcounter to solve duplicate label problems for internal hyperlinks to
% code listings (literalblock counter). User or extension re-definitions of % code listings (literalblock counter). User or extension re-definitions of

View File

@ -1,9 +1,22 @@
%% PYTHON DOCS MACROS AND ENVIRONMENTS %% MODULE RELEASE DATA AND OBJECT DESCRIPTIONS
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexenvdocs.sty}[2021/01/27 documentation environments] \ProvidesFile{sphinxlatexobjects.sty}[2021/01/27 documentation environments]
% (some macros here used by \maketitle in sphinxmanual.cls and sphinxhowto.cls) % Provides support for this output mark-up from Sphinx latex writer:
%
% - environments
%
% - fulllineitems
% - productionlist
% - optionlist
% - DUlineblock (also "lineblock")
%
% - macros
%
% - \DUrole
% - various legacy support macros related to author and release
% data of documented objects and modules.
% \moduleauthor{name}{email} % \moduleauthor{name}{email}
\newcommand{\moduleauthor}[2]{} \newcommand{\moduleauthor}[2]{}

View File

@ -1,139 +0,0 @@
%% OPTION HANDLING
%
% change this info string if making any custom modification
\ProvidesFile{sphinxlatexoptionhandling.sty}[2021/01/27 option handling]
% Handle options via "kvoptions" (later loaded by hyperref anyhow)
\RequirePackage{kvoptions}
\SetupKeyvalOptions{prefix=spx@opt@} % use \spx@opt@ prefix
% Sphinx legacy text layout: 1in margins on all four sides
\ifx\@jsc@uplatextrue\@undefined
\DeclareStringOption[1in]{hmargin}
\DeclareStringOption[1in]{vmargin}
\DeclareStringOption[.5in]{marginpar}
\else
% Japanese standard document classes handle \mag in a special way
\DeclareStringOption[\inv@mag in]{hmargin}
\DeclareStringOption[\inv@mag in]{vmargin}
\DeclareStringOption[.5\dimexpr\inv@mag in\relax]{marginpar}
\fi
\DeclareStringOption[0]{maxlistdepth}% \newcommand*\spx@opt@maxlistdepth{0}
\DeclareStringOption[-1]{numfigreset}
\DeclareBoolOption[false]{nonumfigreset}
\DeclareBoolOption[false]{mathnumfig}
% \DeclareBoolOption[false]{usespart}% not used
% dimensions, we declare the \dimen registers here.
\newdimen\sphinxverbatimsep
\newdimen\sphinxverbatimborder
\newdimen\sphinxshadowsep
\newdimen\sphinxshadowsize
\newdimen\sphinxshadowrule
% \DeclareStringOption is not convenient for the handling of these dimensions
% because we want to assign the values to the corresponding registers. Even if
% we added the code to the key handler it would be too late for the initial
% set-up and we would need to do initial assignments explicitely. We end up
% using \define@key directly.
% verbatim
\sphinxverbatimsep=\fboxsep
\define@key{sphinx}{verbatimsep}{\sphinxverbatimsep\dimexpr #1\relax}
\sphinxverbatimborder=\fboxrule
\define@key{sphinx}{verbatimborder}{\sphinxverbatimborder\dimexpr #1\relax}
% topic boxes
\sphinxshadowsep =5pt
\define@key{sphinx}{shadowsep}{\sphinxshadowsep\dimexpr #1\relax}
\sphinxshadowsize=4pt
\define@key{sphinx}{shadowsize}{\sphinxshadowsize\dimexpr #1\relax}
\sphinxshadowrule=\fboxrule
\define@key{sphinx}{shadowrule}{\sphinxshadowrule\dimexpr #1\relax}
% verbatim
\DeclareBoolOption[true]{verbatimwithframe}
\DeclareBoolOption[true]{verbatimwrapslines}
\DeclareBoolOption[true]{verbatimhintsturnover}
\DeclareBoolOption[true]{inlineliteralwraps}
\DeclareStringOption[t]{literalblockcappos}
\DeclareStringOption[r]{verbatimcontinuedalign}
\DeclareStringOption[r]{verbatimcontinuesalign}
% parsed literal
\DeclareBoolOption[true]{parsedliteralwraps}
% \textvisiblespace for compatibility with fontspec+XeTeX/LuaTeX
\DeclareStringOption[\textcolor{red}{\textvisiblespace}]{verbatimvisiblespace}
\DeclareStringOption % must use braces to hide the brackets
[{\makebox[2\fontcharwd\font`\x][r]{\textcolor{red}{\tiny$\m@th\hookrightarrow$}}}]%
{verbatimcontinued}
% notices/admonitions
% the dimensions for notices/admonitions are kept as macros and assigned to
% \spx@notice@border at time of use, hence \DeclareStringOption is ok for this
\newdimen\spx@notice@border
\DeclareStringOption[0.5pt]{noteborder}
\DeclareStringOption[0.5pt]{hintborder}
\DeclareStringOption[0.5pt]{importantborder}
\DeclareStringOption[0.5pt]{tipborder}
\DeclareStringOption[1pt]{warningborder}
\DeclareStringOption[1pt]{cautionborder}
\DeclareStringOption[1pt]{attentionborder}
\DeclareStringOption[1pt]{dangerborder}
\DeclareStringOption[1pt]{errorborder}
% footnotes
\DeclareStringOption[\mbox{ }]{AtStartFootnote}
% we need a public macro name for direct use in latex file
\newcommand*{\sphinxAtStartFootnote}{\spx@opt@AtStartFootnote}
% no such need for this one, as it is used inside other macros
\DeclareStringOption[\leavevmode\unskip]{BeforeFootnote}
% some font styling.
\DeclareStringOption[\sffamily\bfseries]{HeaderFamily}
% colours
% same problems as for dimensions: we want the key handler to use \definecolor.
% first, some colours with no prefix, for backwards compatibility
\newcommand*{\sphinxDeclareColorOption}[2]{%
\definecolor{#1}#2%
\define@key{sphinx}{#1}{\definecolor{#1}##1}%
}%
\sphinxDeclareColorOption{TitleColor}{{rgb}{0.126,0.263,0.361}}
\sphinxDeclareColorOption{InnerLinkColor}{{rgb}{0.208,0.374,0.486}}
\sphinxDeclareColorOption{OuterLinkColor}{{rgb}{0.216,0.439,0.388}}
\sphinxDeclareColorOption{VerbatimColor}{{rgb}{1,1,1}}
\sphinxDeclareColorOption{VerbatimBorderColor}{{rgb}{0,0,0}}
% now the colours defined with "sphinx" prefix in their names
\newcommand*{\sphinxDeclareSphinxColorOption}[2]{%
% set the initial default
\definecolor{sphinx#1}#2%
% set the key handler. The "value" ##1 must be acceptable by \definecolor.
\define@key{sphinx}{#1}{\definecolor{sphinx#1}##1}%
}%
% Default color chosen to be as in minted.sty LaTeX package!
\sphinxDeclareSphinxColorOption{VerbatimHighlightColor}{{rgb}{0.878,1,1}}
% admonition boxes, "light" style
\sphinxDeclareSphinxColorOption{noteBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{hintBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{importantBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{tipBorderColor}{{rgb}{0,0,0}}
% admonition boxes, "heavy" style
\sphinxDeclareSphinxColorOption{warningBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{cautionBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{attentionBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{dangerBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{errorBorderColor}{{rgb}{0,0,0}}
\sphinxDeclareSphinxColorOption{warningBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{cautionBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{attentionBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{dangerBgColor}{{rgb}{1,1,1}}
\sphinxDeclareSphinxColorOption{errorBgColor}{{rgb}{1,1,1}}
\DeclareDefaultOption{\@unknownoptionerror}
\ProcessKeyvalOptions*
% don't allow use of maxlistdepth via \sphinxsetup.
\DisableKeyvalOption{sphinx}{maxlistdepth}
\DisableKeyvalOption{sphinx}{numfigreset}
\DisableKeyvalOption{sphinx}{nonumfigreset}
\DisableKeyvalOption{sphinx}{mathnumfig}
% To allow hyphenation of first word in narrow contexts; no option,
% customization to be done via 'preamble' key
\newcommand*\sphinxAtStartPar{\nobreak\hskip\z@skip}
% No need for the \hspace{0pt} trick (\hskip\z@skip) with luatex
\ifdefined\directlua\let\sphinxAtStartPar\@empty\fi
% user interface: options can be changed midway in a document!
\newcommand\sphinxsetup[1]{\setkeys{sphinx}{#1}}
\endinput

View File

@ -1,242 +0,0 @@
%% PACKAGES
%
% change this info string if making any custom modification
\ProvidesFile{sphinxlatexrequirepackages.sty}[2021/01/27 packages]
\RequirePackage{graphicx}
\@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
% for \text macro and \iffirstchoice@ conditional even if amsmath not loaded
\RequirePackage{amstext}
\RequirePackage{textcomp}% "warn" option issued from template
\RequirePackage[nobottomtitles*]{titlesec}
\@ifpackagelater{titlesec}{2016/03/15}%
{\@ifpackagelater{titlesec}{2016/03/21}%
{}%
{\newif\ifsphinx@ttlpatch@ok
\IfFileExists{etoolbox.sty}{%
\RequirePackage{etoolbox}%
\patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}%
{\sphinx@ttlpatch@oktrue}{}%
\ifsphinx@ttlpatch@ok
\patchcmd{\ttlh@hang}{\noindent}{}{}{\sphinx@ttlpatch@okfalse}%
\fi
}{}%
\ifsphinx@ttlpatch@ok
\typeout{^^J Package Sphinx Info: ^^J
**** titlesec 2.10.1 successfully patched for bugfix ****^^J}%
\else
\AtEndDocument{\PackageWarningNoLine{sphinx}{^^J%
******** titlesec 2.10.1 has a bug, (section numbers disappear) ......|^^J%
******** and Sphinx could not patch it, perhaps because your local ...|^^J%
******** copy is already fixed without a changed release date. .......|^^J%
******** If not, you must update titlesec! ...........................|}}%
\fi
}%
}{}
\RequirePackage{tabulary}
% tabulary has a bug with its re-definition of \multicolumn in its first pass
% which is not \long. But now Sphinx does not use LaTeX's \multicolumn but its
% own macro. Hence we don't even need to patch tabulary. See
% sphinxpackagemulticell.sty
% X or S (Sphinx) may have meanings if some table package is loaded hence
% \X was chosen to avoid possibility of conflict
\newcolumntype{\X}[2]{p{\dimexpr
(\linewidth-\arrayrulewidth)*#1/#2-\tw@\tabcolsep-\arrayrulewidth\relax}}
\newcolumntype{\Y}[1]{p{\dimexpr
#1\dimexpr\linewidth-\arrayrulewidth\relax-\tw@\tabcolsep-\arrayrulewidth\relax}}
% using here T (for Tabulary) feels less of a problem than the X could be
\newcolumntype{T}{J}%
% For tables allowing pagebreaks
\RequirePackage{longtable}
% User interface to set-up whitespace before and after tables:
\newcommand*\sphinxtablepre {0pt}%
\newcommand*\sphinxtablepost{\medskipamount}%
% Space from caption baseline to top of table or frame of literal-block
\newcommand*\sphinxbelowcaptionspace{.5\sphinxbaselineskip}%
% as one can not use \baselineskip from inside longtable (it is zero there)
% we need \sphinxbaselineskip, which defaults to \baselineskip
\def\sphinxbaselineskip{\baselineskip}%
% The following is to ensure that, whether tabular(y) or longtable:
% - if a caption is on top of table:
% a) the space between its last baseline and the top rule of table is
% exactly \sphinxbelowcaptionspace
% b) the space from last baseline of previous text to first baseline of
% caption is exactly \parskip+\baselineskip+ height of a strut.
% c) the caption text will wrap at width \LTcapwidth (4in)
% - make sure this works also if "caption" package is loaded by user
% (with its width or margin option taking place of \LTcapwidth role)
% TODO: obtain same for caption of literal block: a) & c) DONE, b) TO BE DONE
%
% To modify space below such top caption, adjust \sphinxbelowcaptionspace
% To add or remove space above such top caption, adjust \sphinxtablepre:
% notice that \abovecaptionskip, \belowcaptionskip, \LTpre are **ignored**
% A. Table with longtable
\def\sphinxatlongtablestart
{\par
\vskip\parskip
\vskip\dimexpr\sphinxtablepre\relax % adjust vertical position
\vbox{}% get correct baseline from above
\LTpre\z@skip\LTpost\z@skip % set to zero longtable's own skips
\edef\sphinxbaselineskip{\dimexpr\the\dimexpr\baselineskip\relax\relax}%
}%
% Compatibility with caption package
\def\sphinxthelongtablecaptionisattop{%
\spx@ifcaptionpackage{\noalign{\vskip-\belowcaptionskip}}{}%
}%
% Achieves exactly \sphinxbelowcaptionspace below longtable caption
\def\sphinxlongtablecapskipadjust
{\dimexpr-\dp\strutbox
-\spx@ifcaptionpackage{\abovecaptionskip}{\sphinxbaselineskip}%
+\sphinxbelowcaptionspace\relax}%
\def\sphinxatlongtableend{\@nobreakfalse % latex3/latex2e#173
\prevdepth\z@\vskip\sphinxtablepost\relax}%
% B. Table with tabular or tabulary
\def\sphinxattablestart{\par\vskip\dimexpr\sphinxtablepre\relax}%
\let\sphinxattableend\sphinxatlongtableend
% This is used by tabular and tabulary templates
\newcommand*\sphinxcapstartof[1]{%
\vskip\parskip
\vbox{}% force baselineskip for good positioning by capstart of hyperanchor
% hyperref puts the anchor 6pt above this baseline; in case of caption
% this baseline will be \ht\strutbox above first baseline of caption
\def\@captype{#1}%
\capstart
% move back vertically, as tabular (or its caption) will compensate
\vskip-\baselineskip\vskip-\parskip
}%
\def\sphinxthecaptionisattop{% locate it after \sphinxcapstartof
\spx@ifcaptionpackage
{\caption@setposition{t}%
\vskip\baselineskip\vskip\parskip % undo those from \sphinxcapstartof
\vskip-\belowcaptionskip % anticipate caption package skip
% caption package uses a \vbox, not a \vtop, so "single line" case
% gives different result from "multi-line" without this:
\nointerlineskip
}%
{}%
}%
\def\sphinxthecaptionisatbottom{% (not finalized; for template usage)
\spx@ifcaptionpackage{\caption@setposition{b}}{}%
}%
% The aim of \sphinxcaption is to apply to tabular(y) the maximal width
% of caption as done by longtable
\def\sphinxtablecapwidth{\LTcapwidth}%
\newcommand\sphinxcaption{\@dblarg\spx@caption}%
\long\def\spx@caption[#1]#2{%
\noindent\hb@xt@\linewidth{\hss
\vtop{\@tempdima\dimexpr\sphinxtablecapwidth\relax
% don't exceed linewidth for the caption width
\ifdim\@tempdima>\linewidth\hsize\linewidth\else\hsize\@tempdima\fi
% longtable ignores \abovecaptionskip/\belowcaptionskip, so do the same here
\abovecaptionskip\sphinxabovecaptionskip % \z@skip
\belowcaptionskip\sphinxbelowcaptionskip % \z@skip
\caption[{#1}]%
{\strut\ignorespaces#2\ifhmode\unskip\@finalstrut\strutbox\fi}%
}\hss}%
\par\prevdepth\dp\strutbox
}%
\def\sphinxabovecaptionskip{\z@skip}% Do not use! Flagged for removal
\def\sphinxbelowcaptionskip{\z@skip}% Do not use! Flagged for removal
% This wrapper of \abovecaptionskip is used in sphinxVerbatim for top
% caption, and with another value in sphinxVerbatimintable
% TODO: To unify space above caption of a code-block with the one above
% caption of a table/longtable, \abovecaptionskip must not be used
% This auxiliary will get renamed and receive a different meaning
% in future.
\def\spx@abovecaptionskip{\abovecaptionskip}%
% Achieve \sphinxbelowcaptionspace below a caption located above a tabular
% or a tabulary
\newcommand\sphinxaftertopcaption
{%
\spx@ifcaptionpackage
{\par\prevdepth\dp\strutbox\nobreak\vskip-\abovecaptionskip}{\nobreak}%
\vskip\dimexpr\sphinxbelowcaptionspace\relax
\vskip-\baselineskip\vskip-\parskip
}%
% varwidth is crucial for our handling of general contents in merged cells
\RequirePackage{varwidth}
% but addition of a compatibility patch with hyperref is needed
% (tested with varwidth v 0.92 Mar 2009)
\AtBeginDocument {%
\let\@@vwid@Hy@raisedlink\Hy@raisedlink
\long\def\@vwid@Hy@raisedlink#1{\@vwid@wrap{\@@vwid@Hy@raisedlink{#1}}}%
\edef\@vwid@setup{%
\let\noexpand\Hy@raisedlink\noexpand\@vwid@Hy@raisedlink % HYPERREF !
\unexpanded\expandafter{\@vwid@setup}}%
}%
% Homemade package to handle merged cells
\RequirePackage{sphinxpackagemulticell}
\RequirePackage{makeidx}
% For framing code-blocks and warning type notices, and shadowing topics
\RequirePackage{framed}
% The xcolor package draws better fcolorboxes around verbatim code
\IfFileExists{xcolor.sty}{
\RequirePackage{xcolor}
}{
\RequirePackage{color}
}
% For highlighted code.
\RequirePackage{fancyvrb}
\define@key{FV}{hllines}{\def\sphinx@verbatim@checkifhl##1{\in@{, ##1,}{#1}}}
% sphinxVerbatim must be usable by third party without requiring hllines set-up
\def\sphinxresetverbatimhllines{\def\sphinx@verbatim@checkifhl##1{\in@false}}
\sphinxresetverbatimhllines
% For hyperlinked footnotes in tables; also for gathering footnotes from
% topic and warning blocks. Also to allow code-blocks in footnotes.
\RequirePackage{sphinxpackagefootnote}
% For the H specifier. Do not \restylefloat{figure}, it breaks Sphinx code
% for allowing figures in tables.
\RequirePackage{float}
% For floating figures in the text. Better to load after float.
\RequirePackage{wrapfig}
% Separate paragraphs by space by default.
\IfFileExists{parskip-2001-04-09.sty}% since September 2018 TeXLive update
% new parskip.sty, but let it rollback to old one.
% hopefully TeX installation not broken and LaTeX kernel not too old
{\RequirePackage{parskip}[=v1]}
% standard one from 1989. Admittedly \section of article/book gives possibly
% anomalous spacing, but we can't require September 2018 release for some time.
{\RequirePackage{parskip}}
% For parsed-literal blocks.
\RequirePackage{alltt}
% Display "real" single quotes in literal blocks.
\RequirePackage{upquote}
% control caption around literal-block
\RequirePackage{capt-of}
\RequirePackage{needspace}
% LaTeX 2018-04-01 and later provides \@removefromreset
\ltx@ifundefined{@removefromreset}
{\RequirePackage{remreset}}
{}% avoid warning
% To support hlist directive
\RequirePackage{multicol}
% to make pdf with correct encoded bookmarks in Japanese
% this should precede the hyperref package
\ifx\kanjiskip\@undefined
% for non-Japanese: make sure bookmarks are ok also with lualatex
\PassOptionsToPackage{pdfencoding=unicode}{hyperref}
\else
\RequirePackage{atbegshi}
\ifx\ucs\@undefined
\ifnum 42146=\euc"A4A2
\AtBeginShipoutFirst{\special{pdf:tounicode EUC-UCS2}}
\else
\AtBeginShipoutFirst{\special{pdf:tounicode 90ms-RKSJ-UCS2}}
\fi
\else
\AtBeginShipoutFirst{\special{pdf:tounicode UTF8-UCS2}}
\fi
\fi
\ifx\@jsc@uplatextrue\@undefined\else
\PassOptionsToPackage{setpagesize=false}{hyperref}
\fi
% These options can be overriden inside 'hyperref' key
% or by later use of \hypersetup.
\PassOptionsToPackage{colorlinks,breaklinks,%
linkcolor=InnerLinkColor,filecolor=OuterLinkColor,%
menucolor=OuterLinkColor,urlcolor=OuterLinkColor,%
citecolor=InnerLinkColor}{hyperref}
\endinput

View File

@ -1,7 +1,21 @@
%% TOPIC AND CONTENTS BOXES %% TOPIC AND CONTENTS BOXES
% %
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexenvshadowbox.sty}[2021/01/27 topic and contents boxes] \ProvidesFile{sphinxlatexshadowbox.sty}[2021/01/27 sphinxShadowBox]
% Provides support for this output mark-up from Sphinx latex writer:
%
% - sphinxShadowBox (environment)
%
% Dependencies (they do not need to be defined at time of loading):
%
% - of course the various colour and dimension options handled via sphinx.sty
% - dimension register \spx@image@maxheight from sphinxlatexgraphics.sty
% - \savenotes/\spewnotes from sphinxpackagefootnote
% - \ifspx@inframed defined in sphinx.sty
%
% Requires:
\RequirePackage{framed}
% Again based on use of "framed.sty", this allows breakable framed boxes. % Again based on use of "framed.sty", this allows breakable framed boxes.
\long\def\spx@ShadowFBox#1{% \long\def\spx@ShadowFBox#1{%

View File

@ -1,8 +1,50 @@
% change this info string if making any custom modification
%% TITLES %% TITLES
% %
% change this info string if making any custom modification
\ProvidesFile{sphinxlatexstyleheadings.sty}[2021/01/27 headings] \ProvidesFile{sphinxlatexstyleheadings.sty}[2021/01/27 headings]
\RequirePackage[nobottomtitles*]{titlesec}
\@ifpackagelater{titlesec}{2016/03/15}%
{\@ifpackagelater{titlesec}{2016/03/21}%
{}%
{\newif\ifsphinx@ttlpatch@ok
\IfFileExists{etoolbox.sty}{%
\RequirePackage{etoolbox}%
\patchcmd{\ttlh@hang}{\parindent\z@}{\parindent\z@\leavevmode}%
{\sphinx@ttlpatch@oktrue}{}%
\ifsphinx@ttlpatch@ok
\patchcmd{\ttlh@hang}{\noindent}{}{}{\sphinx@ttlpatch@okfalse}%
\fi
}{}%
\ifsphinx@ttlpatch@ok
\typeout{^^J Package Sphinx Info: ^^J
**** titlesec 2.10.1 successfully patched for bugfix ****^^J}%
\else
\AtEndDocument{\PackageWarningNoLine{sphinx}{^^J%
******** titlesec 2.10.1 has a bug, (section numbers disappear) ......|^^J%
******** and Sphinx could not patch it, perhaps because your local ...|^^J%
******** copy is already fixed without a changed release date. .......|^^J%
******** If not, you must update titlesec! ...........................|}}%
\fi
}%
}{}
% Augment the sectioning commands used to get our own font family in place,
% and reset some internal data items (\titleformat from titlesec package)
\titleformat{\section}{\Large\py@HeaderFamily}%
{\py@TitleColor\thesection}{0.5em}{\py@TitleColor}
\titleformat{\subsection}{\large\py@HeaderFamily}%
{\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}
\titleformat{\subsubsection}{\py@HeaderFamily}%
{\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}
% By default paragraphs (and subsubsections) will not be numbered because
% sphinxmanual.cls and sphinxhowto.cls set secnumdepth to 2
\titleformat{\paragraph}{\py@HeaderFamily}%
{\py@TitleColor\theparagraph}{0.5em}{\py@TitleColor}
\titleformat{\subparagraph}{\py@HeaderFamily}%
{\py@TitleColor\thesubparagraph}{0.5em}{\py@TitleColor}
% Since Sphinx 1.5, users should use HeaderFamily key to 'sphinxsetup' rather % Since Sphinx 1.5, users should use HeaderFamily key to 'sphinxsetup' rather
% than defining their own \py@HeaderFamily command (which is still possible). % than defining their own \py@HeaderFamily command (which is still possible).
% Memo: \py@HeaderFamily is also used by \maketitle as defined in % Memo: \py@HeaderFamily is also used by \maketitle as defined in
@ -32,19 +74,10 @@
}} }}
}{}% <-- "false" clause of \@ifpackagewith }{}% <-- "false" clause of \@ifpackagewith
% Augment the sectioning commands used to get our own font family in place, % fix fncychap's bug which uses prematurely the \textwidth value
% and reset some internal data items (\titleformat from titlesec package) \@ifpackagewith{fncychap}{Bjornstrup}
\titleformat{\section}{\Large\py@HeaderFamily}% {\AtBeginDocument{\mylen\textwidth\advance\mylen-2\myhi}}%
{\py@TitleColor\thesection}{0.5em}{\py@TitleColor} {}% <-- "false" clause of \@ifpackagewith
\titleformat{\subsection}{\large\py@HeaderFamily}%
{\py@TitleColor\thesubsection}{0.5em}{\py@TitleColor}
\titleformat{\subsubsection}{\py@HeaderFamily}%
{\py@TitleColor\thesubsubsection}{0.5em}{\py@TitleColor}
% By default paragraphs (and subsubsections) will not be numbered because
% sphinxmanual.cls and sphinxhowto.cls set secnumdepth to 2
\titleformat{\paragraph}{\py@HeaderFamily}%
{\py@TitleColor\theparagraph}{0.5em}{\py@TitleColor}
\titleformat{\subparagraph}{\py@HeaderFamily}%
{\py@TitleColor\thesubparagraph}{0.5em}{\py@TitleColor}
\endinput \endinput

View File

@ -3,11 +3,22 @@
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexstylepage.sty}[2021/01/27 page styling] \ProvidesFile{sphinxlatexstylepage.sty}[2021/01/27 page styling]
% Separate paragraphs by space by default.
\IfFileExists{parskip-2001-04-09.sty}% since September 2018 TeXLive update
% new parskip.sty, but let it rollback to old one.
% hopefully TeX installation not broken and LaTeX kernel not too old
{\RequirePackage{parskip}[=v1]}
% standard one from 1989. Admittedly \section of article/book gives possibly
% anomalous spacing, but we can't require September 2018 release for some time.
{\RequirePackage{parskip}}
% Style parameters and macros used by most documents here % Style parameters and macros used by most documents here
\raggedbottom \raggedbottom
\sloppy \sloppy
\hbadness = 5000 % don't print trivial gripes \hbadness = 5000 % don't print trivial gripes
% Require package fancyhdr except under memoir class
\@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
% Use \pagestyle{normal} as the primary pagestyle for text. % Use \pagestyle{normal} as the primary pagestyle for text.
% Redefine the 'normal' header/footer style when using "fancyhdr" package: % Redefine the 'normal' header/footer style when using "fancyhdr" package:
\@ifpackageloaded{fancyhdr}{% \@ifpackageloaded{fancyhdr}{%
@ -64,57 +75,5 @@
% Users of memoir class are invited to redefine 'normal' style in preamble % Users of memoir class are invited to redefine 'normal' style in preamble
} }
% geometry
\ifx\kanjiskip\@undefined
\PassOptionsToPackage{%
hmargin={\unexpanded{\spx@opt@hmargin}},%
vmargin={\unexpanded{\spx@opt@vmargin}},%
marginpar=\unexpanded{\spx@opt@marginpar}}
{geometry}
\else
% set text width for Japanese documents to be integer multiple of 1zw
% and text height to be integer multiple of \baselineskip
% the execution is delayed to \sphinxsetup then geometry.sty
\normalsize\normalfont
\newcommand*\sphinxtextwidthja[1]{%
\if@twocolumn\tw@\fi
\dimexpr
\numexpr\dimexpr\paperwidth-\tw@\dimexpr#1\relax\relax/
\dimexpr\if@twocolumn\tw@\else\@ne\fi zw\relax
zw\relax}%
\newcommand*\sphinxmarginparwidthja[1]{%
\dimexpr\numexpr\dimexpr#1\relax/\dimexpr1zw\relax zw\relax}%
\newcommand*\sphinxtextlinesja[1]{%
\numexpr\@ne+\dimexpr\paperheight-\topskip-\tw@\dimexpr#1\relax\relax/
\baselineskip\relax}%
\ifx\@jsc@uplatextrue\@undefined\else
% the way we found in order for the papersize special written by
% geometry in the dvi file to be correct in case of jsbook class
\ifnum\mag=\@m\else % do nothing special if nomag class option or 10pt
\PassOptionsToPackage{truedimen}{geometry}%
\fi
\fi
\PassOptionsToPackage{%
hmarginratio={1:1},%
textwidth=\unexpanded{\sphinxtextwidthja{\spx@opt@hmargin}},%
vmarginratio={1:1},%
lines=\unexpanded{\sphinxtextlinesja{\spx@opt@vmargin}},%
marginpar=\unexpanded{\sphinxmarginparwidthja{\spx@opt@marginpar}},%
footskip=2\baselineskip,%
}{geometry}%
\AtBeginDocument
{% update a dimension used by the jsclasses
\ifx\@jsc@uplatextrue\@undefined\else\fullwidth\textwidth\fi
% for some reason, jreport normalizes all dimensions with \@settopoint
\@ifclassloaded{jreport}
{\@settopoint\textwidth\@settopoint\textheight\@settopoint\marginparwidth}
{}% <-- "false" clause of \@ifclassloaded
}%
\fi
% fix fncychap's bug which uses prematurely the \textwidth value
\@ifpackagewith{fncychap}{Bjornstrup}
{\AtBeginDocument{\mylen\textwidth\advance\mylen-2\myhi}}%
{}% <-- "false" clause of \@ifpackagewith
\endinput \endinput

View File

@ -3,48 +3,8 @@
% change this info string if making any custom modification % change this info string if making any custom modification
\ProvidesFile{sphinxlatexstyletext.sty}[2021/01/27 text styling] \ProvidesFile{sphinxlatexstyletext.sty}[2021/01/27 text styling]
% to obtain straight quotes we execute \@noligs as patched by upquote, and % Basically everything here consists of macros which are part of the latex
% \scantokens is needed in cases where it would be too late for the macro to % markup produced by the Sphinx latex writer
% first set catcodes and then fetch its argument. We also make the contents
% breakable at non-escaped . , ; ? ! / using \sphinxbreaksviaactive,
% and also at \ character (which is escaped to \textbackslash{}).
\protected\def\sphinxtextbackslashbreakbefore
{\discretionary{}{\sphinxafterbreak\sphinx@textbackslash}{\sphinx@textbackslash}}
\protected\def\sphinxtextbackslashbreakafter
{\discretionary{\sphinx@textbackslash}{\sphinxafterbreak}{\sphinx@textbackslash}}
\let\sphinxtextbackslash\sphinxtextbackslashbreakafter
% the macro must be protected if it ends up used in moving arguments,
% in 'alltt' \@noligs is done already, and the \scantokens must be avoided.
\protected\def\sphinxupquote#1{{\def\@tempa{alltt}%
\ifx\@tempa\@currenvir\else
\ifspx@opt@inlineliteralwraps
% break at . , ; ? ! /
\sphinxbreaksviaactive
% break also at \
\let\sphinx@textbackslash\textbackslash
\let\textbackslash\sphinxtextbackslash
% by default, no continuation symbol on next line but may be added
\let\sphinxafterbreak\sphinxafterbreakofinlineliteral
% do not overwrite the comma set-up
\let\verbatim@nolig@list\sphinx@literal@nolig@list
\fi
% fix a space-gobbling issue due to LaTeX's original \do@noligs
% TODO: using \@noligs as patched by upquote.sty is now unneeded because
% either ` and ' are escaped (non-unicode engines) or they don't build
% ligatures (unicode engines). Thus remove this and unify handling of `, <, >,
% ' and - with the characters . , ; ? ! / as handled via
% \sphinxbreaksviaactive.
% Hence \sphinx@do@noligs will be removed, or rather replaced with code
% inserting discretionaries, as they allow a continuation symbol on start of
% next line to achieve common design with code-blocks.
\let\do@noligs\sphinx@do@noligs
\@noligs\endlinechar\m@ne\everyeof{}% (<- in case inside \sphinxhref)
\expandafter\scantokens
\fi {{#1}}}}% extra brace pair to fix end-space gobbling issue...
\def\sphinx@do@noligs #1{\catcode`#1\active\begingroup\lccode`\~`#1\relax
\lowercase{\endgroup\def~{\leavevmode\kern\z@\char`#1 }}}
\def\sphinx@literal@nolig@list {\do\`\do\<\do\>\do\'\do\-}%
\let\sphinxafterbreakofinlineliteral\empty
% Some custom font markup commands. % Some custom font markup commands.
\protected\def\sphinxstrong#1{\textbf{#1}} \protected\def\sphinxstrong#1{\textbf{#1}}

View File

@ -1,10 +1,173 @@
\NeedsTeXFormat{LaTeX2e} %% TABLES (WITH SUPPORT FOR MERGED CELLS OF GENERAL CONTENTS)
\ProvidesPackage{sphinxpackagemulticell}%
[2017/02/23 v1.6 better span rows and columns of a table (Sphinx team)]%
\DeclareOption*{\PackageWarning{sphinxpackagemulticell}%
{Option `\CurrentOption' is unknown}}%
\ProcessOptions\relax
% %
% change this info string if making any custom modification
\ProvidesFile{sphinxlatextables.sty}[2021/01/27 tables]%
% Provides support for this output mark-up from Sphinx latex writer
% and table templates:
%
% - the tabulary and longtable environments from the eponymous packages
% - the varwidth environment
% - the >{} etc mark-up possible in tabularcolumns is from array package
% which is loaded by longtable and tabulary
% - \X, \Y, T column types; others (L, C, R, J) are from tabulary package
% - \sphinxaftertopcaption
% - \sphinxatlongtableend
% - \sphinxatlongtablestart
% - \sphinxattableend
% - \sphinxattablestart
% - \sphinxcapstartof
% - \sphinxcolwidth
% - \sphinxlongtablecapskipadjust
% - \sphinxmultirow
% - \sphinxstartmulticolumn
% - \sphinxstopmulticolumn
% - \sphinxtablestrut
% - \sphinxthecaptionisattop
% - \sphinxthelongtablecaptionisattop
%
% Executes \RequirePackage for:
%
% - tabulary
% - longtable
% - varwidth
%
% Extends tabulary and longtable via patches and custom macros to support
% merged cells possibly containing code-blocks in complex tables
\RequirePackage{tabulary}
% tabulary has a bug with its re-definition of \multicolumn in its first pass
% which is not \long. But now Sphinx does not use LaTeX's \multicolumn but its
% own macro. Hence we don't even need to patch tabulary. See
% sphinxpackagemulticell.sty
% X or S (Sphinx) may have meanings if some table package is loaded hence
% \X was chosen to avoid possibility of conflict
\newcolumntype{\X}[2]{p{\dimexpr
(\linewidth-\arrayrulewidth)*#1/#2-\tw@\tabcolsep-\arrayrulewidth\relax}}
\newcolumntype{\Y}[1]{p{\dimexpr
#1\dimexpr\linewidth-\arrayrulewidth\relax-\tw@\tabcolsep-\arrayrulewidth\relax}}
% using here T (for Tabulary) feels less of a problem than the X could be
\newcolumntype{T}{J}%
% For tables allowing pagebreaks
\RequirePackage{longtable}
% User interface to set-up whitespace before and after tables:
\newcommand*\sphinxtablepre {0pt}%
\newcommand*\sphinxtablepost{\medskipamount}%
% Space from caption baseline to top of table or frame of literal-block
\newcommand*\sphinxbelowcaptionspace{.5\sphinxbaselineskip}%
% as one can not use \baselineskip from inside longtable (it is zero there)
% we need \sphinxbaselineskip, which defaults to \baselineskip
\def\sphinxbaselineskip{\baselineskip}%
% The following is to ensure that, whether tabular(y) or longtable:
% - if a caption is on top of table:
% a) the space between its last baseline and the top rule of table is
% exactly \sphinxbelowcaptionspace
% b) the space from last baseline of previous text to first baseline of
% caption is exactly \parskip+\baselineskip+ height of a strut.
% c) the caption text will wrap at width \LTcapwidth (4in)
% - make sure this works also if "caption" package is loaded by user
% (with its width or margin option taking place of \LTcapwidth role)
% TODO: obtain same for caption of literal block: a) & c) DONE, b) TO BE DONE
%
% To modify space below such top caption, adjust \sphinxbelowcaptionspace
% To add or remove space above such top caption, adjust \sphinxtablepre:
% notice that \abovecaptionskip, \belowcaptionskip, \LTpre are **ignored**
% A. Table with longtable
\def\sphinxatlongtablestart
{\par
\vskip\parskip
\vskip\dimexpr\sphinxtablepre\relax % adjust vertical position
\vbox{}% get correct baseline from above
\LTpre\z@skip\LTpost\z@skip % set to zero longtable's own skips
\edef\sphinxbaselineskip{\dimexpr\the\dimexpr\baselineskip\relax\relax}%
}%
% Compatibility with caption package
\def\sphinxthelongtablecaptionisattop{%
\spx@ifcaptionpackage{\noalign{\vskip-\belowcaptionskip}}{}%
}%
% Achieves exactly \sphinxbelowcaptionspace below longtable caption
\def\sphinxlongtablecapskipadjust
{\dimexpr-\dp\strutbox
-\spx@ifcaptionpackage{\abovecaptionskip}{\sphinxbaselineskip}%
+\sphinxbelowcaptionspace\relax}%
\def\sphinxatlongtableend{\@nobreakfalse % latex3/latex2e#173
\prevdepth\z@\vskip\sphinxtablepost\relax}%
% B. Table with tabular or tabulary
\def\sphinxattablestart{\par\vskip\dimexpr\sphinxtablepre\relax}%
\let\sphinxattableend\sphinxatlongtableend
% This is used by tabular and tabulary templates
\newcommand*\sphinxcapstartof[1]{%
\vskip\parskip
\vbox{}% force baselineskip for good positioning by capstart of hyperanchor
% hyperref puts the anchor 6pt above this baseline; in case of caption
% this baseline will be \ht\strutbox above first baseline of caption
\def\@captype{#1}%
\capstart
% move back vertically, as tabular (or its caption) will compensate
\vskip-\baselineskip\vskip-\parskip
}%
\def\sphinxthecaptionisattop{% locate it after \sphinxcapstartof
\spx@ifcaptionpackage
{\caption@setposition{t}%
\vskip\baselineskip\vskip\parskip % undo those from \sphinxcapstartof
\vskip-\belowcaptionskip % anticipate caption package skip
% caption package uses a \vbox, not a \vtop, so "single line" case
% gives different result from "multi-line" without this:
\nointerlineskip
}%
{}%
}%
\def\sphinxthecaptionisatbottom{% (not finalized; for template usage)
\spx@ifcaptionpackage{\caption@setposition{b}}{}%
}%
% The aim of \sphinxcaption is to apply to tabular(y) the maximal width
% of caption as done by longtable
\def\sphinxtablecapwidth{\LTcapwidth}%
\newcommand\sphinxcaption{\@dblarg\spx@caption}%
\long\def\spx@caption[#1]#2{%
\noindent\hb@xt@\linewidth{\hss
\vtop{\@tempdima\dimexpr\sphinxtablecapwidth\relax
% don't exceed linewidth for the caption width
\ifdim\@tempdima>\linewidth\hsize\linewidth\else\hsize\@tempdima\fi
% longtable ignores \abovecaptionskip/\belowcaptionskip, so do the same here
\abovecaptionskip\sphinxabovecaptionskip % \z@skip
\belowcaptionskip\sphinxbelowcaptionskip % \z@skip
\caption[{#1}]%
{\strut\ignorespaces#2\ifhmode\unskip\@finalstrut\strutbox\fi}%
}\hss}%
\par\prevdepth\dp\strutbox
}%
\def\sphinxabovecaptionskip{\z@skip}% Do not use! Flagged for removal
\def\sphinxbelowcaptionskip{\z@skip}% Do not use! Flagged for removal
% This wrapper of \abovecaptionskip is used in sphinxVerbatim for top
% caption, and with another value in sphinxVerbatimintable
% TODO: To unify space above caption of a code-block with the one above
% caption of a table/longtable, \abovecaptionskip must not be used
% This auxiliary will get renamed and receive a different meaning
% in future.
\def\spx@abovecaptionskip{\abovecaptionskip}%
% Achieve \sphinxbelowcaptionspace below a caption located above a tabular
% or a tabulary
\newcommand\sphinxaftertopcaption
{%
\spx@ifcaptionpackage
{\par\prevdepth\dp\strutbox\nobreak\vskip-\abovecaptionskip}{\nobreak}%
\vskip\dimexpr\sphinxbelowcaptionspace\relax
\vskip-\baselineskip\vskip-\parskip
}%
% varwidth is crucial for our handling of general contents in merged cells
\RequirePackage{varwidth}
% but addition of a compatibility patch with hyperref is needed
% (tested with varwidth v 0.92 Mar 2009)
\AtBeginDocument {%
\let\@@vwid@Hy@raisedlink\Hy@raisedlink
\long\def\@vwid@Hy@raisedlink#1{\@vwid@wrap{\@@vwid@Hy@raisedlink{#1}}}%
\edef\@vwid@setup{%
\let\noexpand\Hy@raisedlink\noexpand\@vwid@Hy@raisedlink % HYPERREF !
\unexpanded\expandafter{\@vwid@setup}}%
}%
%%%%%%%%%%%%%%%%%%%%%
% --- MULTICOLUMN --- % --- MULTICOLUMN ---
% standard LaTeX's \multicolumn % standard LaTeX's \multicolumn
% 1. does not allow verbatim contents, % 1. does not allow verbatim contents,
@ -206,7 +369,8 @@
\def\sphinx@multiwidth #1#2{\dimexpr % #1 to gobble the \@gobble (!) \def\sphinx@multiwidth #1#2{\dimexpr % #1 to gobble the \@gobble (!)
(\ifx\TY@final\@undefined\linewidth\else\sphinx@TY@tablewidth\fi (\ifx\TY@final\@undefined\linewidth\else\sphinx@TY@tablewidth\fi
-\arrayrulewidth)*#2-\tw@\tabcolsep-\arrayrulewidth\relax}% -\arrayrulewidth)*#2-\tw@\tabcolsep-\arrayrulewidth\relax}%
%
%%%%%%%%%%%%%%%%%%
% --- MULTIROW --- % --- MULTIROW ---
% standard \multirow % standard \multirow
% 1. does not allow verbatim contents, % 1. does not allow verbatim contents,
@ -313,6 +477,5 @@
% we need this to avoid colour panels hiding bottom parts of multirow text % we need this to avoid colour panels hiding bottom parts of multirow text
\sphinx@hack@CT \sphinx@hack@CT
}% }%
\endinput \endinput
%%
%% End of file `sphinxpackagemulticell.sty'.

View File

@ -0,0 +1,54 @@
%% OPTIONS FOR GEOMETRY
%
% change this info string if making any custom modification
\ProvidesFile{sphinxoptionsgeometry.sty}[2021/01/27 geometry]
% geometry
\ifx\kanjiskip\@undefined
\PassOptionsToPackage{%
hmargin={\unexpanded{\spx@opt@hmargin}},%
vmargin={\unexpanded{\spx@opt@vmargin}},%
marginpar=\unexpanded{\spx@opt@marginpar}}
{geometry}
\else
% set text width for Japanese documents to be integer multiple of 1zw
% and text height to be integer multiple of \baselineskip
% the execution is delayed to \sphinxsetup then geometry.sty
\normalsize\normalfont
\newcommand*\sphinxtextwidthja[1]{%
\if@twocolumn\tw@\fi
\dimexpr
\numexpr\dimexpr\paperwidth-\tw@\dimexpr#1\relax\relax/
\dimexpr\if@twocolumn\tw@\else\@ne\fi zw\relax
zw\relax}%
\newcommand*\sphinxmarginparwidthja[1]{%
\dimexpr\numexpr\dimexpr#1\relax/\dimexpr1zw\relax zw\relax}%
\newcommand*\sphinxtextlinesja[1]{%
\numexpr\@ne+\dimexpr\paperheight-\topskip-\tw@\dimexpr#1\relax\relax/
\baselineskip\relax}%
\ifx\@jsc@uplatextrue\@undefined\else
% the way we found in order for the papersize special written by
% geometry in the dvi file to be correct in case of jsbook class
\ifnum\mag=\@m\else % do nothing special if nomag class option or 10pt
\PassOptionsToPackage{truedimen}{geometry}%
\fi
\fi
\PassOptionsToPackage{%
hmarginratio={1:1},%
textwidth=\unexpanded{\sphinxtextwidthja{\spx@opt@hmargin}},%
vmarginratio={1:1},%
lines=\unexpanded{\sphinxtextlinesja{\spx@opt@vmargin}},%
marginpar=\unexpanded{\sphinxmarginparwidthja{\spx@opt@marginpar}},%
footskip=2\baselineskip,%
}{geometry}%
\AtBeginDocument
{% update a dimension used by the jsclasses
\ifx\@jsc@uplatextrue\@undefined\else\fullwidth\textwidth\fi
% for some reason, jreport normalizes all dimensions with \@settopoint
\@ifclassloaded{jreport}
{\@settopoint\textwidth\@settopoint\textheight\@settopoint\marginparwidth}
{}% <-- "false" clause of \@ifclassloaded
}%
\fi
\endinput

View File

@ -0,0 +1,35 @@
%% Bookmarks and hyperlinks
%
% change this info string if making any custom modification
\ProvidesFile{sphinxoptionshyperref.sty}[2021/01/27 hyperref]
% to make pdf with correct encoded bookmarks in Japanese
% this should precede the hyperref package
\ifx\kanjiskip\@undefined
% for non-Japanese: make sure bookmarks are ok also with lualatex
\PassOptionsToPackage{pdfencoding=unicode}{hyperref}
\else
\RequirePackage{atbegshi}
\ifx\ucs\@undefined
\ifnum 42146=\euc"A4A2
\AtBeginShipoutFirst{\special{pdf:tounicode EUC-UCS2}}
\else
\AtBeginShipoutFirst{\special{pdf:tounicode 90ms-RKSJ-UCS2}}
\fi
\else
\AtBeginShipoutFirst{\special{pdf:tounicode UTF8-UCS2}}
\fi
\fi
\ifx\@jsc@uplatextrue\@undefined\else
\PassOptionsToPackage{setpagesize=false}{hyperref}
\fi
% These options can be overriden inside 'hyperref' key
% or by later use of \hypersetup.
\PassOptionsToPackage{colorlinks,breaklinks,%
linkcolor=InnerLinkColor,filecolor=OuterLinkColor,%
menucolor=OuterLinkColor,urlcolor=OuterLinkColor,%
citecolor=InnerLinkColor}{hyperref}
\endinput

View File

@ -1,6 +1,11 @@
\NeedsTeXFormat{LaTeX2e} \NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{sphinxpackagefootnote}% \ProvidesPackage{sphinxpackagefootnote}%
[2021/01/26 v1.1b footnotehyper adapted to sphinx (Sphinx team)] [2021/01/26 v1.1b footnotehyper adapted to sphinx (Sphinx team)]
% Provides support for this output mark-up from Sphinx latex writer:
% - footnote environment
% - savenotes environment (table templates)
% - \sphinxfootnotemark
%
%% %%
%% Package: sphinxpackagefootnote %% Package: sphinxpackagefootnote
%% Version: based on footnotehyper.sty 2021/01/26 v1.1b %% Version: based on footnotehyper.sty 2021/01/26 v1.1b