summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/newfloat.dtx
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/newfloat.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/newfloat.dtx204
1 files changed, 147 insertions, 57 deletions
diff --git a/Master/texmf-dist/source/latex/caption/newfloat.dtx b/Master/texmf-dist/source/latex/caption/newfloat.dtx
index 633d57f34a7..fd283697dc0 100644
--- a/Master/texmf-dist/source/latex/caption/newfloat.dtx
+++ b/Master/texmf-dist/source/latex/caption/newfloat.dtx
@@ -2,7 +2,7 @@
%
% This is file `newfloat.dtx'.
%
-% Copyright (C) 2011-2015 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+% Copyright (C) 2011-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
%
@@ -25,7 +25,7 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{1307}
+% \CheckSum{1397}
%
% \iffalse
%<*driver>
@@ -88,10 +88,11 @@
%
% \GetFileInfo{newfloat.drv}
% \let\docdate\filedate
+% \let\docversion\fileversion
% \GetFileInfo{newfloat.sty}
%
% \title{\texorpdfstring{\Thispackage\thanks{%^^A
-% This package has version number \fileversion.}}%^^A
+% This package has version number \docversion.}}%^^A
% {The newfloat package}}
% \author{Axel Sommerfeldt\\
% \url{https://gitlab.com/axelsommerfeldt/caption}}
@@ -469,7 +470,7 @@
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname}
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs}
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo}
-% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom}
+% \DoNotIndex{\@gobble,\@gobbletwo,\@gobblethree,\@gobblefour,\@hangfrom}
% \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded}
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse}
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist}
@@ -515,6 +516,7 @@
% outsourced from the \package{caption3} package and revised}
% \changes{v1.1}{2013/04/27}{Adapted to the \package{tocloft} package}
% \changes{v1.1}{2013/04/27}{New command \cs{PrepareListOf} added}
+% \changes{v1.1d}{2019/03/16}{Adapted to the \package{dgruyter} package}
%
% \iffalse
% --------------------------------------------------------------------------- %
@@ -531,7 +533,7 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{newfloat}[2018/03/04 v1.1a Defining new floating environments (AR)]
+\ProvidesPackage{newfloat}[2019/08/28 v1.1g Defining new floating environments (AR)]
% \end{macrocode}
%
% \begin{macro}{\newfloat@Info}
@@ -610,6 +612,8 @@
% \changes{v1.1}{2013/11/03}{Uses \cs{newfloat@capitalize} now}
% \changes{v1.1}{2015/09/16}{Support of \cs{autodot} (offered by the \KOMAScript\ classes) added}
% \changes{v1.1}{2018/03/04}{Usage of \cs{ifdefined} replaced by \cs{@ifundefined} to improve compatibility with the \package{listings} package}
+% \changes{v1.1b}{2018/12/26}{Bugfix: Missing curly braces added}
+% \changes{v1.1c}{2019/01/10}{Bugfix: Support of \cs{autodot} fixed}
% |\DeclareFloatingEnvironment|\oarg{options}\marg{environment}\oarg{name}\oarg{list name}
% \begin{macrocode}
\newcommand*\DeclareFloatingEnvironment{%
@@ -646,7 +650,8 @@
% Define |\fnum@|\meta{type}, a macro to generate the figure number for a caption
% \begin{macrocode}
\newfloat@def{fnum@#2}%
- {\@nameuse{#2name}\nobreakspace\@nameuse{the#2}\@nameuse{autodot}}%
+ {\@nameuse{#2name}\nobreakspace\@nameuse{the#2}%
+ \ifdefined\autodot\expandafter\autodot\fi}%
% \end{macrocode}
% Define |\|\meta{type}|name| used by |\fnum@|\meta{type} as \meta{type},
% but with first letter capitalized
@@ -666,10 +671,10 @@
% \begin{macrocode}
\ifcsname @tufte@float\endcsname
\newenvironment{#2}[1][htbp]%
- {\begin{@tufte@float}[##1]{#2}{}}%
+ {\begin{@tufte@float}[{##1}]{#2}{}}%
{\end{@tufte@float}}%
\newenvironment{#2*}[1][htbp]%
- {\begin{@tufte@float}[##1]{#2}{star}}%
+ {\begin{@tufte@float}[{##1}]{#2}{star}}%
{\end{@tufte@float}}%
\else
\newenvironment{#2}{\@float{#2}}{\end@float}%
@@ -746,14 +751,21 @@
%
% \begin{macro}{\newfloat@listof}
% \changes{v1.1}{2013/04/27}{Revised}
+% \changes{v1.1g}{2019/08/28}{Starred variant added}
% |\newfloat@listof|\marg{float type}\\
% typesets the list, using |\listoffigure| with patched list name and file extension.
% \begin{macrocode}
\newcommand*\newfloat@listof[1]{%
- \@expandtwoargs\newfloat@list@of{#1}{\@nameuse{ext@#1}}}
+ \@ifstar
+ {\newfloat@list@of{#1}*}%
+ {\newfloat@list@of{#1}\relax}}
+% \end{macrocode}
+% \begin{macrocode}
+\newcommand*\newfloat@list@of[1]{%
+ \@expandtwoargs\newfloat@list@of@{#1}{\@nameuse{ext@#1}}}
% \end{macrocode}
% \begin{macrocode}
-\newcommand*\newfloat@list@of[2]{%
+\newcommand*\newfloat@list@of@[3]{%
\begingroup
\expandafter\let\expandafter\listfigurename\csname list#1name\endcsname
\def\ext@figure{#2}%
@@ -762,7 +774,7 @@
\let\newfloat@listoftoc\listoftoc
\def\listoftoc##1{\newfloat@listoftoc{#2}}%
\@nameuse{newfloat@listof#1@hook}%
- \listoffigures
+ \listoffigures#3%
\endgroup}
% \end{macrocode}
% \end{macro}
@@ -1063,7 +1075,7 @@
% \begin{macro}{\ForEachFloatingEnvironment}
% |\ForEachFloatingEnvironment|\marg{code}
% will execute the given code for each floating environment.
-% The starred variant will only work for already existing environment,
+% The starred variant will only work for already existing environments,
% i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|.
% \begin{macrocode}
\newcommand\ForEachFloatingEnvironment{%
@@ -1294,7 +1306,7 @@
%
% \begin{macro}{planb=}
% \changes{v1.0b}{2012/05/18}{This option added}
-% This option switches the `Plan B' on or off. (default$=$off)
+% This option switches the `Plan B' on or off. (default$=$true)
% \begin{macrocode}
\define@key{newfloat}{planb}[true]{%
\def\@tempa{#1}%
@@ -1343,29 +1355,35 @@
% \subsection{Patching \cs{chapter}}
%
% \begin{macro}{\newfloat@replace@chapter}
-% |\newfloat@replace@chapter|\marg{original code}\marg{replacement code}\par
+% \changes{v1.1f}{2019/08/25}{Parameter \meta{class name} added to macro}
+% |\newfloat@replace@chapter|\marg{class name}\marg{original code}\marg{replacement code}\par
% tries to patch |\@chapter| so |\@add|\-|chapter|\-|lists|\-|gaps| will be supported.
% It checks for |\Hy@org@chapter|, too, since the original code will be stored here
% if the \package{hyperref} package was loaded.
% \begin{macrocode}
-\newcommand\newfloat@replace@chapter[2]{%
+\newcommand\newfloat@replace@chapter[3]{%
\begingroup
\let\if@twocolumn\iffalse
\let\if@mainmatter\iffalse
\let\if@thema\iffalse
- \def\@tempa[##1]##2{#1}%
+ \def\@tempa[##1]##2{#2}%
\ifx\@tempa\@chapter
- \gdef\@chapter[##1]##2{#2}%
- \global\let\newfloat@replace@chapter\@gobbletwo
+ \newfloat@InfoNoLine{Document class `#1' detected}%
+ \gdef\@chapter[##1]##2{#3}%
+ \global\let\newfloat@replace@chapter\newfloat@dont@replace@chapter
\else\ifx\@tempa\Hy@org@chapter
- \gdef\Hy@org@chapter[##1]##2{#2}%
- \global\let\newfloat@replace@chapter\@gobbletwo
+ \newfloat@InfoNoLine{Document class `#1' detected (Hy)}%
+ \gdef\Hy@org@chapter[##1]##2{#3}%
+ \global\let\newfloat@replace@chapter\newfloat@dont@replace@chapter
\fi\fi
\endgroup}
% \end{macrocode}
% \begin{macrocode}
+\newcommand\newfloat@dont@replace@chapter[3]{}
+% \end{macrocode}
+% \begin{macrocode}
\ifcsname @chapter\endcsname \else
- \let\newfloat@replace@chapter\@gobbletwo
+ \let\newfloat@replace@chapter\newfloat@dont@replace@chapter
\fi
% \end{macrocode}
% \end{macro}
@@ -1375,7 +1393,7 @@
%
% \begin{macrocode}
% report.cls [2005/09/16 v1.4f Standard LaTeX document class]
-\newfloat@replace@chapter{%
+\newfloat@replace@chapter{report}{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
@@ -1414,7 +1432,7 @@
%
% \begin{macrocode}
% book.cls [2005/09/16 v1.4f Standard LaTeX document class]
-\newfloat@replace@chapter{%
+\newfloat@replace@chapter{book}{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
@@ -1465,7 +1483,7 @@
% \begin{macrocode}
% amsbook.cls [2004/08/06 v2.20]
% smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF]
-\newfloat@replace@chapter{%
+\newfloat@replace@chapter{amsbook}{%
\refstepcounter{chapter}%
\ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty
\else \let\@secnumber\thechapter \fi
@@ -1499,7 +1517,7 @@
% chapters gap in |\@chapter|\-|lists|\-|gap@on| and |\@chapter|\-|lists|\-|gap@off|.
% \begin{macrocode}
\@ifpackageloaded{tocbasic}{%
- \let\newfloat@replace@chapter\@gobbletwo}{}
+ \let\newfloat@replace@chapter\newfloat@dont@replace@chapter}{}
% \end{macrocode}
%
% \pagebreak[3]
@@ -1510,7 +1528,7 @@
% \begin{macrocode}
\ifcsname insertchapterspace\endcsname
\renewcommand*\insertchapterspace{\@addchapterlistsgaps}
- \let\newfloat@replace@chapter\@gobbletwo
+ \let\newfloat@replace@chapter\newfloat@dont@replace@chapter
\fi
% \end{macrocode}
%
@@ -1519,7 +1537,7 @@
%
% \begin{macrocode}
% rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class]
-\newfloat@replace@chapter{%
+\newfloat@replace@chapter{rapport}{%
\ifnum \c@secnumdepth >\m@ne
\refstepcounter{chapter}%
\typeout{\@chapapp\space\thechapter.}%
@@ -1557,7 +1575,7 @@
% \end{macrocode}
% \begin{macrocode}
% boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class]
-\newfloat@replace@chapter{%
+\newfloat@replace@chapter{boek}{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
@@ -1607,7 +1625,7 @@
%
% \begin{macrocode}
% thesis.cls [1996/25/01 1.0g LaTeX document class (wm).]
-\newfloat@replace@chapter{%
+\newfloat@replace@chapter{thesis}{%
\ifnum \c@secnumdepth >\m@ne
\if@mainmatter
\refstepcounter{chapter}%
@@ -1675,24 +1693,78 @@
% \end{macrocode}
%
% \pagebreak[3]
+% \subsubsection{The Springer Verlag document classes}
+% \changes{v1.1f}{2019/08/25}{Support of \package{svmono} and \package{svmult} document classes added}
+%
+% \begin{macrocode}
+% svmono.cls [2018/06/25 v5.6 Springer Verlag global LaTeX document class for monographs]
+% svmult.cls [2018/01/11 v5.5 Springer Verlag global LaTeX document class for multi authored books]
+\newfloat@replace@chapter{svmono}{%
+ \if@chapnum % war mal \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \if@mainmatter
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}{\protect
+ \numberline{\thechapter\thechapterend}#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}{%
+ \if@chapnum % war mal \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{chapter}%
+ \if@mainmatter
+ \typeout{\@chapapp\space\thechapter.}%
+ \addcontentsline{toc}{chapter}{\protect
+ \numberline{\thechapter\thechapterend}#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}
+% \end{macrocode}
+%
+% \pagebreak[3]
% \subsubsection{Compatibility warning}
%
% \begin{macrocode}
-\ifx\newfloat@replace@chapter\@gobbletwo \else
+\ifx\newfloat@replace@chapter\newfloat@dont@replace@chapter \else
% \end{macrocode}
% If we were not able to patch |\@chapter| an info message is issued
% since we may not be able to support chapter lists gaps then.
% \begin{macrocode}
\newfloat@InfoNoLine{%
- Unsupported document class, or \noexpand\@chapter\MessageBreak
- was already redefined by another package}
+ 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}
% \end{macrocode}
-% Plan B: We patch |\addtocontents| instead, and keep our fingers crossed in the hope
-% that this redefinition actually will fit.
+% Plan B: We patch |\add|\-|to|\-|contents| instead, and keep our fingers crossed
+% in the hope that this redefinition actually will fit.
+% (Note: Since \package{biblatex} patches |\add|\-|to|\-|contents| as well we do
+% this using |\At||Begin||Document|.)
+% \changes{v1.1f}{2019/08/25}{Plan B will now be done using \cs{AtBeginDocument}}
% \begin{macrocode}
- \newfloat@ifplanb{%
+ \newfloat@ifplanb{\AtBeginDocument{%
\newfloat@InfoNoLine{Trying Plan B..}%
\let\newfloat@addtocontents@ORI\addtocontents
\long\def\addtocontents#1#2{%
@@ -1713,7 +1785,7 @@
\@addchapterlistsgaps
\endgroup
\fi
- \fi}}
+ \fi}}}
% \end{macrocode}
% \begin{macrocode}
\fi
@@ -1723,21 +1795,22 @@
% \subsection{Support of other packages}
%
% \begin{macro}{\newfloat@ForEachNew}
-% |\newfloat@ForEachNew|\oarg{command}\marg{code}
+% \changes{v1.1e}{2019/03/17}{This macro revised; uses \cs{ForEachFloatingEnvironment} now}
+% |\newfloat@ForEachNew|\marg{command}\marg{code}
% will execute the given code for every floating environment defined with
-% |\Declare|\-|Floating|\-|Environment|.
-% This will be done |\At|\-|Begin|\-|Document| so the affected package could be loaded
-% after \thispackage.
-% (If a \meta{command} is given this will only be done if \meta{command} is
-% defined.)
-% \begin{macrocode}
-\newcommand\newfloat@ForEachNew[2][newfloat@@list]{%
- \AtBeginDocument{%
- \ifcsname#1\endcsname
- \def\@elt##1{#2}%
- \newfloat@@list
- \let\@elt\relax
- \fi}}%
+% |\Declare|\-|Floating|\-|Environment| if \meta{command} is defined.
+% This will be tried |\At|\-|Begin|\-|Document| additionally so the affected
+% package could be loaded after \thispackage.
+% \begin{macrocode}
+\newcommand\newfloat@ForEachNew[2]{%
+ \ifcsname#1\endcsname
+ \ForEachFloatingEnvironment{#2}%
+ \else
+ \AtBeginDocument{%
+ \ifcsname#1\endcsname
+ \ForEachFloatingEnvironment{#2}%
+ \fi}%
+ \fi}%
\@onlypreamble\newfloat@ForEachNew
% \end{macrocode}
% \end{macro}
@@ -1749,7 +1822,7 @@
% extensions, too. Since this list will be used for inserting chapters gaps
% we only add the ones which are configured for chapters gaps on.
%% \begin{macrocode}
-\newfloat@ForEachNew[float@exts]{%
+\newfloat@ForEachNew{float@exts}{%
\@nameuse{@ifchapterlistsgap@#1}{% if switched on
\let\float@do=\relax
\edef\@tempa{%
@@ -1762,7 +1835,7 @@
%
% We define a FP-variant of new floating environments here.
% \begin{macrocode}
-\newfloat@ForEachNew[FP@floatBegin]{%
+\newfloat@ForEachNew{FP@floatBegin}{%
\newcounter{FP@#1C}%
\newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}}
% \end{macrocode}
@@ -1784,7 +1857,7 @@
%
% We define a sideways-variant of new floating environments here.
% \begin{macrocode}
-\newfloat@ForEachNew[@rotfloat]{%
+\newfloat@ForEachNew{@rotfloat}{%
\newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}%
\newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}}
% \end{macrocode}
@@ -1793,28 +1866,45 @@
% \subsubsection{\package{sidecap}}
%
% We define a SC-variant of new floating environments here.
+% \begin{macro}{\SC@float}
+% \changes{v1.1b}{2018/12/26}{Bugfix: Missing curly braces added}
% \begin{macrocode}
\newcommand*\newfloat@For@SC[2]{%
\def#1{b}% = \sidecaptionvpos{#2}{b} (v1.6)
\newenvironment{SC#2}%
- {\SC@float[#1]{#2}}{\endSC@float}%
+ {\SC@float[{#1}]{#2}}{\endSC@float}%
\newenvironment{SC#2*}%
- {\SC@dblfloat[#1]{#2}}{\endSC@dblfloat}}
+ {\SC@dblfloat[{#1}]{#2}}{\endSC@dblfloat}}
\@onlypreamble\newfloat@For@SC
% \end{macrocode}
% \begin{macrocode}
-\newfloat@ForEachNew[SC@float]{%
+\newfloat@ForEachNew{SC@float}{%
\expandafter\newfloat@For@SC\csname SC@#1@vpos\endcsname{#1}}
% \end{macrocode}
+% \end{macro}
%
% \pagebreak[3]
% \subsubsection{\package{wrapfig}}
%
% We define a wrap-variant of new floating environments here.
% \begin{macrocode}
-\newfloat@ForEachNew[wrapfloat]{%
+\newfloat@ForEachNew{wrapfloat}{%
\newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}}
% \end{macrocode}
+%
+% \pagebreak[3]
+% \subsubsection{\package{dgruyter}}
+%
+% The De Gruyter layout package (for preparing books for Walter de Gruyter GmbH)
+% is defining |\plist@figure| and |\plist@table|, and expects this to be
+% defined for other floating environments as well.
+% (This will be used as prefix for the ``List of''.)
+% \begin{macrocode}
+\newfloat@ForEachNew{plist@figure}{%
+ \expandafter\newcommand\csname plist@#1\endcsname{%
+ \@nameuse{#1name}\space}}
+% \end{macrocode}
+%
% \iffalse
%</package>
% \fi