mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
Refactor LaTeX style files
This is a (continuation and) re-work of #8769 (e6bf9145dc
)
I have reintegrated option handling and most package loading into the
original file sphinx.sty and reorganized completely the filenames of
secondary style files.
sphinx.sty had become too big and first #8769 now this more definitive
refactoring is necessary to clarify structure, dependencies, and ease up
future maintenance.
Unfortunately this means a lot of moving around hunks of latex code with
some alterations. I tried to carefully check everything is defined in
right order (as LaTeX being a macro expansion language, often one can
manipulate things before them being defined, nevertheless I checked
things are done in order).
Only simple thing is to review is that I added missing EOLs at last
lines of the extracted files...
This commit is contained in:
parent
1ebc9c26c7
commit
0c0be64ece
@ -31,11 +31,214 @@
|
||||
}}
|
||||
|
||||
|
||||
%% 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}}
|
||||
|
||||
|
||||
%% 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
|
||||
%
|
||||
% we delay handling of options to after having loaded packages, because
|
||||
% of the need to use \definecolor.
|
||||
\input{sphinxlatexrequirepackages.sty}
|
||||
% as will be indicated below, secondary style files load some more packages
|
||||
%
|
||||
% for \text macro and \iffirstchoice@ conditional even if amsmath not loaded
|
||||
\RequirePackage{amstext}
|
||||
% it was passed "warn" option from latex template
|
||||
\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}
|
||||
% control caption around literal-block
|
||||
\RequirePackage{capt-of}
|
||||
\RequirePackage{needspace}
|
||||
% support hlist directive
|
||||
\RequirePackage{multicol}
|
||||
|
||||
|
||||
%% GRAPHICS
|
||||
%
|
||||
\RequirePackage{graphicx}
|
||||
\input{sphinxlatexgraphics.sty}
|
||||
|
||||
|
||||
%% FRAMED ENVIRONMENTS
|
||||
% For framing code-blocks and warning type notices, and shadowing topics
|
||||
\RequirePackage{framed}
|
||||
%
|
||||
% macros and environment for display literals (sphinxVerbatim, sphinxalltt)
|
||||
% and inline literals (\sphinxupquote); also defines \sphinxhref.
|
||||
% Requires: fancyvrb, alltt, upquote
|
||||
\input{sphinxlatexliterals.sty}
|
||||
%
|
||||
% topic and contents boxes: sphinxShadowBox uses framed.sty
|
||||
\input{sphinxlatexshadowbox.sty}
|
||||
%
|
||||
% notices and admonitions: sphinxheavybox uses again framed.sty
|
||||
\input{sphinxlatexadmonitions.sty}
|
||||
|
||||
|
||||
%% PYGMENTS
|
||||
@ -54,82 +257,67 @@
|
||||
}%
|
||||
|
||||
|
||||
%% OPTION HANDLING
|
||||
%% TABLES
|
||||
%
|
||||
\input{sphinxlatexoptionhandling.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}}
|
||||
% Requires: tabulary, longtable, varwidth
|
||||
% extends tabulary and longtable via patches and custom macros to support
|
||||
% merged cells possibly containing code-blocks in complex tables
|
||||
\input{sphinxlatextables.sty}
|
||||
|
||||
|
||||
%% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS
|
||||
%
|
||||
\input{sphinxlatexmiscnumbering.sty}
|
||||
% Requires: remreset (old LaTeX only)
|
||||
% relates to numfig and numfig_secnum_depth configuration variables
|
||||
\input{sphinxlatexnumfig.sty}
|
||||
|
||||
|
||||
%% LITERAL BLOCKS
|
||||
%% LISTS
|
||||
%
|
||||
\input{sphinxlatexenvliteral.sty}
|
||||
% optionally extends LaTeX maximal list nesting depth and provides
|
||||
% \sphinxsetlistlabels macro used in mark-up
|
||||
\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 provides savenotes environment (aka \savenotes/spewnotes)
|
||||
% For hyperlinked footnotes in tables; also for gathering footnotes from
|
||||
% topic and warning blocks. Also to allow code-blocks in footnotes.
|
||||
% Based on footnotehyper, extended to support tabulary multipass system
|
||||
\RequirePackage{sphinxpackagefootnote}
|
||||
|
||||
|
||||
%% NOTICES AND ADMONITIONS
|
||||
%% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS
|
||||
%
|
||||
\input{sphinxlatexenvadmonitions.sty}
|
||||
% requires makeidx
|
||||
\input{sphinxlatexindbibtoc.sty}
|
||||
|
||||
|
||||
%% PYTHON DOCS MACROS AND ENVIRONMENTS
|
||||
%
|
||||
\input{sphinxlatexenvdocs.sty}
|
||||
|
||||
|
||||
%% TEXT STYLING
|
||||
%% STYLING
|
||||
%
|
||||
% page
|
||||
% requires parskip (legacy version) and, except if memoir class, fancyhdr
|
||||
\input{sphinxlatexstylepage.sty}
|
||||
% headings
|
||||
% requires titlesec and, if it is at 2.10.1, etoolbox to patch it
|
||||
\input{sphinxlatexstyleheadings.sty}
|
||||
% many \sphinx... prefixed commands to style text
|
||||
\input{sphinxlatexstyletext.sty}
|
||||
|
||||
|
||||
%% MODULE RELEASE DATA AND OBJECT DESCRIPTIONS
|
||||
%
|
||||
% this legacy code has remained very stable over the years
|
||||
% (fulllineitems was updated to support multiline signatures)
|
||||
\input{sphinxlatexobjects.sty}
|
||||
|
||||
|
||||
% FIXME: this line should be dropped, as "9" is default anyhow.
|
||||
\ifdefined\pdfcompresslevel\pdfcompresslevel = 9 \fi
|
||||
|
||||
|
||||
\endinput
|
||||
|
@ -1,7 +1,7 @@
|
||||
%% NOTICES AND ADMONITIONS
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatexenvadmonitions.sty}[2021/01/27 admonitions]
|
||||
\ProvidesFile{sphinxlatexadmonitions.sty}[2021/01/27 admonitions]
|
||||
|
||||
% Some are quite plain
|
||||
% the spx@notice@bordercolor etc are set in the sphinxadmonition environment
|
||||
@ -119,4 +119,4 @@
|
||||
% workaround some LaTeX "feature" of \end command
|
||||
{\edef\spx@temp{\noexpand\end{sphinx\spx@noticetype}}\spx@temp}
|
||||
|
||||
\endinput
|
||||
\endinput
|
@ -1,7 +1,9 @@
|
||||
%% INDEX, BIBLIOGRAPHY, APPENDIX, TABLE OF CONTENTS
|
||||
%
|
||||
% 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]
|
||||
|
||||
\RequirePackage{makeidx}
|
||||
|
||||
% fix the double index and bibliography on the table of contents
|
||||
% in jsclasses (Japanese standard document classes)
|
||||
@ -44,4 +46,7 @@
|
||||
\newcommand*{\sphinxsymbolsname}{}
|
||||
\newcommand*{\sphinxnumbersname}{}
|
||||
|
||||
\endinput
|
||||
\protected\def\sphinxcite{\cite}
|
||||
|
||||
|
||||
\endinput
|
@ -1,7 +1,7 @@
|
||||
%% ALPHANUMERIC LIST ITEMS
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatexmisclists.sty}[2021/01/27 lists]
|
||||
\ProvidesFile{sphinxlatexlists.sty}[2021/01/27 lists]
|
||||
|
||||
\newcommand\sphinxsetlistlabels[5]
|
||||
{% #1 = style, #2 = enum, #3 = enumnext, #4 = prefix, #5 = suffix
|
@ -1,7 +1,18 @@
|
||||
%% LITERAL BLOCKS
|
||||
%
|
||||
% 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]
|
||||
|
||||
% 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 parsed-literal blocks.
|
||||
\RequirePackage{alltt}
|
||||
% Display "real" single quotes in literal blocks.
|
||||
\RequirePackage{upquote}
|
||||
|
||||
% Based on use of "fancyvrb.sty"'s Verbatim.
|
||||
% - with framing allowing page breaks ("framed.sty")
|
||||
@ -459,6 +470,10 @@
|
||||
\fi }
|
||||
{\end{alltt}}
|
||||
|
||||
|
||||
%% INLINE MARK-UP
|
||||
%
|
||||
|
||||
% Protect \href's first argument in contexts such as sphinxalltt (or
|
||||
% \sphinxcode). Sphinx uses \#, \%, \& ... always inside \sphinxhref.
|
||||
\protected\def\sphinxhref#1#2{{%
|
||||
@ -477,4 +492,49 @@
|
||||
\endlinechar\m@ne\scantokens{\nolinkurl{#1}}%
|
||||
}}
|
||||
|
||||
\endinput
|
||||
% \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
|
@ -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
|
@ -1,8 +1,12 @@
|
||||
%% NUMBERING OF FIGURES, TABLES, AND LITERAL BLOCKS
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatexmiscnumbering.sty}[2021/01/27 numbering]
|
||||
\ProvidesFile{sphinxlatexnumfig.sty}[2021/01/27 numbering]
|
||||
|
||||
% 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
|
||||
% \newcounter to solve duplicate label problems for internal hyperlinks to
|
||||
% code listings (literalblock counter). User or extension re-definitions of
|
@ -1,7 +1,7 @@
|
||||
%% PYTHON DOCS MACROS AND ENVIRONMENTS
|
||||
%% MODULE RELEASE DATA AND OBJECT DESCRIPTIONS
|
||||
%
|
||||
% 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)
|
||||
|
@ -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
|
@ -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
|
@ -1,7 +1,7 @@
|
||||
%% TOPIC AND CONTENTS BOXES
|
||||
%
|
||||
% 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]
|
||||
|
||||
% Again based on use of "framed.sty", this allows breakable framed boxes.
|
||||
\long\def\spx@ShadowFBox#1{%
|
@ -1,8 +1,33 @@
|
||||
% change this info string if making any custom modification
|
||||
%% TITLES
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\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
|
||||
}%
|
||||
}{}
|
||||
% Since Sphinx 1.5, users should use HeaderFamily key to 'sphinxsetup' rather
|
||||
% than defining their own \py@HeaderFamily command (which is still possible).
|
||||
% Memo: \py@HeaderFamily is also used by \maketitle as defined in
|
||||
@ -47,4 +72,4 @@
|
||||
\titleformat{\subparagraph}{\py@HeaderFamily}%
|
||||
{\py@TitleColor\thesubparagraph}{0.5em}{\py@TitleColor}
|
||||
|
||||
\endinput
|
||||
\endinput
|
||||
|
@ -3,11 +3,21 @@
|
||||
% change this info string if making any custom modification
|
||||
\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
|
||||
\raggedbottom
|
||||
\sloppy
|
||||
\hbadness = 5000 % don't print trivial gripes
|
||||
|
||||
\@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
|
||||
% Use \pagestyle{normal} as the primary pagestyle for text.
|
||||
% Redefine the 'normal' header/footer style when using "fancyhdr" package:
|
||||
\@ifpackageloaded{fancyhdr}{%
|
||||
@ -64,57 +74,9 @@
|
||||
% 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
|
||||
|
@ -3,49 +3,6 @@
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatexstyletext.sty}[2021/01/27 text styling]
|
||||
|
||||
% 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
|
||||
|
||||
% Some custom font markup commands.
|
||||
\protected\def\sphinxstrong#1{\textbf{#1}}
|
||||
\protected\def\sphinxcode#1{\texttt{#1}}
|
||||
|
@ -1,10 +1,145 @@
|
||||
\NeedsTeXFormat{LaTeX2e}
|
||||
\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
|
||||
%% TABLES (WITH SUPPORT FOR MERGED CELLS OF GENERAL CONTENTS)
|
||||
%
|
||||
% change this info string if making any custom modification
|
||||
\ProvidesFile{sphinxlatextables.sty}[2021/01/27 tables]%
|
||||
|
||||
% IMPORTANT: all this is to be kept in sync with the templates
|
||||
% longtable.tex_t, tabular.tex_t, tabulary.tex_t and the actual
|
||||
% Sphinx latex writer output.
|
||||
|
||||
\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 ---
|
||||
% standard LaTeX's \multicolumn
|
||||
% 1. does not allow verbatim contents,
|
||||
@ -206,7 +341,8 @@
|
||||
\def\sphinx@multiwidth #1#2{\dimexpr % #1 to gobble the \@gobble (!)
|
||||
(\ifx\TY@final\@undefined\linewidth\else\sphinx@TY@tablewidth\fi
|
||||
-\arrayrulewidth)*#2-\tw@\tabcolsep-\arrayrulewidth\relax}%
|
||||
%
|
||||
|
||||
%%%%%%%%%%%%%%%%%%
|
||||
% --- MULTIROW ---
|
||||
% standard \multirow
|
||||
% 1. does not allow verbatim contents,
|
||||
@ -313,6 +449,5 @@
|
||||
% we need this to avoid colour panels hiding bottom parts of multirow text
|
||||
\sphinx@hack@CT
|
||||
}%
|
||||
|
||||
\endinput
|
||||
%%
|
||||
%% End of file `sphinxpackagemulticell.sty'.
|
54
sphinx/texinputs/sphinxoptionsgeometry.sty
Normal file
54
sphinx/texinputs/sphinxoptionsgeometry.sty
Normal 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
|
35
sphinx/texinputs/sphinxoptionshyperref.sty
Normal file
35
sphinx/texinputs/sphinxoptionshyperref.sty
Normal 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
|
Loading…
Reference in New Issue
Block a user