summaryrefslogtreecommitdiff
path: root/sphinx/texinputs
diff options
context:
space:
mode:
Diffstat (limited to 'sphinx/texinputs')
-rw-r--r--sphinx/texinputs/Makefile_t (renamed from sphinx/texinputs/Makefile)14
-rw-r--r--sphinx/texinputs/fncychap.sty683
-rw-r--r--sphinx/texinputs/footnotehyper-sphinx.sty156
-rwxr-xr-xsphinx/texinputs/iftex.sty97
-rw-r--r--sphinx/texinputs/newfloat.sty737
-rw-r--r--sphinx/texinputs/sphinx.sty881
-rw-r--r--sphinx/texinputs/sphinxhowto.cls37
-rw-r--r--sphinx/texinputs/sphinxmanual.cls44
-rw-r--r--sphinx/texinputs/tabulary.sty452
9 files changed, 761 insertions, 2340 deletions
diff --git a/sphinx/texinputs/Makefile b/sphinx/texinputs/Makefile_t
index d748006cc..ffec3662c 100644
--- a/sphinx/texinputs/Makefile
+++ b/sphinx/texinputs/Makefile_t
@@ -3,6 +3,7 @@
ALLDOCS = $(basename $(wildcard *.tex))
ALLPDF = $(addsuffix .pdf,$(ALLDOCS))
ALLDVI = $(addsuffix .dvi,$(ALLDOCS))
+ALLPS = $(addsuffix .ps,$(ALLDOCS))
# Prefix for archive names
ARCHIVEPRREFIX =
@@ -12,14 +13,18 @@ LATEXOPTS =
FMT = pdf
LATEX = latex
-PDFLATEX = pdflatex
+PDFLATEX = {{ latex_engine }}
MAKEINDEX = makeindex
+{% if latex_engine == 'platex' %}
+all: all-pdf-ja
+all-pdf: all-pdf-ja
+{% else %}
all: $(ALLPDF)
all-pdf: $(ALLPDF)
+{% endif -%}
all-dvi: $(ALLDVI)
-all-ps: all-dvi
- for f in *.dvi; do dvips $$f; done
+all-ps: $(ALLPS)
all-pdf-ja:
for f in *.pdf *.png *.gif *.jpg *.jpeg; do extractbb $$f; done
@@ -70,6 +75,9 @@ xz: tar
$(PDFLATEX) $(LATEXOPTS) '$<'
$(PDFLATEX) $(LATEXOPTS) '$<'
+%.ps: %.dvi
+ dvips '$<'
+
clean:
rm -f *.log *.ind *.aux *.toc *.syn *.idx *.out *.ilg *.pla *.ps *.tar *.tar.gz *.tar.bz2 *.tar.xz $(ALLPDF) $(ALLDVI)
diff --git a/sphinx/texinputs/fncychap.sty b/sphinx/texinputs/fncychap.sty
deleted file mode 100644
index 9a56c04ed..000000000
--- a/sphinx/texinputs/fncychap.sty
+++ /dev/null
@@ -1,683 +0,0 @@
-%%% Copyright Ulf A. Lindgren
-%%%
-%%% Note Premission is granted to modify this file under
-%%% the condition that it is saved using another
-%%% file and package name.
-%%%
-%%% Revision 1.1 (1997)
-%%%
-%%% Jan. 8th Modified package name base date option
-%%% Jan. 22th Modified FmN and FmTi for error in book.cls
-%%% \MakeUppercase{#}->{\MakeUppercase#}
-%%% Apr. 6th Modified Lenny option to prevent undesired
-%%% skip of line.
-%%% Nov. 8th Fixed \@chapapp for AMS
-%%%
-%%% Revision 1.2 (1998)
-%%%
-%%% Feb. 11th Fixed appendix problem related to Bjarne
-%%% Aug. 11th Fixed problem related to 11pt and 12pt
-%%% suggested by Tomas Lundberg. THANKS!
-%%%
-%%% Revision 1.3 (2004)
-%%% Sep. 20th problem with frontmatter, mainmatter and
-%%% backmatter, pointed out by Lapo Mori
-%%%
-%%% Revision 1.31 (2004)
-%%% Sep. 21th problem with the Rejne definition streched text
-%%% caused ugly gaps in the vrule aligned with the title
-%%% text. Kindly pointed out to me by Hendri Adriaens
-%%%
-%%% Revision 1.32 (2005)
-%%% Jun. 23th compatibility problem with the KOMA class 'scrbook.cls'
-%%% a remedy is a redefinition of '\@schapter' in
-%%% line with that used in KOMA. The problem was pointed
-%%% out to me by Mikkel Holm Olsen
-%%%
-%%% Revision 1.33 (2005)
-%%% Aug. 9th misspelled ``TWELV'' corrected, the error was pointed
-%%% out to me by George Pearson
-%%%
-%%% Revision 1.34 (2007)
-%%% Added an alternative to Lenny provided by Peter
-%%% Osborne (2005-11-28)
-%%% Corrected front, main and back matter, based on input
-%%% from Bas van Gils (2006-04-24)
-%%% Jul. 30th Added Bjornstrup option provided by Jean-Marc
-%%% Francois (2007-01-05).
-%%% Reverted to \MakeUppercase{#} see rev 1.1, solved
-%%% problem with MakeUppercase and MakeLowercase pointed
-%%% out by Marco Feuerstein (2007-06-06)
-
-
-%%% Last modified Jul. 2007
-
-\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{fncychap}
- [2007/07/30 v1.34
- LaTeX package (Revised chapters)]
-
-%%%% For conditional inclusion of color
-\newif\ifusecolor
-\usecolorfalse
-
-
-
-%%%% DEFINITION OF Chapapp variables
-\newcommand{\CNV}{\huge\bfseries}
-\newcommand{\ChNameVar}[1]{\renewcommand{\CNV}{#1}}
-
-
-%%%% DEFINITION OF TheChapter variables
-\newcommand{\CNoV}{\huge\bfseries}
-\newcommand{\ChNumVar}[1]{\renewcommand{\CNoV}{#1}}
-
-\newif\ifUCN
-\UCNfalse
-\newif\ifLCN
-\LCNfalse
-\def\ChNameLowerCase{\LCNtrue\UCNfalse}
-\def\ChNameUpperCase{\UCNtrue\LCNfalse}
-\def\ChNameAsIs{\UCNfalse\LCNfalse}
-
-%%%%% Fix for AMSBook 971008
-
-\@ifundefined{@chapapp}{\let\@chapapp\chaptername}{}
-
-
-%%%%% Fix for Bjarne and appendix 980211
-
-\newif\ifinapp
-\inappfalse
-\renewcommand\appendix{\par
- \setcounter{chapter}{0}%
- \setcounter{section}{0}%
- \inapptrue%
- \renewcommand\@chapapp{\appendixname}%
- \renewcommand\thechapter{\@Alph\c@chapter}}
-
-%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
-
-\@ifundefined{@mainmatter}{\newif\if@mainmatter \@mainmattertrue}{}
-
-%%%%%
-
-
-
-\newcommand{\FmN}[1]{%
-\ifUCN
- {\MakeUppercase{#1}}\LCNfalse
-\else
- \ifLCN
- {\MakeLowercase{#1}}\UCNfalse
- \else #1
- \fi
-\fi}
-
-
-%%%% DEFINITION OF Title variables
-\newcommand{\CTV}{\Huge\bfseries}
-\newcommand{\ChTitleVar}[1]{\renewcommand{\CTV}{#1}}
-
-%%%% DEFINITION OF the basic rule width
-\newlength{\RW}
-\setlength{\RW}{1pt}
-\newcommand{\ChRuleWidth}[1]{\setlength{\RW}{#1}}
-
-\newif\ifUCT
-\UCTfalse
-\newif\ifLCT
-\LCTfalse
-\def\ChTitleLowerCase{\LCTtrue\UCTfalse}
-\def\ChTitleUpperCase{\UCTtrue\LCTfalse}
-\def\ChTitleAsIs{\UCTfalse\LCTfalse}
-\newcommand{\FmTi}[1]{%
-\ifUCT
- {\MakeUppercase{#1}}\LCTfalse
-\else
- \ifLCT
- {\MakeLowercase{#1}}\UCTfalse
- \else {#1}
- \fi
-\fi}
-
-
-
-\newlength{\mylen}
-\newlength{\myhi}
-\newlength{\px}
-\newlength{\py}
-\newlength{\pyy}
-\newlength{\pxx}
-
-
-\def\mghrulefill#1{\leavevmode\leaders\hrule\@height #1\hfill\kern\z@}
-
-\newcommand{\DOCH}{%
- \CNV\FmN{\@chapapp}\space \CNoV\thechapter
- \par\nobreak
- \vskip 20\p@
- }
-\newcommand{\DOTI}[1]{%
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@
- }
-\newcommand{\DOTIS}[1]{%
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@
- }
-
-%%%%%% SONNY DEF
-
-\DeclareOption{Sonny}{%
- \ChNameVar{\Large\sf}
- \ChNumVar{\Huge}
- \ChTitleVar{\Large\sf}
- \ChRuleWidth{0.5pt}
- \ChNameUpperCase
- \renewcommand{\DOCH}{%
- \raggedleft
- \CNV\FmN{\@chapapp}\space \CNoV\thechapter
- \par\nobreak
- \vskip 40\p@}
- \renewcommand{\DOTI}[1]{%
- \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
- \vskip 5\p@
- \CTV\FmTi{#1}\par\nobreak
- \mghrulefill{\RW}\par\nobreak
- \vskip 40\p@}
- \renewcommand{\DOTIS}[1]{%
- \CTV\raggedleft\mghrulefill{\RW}\par\nobreak
- \vskip 5\p@
- \CTV\FmTi{#1}\par\nobreak
- \mghrulefill{\RW}\par\nobreak
- \vskip 40\p@}
-}
-
-%%%%%% LENNY DEF
-
-\DeclareOption{Lenny}{%
-
- \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
- \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
- \ChTitleVar{\Huge\bfseries\rm}
- \ChRuleWidth{1pt}
- \renewcommand{\DOCH}{%
- \settowidth{\px}{\CNV\FmN{\@chapapp}}
- \addtolength{\px}{2pt}
- \settoheight{\py}{\CNV\FmN{\@chapapp}}
- \addtolength{\py}{1pt}
-
- \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
- \addtolength{\mylen}{1pt}
- \settowidth{\pxx}{\CNoV\thechapter}
- \addtolength{\pxx}{-1pt}
-
- \settoheight{\pyy}{\CNoV\thechapter}
- \addtolength{\pyy}{-2pt}
- \setlength{\myhi}{\pyy}
- \addtolength{\myhi}{-1\py}
- \par
- \parbox[b]{\textwidth}{%
- \rule[\py]{\RW}{\myhi}%
- \hskip -\RW%
- \rule[\pyy]{\px}{\RW}%
- \hskip -\px%
- \raggedright%
- \CNV\FmN{\@chapapp}\space\CNoV\thechapter%
- \hskip1pt%
- \mghrulefill{\RW}%
- \rule{\RW}{\pyy}\par\nobreak%
- \vskip -\baselineskip%
- \vskip -\pyy%
- \hskip \mylen%
- \mghrulefill{\RW}\par\nobreak%
- \vskip \pyy}%
- \vskip 20\p@}
-
-
- \renewcommand{\DOTI}[1]{%
- \raggedright
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@}
-
- \renewcommand{\DOTIS}[1]{%
- \raggedright
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@}
- }
-
-%%%%%% Peter Osbornes' version of LENNY DEF
-
-\DeclareOption{PetersLenny}{%
-
-% five new lengths
-\newlength{\bl} % bottom left : orig \space
-\setlength{\bl}{6pt}
-\newcommand{\BL}[1]{\setlength{\bl}{#1}}
-\newlength{\br} % bottom right : orig 1pt
-\setlength{\br}{1pt}
-\newcommand{\BR}[1]{\setlength{\br}{#1}}
-\newlength{\tl} % top left : orig 2pt
-\setlength{\tl}{2pt}
-\newcommand{\TL}[1]{\setlength{\tl}{#1}}
-\newlength{\trr} % top right :orig 1pt
-\setlength{\trr}{1pt}
-\newcommand{\TR}[1]{\setlength{\trr}{#1}}
-\newlength{\blrule} % top right :orig 1pt
-\setlength{\trr}{0pt}
-\newcommand{\BLrule}[1]{\setlength{\blrule}{#1}}
-
-
- \ChNameVar{\fontsize{14}{16}\usefont{OT1}{phv}{m}{n}\selectfont}
- \ChNumVar{\fontsize{60}{62}\usefont{OT1}{ptm}{m}{n}\selectfont}
- \ChTitleVar{\Huge\bfseries\rm}
- \ChRuleWidth{1pt}
-\renewcommand{\DOCH}{%
-
-
-%%%%%%% tweaks for 1--9 and A--Z
-\ifcase\c@chapter\relax%
-\or\BL{-3pt}\TL{-4pt}\BR{0pt}\TR{-6pt}%1
-\or\BL{0pt}\TL{-4pt}\BR{2pt}\TR{-4pt}%2
-\or\BL{0pt}\TL{-4pt}\BR{2pt}\TR{-4pt}%3
-\or\BL{0pt}\TL{5pt}\BR{2pt}\TR{-4pt}%4
-\or\BL{0pt}\TL{3pt}\BR{2pt}\TR{-4pt}%5
-\or\BL{-1pt}\TL{0pt}\BR{2pt}\TR{-2pt}%6
-\or\BL{0pt}\TL{-3pt}\BR{2pt}\TR{-2pt}%7
-\or\BL{0pt}\TL{-3pt}\BR{2pt}\TR{-2pt}%8
-\or\BL{0pt}\TL{-3pt}\BR{-4pt}\TR{-2pt}%9
-\or\BL{-3pt}\TL{-3pt}\BR{2pt}\TR{-7pt}%10
-\or\BL{-6pt}\TL{-6pt}\BR{0pt}\TR{-9pt}%11
-\or\BL{-6pt}\TL{-6pt}\BR{2pt}\TR{-7pt}%12
-\or\BL{-5pt}\TL{-5pt}\BR{0pt}\TR{-9pt}%13
-\or\BL{-6pt}\TL{-6pt}\BR{0pt}\TR{-9pt}%14
-\or\BL{-3pt}\TL{-3pt}\BR{3pt}\TR{-6pt}%15
-\or\BL{-3pt}\TL{-3pt}\BR{3pt}\TR{-6pt}%16
-\or\BL{-5pt}\TL{-3pt}\BR{-8pt}\TR{-6pt}%17
-\or\BL{-5pt}\TL{-5pt}\BR{0pt}\TR{-9pt}%18
-\or\BL{-3pt}\TL{-3pt}\BR{-6pt}\TR{-9pt}%19
-\or\BL{0pt}\TL{0pt}\BR{0pt}\TR{-5pt}%20
-\fi
-
-\ifinapp\ifcase\c@chapter\relax%
-\or\BL{0pt}\TL{14pt}\BR{5pt}\TR{-19pt}%A
-\or\BL{0pt}\TL{-5pt}\BR{-3pt}\TR{-8pt}%B
-\or\BL{-3pt}\TL{-2pt}\BR{1pt}\TR{-6pt}\BLrule{0pt}%C
-\or\BL{0pt}\TL{-5pt}\BR{-3pt}\TR{-8pt}\BLrule{0pt}%D
-\or\BL{0pt}\TL{-5pt}\BR{2pt}\TR{-3pt}%E
-\or\BL{0pt}\TL{-5pt}\BR{-10pt}\TR{-1pt}%F
-\or\BL{-3pt}\TL{0pt}\BR{0pt}\TR{-7pt}%G
-\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%H
-\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%I
-\or\BL{2pt}\TL{0pt}\BR{-3pt}\TR{1pt}%J
-\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%K
-\or\BL{0pt}\TL{-5pt}\BR{2pt}\TR{-19pt}%L
-\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}%M
-\or\BL{0pt}\TL{-5pt}\BR{-2pt}\TR{-1pt}%N
-\or\BL{-3pt}\TL{-2pt}\BR{-3pt}\TR{-11pt}%O
-\or\BL{0pt}\TL{-5pt}\BR{-9pt}\TR{-3pt}%P
-\or\BL{-3pt}\TL{-2pt}\BR{-3pt}\TR{-11pt}%Q
-\or\BL{0pt}\TL{-5pt}\BR{4pt}\TR{-8pt}%R
-\or\BL{-2pt}\TL{-2pt}\BR{-2pt}\TR{-7pt}%S
-\or\BL{-3pt}\TL{0pt}\BR{-5pt}\TR{4pt}\BLrule{8pt}%T
-\or\BL{-7pt}\TL{-11pt}\BR{-5pt}\TR{-7pt}\BLrule{0pt}%U
-\or\BL{-14pt}\TL{-5pt}\BR{-14pt}\TR{-1pt}\BLrule{14pt}%V
-\or\BL{-10pt}\TL{-9pt}\BR{-13pt}\TR{-3pt}\BLrule{7pt}%W
-\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}\BLrule{0pt}%X
-\or\BL{-6pt}\TL{-4pt}\BR{-7pt}\TR{1pt}\BLrule{7pt}%Y
-\or\BL{0pt}\TL{-5pt}\BR{3pt}\TR{-1pt}\BLrule{0pt}%Z
-\fi\fi
-%%%%%%%
- \settowidth{\px}{\CNV\FmN{\@chapapp}}
- \addtolength{\px}{\tl} %MOD change 2pt to \tl
- \settoheight{\py}{\CNV\FmN{\@chapapp}}
- \addtolength{\py}{1pt}
-
- \settowidth{\mylen}{\CNV\FmN{\@chapapp}\space\CNoV\thechapter}
- \addtolength{\mylen}{\trr}% MOD change 1pt to \tr
- \settowidth{\pxx}{\CNoV\thechapter}
- \addtolength{\pxx}{-1pt}
-
- \settoheight{\pyy}{\CNoV\thechapter}
- \addtolength{\pyy}{-2pt}
- \setlength{\myhi}{\pyy}
- \addtolength{\myhi}{-1\py}
- \par
- \parbox[b]{\textwidth}{%
- \rule[\py]{\RW}{\myhi}%
- \hskip -\RW%
- \rule[\pyy]{\px}{\RW}%
- \hskip -\px%
- \raggedright%
- \CNV\FmN{\@chapapp}\rule{\blrule}{\RW}\hskip\bl\CNoV\thechapter%MOD
-% \CNV\FmN{\@chapapp}\space\CNoV\thechapter %ORIGINAL
- \hskip\br% %MOD 1pt to \br
- \mghrulefill{\RW}%
- \rule{\RW}{\pyy}\par\nobreak%
- \vskip -\baselineskip%
- \vskip -\pyy%
- \hskip \mylen%
- \mghrulefill{\RW}\par\nobreak%
- \vskip \pyy}%
- \vskip 20\p@}
-
-
- \renewcommand{\DOTI}[1]{%
- \raggedright
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@}
-
- \renewcommand{\DOTIS}[1]{%
- \raggedright
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@}
- }
-
-
-%
-
-
-%%%%%% BJORNSTRUP DEF
-
-\DeclareOption{Bjornstrup}{%
- \usecolortrue
- % pzc (Zapf Chancelery) is nice. ppl (Palatino) is cool too.
- \ChNumVar{\fontsize{76}{80}\usefont{OT1}{pzc}{m}{n}\selectfont}
- \ChTitleVar{\raggedleft\Large\sffamily\bfseries}
-
- \setlength{\myhi}{10pt} % Space between grey box border and text
- \setlength{\mylen}{\textwidth}
- \addtolength{\mylen}{-2\myhi}
- \renewcommand{\DOCH}{%
- \settowidth{\py}{\CNoV\thechapter}
- \addtolength{\py}{-10pt} % Amount of space by which the
-% % number is shifted right
- \fboxsep=0pt%
- \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}%
- \kern-\py\raise20pt%
- \hbox{\color[gray]{.5}\CNoV\thechapter}\\%
- }
-
- \renewcommand{\DOTI}[1]{%
- \nointerlineskip\raggedright%
- \fboxsep=\myhi%
- \vskip-1ex%
- \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
- \vskip 40\p@%
- }
-
- \renewcommand{\DOTIS}[1]{%
- \fboxsep=0pt
- \colorbox[gray]{.85}{\rule{0pt}{40pt}\parbox[b]{\textwidth}{\hfill}}\\%
- \nointerlineskip\raggedright%
- \fboxsep=\myhi%
- \colorbox[gray]{.85}{\parbox[t]{\mylen}{\CTV\FmTi{#1}}}\par\nobreak%
- \vskip 40\p@%
- }
-}
-
-
-%%%%%%% GLENN DEF
-
-
-\DeclareOption{Glenn}{%
- \ChNameVar{\bfseries\Large\sf}
- \ChNumVar{\Huge}
- \ChTitleVar{\bfseries\Large\rm}
- \ChRuleWidth{1pt}
- \ChNameUpperCase
- \ChTitleUpperCase
- \renewcommand{\DOCH}{%
- \settoheight{\myhi}{\CTV\FmTi{Test}}
- \setlength{\py}{\baselineskip}
- \addtolength{\py}{\RW}
- \addtolength{\py}{\myhi}
- \setlength{\pyy}{\py}
- \addtolength{\pyy}{-1\RW}
-
- \raggedright
- \CNV\FmN{\@chapapp}\space\CNoV\thechapter
- \hskip 3pt\mghrulefill{\RW}\rule[-1\pyy]{2\RW}{\py}\par\nobreak}
-
- \renewcommand{\DOTI}[1]{%
- \addtolength{\pyy}{-4pt}
- \settoheight{\myhi}{\CTV\FmTi{#1}}
- \addtolength{\myhi}{\py}
- \addtolength{\myhi}{-1\RW}
- \vskip -1\pyy
- \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
- \raggedleft\CTV\FmTi{#1}\par\nobreak
- \vskip 80\p@}
-
-\newlength{\backskip}
- \renewcommand{\DOTIS}[1]{%
-% \setlength{\py}{10pt}
-% \setlength{\pyy}{\py}
-% \addtolength{\pyy}{\RW}
-% \setlength{\myhi}{\baselineskip}
-% \addtolength{\myhi}{\pyy}
-% \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
-% \addtolength{}{}
-%\vskip -1\baselineskip
-% \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 2pt
-% \raggedleft\CTV\FmTi{#1}\par\nobreak
-% \vskip 60\p@}
-%% Fix suggested by Tomas Lundberg
- \setlength{\py}{25pt} % eller vad man vill
- \setlength{\pyy}{\py}
- \setlength{\backskip}{\py}
- \addtolength{\backskip}{2pt}
- \addtolength{\pyy}{\RW}
- \setlength{\myhi}{\baselineskip}
- \addtolength{\myhi}{\pyy}
- \mghrulefill{\RW}\rule[-1\py]{2\RW}{\pyy}\par\nobreak
- \vskip -1\backskip
- \rule{2\RW}{\myhi}\mghrulefill{\RW}\hskip 3pt %
- \raggedleft\CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@}
- }
-
-%%%%%%% CONNY DEF
-
-\DeclareOption{Conny}{%
- \ChNameUpperCase
- \ChTitleUpperCase
- \ChNameVar{\centering\Huge\rm\bfseries}
- \ChNumVar{\Huge}
- \ChTitleVar{\centering\Huge\rm}
- \ChRuleWidth{2pt}
-
- \renewcommand{\DOCH}{%
- \mghrulefill{3\RW}\par\nobreak
- \vskip -0.5\baselineskip
- \mghrulefill{\RW}\par\nobreak
- \CNV\FmN{\@chapapp}\space \CNoV\thechapter
- \par\nobreak
- \vskip -0.5\baselineskip
- }
- \renewcommand{\DOTI}[1]{%
- \mghrulefill{\RW}\par\nobreak
- \CTV\FmTi{#1}\par\nobreak
- \vskip 60\p@
- }
- \renewcommand{\DOTIS}[1]{%
- \mghrulefill{\RW}\par\nobreak
- \CTV\FmTi{#1}\par\nobreak
- \vskip 60\p@
- }
- }
-
-%%%%%%% REJNE DEF
-
-\DeclareOption{Rejne}{%
-
- \ChNameUpperCase
- \ChTitleUpperCase
- \ChNameVar{\centering\Large\rm}
- \ChNumVar{\Huge}
- \ChTitleVar{\centering\Huge\rm}
- \ChRuleWidth{1pt}
- \renewcommand{\DOCH}{%
- \settoheight{\py}{\CNoV\thechapter}
- \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
- \addtolength{\py}{-1pt}
- \CNV\FmN{\@chapapp}\par\nobreak
- \vskip 20\p@
- \setlength{\myhi}{2\baselineskip}
- \setlength{\px}{\myhi}
- \addtolength{\px}{-1\RW}
- \rule[-1\px]{\RW}{\myhi}\mghrulefill{\RW}\hskip
- 10pt\raisebox{-0.5\py}{\CNoV\thechapter}\hskip 10pt\mghrulefill{\RW}\rule[-1\px]{\RW}{\myhi}\par\nobreak
- \vskip -3\p@% Added -2pt vskip to correct for streched text v1.31
- }
- \renewcommand{\DOTI}[1]{%
- \setlength{\mylen}{\textwidth}
- \parskip=0pt plus 1pt % Set parskip to default, just in case v1.31
- \addtolength{\mylen}{-2\RW}
- {\vrule width\RW}\parbox{\mylen}{\CTV\FmTi{#1}}{\vrule width\RW}\par\nobreak%
- \vskip -3pt\rule{\RW}{2\baselineskip}\mghrulefill{\RW}\rule{\RW}{2\baselineskip}%
- \vskip 60\p@% Added -2pt in vskip to correct for streched text v1.31
- }
- \renewcommand{\DOTIS}[1]{%
- \setlength{\py}{\fboxrule}
- \setlength{\fboxrule}{\RW}
- \setlength{\mylen}{\textwidth}
- \addtolength{\mylen}{-2\RW}
- \fbox{\parbox{\mylen}{\vskip 2\baselineskip\CTV\FmTi{#1}\par\nobreak\vskip \baselineskip}}
- \setlength{\fboxrule}{\py}
- \vskip 60\p@
- }
- }
-
-
-%%%%%%% BJARNE DEF
-
-\DeclareOption{Bjarne}{%
- \ChNameUpperCase
- \ChTitleUpperCase
- \ChNameVar{\raggedleft\normalsize\rm}
- \ChNumVar{\raggedleft \bfseries\Large}
- \ChTitleVar{\raggedleft \Large\rm}
- \ChRuleWidth{1pt}
-
-
-%% Note thechapter -> c@chapter fix appendix bug
-%% Fixed misspelled 12
-
- \newcounter{AlphaCnt}
- \newcounter{AlphaDecCnt}
- \newcommand{\AlphaNo}{%
- \ifcase\number\theAlphaCnt
- \ifnum\c@chapter=0
- ZERO\else{}\fi
- \or ONE\or TWO\or THREE\or FOUR\or FIVE
- \or SIX\or SEVEN\or EIGHT\or NINE\or TEN
- \or ELEVEN\or TWELVE\or THIRTEEN\or FOURTEEN\or FIFTEEN
- \or SIXTEEN\or SEVENTEEN\or EIGHTEEN\or NINETEEN\fi
-}
-
- \newcommand{\AlphaDecNo}{%
- \setcounter{AlphaDecCnt}{0}
- \@whilenum\number\theAlphaCnt>0\do
- {\addtocounter{AlphaCnt}{-10}
- \addtocounter{AlphaDecCnt}{1}}
- \ifnum\number\theAlphaCnt=0
- \else
- \addtocounter{AlphaDecCnt}{-1}
- \addtocounter{AlphaCnt}{10}
- \fi
-
-
- \ifcase\number\theAlphaDecCnt\or TEN\or TWENTY\or THIRTY\or
- FORTY\or FIFTY\or SIXTY\or SEVENTY\or EIGHTY\or NINETY\fi
- }
- \newcommand{\TheAlphaChapter}{%
-
- \ifinapp
- \thechapter
- \else
- \setcounter{AlphaCnt}{\c@chapter}
- \ifnum\c@chapter<20
- \AlphaNo
- \else
- \AlphaDecNo\AlphaNo
- \fi
- \fi
- }
- \renewcommand{\DOCH}{%
- \mghrulefill{\RW}\par\nobreak
- \CNV\FmN{\@chapapp}\par\nobreak
- \CNoV\TheAlphaChapter\par\nobreak
- \vskip -1\baselineskip\vskip 5pt\mghrulefill{\RW}\par\nobreak
- \vskip 20\p@
- }
- \renewcommand{\DOTI}[1]{%
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@
- }
- \renewcommand{\DOTIS}[1]{%
- \CTV\FmTi{#1}\par\nobreak
- \vskip 40\p@
- }
-}
-
-\DeclareOption*{%
- \PackageWarning{fancychapter}{unknown style option}
- }
-
-\ProcessOptions* \relax
-
-\ifusecolor
- \RequirePackage{color}
-\fi
-\def\@makechapterhead#1{%
- \vspace*{50\p@}%
- {\parindent \z@ \raggedright \normalfont
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 040920
- \DOCH
- \fi
- \fi
- \interlinepenalty\@M
- \if@mainmatter%%%%% Fix for frontmatter, mainmatter, and backmatter 060424
- \DOTI{#1}%
- \else%
- \DOTIS{#1}%
- \fi
- }}
-
-
-%%% Begin: To avoid problem with scrbook.cls (fncychap version 1.32)
-
-%%OUT:
-%\def\@schapter#1{\if@twocolumn
-% \@topnewpage[\@makeschapterhead{#1}]%
-% \else
-% \@makeschapterhead{#1}%
-% \@afterheading
-% \fi}
-
-%%IN:
-\def\@schapter#1{%
-\if@twocolumn%
- \@makeschapterhead{#1}%
-\else%
- \@makeschapterhead{#1}%
- \@afterheading%
-\fi}
-
-%%% End: To avoid problem with scrbook.cls (fncychap version 1.32)
-
-\def\@makeschapterhead#1{%
- \vspace*{50\p@}%
- {\parindent \z@ \raggedright
- \normalfont
- \interlinepenalty\@M
- \DOTIS{#1}
- \vskip 40\p@
- }}
-
-\endinput
-
-
diff --git a/sphinx/texinputs/footnotehyper-sphinx.sty b/sphinx/texinputs/footnotehyper-sphinx.sty
new file mode 100644
index 000000000..a714f211d
--- /dev/null
+++ b/sphinx/texinputs/footnotehyper-sphinx.sty
@@ -0,0 +1,156 @@
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{footnotehyper-sphinx}%
+ [2016/10/27 v0.9f hyperref aware footnote.sty for sphinx (JFB)]
+%%
+%% Package: footnotehyper-sphinx
+%% Version: based on footnotehyper.sty v0.9f (2016/10/03)
+%% as available at http://www.ctan.org/pkg/footnotehyper
+%% License: the one applying to Sphinx
+%%
+%% Differences from footnotehyper v0.9f (2016/10/03):
+%% 1. hyperref is assumed in use (with default hyperfootnotes=true),
+%% 2. no need to check if footnote.sty was loaded,
+%% 3. a special tabulary compatibility layer added, (partial but enough for
+%% Sphinx),
+%% 4. \sphinxfootnotemark, and use of \spx@opt@BeforeFootnote from sphinx.sty.
+%% Note: with \footnotemark[N]/\footnotetext[N] syntax, hyperref
+%% does not insert an hyperlink. This is _not_ improved here.
+%%
+\DeclareOption*{\PackageWarning{footnotehyper}{Option `\CurrentOption' is unknown}}%
+\ProcessOptions\relax
+\let\FNH@@makefntext\@makefntext\let\@makefntext\@firstofone
+\RequirePackage{footnote}
+\let\fnparbox\parbox\let\parbox\fn@parbox\let\@makefntext\FNH@@makefntext
+\let\FNH@fn@footnote \footnote % buggy footnote.sty's \footnote
+\let\FNH@fn@footnotetext\footnotetext % will be redefined later
+\let\footnote \fn@latex@@footnote % meaning of \footnote before footnote.sty
+\let\footnotetext\fn@latex@@footnotetext
+\def\fn@endnote {\color@endgroup}%
+\AtBeginDocument {%
+ \let\fn@latex@@footnote \footnote % meaning of \footnote at end of preamble
+ \let\fn@latex@@footnotetext\footnotetext
+ \let\fn@fntext \FNH@hyper@fntext
+ \let\spewnotes \FNH@hyper@spewnotes
+ \let\endsavenotes\spewnotes
+ \let\fn@endfntext\FNH@fixed@endfntext
+ \let\footnote \FNH@fixed@footnote
+ \let\footnotetext\FNH@fixed@footnotetext
+ \let\endfootnote\fn@endfntext
+ \let\endfootnotetext\endfootnote
+}%
+\def\FNH@hyper@fntext {%
+%% amsmath compatibility
+ \ifx\ifmeasuring@\undefined\expandafter\@secondoftwo
+ \else\expandafter\@firstofone\fi
+ {\ifmeasuring@\expandafter\@gobbletwo\else\expandafter\@firstofone\fi}%
+%% partial tabulary compatibility, [N] must be used, but Sphinx does it
+ {\ifx\equation$\expandafter\@gobbletwo\fi\FNH@hyper@fntext@i }%$
+}%
+\long\def\FNH@hyper@fntext@i #1{\global\setbox\fn@notes\vbox
+ {\unvbox\fn@notes
+ \fn@startnote
+ \@makefntext
+ {\rule\z@\footnotesep\ignorespaces
+ \ifHy@nesting\expandafter\ltx@firstoftwo
+ \else\expandafter\ltx@secondoftwo
+ \fi
+ {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}{#1}}%
+ {\Hy@raisedlink
+ {\expandafter\hyper@@anchor\expandafter{\Hy@footnote@currentHref}%
+ {\relax}}%
+ \let\@currentHref\Hy@footnote@currentHref
+ \let\@currentlabelname\@empty
+ #1}%
+ \@finalstrut\strutbox }%
+ \fn@endnote }%
+}%
+\def\FNH@hyper@spewnotes {\endgroup
+ \if@savingnotes\else\ifvoid\fn@notes\else
+ \begingroup\let\@makefntext\@empty
+ \let\@finalstrut\@gobble
+ \let\rule\@gobbletwo
+ \H@@footnotetext{\unvbox\fn@notes}%
+ \endgroup\fi\fi
+}%
+\def\FNH@fixed@endfntext {%
+ \@finalstrut\strutbox
+ \fn@postfntext
+ \fn@endnote
+ \egroup\FNH@endfntext@next % will decide if link or no link
+}%
+\def\FNH@endfntext@link {\begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble\let\rule\@gobbletwo
+ \@footnotetext {\unvbox\z@}%
+ \endgroup
+}%
+\def\FNH@endfntext@nolink {\begingroup
+ \let\@makefntext\@empty\let\@finalstrut\@gobble
+ \let\rule\@gobbletwo
+ \if@savingnotes\expandafter\fn@fntext\else\expandafter\H@@footnotetext\fi
+ {\unvbox\z@}\endgroup
+}%
+%% \spx@opt@BeforeFootnote is defined in sphinx.sty
+\def\FNH@fixed@footnote {\spx@opt@BeforeFootnote\ifx\@currenvir\fn@footnote
+ \expandafter\FNH@footnoteenv\else\expandafter\fn@latex@@footnote\fi }%
+\def\FNH@footnoteenv {\@ifnextchar[\FNH@xfootnoteenv%]
+ {\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}\@footnotemark
+ \def\FNH@endfntext@next{\FNH@endfntext@link}\fn@startfntext}}%
+\def\FNH@xfootnoteenv [#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup\@footnotemark\def\FNH@endfntext@next{\FNH@endfntext@link}%
+ \fn@startfntext}%
+\def\FNH@fixed@footnotetext {\ifx\@currenvir\fn@footnotetext
+ \expandafter\FNH@footnotetextenv\else\expandafter\fn@latex@@footnotetext\fi}%
+\def\FNH@footnotetextenv {\@ifnextchar[\FNH@xfootnotetextenv%]
+ {\protected@xdef\@thefnmark{\thempfn}%
+ \def\FNH@endfntext@next{\FNH@endfntext@link}\fn@startfntext}}%
+\def\FNH@xfootnotetextenv [#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup\def\FNH@endfntext@next{\FNH@endfntext@nolink}%
+ \fn@startfntext }%
+% Now some checks in case some package has modified \@makefntext.
+\AtBeginDocument
+{% compatibility with French module of LaTeX babel
+ \ifx\@makefntextFB\undefined
+ \expandafter\@gobble\else\expandafter\@firstofone\fi
+ {\ifFBFrenchFootnotes \let\FNH@@makefntext\@makefntextFB \else
+ \let\FNH@@makefntext\@makefntextORI\fi}%
+ \expandafter\FNH@check@a\FNH@@makefntext{1.2!3?4,}\FNH@@@1.2!3?4,\FNH@@@\relax
+}%
+\long\def\FNH@check@a #11.2!3?4,#2\FNH@@@#3%
+{%
+ \ifx\relax#3\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi
+ \FNH@bad@footnote@env
+ {\def\fn@prefntext{#1}\def\fn@postfntext{#2}\FNH@check@b}%
+}%
+\def\FNH@check@b #1\relax
+{%
+ \expandafter\expandafter\expandafter\FNH@check@c
+ \expandafter\meaning\expandafter\fn@prefntext
+ \meaning\fn@postfntext1.2!3?4,\FNH@check@c\relax
+}%
+\def\FNH@check@c #11.2!3?4,#2#3\relax
+ {\ifx\FNH@check@c#2\expandafter\@gobble\fi\FNH@bad@footnote@env}%
+\def\FNH@bad@footnote@env
+{\PackageWarningNoLine{footnotehyper}%
+ {The footnote environment from package footnote^^J
+ will be dysfunctional, sorry (not my fault...). You may try to make a bug^^J
+ report at https://github.com/sphinx-doc/sphinx including the next lines:}%
+ \typeout{\meaning\@makefntext}%
+ \let\fn@prefntext\@empty\let\fn@postfntext\@empty
+}%
+%% \sphinxfootnotemark: usable in section titles and silently removed from
+%% TOCs.
+\def\sphinxfootnotemark [#1]%
+ {\ifx\thepage\relax\else \protect\spx@opt@BeforeFootnote
+ \protect\footnotemark[#1]\fi}%
+\AtBeginDocument % let hyperref less complain
+ {\pdfstringdefDisableCommands{\def\sphinxfootnotemark [#1]{}}}%
+\endinput
+%%
+%% End of file `footnotehyper-sphinx.sty'.
diff --git a/sphinx/texinputs/iftex.sty b/sphinx/texinputs/iftex.sty
deleted file mode 100755
index 765146644..000000000
--- a/sphinx/texinputs/iftex.sty
+++ /dev/null
@@ -1,97 +0,0 @@
-%%
-%% This is file `iftex.sty',
-
-%%
-%% __________________________________
-%% Copyright © 2010–2013 Persian TeX Group
-%%
-%% License information appended.
-%%
-%%
-\csname iftexloaded\endcsname
-\let\iftexloaded\endinput
-\expandafter\ifx\csname ProvidesPackage\endcsname\relax\else
- \ProvidesPackage{iftex}
- [2013/04/04 v0.2 Provides if(tex) conditional for PDFTeX, XeTeX, and LuaTeX]
-\fi
-\def\RequirePDFTeX{%
- \ifPDFTeX\else
- \begingroup
- \errorcontextlines=-1\relax
- \newlinechar=10\relax
- \errmessage{^^J
- ********************************************^^J
- * PDFTeX is required to compile this document.^^J
- * Sorry!^^J
- ********************************************}%
- \endgroup
- \fi}
-\def\RequireXeTeX{%
- \ifXeTeX\else
- \begingroup
- \errorcontextlines=-1\relax
- \newlinechar=10\relax
- \errmessage{^^J
- ********************************************^^J
- * XeTeX is required to compile this document.^^J
- * Sorry!^^J
- ********************************************}%
- \endgroup
- \fi}
-\def\RequireLuaTeX{%
- \ifLuaTeX\else
- \begingroup
- \errorcontextlines=-1\relax
- \newlinechar=10\relax
- \errmessage{^^J
- ********************************************^^J
- * LuaTeX is required to compile this document.^^J
- * Sorry!^^J
- ********************************************}%
- \endgroup
- \fi}
-\expandafter\ifx\csname ifPDFTeX\endcsname\relax\else
- \expandafter\endinput
-\fi
-\expandafter\ifx\csname ifXeTeX\endcsname\relax\else
- \expandafter\endinput
-\fi
-\expandafter\ifx\csname ifLuaTeX\endcsname\relax\else
- \expandafter\endinput
-\fi
-\newif\ifPDFTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname pdfmatch\endcsname\relax
- \PDFTeXfalse
-\else
- \PDFTeXtrue
-\fi
-\newif\ifXeTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname XeTeXinterchartoks\endcsname\relax
- \XeTeXfalse
-\else
- \XeTeXtrue
-\fi
-\newif\ifLuaTeX
-\begingroup\expandafter\expandafter\expandafter\endgroup
-\expandafter\ifx\csname directlua\endcsname\relax
- \LuaTeXfalse
-\else
- \LuaTeXtrue
-\fi
-%%
-%% Copyright © 2010–2013 by Persian TeX Group <persian-tex@tug.org>
-%%
-%% Distributable under the LaTeX Project Public License,
-%% version 1.3c or higher (your choice). The latest version of
-%% this license is at: http://www.latex-project.org/lppl.txt
-%%
-%% This work is "maintained" (as per LPPL maintenance status)
-%% by Persian TeX Group.
-%%
-%%
-%%
-%%
-%%
-%% End of file `iftex.sty'.
diff --git a/sphinx/texinputs/newfloat.sty b/sphinx/texinputs/newfloat.sty
deleted file mode 100644
index 47ac5e568..000000000
--- a/sphinx/texinputs/newfloat.sty
+++ /dev/null
@@ -1,737 +0,0 @@
-%%
-%% This is file `newfloat.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% newfloat.dtx (with options: `package')
-%%
-%% Copyright (C) 1994-2016 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
-%%
-%% http://sourceforge.net/projects/latex-caption/
-%%
-%% --------------------------------------------------------------------------
-%%
-%% This work may be distributed and/or modified under the
-%% conditions of the LaTeX Project Public License, either version 1.3
-%% of this license or (at your option) any later version.
-%% The latest version of this license is in
-%% http://www.latex-project.org/lppl.txt
-%% and version 1.3 or later is part of all distributions of LaTeX
-%% version 2003/12/01 or later.
-%%
-%% This work has the LPPL maintenance status "maintained".
-%%
-%% This Current Maintainer of this work is Axel Sommerfeldt.
-%%
-%% This work consists of the files
-%% CHANGELOG, README, SUMMARY, caption.ins,
-%% caption.dtx, caption2.dtx, caption3.dtx,
-%% bicaption.dtx, ltcaption.dtx, subcaption.dtx,
-%% newfloat.dtx, and totalcount.dtx
-%% the derived files
-%% caption.sty, caption2.sty, caption3.sty,
-%% bicaption.sty, ltcaption.sty, subcaption.sty,
-%% newfloat.sty, and totalcount.sty
-%% and the user manuals
-%% caption-deu.tex, caption-eng.tex, and caption-rus.tex.
-%%
-\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\def\caption@tempa$Id: #1 #2 #3-#4-#5 #6${%
- \def\caption@tempa{#3/#4/#5 }\def\caption@tempb{#2 }}
-\caption@tempa $Id: newfloat.dtx 109 2015-09-17 09:29:07Z sommerfeldt $
-\ProvidesPackage{newfloat}[\caption@tempa v1.1-\caption@tempb Defining new floating environments (AR)]
-\newcommand*\newfloat@Info[1]{%
- \PackageInfo{newfloat}{#1}}
-\newcommand*\newfloat@InfoNoLine[1]{%
- \newfloat@Info{#1\@gobble}}
-\newcommand*\newfloat@Error[1]{%
- \PackageError{newfloat}{#1}\newfloat@eh}
-\newcommand*\newfloat@eh{%
- If you do not understand this error, please take a closer look\MessageBreak
- at the documentation of the `newfloat' package.\MessageBreak\@ehc}
-\RequirePackage{keyval}[1997/11/10]
-\newcommand*\newfloat@def[2]{%
- \newfloat@ifundefined{#1}{%
- \@namedef{#1}{#2}}}
-\newcommand*\newfloat@let[2]{%
- \newfloat@ifundefined{#1}{%
- \expandafter\let\csname #1\endcsname#2}}
-\newcommand*\newfloat@ifundefined[2]{%
- \@ifundefined{#1}{#2}{%
- \newfloat@Info{%
- \expandafter\string\csname#1\endcsname\space is already defined}}}
-\newcommand*\DeclareFloatingEnvironment{%
- \@testopt\@DeclareFloatingEnvironment{}}
-\@onlypreamble\DeclareFloatingEnvironment
-\def\@DeclareFloatingEnvironment[#1]#2{%
- \newfloat@Info{New float `#2' with options `#1'}%
- \newfloat@ifundefined{c@#2}{\newcounter{#2}}%
- \ifdefined\c@float@type % from float package
- \expandafter\edef\csname ftype@#2\endcsname{\the\value{float@type}}%
- \addtocounter{float@type}{\value{float@type}}%
- \else\ifdefined\c@newflo@tctr % from memoir document class
- \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}%
- \advance\c@newflo@tctr \c@newflo@tctr
- \else
- \ifdefined\newfloat@ftype \else
- \newcount\newfloat@ftype
- \newfloat@ftype=8\relax
- \fi
- \expandafter\xdef\csname ftype@#2\endcsname{\the\newfloat@ftype}%
- \advance\newfloat@ftype\newfloat@ftype
- \fi\fi
- \newfloat@Info{float type `#2'=\@nameuse{ftype@#2}}%
- \newfloat@def{fnum@#2}%
- {\@nameuse{#2name}\nobreakspace\@nameuse{the#2}\@nameuse{autodot}}%
- \newfloat@capitalize\newfloat@Type{#2}%
- \newfloat@let{#2name}{\newfloat@Type}%
- \newfloat@def{fleg#2}{\@nameuse{#2name}}% legend naming (memoir)
- \newfloat@ifundefined{flegtoc#2}{\@namedef{flegtoc#2}##1{}}%
- \ifcsname @tufte@float\endcsname
- \newenvironment{#2}[1][htbp]%
- {\begin{@tufte@float}[##1]{#2}{}}%
- {\end{@tufte@float}}%
- \newenvironment{#2*}[1][htbp]%
- {\begin{@tufte@float}[##1]{#2}{star}}%
- {\end{@tufte@float}}%
- \else
- \newenvironment{#2}{\@float{#2}}{\end@float}%
- \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}%
- \fi
- \newfloat@def{listof#2}{\newfloat@listof{#2}}%
- \newfloat@def{listof#2s}{\@nameuse{listof#2}}%
- \newfloat@def{listof#2es}{\@nameuse{listof#2s}}%
- \newfloat@def{newfloat@listof#2@hook}{}%
- \ifdefined\l@figure
- \newfloat@let{l@#2}{\l@figure}%
- \else
- \newfloat@def{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}%
- \fi
- \edef\newfloat@tempa{List of \newfloat@Type s}%
- \newfloat@let{list#2name}{\newfloat@tempa}%
- \expandafter\let\csname fst@#2\endcsname\@undefined
- \newfloat@ifundefined{fps@#2}{\newfloat@setplacement{#2}{tbp}}%
- \newfloat@ifundefined{ext@#2}{\newfloat@setfileext{#2}{lo#2}}%
- \newfloat@setoptions*{#2}{#1}%
- \@expandtwoargs\newfloat@announce{#2}{\@nameuse{ext@#2}}%
- \@ifnextchar[\newfloat@DFE@setname\relax}
-\@onlypreamble\@DeclareFloatingEnvironment
-\def\newfloat@DFE@setname[#1]{%
- \KV@@newfloat@name{#1}%
- \@ifnextchar[\newfloat@DFE@setlistname\relax}
-\@onlypreamble\newfloat@DFE@setname
-\def\newfloat@DFE@setlistname[#1]{%
- \KV@@newfloat@listname{#1}}
-\@onlypreamble\newfloat@DFE@setlistname
-\newcommand*\newfloat@capitalize[2]{%
- \edef\newfloat@tempa{\gdef\noexpand#1{\@car#2\@nil}}%
- \uppercase\expandafter{\newfloat@tempa}%
- \edef\newfloat@tempa{%
- \noexpand\g@addto@macro\noexpand#1{\@cdr#2\@nil}}%
- \newfloat@tempa}
-\newcommand*\newfloat@listof[1]{%
- \@expandtwoargs\newfloat@list@of{#1}{\@nameuse{ext@#1}}}
-\newcommand*\newfloat@list@of[2]{%
- \begingroup
- \expandafter\let\expandafter\listfigurename\csname list#1name\endcsname
- \def\ext@figure{#2}%
- \let\newfloat@starttoc\@starttoc
- \def\@starttoc##1{\newfloat@starttoc{#2}}%
- \let\newfloat@listoftoc\listoftoc
- \def\listoftoc##1{\newfloat@listoftoc{#2}}%
- \@nameuse{newfloat@listof#1@hook}%
- \listoffigures
- \endgroup}
-\newcommand*\newfloat@setoptions{%
- \@ifstar
- {\newfloat@@setoptions\@firstofone}%
- {\newfloat@@setoptions\@gobble}}
-\newcommand*\newfloat@@setoptions[3]{%
- \let\newfloat@within@value\@undefined
- \let\newfloat@chapterlistsgaps@value\@undefined
- #1{\KV@@newfloat@within\newfloat@within@default}% set default value for new floats
- \def\newfloat@type{#2}%
- \setkeys{@newfloat}{#3}%
- \ifx\newfloat@within@value\@undefined \else
- \newfloat@setoption{within}\newfloat@within@value
- \fi
- \ifx\newfloat@chapterlistsgaps@value\@undefined \else
- \newfloat@setoption{chapterlistsgaps}\newfloat@chapterlistsgaps@value
- \fi}
-\newcommand*\newfloat@within@default{%
- \ifcsname c@chapter\endcsname chapter\else none\fi}
-\@onlypreamble\newfloat@within@default
-\newcommand*\newfloat@setoption[1]{%
- \edef\caption@tempa{\noexpand\@nameuse{newfloat@set#1}{\newfloat@type}}%
- \caption@tempa}
-\newcommand*\newfloat@setfileext[2]{%
- \@namedef{ext@#1}{#2}}
-\define@key{@newfloat}{fileext}{%
- \newfloat@setoption{fileext}{#1}}
-\newcommand*\newfloat@setlistname[2]{%
- \@namedef{list#1name}{#2}}
-\define@key{@newfloat}{listname}{%
- \newfloat@setoption{listname}{#1}}
-\newcommand*\newfloat@setname[2]{%
- \newfloat@@setname{#1}{#2}%
- \begingroup
- \ifcsname languagename\endcsname
- \ifcsname captions\languagename\endcsname
- \expandafter\g@addto@macro\csname captions\languagename\endcsname
- {\newfloat@@setname{#1}{#2}}%
- \fi
- \fi
- \endgroup}
-%%\AtBeginDocument{\let\newfloat@setname\newfloat@@setname}
-\newcommand*\newfloat@@setname[2]{%
- \@namedef{#1name}{#2}}
-\define@key{@newfloat}{name}{%
- \newfloat@setoption{name}{#1}}
-\newcommand*\newfloat@setplacement[2]{%
- \@namedef{fps@#1}{#2}}
-\define@key{@newfloat}{placement}{%
- \newfloat@setoption{placement}{#1}}
-\newcommand*\newfloat@setwithin[2]{%
- \ifcsname c@chapter\endcsname
- \@removefromreset{#1}{chapter}%
- \fi
- \@removefromreset{#1}{section}%
- \edef\@tempa{#2}%
- \ifx\@tempa\@empty
- \def\@tempa{none}%
- \fi
- \def\@tempb{none}%
- \ifx\@tempa\@tempb
- \ifcsname c@chapter\endcsname
- \@chapterlistsgap@off{#1}%
- \fi
- \newfloat@@setwithin{#1}{}{}%
- \else
- \def\@tempb{chapter}%
- \ifx\@tempa\@tempb
- \@addtoreset{#1}{chapter}%
- \@chapterlistsgap@on{#1}%
- \newfloat@@setwithin{#1}{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}%
- \else
- \def\@tempb{section}%
- \ifx\@tempa\@tempb
- \@addtoreset{#1}{section}%
- \ifcsname c@chapter\endcsname
- \@addtoreset{#1}{chapter}%
- \@chapterlistsgap@on{#1}%
- \newfloat@@setwithin{#1}{\thesection.}{\theHsection.}%
- \else
- \newfloat@@setwithin{#1}{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}%
- \fi
- \else
- \newfloat@Error{Invalid value `#2' for option `within'}%
- \fi
- \fi
- \fi}
-\newcommand*\newfloat@@setwithin[3]{%
- \global\@namedef{the#1}{#2\arabic{#1}}%
- \global\@namedef{theH#1}{#3\arabic{#1}}}
-\define@key{@newfloat}{within}{%
- \def\newfloat@within@value{#1}}
-\newcommand*\newfloat@setwithout[1]{%
- \newfloat@setwithin{#1}{none}}
-\define@key{@newfloat}{without}[]{%
- \def\newfloat@within@value{none}}
-\newcommand*\newfloat@setchapterlistsgaps[2]{%
- \edef\@tempa{#2}%
- \def\@tempb{off}%
- \ifx\@tempa\@tempb
- \@chapterlistsgap@off{#1}%
- \else
- \def\@tempb{on}%
- \ifx\@tempa\@tempb
- \@chapterlistsgap@on{#1}%
- \else
- \newfloat@Error{Invalid value `#2' for option `chapterlistsgaps'}%
- \fi
- \fi}
-\define@key{@newfloat}{chapterlistsgaps}{%
- \def\newfloat@chapterlistsgaps@value{#1}}
-\providecommand*\@removefromreset[2]{{%
- \expandafter\let\csname c@#1\endcsname\@removefromreset
- \def\@elt##1{%
- \expandafter\ifx\csname c@##1\endcsname\@removefromreset
- \else
- \noexpand\@elt{##1}%
- \fi}%
- \expandafter\xdef\csname cl@#2\endcsname{%
- \csname cl@#2\endcsname}}}
-\newcommand*\newfloat@announce[2]{%
- \@cons\newfloat@list{{#1}}%
- \@cons\newfloat@@list{{#1}}%
- \newfloat@ifundefined{newfloat@ext@#2}{%
- \@namedef{newfloat@ext@#2}{#1}%
- \ifcsname c@lofdepth\endcsname
- \newfloat@ifundefined{c@#2depth}{%
- \newcounter{#2depth}%
- \setcounter{#2depth}{1}}%
- \fi
- \ifcsname addtotoclist\endcsname
- \addtotoclist[float]{#2}%
- \newfloat@def{listof#2name}{\@nameuse{list#1name}}%
- \fi
- }%
- \ifcsname contentsuse\endcsname
- \contentsuse{#1}{#2}%
- \fi
- \newfloat@hook{#1}}
-\@onlypreamble\newfloat@announce
-\newcommand*\newfloat@@list{}
-\newcommand*\SetupFloatingEnvironment[1]{%
- \newfloat@addtolist{#1}%
- \newfloat@setoptions{#1}}
-\newcommand\ForEachFloatingEnvironment{%
- \@ifstar
- {\@ForEachFloatingEnvironment\@gobble}%
- {\@ForEachFloatingEnvironment\@iden}}
-\newcommand\@ForEachFloatingEnvironment[2]{%
- \def\@elt##1{#2}%
- \newfloat@list
- \let\@elt\relax
- #1{\newfloat@addtohook{#2}}}
-\providecommand\newfloat@addtohook[1]{%
- \toks@=\expandafter{\newfloat@hook{##1}#1}%
- \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%
- \@tempa}
-\providecommand*\newfloat@hook[1]{}
-\newcommand\PrepareListOf[1]{%
- \expandafter\g@addto@macro\csname newfloat@listof#1@hook\endcsname}
-\@onlypreamble\PrepareListOf
-\newcommand*\newfloat@list{}
-\newcommand*\newfloat@addtolist[1]{%
- \newfloat@ifinlist{#1}{}{%
- \ifcsname ext@#1\endcsname
- \@cons\newfloat@list{{#1}}%
- \@namedef{newfloat@ext@\@nameuse{ext@#1}}{#1}%
- \newfloat@let{@ifchapterlistsgap@#1}{\@iden}%
- \else
- \newfloat@Error{`#1' does not seem to be a floating environment}%
- \fi}}
-\newcommand*\newfloat@ifinlist[1]{%
- \let\next\@secondoftwo
- \begingroup
- \expandafter\let\csname c@#1\endcsname\newfloat@ifinlist
- \def\@elt##1{%
- \expandafter\ifx\csname c@##1\endcsname\newfloat@ifinlist
- \global\let\next\@firstoftwo
- \fi}%
- \newfloat@list
- \endgroup
- \next}
-\ifcsname ext@figure\endcsname
- \newfloat@addtolist{figure}
-\fi
-\ifcsname ext@table\endcsname
- \newfloat@addtolist{table}
-\fi
-\ifcsname @chapter\endcsname
- \providecommand*\@chapterlistsgap{10\p@}%
- \providecommand*\@addchapterlistsgap[2]{%
- \@nameuse{@ifchapterlistsgap@#1}{% if switched on
- \@@addchapterlistsgap{#1}{#2}}}
- \providecommand*\@@addchapterlistsgap[2]{%
- \@ifundefined{@addchapterlistsgap@#2}{% only once per extension
- \@namedef{@addchapterlistsgap@#2}{#1}%
- \@@@addchapterlistsgap{#2}}{}}
- \providecommand*\@@@addchapterlistsgap[1]{%
- \ifdim \@chapterlistsgap>\z@
- \addtocontents{#1}{\protect\addvspace{\@chapterlistsgap}}%
- \fi}
- \providecommand*\@addchapterlistsgaps{%
- \begingroup
- \def\@elt##1{%
- \@expandtwoargs\@addchapterlistsgap{##1}{\@nameuse{ext@##1}}}%
- \newfloat@list
- \endgroup}
- \providecommand*\@chapterlistsgap@off[1]{%
- \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@gobble
- \ifcsname unsettoc\endcsname
- \@expandtwoargs\unsettoc{\@nameuse{ext@#1}}{chapteratlist}%
- \fi}
- \providecommand*\@chapterlistsgap@on[1]{%
- \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@iden
- \ifcsname setuptoc\endcsname
- \@expandtwoargs\setuptoc{\@nameuse{ext@#1}}{chapteratlist}%
- \fi}
-\fi
-\define@key{newfloat}{chapterlistsgap}{%
- \renewcommand*\@chapterlistsgap{#1}}
-\define@key{newfloat}{within}{%
- \def\newfloat@within@default{#1}% set new default value
- \def\@elt##1{\newfloat@setwithin{##1}{#1}}%
- \newfloat@list
- \let\@elt\relax}
-\define@key{newfloat}{without}[]{%
- \KV@newfloat@within{none}}
-\def\@elt#1{%
- \define@key{newfloat}{#1name}{%
- \newfloat@setname{#1}{##1}}%
- \define@key{newfloat}{list#1name}{%
- \newfloat@setname{list#1}{##1}}%
- \define@key{newfloat}{#1within}{%
- \newfloat@setwithin{#1}{##1}}%
- \define@key{newfloat}{#1without}[]{%
- \newfloat@setwithout{#1}}%
-}%
-\newfloat@list
-\let\@elt\relax
-\define@key{newfloat}{planb}[true]{%
- \def\@tempa{#1}%
- \def\@tempb{false}%
- \ifx\@tempa\@tempb
- \let\newfloat@ifplanb\@gobble
- \else
- \def\@tempb{true}%
- \ifx\@tempa\@tempb
- \let\newfloat@ifplanb\@iden
- \else
- \newfloat@Error{Invalid value `#1' for option `planb'}%
- \fi
- \fi}
-\define@key{newfloat}{planb-fileext}{%
- \newfloat@Info{Setting Plan B file extension to `#1'}
- \xdef\newfloat@addtocontents@ext{#1}}
-
-\let\@tempc\relax
-\@expandtwoargs\setkeys{newfloat}{planb,\@ptionlist{\@currname.\@currext}}%
-\AtEndOfPackage{\let\@unprocessedoptions\relax}
-\newcommand*\newfloatsetup{\setkeys{newfloat}}
-\newcommand\newfloat@replace@chapter[2]{%
- \begingroup
- \let\if@twocolumn\iffalse
- \let\if@mainmatter\iffalse
- \let\if@thema\iffalse
- \def\@tempa[##1]##2{#1}%
- \ifx\@tempa\@chapter
- \gdef\@chapter[##1]##2{#2}%
- \global\let\newfloat@replace@chapter\@gobbletwo
- \else\ifx\@tempa\Hy@org@chapter
- \gdef\Hy@org@chapter[##1]##2{#2}%
- \global\let\newfloat@replace@chapter\@gobbletwo
- \fi\fi
- \endgroup}
-\ifcsname @chapter\endcsname \else
- \let\newfloat@replace@chapter\@gobbletwo
-\fi
-\newfloat@replace@chapter{%
- \ifnum \c@secnumdepth >\m@ne
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi
-}{%
- \ifnum \c@secnumdepth >\m@ne
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \chaptermark{#1}%
- \@addchapterlistsgaps
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi}
-\newfloat@replace@chapter{%
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi
-}{%
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}#1}%
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \chaptermark{#1}%
- \@addchapterlistsgaps
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi}
-\newfloat@replace@chapter{%
- \refstepcounter{chapter}%
- \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
- \else \let\@secnumber\thechapter \fi
- \typeout{\chaptername\space\@secnumber}%
- \def\@toclevel{0}%
- \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}%
- \else \@tocwriteb\tocchapter{chapter}{#2}\fi
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \@makechapterhead{#2}\@afterheading
-}{%
- \refstepcounter{chapter}%
- \ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
- \else \let\@secnumber\thechapter \fi
- \typeout{\chaptername\space\@secnumber}%
- \def\@toclevel{0}%
- \ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}%
- \else \@tocwriteb\tocchapter{chapter}{#2}\fi
- \chaptermark{#1}%
- \@addchapterlistsgaps
- \@makechapterhead{#2}\@afterheading}
-\@ifpackageloaded{tocbasic}{%
- \let\newfloat@replace@chapter\@gobbletwo}{}
-\ifcsname insertchapterspace\endcsname
- \renewcommand*\insertchapterspace{\@addchapterlistsgaps}
- \let\newfloat@replace@chapter\@gobbletwo
-\fi
-\newfloat@replace@chapter{%
- \ifnum \c@secnumdepth >\m@ne
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}\toc@font0 #1}%
- \else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
- \fi
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi
-}{%
- \ifnum \c@secnumdepth >\m@ne
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}\toc@font0 #1}%
- \else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
- \fi
- \chaptermark{#1}%
- \@addchapterlistsgaps
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi}
- % boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class]
-\newfloat@replace@chapter{%
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}\toc@font0 #1}%
- \else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
- \fi
- \chaptermark{#1}%
- \addtocontents{lof}{\protect\addvspace{10\p@}}%
- \addtocontents{lot}{\protect\addvspace{10\p@}}%
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi
-}{%
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\@chapapp\space\thechapter.}%
- \addcontentsline{toc}{chapter}%
- {\protect\numberline{\thechapter}\toc@font0 #1}%
- \else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{\toc@font0 #1}%
- \fi
- \chaptermark{#1}%
- \@addchapterlistsgaps
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi}
-\newfloat@replace@chapter{%
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\chaptername\space\thechapter.}
- \if@thema
- \ifx\@shortauthor\@empty
- \addcontentsline{toc}{chapter}{%
- \protect\numberline{\thechapter.}#1}%
- \else
- \addcontentsline{toc}{chapter}{%
- \protect\numberline{\thechapter.}%
- \@shortauthor\hfill\mbox{}\vskip\normallineskip #1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{%
- \protect\numberline{\thechapter.}#1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{#1}
- \fi
- \else
- \addcontentsline{toc}{chapter}{#1}
- \fi
- \chaptermark{#1}
- \addtocontents{lof}{\protect\addvspace{10pt}}
- \addtocontents{lot}{\protect\addvspace{10pt}}
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]
- \else
- \@makechapterhead{#2}
- \@afterheading
- \fi
-}{%
- \ifnum \c@secnumdepth >\m@ne
- \if@mainmatter
- \refstepcounter{chapter}%
- \typeout{\chaptername\space\thechapter.}%
- \if@thema
- \ifx\@shortauthor\@empty
- \addcontentsline{toc}{chapter}{%
- \protect\numberline{\thechapter.}#1}%
- \else
- \addcontentsline{toc}{chapter}{%
- \protect\numberline{\thechapter.}%
- \@shortauthor\hfill\mbox{}\vskip\normallineskip #1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{%
- \protect\numberline{\thechapter.}#1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \else
- \addcontentsline{toc}{chapter}{#1}%
- \fi
- \chaptermark{#1}%
- \@addchapterlistsgaps
- \if@twocolumn
- \@topnewpage[\@makechapterhead{#2}]%
- \else
- \@makechapterhead{#2}%
- \@afterheading
- \fi}
-\ifx\newfloat@replace@chapter\@gobbletwo \else
- \newfloat@InfoNoLine{%
- Unsupported document class, or \noexpand\@chapter\MessageBreak
- was already redefined by another package}
- \newfloat@InfoNoLine{\string\@chapter\space=\space\meaning\@chapter}
- \newfloat@InfoNoLine{\string\Hy@org@chapter\space=\space\meaning\Hy@org@chapter}
- \newfloat@ifplanb{%
- \newfloat@InfoNoLine{Trying Plan B..}%
- \let\newfloat@addtocontents@ORI\addtocontents
- \long\def\addtocontents#1#2{%
- \newfloat@addtocontents{#1}{#2}#2\addvspace\newfloat@nil}%
- \long\def\newfloat@addtocontents#1#2#3\addvspace#4\newfloat@nil{%
- \def\newfloat@tempa{#4}%
- \ifx\newfloat@tempa\@empty
- \newfloat@addtocontents@ORI{#1}{#2}%
- \else
- \ifx\newfloat@addtocontents@ext\@undefined
- \newfloat@Info{Setting Plan B file extension to `#1'...}%
- \xdef\newfloat@addtocontents@ext{#1}%
- \fi
- \edef\newfloat@tempa{#1}%
- \ifx\newfloat@tempa\newfloat@addtocontents@ext
- \begingroup
- \let\addtocontents\newfloat@addtocontents@ORI
- \@addchapterlistsgaps
- \endgroup
- \fi
- \fi}}
-\fi
-\newcommand\newfloat@ForEachNew[2][newfloat@@list]{%
- \AtBeginDocument{%
- \ifcsname#1\endcsname
- \def\@elt##1{#2}%
- \newfloat@@list
- \let\@elt\relax
- \fi}}%
-\@onlypreamble\newfloat@ForEachNew
-%% \begin{macrocode}
-\newfloat@ForEachNew[float@exts]{%
- \@nameuse{@ifchapterlistsgap@#1}{% if switched on
- \let\float@do=\relax
- \edef\@tempa{%
- \noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#1}}}}%
- \@tempa}}
-\newfloat@ForEachNew[FP@floatBegin]{%
- \newcounter{FP@#1C}%
- \newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}}
-\providecommand*\ext@lstlisting{lol}%
-\newfloat@ForEachNew[@rotfloat]{%
- \newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}%
- \newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}}
-\newcommand*\newfloat@For@SC[2]{%
- \def#1{b}% = \sidecaptionvpos{#2}{b} (v1.6)
- \newenvironment{SC#2}%
- {\SC@float[#1]{#2}}{\endSC@float}%
- \newenvironment{SC#2*}%
- {\SC@dblfloat[#1]{#2}}{\endSC@dblfloat}}
-\@onlypreamble\newfloat@For@SC
-\newfloat@ForEachNew[SC@float]{%
- \expandafter\newfloat@For@SC\csname SC@#1@vpos\endcsname{#1}}
-\newfloat@ForEachNew[wrapfloat]{%
- \newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}}
-\endinput
-%%
-%% End of file `newfloat.sty'.
diff --git a/sphinx/texinputs/sphinx.sty b/sphinx/texinputs/sphinx.sty
index d025a0797..b89ffa64e 100644
--- a/sphinx/texinputs/sphinx.sty
+++ b/sphinx/texinputs/sphinx.sty
@@ -6,38 +6,22 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesPackage{sphinx}[2010/01/15 LaTeX package (Sphinx markup)]
+\ProvidesPackage{sphinx}[2016/10/29 v1.5 LaTeX package (Sphinx markup)]
-% this is the \ltx@ifundefined of ltxcmds.sty, which is loaded by
-% hyperref.sty, but we need it before, and initial ltxcmds.sty
-% as in TL2009/Debian had wrong definition.
-\newcommand{\spx@ifundefined}[1]{%
- \ifcsname #1\endcsname
- \expandafter\ifx\csname #1\endcsname\relax
- \expandafter\expandafter\expandafter\@firstoftwo
- \else
- \expandafter\expandafter\expandafter\@secondoftwo
- \fi
- \else
- \expandafter\@firstoftwo
- \fi
-}
+% we delay handling of options to after having loaded packages, because
+% of the need to use \definecolor.
+\RequirePackage{graphicx}
\@ifclassloaded{memoir}{}{\RequirePackage{fancyhdr}}
% for \text macro and \iffirstchoice@ conditional even if amsmath not loaded
\RequirePackage{amstext}
\RequirePackage{textcomp}
-% fancybox not used anymore and will be removed at Sphinx-1.5
-\RequirePackage{fancybox}
\RequirePackage{titlesec}
\RequirePackage{tabulary}
\RequirePackage{makeidx}
% For framing code-blocks and warning type notices, and shadowing topics
\RequirePackage{framed}
-\newif\ifspx@inframed % flag set if we are in a framed environment
-% ifthen not used anymore and will be removed at Sphinx-1.5
-\RequirePackage{ifthen}
% The xcolor package draws better fcolorboxes around verbatim code
\IfFileExists{xcolor.sty}{
\RequirePackage{xcolor}
@@ -46,12 +30,20 @@
}
% For highlighted code.
\RequirePackage{fancyvrb}
+\fvset{fontsize=\small}
% For table captions.
\RequirePackage{threeparttable}
-% Handle footnotes in tables.
-\RequirePackage{footnote}
+% For hyperlinked footnotes in tables; also for gathering footnotes from
+% topic and warning blocks. Also to allow code-blocks in footnotes.
+\RequirePackage{footnotehyper-sphinx}
\makesavenoteenv{tabulary}
-% For floating figures in the text.
+\makesavenoteenv{tabular}
+\makesavenoteenv{threeparttable}
+% (longtable is hyperref compatible and needs no special treatment here.)
+% 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.
\RequirePackage{parskip}
@@ -59,33 +51,131 @@
\RequirePackage{alltt}
% Display "real" single quotes in literal blocks.
\RequirePackage{upquote}
-% For the H specifier. Do not \restylefloat{figure}, it breaks Sphinx code
-% for allowing figures in tables.
-\RequirePackage{float}
-% Redefine these colors to your liking in the preamble.
-\definecolor{TitleColor}{rgb}{0.126,0.263,0.361}
-\definecolor{InnerLinkColor}{rgb}{0.208,0.374,0.486}
-\definecolor{OuterLinkColor}{rgb}{0.216,0.439,0.388}
-% Redefine these colors to something if you want to have colored
-% background and border for code examples.
-\definecolor{VerbatimColor}{rgb}{1,1,1}
-\definecolor{VerbatimBorderColor}{rgb}{0,0,0}
-
-% Uncomment these two lines to ignore the paper size and make the page
-% size more like a typical published manual.
-%\renewcommand{\paperheight}{9in}
-%\renewcommand{\paperwidth}{8.5in} % typical squarish manual
-%\renewcommand{\paperwidth}{7in} % O'Reilly ``Programmming Python''
+% Handle options via "kvoptions" (later loaded by hyperref anyhow)
+\RequirePackage{kvoptions}
+\SetupKeyvalOptions{prefix=spx@opt@} % use \spx@opt@ prefix
+
+\DeclareBoolOption{dontkeepoldnames} % \ifspx@opt@dontkeepoldnames = \iffalse
+\DeclareStringOption[0]{maxlistdepth}% \newcommand*\spx@opt@maxlistdepth{0}
+
+% 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]{inlineliteralwraps}
+% \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}%
+}%
+% 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}
+% user interface: options can be changed midway in a document!
+\newcommand\sphinxsetup[1]{\setkeys{sphinx}{#1}}
+% this is the \ltx@ifundefined of ltxcmds.sty, which is loaded by
+% hyperref.sty, but we need it before, and the first release of
+% ltxcmds.sty as in TL2009/Debian has wrong definition.
+\newcommand{\spx@ifundefined}[1]{%
+ \ifcsname #1\endcsname
+ \expandafter\ifx\csname #1\endcsname\relax
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \else
+ \expandafter\expandafter\expandafter\@secondoftwo
+ \fi
+ \else
+ \expandafter\@firstoftwo
+ \fi
+}
+% FIXME: the reasons might be obsolete (better color drivers now?)
% use pdfoutput for pTeX and dvipdfmx
% when pTeX (\kanjiskip is defined), set pdfoutput to evade \include{pdfcolor}
\ifx\kanjiskip\undefined\else
\newcount\pdfoutput\pdfoutput=0
\fi
-\RequirePackage{graphicx}
-
% for PDF output, use colors and maximal compression
\newif\ifsphinxpdfoutput % used in \maketitle
\ifx\pdfoutput\undefined\else
@@ -107,24 +197,6 @@
\def\py@TitleColor{\color{TitleColor}}
\fi
-% Increase printable page size (copied from fullpage.sty)
-\topmargin 0pt
-\advance \topmargin by -\headheight
-\advance \topmargin by -\headsep
-
-% attempt to work a little better for A4 users
-\textheight \paperheight
-\advance\textheight by -2in
-
-\oddsidemargin 0pt
-\evensidemargin 0pt
-%\evensidemargin -.25in % for ``manual size'' documents
-\marginparwidth 0.5in
-
-\textwidth \paperwidth
-\advance\textwidth by -2in
-
-
% Style parameters and macros used by most documents here
\raggedbottom
\sloppy
@@ -133,8 +205,7 @@
\pagestyle{empty} % start this way
% Use this to set the font family for headers and other decor:
-\newcommand{\py@HeaderFamily}{\sffamily\bfseries}
-\newcommand{\sphinxSetHeaderFamily}[1]{\renewcommand{\py@HeaderFamily}{#1}}
+\newcommand{\py@HeaderFamily}{\spx@opt@HeaderFamily}
% Redefine the 'normal' header/footer style when using "fancyhdr" package:
\spx@ifundefined{fancyhf}{}{
@@ -163,32 +234,61 @@
}
% Some custom font markup commands.
-% *** the macros without \sphinx prefix are still defined at bottom of file ***
-\newcommand{\sphinxstrong}[1]{{\textbf{#1}}}
-% let \sphinxcode and \sphinxbfcode use straight quotes. \@noligs patched by upquote,
-% but needs protection in "moving arguments" such as for captions.
-% Use \scantokens to handle e.g. \item[{\sphinxcode{'fontenc'}}]
-\DeclareRobustCommand{\sphinxcode}[1]{{\@noligs\scantokens{\texttt{#1}\relax}}}
-\newcommand{\sphinxbfcode}[1]{\sphinxcode{\bfseries#1}}
-\newcommand{\sphinxemail}[1]{\textsf{#1}}
-\newcommand{\sphinxtablecontinued}[1]{\textsf{#1}}
-\newcommand{\sphinxtitleref}[1]{\emph{#1}}
-\newcommand{\sphinxmenuselection}[1]{\emph{#1}}
-\newcommand{\sphinxaccelerator}[1]{\underline{#1}}
-\newcommand{\sphinxcrossref}[1]{\emph{#1}}
-\newcommand{\sphinxtermref}[1]{\emph{#1}}
-
-% miscellaneous related to footnotes
-\newcommand*{\sphinxAtStartFootnote}{\mbox{ }}
-% Support large numbered footnotes in minipage (cf. admonitions)
+% *** the macros without \sphinx prefix are still defined near end of file ***
+\long\protected\def\sphinxstrong#1{{\textbf{#1}}}
+% 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.
+% 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.
+\long\protected\def\sphinxcode#1{{\def\@tempa{alltt}%
+ \ifx\@tempa\@currenvir\else
+ \ifspx@opt@inlineliteralwraps
+ \sphinxbreaksviaactive\let\sphinxafterbreak\empty
+ % 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
+ \let\do@noligs\sphinx@do@noligs
+ \@noligs\endlinechar\m@ne\everyeof{\noexpand}%
+ \expandafter\scantokens
+ \fi {\texttt{#1}}}}
+\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\-}%
+
+\long\protected\def\sphinxbfcode#1{\sphinxcode{\bfseries#1}}
+\long\protected\def\sphinxemail#1{\textsf{#1}}
+\long\protected\def\sphinxtablecontinued#1{\textsf{#1}}
+\long\protected\def\sphinxtitleref#1{\emph{#1}}
+\long\protected\def\sphinxmenuselection#1{\emph{#1}}
+\long\protected\def\sphinxaccelerator#1{\underline{#1}}
+\long\protected\def\sphinxcrossref#1{\emph{#1}}
+\long\protected\def\sphinxtermref#1{\emph{#1}}
+
+% 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}}
-% Redefine the Verbatim environment to allow border and background colors
-% and to handle the top caption in a non separable by pagebreak way.
-% The original environment is still used for verbatims within tables.
-\let\OriginalVerbatim=\Verbatim
-\let\endOriginalVerbatim=\endVerbatim
+% Code-blocks
+% Based on use of "fancyvrb.sty"'s Verbatim.
+% - with framing allowing page breaks ("framed.sty")
+% - with breaking of long lines (exploits Pygments mark-up),
+% - with possibly of a top caption, non-separable by pagebreak.
+% - and usable inside tables or footnotes ("footnotehyper-sphinx").
+
+% For maintaining compatibility with Sphinx < 1.5, we define and use these
+% when (unmodified) Verbatim will be needed. But Sphinx >= 1.5 does not modify
+% original Verbatim anyhow.
+\let\OriginalVerbatim \Verbatim
+\let\endOriginalVerbatim\endVerbatim
+
+\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)
+\newif\ifsphinxverbatimwithminipage \sphinxverbatimwithminipagefalse
\newcommand\spx@colorbox [2]{%
% #1 will be \fcolorbox or, for first part of frame: \spx@fcolorbox
% let the framing obey the current indentation (adapted from framed.sty's code).
@@ -202,12 +302,14 @@
\def\spx@fcolorbox #1#2%
{\color@b@x {\fboxsep\z@\color{#1}\spx@VerbatimFBox}{\color{#2}}}%
-% The title is specified from outside as macro \sphinxVerbatimTitle.
+% The title (caption) is specified from outside as macro \sphinxVerbatimTitle.
% \sphinxVerbatimTitle is reset to empty after each use of Verbatim.
\newcommand*\sphinxVerbatimTitle {}
+% This box to typeset the caption before framed.sty multiple passes for framing.
+\newbox\spx@VerbatimTitleBox
% Holder macro for labels of literal blocks. Set-up by LaTeX writer.
\newcommand*\sphinxLiteralBlockLabel {}
-\newcommand*\sphinxSetupCaptionForVerbatim [2]
+\newcommand*\sphinxSetupCaptionForVerbatim [1]
{%
\needspace{\sphinxliteralblockneedspace}%
% insert a \label via \sphinxLiteralBlockLabel
@@ -215,31 +317,31 @@
% the caption inserts \abovecaptionskip whitespace above itself (usually 10pt)
% there is also \belowcaptionskip but it is usually zero, hence the \smallskip
\def\sphinxVerbatimTitle
- {\py@NormalColor\captionof{#1}{\sphinxLiteralBlockLabel #2}\smallskip }%
+ {\py@NormalColor
+ \captionof{literalblock}{\sphinxLiteralBlockLabel #1}\smallskip }%
}
+\newcommand*\sphinxSetupCodeBlockInFootnote {%
+ \fvset{fontsize=\footnotesize}\let\caption\sphinxfigcaption
+ \sphinxverbatimwithminipagetrue % reduces vertical spaces
+ % we counteract float.sty's \caption which does \@normalsize
+ \let\normalsize\footnotesize\let\@parboxrestore\relax
+ \abovecaptionskip \smallskipamount \belowcaptionskip \z@skip}
% Inspired and adapted from framed.sty's \CustomFBox with extra handling
-% of a non separable by pagebreak caption, and controlled counter stepping.
-\newif\ifspx@myfirstframedpass
+% of a non separable by pagebreak caption.
\long\def\spx@VerbatimFBox#1{%
\leavevmode
\begingroup
- % framed.sty does some measuring but this macro adds possibly a caption
- % use amsmath conditional to inhibit the caption counter stepping after
- % first pass
- \ifspx@myfirstframedpass\else\firstchoice@false\fi
\setbox\@tempboxa\hbox{\kern\fboxsep{#1}\kern\fboxsep}%
\hbox
{\lower\dimexpr\fboxrule+\fboxsep+\dp\@tempboxa
\hbox{%
- \vbox{\ifx\sphinxVerbatimTitle\empty\else
+ \vbox{\ifvoid\spx@VerbatimTitleBox\else
% add the caption in a centered way above possibly indented frame
% hide its width from framed.sty's measuring step
% note that the caption brings \abovecaptionskip top vertical space
\moveright\dimexpr\fboxrule+.5\wd\@tempboxa
- \hb@xt@\z@{\hss\begin{minipage}{\wd\@tempboxa}%
- \sphinxVerbatimTitle
- \end{minipage}\hss}\fi
+ \hb@xt@\z@{\hss\unhcopy\spx@VerbatimTitleBox\hss}\fi
% draw frame border _latest_ to avoid pdf viewer issue
\kern\fboxrule
\hbox{\kern\fboxrule
@@ -255,63 +357,60 @@
\hrule\@height\fboxrule}%
}}%
\endgroup
- \global\spx@myfirstframedpassfalse
}
% For linebreaks inside Verbatim environment from package fancyvrb.
\newbox\sphinxcontinuationbox
\newbox\sphinxvisiblespacebox
-% These are user customizable e.g. from latex_elements's preamble key.
-% Use of \textvisiblespace for compatibility with XeTeX/LuaTeX/fontspec.
-\newcommand*\sphinxvisiblespace {\textcolor{red}{\textvisiblespace}}
-\newcommand*\sphinxcontinuationsymbol {\textcolor{red}{\llap{\tiny$\m@th\hookrightarrow$}}}
-\newcommand*\sphinxcontinuationindent {3ex }
-\newcommand*\sphinxafterbreak {\kern\sphinxcontinuationindent\copy\sphinxcontinuationbox}
+\newcommand*\sphinxafterbreak {\copy\sphinxcontinuationbox}
% Take advantage of the already applied Pygments mark-up to insert
% potential linebreaks for TeX processing.
% {, <, #, %, $, ' and ": go to next line.
% _, }, ^, &, >, - and ~: stay at end of broken line.
% Use of \textquotesingle for straight quote.
+% FIXME: convert this to package options
+\newcommand*\sphinxbreaksbeforelist {%
+ \do\PYGZob\{\do\PYGZlt\<\do\PYGZsh\#\do\PYGZpc\%% {, <, #, %,
+ \do\PYGZdl\$\do\PYGZdq\"% $, "
+ \def\PYGZsq
+ {\discretionary{}{\sphinxafterbreak\textquotesingle}{\textquotesingle}}% '
+}
+\newcommand*\sphinxbreaksafterlist {%
+ \do\PYGZus\_\do\PYGZcb\}\do\PYGZca\^\do\PYGZam\&% _, }, ^, &,
+ \do\PYGZgt\>\do\PYGZhy\-\do\PYGZti\~% >, -, ~
+}
\newcommand*\sphinxbreaksatspecials {%
- \def\PYGZus{\discretionary{\char`\_}{\sphinxafterbreak}{\char`\_}}%
- \def\PYGZob{\discretionary{}{\sphinxafterbreak\char`\{}{\char`\{}}%
- \def\PYGZcb{\discretionary{\char`\}}{\sphinxafterbreak}{\char`\}}}%
- \def\PYGZca{\discretionary{\char`\^}{\sphinxafterbreak}{\char`\^}}%
- \def\PYGZam{\discretionary{\char`\&}{\sphinxafterbreak}{\char`\&}}%
- \def\PYGZlt{\discretionary{}{\sphinxafterbreak\char`\<}{\char`\<}}%
- \def\PYGZgt{\discretionary{\char`\>}{\sphinxafterbreak}{\char`\>}}%
- \def\PYGZsh{\discretionary{}{\sphinxafterbreak\char`\#}{\char`\#}}%
- \def\PYGZpc{\discretionary{}{\sphinxafterbreak\char`\%}{\char`\%}}%
- \def\PYGZdl{\discretionary{}{\sphinxafterbreak\char`\$}{\char`\$}}%
- \def\PYGZhy{\discretionary{\char`\-}{\sphinxafterbreak}{\char`\-}}%
- \def\PYGZsq{\discretionary{}{\sphinxafterbreak\textquotesingle}{\textquotesingle}}%
- \def\PYGZdq{\discretionary{}{\sphinxafterbreak\char`\"}{\char`\"}}%
- \def\PYGZti{\discretionary{\char`\~}{\sphinxafterbreak}{\char`\~}}%
+ \def\do##1##2%
+ {\def##1{\discretionary{}{\sphinxafterbreak\char`##2}{\char`##2}}}%
+ \sphinxbreaksbeforelist
+ \def\do##1##2%
+ {\def##1{\discretionary{\char`##2}{\sphinxafterbreak}{\char`##2}}}%
+ \sphinxbreaksafterlist
}
\def\sphinx@verbatim@nolig@list {\do \`}%
% Some characters . , ; ? ! / are not pygmentized.
% This macro makes them "active" and they will insert potential linebreaks
-\newcommand*\sphinxbreaksatpunct {%
- \lccode`\~`\.\lowercase{\def~}{\discretionary{\char`\.}{\sphinxafterbreak}{\char`\.}}%
- \lccode`\~`\,\lowercase{\def~}{\discretionary{\char`\,}{\sphinxafterbreak}{\char`\,}}%
- \lccode`\~`\;\lowercase{\def~}{\discretionary{\char`\;}{\sphinxafterbreak}{\char`\;}}%
- \lccode`\~`\:\lowercase{\def~}{\discretionary{\char`\:}{\sphinxafterbreak}{\char`\:}}%
- \lccode`\~`\?\lowercase{\def~}{\discretionary{\char`\?}{\sphinxafterbreak}{\char`\?}}%
- \lccode`\~`\!\lowercase{\def~}{\discretionary{\char`\!}{\sphinxafterbreak}{\char`\!}}%
- \lccode`\~`\/\lowercase{\def~}{\discretionary{\char`\/}{\sphinxafterbreak}{\char`\/}}%
- \catcode`\.\active
- \catcode`\,\active
- \catcode`\;\active
- \catcode`\:\active
- \catcode`\?\active
- \catcode`\!\active
- \catcode`\/\active
+\newcommand*\sphinxbreaksbeforeactivelist {}% none
+\newcommand*\sphinxbreaksafteractivelist {\do\.\do\,\do\;\do\?\do\!\do\/}
+\newcommand*\sphinxbreaksviaactive {%
+ \def\do##1{\lccode`\~`##1%
+ \lowercase{\def~}{\discretionary{}{\sphinxafterbreak\char`##1}{\char`##1}}%
+ \catcode`##1\active}%
+ \sphinxbreaksbeforeactivelist
+ \def\do##1{\lccode`\~`##1%
+ \lowercase{\def~}{\discretionary{\char`##1}{\sphinxafterbreak}{\char`##1}}%
+ \catcode`##1\active}%
+ \sphinxbreaksafteractivelist
\lccode`\~`\~
}
-\renewcommand{\Verbatim}[1][1]{%
+% needed to create wrapper environments of fancyvrb's Verbatim
+\newcommand*{\sphinxVerbatimEnvironment}{\gdef\FV@EnvironName{sphinxVerbatim}}
+% Sphinx <1.5 optional argument was in fact mandatory. It is now really
+% optional and handled by original Verbatim.
+\newenvironment{sphinxVerbatim}{%
% quit horizontal mode if we are still in a paragraph
\par
% list starts new par, but we don't want it to be set apart vertically
@@ -327,16 +426,25 @@
\needspace{\sphinxliteralblockwithoutcaptionneedspace}%
\phantomsection\sphinxLiteralBlockLabel
\fi
- \fi
+ \setbox\spx@VerbatimTitleBox\box\voidb@x
+ \else
% non-empty \sphinxVerbatimTitle has label inside it (in case there is one)
+ \setbox\spx@VerbatimTitleBox
+ \hbox{\begin{minipage}{\linewidth}%
+ \sphinxVerbatimTitle
+ \end{minipage}}%
+ \fi
+ \fboxsep\sphinxverbatimsep \fboxrule\sphinxverbatimborder
+ % setting borderwidth to zero is simplest for no-frame effect with same pagebreaks
+ \ifspx@opt@verbatimwithframe\else\fboxrule\z@\fi
% Customize framed.sty \MakeFramed to glue caption to literal block
- \global\spx@myfirstframedpasstrue
% via \spx@fcolorbox, will use \spx@VerbatimFBox which inserts title
\def\FrameCommand {\spx@colorbox\spx@fcolorbox }%
\let\FirstFrameCommand\FrameCommand
% for mid pages and last page portion of (long) split frame:
\def\MidFrameCommand{\spx@colorbox\fcolorbox }%
\let\LastFrameCommand\MidFrameCommand
+ \ifspx@opt@verbatimwrapslines
% fancyvrb's Verbatim puts each input line in (unbreakable) horizontal boxes.
% This customization wraps each line from the input in a \vtop, thus
% allowing it to wrap and display on two or more lines in the latex output.
@@ -345,8 +453,9 @@
% to achieve this without extensive rewrite of fancyvrb.
% - The (not used in sphinx) obeytabs option to Verbatim is
% broken by this change (showtabs and tabspace work).
- \sbox\sphinxcontinuationbox {\sphinxcontinuationsymbol}%
- \sbox\sphinxvisiblespacebox {\FV@SetupFont\sphinxvisiblespace}%
+ \expandafter\def\expandafter\FV@SetupFont\expandafter
+ {\FV@SetupFont\sbox\sphinxcontinuationbox {\spx@opt@verbatimcontinued}%
+ \sbox\sphinxvisiblespacebox {\spx@opt@verbatimvisiblespace}}%
\def\FancyVerbFormatLine ##1{\hsize\linewidth
\vtop{\raggedright\hyphenpenalty\z@\exhyphenpenalty\z@
\doublehyphendemerits\z@\finalhyphendemerits\z@
@@ -360,12 +469,15 @@
\discretionary{\copy\sphinxvisiblespacebox}{\sphinxafterbreak}
{\kern\fontdimen2\font}%
}%
- % go around fancyvrb's check of @currenvir (for case of minipage below)
- \renewcommand*{\VerbatimEnvironment}{\gdef\FV@EnvironName{Verbatim}}%
- % go around fancyvrb's check of current list depth
- \def\@toodeep {\advance\@listdepth\@ne}%
% Allow breaks at special characters using \PYG... macros.
\sphinxbreaksatspecials
+ % Breaks at punctuation characters . , ; ? ! and / (needs catcode activation)
+ \def\FancyVerbCodes{\sphinxbreaksviaactive}%
+ \fi % end of conditional code for wrapping long code lines
+ % go around fancyvrb's check of \@currenvir
+ \let\VerbatimEnvironment\sphinxVerbatimEnvironment
+ % go around fancyvrb's check of current list depth
+ \def\@toodeep {\advance\@listdepth\@ne}%
% The list environment is needed to control perfectly the vertical space.
% Note: \OuterFrameSep used by framed.sty is later set to \topsep hence 0pt.
% - if caption: vertical space above caption = (\abovecaptionskip + D) with
@@ -379,34 +491,48 @@
\rightmargin\z@
\parindent \z@% becomes \itemindent. Default zero, but perhaps overwritten.
\trivlist\item\relax
- % use a minipage if we are already inside a framed environment
+ \ifsphinxverbatimwithminipage\spx@inframedtrue\fi
+ % use a minipage if we are already inside a framed environment
\ifspx@inframed\noindent\begin{minipage}{\linewidth}\fi
\MakeFramed {% adapted over from framed.sty's snugshade environment
- \advance\hsize-\width\@totalleftmargin\z@\linewidth\hsize
- \@setminipage }%
- \small
+ \advance\hsize-\width\@totalleftmargin\z@\linewidth\hsize\@setminipage
+ }%
% For grid placement from \strut's in \FancyVerbFormatLine
\lineskip\z@skip
- % Breaks at punctuation characters . , ; ? ! and / need catcode=\active
- % and the active comma should not be overwritten by \@noligs
- \let\verbatim@nolig@list \sphinx@verbatim@nolig@list
- \OriginalVerbatim[#1,codes*=\sphinxbreaksatpunct]%
+ % active comma should not be overwritten by \@noligs
+ \ifspx@opt@verbatimwrapslines
+ \let\verbatim@nolig@list \sphinx@verbatim@nolig@list
+ \fi
+ % will fetch its optional arguments if any
+ \OriginalVerbatim
}
-\renewcommand{\endVerbatim}{%
+{%
\endOriginalVerbatim
- \par\unskip\@minipagefalse\endMakeFramed
+ \par\unskip\@minipagefalse\endMakeFramed % from framed.sty snugshade
\ifspx@inframed\end{minipage}\fi
\endtrivlist
}
-
-% define macro to frame contents and add shadow on right and bottom
-% use public names for customizable lengths
-\newlength\sphinxshadowsep \setlength\sphinxshadowsep {5pt}
-\newlength\sphinxshadowsize \setlength\sphinxshadowsize {4pt}
-\newlength\sphinxshadowrule
-% this uses \fboxrule value at loading time of sphinx.sty (0.4pt normally)
-\setlength\sphinxshadowrule {\fboxrule}
-
+\newenvironment {sphinxVerbatimNoFrame}
+ {\spx@opt@verbatimwithframefalse
+ % needed for fancyvrb as literal code will end in \end{sphinxVerbatimNoFrame}
+ \def\sphinxVerbatimEnvironment{\gdef\FV@EnvironName{sphinxVerbatimNoFrame}}%
+ \begin{sphinxVerbatim}}
+ {\end{sphinxVerbatim}}
+\newenvironment {sphinxVerbatimintable}
+ {% don't use a frame if in a table cell
+ \spx@opt@verbatimwithframefalse
+ \sphinxverbatimwithminipagetrue
+ % counteract longtable redefinition of caption
+ \let\caption\sphinxfigcaption
+ % reduce above caption space if in a table cell
+ \abovecaptionskip\smallskipamount
+ \def\sphinxVerbatimEnvironment{\gdef\FV@EnvironName{sphinxVerbatimintable}}%
+ \begin{sphinxVerbatim}}
+ {\end{sphinxVerbatim}}
+
+% Topic boxes
+
+% Again based on use of "framed.sty", this allows breakable framed boxes.
\long\def\spx@ShadowFBox#1{%
\leavevmode\begingroup
% first we frame the box #1
@@ -451,6 +577,8 @@
% imitate closely the layout from Sphinx <= 1.4.1; the \FrameHeightAdjust
% will put top part of frame on this baseline.
\def\FrameHeightAdjust {\baselineskip}%
+ % use package footnote to handle footnotes
+ \savenotes
\trivlist\item\noindent
% use a minipage if we are already inside a framed environment
\ifspx@inframed\begin{minipage}{\linewidth}\fi
@@ -464,9 +592,6 @@
% itemize/enumerate are therein typeset more tightly, we want to keep
% that). We copy-paste from LaTeX source code but don't do a real minipage.
\@pboxswfalse
- % for footnotes, but Sphinx inactivates footnotes in topics
- \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
- \let\@footnotetext\@mpfootnotetext
\let\@listdepth\@mplistdepth \@mplistdepth\z@
\@minipagerestore
\@setminipage
@@ -474,14 +599,12 @@
}%
{% insert the "endminipage" code
\par\unskip
- % handle (currently non existing) minipage style footnotes
- \ifvoid\@mpfootins\else
- \vskip\skip\@mpfootins\normalcolor\footnoterule\unvbox\@mpfootins
- \fi
\@minipagefalse
\endMakeFramed
\ifspx@inframed\end{minipage}\fi
\endtrivlist
+ % output the stored footnotes
+ \spewnotes
}
@@ -509,13 +632,13 @@
% {fulllineitems} is the main environment for object descriptions.
%
\newcommand{\py@itemnewline}[1]{%
- \@tempdima\linewidth%
+ \@tempdima\linewidth
\advance\@tempdima \leftmargin\makebox[\@tempdima][l]{#1}%
}
\newenvironment{fulllineitems}{
- \begin{list}{}{\labelwidth \leftmargin \labelsep 0pt
- \rightmargin 0pt \topsep -\parskip \partopsep \parskip
+ \begin{list}{}{\labelwidth \leftmargin \labelsep \z@
+ \rightmargin \z@ \topsep -\parskip \partopsep \parskip
\itemsep -\parsep
\let\makelabel=\py@itemnewline}
}{\end{list}}
@@ -527,35 +650,71 @@
\newlength{\py@argswidth}
\newcommand{\py@sigparams}[2]{%
\parbox[t]{\py@argswidth}{#1\sphinxcode{)}#2}}
-\newcommand{\pysigline}[1]{\item[#1]\nopagebreak}
+\newcommand{\pysigline}[1]{\item[{#1}]\nopagebreak}
\newcommand{\pysiglinewithargsret}[3]{%
\settowidth{\py@argswidth}{#1\sphinxcode{(}}%
\addtolength{\py@argswidth}{-2\py@argswidth}%
\addtolength{\py@argswidth}{\linewidth}%
- \item[#1\sphinxcode{(}\py@sigparams{#2}{#3}]}
+ \item[{#1\sphinxcode{(}\py@sigparams{#2}{#3}}]}
% Production lists
%
-\newenvironment{productionlist}{
+\newenvironment{productionlist}{%
% \def\sphinxoptional##1{{\Large[}##1{\Large]}}
- \def\production##1##2{\\\sphinxcode{##1}&::=&\sphinxcode{##2}}
- \def\productioncont##1{\\& &\sphinxcode{##1}}
+ \def\production##1##2{\\\sphinxcode{##1}&::=&\sphinxcode{##2}}%
+ \def\productioncont##1{\\& &\sphinxcode{##1}}%
\parindent=2em
\indent
- \setlength{\LTpre}{0pt}
- \setlength{\LTpost}{0pt}
+ \setlength{\LTpre}{0pt}%
+ \setlength{\LTpost}{0pt}%
\begin{longtable}[l]{lcl}
}{%
\end{longtable}
}
% Notices / Admonitions
-%
+% Some are quite plain
+% the spx@notice@bordercolor etc are set in the sphinxadmonition environment
+\newenvironment{sphinxlightbox}{%
+ \par\allowbreak
+ \noindent{\color{spx@notice@bordercolor}%
+ \rule{\linewidth}{\spx@notice@border}}\par\nobreak
+ {\parskip\z@skip\noindent}%
+ }
+ {%
+ \par
+ % counteract previous possible negative skip (French lists!):
+ % (we can't cancel that any earlier \vskip introduced a potential pagebreak)
+ \ifdim\lastskip<\z@\vskip-\lastskip\fi
+ \nobreak\vbox{\noindent\kern\@totalleftmargin
+ {\color{spx@notice@bordercolor}%
+ \rule[\dimexpr.4\baselineskip-\spx@notice@border\relax]
+ {\linewidth}{\spx@notice@border}}\hss}\allowbreak
+ }% end of sphinxlightbox environment definition
+% may be renewenvironment'd by user for complete customization
+\newenvironment{sphinxnote}[1]
+ {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
+\newenvironment{sphinxhint}[1]
+ {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
+\newenvironment{sphinximportant}[1]
+ {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
+\newenvironment{sphinxtip}[1]
+ {\begin{sphinxlightbox}\sphinxstrong{#1} }{\end{sphinxlightbox}}
+% or just use the package options
+% these are needed for common handling by notice environment of lightbox
+% and heavybox but they are currently not used by lightbox environment
+% and there is consequently no corresponding package option
+\definecolor{sphinxnoteBgColor}{rgb}{1,1,1}
+\definecolor{sphinxhintBgColor}{rgb}{1,1,1}
+\definecolor{sphinimportantBgColor}{rgb}{1,1,1}
+\definecolor{sphinxtipBgColor}{rgb}{1,1,1}
+
+% Others get more distinction
% Code adapted from framed.sty's "snugshade" environment.
% Nesting works (inner frames do not allow page breaks).
-\newcommand{\py@heavybox}{\par
- \setlength{\FrameRule}{\p@}% 1pt
+\newenvironment{sphinxheavybox}{\par
+ \setlength{\FrameRule}{\spx@notice@border}%
\setlength{\FrameSep}{\dimexpr.6\baselineskip-\FrameRule\relax}
% configure framed.sty's parameters to obtain same vertical spacing
% as for "light" boxes. We need for this to manually insert parskip glue and
@@ -564,8 +723,10 @@
\vspace{\FrameHeightAdjust}
% copied/adapted from framed.sty's snugshade
\def\FrameCommand##1{\hskip\@totalleftmargin
- \fboxsep\FrameSep \fboxrule\FrameRule\fbox{##1}%
+ \fboxsep\FrameSep \fboxrule\FrameRule
+ \fcolorbox{spx@notice@bordercolor}{spx@notice@bgcolor}{##1}%
\hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+ \savenotes
% use a minipage if we are already inside a framed environment
\ifspx@inframed
\noindent\begin{minipage}{\linewidth}
@@ -581,67 +742,53 @@
\advance\hsize-\width \@totalleftmargin\z@ \linewidth\hsize
% minipage initialization copied from LaTeX source code.
\@pboxswfalse
- % for footnotes
- \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
- \let\@footnotetext\@mpfootnotetext
\let\@listdepth\@mplistdepth \@mplistdepth\z@
\@minipagerestore
\@setminipage }%
}
-\newcommand{\py@endheavybox}{%
+ {%
\par\unskip
- % handles footnotes
- \ifvoid\@mpfootins\else
- \vskip\skip\@mpfootins\normalcolor\footnoterule\unvbox\@mpfootins
- \fi
\@minipagefalse
\endMakeFramed
\ifspx@inframed\end{minipage}\fi
+ % set footnotes at bottom of page
+ \spewnotes
% arrange for similar spacing below frame as for "light" boxes.
\vskip .4\baselineskip
- }
-
-\newcommand{\py@lightbox}{%
- \par\allowbreak
- \noindent\rule{\linewidth}{0.5pt}\par\nobreak
- {\parskip\z@skip\noindent}%
- }
-\newcommand{\py@endlightbox}{%
- \par
- % counteract previous possible negative skip (French lists!):
- % (we can't cancel that any earlier \vskip introduced a potential pagebreak)
- \ifdim\lastskip<\z@\vskip-\lastskip\fi
- \nobreak\vbox{\noindent\kern\@totalleftmargin
- \rule[.4\baselineskip]{\linewidth}{0.5pt}\hss}\allowbreak
- }
-
-% Some are quite plain:
-\newcommand{\py@noticestart@note}{\py@lightbox}
-\newcommand{\py@noticeend@note}{\py@endlightbox}
-\newcommand{\py@noticestart@hint}{\py@lightbox}
-\newcommand{\py@noticeend@hint}{\py@endlightbox}
-\newcommand{\py@noticestart@important}{\py@lightbox}
-\newcommand{\py@noticeend@important}{\py@endlightbox}
-\newcommand{\py@noticestart@tip}{\py@lightbox}
-\newcommand{\py@noticeend@tip}{\py@endlightbox}
-
-% Others gets more visible distinction:
-\newcommand{\py@noticestart@warning}{\py@heavybox}
-\newcommand{\py@noticeend@warning}{\py@endheavybox}
-\newcommand{\py@noticestart@caution}{\py@heavybox}
-\newcommand{\py@noticeend@caution}{\py@endheavybox}
-\newcommand{\py@noticestart@attention}{\py@heavybox}
-\newcommand{\py@noticeend@attention}{\py@endheavybox}
-\newcommand{\py@noticestart@danger}{\py@heavybox}
-\newcommand{\py@noticeend@danger}{\py@endheavybox}
-\newcommand{\py@noticestart@error}{\py@heavybox}
-\newcommand{\py@noticeend@error}{\py@endheavybox}
-
-\newenvironment{notice}[2]{
- \def\py@noticetype{#1}
- \csname py@noticestart@#1\endcsname
- \sphinxstrong{#2} % <- legacy code creates a space after {#2}
-}{\csname py@noticeend@\py@noticetype\endcsname}
+ }% end of sphinxheavybox environment definition
+% may be renewenvironment'd by user for complete customization
+\newenvironment{sphinxwarning}[1]
+ {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
+\newenvironment{sphinxcaution}[1]
+ {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
+\newenvironment{sphinxattention}[1]
+ {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
+\newenvironment{sphinxdanger}[1]
+ {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
+\newenvironment{sphinxerror}[1]
+ {\begin{sphinxheavybox}\sphinxstrong{#1} }{\end{sphinxheavybox}}
+% or just use package options
+
+% the \colorlet of xcolor (if at all loaded) is overkill for our use case
+\newcommand{\sphinxcolorlet}[2]
+ {\expandafter\let\csname\@backslashchar color@#1\expandafter\endcsname
+ \csname\@backslashchar color@#2\endcsname }
+
+% the main dispatch for all types of notices
+\newenvironment{sphinxadmonition}{\begin{notice}}{\end{notice}}
+% use of ``notice'' is for backwards compatibility and will be removed in
+% future release; sphinxadmonition environment will be defined directly.
+\newenvironment{notice}[2]{% #1=type, #2=heading
+ % can't use #1 directly in definition of end part
+ \def\spx@noticetype {#1}%
+ % set parameters of heavybox/lightbox
+ \sphinxcolorlet{spx@notice@bordercolor}{sphinx#1BorderColor}%
+ \sphinxcolorlet{spx@notice@bgcolor}{sphinx#1BgColor}%
+ \spx@notice@border \dimexpr\csname spx@opt@#1border\endcsname\relax
+ % start specific environment, passing the heading as argument
+ \begin{sphinx#1}{#2}}
+ % in end part, need to go around a LaTeX's "feature"
+ {\edef\spx@temp{\noexpand\end{sphinx\spx@noticetype}}\spx@temp}
% Allow the release number to be specified independently of the
% \date{}. This allows the date to reflect the document's date and
@@ -670,28 +817,33 @@
% This sets up the fancy chapter headings that make the documents look
% at least a little better than the usual LaTeX output.
%
-\spx@ifundefined{ChTitleVar}{}{
- \ChNameVar{\raggedleft\normalsize\py@HeaderFamily}
- \ChNumVar{\raggedleft \bfseries\Large\py@HeaderFamily}
- \ChTitleVar{\raggedleft \textrm{\Huge\py@HeaderFamily}}
- % This creates chapter heads without the leading \vspace*{}:
+\@ifpackagewith{fncychap}{Bjarne}{
+ \ChNameVar {\raggedleft\normalsize \py@HeaderFamily}
+ \ChNumVar {\raggedleft\Large \py@HeaderFamily}
+ \ChTitleVar{\raggedleft\Large \py@HeaderFamily}
+ % This creates (numbered) chapter heads without the leading \vspace*{}:
\def\@makechapterhead#1{%
{\parindent \z@ \raggedright \normalfont
\ifnum \c@secnumdepth >\m@ne
- \DOCH
+ \if@mainmatter
+ \DOCH
+ \fi
\fi
\interlinepenalty\@M
- \DOTI{#1}
- }
- }
-}
+ \if@mainmatter
+ \DOTI{#1}%
+ \else%
+ \DOTIS{#1}%
+ \fi
+ }}
+}{}% <-- "false" clause of \@ifpackagewith
% Redefine description environment so that it is usable inside fulllineitems.
%
\renewcommand{\description}{%
- \list{}{\labelwidth\z@%
- \itemindent-\leftmargin%
- \labelsep5pt%
+ \list{}{\labelwidth\z@
+ \itemindent-\leftmargin
+ \labelsep5pt\relax
\let\makelabel=\descriptionlabel}}
% Definition lists; requested by AMK for HOWTO documents. Probably useful
@@ -699,7 +851,7 @@
%
\newenvironment{definitions}{%
\begin{description}%
- \def\term##1{\item[##1]\mbox{}\\*[0mm]}
+ \def\term##1{\item[{##1}]\mbox{}\\*[0mm]}%
}{%
\end{description}%
}
@@ -707,7 +859,6 @@
% Tell TeX about pathological hyphenation cases:
\hyphenation{Base-HTTP-Re-quest-Hand-ler}
-
% The following is stuff copied from docutils' latex writer.
%
\newcommand{\optionlistlabel}[1]{\normalfont\bfseries #1 \hfill}% \bf deprecated
@@ -728,27 +879,31 @@
{\setlength{\partopsep}{\parskip}
\addtolength{\partopsep}{\baselineskip}
\topsep0pt\itemsep0.15\baselineskip\parsep0pt
- \leftmargin#1}
+ \leftmargin#1\relax}
\raggedright}
{\end{list}}
-% Re-define \includegraphics to resize images larger than the line width
-% if the size is not specified.
+% Redefine \includegraphics to resize images larger than the line width,
+% except if height or width option present.
+%
+% If scale is present, rescale before fitting to line width. (since 1.5)
+%
% Warning: future version of Sphinx will not modify original \includegraphics,
-% Below custom code will be direct definition of \sphinxincludegraphics, with
-% \py@Oldincludegraphics replaced by direct use of original \includegraphics.
+% below code will be definition only of \sphinxincludegraphics.
\let\py@Oldincludegraphics\includegraphics
\newbox\spx@image@box
-\renewcommand*{\includegraphics}[2][\@empty]{%
- \ifx\@empty #1% attention, #1 could be bb.., bad if first after \ifx
- \setbox\spx@image@box=\hbox{\py@Oldincludegraphics{#2}}%
+\renewcommand*{\includegraphics}[2][]{%
+ \in@{height}{#1}\ifin@\else\in@{width}{#1}\fi
+ \ifin@ % height or width present
+ \py@Oldincludegraphics[#1]{#2}%
+ \else % no height nor width (but #1 may be "scale=...")
+ \setbox\spx@image@box\hbox{\py@Oldincludegraphics[#1,draft]{#2}}%
\ifdim \wd\spx@image@box>\linewidth
- \py@Oldincludegraphics[width=\linewidth]{#2}%
+ \setbox\spx@image@box\box\voidb@x % clear memory
+ \py@Oldincludegraphics[#1,width=\linewidth]{#2}%
\else
- \leavevmode\box\spx@image@box
+ \py@Oldincludegraphics[#1]{#2}%
\fi
- \else
- \py@Oldincludegraphics[#1]{#2}%
\fi
}
% Writer will put \sphinxincludegraphics in LaTeX source, and with this,
@@ -774,32 +929,26 @@
\fi
\fi
-% Include hyperref last.
-\RequirePackage[colorlinks,breaklinks,
- linkcolor=InnerLinkColor,filecolor=OuterLinkColor,
- menucolor=OuterLinkColor,urlcolor=OuterLinkColor,
- citecolor=InnerLinkColor]{hyperref}
-% Fix anchor placement for figures with captions.
-% (Note: we don't use a package option here; instead, we give an explicit
-% \capstart for figures that actually have a caption.)
-\RequirePackage{hypcap}
-
-% Set up styles of URL: it should be placed after hyperref
-\urlstyle{same}
+% 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}
% From docutils.writers.latex2e
% inline markup (custom roles)
% \DUrole{#1}{#2} tries \DUrole#1{#2}
\providecommand*{\DUrole}[2]{%
- \ifcsname DUrole#1\endcsname%
+ \ifcsname DUrole#1\endcsname
\csname DUrole#1\endcsname{#2}%
\else% backwards compatibility: try \docutilsrole#1{#2}
- \ifcsname docutilsrole#1\endcsname%
+ \ifcsname docutilsrole#1\endcsname
\csname docutilsrole#1\endcsname{#2}%
- \else%
+ \else
#2%
- \fi%
- \fi%
+ \fi
+ \fi
}
\providecommand*{\DUprovidelength}[2]{%
@@ -820,27 +969,11 @@
{\endlist}
\fi
-% From footmisc.sty: allows footnotes in titles
-\let\FN@sf@@footnote\footnote
-\def\footnote{\ifx\protect\@typeset@protect
- \expandafter\FN@sf@@footnote
- \else
- \expandafter\FN@sf@gobble@opt
- \fi
-}
-\edef\FN@sf@gobble@opt{\noexpand\protect
- \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname}
-\expandafter\def\csname FN@sf@gobble@opt \endcsname{%
- \@ifnextchar[%]
- \FN@sf@gobble@twobracket
- \@gobble
-}
-\def\FN@sf@gobble@twobracket[#1]#2{}
-
% adjust the margins for footer,
% this works with the jsclasses only (Japanese standard document classes)
+% FIXME: rather, pass options to "geometry".
\ifx\@jsc@uplatextrue\undefined\else
- \hypersetup{setpagesize=false}
+ \PassOptionsToPackage{setpagesize=false}{hyperref}
\setlength\footskip{2\baselineskip}
\addtolength{\textheight}{-2\baselineskip}
\fi
@@ -848,16 +981,15 @@
% fix the double index and bibliography on the table of contents
% in jsclasses (Japanese standard document classes)
\ifx\@jsc@uplatextrue\undefined\else
- \renewcommand{\theindex}{
- \cleardoublepage
- \phantomsection
- \py@OldTheindex
- }
- \renewcommand{\thebibliography}[1]{
- \cleardoublepage
- \phantomsection
- \py@OldThebibliography{1}
- }
+ \renewenvironment{sphinxtheindex}
+ {\cleardoublepage\phantomsection
+ \begin{theindex}}
+ {\end{theindex}}
+
+ \renewenvironment{sphinxthebibliography}[1]
+ {\cleardoublepage\phantomsection
+ \begin{thebibliography}{1}}
+ {\end{thebibliography}}
\fi
% disable \@chappos in Appendix in pTeX
@@ -869,13 +1001,25 @@
}
\fi
-% Define literal-block environment
-\RequirePackage{newfloat}
-\DeclareFloatingEnvironment{literal-block}
+% for captions of literal blocks
+% with `\theH...` macros for hyperref
+\newcounter{literalblock}
\spx@ifundefined{c@chapter}
- {\SetupFloatingEnvironment{literal-block}{within=section,placement=h}}
- {\SetupFloatingEnvironment{literal-block}{within=chapter,placement=h}}
-\SetupFloatingEnvironment{literal-block}{name=List}
+ {\@addtoreset{literalblock}{section}
+ \def\theliteralblock {\ifnum\c@section>\z@ \thesection.\fi\arabic{literalblock}}
+ \def\theHliteralblock {\theHsection.\arabic{literalblock}}}
+ {\@addtoreset{literalblock}{chapter}
+ \def\theliteralblock {\ifnum\c@chapter>\z@ \thechapter.\fi\arabic{literalblock}}
+ \def\theHliteralblock {\theHchapter.\arabic{literalblock}}}
+% at start of caption title
+\newcommand*{\fnum@literalblock}{\literalblockname\nobreakspace\theliteralblock}
+% this will be overwritten in document preamble by Babel translation
+\newcommand*{\literalblockname}{Listing }
+% file extension needed for \caption's good functioning, the file is created
+% only if a \listof{literalblock}{foo} command is encountered, which is
+% analogous to \listoffigures, but for the code listings (foo = chosen title.)
+\newcommand*{\ext@literalblock}{lol}
+
% control caption around literal-block
\RequirePackage{capt-of}
\RequirePackage{needspace}
@@ -896,22 +1040,117 @@
\spx@originalcaption }
% by default, also define macros with the no-prefix names
-\ifsphinxKeepOldNames
+\ifspx@opt@dontkeepoldnames\else
\typeout{** (sphinx) defining (legacy) text style macros without \string\sphinx\space prefix}
- \typeout{** if clashes with packages, set latex_keep_old_macro_names=False in conf.py}
- \@for\@tempa:=strong,bfcode,email,tablecontinued,titleref,%
+ \typeout{** if clashes with packages, set latex_keep_old_macro_names=False
+ in conf.py}
+ \@for\@tempa:=code,strong,bfcode,email,tablecontinued,titleref,%
menuselection,accelerator,crossref,termref,optional\do
{% first, check if command with no prefix already exists
\expandafter\newcommand\csname\@tempa\endcsname{}%
- % if no error give it the meaning defined so far with \sphinx prefix
+ % give it the meaning defined so far with \sphinx prefix
\expandafter\let\csname\@tempa\expandafter\endcsname
\csname sphinx\@tempa\endcsname
% redefine the \sphinx prefixed macro to expand to non-prefixed one
\expandafter\def\csname sphinx\@tempa\expandafter\endcsname
\expandafter{\csname\@tempa\endcsname}%
-}
- % robustified case needs special treatment
- \newcommand\code{}\let\code\relax
- \DeclareRobustCommand{\code}[1]{{\@noligs\scantokens{\texttt{#1}\relax}}}
- \def\sphinxcode{\code}%
+}%
\fi
+
+% additional customizable styling
+% FIXME: convert this to package options ?
+\protected\def\sphinxstyleindexentry {\texttt}
+\long\protected\def\sphinxstyleindexextra #1{ \emph{(#1)}}
+\protected\def\sphinxstyleindexpageref {, \pageref}
+\long\protected\def\sphinxstyletopictitle #1{\textbf{#1}\par\medskip}
+\let\sphinxstylesidebartitle\sphinxstyletopictitle
+\protected\def\sphinxstyleothertitle {\textbf}
+\long\protected\def\sphinxstylesidebarsubtitle #1{~\\\textbf{#1} \smallskip}
+\protected\def\sphinxstylethead {\textsf}
+\protected\def\sphinxstyleemphasis {\emph}
+\long\protected\def\sphinxstyleliteralemphasis#1{\emph{\sphinxcode{#1}}}
+\protected\def\sphinxstylestrong {\textbf}
+\protected\def\sphinxstyleliteralstrong {\sphinxbfcode}
+\protected\def\sphinxstyleabbreviation {\textsc}
+\protected\def\sphinxstyleliteralintitle {\sphinxcode}
+
+% stylesheet for highlighting with pygments
+\RequirePackage{sphinxhighlight}
+
+% make commands known to non-Sphinx document classes
+\providecommand*{\sphinxtableofcontents}{\tableofcontents}
+\providecommand*{\sphinxthebibliography}{\thebibliography}
+\providecommand*{\sphinxtheindex}{\theindex}
+
+% remove LaTeX's cap on nesting depth if 'maxlistdepth' key used.
+% This is a hack, which works with the standard classes: it assumes \@toodeep
+% is always used in "true" branches: "\if ... \@toodeep \else .. \fi."
+
+% will force use the "false" branch (if there is one)
+\def\spx@toodeep@hack{\fi\iffalse}
+
+% do nothing if 'maxlistdepth' key not used or if package enumitem loaded.
+\ifnum\spx@opt@maxlistdepth=\z@\expandafter\@gobbletwo\fi
+\AtBeginDocument{%
+\@ifpackageloaded{enumitem}{\remove@to@nnil}{}%
+ \let\spx@toodeepORI\@toodeep
+ \def\@toodeep{%
+ \ifnum\@listdepth<\spx@opt@maxlistdepth\relax
+ \expandafter\spx@toodeep@hack
+ \else
+ \expandafter\spx@toodeepORI
+ \fi}%
+% define all missing \@list... macros
+ \count@\@ne
+ \loop
+ \spx@ifundefined{@list\romannumeral\the\count@}
+ {\iffalse}{\iftrue\advance\count@\@ne}%
+ \repeat
+ \loop
+ \ifnum\count@>\spx@opt@maxlistdepth\relax\else
+ \expandafter\let
+ \csname @list\romannumeral\the\count@\expandafter\endcsname
+ \csname @list\romannumeral\the\numexpr\count@-\@ne\endcsname
+ % higher \leftmargin... needed to fix issue with babel-french (v2.6--...)
+ \spx@ifundefined{leftmargin\romannumeral\the\count@}
+ {\expandafter\let
+ \csname leftmargin\romannumeral\the\count@\expandafter\endcsname
+ \csname leftmargin\romannumeral\the\numexpr\count@-\@ne\endcsname}{}%
+ \advance\count@\@ne
+ \repeat
+% define all missing enum... counters and \labelenum... macros and \p@enum..
+ \count@\@ne
+ \loop
+ \spx@ifundefined{c@enum\romannumeral\the\count@}
+ {\iffalse}{\iftrue\advance\count@\@ne}%
+ \repeat
+ \loop
+ \ifnum\count@>\spx@opt@maxlistdepth\relax\else
+ \newcounter{enum\romannumeral\the\count@}%
+ \expandafter\def
+ \csname labelenum\romannumeral\the\count@\expandafter\endcsname
+ \expandafter
+ {\csname theenum\romannumeral\the\numexpr\count@\endcsname.}%
+ \expandafter\def
+ \csname p@enum\romannumeral\the\count@\expandafter\endcsname
+ \expandafter
+ {\csname p@enum\romannumeral\the\numexpr\count@-\@ne\expandafter
+ \endcsname\csname theenum\romannumeral\the\numexpr\count@-\@ne\endcsname.}%
+ \advance\count@\@ne
+ \repeat
+% define all missing labelitem... macros
+ \count@\@ne
+ \loop
+ \spx@ifundefined{labelitem\romannumeral\the\count@}
+ {\iffalse}{\iftrue\advance\count@\@ne}%
+ \repeat
+ \loop
+ \ifnum\count@>\spx@opt@maxlistdepth\relax\else
+ \expandafter\let
+ \csname labelitem\romannumeral\the\count@\expandafter\endcsname
+ \csname labelitem\romannumeral\the\numexpr\count@-\@ne\endcsname
+ \advance\count@\@ne
+ \repeat
+ \PackageInfo{sphinx}{maximal list depth extended to \spx@opt@maxlistdepth}%
+\@gobble\@nnil
+}
diff --git a/sphinx/texinputs/sphinxhowto.cls b/sphinx/texinputs/sphinxhowto.cls
index 8d5c59232..3e34063ef 100644
--- a/sphinx/texinputs/sphinxhowto.cls
+++ b/sphinx/texinputs/sphinxhowto.cls
@@ -3,13 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesClass{sphinxhowto}[2009/06/02 Document class (Sphinx HOWTO)]
-
-\ifx\directlua\undefined\else
-% if compiling with lualatex 0.85 or later load compatibility patch issued by
-% the LaTeX team for older packages relying on \pdf<name> named primitives.
- \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{}
-\fi
+\ProvidesClass{sphinxhowto}[2016/10/12 v1.5 Document class (Sphinx HOWTO)]
% 'oneside' option overriding the 'twoside' default
\newif\if@oneside
@@ -70,11 +64,10 @@
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
}
-\let\py@OldTableofcontents=\tableofcontents
-\renewcommand{\tableofcontents}{
+\newcommand{\sphinxtableofcontents}{
\begingroup
\parskip = 0mm
- \py@OldTableofcontents
+ \tableofcontents
\endgroup
\rule{\textwidth}{1pt}
\vspace{12pt}
@@ -91,21 +84,21 @@
% Contents.
% For an article document class this environment is a section,
% so no page break before it.
-\let\py@OldThebibliography=\thebibliography
-\renewcommand{\thebibliography}[1]{
+%
+% Note: \phantomsection is required for TeXLive 2009
+% http://tex.stackexchange.com/questions/44088/when-do-i-need-to-invoke-phantomsection#comment166081_44091
+\newenvironment{sphinxthebibliography}[1]{%
\phantomsection
- \py@OldThebibliography{1}
- \addcontentsline{toc}{section}{\bibname}
-}
+ \begin{thebibliography}{1}%
+ \addcontentsline{toc}{section}{\ifdefined\refname\refname\else\ifdefined\bibname\bibname\fi\fi}}{\end{thebibliography}}
+
% Same for the indices.
% The memoir class already does this, so we don't duplicate it in that case.
%
-\@ifclassloaded{memoir}{}{
- \let\py@OldTheindex=\theindex
- \renewcommand{\theindex}{
+\@ifclassloaded{memoir}
+ {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}
+ {\newenvironment{sphinxtheindex}{%
\phantomsection
- \py@OldTheindex
- \addcontentsline{toc}{section}{\indexname}
- }
-}
+ \begin{theindex}%
+ \addcontentsline{toc}{section}{\indexname}}{\end{theindex}}}
diff --git a/sphinx/texinputs/sphinxmanual.cls b/sphinx/texinputs/sphinxmanual.cls
index f20449449..3a48c6760 100644
--- a/sphinx/texinputs/sphinxmanual.cls
+++ b/sphinx/texinputs/sphinxmanual.cls
@@ -3,13 +3,7 @@
%
\NeedsTeXFormat{LaTeX2e}[1995/12/01]
-\ProvidesClass{sphinxmanual}[2009/06/02 Document class (Sphinx manual)]
-
-\ifx\directlua\undefined\else
-% if compiling with lualatex 0.85 or later load compatibility patch issued by
-% the LaTeX team for older packages relying on \pdf<name> named primitives.
- \IfFileExists{luatex85.sty}{\RequirePackage{luatex85}}{}
-\fi
+\ProvidesClass{sphinxmanual}[2016/10/12 v1.5 Document class (Sphinx manual)]
% chapters starting at odd pages (overridden by 'openany' document option)
\PassOptionsToClass{openright}{\sphinxdocclass}
@@ -40,6 +34,9 @@
% ``Bjarne'' style a bit better.
%
\renewcommand{\maketitle}{%
+ \let\spx@tempa\relax
+ \ifHy@pageanchor\def\spx@tempa{\Hy@pageanchortrue}\fi
+ \hypersetup{pageanchor=false}% avoid duplicate destination warnings
\begin{titlepage}%
\let\footnotesize\small
\let\footnoterule\relax
@@ -80,24 +77,22 @@
\setcounter{footnote}{0}%
\let\thanks\relax\let\maketitle\relax
%\gdef\@thanks{}\gdef\@author{}\gdef\@title{}
+ \if@openright\cleardoublepage\else\clearpage\fi
+ \spx@tempa
}
-\let\py@OldTableofcontents=\tableofcontents
-\renewcommand{\tableofcontents}{%
- % before resetting page counter, let's do the right thing.
- \if@openright\cleardoublepage\else\clearpage\fi
+\newcommand{\sphinxtableofcontents}{%
\pagenumbering{roman}%
\pagestyle{plain}%
\begingroup
\parskip \z@skip
- \py@OldTableofcontents
+ \tableofcontents
\endgroup
% before resetting page counter, let's do the right thing.
\if@openright\cleardoublepage\else\clearpage\fi
\pagenumbering{arabic}%
\ifdefined\fancyhf\pagestyle{normal}\fi
}
-\pagenumbering{alph}% avoid hyperref "duplicate destination" warnings
% This is needed to get the width of the section # area wide enough in the
% library reference. Doing it here keeps it the same for all the manuals.
@@ -108,23 +103,22 @@
% Fix the bibliography environment to add an entry to the Table of
% Contents.
% For a report document class this environment is a chapter.
-\let\py@OldThebibliography=\thebibliography
-\renewcommand{\thebibliography}[1]{
+%
+% Note: \phantomsection is required for TeXLive 2009
+% http://tex.stackexchange.com/questions/44088/when-do-i-need-to-invoke-phantomsection#comment166081_44091
+\newenvironment{sphinxthebibliography}[1]{%
\if@openright\cleardoublepage\else\clearpage\fi
\phantomsection
- \py@OldThebibliography{1}
- \addcontentsline{toc}{chapter}{\bibname}
-}
+ \begin{thebibliography}{1}%
+ \addcontentsline{toc}{chapter}{\bibname}}{\end{thebibliography}}
% Same for the indices.
% The memoir class already does this, so we don't duplicate it in that case.
%
-\@ifclassloaded{memoir}{}{
- \let\py@OldTheindex=\theindex
- \renewcommand{\theindex}{
+\@ifclassloaded{memoir}
+ {\newenvironment{sphinxtheindex}{\begin{theindex}}{\end{theindex}}}
+ {\newenvironment{sphinxtheindex}{%
\if@openright\cleardoublepage\else\clearpage\fi
\phantomsection
- \py@OldTheindex
- \addcontentsline{toc}{chapter}{\indexname}
- }
-}
+ \begin{theindex}%
+ \addcontentsline{toc}{chapter}{\indexname}}{\end{theindex}}}
diff --git a/sphinx/texinputs/tabulary.sty b/sphinx/texinputs/tabulary.sty
deleted file mode 100644
index 11fdf7428..000000000
--- a/sphinx/texinputs/tabulary.sty
+++ /dev/null
@@ -1,452 +0,0 @@
-%%
-%% This is file `tabulary.sty',
-%% generated with the docstrip utility.
-%%
-%% The original source files were:
-%%
-%% tabulary.dtx (with options: `package')
-%% DRAFT VERSION
-%%
-%% File `tabulary.dtx'.
-%% Copyright (C) 1995 1996 2003 2008 David Carlisle
-%% This file may be distributed under the terms of the LPPL.
-%% See 00readme.txt for details.
-%%
-\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{tabulary}
- [2008/12/01 v0.9 tabulary package (DPC)]
-\RequirePackage{array}
-\catcode`\Z=14
-\DeclareOption{debugshow}{\catcode`\Z=9\relax}
-\ProcessOptions
-\def\arraybackslash{\let\\=\@arraycr}
-\def\@finalstrut#1{%
- \unskip\ifhmode\nobreak\fi\vrule\@width\z@\@height\z@\@depth\dp#1}
-\newcount\TY@count
-\def\tabulary{%
- \let\TY@final\tabular
- \let\endTY@final\endtabular
- \TY@tabular}
-\def\TY@tabular#1{%
- \edef\TY@{\@currenvir}%
- {\ifnum0=`}\fi
- \@ovxx\TY@linewidth
- \@ovyy\TY@tablewidth
- \count@\z@
- \@tempswatrue
- \@whilesw\if@tempswa\fi{%
- \advance\count@\@ne
- \expandafter\ifx\csname TY@F\the\count@\endcsname\relax
- \@tempswafalse
- \else
- \expandafter\let\csname TY@SF\the\count@\expandafter\endcsname
- \csname TY@F\the\count@\endcsname
- \global\expandafter\let\csname TY@F\the\count@\endcsname\relax
- \expandafter\let\csname TY@S\the\count@\expandafter\endcsname
- \csname TY@\the\count@\endcsname
- \fi}%
- \global\TY@count\@ne
- \TY@width\xdef{0pt}%
- \global\TY@tablewidth\z@
- \global\TY@linewidth#1\relax
-Z\message{^^J^^JTable^^J%
-Z Target Width: \the\TY@linewidth^^J%
-Z \string\tabcolsep: \the\tabcolsep\space
-Z \string\arrayrulewidth: \the\arrayrulewidth\space
-Z \string\doublerulesep: \the\doublerulesep^^J%
-Z \string\tymin: \the\tymin\space
-Z \string\tymax: \the\tymax^^J}%
- \let\@classz\TY@classz
- \let\verb\TX@verb
- \toks@{}\TY@get@body}
-\let\TY@@mkpream\@mkpream
-\def\TY@mkpream{%
- \def\@addamp{%
- \if@firstamp \@firstampfalse \else
- \global\advance\TY@count\@ne
- \edef\@preamble{\@preamble &}\fi
- \TY@width\xdef{0pt}}%
- \def\@acol{%
- \TY@subwidth\col@sep
- \@addtopreamble{\hskip\col@sep}}%
- \let\@arrayrule\TY@arrayrule
- \let\@classvi\TY@classvi
- \def\@classv{\save@decl
- \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
- \sbox\z@{\d@llarbegin\@nextchar\d@llarend}%
- \TY@subwidth{\wd\z@}%
- \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
- \prepnext@tok}%
- \global\let\@mkpream\TY@@mkpream
- \TY@@mkpream}
-\def\TY@arrayrule{%
- \TY@subwidth\arrayrulewidth
- \@addtopreamble \vline}
-\def\TY@classvi{\ifcase \@lastchclass
- \@acol \or
- \TY@subwidth\doublerulesep
- \@addtopreamble{\hskip \doublerulesep}\or
- \@acol \or
- \@classvii
- \fi}
-\def\TY@tab{%
- \setbox\z@\hbox\bgroup
- \let\[$\let\]$%
- \let\equation$\let\endequation$%
- \col@sep\tabcolsep
- \let\d@llarbegin\begingroup\let\d@llarend\endgroup
- \let\@mkpream\TY@mkpream
- \def\multicolumn##1##2##3{\multispan##1\relax}%
- \CT@start\TY@tabarray}
-\def\TY@tabarray{\@ifnextchar[{\TY@array}{\@array[t]}}
-\def\TY@array[#1]{\@array[t]}
-\def\TY@width#1{%
- \expandafter#1\csname TY@\the\TY@count\endcsname}
-\def\TY@subwidth#1{%
- \TY@width\dimen@
- \advance\dimen@-#1\relax
- \TY@width\xdef{\the\dimen@}%
- \global\advance\TY@linewidth-#1\relax}
-\def\endtabulary{%
- \gdef\@halignto{}%
- \let\TY@footnote\footnote%
- \def\footnote{}% prevent footnotes from doing anything
- \expandafter\TY@tab\the\toks@
- \crcr\omit
- {\xdef\TY@save@row{}%
- \loop
- \advance\TY@count\m@ne
- \ifnum\TY@count>\z@
- \xdef\TY@save@row{\TY@save@row&\omit}%
- \repeat}\TY@save@row
- \endarray\global\setbox1=\lastbox\setbox0=\vbox{\unvbox1
- \unskip\global\setbox1=\lastbox}\egroup
- \dimen@\TY@linewidth
- \divide\dimen@\TY@count
- \ifdim\dimen@<\tymin
- \TY@warn{tymin too large (\the\tymin), resetting to \the\dimen@}%
- \tymin\dimen@
- \fi
- \setbox\tw@=\hbox{\unhbox\@ne
- \loop
-\@tempdima=\lastskip
-\ifdim\@tempdima>\z@
-Z \message{ecs=\the\@tempdima^^J}%
- \global\advance\TY@linewidth-\@tempdima
-\fi
- \unskip
- \setbox\tw@=\lastbox
- \ifhbox\tw@
-Z \message{Col \the\TY@count: Initial=\the\wd\tw@\space}%
- \ifdim\wd\tw@>\tymax
- \wd\tw@\tymax
-Z \message{> max\space}%
-Z \else
-Z \message{ \@spaces\space}%
- \fi
- \TY@width\dimen@
-Z \message{\the\dimen@\space}%
- \advance\dimen@\wd\tw@
-Z \message{Final=\the\dimen@\space}%
- \TY@width\xdef{\the\dimen@}%
- \ifdim\dimen@<\tymin
-Z \message{< tymin}%
- \global\advance\TY@linewidth-\dimen@
- \expandafter\xdef\csname TY@F\the\TY@count\endcsname
- {\the\dimen@}%
- \else
- \expandafter\ifx\csname TY@F\the\TY@count\endcsname\z@
-Z \message{***}%
- \global\advance\TY@linewidth-\dimen@
- \expandafter\xdef\csname TY@F\the\TY@count\endcsname
- {\the\dimen@}%
- \else
-Z \message{> tymin}%
- \global\advance\TY@tablewidth\dimen@
- \global\expandafter\let\csname TY@F\the\TY@count\endcsname
- \maxdimen
- \fi\fi
- \advance\TY@count\m@ne
- \repeat}%
- \TY@checkmin
- \TY@checkmin
- \TY@checkmin
- \TY@checkmin
- \TY@count\z@
- \let\TY@box\TY@box@v
- \let\footnote\TY@footnote % restore footnotes
- {\expandafter\TY@final\the\toks@\endTY@final}%
- \count@\z@
- \@tempswatrue
- \@whilesw\if@tempswa\fi{%
- \advance\count@\@ne
- \expandafter\ifx\csname TY@SF\the\count@\endcsname\relax
- \@tempswafalse
- \else
- \global\expandafter\let\csname TY@F\the\count@\expandafter\endcsname
- \csname TY@SF\the\count@\endcsname
- \global\expandafter\let\csname TY@\the\count@\expandafter\endcsname
- \csname TY@S\the\count@\endcsname
- \fi}%
- \TY@linewidth\@ovxx
- \TY@tablewidth\@ovyy
- \ifnum0=`{\fi}}
-\def\TY@checkmin{%
- \let\TY@checkmin\relax
-\ifdim\TY@tablewidth>\z@
- \Gscale@div\TY@ratio\TY@linewidth\TY@tablewidth
- \ifdim\TY@tablewidth <\TY@linewidth
- \def\TY@ratio{1}%
- \fi
-\else
- \TY@warn{No suitable columns!}%
- \def\TY@ratio{1}%
-\fi
-\count@\z@
-Z \message{^^JLine Width: \the\TY@linewidth,
-Z Natural Width: \the\TY@tablewidth,
-Z Ratio: \TY@ratio^^J}%
-\@tempdima\z@
-\loop
-\ifnum\count@<\TY@count
-\advance\count@\@ne
- \ifdim\csname TY@F\the\count@\endcsname>\tymin
- \dimen@\csname TY@\the\count@\endcsname
- \dimen@\TY@ratio\dimen@
- \ifdim\dimen@<\tymin
-Z \message{Column \the\count@\space ->}%
- \global\expandafter\let\csname TY@F\the\count@\endcsname\tymin
- \global\advance\TY@linewidth-\tymin
- \global\advance\TY@tablewidth-\csname TY@\the\count@\endcsname
- \let\TY@checkmin\TY@@checkmin
- \else
- \expandafter\xdef\csname TY@F\the\count@\endcsname{\the\dimen@}%
- \advance\@tempdima\csname TY@F\the\count@\endcsname
- \fi
- \fi
-Z \dimen@\csname TY@F\the\count@\endcsname\message{\the\dimen@, }%
-\repeat
-Z \message{^^JTotal:\the\@tempdima^^J}%
-}
-\let\TY@@checkmin\TY@checkmin
-\newdimen\TY@linewidth
-\def\tyformat{\everypar{{\nobreak\hskip\z@skip}}}
-\newdimen\tymin
-\tymin=10pt
-\newdimen\tymax
-\tymax=2\textwidth
-\def\@testpach{\@chclass
- \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
- \ifnum \@lastchclass=7 5 \else
- \ifnum \@lastchclass=8 \tw@ \else
- \ifnum \@lastchclass=9 \thr@@
- \else \z@
- \ifnum \@lastchclass = 10 \else
- \edef\@nextchar{\expandafter\string\@nextchar}%
- \@chnum
- \if \@nextchar c\z@ \else
- \if \@nextchar l\@ne \else
- \if \@nextchar r\tw@ \else
- \if \@nextchar C7 \else
- \if \@nextchar L8 \else
- \if \@nextchar R9 \else
- \if \@nextchar J10 \else
- \z@ \@chclass
- \if\@nextchar |\@ne \else
- \if \@nextchar !6 \else
- \if \@nextchar @7 \else
- \if \@nextchar <8 \else
- \if \@nextchar >9 \else
- 10
- \@chnum
- \if \@nextchar m\thr@@\else
- \if \@nextchar p4 \else
- \if \@nextchar b5 \else
- \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi\fi \fi \fi\fi \fi
- \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
-\def\TY@classz{%
- \@classx
- \@tempcnta\count@
- \ifx\TY@box\TY@box@v
- \global\advance\TY@count\@ne
- \fi
- \let\centering c%
- \let\raggedright\noindent
- \let\raggedleft\indent
- \let\arraybackslash\relax
- \prepnext@tok
- \ifnum\@chnum<4
- \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
- \fi
- \ifnum\@chnum=6
- \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
- \fi
- \@addtopreamble{%
- \ifcase\@chnum
- \hfil \d@llarbegin\insert@column\d@llarend \hfil \or
- \kern\z@
- \d@llarbegin \insert@column \d@llarend \hfil \or
- \hfil\kern\z@ \d@llarbegin \insert@column \d@llarend \or
- $\vcenter\@startpbox{\@nextchar}\insert@column \@endpbox $\or
- \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
- \vbox \@startpbox{\@nextchar}\insert@column \@endpbox \or
- \d@llarbegin \insert@column \d@llarend \or% dubious "s" case
- \TY@box\centering\or
- \TY@box\raggedright\or
- \TY@box\raggedleft\or
- \TY@box\relax
- \fi}\prepnext@tok}
-\def\TY@box#1{%
- \ifx\centering#1%
- \hfil \d@llarbegin\insert@column\d@llarend \hfil \else
- \ifx\raggedright#1%
- \kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
- \d@llarbegin \insert@column \d@llarend \hfil \else
- \ifx\raggedleft#1%
- \hfil\kern\z@ \d@llarbegin \insert@column \d@llarend \else
- \ifx\relax#1%
- \d@llarbegin \insert@column \d@llarend
- \fi \fi \fi \fi}
-\def\TY@box@v#1{%
- \vtop \@startpbox{\csname TY@F\the\TY@count\endcsname}%
- #1\arraybackslash\tyformat
- \insert@column\@endpbox}
-\newdimen\TY@tablewidth
-\def\Gscale@div#1#2#3{%
- \setlength\dimen@{#3}%
- \ifdim\dimen@=\z@
- \PackageError{graphics}{Division by 0}\@eha
- \dimen@#2%
- \fi
- \edef\@tempd{\the\dimen@}%
- \setlength\dimen@{#2}%
- \count@65536\relax
- \ifdim\dimen@<\z@
- \dimen@-\dimen@
- \count@-\count@
- \fi
- \loop
- \ifdim\dimen@<8192\p@
- \dimen@\tw@\dimen@
- \divide\count@\tw@
- \repeat
- \dimen@ii=\@tempd\relax
- \divide\dimen@ii\count@
- \divide\dimen@\dimen@ii
- \edef#1{\strip@pt\dimen@}}
-\long\def\TY@get@body#1\end
- {\toks@\expandafter{\the\toks@#1}\TY@find@end}
-\def\TY@find@end#1{%
- \def\@tempa{#1}%
- \ifx\@tempa\TY@\def\@tempa{\end{#1}}\expandafter\@tempa
- \else\toks@\expandafter
- {\the\toks@\end{#1}}\expandafter\TY@get@body\fi}
-\def\TY@warn{%
- \PackageWarning{tabulary}}
-\catcode`\Z=11
-\AtBeginDocument{
-\@ifpackageloaded{colortbl}{%
-\expandafter\def\expandafter\@mkpream\expandafter#\expandafter1%
- \expandafter{%
- \expandafter\let\expandafter\CT@setup\expandafter\relax
- \expandafter\let\expandafter\CT@color\expandafter\relax
- \expandafter\let\expandafter\CT@do@color\expandafter\relax
- \expandafter\let\expandafter\color\expandafter\relax
- \expandafter\let\expandafter\CT@column@color\expandafter\relax
- \expandafter\let\expandafter\CT@row@color\expandafter\relax
- \@mkpream{#1}}
-\let\TY@@mkpream\@mkpream
-\def\TY@classz{%
- \@classx
- \@tempcnta\count@
- \ifx\TY@box\TY@box@v
- \global\advance\TY@count\@ne
- \fi
- \let\centering c%
- \let\raggedright\noindent
- \let\raggedleft\indent
- \let\arraybackslash\relax
- \prepnext@tok
-\expandafter\CT@extract\the\toks\@tempcnta\columncolor!\@nil
- \ifnum\@chnum<4
- \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
- \fi
- \ifnum\@chnum=6
- \global\expandafter\let\csname TY@F\the\TY@count\endcsname\z@
- \fi
- \@addtopreamble{%
- \setbox\z@\hbox\bgroup\bgroup
- \ifcase\@chnum
- \hskip\stretch{.5}\kern\z@
- \d@llarbegin\insert@column\d@llarend\hskip\stretch{.5}\or
- \kern\z@%<<<<<<<<<<<<<<<<<<<<<<<<<<<
- \d@llarbegin \insert@column \d@llarend \hfill \or
- \hfill\kern\z@ \d@llarbegin \insert@column \d@llarend \or
- $\vcenter\@startpbox{\@nextchar}\insert@column \@endpbox $\or
- \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
- \vbox \@startpbox{\@nextchar}\insert@column \@endpbox \or
- \d@llarbegin \insert@column \d@llarend \or% dubious s case
- \TY@box\centering\or
- \TY@box\raggedright\or
- \TY@box\raggedleft\or
- \TY@box\relax
- \fi
- \egroup\egroup
-\begingroup
- \CT@setup
- \CT@column@color
- \CT@row@color
- \CT@do@color
-\endgroup
- \@tempdima\ht\z@
- \advance\@tempdima\minrowclearance
- \vrule\@height\@tempdima\@width\z@
-\unhbox\z@
-}\prepnext@tok}%
- \def\TY@arrayrule{%
- \TY@subwidth\arrayrulewidth
- \@addtopreamble{{\CT@arc@\vline}}}%
- \def\TY@classvi{\ifcase \@lastchclass
- \@acol \or
- \TY@subwidth\doublerulesep
- \ifx\CT@drsc@\relax
- \@addtopreamble{\hskip\doublerulesep}%
- \else
- \@addtopreamble{{\CT@drsc@\vrule\@width\doublerulesep}}%
- \fi\or
- \@acol \or
- \@classvii
- \fi}%
-}{%
-\let\CT@start\relax
-}
-}
-{\uccode`\*=`\ %
-\uppercase{\gdef\TX@verb{%
- \leavevmode\null\TX@vwarn
- {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
- \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
-\def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
- \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
-\def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
-\begingroup
-\catcode`\*=\catcode`\#
-\catcode`\#=12
-\gdef\TX@vfirst{%
- \if\@tempa#%
- \def\@tempb{\TX@v@#}%
- \else
- \let\@tempb\TX@v@
- \if\@tempa\space~\else\@tempa\fi
- \fi
- \@tempb}
-\gdef\TX@v@*1 *2{%
- \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
-\gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}
-\endgroup
-\def\TX@vwarn{%
- \@warning{\noexpand\verb may be unreliable inside tabularx/y}%
- \global\let\TX@vwarn\@empty}
-\endinput
-%%
-%% End of file `tabulary.sty'.