From bda33c341eb25c458644341f2f5bd8e4ac9b93c8 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 24 Nov 2019 21:24:24 +0000 Subject: newfloat (24nov19) git-svn-id: svn://tug.org/texlive/trunk@52906 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/newfloat/newfloat.dtx | 2076 ++++++++++++++++++++ .../texmf-dist/source/latex/newfloat/newfloat.ins | 42 + 2 files changed, 2118 insertions(+) create mode 100644 Master/texmf-dist/source/latex/newfloat/newfloat.dtx create mode 100644 Master/texmf-dist/source/latex/newfloat/newfloat.ins (limited to 'Master/texmf-dist/source/latex/newfloat') diff --git a/Master/texmf-dist/source/latex/newfloat/newfloat.dtx b/Master/texmf-dist/source/latex/newfloat/newfloat.dtx new file mode 100644 index 00000000000..eed00a0f96b --- /dev/null +++ b/Master/texmf-dist/source/latex/newfloat/newfloat.dtx @@ -0,0 +1,2076 @@ +% \iffalse meta-comment +% +% This is file `newfloat.dtx'. +% +% Copyright (C) 2011-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) +% +% -------------------------------------------------------------------------- +% +% 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 newfloat.ins, newfloat.dtx, +% and the derived file newfloat.sty. +% +% \fi +% \CheckSum{1609} +% +% \iffalse +%<*driver> +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesFile{newfloat.drv}% + [2013/04/27 v1.1 This package offers a command for defining new floating environments] +\hbadness=9999 \newcount\hbadness \hfuzz=48pt % Make TeX shut up. +% +\documentclass{ltxdoc} +\setlength\parindent{0pt} +\setlength\parskip{\smallskipamount} +% +\usepackage{ifpdf} +\ifpdf + \usepackage{mathptmx,courier} + \usepackage[scaled=0.90]{helvet} +% \addtolength\marginparwidth{15pt} +\fi +% +\usepackage[bottom]{footmisc} +% +\usepackage{hypdoc} +\ifpdf\usepackage{hypdestopt}\fi +\hypersetup{pdfkeywords={LaTeX, package, newfloat},pdfstartpage={},pdfstartview={}} +% +\usepackage{newfloat} +% +\DeclareRobustCommand*\eTeX{\texorpdfstring + {\leavevmode\hbox{$\varepsilon$}-\TeX}% + {e-TeX}} +\DeclareRobustCommand*\AmS{\texorpdfstring + {{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}% + {AMS}} +\DeclareRobustCommand*\KOMAScript{\texorpdfstring + {\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}% + {KOMA-Script}} +\DeclareRobustCommand*\NTG{NTG} +\DeclareRobustCommand*\SmF{SMF} +% +\begin{document} + \DocInput{newfloat.dtx} +\end{document} +% +% \fi +% +% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}} +% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}} +% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}} +% \let\class\puresf \let\package\puresf +% \let\env\purett \let\opt\purett +% +% \def\thispackage{the \package{newfloat} package} +% \def\Thispackage{The \package{newfloat} package} +% +% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} +% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} +% \newcommand*\version[2][]{\textit{v#2}} +% +% \setlength\leftmargini{1.5em} +% +% \GetFileInfo{newfloat.drv} +% \let\docdate\filedate +% \let\docversion\fileversion +% \GetFileInfo{newfloat.sty} +% +% \title{\texorpdfstring{\Thispackage\thanks{%^^A +% This package has version number \docversion.}}%^^A +% {The newfloat package}} +% \author{Axel Sommerfeldt\\ +% \url{https://gitlab.com/axelsommerfeldt/newfloat}} +% \date{\docdate} +% \maketitle +% +% \begin{abstract} +% \centering +% This package offers the command +% |\Declare|\-|Floating|\-|Environment| for defining new floating environments +% which behave like |figure| and |table|. +% \end{abstract} +% +% \tableofcontents +% +% \clearpage +% \section{Loading the package} +% +% First of all you need to include this package into your document with +% \begin{quote} +% |\usepackage|\oarg{options}|{newfloat}| +% \end{quote} +% where \meta{options} are one or more of +% \begin{quote}\begin{tabular}{r@{\,}l} +% |within=| & \meta{``within'' counter} \emph{or} \texttt{none}\quad\\ +% |chapterlistsgap=| & \meta{value}~\footnotemark[1] +% \end{tabular}\end{quote} +% +% The ``within'' counter specifies the counter which will be used to reset +% the counter of the floating environments |figure| and |table| . +% (Furthermore this setting will be used as default setting for +% |\Declare|\-|Floating|\-|Environment|.) +% +% So for example |within=chapter| will give you a numbering scheme +% \meta{chapter}.\meta{x} for floating environments, +% while |within=section| will give you a numbering scheme +% \meta{chapter}.\meta{section}.\meta{x}, or \meta{section}.\meta{x} +% if the document class does not offer |\chapter|. +% |within=none| will result in a continuous numbering throughout the document, +% i.e.~the numbering scheme will be simply \meta{x}. +% +% The option |chapterlistsgap=|\meta{value} sets the amount of the +% vertical gap inserted into the ``List of Figure'', ``List of Tables'', +% and all lists created with |\Declare|\-|Floating|\-|Environment| +% when a new chapter will be started. +% The default value is |10pt|. +% (This option will only be available if the document class used offer +% the usage of chapters, e.g.~the |book| or |report| document class.) +% +% \pagebreak[3] +% Both options can be changed later on, too, by using the command +% \begin{quote} +% |\newfloatsetup|\meta{options}\quad, +% \end{quote} +% +% \pagebreak[3] +% \section{\cs{DeclareFloatingEnvironment}} +% +% After loading \thispackage\ you can define your own floating environments with +% \begin{quote} +% \iffalse +% \setlength{\leftmargin}{6cm} +% \fi +% |\DeclareFloatingEnvironment|\oarg{options}\marg{type}% +% \iffalse +% \oarg{name}\oarg{list name} +% \fi +% \end{quote} +% where \meta{options} are one or more of +% \begin{quote}\begin{tabular}{r@{\,}l} +% |fileext=| & \meta{file extension}\\ +% |listname=| & \meta{list name}\\ +% |name=| & \meta{prosa name}\\ +% |placement=| & \meta{combination of \,\purett{htbp}}\\ +% |within=| & \meta{``within'' counter} \emph{or} \texttt{none}\\ +% |chapterlistsgaps=| & \texttt{on} \emph{or} \texttt{off}~\footnotemark[1] +% \end{tabular}\end{quote} +% \footnotetext[1]{Please note that although \thispackage\ tries hard to offer this +% option it may not be available or is working incorrectly in cooperation with +% your document class since there is no standard interface which we could use +% for that purpose. Therefore we have to try to patch the \cs{chapter} command, +% and if this fails, we try to patch \cs{addtocontents} (in an unusual way) instead.} +% +% If no \meta{options} are given, +% ``lo\meta{type}'' will be used as \meta{file extension} for the list, +% ``List of \meta{name}s'' as \meta{list name}. +% ``\meta{name}'' as \meta{name} (but with the first letter capitalized), +% ``|tbp|'' as \meta{placement} specifier, +% and ``|chapter|'' resp. ``|none|'' as \meta{``within'' counter}, +% i.e., the counter which resets the numbering. +% +% The default value of the |chapterlistsgaps=| option depends on the +% ``within'' setting, it is set to |on| if |chapter| or |section| is selected, +% otherwise it is set to |off|. +% (This option will only be available if the document class used offer +% the usage of chapters, e.g.~the |book| or |report| document class.) +% +% The list will be typeset using the command |\list|\-|of|\meta{type}|s| +% resp.~|\list|\-|of|\meta{type}|es|, +% analogous to |\list|\-|of|\-|figures| and |\list|\-|of|\-|tables|. +% +% If the \package{fltpage} package is loaded, an environment called +% |FP|\meta{type} will be defined additionally, same for |sideways|\meta{type} +% (\package{rotating} package), |SC|\meta{type} (\package{sidecap} package), +% and |wrap|\meta{type} (\package{wrapfig} package). +% +% \bigskip +% +% \pagebreak[3] +% So for example +% \begin{quote} +% |\DeclareFloatingEnvironment{diagram}| +% \end{quote} +% will define a new floating environment called |diagram|, +% the list will be stored in a file with the extension |lodiagram|, the name +% (used for the caption) will be ``Diagram'' and the list name +% ``List of Diagrams''. +% The list could be typeset with |\list|\-|of|\-|diagrams|. +% Dependent on which packages are loaded, the environments |FP|\-|diagram|, +% |sideways|\-|diagram|, |SC|\-|diagram|, and |wrap|\-|diagram| will be defined additionally. +% +% \pagebreak[3] +% Another example: +% \begin{quote} +% |\DeclareFloatingEnvironment[|\\ +% | fileext=lox,|\\ +% | listname={List of Matrixes},|\\ +% | name=Matrix,|\\ +% | placement=p,|\\ +% | within=section,|\\ +% | chapterlistsgaps=off,|\\ +% | ]{matrix}| +% \end{quote} +% will define a new floating environment called |matrix| with the given settings. +% Please note that names which contain spaces needs to be enclosed in curly braces. +% +% \pagebreak[3] +% \section{\cs{SetupFloatingEnvironment}} +% +% While |\DeclareFloatingEnvironment| will create new floating environments, +% \begin{quote} +% |\SetupFloatingEnvironment|\marg{floating environment}\marg{options} +% \end{quote} +% will change the settings of existing ones, i.e. either |figure| or |table|, +% or a one created with |\Declare|\-|Floating|\-|Environment|, +% or a one created with |\new|\-|float| offered by the \package{float} package, +% or a one created with |\new|\-|float| offered by the \package{memoir} document class, +% or a one created with |\Declare|\-|New|\-|Float|\-|Type| offered by the \package{floatrow} package, +% or \ldots +% +% The \meta{options} are the same as the options for +% |\Declare|\-|Floating|\-|Environment|, +% but one should avoid changing the file extension +% of existing floating environments, +% i.e.~using the |fileext=| option within |\Setup|\-|Floating|\-|Environment| +% is usually a very bad idea. +% +% \bigskip +% +% \pagebreak[3] +% An example: +% \begin{quote} +% |\SetupFloatingEnvironment{lstlisting}{chapterlistsgaps=off}| +% \end{quote} +% will switch off the chapter lists gaps for |lstlisting| environments +% offered by the \package{listings} package. +% +% \pagebreak[3] +% \section{\cs{ForEachFloatingEnvironment}} +% +% \begin{quote} +% |\ForEachFloatingEnvironment|\marg{code with \#1} +% \end{quote} +% will execute the given \meta{code} for all known floating environments, +% and for ones defined with |\Declare|\-|Floating|\-|Environment| later on. +% +% \pagebreak[3] +% So for example the \package{subcaption} packages uses +% \begin{quote} +% |\ForEachFloatingEnvironment{\DeclareCaptionSubType{#1}}| +% \end{quote} +% for initializing itself for all floating environments which are +% known to \thispackage. +% +% \medskip +% +% There is also a starred variant |\For|\-|Each|\-|Floating|\-|Environment*| +% which will execute the given code for already existing floating environments +% only, i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|. +% +% \pagebreak[3] +% An example: +% \begin{quote} +% |\ForEachFloatingEnvironment*{\typeout{#1}}| +% \end{quote} +% will typeout the names of all already known floating environments to the terminal +% and log file. +% +% \pagebreak[3] +% \section{\cs{PrepareListOf}} +% +% Unfortunately there is no standardized way of typesetting and customizing +% lists of floating environments, i.e.~every document class offers it's own stuff here, +% and there are plenty of \LaTeXe\ packages for this purpose. +% +% \pagebreak[3] +% For that reason the \thispackage\ simply typesets the lists of newly +% defined floating environments as ``List of Figure'' internally (using |\list|\-|of|\-|figure|) +% but using a different list (the right one, of course) and using a different list name, +% the one you have specified with either |\Declare|\-|Floating|\-|Environment| or +% |\Setup|\-|Floating|\-|Environment|.\footnote{Please note that this is not the +% fact when using a \KOMAScript\ document class, not \cs{listoffigure} but \cs{listoftoc} +% will be used here, and therefore no problems should occur.} +% +% \pagebreak[3] +% While this usually results in the same layout as the ``List of Figure'' and +% is sufficient for most cases, there are some cases where this might +% lead to an unwanted side effect. +% +% \pagebreak[3] +% Therefore the \thispackage\ offers +% \begin{quote} +% |\PrepareListOf|\marg{floating environment}\marg{code} +% \end{quote} +% which will execute the given \meta{code} right before actually typesetting the list +% with |\list|\-|of|\-|figures| internally. +% +% \pagebreak[3] +% One example: +% \begin{quote} +% |\PrepareListOf{diagram}{%|\\ +% | \renewcommand{\cftfigpresnum}{Diagram~}}| +% \end{quote} +% will change the part typeset in front of the diagram number within the +% ``List of Diagrams'' when using the \package{tocloft} package~\cite{tocloft}. +% Without the code above you will get the part defined for figures instead. +% +% \pagebreak[3] +% However, when dealing with the \package{tocloft} package it's a better +% idea not to use |\Prepare|\-|List|\-|Of| but the customization facilities of that package +% instead, e.g.: +% \begin{quote} +% |\documentclass{book}|\\ +% \ldots\\ +% |\usepackage{newfloat,tocloft}|\\ +% |\newlistof{diagram}{lod}{List of Diagrams}|\\ +% |\DeclareFloatingEnvironment[name=Diagram,fileext=lod]{diagram}|\\ +% | % Note: Due of a bug in tocloft the file extension|\\ +% | % must be repeated at \DeclareFloatingEnvironment,|\\ +% | % otherwise you will get an empty list.|\\ +% ||\\ +% |% Customize `List of Figures'|\\ +% |\renewcommand{\cftfigpresnum}{Figure~}|\\ +% |\setlength{\cftfignumwidth}{2cm}|\\ +% ||\\ +% |% Customize `List of Diagrams'|\\ +% |\renewcommand{\cftdiagrampresnum}{Diagram~}|\\ +% |\setlength{\cftdiagramnumwidth}{2cm}|\\ +% ||\\ +% \ldots\\ +% ||\\ +% |\begin{document}|\\ +% \ldots\\ +% |\listoffigures|\\ +% |\listofdiagrams|\\ +% \ldots\\ +% |\end{document}| +% \end{quote} +% +% \iffalse +% \pagebreak[3] +% \section{For \LaTeX{} package authors} +% +% |\For|\-|Each|\-|Floating|\-|Environment| without \package{newfloat} package: +% \begin{quote} +% |\newcommand\mypackage@foreachfloat[1]{%|\\ +% | \@ifundefined{ForEachFloatingEnvironment}%|\\ +% | {\def\@elt##1{#1}%|\\ +% | \@ifundefined{c@figure}\@gobble\@elt{figure}%|\\ +% | \@ifundefined{c@table}\@gobble\@elt{table}%|\\ +% | \let\@elt\relax|\\ +% | \newfloat@addtohook{#1}}%|\\ +% | {\ForEachFloatingEnvironment{#1}}}|\\ +% |\providecommand\newfloat@addtohook[1]{%|\\ +% | \toks@=\expandafter{\newfloat@hook{##1}#1}%|\\ +% | \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%|\\ +% | \@tempa}|\\ +% |\providecommand*\newfloat@hook[1]{}| +% \end{quote} +% +% \pagebreak[3] +% Adding environment to list of floating environments: +% \begin{quote} +% |\SetupFloatingEnvironment|\marg{environment}|{}| +% \end{quote} +% or (without \package{newfloat} package loaded): +% \begin{quote} +% |\providecommand\newfloat@list{}|\\ +% |\@cons\newfloat@list{|\marg{environment}|}| +% \end{quote} +% (Please note the doubled curly braces around the environment name.) +% \fi +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \StopEventually{%^^A +% \pagebreak[4] +% \begin{thebibliography}{9} +% +% \bibitem{memoir} +% Peter Wilson:\\ +% \href{http://www.ctan.org/pkg/memoir}% +% {\emph{The Memoir Class for Configurable Typesetting}},\\ +% 2011/03/06 +% +% \bibitem{NTGclasses} +% Victor Eijkhout:\\ +% \href{http://www.ctan.org/pkg/ntgclass}% +% {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\ +% \mbox{3~September~1989} +% +% \bibitem{KOMAScript} +% Markus Kohm \& Jens-Uwe-Morawski:\\ +% \href{http://www.ctan.org/pkg/koma-script}% +% {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\ +% 2012-07-22 +% +% \bibitem{float} +% Anselm Lingnau:\\ +% \href{http://www.ctan.org/pkg/float}% +% {\emph{An Improved Environment for Floats}},\\ +% 2001/11/08 +% +% \bibitem{fltpage} +% Sebastian Gross:\\ +% \href{http://www.ctan.org/pkg/fltpage}% +% {\emph{Welcome to the beta test of fltpage package!}},\\ +% 1998/11/13 +% +% \bibitem{rotating} +% Sebastian Rahtz and Leonor Barroca:\\ +% \href{http://www.ctan.org/pkg/rotating}% +% {\emph{A style option for rotated objects in \LaTeX}},\\ +% 1997/09/26 +% +% \bibitem{sidecap} +% Rolf Niepraschk \& Hubert G\"a\ss lein:\\ +% \href{http://www.ctan.org/pkg/sidecap}% +% {\emph{The sidecap package}},\\ +% 2003/06/06 +% +% \bibitem{tocloft} +% Peter Wilson, Herries Press, Will Robertson:\\ +% \href{http://www.ctan.org/pkg/tocloft}% +% {\emph{The tocloft package}},\\ +% 2010/10/13 +% +% \bibitem{wrapfig} +% Donald Arseneau:\\ +% \href{http://www.ctan.org/pkg/wrapfig}% +% {\emph{WRAPFIG.STY ver 3.6}},\\ +% 2003/01/31 +% +% \end{thebibliography} +% } +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \DoNotIndex{\\,\_,\ ,\@@par} +% \DoNotIndex{\@bsphack} +% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} +% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} +% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} +% \DoNotIndex{\@gobble,\@gobbletwo,\@gobblethree,\@gobblefour,\@hangfrom} +% \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} +% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse} +% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} +% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} +% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} +% \DoNotIndex{\@testopt} +% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} +% \DoNotIndex{\p@,\z@} +% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} +% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box} +% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} +% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} +% \DoNotIndex{\fi,\footnotesize,\global} +% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} +% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} +% \DoNotIndex{\ifx,\ignorespaces,\itshape} +% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} +% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} +% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} +% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline} +% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} +% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} +% \DoNotIndex{\providecommand,\quad} +% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} +% \DoNotIndex{\rightskip,\rmfamily} +% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} +% \DoNotIndex{\small,\string,\space,\strut} +% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} +% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage} +% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip} +% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} +% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} +% \DoNotIndex{\NeedsTeXFormat,\MessageBreak} +% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} +% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \setlength{\parskip}{0pt plus 1pt} +% \changes{v1.0}{2011/10/30}{First release as \package{newfloat} package, +% 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 +% --------------------------------------------------------------------------- % +% \fi +% +% \clearpage +% \section{The Implementation} +% \iffalse +%<*package> +% \fi +% +% \pagebreak[3] +% \subsection{Identification} +% +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e}[1994/12/01] +\ProvidesPackage{newfloat}[2019/09/02 v1.1l Defining new floating environments (AR)] +% \end{macrocode} +% +% \begin{macro}{\newfloat@Info} +% \begin{macro}{\newfloat@InfoNoLine} +% |\newfloat@Info|\marg{message} +% \begin{macrocode} +\newcommand*\newfloat@Info[1]{% + \PackageInfo{newfloat}{#1}} +\newcommand*\newfloat@InfoNoLine[1]{% + \newfloat@Info{#1\@gobble}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\newfloat@Warning} +% \begin{macro}{\newfloat@WarningNoLine} +% |\newfloat@Warning|\marg{message} +% \begin{macrocode} +\newcommand*\newfloat@Warning[1]{% + \PackageWarning{newfloat}{#1}} +\newcommand*\newfloat@WarningNoLine[1]{% + \newfloat@Warning{#1\@gobble}} +% \end{macrocode} +% \end{macro} +% \end{macro} +% +% \begin{macro}{\newfloat@Error} +% |\newfloat@Error|\marg{message} +% \begin{macrocode} +\newcommand*\newfloat@Error[1]{% + \PackageError{newfloat}{#1}\newfloat@eh} +% \end{macrocode} +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{Using the keyval package} +% +% We need the \package{keyval} package for option handling, so we load it here. +% \begin{macrocode} +\RequirePackage{keyval}[1997/11/10] +% \end{macrocode} +% +% \pagebreak[3] +% \subsection{Helper macros} +% +% \begin{macro}{\newfloat@def} +% \changes{v1.1}{2013/04/27}{This macro added} +% |\newfloat@def|\marg{macro name}\marg{definition} +% \begin{macrocode} +\newcommand*\newfloat@def[2]{% + \newfloat@ifundefined{#1}{% + \@namedef{#1}{#2}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@let} +% \changes{v1.1}{2013/04/27}{This macro added} +% |\newfloat@let|\marg{macro name}\marg{macro} +% \begin{macrocode} +\newcommand*\newfloat@let[2]{% + \newfloat@ifundefined{#1}{% + \expandafter\let\csname #1\endcsname#2}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@ifundefined} +% \changes{v1.1}{2013/04/27}{This macro added} +% |\newfloat@ifundefined|\marg{macro name}\marg{code} +% \begin{macrocode} +\newcommand*\newfloat@ifundefined[2]{% + \@ifundefined{#1}{#2}{% + \newfloat@Info{% + \expandafter\string\csname#1\endcsname\space is already defined}}} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{\cs{DeclareFloatingEnvironment}} +% +% \begin{macro}{\DeclareFloatingEnvironment} +% \changes{v1.0a}{2011/11/16}{Bugfix: Undefines \cs{fst@}\meta{environment} now} +% \changes{v1.1}{2013/04/27}{Revised, only defines stuff yet undefined now} +% \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} +% \changes{v1.1k}{2019/09/01}{Adapted to the \class{beamer} document class} +% |\DeclareFloatingEnvironment|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} +% \begin{macrocode} +\newcommand*\DeclareFloatingEnvironment{% + \@testopt\@DeclareFloatingEnvironment{}} +\@onlypreamble\DeclareFloatingEnvironment +% \end{macrocode} +% \begin{macrocode} +\def\@DeclareFloatingEnvironment[#1]#2{% + \newfloat@Info{New float `#2' with options `#1'}% +% \end{macrocode} +% Define a counter with the same name as the floating environment +% \begin{macrocode} + \newfloat@ifundefined{c@#2}{\newcounter{#2}}% +% \end{macrocode} +% Set |\ftype@|\meta{type} which contains the type number for floats of type \meta{type}\par +% (See also \url{http://tex.stackexchange.com/q/32359/2574}) +% \begin{macrocode} + \@ifundefined{c@float@type}% from float package + {\@ifundefined{c@newflo@tctr}% from memoir document class + {\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}% + {\expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}% + \advance\c@newflo@tctr \c@newflo@tctr}}% + {\expandafter\edef\csname ftype@#2\endcsname{\the\value{float@type}}% + \addtocounter{float@type}{\value{float@type}}}% +% \end{macrocode} +% \begin{macrocode} + \newfloat@Info{float type `#2'=\@nameuse{ftype@#2}}% +% \end{macrocode} +% 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}% + \ifdefined\autodot\expandafter\autodot\fi}% +% \end{macrocode} +% Define |\|\meta{type}|name| used by |\fnum@|\meta{type} as \meta{type}, +% but with first letter capitalized +% \begin{macrocode} + \newfloat@capitalize\newfloat@Type{#2}% + \newfloat@let{#2name}{\newfloat@Type}% + \newfloat@def{fleg#2}{\@nameuse{#2name}}% legend naming (memoir) +% \end{macrocode} +% Legend name in ToC (memoir document class) +% \begin{macrocode} + \newfloat@ifundefined{flegtoc#2}{\@namedef{flegtoc#2}##1{}}% +% \end{macrocode} +% Define the floating environment\par +% If the \class{tufte} document class is loaded, +% |\@tufte@float| and |\end@tufte@float| will be used instead of +% |\@float|, |\end@float|, |\@dblfloat|, and |\end@dblfloat|.\par +% If the \class{beamer} document class is loaded, +% |\beamer@float| and |\end@beamer@float| will be used. +% \begin{macrocode} + \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 + \@ifclassloaded{beamer}{% + \newenvironment{#2}[1][]{\beamer@float{#2}}{\end@beamer@float}% + }{% + \newenvironment{#2}{\@float{#2}}{\end@float}% + \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% + }% + \fi +% \end{macrocode} +% Define the listing command |\listof|\meta{type}(|e|)|s| +% \changes{v1.1}{2013/04/27}{Definition of list hook added} +% \begin{macrocode} + \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}% +% \end{macrocode} +% We undefine |\fst@|\meta{environment} so the new environment +% will not be recognized as defined by the \package{float} package. +% (|\fst@|\meta{type} use to hold the float style, see \package{float} package +% implementation for details.) +% \begin{macrocode} + \expandafter\let\csname fst@#2\endcsname\@undefined +% \end{macrocode} +% Set default parameters +% \begin{macrocode} + \newfloat@ifundefined{fps@#2}{\newfloat@setplacement{#2}{tbp}}% + \newfloat@ifundefined{ext@#2}{\newfloat@setfileext{#2}{lo#2}}% +% \end{macrocode} +% Apply given options +% \begin{macrocode} + \newfloat@setoptions*{#2}{#1}% +% \end{macrocode} +% Announce the new floating environment to other packages +% \begin{macrocode} + \@expandtwoargs\newfloat@announce{#2}{\@nameuse{ext@#2}}% +% \end{macrocode} +% Apply the last two optional arguments for setting names +% \begin{macrocode} + \@ifnextchar[\newfloat@DFE@setname\relax} +\@onlypreamble\@DeclareFloatingEnvironment +% \end{macrocode} +% \begin{macrocode} +\def\newfloat@DFE@setname[#1]{% + \KV@@newfloat@name{#1}% + \@ifnextchar[\newfloat@DFE@setlistname\relax} +\@onlypreamble\newfloat@DFE@setname +% \end{macrocode} +% \begin{macrocode} +\def\newfloat@DFE@setlistname[#1]{% + \KV@@newfloat@listname{#1}} +\@onlypreamble\newfloat@DFE@setlistname +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@capitalize} +% \changes{v1.1}{2013/11/03}{Code extracted from \cs{DeclareFloatingEnvironment}} +% \changes{v1.1}{2013/11/03}{Uses \cs{newfloat@tempa} instead of \cs{@tempa} now} +% |\newfloat@capitalize|\marg{command}\marg{name}\\ +% Defines \meta{command} to \meta{name}, but with first letter capitalized. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \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]{% + \@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@[3]{% + \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#3% + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setoptions} +% |\newfloat@setoptions*|\marg{environment}\marg{options} +% \begin{macrocode} +\newcommand*\newfloat@setoptions{% + \@ifstar + {\newfloat@@setoptions\@firstofone}% + {\newfloat@@setoptions\@gobble}} +% \end{macrocode} +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@within@default} +% The default `within' value. +% This one will be used if no option |within=|\meta{counter} is given. +% \begin{macrocode} +\newcommand*\newfloat@within@default{% + \ifcsname c@chapter\endcsname chapter\else none\fi} +\@onlypreamble\newfloat@within@default +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setoption} +% \changes{v1.1}{2015/09/15}{Bugfix: \cs{@expandtwoargs} replaced by own expansion so the option value do not get expanded anymore} +% |\newfloat@setoption|\marg{option name}{options} +% \begin{macrocode} +\newcommand*\newfloat@setoption[1]{% + \edef\caption@tempa{\noexpand\@nameuse{newfloat@set#1}{\newfloat@type}}% + \caption@tempa} +% \end{macrocode} +% \end{macro} +% +% The available \meta{options} are: +% |fileext=|\meta{file extension}, +% |listname=|\meta{list name}, +% |name=|\meta{prosa name}, +% |placement=|\meta{htbp}, +% |within=|\meta{none,chapter,section}, and +% |without|. +% +% \begin{macro}{\newfloat@setfileext} +% |\newfloat@setfileext|\marg{environment}\marg{file extension} +% \begin{macrocode} +\newcommand*\newfloat@setfileext[2]{% + \@namedef{ext@#1}{#2}} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{fileext}{% + \newfloat@setoption{fileext}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setlistname} +% |\newfloat@setlistname|\marg{environment}\marg{list name} +% \begin{macrocode} +\newcommand*\newfloat@setlistname[2]{% + \@namedef{list#1name}{#2}} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{listname}{% + \newfloat@setoption{listname}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setname} +% |\newfloat@setname|\marg{environment}\marg{name} +% \begin{macrocode} +\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} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\newfloat@@setname[2]{% + \@namedef{#1name}{#2}} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{name}{% + \newfloat@setoption{name}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setplacement} +% |\newfloat@setplacement|\marg{environment}\marg{float placement} +% \begin{macrocode} +\newcommand*\newfloat@setplacement[2]{% + \@namedef{fps@#1}{#2}} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{placement}{% + \newfloat@setoption{placement}{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setwithin} +% |\newfloat@setwithin|\marg{environment}\marg{counter}\par +% setup the counter for working ``within'' a given counter. +% Furthermore the chapters lists gap will be switched on +% (if counter $=$ |chapter|) or off (otherwise). +% \begin{macrocode} +\newcommand*\newfloat@setwithin[2]{% + \ifcsname c@chapter\endcsname + \@removefromreset{#1}{chapter}% + \fi + \@removefromreset{#1}{section}% +% \end{macrocode} +% \begin{macrocode} + \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} +% \end{macrocode} +% Note: Since the \package{hyperref} package with version $<$ 6.82k defines +% |\the|\-|H|\-|figure| and |\the|\-|H|\-|table| with |\new|\-|command|, +% |\newfloat@@setwithin| will yield to an error message when using with an +% old version of \package{hyperref}, +% e.g. ``\texttt{LaTeX Error: Command \cs{theHfigure} already defined}''. +% \begin{macrocode} +\newcommand*\newfloat@@setwithin[3]{% + \global\@namedef{the#1}{#2\arabic{#1}}% + \global\@namedef{theH#1}{#3\arabic{#1}}} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{within}{% + \def\newfloat@within@value{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setwithout} +% |\newfloat@setwithout|\marg{environment} +% \begin{macrocode} +\newcommand*\newfloat@setwithout[1]{% + \newfloat@setwithin{#1}{none}} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{without}[]{% + \def\newfloat@within@value{none}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@setchapterlistsgaps} +% |\newfloat@setchapterlistsgaps|\marg{environment}\marg{on/off} +% \begin{macrocode} +\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} +% \end{macrocode} +% \begin{macrocode} +\define@key{@newfloat}{chapterlistsgaps}{% + \def\newfloat@chapterlistsgaps@value{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@removefromreset} +% This code was taken from the \package{remreset} package +% which is part of the `carlisle' package bundle. +% (Copyright 1997 David Carlisle) +% \begin{macrocode} +\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}}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@announce} +% |\newfloat@announce|\marg{environment name}\marg{list file extension} +% \begin{macrocode} +\newcommand*\newfloat@announce[2]{% +% \end{macrocode} +% \begin{macrocode} + \@cons\newfloat@list{{#1}}% + \@cons\newfloat@@list{{#1}}% +% \end{macrocode} +% \begin{macrocode} + \newfloat@ifundefined{newfloat@ext@#2}{% + \@namedef{newfloat@ext@#2}{#1}% +% \end{macrocode} +% Support of \package{memoir} document class +% \begin{macrocode} + \ifcsname c@lofdepth\endcsname + \newfloat@ifundefined{c@#2depth}{% + \newcounter{#2depth}% + \setcounter{#2depth}{1}}% + \fi +% \end{macrocode} +% Support of \package{tocbasic} package +% \begin{macrocode} + \ifcsname addtotoclist\endcsname + \addtotoclist[float]{#2}% + \newfloat@def{listof#2name}{\@nameuse{list#1name}}% + \fi +% \end{macrocode} +% \begin{macrocode} + }% +% \end{macrocode} +% Support of \package{titletoc} package +% \begin{macrocode} + \ifcsname contentsuse\endcsname + \contentsuse{#1}{#2}% + \fi +% \end{macrocode} +% \begin{macrocode} + \newfloat@hook{#1}} +\@onlypreamble\newfloat@announce +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@@list} +% |\newfloat@@list| is an \cs{@elt}-list containing the floating environments defined +% with |\Declare|\-|Floating|\-|Environment| only. +% \begin{macrocode} +\newcommand*\newfloat@@list{} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{\cs{SetupFloatingEnvironment}} +% +% \begin{macro}{\SetupFloatingEnvironment} +% |\SetupFloatingEnvironment|\marg{environment}\marg{options} +% \begin{macrocode} +\newcommand*\SetupFloatingEnvironment[1]{% + \newfloat@addtolist{#1}% + \newfloat@setoptions{#1}} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{\cs{ForEachFloatingEnvironment}} +% +% \begin{macro}{\ForEachFloatingEnvironment} +% |\ForEachFloatingEnvironment|\marg{code} +% will execute the given code for each floating 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{% + \@ifstar + {\@ForEachFloatingEnvironment\@gobble}% + {\@ForEachFloatingEnvironment\@iden}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\@ForEachFloatingEnvironment[2]{% + \def\@elt##1{#2}% + \newfloat@list + \let\@elt\relax + #1{\newfloat@addtohook{#2}}} +% \end{macrocode} +% \begin{macrocode} +\providecommand\newfloat@addtohook[1]{% + \toks@=\expandafter{\newfloat@hook{##1}#1}% + \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}% + \@tempa} +% \end{macrocode} +% \begin{macrocode} +\providecommand*\newfloat@hook[1]{} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{\cs{PrepareListOf}} +% +% \begin{macro}{\PrepareListOf} +% \changes{v1.1}{2013/04/27}{This macro added} +% |\PrepareListOf|\marg{float type}\marg{code}\\ +% adds \meta{code} to the one which prepares typesetting the list, +% just before |\listoffigures|. +% \begin{macrocode} +\newcommand\PrepareListOf[1]{% + \expandafter\g@addto@macro\csname newfloat@listof#1@hook\endcsname} +\@onlypreamble\PrepareListOf +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{The list of floating environments} +% +% \begin{macro}{\newfloat@list} +% |\newfloat@list| is an \cs{@elt}-list containing the already existising floating +% environments as well the ones defined with |\Declare|\-|Floating|\-|Environment|. +% \begin{macrocode} +\newcommand*\newfloat@list{} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@addtolist} +% \changes{v1.0b}{2012/05/18}{Bugfix: Definition of \cs{@ifchapterlistsgap@}\meta{environment} added} +% |\newfloat@addtolist|\marg{environment} +% adds an environment to the list of floating environments. +% \begin{macrocode} +\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}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\newfloat@ifinlist} +% |\newfloat@ifinlist|\marg{environment}\marg{yes code}\marg{no code} +% tests if an environment is an element of the list of floating environments. +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% +% Add |figure| and |table| to the list of floating environments. +% \begin{macrocode} +\ifcsname ext@figure\endcsname + \newfloat@addtolist{figure} +\fi +\ifcsname ext@table\endcsname + \newfloat@addtolist{table} +\fi +% \end{macrocode} +% +% \pagebreak[3] +% \subsection{Chapter lists gaps} +% +% \begin{macrocode} +\ifcsname @chapter\endcsname +% \end{macrocode} +% +% \begin{macro}{\@chapterlistsgap} +% The amount of the chapter lists gap, the default one is |10pt|. +% (This command is already defined in \KOMAScript.) +% \begin{macrocode} + \providecommand*\@chapterlistsgap{10\p@}% +% \end{macrocode} +% If the \package{dgruyter} package is loaded, the default gap is |13pt|. +% \begin{macrocode} + \@ifpackageloaded{dgruyter}{\renewcommand*\@chapterlistsgap{13\p@}}{}% +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@addchapterlistsgap} +% |\@addchapterlistsgap|\marg{float type}\marg{file extension}\par +% will add the chapter lists gap for the given float type. +% \begin{macrocode} + \providecommand*\@addchapterlistsgap[2]{% + \@nameuse{@ifchapterlistsgap@#1}{% if switched on + \@@addchapterlistsgap{#1}{#2}}} +% \end{macrocode} +% \begin{macrocode} + \providecommand*\@@addchapterlistsgap[2]{% + \@ifundefined{@addchapterlistsgap@#2}{% only once per extension + \@namedef{@addchapterlistsgap@#2}{#1}% + \@@@addchapterlistsgap{#2}}{}} +% \end{macrocode} +% \begin{macrocode} + \providecommand*\@@@addchapterlistsgap[1]{% + \ifdim \@chapterlistsgap>\z@ + \addtocontents{#1}{\protect\addvspace{\@chapterlistsgap}}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@addchapterlistsgaps} +% \changes{v1.0b}{2012/05/18}{Bugfix: Group added to make \cs{@addchapterlistsgap} work correctly} +% |\@addchapterlistsgaps|\par +% will add the chapter lists gaps for all floating environments in |\newfloat@list|. +% \begin{macrocode} + \providecommand*\@addchapterlistsgaps{% + \begingroup + \def\@elt##1{% + \@expandtwoargs\@addchapterlistsgap{##1}{\@nameuse{ext@##1}}}% + \newfloat@list + \endgroup} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@chapterlistsgap@off} +% |\@chapterlistsgap@off|\marg{float type}\par +% switches the chapter lists gap off for the given float type. +% Since \KOMAScript{} (still) supports |\float@exts| we need to handle +% this locally, too, even if |\unsettoc| is offered by the \package{tocbasic} package. +% (Otherwise our handling could be moved into the |\else| branch.) +% \begin{macrocode} + \providecommand*\@chapterlistsgap@off[1]{% + \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@gobble + \ifcsname unsettoc\endcsname + \@expandtwoargs\unsettoc{\@nameuse{ext@#1}}{chapteratlist}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{\@chapterlistsgap@on} +% |\@chapterlistsgap@off|\marg{float type}\par +% switches the chapter lists gap on for the given float type. +% \begin{macrocode} + \providecommand*\@chapterlistsgap@on[1]{% + \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@iden + \ifcsname setuptoc\endcsname + \@expandtwoargs\setuptoc{\@nameuse{ext@#1}}{chapteratlist}% + \fi} +% \end{macrocode} +% \end{macro} +% +% \begin{macrocode} +\fi +% \end{macrocode} +% +% \pagebreak[3] +% \subsection{Global options} +% +% \begin{macro}{chapterlistsgap=} +% The |chapterlistsgap=| option sets the vertical skip added to each list when +% starting a new chapter. +% \begin{macrocode} +\define@key{newfloat}{chapterlistsgap}{% + \renewcommand*\@chapterlistsgap{#1}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{within=} +% The |within=| option redefines the default value and modifies all +% existing floating environments. +% \begin{macrocode} +\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} +% \end{macrocode} +% \begin{macrocode} +\define@key{newfloat}{without}[]{% + \KV@newfloat@within{none}} +% \end{macrocode} +% \end{macro} +% +% \begin{macro}{figurename=} +% \begin{macro}{listfigurename=} +% \begin{macro}{figurewithin=} +% We define these options not only for |figure| but for all existing floating environments. +% \begin{macrocode} +\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 +% \end{macrocode} +% \end{macro} +% \end{macro} +% \end{macro} +% +% \begin{macro}{planb=} +% \changes{v1.0b}{2012/05/18}{This option added} +% This option switches the `Plan B' on or off. (default$=$true) +% \begin{macrocode} +\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} +% \end{macrocode} +% \end{macro} +% \begin{macro}{planb-filext=} +% \changes{v1.0b}{2012/05/19}{This option added} +% This option sets the file extension used for `Plan B'. +% (default$=$use the 1st one which seem to fit) +% \begin{macrocode} +\define@key{newfloat}{planb-fileext}{% + \newfloat@Info{Setting Plan B file extension to `#1'} + \xdef\newfloat@addtocontents@ext{#1}} +% \end{macrocode} +% \end{macro} +% +% Process the package options: +% We use |\setkeys| here instead of |\ProcessOptions|. +% \begin{macrocode} +\let\@tempc\relax +\@expandtwoargs\setkeys{newfloat}{planb,\@ptionlist{\@currname.\@currext}}% +\AtEndOfPackage{\let\@unprocessedoptions\relax} +% \end{macrocode} +% +% \begin{macro}{\newfloatsetup} +% |\newfloatsetup|\marg{options} +% sets global options after loading the package. +% \begin{macrocode} +\newcommand*\newfloatsetup{\setkeys{newfloat}} +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{Patching \cs{chapter}} +% +% \begin{macro}{\newfloat@replace@chapter} +% \changes{v1.1f}{2019/08/25}{Parameter \meta{class name} added to macro} +% \changes{v1.1i}{2019/08/31}{Local definition of \cs{if@chapnum} added} +% |\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[3]{% + \begingroup + \let\if@twocolumn\iffalse + \let\if@mainmatter\iffalse + \let\if@thema\iffalse + \let\if@chapnum\iffalse + \def\@tempa[##1]##2{#2}% + \ifx\@tempa\@chapter + \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 + \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\newfloat@dont@replace@chapter +\fi +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsubsection{Standard \LaTeX{} document classes} +% +% \begin{macrocode} +% report.cls [2005/09/16 v1.4f Standard LaTeX document class] +\newfloat@replace@chapter{report}{% + \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} +% \end{macrocode} +% +% \begin{macrocode} +% book.cls [2005/09/16 v1.4f Standard LaTeX document class] +\newfloat@replace@chapter{book}{% + \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} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{\AmS{} \& \SmF{} document classes} +% +% \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{amsbook}{% + \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} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{\KOMAScript{} document classes} +% +% If a \KOMAScript{} document class or the \package{tocbasic} package is used +% we don't need to patch anything. +% Instead we use |\setup|\-|toc| and |\un|\-|set|\-|toc| to setup the +% chapters gap in |\@chapter|\-|lists|\-|gap@on| and |\@chapter|\-|lists|\-|gap@off|. +% \begin{macrocode} +\@ifpackageloaded{tocbasic}{% + \let\newfloat@replace@chapter\newfloat@dont@replace@chapter}{} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{memoir document classes} +% +% If the \package{memoir} document class is used, +% replacing |\insert|\-|chapter|\-|space| by |\@add|\-|chapter|\-|lists|\-|gaps| is sufficient. +% \begin{macrocode} +\ifcsname insertchapterspace\endcsname + \renewcommand*\insertchapterspace{\@addchapterlistsgaps} + \let\newfloat@replace@chapter\newfloat@dont@replace@chapter +\fi +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{NTG document classes} +% +% \begin{macrocode} +% rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class] +\newfloat@replace@chapter{rapport}{% + \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} +% \end{macrocode} +% \begin{macrocode} +% boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class] +\newfloat@replace@chapter{boek}{% + \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} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{The thesis document class} +% +% \begin{macrocode} +% thesis.cls [1996/25/01 1.0g LaTeX document class (wm).] +\newfloat@replace@chapter{thesis}{% + \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} +% \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{The dgruyter package} +% \changes{v1.1j}{2019/08/31}{Extended support of \package{dgruyter} package added} +% +% \begin{macrocode} +% dgruyter.sty [2017/09/19 v2.00 De Gruyter layout] +\newfloat@replace@chapter{dgruyter}{% + \let\thesection\theinchapsection + \let\theequation\theinchapequation + \let\thefigure\theinchapfigure + \let\thetable\theinchaptable + \ifx\bookDOI\@undefined + \else + \@tempcnta\numexpr\componentd@i+\@ne\relax + \xdef\componentd@i{\the\@tempcnta}% + \xdef\@DOI{% + https://doi.org/\bookDOI + -\ifx\thepage\thefrontmatterpage2\else\ifnum\@tempcnta<100 0\fi\fi + \ifnum\@tempcnta<10 0\fi\componentd@i}% + \fi + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}% + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \chaptermark{#1}% + \addtocontents{lof}{\protect\addvspace{13\p@}}% + \addtocontents{lot}{\protect\addvspace{13\p@}}% + \if@twocolumn + \@topnewpage[\@makechapterhead{#2}]% + \else + \@makechapterhead{#2}% + \@afterheading + \fi +}{% + \let\thesection\theinchapsection + \let\theequation\theinchapequation + \let\thefigure\theinchapfigure + \let\thetable\theinchaptable + \ifx\bookDOI\@undefined + \else + \@tempcnta\numexpr\componentd@i+\@ne\relax + \xdef\componentd@i{\the\@tempcnta}% + \xdef\@DOI{% + https://doi.org/\bookDOI + -\ifx\thepage\thefrontmatterpage2\else\ifnum\@tempcnta<100 0\fi\fi + \ifnum\@tempcnta<10 0\fi\componentd@i}% + \fi + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \refstepcounter{chapter}% + \typeout{\@chapapp\space\thechapter.}% + \addcontentsline{toc}{chapter}{\protect\numberline{\thechapter}#1}% + \else + \addcontentsline{toc}{schapter}{#1}% + \fi + \else + \addcontentsline{toc}{schapter}{#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\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} + \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 |\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{\AtBeginDocument{% + \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}}} +% \end{macrocode} +% \begin{macrocode} +\fi +% \end{macrocode} +% +% \pagebreak[3] +% \subsection{Support of document classes} +% +% \subsubsection{The beamer document class} +% +% \begin{macro}{\beamer@float} +% \changes{v1.1k}{2019/09/01}{This macro added} +% Unfortunately the \class{beamer} document class does not offer +% |\beamer@float| and |\end@beamer@float| (yet), so we have to define them +% for ourself. +% (This code was taken from beamerbaselocalstructure.sty [2019/07/23 v3.56] and adapted.) +% \begin{macrocode} +\ifcsname beamer@float\endcsname \else +% \end{macrocode} +% \begin{macrocode} + \def\beamer@float#1{% + \ifcsname caption@settype\endcsname + \caption@settype{#1}% + \else + \def\@captype{#1}% + \fi + \par\nobreak\begin{center}\nobreak} +% \end{macrocode} +% \begin{macrocode} + \def\end@beamer@float{% + \par\nobreak\end{center}} +% \end{macrocode} +% \begin{macrocode} +\fi +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsection{Support of other packages} +% +% \begin{macro}{\newfloat@IfPackageLoaded} +% \changes{v1.1e}{2019/03/17}{This macro revised} +% \changes{v1.1h}{2019/08/31}{This macro revised again and renamed from \cs{newfloat@ForEachNew} to \cs{newfloat@IfPackageLoaded}} +% |\newfloat@IfPackageLoaded|\marg{package name}\marg{command}\marg{code} +% will execute the given code for every floating environment defined with +% |\Declare|\-|Floating|\-|Environment| if \meta{command} is not defined yet. +% (If \meta{command} is already defined a warning will be issued.) +% This will be tried |\At|\-|Begin|\-|Document| additionally so the affected package could +% be loaded after \thispackage. +% \begin{macrocode} +\newcommand\newfloat@IfPackageLoaded[3]{% + \@ifpackageloaded{#1}{% + \newfloat@@IfPackageLoaded{#1}{#2}{#3}% + }{% + \AtBeginDocument{% + \@ifpackageloaded{#1}{% + \newfloat@@IfPackageLoaded{#1}{#2}{#3}% + }{}}% + }} +\@onlypreamble\newfloat@IfPackageLoaded +% \end{macrocode} +% \begin{macrocode} +\newcommand\newfloat@@IfPackageLoaded[3]{% + \newfloat@InfoNoLine{`#1' package detected}% + % Execute code for every previous \DeclareFloatingEnvironment + \def\@elt##1{\newfloat@@@IfPackageLoaded{#1}{#2}{#3}}% + \newfloat@@list + \let\@elt\relax + % Execute code for every future \DeclareFloatingEnvironment + \newfloat@addtohook{\newfloat@@@IfPackageLoaded{#1}{#2}{#3}}} +\@onlypreamble\newfloat@@IfPackageLoaded +% \end{macrocode} +% \begin{macrocode} +\newcommand\newfloat@@@IfPackageLoaded[3]{% + \ifcsname#2\endcsname + \newfloat@WarningNoLine{% + Command \@backslashchar#2 already defined.\MessageBreak + (`#1' package support)}% + \else + #3% + \fi} +\@onlypreamble\newfloat@@@IfPackageLoaded +% \end{macrocode} +% \end{macro} +% +% \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@IfPackageLoaded{dgruyter}{plist@#1}{% + \expandafter\newcommand\csname plist@#1\endcsname{% + \@nameuse{#1name}\space}} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{\package{float}} +% +% If the \package{float} package is used we fill up |\float@exts| with our file +% extensions, too. Since this list will be used for inserting chapters gaps +% we only add the ones which are configured for chapters gaps on.\par +% Note: This has to be done |\At|\-|Begin|\-|Document| so the settings for +% chapter gaps could be changed by the user within the preamble of the document. +% \begin{macrocode} +\AtBeginDocument{% + \ifcsname float@exts\endcsname + \newfloat@@IfPackageLoaded{float}{newfloat@undefined}{% + \@nameuse{@ifchapterlistsgap@#1}{% if switched on + \let\float@do=\relax + \edef\@tempa{% + \noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#1}}}}% + \@tempa}}% + \fi} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{\package{fltpage}} +% +% We define a FP-variant of new floating environments here. +% \begin{macrocode} +\newfloat@IfPackageLoaded{fltpage}{FP#1}{% + \newcounter{FP@#1C}% + \newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}} +% \end{macrocode} +% +% \pagebreak[3] +% \subsubsection{\package{listings}} +% +% \begin{macro}{\ext@lstlisting} +% Since the \package{listings} package do not define |\ext@lst|\-|listing| +% but we needed it when |Setup|\-|Floating|\-|Environment{lst|\-|listing}{|\ldots|}| +% will be done by the end user, we define it here. +% \begin{macrocode} +\providecommand*\ext@lstlisting{lol}% +% \end{macrocode} +% \end{macro} +% +% \pagebreak[3] +% \subsubsection{\package{rotating}} +% +% We define a sideways-variant of new floating environments here. +% \begin{macrocode} +\newfloat@IfPackageLoaded{rotating}{sideways#1}{% + \newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}% + \newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}} +% \end{macrocode} +% +% \pagebreak[3] +% \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}% + \newenvironment{SC#2*}% + {\SC@dblfloat[{#1}]{#2}}{\endSC@dblfloat}} +\@onlypreamble\newfloat@For@SC +% \end{macrocode} +% \begin{macrocode} +\newfloat@IfPackageLoaded{sidecap}{SC#1}{% + \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@IfPackageLoaded{wrapfig}{wrap#1}{% + \newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}} +% \end{macrocode} +% +% \iffalse +% +% \fi +% +% \iffalse +% --------------------------------------------------------------------------- % +% \fi +% +% \Finale +% +\endinput diff --git a/Master/texmf-dist/source/latex/newfloat/newfloat.ins b/Master/texmf-dist/source/latex/newfloat/newfloat.ins new file mode 100644 index 00000000000..889504d5346 --- /dev/null +++ b/Master/texmf-dist/source/latex/newfloat/newfloat.ins @@ -0,0 +1,42 @@ +\def\batchfile{newfloat.ins} +\input docstrip + +\askforoverwritefalse +\keepsilent + +\preamble + +Copyright (C) 2011-2019 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) + +https://gitlab.com/axelsommerfeldt/newfloat + +-------------------------------------------------------------------------- + +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 newfloat.ins, newfloat.dtx, +and the derived file newfloat.sty. + +\endpreamble + +\generate{\file{newfloat.sty}{\from{newfloat.dtx}{package}}} + +\Msg{***********************************************************} +\Msg{*} +\Msg{* To finish the installation you have to move the file} +\Msg{* `newfloat.sty' into a directory searched by TeX.} +\Msg{*} +\Msg{* To produce the documentation run the file} +\Msg{* `newfloat.dtx' through LaTeX.} +\Msg{*} +\Msg{***********************************************************} -- cgit v1.2.3