| 1 |
% \iffalse meta-comment |
| 2 |
% |
| 3 |
% This is file `newfloat.dtx'. |
| 4 |
% |
| 5 |
% Copyright (C) 2011-2012 Axel Sommerfeldt ([email protected]) |
| 6 |
% |
| 7 |
% -------------------------------------------------------------------------- |
| 8 |
% |
| 9 |
% This work may be distributed and/or modified under the |
| 10 |
% conditions of the LaTeX Project Public License, either version 1.3 |
| 11 |
% of this license or (at your option) any later version. |
| 12 |
% The latest version of this license is in |
| 13 |
% http://www.latex-project.org/lppl.txt |
| 14 |
% and version 1.3 or later is part of all distributions of LaTeX |
| 15 |
% version 2003/12/01 or later. |
| 16 |
% |
| 17 |
% This work has the LPPL maintenance status "unmaintained". |
| 18 |
% |
| 19 |
% This work consists of the files caption.ins, caption.dtx, caption2.dtx, |
| 20 |
% caption3.dtx, bicaption.dtx, ltcaption.dtx, subcaption.dtx, and newfloat.dtx, |
| 21 |
% the derived files caption.sty, caption2.sty, caption3.sty, |
| 22 |
% bicaption.sty, ltcaption.sty, subcaption.sty, and newfloat.sty, |
| 23 |
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. |
| 24 |
% |
| 25 |
% \fi |
| 26 |
% \CheckSum{1291} |
| 27 |
% |
| 28 |
% \iffalse |
| 29 |
%<*driver> |
| 30 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 31 |
\ProvidesFile{newfloat.drv}% |
| 32 |
[2012/05/18 v1.0 This package offers a command for defining new floating environments] |
| 33 |
\hbadness=9999 \newcount\hbadness \hfuzz=48pt % Make TeX shut up. |
| 34 |
% |
| 35 |
\documentclass{ltxdoc} |
| 36 |
\setlength\parindent{0pt} |
| 37 |
\setlength\parskip{\smallskipamount} |
| 38 |
% |
| 39 |
\usepackage{ifpdf} |
| 40 |
\ifpdf |
| 41 |
\usepackage{mathptmx,courier} |
| 42 |
\usepackage[scaled=0.90]{helvet} |
| 43 |
% \addtolength\marginparwidth{15pt} |
| 44 |
\fi |
| 45 |
% |
| 46 |
\usepackage[bottom]{footmisc} |
| 47 |
% |
| 48 |
\usepackage{hypdoc} |
| 49 |
\ifpdf\usepackage{hypdestopt}\fi |
| 50 |
\hypersetup{pdfkeywords={LaTeX, package, newfloat},pdfstartpage={},pdfstartview={}} |
| 51 |
% |
| 52 |
\usepackage{newfloat} |
| 53 |
% |
| 54 |
\DeclareRobustCommand*\eTeX{\texorpdfstring |
| 55 |
{\leavevmode\hbox{$\varepsilon$}-\TeX}% |
| 56 |
{e-TeX}} |
| 57 |
\DeclareRobustCommand*\AmS{\texorpdfstring |
| 58 |
{{\protect\usefont{OMS}{cmsy}{m}{n}A\kern-.1667em\lower.5ex\hbox{M}\kern-.125emS}}% |
| 59 |
{AMS}} |
| 60 |
\DeclareRobustCommand*\KOMAScript{\texorpdfstring |
| 61 |
{\textsf{K\kern.05em O\kern.05em M\kern.05em A\kern.1em-\kern.1em Script}}% |
| 62 |
{KOMA-Script}} |
| 63 |
\DeclareRobustCommand*\NTG{NTG} |
| 64 |
\DeclareRobustCommand*\SmF{SMF} |
| 65 |
% |
| 66 |
\begin{document} |
| 67 |
\DocInput{newfloat.dtx} |
| 68 |
\end{document} |
| 69 |
%</driver> |
| 70 |
% \fi |
| 71 |
% |
| 72 |
% \newcommand*\purerm[1]{{\upshape\mdseries\rmfamily #1}} |
| 73 |
% \newcommand*\puresf[1]{{\upshape\mdseries\sffamily #1}} |
| 74 |
% \newcommand*\purett[1]{{\upshape\mdseries\ttfamily #1}} |
| 75 |
% \let\package\puresf |
| 76 |
% \let\env\purett \let\opt\purett |
| 77 |
% |
| 78 |
% \def\thispackage{the \package{newfloat} package} |
| 79 |
% \def\Thispackage{The \package{newfloat} package} |
| 80 |
% |
| 81 |
% \newcommand*\csmarg[1]{\texttt{\char`\{#1\char`\}}} |
| 82 |
% \newcommand*\csoarg[1]{\texttt{\char`\[#1\char`\]}} |
| 83 |
% \newcommand*\version[2][]{\textit{v#2}} |
| 84 |
% |
| 85 |
% \setlength\leftmargini{1.5em} |
| 86 |
% |
| 87 |
% \GetFileInfo{newfloat.drv} |
| 88 |
% \let\docdate\filedate |
| 89 |
% \GetFileInfo{newfloat.sty} |
| 90 |
% |
| 91 |
% \title{\texorpdfstring{\Thispackage\thanks{%^^A |
| 92 |
% This package has version number \fileversion, last revised \filedate.}}%^^A |
| 93 |
% {The newfloat package}} |
| 94 |
% \author{Axel Sommerfeldt\\ |
| 95 |
% \href{mailto:[email protected]}{\texttt{[email protected]}}} |
| 96 |
% \date{\docdate} |
| 97 |
% \maketitle |
| 98 |
% |
| 99 |
% \begin{abstract} |
| 100 |
% \centering |
| 101 |
% This package offers the command |
| 102 |
% |\Declare|\-|Floating|\-|Environment| for defining new floating environments |
| 103 |
% which behave like |figure| and |table|. |
| 104 |
% \end{abstract} |
| 105 |
% |
| 106 |
% \tableofcontents |
| 107 |
% |
| 108 |
% \clearpage |
| 109 |
% \section{Loading the package} |
| 110 |
% |
| 111 |
% First of all you need to include this package into your document with |
| 112 |
% \begin{quote} |
| 113 |
% |\usepackage|\oarg{options}|{newfloat}| |
| 114 |
% \end{quote} |
| 115 |
% where \meta{options} are one or more of |
| 116 |
% \begin{quote}\begin{tabular}{r@{\,}l} |
| 117 |
% |within=| & \meta{``within'' counter} \emph{or} \texttt{none}\quad\\ |
| 118 |
% |chapterlistsgap=| & \meta{value}~\footnotemark[1] |
| 119 |
% \end{tabular}\end{quote} |
| 120 |
% |
| 121 |
% The ``within'' counter specifies the counter which will be used to reset |
| 122 |
% the counter of the floating environments |figure| and |table| . |
| 123 |
% (Furthermore this setting will be used as default setting for |
| 124 |
% |\Declare|\-|Floating|\-|Environment|.) |
| 125 |
% |
| 126 |
% So for example |within=chapter| will give you a numbering scheme |
| 127 |
% \meta{chapter}.\meta{x} for floating environments, |
| 128 |
% while |within=section| will give you a numbering scheme |
| 129 |
% \meta{chapter}.\meta{section}.\meta{x}, or \meta{section}.\meta{x} |
| 130 |
% if the document class does not offer |\chapter|. |
| 131 |
% |within=none| will result in a continuous numbering throughout the document, |
| 132 |
% i.e.~the numbering scheme will be simply \meta{x}. |
| 133 |
% |
| 134 |
% The option |chapterlistsgap=|\meta{value} sets the amount of the |
| 135 |
% vertical gap inserted into the ``List of Figure'', ``List of Tables'', |
| 136 |
% and all lists created with |\Declare|\-|Floating|\-|Environment| |
| 137 |
% when a new chapter will be started. |
| 138 |
% The default value is |10pt|. |
| 139 |
% (This option will only be available if the document class used offer |
| 140 |
% the usage of chapters, e.g.~the |book| or |report| document class.) |
| 141 |
% |
| 142 |
% \pagebreak[3] |
| 143 |
% Both options can be changed later on, too, by using the command |
| 144 |
% \begin{quote} |
| 145 |
% |\newfloatsetup|\meta{options}\quad, |
| 146 |
% \end{quote} |
| 147 |
% |
| 148 |
% \pagebreak[3] |
| 149 |
% \section{\cs{DeclareFloatingEnvironment}} |
| 150 |
% |
| 151 |
% After loading \thispackage\ you can define your own floating environments with |
| 152 |
% \begin{quote} |
| 153 |
% \iffalse |
| 154 |
% \setlength{\leftmargin}{6cm} |
| 155 |
% \fi |
| 156 |
% |\DeclareFloatingEnvironment|\oarg{options}\marg{type}% |
| 157 |
% \iffalse |
| 158 |
% \oarg{name}\oarg{list name} |
| 159 |
% \fi |
| 160 |
% \end{quote} |
| 161 |
% where \meta{options} are one or more of |
| 162 |
% \begin{quote}\begin{tabular}{r@{\,}l} |
| 163 |
% |fileext=| & \meta{file extension}\\ |
| 164 |
% |listname=| & \meta{list name}\\ |
| 165 |
% |name=| & \meta{prosa name}\\ |
| 166 |
% |placement=| & \meta{combination of \,\purett{htbp}}\\ |
| 167 |
% |within=| & \meta{``within'' counter} \emph{or} \texttt{none}\\ |
| 168 |
% |chapterlistsgaps=| & \texttt{on} \emph{or} \texttt{off}~\footnotemark[1] |
| 169 |
% \end{tabular}\end{quote} |
| 170 |
% \footnotetext[1]{Please note that although \thispackage\ tries hard to offer this |
| 171 |
% option it may not be available or is working incorrectly in cooperation with |
| 172 |
% your document class since there is no standard interface which we could use |
| 173 |
% for that purpose. Therefore we have to try to patch the \cs{chapter} command, |
| 174 |
% and if this fails, we try to patch \cs{addtocontents} (in an unusual way) instead.} |
| 175 |
% |
| 176 |
% If no \meta{options} are given, |
| 177 |
% ``lo\meta{type}'' will be used as \meta{file extension} for the list, |
| 178 |
% ``List of \meta{name}s'' as \meta{list name}. |
| 179 |
% ``\meta{name}'' as \meta{name} (but with the first letter capitalized), |
| 180 |
% ``|tbp|'' as \meta{placement} specifier, |
| 181 |
% and ``|chapter|'' resp. ``|none|'' as \meta{``within'' counter}, |
| 182 |
% i.e., the counter which resets the numbering. |
| 183 |
% |
| 184 |
% The default value of the |chapterlistsgaps=| option depends on the |
| 185 |
% ``within'' setting, it is set to |on| if |chapter| or |section| is selected, |
| 186 |
% otherwise it is set to |off|. |
| 187 |
% (This option will only be available if the document class used offer |
| 188 |
% the usage of chapters, e.g.~the |book| or |report| document class.) |
| 189 |
% |
| 190 |
% The list will be typeset using the command |\list|\-|of|\meta{type}|s| |
| 191 |
% resp.~|\list|\-|of|\meta{type}|es|, |
| 192 |
% analogous to |\list|\-|of|\-|figures| and |\list|\-|of|\-|tables|. |
| 193 |
% |
| 194 |
% If the \package{fltpage} package is loaded, an environment called |
| 195 |
% |FP|\meta{type} will be defined additionally, same for |sideways|\meta{type} |
| 196 |
% (\package{rotating} package), |SC|\meta{type} (\package{sidecap} package), |
| 197 |
% and |wrap|\meta{type} (\package{wrapfig} package). |
| 198 |
% |
| 199 |
% \bigskip |
| 200 |
% |
| 201 |
% \pagebreak[3] |
| 202 |
% So for example |
| 203 |
% \begin{quote} |
| 204 |
% |\DeclareFloatingEnvironment{diagram}| |
| 205 |
% \end{quote} |
| 206 |
% will define a new floating environment called |diagram|, |
| 207 |
% the list will be stored in a file with the extension |lodiagram|, the name |
| 208 |
% (used for the caption) will be ``Diagram'' and the list name |
| 209 |
% ``List of Diagrams''. |
| 210 |
% The list could be typeset with |\list|\-|of|\-|diagrams|. |
| 211 |
% Dependent on which packages are loaded, the environments |FP|\-|diagram|, |
| 212 |
% |sideways|\-|diagram|, |SC|\-|diagram|, and |wrap|\-|diagram| will be defined additionally. |
| 213 |
% |
| 214 |
% \pagebreak[3] |
| 215 |
% Another example: |
| 216 |
% \begin{quote} |
| 217 |
% |\DeclareFloatingEnvironment[|\\ |
| 218 |
% | fileext=lox,|\\ |
| 219 |
% | listname={List of Matrixes},|\\ |
| 220 |
% | name=Matrix,|\\ |
| 221 |
% | placement=p,|\\ |
| 222 |
% | within=section,|\\ |
| 223 |
% | chapterlistsgaps=off,|\\ |
| 224 |
% | ]{matrix}| |
| 225 |
% \end{quote} |
| 226 |
% will define a new floating environment called |matrix| with the given settings. |
| 227 |
% Please note that names which contain spaces needs to be enclosed in curly braces. |
| 228 |
% |
| 229 |
% \pagebreak[3] |
| 230 |
% \section{\cs{SetupFloatingEnvironment}} |
| 231 |
% |
| 232 |
% While |\DeclareFloatingEnvironment| will create new floating environments, |
| 233 |
% \begin{quote} |
| 234 |
% |\SetupFloatingEnvironment|\marg{floating environment}\marg{options} |
| 235 |
% \end{quote} |
| 236 |
% will change the settings of existing ones, i.e. either |figure| or |table|, |
| 237 |
% or a one created with |\Declare|\-|Floating|\-|Environment|, |
| 238 |
% or a one created with |\new|\-|float| offered by the \package{float} package, |
| 239 |
% or a one created with |\new|\-|float| offered by the \package{memoir} document class, |
| 240 |
% or a one created with |\Declare|\-|New|\-|Float|\-|Type| offered by the \package{floatrow} package, |
| 241 |
% or \ldots |
| 242 |
% |
| 243 |
% The \meta{options} are the same as the options for |
| 244 |
% |\Declare|\-|Floating|\-|Environment|, |
| 245 |
% but one should avoid changing the file extension |
| 246 |
% of existing floating environments, |
| 247 |
% i.e.~using the |fileext=| option within |\Setup|\-|Floating|\-|Environment| |
| 248 |
% is usually a very bad idea. |
| 249 |
% |
| 250 |
% \bigskip |
| 251 |
% |
| 252 |
% \pagebreak[3] |
| 253 |
% An example: |
| 254 |
% \begin{quote} |
| 255 |
% |\SetupFloatingEnvironment{lstlisting}{chapterlistsgaps=off}| |
| 256 |
% \end{quote} |
| 257 |
% will switch off the chapter lists gaps for |lstlisting| environments |
| 258 |
% offered by the \package{listings} package. |
| 259 |
% |
| 260 |
% \pagebreak[3] |
| 261 |
% \section{\cs{ForEachFloatingEnvironment}} |
| 262 |
% |
| 263 |
% \begin{quote} |
| 264 |
% |\ForEachFloatingEnvironment|\meta{code with \#1} |
| 265 |
% \end{quote} |
| 266 |
% will execute the given \meta{code} for all known floating environments, |
| 267 |
% and for ones defined with |\Declare|\-|Floating|\-|Environment| later on. |
| 268 |
% |
| 269 |
% \pagebreak[3] |
| 270 |
% So for example the \package{subcaption} packages uses |
| 271 |
% \begin{quote} |
| 272 |
% |\ForEachFloatingEnvironment{\DeclareCaptionSubType{#1}}| |
| 273 |
% \end{quote} |
| 274 |
% for initializing itself for all floating environments which are |
| 275 |
% known to \thispackage. |
| 276 |
% |
| 277 |
% \medskip |
| 278 |
% |
| 279 |
% There is also a starred variant |\For|\-|Each|\-|Floating|\-|Environment*| |
| 280 |
% which will execute the given code for already existing floating environments |
| 281 |
% only, i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|. |
| 282 |
% |
| 283 |
% \pagebreak[3] |
| 284 |
% An example: |
| 285 |
% \begin{quote} |
| 286 |
% |\ForEachFloatingEnvironment*{\typeout{#1}}| |
| 287 |
% \end{quote} |
| 288 |
% will typeout the names of all already known floating environments to the terminal |
| 289 |
% and log file. |
| 290 |
% |
| 291 |
% \iffalse |
| 292 |
% \pagebreak[3] |
| 293 |
% \section{For \LaTeX{} package authors} |
| 294 |
% |
| 295 |
% |\For|\-|Each|\-|Floating|\-|Environment| without \package{newfloat} package: |
| 296 |
% \begin{quote} |
| 297 |
% |\newcommand\mypackage@foreachfloat[1]{%|\\ |
| 298 |
% | \@ifundefined{ForEachFloatingEnvironment}%|\\ |
| 299 |
% | {\def\@elt##1{#1}%|\\ |
| 300 |
% | \@ifundefined{c@figure}\@gobble\@elt{figure}%|\\ |
| 301 |
% | \@ifundefined{c@table}\@gobble\@elt{table}%|\\ |
| 302 |
% | \let\@elt\relax|\\ |
| 303 |
% | \newfloat@addtohook{#1}}%|\\ |
| 304 |
% | {\ForEachFloatingEnvironment{#1}}}|\\ |
| 305 |
% |\providecommand\newfloat@addtohook[1]{%|\\ |
| 306 |
% | \toks@=\expandafter{\newfloat@hook{##1}#1}%|\\ |
| 307 |
% | \edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}%|\\ |
| 308 |
% | \@tempa}|\\ |
| 309 |
% |\providecommand*\newfloat@hook[1]{}| |
| 310 |
% \end{quote} |
| 311 |
% |
| 312 |
% \pagebreak[3] |
| 313 |
% Adding environment to list of floating environments: |
| 314 |
% \begin{quote} |
| 315 |
% |\SetupFloatingEnvironment|\marg{environment}|{}| |
| 316 |
% \end{quote} |
| 317 |
% or (without \package{newfloat} package loaded): |
| 318 |
% \begin{quote} |
| 319 |
% |\providecommand\newfloat@list{}|\\ |
| 320 |
% |\@cons\newfloat@list{|\marg{environment}|}| |
| 321 |
% \end{quote} |
| 322 |
% (Please note the doubled curly braces around the environment name.) |
| 323 |
% \fi |
| 324 |
% |
| 325 |
% \iffalse |
| 326 |
% --------------------------------------------------------------------------- % |
| 327 |
% \fi |
| 328 |
% |
| 329 |
% \StopEventually{%^^A |
| 330 |
% \pagebreak[3] |
| 331 |
% \begin{thebibliography}{9} |
| 332 |
% |
| 333 |
% \bibitem{memoir} |
| 334 |
% Peter Wilson:\\ |
| 335 |
% \href{http://www.ctan.org/pkg/memoir}% |
| 336 |
% {\emph{The Memoir Class for Configurable Typesetting}},\\ |
| 337 |
% 2011/03/06 |
| 338 |
% |
| 339 |
% \bibitem{NTGclasses} |
| 340 |
% Victor Eijkhout:\\ |
| 341 |
% \href{http://www.ctan.org/pkg/ntgclass}% |
| 342 |
% {\emph{An introduction to the Dutch \LaTeX\ document classes}},\\ |
| 343 |
% \mbox{3~September~1989} |
| 344 |
% |
| 345 |
% \bibitem{KOMAScript} |
| 346 |
% Markus Kohm \& Jens-Uwe-Morawski:\\ |
| 347 |
% \href{http://www.ctan.org/pkg/koma-script}% |
| 348 |
% {\emph{KOMA-Script -- a versatile \LaTeXe\ bundle}},\\ |
| 349 |
% 2007-01-09 |
| 350 |
% |
| 351 |
% \bibitem{float} |
| 352 |
% Anselm Lingnau:\\ |
| 353 |
% \href{http://www.ctan.org/pkg/float}% |
| 354 |
% {\emph{An Improved Environment for Floats}},\\ |
| 355 |
% 2001/11/08 |
| 356 |
% |
| 357 |
% \bibitem{fltpage} |
| 358 |
% Sebastian Gross:\\ |
| 359 |
% \href{http://www.ctan.org/pkg/fltpage}% |
| 360 |
% {\emph{Welcome to the beta test of fltpage package!}},\\ |
| 361 |
% 1998/11/13 |
| 362 |
% |
| 363 |
% \bibitem{rotating} |
| 364 |
% Sebastian Rahtz and Leonor Barroca:\\ |
| 365 |
% \href{http://www.ctan.org/pkg/rotating}% |
| 366 |
% {\emph{A style option for rotated objects in \LaTeX}},\\ |
| 367 |
% 1997/09/26 |
| 368 |
% |
| 369 |
% \bibitem{sidecap} |
| 370 |
% Rolf Niepraschk \& Hubert G\"a\ss lein:\\ |
| 371 |
% \href{http://www.ctan.org/pkg/sidecap}% |
| 372 |
% {\emph{The sidecap package}},\\ |
| 373 |
% 2003/06/06 |
| 374 |
% |
| 375 |
% \bibitem{wrapfig} |
| 376 |
% Donald Arseneau:\\ |
| 377 |
% \href{http://www.ctan.org/pkg/wrapfig}% |
| 378 |
% {\emph{WRAPFIG.STY ver 3.6}},\\ |
| 379 |
% 2003/01/31 |
| 380 |
% |
| 381 |
% \end{thebibliography} |
| 382 |
% } |
| 383 |
% |
| 384 |
% \iffalse |
| 385 |
% --------------------------------------------------------------------------- % |
| 386 |
% \fi |
| 387 |
% |
| 388 |
% \DoNotIndex{\\,\_,\ ,\@@par} |
| 389 |
% \DoNotIndex{\@bsphack} |
| 390 |
% \DoNotIndex{\@car,\@cdr,\@classoptionslist,\@cons,\@currext,\@currname} |
| 391 |
% \DoNotIndex{\@ehc,\@ehd,\@empty,\@esphack,\@expandtwoargs} |
| 392 |
% \DoNotIndex{\@for,\@firstofone,\@firstoftwo} |
| 393 |
% \DoNotIndex{\@gobble,\@gobblefour,\@gobbletwo,\@hangfrom} |
| 394 |
% \DoNotIndex{\@ifnextchar,\@ifpackagelater,\@ifpackageloaded} |
| 395 |
% \DoNotIndex{\@ifstar,\@ifundefined,\@latex@error,\@namedef,\@nameuse} |
| 396 |
% \DoNotIndex{\@onlypreamble,\@parboxrestore,\@plus,\@ptionlist} |
| 397 |
% \DoNotIndex{\@removeelement,\@restorepar,\@secondoftwo,\@setpar} |
| 398 |
% \DoNotIndex{\@tempa,\@tempboxa,\@tempdima,\@tempdimb,\@tempdimc,\@tempb,\@tempc} |
| 399 |
% \DoNotIndex{\@testopt} |
| 400 |
% \DoNotIndex{\@undefined,\@unprocessedoptions,\@unusedoptionlist} |
| 401 |
% \DoNotIndex{\p@,\z@} |
| 402 |
% \DoNotIndex{\active,\addtocounter,\addtolength,\advance,\aftergroup} |
| 403 |
% \DoNotIndex{\baselineskip,\begin,\begingroup,\bfseries,\box} |
| 404 |
% \DoNotIndex{\catcode,\centering,\changes,\csname,\def,\divide,\do,\downarrow} |
| 405 |
% \DoNotIndex{\edef,\else,\empty,\end,\endcsname,\endgraf,\endgroup,\expandafter} |
| 406 |
% \DoNotIndex{\fi,\footnotesize,\global} |
| 407 |
% \DoNotIndex{\hangindent,\hbox,\hfil,\hsize,\hskip,\hspace,\hss} |
| 408 |
% \DoNotIndex{\ifcase,\ifdim,\ifnum,\ifodd,\ifvoid,\ifvmode} |
| 409 |
% \DoNotIndex{\ifx,\ignorespaces,\itshape} |
| 410 |
% \DoNotIndex{\Large,\large,\leavevmode,\leftmargini,\leftskip,\let,\linewidth} |
| 411 |
% \DoNotIndex{\llap,\long,\m@ne,\margin,\mdseries,\message} |
| 412 |
% \DoNotIndex{\newcommand,\newdimen,\newlength,\newline,\newif,\newsavebox} |
| 413 |
% \DoNotIndex{\next,\nobreak,\nobreakspace,\noexpand,\noindent,\numberline} |
| 414 |
% \DoNotIndex{\normalcolor,\normalfont,\normalsize,\or,\par,\parbox,\parfillskip} |
| 415 |
% \DoNotIndex{\parindent,\parskip,\prevdepth,\protect,\protected@edef,\protected@write} |
| 416 |
% \DoNotIndex{\providecommand,\quad} |
| 417 |
% \DoNotIndex{\raggedleft,\raggedright,\relax,\renewcommand,\RequirePackage} |
| 418 |
% \DoNotIndex{\rightskip,\rmfamily} |
| 419 |
% \DoNotIndex{\sbox,\scriptsize,\scshape,\setbox,\setlength,\sffamily,\slshape} |
| 420 |
% \DoNotIndex{\small,\string,\space,\strut} |
| 421 |
% \DoNotIndex{\textheight,\the,\toks@,\typeout,\ttfamily} |
| 422 |
% \DoNotIndex{\unvbox,\uparrow,\upshape,\usebox,\usepackage} |
| 423 |
% \DoNotIndex{\value,\vbox,\vsize,\vskip,\wd,\width,\z@skip} |
| 424 |
% \DoNotIndex{\AtBeginDocument,\AtEndOfPackage,\CurrentOption,\DeclareOption} |
| 425 |
% \DoNotIndex{\ExecuteOptions,\GenericWarning,\IfFileExists,\InputIfFileExists} |
| 426 |
% \DoNotIndex{\NeedsTeXFormat,\MessageBreak} |
| 427 |
% \DoNotIndex{\PackageError,\PackageInfo,\PackageWarning,\PackageWarningNoLine} |
| 428 |
% \DoNotIndex{\PassOptionsToPackage,\ProcessOptions,\ProvidesPackage} |
| 429 |
% |
| 430 |
% \iffalse |
| 431 |
% --------------------------------------------------------------------------- % |
| 432 |
% \fi |
| 433 |
% |
| 434 |
% \setlength{\parskip}{0pt plus 1pt} |
| 435 |
% \changes{v1.0}{2011/10/30}{First release as \package{newfloat} package, |
| 436 |
% outsourced from the \package{caption3} package and revised} |
| 437 |
% |
| 438 |
% \iffalse |
| 439 |
% --------------------------------------------------------------------------- % |
| 440 |
% \fi |
| 441 |
% |
| 442 |
% \clearpage |
| 443 |
% \section{The Implementation} |
| 444 |
% \iffalse |
| 445 |
%<*package> |
| 446 |
% \fi |
| 447 |
% |
| 448 |
% \pagebreak[3] |
| 449 |
% \subsection{Identification} |
| 450 |
% |
| 451 |
% \begin{macrocode} |
| 452 |
\NeedsTeXFormat{LaTeX2e}[1994/12/01] |
| 453 |
\ProvidesPackage{newfloat}[2012/05/19 v1.0b Defining new floating environments (AR)] |
| 454 |
% \end{macrocode} |
| 455 |
% |
| 456 |
% \begin{macro}{\newfloat@Info} |
| 457 |
% \begin{macro}{\newfloat@InfoNoLine} |
| 458 |
% |\newfloat@Info|\marg{message} |
| 459 |
% \begin{macrocode} |
| 460 |
\newcommand*\newfloat@Info[1]{% |
| 461 |
\PackageInfo{newfloat}{#1}} |
| 462 |
\newcommand*\newfloat@InfoNoLine[1]{% |
| 463 |
\newfloat@Info{#1\@gobble}} |
| 464 |
% \end{macrocode} |
| 465 |
% \end{macro} |
| 466 |
% \end{macro} |
| 467 |
% |
| 468 |
% \begin{macro}{\newfloat@Error} |
| 469 |
% |\newfloat@Error|\marg{message} |
| 470 |
% \begin{macrocode} |
| 471 |
\newcommand*\newfloat@Error[1]{% |
| 472 |
\PackageError{newfloat}{#1}\newfloat@eh} |
| 473 |
% \end{macrocode} |
| 474 |
% \begin{macrocode} |
| 475 |
\newcommand*\newfloat@eh{% |
| 476 |
If you do not understand this error, please take a closer look\MessageBreak |
| 477 |
at the documentation of the `newfloat' package.\MessageBreak\@ehc} |
| 478 |
% \end{macrocode} |
| 479 |
% \end{macro} |
| 480 |
% |
| 481 |
% \pagebreak[3] |
| 482 |
% \subsection{Using the keyval package} |
| 483 |
% |
| 484 |
% We need the \package{keyval} package for option handling, so we load it here. |
| 485 |
% \begin{macrocode} |
| 486 |
\RequirePackage{keyval}[1997/11/10] |
| 487 |
% \end{macrocode} |
| 488 |
% |
| 489 |
% \pagebreak[3] |
| 490 |
% \subsection{\cs{DeclareFloatingEnvironment}} |
| 491 |
% |
| 492 |
% \begin{macro}{\DeclareFloatingEnvironment} |
| 493 |
% \changes{v1.0a}{2011/11/16}{Bugfix: Undefines \cs{fst@}\meta{environment} now} |
| 494 |
% |\DeclareFloatingEnvironment|\oarg{options}\marg{environment}\oarg{name}\oarg{list name} |
| 495 |
% \begin{macrocode} |
| 496 |
\newcommand*\DeclareFloatingEnvironment{% |
| 497 |
\@testopt\@DeclareFloatingEnvironment{}} |
| 498 |
\@onlypreamble\DeclareFloatingEnvironment |
| 499 |
% \end{macrocode} |
| 500 |
% \begin{macrocode} |
| 501 |
\def\@DeclareFloatingEnvironment[#1]#2{% |
| 502 |
% \end{macrocode} |
| 503 |
% First of all, we set |\newfloat@Type| to the type name\par |
| 504 |
% \begin{macrocode} |
| 505 |
\newfloat@Info{New float `#2' with options `#1'}% |
| 506 |
\edef\newfloat@Type{\def\noexpand\newfloat@Type{\@car#2\@nil}}% |
| 507 |
\uppercase\expandafter{\newfloat@Type}% |
| 508 |
\edef\@tempa{% |
| 509 |
\noexpand\g@addto@macro\noexpand\newfloat@Type{\@cdr#2\@nil}}% |
| 510 |
\@tempa |
| 511 |
% \end{macrocode} |
| 512 |
% Define a counter with the same name as the floating environment |
| 513 |
% \begin{macrocode} |
| 514 |
\newcounter{#2}% |
| 515 |
% \end{macrocode} |
| 516 |
% Set |\ftype@|\meta{type} which contains the type number for floats of type \meta{type}\par |
| 517 |
% (See also \url{http://tex.stackexchange.com/q/32359/2574}) |
| 518 |
% \begin{macrocode} |
| 519 |
\ifdefined\c@float@type % from float package |
| 520 |
\expandafter\edef\csname ftype@#2\endcsname{\the\value{float@type}}% |
| 521 |
\addtocounter{float@type}{\value{float@type}}% |
| 522 |
\else\ifdefined\c@newflo@tctr % from memoir document class |
| 523 |
\expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}% |
| 524 |
\advance\c@newflo@tctr \c@newflo@tctr |
| 525 |
\else |
| 526 |
\ifdefined\newfloat@ftype \else |
| 527 |
\newcount\newfloat@ftype |
| 528 |
\newfloat@ftype=8\relax |
| 529 |
\fi |
| 530 |
\expandafter\xdef\csname ftype@#2\endcsname{\the\newfloat@ftype}% |
| 531 |
\advance\newfloat@ftype\newfloat@ftype |
| 532 |
\fi\fi |
| 533 |
\newfloat@Info{float type `#2'=\@nameuse{ftype@#2}}% |
| 534 |
% \end{macrocode} |
| 535 |
% Define |\fnum@|\meta{type}, a macro to generate the figure number for a caption |
| 536 |
% \begin{macrocode} |
| 537 |
\@namedef{fnum@#2}{\@nameuse{#2name}\nobreakspace\@nameuse{the#2}}% |
| 538 |
% \end{macrocode} |
| 539 |
% Define |\|\meta{type}|name| used by |\fnum@|\meta{type} as \meta{type}, |
| 540 |
% but with first letter capitalized |
| 541 |
% \begin{macrocode} |
| 542 |
\expandafter\newcommand\csname #2name\endcsname{}% |
| 543 |
\expandafter\let\csname #2name\endcsname\newfloat@Type |
| 544 |
\@namedef{fleg#2}{\@nameuse{#2name}}% legend naming (memoir) |
| 545 |
% \end{macrocode} |
| 546 |
% Legend name in ToC (memoir document class) |
| 547 |
% \begin{macrocode} |
| 548 |
\@namedef{flegtoc#2}##1{}% |
| 549 |
% \end{macrocode} |
| 550 |
% Define the floating environment |
| 551 |
% \begin{macrocode} |
| 552 |
\newenvironment{#2}{\@float{#2}}{\end@float}% |
| 553 |
\newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}% |
| 554 |
% \end{macrocode} |
| 555 |
% Define the listing command |\listof|\meta{type}(|e|)|s| |
| 556 |
% \begin{macrocode} |
| 557 |
\expandafter\newcommand\csname listof#2s\endcsname{\newfloat@listof{#2}}% |
| 558 |
\expandafter\newcommand\csname listof#2es\endcsname{\newfloat@listof{#2}}% |
| 559 |
\ifdefined\l@figure |
| 560 |
\expandafter\let\csname l@#2\endcsname\l@figure |
| 561 |
\else |
| 562 |
\@namedef{l@#2}{\@dottedtocline{1}{1.5em}{2.3em}}% |
| 563 |
\fi |
| 564 |
\expandafter\newcommand\csname list#2name\endcsname{}% |
| 565 |
\expandafter\xdef\csname list#2name\endcsname{List of \newfloat@Type s}% |
| 566 |
% \end{macrocode} |
| 567 |
% We undefine |\fst@|\meta{environment} so the new environment |
| 568 |
% will not be recognized as defined by the \package{float} package. |
| 569 |
% (|\fst@|\meta{type} use to hold the float style, see \package{float} package |
| 570 |
% implementation for details.) |
| 571 |
% \begin{macrocode} |
| 572 |
\expandafter\let\csname fst@#2\endcsname\@undefined |
| 573 |
% \end{macrocode} |
| 574 |
% Set default parameters |
| 575 |
% \begin{macrocode} |
| 576 |
\newfloat@setplacement{#2}{tbp}% |
| 577 |
\newfloat@setfileext{#2}{lo#2}% |
| 578 |
% \end{macrocode} |
| 579 |
% Apply given options |
| 580 |
% \begin{macrocode} |
| 581 |
\newfloat@setoptions*{#2}{#1}% |
| 582 |
% \end{macrocode} |
| 583 |
% Announce the new floating environment to other packages |
| 584 |
% \begin{macrocode} |
| 585 |
\@expandtwoargs\newfloat@announce{#2}{\@nameuse{ext@#2}}% |
| 586 |
% \end{macrocode} |
| 587 |
% Apply the last two optional arguments for setting names |
| 588 |
% \begin{macrocode} |
| 589 |
\@ifnextchar[\newfloat@DFE@setname\relax} |
| 590 |
\@onlypreamble\@DeclareFloatingEnvironment |
| 591 |
% \end{macrocode} |
| 592 |
% \begin{macrocode} |
| 593 |
\def\newfloat@DFE@setname[#1]{% |
| 594 |
\KV@@newfloat@name{#1}% |
| 595 |
\@ifnextchar[\newfloat@DFE@setlistname\relax} |
| 596 |
\@onlypreamble\newfloat@DFE@setname |
| 597 |
% \end{macrocode} |
| 598 |
% \begin{macrocode} |
| 599 |
\def\newfloat@DFE@setlistname[#1]{% |
| 600 |
\KV@@newfloat@listname{#1}} |
| 601 |
\@onlypreamble\newfloat@DFE@setlistname |
| 602 |
% \end{macrocode} |
| 603 |
% \end{macro} |
| 604 |
% |
| 605 |
% \begin{macro}{\newfloat@listof} |
| 606 |
% |\newfloat@listof|\marg{float type} typesets the list |
| 607 |
% \begin{macrocode} |
| 608 |
\newcommand*\newfloat@listof[1]{% |
| 609 |
\ifcsname listoftoc\endcsname |
| 610 |
\expandafter\listoftoc\expandafter{\@nameuse{ext@#1}}% |
| 611 |
\else |
| 612 |
\begingroup |
| 613 |
\expandafter\let\expandafter\listfigurename\csname list#1name\endcsname |
| 614 |
\expandafter\let\expandafter\ext@figure\csname ext@#1\endcsname |
| 615 |
\let\newfloat@ORI@starttoc\@starttoc |
| 616 |
\renewcommand*\@starttoc[1]{% |
| 617 |
\expandafter\newfloat@ORI@starttoc\expandafter{\ext@figure}}% |
| 618 |
\listoffigures |
| 619 |
\endgroup |
| 620 |
\fi} |
| 621 |
% \end{macrocode} |
| 622 |
% \end{macro} |
| 623 |
% |
| 624 |
% \begin{macro}{\newfloat@setoptions} |
| 625 |
% |\newfloat@setoptions*|\marg{environment}\marg{options} |
| 626 |
% \begin{macrocode} |
| 627 |
\newcommand*\newfloat@setoptions{% |
| 628 |
\@ifstar |
| 629 |
{\newfloat@@setoptions\@firstofone}% |
| 630 |
{\newfloat@@setoptions\@gobble}} |
| 631 |
% \end{macrocode} |
| 632 |
% \begin{macrocode} |
| 633 |
\newcommand*\newfloat@@setoptions[3]{% |
| 634 |
\let\newfloat@within@value\@undefined |
| 635 |
\let\newfloat@chapterlistsgaps@value\@undefined |
| 636 |
#1{\KV@@newfloat@within\newfloat@within@default}% set default value for new floats |
| 637 |
\def\newfloat@type{#2}% |
| 638 |
\setkeys{@newfloat}{#3}% |
| 639 |
\ifx\newfloat@within@value\@undefined \else |
| 640 |
\newfloat@setoption{within}\newfloat@within@value |
| 641 |
\fi |
| 642 |
\ifx\newfloat@chapterlistsgaps@value\@undefined \else |
| 643 |
\newfloat@setoption{chapterlistsgaps}\newfloat@chapterlistsgaps@value |
| 644 |
\fi} |
| 645 |
% \end{macrocode} |
| 646 |
% \end{macro} |
| 647 |
% |
| 648 |
% \begin{macro}{\newfloat@within@default} |
| 649 |
% The default `within' value. |
| 650 |
% This one will be used if no option |within=|\meta{counter} is given. |
| 651 |
% \begin{macrocode} |
| 652 |
\newcommand*\newfloat@within@default{% |
| 653 |
\ifcsname c@chapter\endcsname chapter\else none\fi} |
| 654 |
\@onlypreamble\newfloat@within@default |
| 655 |
% \end{macrocode} |
| 656 |
% \end{macro} |
| 657 |
% |
| 658 |
% \begin{macro}{\newfloat@setoption} |
| 659 |
% |\newfloat@setoption|\marg{option name}{options} |
| 660 |
% \begin{macrocode} |
| 661 |
\newcommand*\newfloat@setoption[1]{% |
| 662 |
\expandafter\@expandtwoargs\csname newfloat@set#1\endcsname\newfloat@type} |
| 663 |
% \end{macrocode} |
| 664 |
% \end{macro} |
| 665 |
% |
| 666 |
% The available \meta{options} are: |
| 667 |
% |fileext=|\meta{file extension}, |
| 668 |
% |listname=|\meta{list name}, |
| 669 |
% |name=|\meta{prosa name}, |
| 670 |
% |placement=|\meta{htbp}, |
| 671 |
% |within=|\meta{none,chapter,section}, and |
| 672 |
% |without|. |
| 673 |
% |
| 674 |
% \begin{macro}{\newfloat@setfileext} |
| 675 |
% |\newfloat@setfileext|\marg{environment}\marg{file extension} |
| 676 |
% \begin{macrocode} |
| 677 |
\newcommand*\newfloat@setfileext[2]{% |
| 678 |
\@namedef{ext@#1}{#2}} |
| 679 |
% \end{macrocode} |
| 680 |
% \begin{macrocode} |
| 681 |
\define@key{@newfloat}{fileext}{% |
| 682 |
\newfloat@setoption{fileext}{#1}} |
| 683 |
% \end{macrocode} |
| 684 |
% \end{macro} |
| 685 |
% |
| 686 |
% \begin{macro}{\newfloat@setlistname} |
| 687 |
% |\newfloat@setlistname|\marg{environment}\marg{list name} |
| 688 |
% \begin{macrocode} |
| 689 |
\newcommand*\newfloat@setlistname[2]{% |
| 690 |
\@namedef{list#1name}{#2}} |
| 691 |
% \end{macrocode} |
| 692 |
% \begin{macrocode} |
| 693 |
\define@key{@newfloat}{listname}{% |
| 694 |
\newfloat@setoption{listname}{#1}} |
| 695 |
% \end{macrocode} |
| 696 |
% \end{macro} |
| 697 |
% |
| 698 |
% \begin{macro}{\newfloat@setname} |
| 699 |
% |\newfloat@setname|\marg{environment}\marg{name} |
| 700 |
% \begin{macrocode} |
| 701 |
\newcommand*\newfloat@setname[2]{% |
| 702 |
\newfloat@@setname{#1}{#2}% |
| 703 |
\begingroup |
| 704 |
\ifcsname languagename\endcsname |
| 705 |
\ifcsname captions\languagename\endcsname |
| 706 |
\expandafter\g@addto@macro\csname captions\languagename\endcsname |
| 707 |
{\newfloat@@setname{#1}{#2}}% |
| 708 |
\fi |
| 709 |
\fi |
| 710 |
\endgroup} |
| 711 |
%%\AtBeginDocument{\let\newfloat@setname\newfloat@@setname} |
| 712 |
% \end{macrocode} |
| 713 |
% \begin{macrocode} |
| 714 |
\newcommand*\newfloat@@setname[2]{% |
| 715 |
\@namedef{#1name}{#2}} |
| 716 |
% \end{macrocode} |
| 717 |
% \begin{macrocode} |
| 718 |
\define@key{@newfloat}{name}{% |
| 719 |
\newfloat@setoption{name}{#1}} |
| 720 |
% \end{macrocode} |
| 721 |
% \end{macro} |
| 722 |
% |
| 723 |
% \begin{macro}{\newfloat@setplacement} |
| 724 |
% |\newfloat@setplacement|\marg{environment}\marg{float placement} |
| 725 |
% \begin{macrocode} |
| 726 |
\newcommand*\newfloat@setplacement[2]{% |
| 727 |
\@namedef{fps@#1}{#2}} |
| 728 |
% \end{macrocode} |
| 729 |
% \begin{macrocode} |
| 730 |
\define@key{@newfloat}{placement}{% |
| 731 |
\newfloat@setoption{placement}{#1}} |
| 732 |
% \end{macrocode} |
| 733 |
% \end{macro} |
| 734 |
% |
| 735 |
% \begin{macro}{\newfloat@setwithin} |
| 736 |
% |\newfloat@setwithin|\marg{environment}\marg{counter}\par |
| 737 |
% setup the counter for working ``within'' a given counter. |
| 738 |
% Furthermore the chapters lists gap will be switched on |
| 739 |
% (if counter $=$ |chapter|) or off (otherwise). |
| 740 |
% \begin{macrocode} |
| 741 |
\newcommand*\newfloat@setwithin[2]{% |
| 742 |
\ifcsname c@chapter\endcsname |
| 743 |
\@removefromreset{#1}{chapter}% |
| 744 |
\fi |
| 745 |
\@removefromreset{#1}{section}% |
| 746 |
% \end{macrocode} |
| 747 |
% \begin{macrocode} |
| 748 |
\edef\@tempa{#2}% |
| 749 |
\ifx\@tempa\@empty |
| 750 |
\def\@tempa{none}% |
| 751 |
\fi |
| 752 |
\def\@tempb{none}% |
| 753 |
\ifx\@tempa\@tempb |
| 754 |
\ifcsname c@chapter\endcsname |
| 755 |
\@chapterlistsgap@off{#1}% |
| 756 |
\fi |
| 757 |
\newfloat@@setwithin{#1}{}{}% |
| 758 |
\else |
| 759 |
\def\@tempb{chapter}% |
| 760 |
\ifx\@tempa\@tempb |
| 761 |
\@addtoreset{#1}{chapter}% |
| 762 |
\@chapterlistsgap@on{#1}% |
| 763 |
\newfloat@@setwithin{#1}{\ifnum\c@chapter>\z@ \thechapter.\fi}{\theHchapter.}% |
| 764 |
\else |
| 765 |
\def\@tempb{section}% |
| 766 |
\ifx\@tempa\@tempb |
| 767 |
\@addtoreset{#1}{section}% |
| 768 |
\ifcsname c@chapter\endcsname |
| 769 |
\@addtoreset{#1}{chapter}% |
| 770 |
\@chapterlistsgap@on{#1}% |
| 771 |
\newfloat@@setwithin{#1}{\thesection.}{\theHsection.}% |
| 772 |
\else |
| 773 |
\newfloat@@setwithin{#1}{\ifnum\c@section>\z@ \thesection.\fi}{\theHsection.}% |
| 774 |
\fi |
| 775 |
\else |
| 776 |
\newfloat@Error{Invalid value `#2' for option `within'}% |
| 777 |
\fi |
| 778 |
\fi |
| 779 |
\fi} |
| 780 |
% \end{macrocode} |
| 781 |
% Note: Since the \package{hyperref} package with version $<$ 6.82k defines |
| 782 |
% |\the|\-|H|\-|figure| and |\the|\-|H|\-|table| with |\new|\-|command|, |
| 783 |
% |\newfloat@@setwithin| will yield to an error message when using with an |
| 784 |
% old version of \package{hyperref}, |
| 785 |
% e.g. ``\texttt{LaTeX Error: Command \cs{theHfigure} already defined}''. |
| 786 |
% \begin{macrocode} |
| 787 |
\newcommand*\newfloat@@setwithin[3]{% |
| 788 |
\global\@namedef{the#1}{#2\arabic{#1}}% |
| 789 |
\global\@namedef{theH#1}{#3\arabic{#1}}} |
| 790 |
% \end{macrocode} |
| 791 |
% \begin{macrocode} |
| 792 |
\define@key{@newfloat}{within}{% |
| 793 |
\def\newfloat@within@value{#1}} |
| 794 |
% \end{macrocode} |
| 795 |
% \end{macro} |
| 796 |
% |
| 797 |
% \begin{macro}{\newfloat@setwithout} |
| 798 |
% |\newfloat@setwithout|\marg{environment} |
| 799 |
% \begin{macrocode} |
| 800 |
\newcommand*\newfloat@setwithout[1]{% |
| 801 |
\newfloat@setwithin{#1}{none}} |
| 802 |
% \end{macrocode} |
| 803 |
% \begin{macrocode} |
| 804 |
\define@key{@newfloat}{without}[]{% |
| 805 |
\def\newfloat@within@value{none}} |
| 806 |
% \end{macrocode} |
| 807 |
% \end{macro} |
| 808 |
% |
| 809 |
% \begin{macro}{\newfloat@setchapterlistsgaps} |
| 810 |
% |\newfloat@setchapterlistsgaps|\marg{environment}\marg{on/off} |
| 811 |
% \begin{macrocode} |
| 812 |
\newcommand*\newfloat@setchapterlistsgaps[2]{% |
| 813 |
\edef\@tempa{#2}% |
| 814 |
\def\@tempb{off}% |
| 815 |
\ifx\@tempa\@tempb |
| 816 |
\@chapterlistsgap@off{#1}% |
| 817 |
\else |
| 818 |
\def\@tempb{on}% |
| 819 |
\ifx\@tempa\@tempb |
| 820 |
\@chapterlistsgap@on{#1}% |
| 821 |
\else |
| 822 |
\newfloat@Error{Invalid value `#2' for option `chapterlistsgaps'}% |
| 823 |
\fi |
| 824 |
\fi} |
| 825 |
% \end{macrocode} |
| 826 |
% \begin{macrocode} |
| 827 |
\define@key{@newfloat}{chapterlistsgaps}{% |
| 828 |
\def\newfloat@chapterlistsgaps@value{#1}} |
| 829 |
% \end{macrocode} |
| 830 |
% \end{macro} |
| 831 |
% |
| 832 |
% \begin{macro}{\@removefromreset} |
| 833 |
% This code was taken from the \package{remreset} package |
| 834 |
% which is part of the `carlisle' package bundle. |
| 835 |
% (Copyright 1997 David Carlisle) |
| 836 |
% \begin{macrocode} |
| 837 |
\providecommand*\@removefromreset[2]{{% |
| 838 |
\expandafter\let\csname c@#1\endcsname\@removefromreset |
| 839 |
\def\@elt##1{% |
| 840 |
\expandafter\ifx\csname c@##1\endcsname\@removefromreset |
| 841 |
\else |
| 842 |
\noexpand\@elt{##1}% |
| 843 |
\fi}% |
| 844 |
\expandafter\xdef\csname cl@#2\endcsname{% |
| 845 |
\csname cl@#2\endcsname}}} |
| 846 |
% \end{macrocode} |
| 847 |
% \end{macro} |
| 848 |
% |
| 849 |
% \begin{macro}{\newfloat@announce} |
| 850 |
% |\newfloat@announce|\marg{environment name}\marg{list file extension} |
| 851 |
% \begin{macrocode} |
| 852 |
\newcommand*\newfloat@announce[2]{% |
| 853 |
% \end{macrocode} |
| 854 |
% \begin{macrocode} |
| 855 |
\@cons\newfloat@list{{#1}}% |
| 856 |
\@cons\newfloat@@list{{#1}}% |
| 857 |
% \end{macrocode} |
| 858 |
% \begin{macrocode} |
| 859 |
\@ifundefined{newfloat@ext@#2}{% |
| 860 |
\@namedef{newfloat@ext@#2}{#1}% |
| 861 |
% \end{macrocode} |
| 862 |
% Support of \package{memoir} document class |
| 863 |
% \begin{macrocode} |
| 864 |
\ifcsname c@lofdepth\endcsname |
| 865 |
\@ifundefined{c@#2depth}{% |
| 866 |
\newcounter{#2depth}% |
| 867 |
\setcounter{#2depth}{1}% |
| 868 |
}{}% |
| 869 |
\fi |
| 870 |
% \end{macrocode} |
| 871 |
% Support of \package{tocbasic} package |
| 872 |
% \begin{macrocode} |
| 873 |
\ifcsname addtotoclist\endcsname |
| 874 |
\addtotoclist[float]{#2}% |
| 875 |
\@namedef{listof#2name}{\@nameuse{list#1name}}% |
| 876 |
\fi |
| 877 |
% \end{macrocode} |
| 878 |
% \begin{macrocode} |
| 879 |
}{}% |
| 880 |
% \end{macrocode} |
| 881 |
% Support of \package{titletoc} package |
| 882 |
% \begin{macrocode} |
| 883 |
\ifcsname contentsuse\endcsname |
| 884 |
\contentsuse{#1}{#2}% |
| 885 |
\fi |
| 886 |
% \end{macrocode} |
| 887 |
% \begin{macrocode} |
| 888 |
\newfloat@hook{#1}} |
| 889 |
\@onlypreamble\newfloat@announce |
| 890 |
% \end{macrocode} |
| 891 |
% \end{macro} |
| 892 |
% |
| 893 |
% \begin{macro}{\newfloat@@list} |
| 894 |
% |\newfloat@@list| is an \cs{@elt}-list containing the floating environments defined |
| 895 |
% with |\Declare|\-|Floating|\-|Environment| only. |
| 896 |
% \begin{macrocode} |
| 897 |
\newcommand*\newfloat@@list{} |
| 898 |
% \end{macrocode} |
| 899 |
% \end{macro} |
| 900 |
% |
| 901 |
% \pagebreak[3] |
| 902 |
% \subsection{\cs{SetupFloatingEnvironment}} |
| 903 |
% |
| 904 |
% \begin{macro}{\SetupFloatingEnvironment} |
| 905 |
% |\SetupFloatingEnvironment|\marg{environment}\marg{options} |
| 906 |
% \begin{macrocode} |
| 907 |
\newcommand*\SetupFloatingEnvironment[1]{% |
| 908 |
\newfloat@addtolist{#1}% |
| 909 |
\newfloat@setoptions{#1}} |
| 910 |
% \end{macrocode} |
| 911 |
% \end{macro} |
| 912 |
% |
| 913 |
% \pagebreak[3] |
| 914 |
% \subsection{\cs{ForEachFloatingEnvironment}} |
| 915 |
% |
| 916 |
% \begin{macro}{\ForEachFloatingEnvironment} |
| 917 |
% |\ForEachFloatingEnvironment|\marg{code} |
| 918 |
% will execute the given code for each floating environment. |
| 919 |
% The starred variant will only work for already existing environment, |
| 920 |
% i.e.~no hook will be placed inside |\Declare|\-|Floating|\-|Environment|. |
| 921 |
% \begin{macrocode} |
| 922 |
\newcommand\ForEachFloatingEnvironment{% |
| 923 |
\@ifstar |
| 924 |
{\@ForEachFloatingEnvironment\@gobble}% |
| 925 |
{\@ForEachFloatingEnvironment\@iden}} |
| 926 |
% \end{macrocode} |
| 927 |
% \begin{macrocode} |
| 928 |
\newcommand\@ForEachFloatingEnvironment[2]{% |
| 929 |
\def\@elt##1{#2}% |
| 930 |
\newfloat@list |
| 931 |
\let\@elt\relax |
| 932 |
#1{\newfloat@addtohook{#2}}} |
| 933 |
% \end{macrocode} |
| 934 |
% \begin{macrocode} |
| 935 |
\providecommand\newfloat@addtohook[1]{% |
| 936 |
\toks@=\expandafter{\newfloat@hook{##1}#1}% |
| 937 |
\edef\@tempa{\def\noexpand\newfloat@hook####1{\the\toks@}}% |
| 938 |
\@tempa} |
| 939 |
% \end{macrocode} |
| 940 |
% \begin{macrocode} |
| 941 |
\providecommand*\newfloat@hook[1]{} |
| 942 |
% \end{macrocode} |
| 943 |
% \end{macro} |
| 944 |
% |
| 945 |
% \pagebreak[3] |
| 946 |
% \subsection{The list of floating environments} |
| 947 |
% |
| 948 |
% \begin{macro}{\newfloat@list} |
| 949 |
% |\newfloat@list| is an \cs{@elt}-list containing the already existising floating |
| 950 |
% environments as well the ones defined with |\Declare|\-|Floating|\-|Environment|. |
| 951 |
% \begin{macrocode} |
| 952 |
\newcommand*\newfloat@list{} |
| 953 |
% \end{macrocode} |
| 954 |
% \end{macro} |
| 955 |
% |
| 956 |
% \begin{macro}{\newfloat@addtolist} |
| 957 |
% \changes{v1.0b}{2012/05/18}{Bugfix: Definition of \cs{@ifchapterlistsgap@}\meta{environment} added} |
| 958 |
% |\newfloat@addtolist|\marg{environment} |
| 959 |
% adds an environment to the list of floating environments. |
| 960 |
% \begin{macrocode} |
| 961 |
\newcommand*\newfloat@addtolist[1]{% |
| 962 |
\newfloat@ifinlist{#1}{}{% |
| 963 |
\ifcsname ext@#1\endcsname |
| 964 |
\@cons\newfloat@list{{#1}}% |
| 965 |
\@namedef{newfloat@ext@\@nameuse{ext@#1}}{#1}% |
| 966 |
\@ifundefined{@ifchapterlistsgap@#1}{% |
| 967 |
\expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@iden}{}% |
| 968 |
\else |
| 969 |
\newfloat@Error{`#1' does not seem to be a floating environment}% |
| 970 |
\fi}} |
| 971 |
% \end{macrocode} |
| 972 |
% \end{macro} |
| 973 |
% |
| 974 |
% \begin{macro}{\newfloat@ifinlist} |
| 975 |
% |\newfloat@ifinlist|\marg{environment}\marg{yes code}\marg{no code} |
| 976 |
% tests if an environment is an element of the list of floating environments. |
| 977 |
% \begin{macrocode} |
| 978 |
\newcommand*\newfloat@ifinlist[1]{% |
| 979 |
\let\next\@secondoftwo |
| 980 |
\begingroup |
| 981 |
\expandafter\let\csname c@#1\endcsname\newfloat@ifinlist |
| 982 |
\def\@elt##1{% |
| 983 |
\expandafter\ifx\csname c@##1\endcsname\newfloat@ifinlist |
| 984 |
\global\let\next\@firstoftwo |
| 985 |
\fi}% |
| 986 |
\newfloat@list |
| 987 |
\endgroup |
| 988 |
\next} |
| 989 |
% \end{macrocode} |
| 990 |
% \end{macro} |
| 991 |
% |
| 992 |
% Add |figure| and |table| to the list of floating environments. |
| 993 |
% \begin{macrocode} |
| 994 |
\ifcsname ext@figure\endcsname |
| 995 |
\newfloat@addtolist{figure} |
| 996 |
\fi |
| 997 |
\ifcsname ext@table\endcsname |
| 998 |
\newfloat@addtolist{table} |
| 999 |
\fi |
| 1000 |
% \end{macrocode} |
| 1001 |
% |
| 1002 |
% \pagebreak[3] |
| 1003 |
% \subsection{Chapter lists gaps} |
| 1004 |
% |
| 1005 |
% \begin{macrocode} |
| 1006 |
\ifcsname @chapter\endcsname |
| 1007 |
% \end{macrocode} |
| 1008 |
% |
| 1009 |
% \begin{macro}{\@chapterlistsgap} |
| 1010 |
% The amount of the chapter lists gap, the default one is |10pt|. |
| 1011 |
% (This command is already defined in \KOMAScript.) |
| 1012 |
% \begin{macrocode} |
| 1013 |
\providecommand*\@chapterlistsgap{10\p@}% |
| 1014 |
% \end{macrocode} |
| 1015 |
% \end{macro} |
| 1016 |
% |
| 1017 |
% \begin{macro}{\@addchapterlistsgap} |
| 1018 |
% |\@addchapterlistsgap|\marg{float type}\marg{file extension}\par |
| 1019 |
% will add the chapter lists gap for the given float type. |
| 1020 |
% \begin{macrocode} |
| 1021 |
\providecommand*\@addchapterlistsgap[2]{% |
| 1022 |
\@nameuse{@ifchapterlistsgap@#1}{% if switched on |
| 1023 |
\@@addchapterlistsgap{#1}{#2}}} |
| 1024 |
% \end{macrocode} |
| 1025 |
% \begin{macrocode} |
| 1026 |
\providecommand*\@@addchapterlistsgap[2]{% |
| 1027 |
\@ifundefined{@addchapterlistsgap@#2}{% only once per extension |
| 1028 |
\@namedef{@addchapterlistsgap@#2}{#1}% |
| 1029 |
\@@@addchapterlistsgap{#2}}{}} |
| 1030 |
% \end{macrocode} |
| 1031 |
% \begin{macrocode} |
| 1032 |
\providecommand*\@@@addchapterlistsgap[1]{% |
| 1033 |
\ifdim \@chapterlistsgap>\z@ |
| 1034 |
\addtocontents{#1}{\protect\addvspace{\@chapterlistsgap}}% |
| 1035 |
\fi} |
| 1036 |
% \end{macrocode} |
| 1037 |
% \end{macro} |
| 1038 |
% |
| 1039 |
% \begin{macro}{\@addchapterlistsgaps} |
| 1040 |
% \changes{v1.0b}{2012/05/18}{Bugfix: Group added to make \cs{@addchapterlistsgap} work correctly} |
| 1041 |
% |\@addchapterlistsgaps|\par |
| 1042 |
% will add the chapter lists gaps for all floating environments in |\newfloat@list|. |
| 1043 |
% \begin{macrocode} |
| 1044 |
\providecommand*\@addchapterlistsgaps{% |
| 1045 |
\begingroup |
| 1046 |
\def\@elt##1{% |
| 1047 |
\@expandtwoargs\@addchapterlistsgap{##1}{\@nameuse{ext@##1}}}% |
| 1048 |
\newfloat@list |
| 1049 |
\endgroup} |
| 1050 |
% \end{macrocode} |
| 1051 |
% \end{macro} |
| 1052 |
% |
| 1053 |
% \begin{macro}{\@chapterlistsgap@off} |
| 1054 |
% |\@chapterlistsgap@off|\marg{float type}\par |
| 1055 |
% switches the chapter lists gap off for the given float type. |
| 1056 |
% Since \KOMAScript{} (still) supports |\float@exts| we need to handle |
| 1057 |
% this locally, too, even if |\unsettoc| is offered by the \package{tocbasic} package. |
| 1058 |
% (Otherwise our handling could be moved into the |\else| branch.) |
| 1059 |
% \begin{macrocode} |
| 1060 |
\providecommand*\@chapterlistsgap@off[1]{% |
| 1061 |
\expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@gobble |
| 1062 |
\ifcsname unsettoc\endcsname |
| 1063 |
\@expandtwoargs\unsettoc{\@nameuse{ext@#1}}{chapteratlist}% |
| 1064 |
\fi} |
| 1065 |
% \end{macrocode} |
| 1066 |
% \end{macro} |
| 1067 |
% |
| 1068 |
% \begin{macro}{\@chapterlistsgap@on} |
| 1069 |
% |\@chapterlistsgap@off|\marg{float type}\par |
| 1070 |
% switches the chapter lists gap on for the given float type. |
| 1071 |
% \begin{macrocode} |
| 1072 |
\providecommand*\@chapterlistsgap@on[1]{% |
| 1073 |
\expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@iden |
| 1074 |
\ifcsname setuptoc\endcsname |
| 1075 |
\@expandtwoargs\setuptoc{\@nameuse{ext@#1}}{chapteratlist}% |
| 1076 |
\fi} |
| 1077 |
% \end{macrocode} |
| 1078 |
% \end{macro} |
| 1079 |
% |
| 1080 |
% \begin{macrocode} |
| 1081 |
\fi |
| 1082 |
% \end{macrocode} |
| 1083 |
% |
| 1084 |
% \pagebreak[3] |
| 1085 |
% \subsection{Global options} |
| 1086 |
% |
| 1087 |
% \begin{macro}{chapterlistsgap=} |
| 1088 |
% The |chapterlistsgap=| option sets the vertical skip added to each list when |
| 1089 |
% starting a new chapter. |
| 1090 |
% \begin{macrocode} |
| 1091 |
\define@key{newfloat}{chapterlistsgap}{% |
| 1092 |
\renewcommand*\@chapterlistsgap{#1}} |
| 1093 |
% \end{macrocode} |
| 1094 |
% \end{macro} |
| 1095 |
% |
| 1096 |
% \begin{macro}{within=} |
| 1097 |
% The |within=| option redefines the default value and modifies all |
| 1098 |
% existing floating environments. |
| 1099 |
% \begin{macrocode} |
| 1100 |
\define@key{newfloat}{within}{% |
| 1101 |
\def\newfloat@within@default{#1}% set new default value |
| 1102 |
\def\@elt##1{\newfloat@setwithin{##1}{#1}}% |
| 1103 |
\newfloat@list |
| 1104 |
\let\@elt\relax} |
| 1105 |
% \end{macrocode} |
| 1106 |
% \begin{macrocode} |
| 1107 |
\define@key{newfloat}{without}[]{% |
| 1108 |
\KV@newfloat@within{none}} |
| 1109 |
% \end{macrocode} |
| 1110 |
% \end{macro} |
| 1111 |
% |
| 1112 |
% \begin{macro}{figurename=} |
| 1113 |
% \begin{macro}{listfigurename=} |
| 1114 |
% \begin{macro}{figurewithin=} |
| 1115 |
% We define these options not only for |figure| but for all existing floating environments. |
| 1116 |
% \begin{macrocode} |
| 1117 |
\def\@elt#1{% |
| 1118 |
\define@key{newfloat}{#1name}{% |
| 1119 |
\newfloat@setname{#1}{##1}}% |
| 1120 |
\define@key{newfloat}{list#1name}{% |
| 1121 |
\newfloat@setname{list#1}{##1}}% |
| 1122 |
\define@key{newfloat}{#1within}{% |
| 1123 |
\newfloat@setwithin{#1}{##1}}% |
| 1124 |
\define@key{newfloat}{#1without}[]{% |
| 1125 |
\newfloat@setwithout{#1}}% |
| 1126 |
}% |
| 1127 |
\newfloat@list |
| 1128 |
\let\@elt\relax |
| 1129 |
% \end{macrocode} |
| 1130 |
% \end{macro} |
| 1131 |
% \end{macro} |
| 1132 |
% \end{macro} |
| 1133 |
% |
| 1134 |
% \begin{macro}{planb=} |
| 1135 |
% \changes{v1.0b}{2012/05/18}{This option added} |
| 1136 |
% This option switches the `Plan B' on or off. (default$=$off) |
| 1137 |
% \begin{macrocode} |
| 1138 |
\define@key{newfloat}{planb}[true]{% |
| 1139 |
\def\@tempa{#1}% |
| 1140 |
\def\@tempb{false}% |
| 1141 |
\ifx\@tempa\@tempb |
| 1142 |
\let\newfloat@ifplanb\@gobble |
| 1143 |
\else |
| 1144 |
\def\@tempb{true}% |
| 1145 |
\ifx\@tempa\@tempb |
| 1146 |
\let\newfloat@ifplanb\@iden |
| 1147 |
\else |
| 1148 |
\newfloat@Error{Invalid value `#1' for option `planb'}% |
| 1149 |
\fi |
| 1150 |
\fi} |
| 1151 |
% \end{macrocode} |
| 1152 |
% \end{macro} |
| 1153 |
% \begin{macro}{planb-filext=} |
| 1154 |
% \changes{v1.0b}{2012/05/19}{This option added} |
| 1155 |
% This option sets the file extension used for `Plan B'. |
| 1156 |
% (default$=$use the 1st one which seem to fit) |
| 1157 |
% \begin{macrocode} |
| 1158 |
\define@key{newfloat}{planb-fileext}{% |
| 1159 |
\newfloat@Info{Setting Plan B file extension to `#1'} |
| 1160 |
\xdef\newfloat@addtocontents@ext{#1}} |
| 1161 |
% \end{macrocode} |
| 1162 |
% \end{macro} |
| 1163 |
|
| 1164 |
% |
| 1165 |
% Process the package options: |
| 1166 |
% We use |\setkeys| here instead of |\ProcessOptions|. |
| 1167 |
% \begin{macrocode} |
| 1168 |
\let\@tempc\relax |
| 1169 |
\@expandtwoargs\setkeys{newfloat}{planb,\@ptionlist{\@currname.\@currext}}% |
| 1170 |
\AtEndOfPackage{\let\@unprocessedoptions\relax} |
| 1171 |
% \end{macrocode} |
| 1172 |
% |
| 1173 |
% \begin{macro}{\newfloatsetup} |
| 1174 |
% |\newfloatsetup|\marg{options} |
| 1175 |
% sets global options after loading the package. |
| 1176 |
% \begin{macrocode} |
| 1177 |
\newcommand*\newfloatsetup{\setkeys{newfloat}} |
| 1178 |
% \end{macrocode} |
| 1179 |
% \end{macro} |
| 1180 |
% |
| 1181 |
% \pagebreak[3] |
| 1182 |
% \subsection{Patching \cs{chapter}} |
| 1183 |
% |
| 1184 |
% \begin{macro}{\newfloat@replace@chapter} |
| 1185 |
% |\newfloat@replace@chapter|\marg{original code}\marg{replacement code}\par |
| 1186 |
% tries to patch |\@chapter| so |\@add|\-|chapter|\-|lists|\-|gaps| will be supported. |
| 1187 |
% It checks for |\Hy@org@chapter|, too, since the original code will be stored here |
| 1188 |
% if the \package{hyperref} package was loaded. |
| 1189 |
% \begin{macrocode} |
| 1190 |
\newcommand\newfloat@replace@chapter[2]{% |
| 1191 |
\begingroup |
| 1192 |
\let\if@twocolumn\iffalse |
| 1193 |
\let\if@mainmatter\iffalse |
| 1194 |
\let\if@thema\iffalse |
| 1195 |
\def\@tempa[##1]##2{#1}% |
| 1196 |
\ifx\@tempa\@chapter |
| 1197 |
\gdef\@chapter[##1]##2{#2}% |
| 1198 |
\global\let\newfloat@replace@chapter\@gobbletwo |
| 1199 |
\else\ifx\@tempa\Hy@org@chapter |
| 1200 |
\gdef\Hy@org@chapter[##1]##2{#2}% |
| 1201 |
\global\let\newfloat@replace@chapter\@gobbletwo |
| 1202 |
\fi\fi |
| 1203 |
\endgroup} |
| 1204 |
% \end{macrocode} |
| 1205 |
% \begin{macrocode} |
| 1206 |
\ifcsname @chapter\endcsname \else |
| 1207 |
\let\newfloat@replace@chapter\@gobbletwo |
| 1208 |
\fi |
| 1209 |
% \end{macrocode} |
| 1210 |
% \end{macro} |
| 1211 |
% |
| 1212 |
% \pagebreak[3] |
| 1213 |
% \subsubsection{Standard \LaTeX{} document classes} |
| 1214 |
% |
| 1215 |
% \begin{macrocode} |
| 1216 |
% report.cls [2005/09/16 v1.4f Standard LaTeX document class] |
| 1217 |
\newfloat@replace@chapter{% |
| 1218 |
\ifnum \c@secnumdepth >\m@ne |
| 1219 |
\refstepcounter{chapter}% |
| 1220 |
\typeout{\@chapapp\space\thechapter.}% |
| 1221 |
\addcontentsline{toc}{chapter}% |
| 1222 |
{\protect\numberline{\thechapter}#1}% |
| 1223 |
\else |
| 1224 |
\addcontentsline{toc}{chapter}{#1}% |
| 1225 |
\fi |
| 1226 |
\chaptermark{#1}% |
| 1227 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1228 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1229 |
\if@twocolumn |
| 1230 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1231 |
\else |
| 1232 |
\@makechapterhead{#2}% |
| 1233 |
\@afterheading |
| 1234 |
\fi |
| 1235 |
}{% |
| 1236 |
\ifnum \c@secnumdepth >\m@ne |
| 1237 |
\refstepcounter{chapter}% |
| 1238 |
\typeout{\@chapapp\space\thechapter.}% |
| 1239 |
\addcontentsline{toc}{chapter}% |
| 1240 |
{\protect\numberline{\thechapter}#1}% |
| 1241 |
\else |
| 1242 |
\addcontentsline{toc}{chapter}{#1}% |
| 1243 |
\fi |
| 1244 |
\chaptermark{#1}% |
| 1245 |
\@addchapterlistsgaps |
| 1246 |
\if@twocolumn |
| 1247 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1248 |
\else |
| 1249 |
\@makechapterhead{#2}% |
| 1250 |
\@afterheading |
| 1251 |
\fi} |
| 1252 |
% \end{macrocode} |
| 1253 |
% |
| 1254 |
% \begin{macrocode} |
| 1255 |
% book.cls [2005/09/16 v1.4f Standard LaTeX document class] |
| 1256 |
\newfloat@replace@chapter{% |
| 1257 |
\ifnum \c@secnumdepth >\m@ne |
| 1258 |
\if@mainmatter |
| 1259 |
\refstepcounter{chapter}% |
| 1260 |
\typeout{\@chapapp\space\thechapter.}% |
| 1261 |
\addcontentsline{toc}{chapter}% |
| 1262 |
{\protect\numberline{\thechapter}#1}% |
| 1263 |
\else |
| 1264 |
\addcontentsline{toc}{chapter}{#1}% |
| 1265 |
\fi |
| 1266 |
\else |
| 1267 |
\addcontentsline{toc}{chapter}{#1}% |
| 1268 |
\fi |
| 1269 |
\chaptermark{#1}% |
| 1270 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1271 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1272 |
\if@twocolumn |
| 1273 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1274 |
\else |
| 1275 |
\@makechapterhead{#2}% |
| 1276 |
\@afterheading |
| 1277 |
\fi |
| 1278 |
}{% |
| 1279 |
\ifnum \c@secnumdepth >\m@ne |
| 1280 |
\if@mainmatter |
| 1281 |
\refstepcounter{chapter}% |
| 1282 |
\typeout{\@chapapp\space\thechapter.}% |
| 1283 |
\addcontentsline{toc}{chapter}% |
| 1284 |
{\protect\numberline{\thechapter}#1}% |
| 1285 |
\else |
| 1286 |
\addcontentsline{toc}{chapter}{#1}% |
| 1287 |
\fi |
| 1288 |
\else |
| 1289 |
\addcontentsline{toc}{chapter}{#1}% |
| 1290 |
\fi |
| 1291 |
\chaptermark{#1}% |
| 1292 |
\@addchapterlistsgaps |
| 1293 |
\if@twocolumn |
| 1294 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1295 |
\else |
| 1296 |
\@makechapterhead{#2}% |
| 1297 |
\@afterheading |
| 1298 |
\fi} |
| 1299 |
% \end{macrocode} |
| 1300 |
% |
| 1301 |
% \pagebreak[3] |
| 1302 |
% \subsubsection{\AmS{} \& \SmF{} document classes} |
| 1303 |
% |
| 1304 |
% \begin{macrocode} |
| 1305 |
% amsbook.cls [2004/08/06 v2.20] |
| 1306 |
% smfbook.cls [1999/11/15 v1.2f Classe LaTeX pour les monographies editees par la SMF] |
| 1307 |
\newfloat@replace@chapter{% |
| 1308 |
\refstepcounter{chapter}% |
| 1309 |
\ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty |
| 1310 |
\else \let\@secnumber\thechapter \fi |
| 1311 |
\typeout{\chaptername\space\@secnumber}% |
| 1312 |
\def\@toclevel{0}% |
| 1313 |
\ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}% |
| 1314 |
\else \@tocwriteb\tocchapter{chapter}{#2}\fi |
| 1315 |
\chaptermark{#1}% |
| 1316 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1317 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1318 |
\@makechapterhead{#2}\@afterheading |
| 1319 |
}{% |
| 1320 |
\refstepcounter{chapter}% |
| 1321 |
\ifnum\c@secnumdepth<\z@ \let\@secnumber\@empty |
| 1322 |
\else \let\@secnumber\thechapter \fi |
| 1323 |
\typeout{\chaptername\space\@secnumber}% |
| 1324 |
\def\@toclevel{0}% |
| 1325 |
\ifx\chaptername\appendixname \@tocwriteb\tocappendix{chapter}{#2}% |
| 1326 |
\else \@tocwriteb\tocchapter{chapter}{#2}\fi |
| 1327 |
\chaptermark{#1}% |
| 1328 |
\@addchapterlistsgaps |
| 1329 |
\@makechapterhead{#2}\@afterheading} |
| 1330 |
% \end{macrocode} |
| 1331 |
% |
| 1332 |
% \pagebreak[3] |
| 1333 |
% \subsubsection{\KOMAScript{} document classes} |
| 1334 |
% |
| 1335 |
% If a \KOMAScript{} document class or the \package{tocbasic} package is used |
| 1336 |
% we don't need to patch anything. |
| 1337 |
% Instead we use |\setup|\-|toc| and |\un|\-|set|\-|toc| to setup the |
| 1338 |
% chapters gap in |\@chapter|\-|lists|\-|gap@on| and |\@chapter|\-|lists|\-|gap@off|. |
| 1339 |
% \begin{macrocode} |
| 1340 |
\@ifpackageloaded{tocbasic}{% |
| 1341 |
\let\newfloat@replace@chapter\@gobbletwo}{} |
| 1342 |
% \end{macrocode} |
| 1343 |
% |
| 1344 |
% \pagebreak[3] |
| 1345 |
% \subsubsection{memoir document classes} |
| 1346 |
% |
| 1347 |
% If the \package{memoir} document class is used, |
| 1348 |
% replacing |\insert|\-|chapter|\-|space| by |\@add|\-|chapter|\-|lists|\-|gaps| is sufficient. |
| 1349 |
% \begin{macrocode} |
| 1350 |
\ifcsname insertchapterspace\endcsname |
| 1351 |
\renewcommand*\insertchapterspace{\@addchapterlistsgaps} |
| 1352 |
\let\newfloat@replace@chapter\@gobbletwo |
| 1353 |
\fi |
| 1354 |
% \end{macrocode} |
| 1355 |
% |
| 1356 |
% \pagebreak[3] |
| 1357 |
% \subsubsection{NTG document classes} |
| 1358 |
% |
| 1359 |
% \begin{macrocode} |
| 1360 |
% rapport1/3.cls [2004/06/07 v2.1a NTG LaTeX document class] |
| 1361 |
\newfloat@replace@chapter{% |
| 1362 |
\ifnum \c@secnumdepth >\m@ne |
| 1363 |
\refstepcounter{chapter}% |
| 1364 |
\typeout{\@chapapp\space\thechapter.}% |
| 1365 |
\addcontentsline{toc}{chapter}% |
| 1366 |
{\protect\numberline{\thechapter}\toc@font0 #1}% |
| 1367 |
\else |
| 1368 |
\addcontentsline{toc}{chapter}{\toc@font0 #1}% |
| 1369 |
\fi |
| 1370 |
\chaptermark{#1}% |
| 1371 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1372 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1373 |
\if@twocolumn |
| 1374 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1375 |
\else |
| 1376 |
\@makechapterhead{#2}% |
| 1377 |
\@afterheading |
| 1378 |
\fi |
| 1379 |
}{% |
| 1380 |
\ifnum \c@secnumdepth >\m@ne |
| 1381 |
\refstepcounter{chapter}% |
| 1382 |
\typeout{\@chapapp\space\thechapter.}% |
| 1383 |
\addcontentsline{toc}{chapter}% |
| 1384 |
{\protect\numberline{\thechapter}\toc@font0 #1}% |
| 1385 |
\else |
| 1386 |
\addcontentsline{toc}{chapter}{\toc@font0 #1}% |
| 1387 |
\fi |
| 1388 |
\chaptermark{#1}% |
| 1389 |
\@addchapterlistsgaps |
| 1390 |
\if@twocolumn |
| 1391 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1392 |
\else |
| 1393 |
\@makechapterhead{#2}% |
| 1394 |
\@afterheading |
| 1395 |
\fi} |
| 1396 |
% \end{macrocode} |
| 1397 |
% \begin{macrocode} |
| 1398 |
% boek(3).cls [2004/06/07 v2.1a NTG LaTeX document class] |
| 1399 |
\newfloat@replace@chapter{% |
| 1400 |
\ifnum \c@secnumdepth >\m@ne |
| 1401 |
\if@mainmatter |
| 1402 |
\refstepcounter{chapter}% |
| 1403 |
\typeout{\@chapapp\space\thechapter.}% |
| 1404 |
\addcontentsline{toc}{chapter}% |
| 1405 |
{\protect\numberline{\thechapter}\toc@font0 #1}% |
| 1406 |
\else |
| 1407 |
\addcontentsline{toc}{chapter}{\toc@font0 #1}% |
| 1408 |
\fi |
| 1409 |
\else |
| 1410 |
\addcontentsline{toc}{chapter}{\toc@font0 #1}% |
| 1411 |
\fi |
| 1412 |
\chaptermark{#1}% |
| 1413 |
\addtocontents{lof}{\protect\addvspace{10\p@}}% |
| 1414 |
\addtocontents{lot}{\protect\addvspace{10\p@}}% |
| 1415 |
\if@twocolumn |
| 1416 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1417 |
\else |
| 1418 |
\@makechapterhead{#2}% |
| 1419 |
\@afterheading |
| 1420 |
\fi |
| 1421 |
}{% |
| 1422 |
\ifnum \c@secnumdepth >\m@ne |
| 1423 |
\if@mainmatter |
| 1424 |
\refstepcounter{chapter}% |
| 1425 |
\typeout{\@chapapp\space\thechapter.}% |
| 1426 |
\addcontentsline{toc}{chapter}% |
| 1427 |
{\protect\numberline{\thechapter}\toc@font0 #1}% |
| 1428 |
\else |
| 1429 |
\addcontentsline{toc}{chapter}{\toc@font0 #1}% |
| 1430 |
\fi |
| 1431 |
\else |
| 1432 |
\addcontentsline{toc}{chapter}{\toc@font0 #1}% |
| 1433 |
\fi |
| 1434 |
\chaptermark{#1}% |
| 1435 |
\@addchapterlistsgaps |
| 1436 |
\if@twocolumn |
| 1437 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1438 |
\else |
| 1439 |
\@makechapterhead{#2}% |
| 1440 |
\@afterheading |
| 1441 |
\fi} |
| 1442 |
% \end{macrocode} |
| 1443 |
% |
| 1444 |
% \pagebreak[3] |
| 1445 |
% \subsubsection{The thesis document class} |
| 1446 |
% |
| 1447 |
% \begin{macrocode} |
| 1448 |
% thesis.cls [1996/25/01 1.0g LaTeX document class (wm).] |
| 1449 |
\newfloat@replace@chapter{% |
| 1450 |
\ifnum \c@secnumdepth >\m@ne |
| 1451 |
\if@mainmatter |
| 1452 |
\refstepcounter{chapter}% |
| 1453 |
\typeout{\chaptername\space\thechapter.} |
| 1454 |
\if@thema |
| 1455 |
\ifx\@shortauthor\@empty |
| 1456 |
\addcontentsline{toc}{chapter}{% |
| 1457 |
\protect\numberline{\thechapter.}#1}% |
| 1458 |
\else |
| 1459 |
\addcontentsline{toc}{chapter}{% |
| 1460 |
\protect\numberline{\thechapter.}% |
| 1461 |
\@shortauthor\hfill\mbox{}\vskip\normallineskip #1}% |
| 1462 |
\fi |
| 1463 |
\else |
| 1464 |
\addcontentsline{toc}{chapter}{% |
| 1465 |
\protect\numberline{\thechapter.}#1}% |
| 1466 |
\fi |
| 1467 |
\else |
| 1468 |
\addcontentsline{toc}{chapter}{#1} |
| 1469 |
\fi |
| 1470 |
\else |
| 1471 |
\addcontentsline{toc}{chapter}{#1} |
| 1472 |
\fi |
| 1473 |
\chaptermark{#1} |
| 1474 |
\addtocontents{lof}{\protect\addvspace{10pt}} |
| 1475 |
\addtocontents{lot}{\protect\addvspace{10pt}} |
| 1476 |
\if@twocolumn |
| 1477 |
\@topnewpage[\@makechapterhead{#2}] |
| 1478 |
\else |
| 1479 |
\@makechapterhead{#2} |
| 1480 |
\@afterheading |
| 1481 |
\fi |
| 1482 |
}{% |
| 1483 |
\ifnum \c@secnumdepth >\m@ne |
| 1484 |
\if@mainmatter |
| 1485 |
\refstepcounter{chapter}% |
| 1486 |
\typeout{\chaptername\space\thechapter.}% |
| 1487 |
\if@thema |
| 1488 |
\ifx\@shortauthor\@empty |
| 1489 |
\addcontentsline{toc}{chapter}{% |
| 1490 |
\protect\numberline{\thechapter.}#1}% |
| 1491 |
\else |
| 1492 |
\addcontentsline{toc}{chapter}{% |
| 1493 |
\protect\numberline{\thechapter.}% |
| 1494 |
\@shortauthor\hfill\mbox{}\vskip\normallineskip #1}% |
| 1495 |
\fi |
| 1496 |
\else |
| 1497 |
\addcontentsline{toc}{chapter}{% |
| 1498 |
\protect\numberline{\thechapter.}#1}% |
| 1499 |
\fi |
| 1500 |
\else |
| 1501 |
\addcontentsline{toc}{chapter}{#1}% |
| 1502 |
\fi |
| 1503 |
\else |
| 1504 |
\addcontentsline{toc}{chapter}{#1}% |
| 1505 |
\fi |
| 1506 |
\chaptermark{#1}% |
| 1507 |
\@addchapterlistsgaps |
| 1508 |
\if@twocolumn |
| 1509 |
\@topnewpage[\@makechapterhead{#2}]% |
| 1510 |
\else |
| 1511 |
\@makechapterhead{#2}% |
| 1512 |
\@afterheading |
| 1513 |
\fi} |
| 1514 |
% \end{macrocode} |
| 1515 |
% |
| 1516 |
% \pagebreak[3] |
| 1517 |
% \subsubsection{Compatibility warning} |
| 1518 |
% |
| 1519 |
% \begin{macrocode} |
| 1520 |
\ifx\newfloat@replace@chapter\@gobbletwo \else |
| 1521 |
% \end{macrocode} |
| 1522 |
% If we were not able to patch |\@chapter| an info message is issued |
| 1523 |
% since we may not be able to support chapter lists gaps then. |
| 1524 |
% \begin{macrocode} |
| 1525 |
\newfloat@InfoNoLine{% |
| 1526 |
Unsupported document class, or \noexpand\@chapter\MessageBreak |
| 1527 |
was already redefined by another package} |
| 1528 |
\newfloat@InfoNoLine{\string\@chapter\space=\space\meaning\@chapter} |
| 1529 |
\newfloat@InfoNoLine{\string\Hy@org@chapter\space=\space\meaning\Hy@org@chapter} |
| 1530 |
% \end{macrocode} |
| 1531 |
% Plan B: We patch |\addtocontents| instead, and keep our fingers crossed in the hope |
| 1532 |
% that this redefinition actually will fit. |
| 1533 |
% \begin{macrocode} |
| 1534 |
\newfloat@ifplanb{% |
| 1535 |
\newfloat@InfoNoLine{Trying Plan B..}% |
| 1536 |
\let\newfloat@addtocontents@ORI\addtocontents |
| 1537 |
\long\def\addtocontents#1#2{% |
| 1538 |
\newfloat@addtocontents{#1}{#2}#2\addvspace\newfloat@nil}% |
| 1539 |
\long\def\newfloat@addtocontents#1#2#3\addvspace#4\newfloat@nil{% |
| 1540 |
\def\newfloat@tempa{#4}% |
| 1541 |
\ifx\newfloat@tempa\@empty |
| 1542 |
\newfloat@addtocontents@ORI{#1}{#2}% |
| 1543 |
\else |
| 1544 |
\ifx\newfloat@addtocontents@ext\@undefined |
| 1545 |
\newfloat@Info{Setting Plan B file extension to `#1'...}% |
| 1546 |
\xdef\newfloat@addtocontents@ext{#1}% |
| 1547 |
\fi |
| 1548 |
\edef\newfloat@tempa{#1}% |
| 1549 |
\ifx\newfloat@tempa\newfloat@addtocontents@ext |
| 1550 |
\begingroup |
| 1551 |
\let\addtocontents\newfloat@addtocontents@ORI |
| 1552 |
\@addchapterlistsgaps |
| 1553 |
\endgroup |
| 1554 |
\fi |
| 1555 |
\fi}} |
| 1556 |
% \end{macrocode} |
| 1557 |
% \begin{macrocode} |
| 1558 |
\fi |
| 1559 |
% \end{macrocode} |
| 1560 |
% |
| 1561 |
% \pagebreak[3] |
| 1562 |
% \subsection{Support of other packages} |
| 1563 |
% |
| 1564 |
% \begin{macro}{\newfloat@ForEachNew} |
| 1565 |
% |\newfloat@ForEachNew|\oarg{command}\marg{code} |
| 1566 |
% will execute the given code for every floating environment defined with |
| 1567 |
% |\Declare|\-|Floating|\-|Environment|. |
| 1568 |
% This will be done |\At|\-|Begin|\-|Document| so the affected package could be loaded |
| 1569 |
% after \thispackage. |
| 1570 |
% (If a \meta{command} is given this will only be done if \meta{command} is |
| 1571 |
% defined.) |
| 1572 |
% \begin{macrocode} |
| 1573 |
\newcommand\newfloat@ForEachNew[2][newfloat@@list]{% |
| 1574 |
\AtBeginDocument{% |
| 1575 |
\ifcsname#1\endcsname |
| 1576 |
\def\@elt##1{#2}% |
| 1577 |
\newfloat@@list |
| 1578 |
\let\@elt\relax |
| 1579 |
\fi}}% |
| 1580 |
\@onlypreamble\newfloat@ForEachNew |
| 1581 |
% \end{macrocode} |
| 1582 |
% \end{macro} |
| 1583 |
% |
| 1584 |
% \pagebreak[3] |
| 1585 |
% \subsubsection{\package{float}} |
| 1586 |
% |
| 1587 |
% If the \package{float} package is used we fill up |\float@exts| with our file |
| 1588 |
% extensions, too. Since this list will be used for inserting chapters gaps |
| 1589 |
% we only add the ones which are configured for chapters gaps on. |
| 1590 |
%% \begin{macrocode} |
| 1591 |
\newfloat@ForEachNew[float@exts]{% |
| 1592 |
\@nameuse{@ifchapterlistsgap@#1}{% if switched on |
| 1593 |
\let\float@do=\relax |
| 1594 |
\edef\@tempa{% |
| 1595 |
\noexpand\float@exts{\the\float@exts\float@do{\@nameuse{ext@#1}}}}% |
| 1596 |
\@tempa}} |
| 1597 |
% \end{macrocode} |
| 1598 |
% |
| 1599 |
% \pagebreak[3] |
| 1600 |
% \subsubsection{\package{fltpage}} |
| 1601 |
% |
| 1602 |
% We define a FP-variant of new floating environments here. |
| 1603 |
% \begin{macrocode} |
| 1604 |
\newfloat@ForEachNew[FP@floatBegin]{% |
| 1605 |
\newcounter{FP@#1C}% |
| 1606 |
\newenvironment{FP#1}{\FP@floatBegin{#1}}{\FP@floatEnd}} |
| 1607 |
% \end{macrocode} |
| 1608 |
% |
| 1609 |
% \pagebreak[3] |
| 1610 |
% \subsubsection{\package{listings}} |
| 1611 |
% |
| 1612 |
% \begin{macro}{\ext@lstlisting} |
| 1613 |
% Since the \package{listings} package do not define |\ext@lst|\-|listing| |
| 1614 |
% but we needed it when |Setup|\-|Floating|\-|Environment{lst|\-|listing}{|\ldots|}| |
| 1615 |
% will be done by the end user, we define it here. |
| 1616 |
% \begin{macrocode} |
| 1617 |
\providecommand*\ext@lstlisting{lol}% |
| 1618 |
% \end{macrocode} |
| 1619 |
% \end{macro} |
| 1620 |
% |
| 1621 |
% \pagebreak[3] |
| 1622 |
% \subsubsection{\package{rotating}} |
| 1623 |
% |
| 1624 |
% We define a sideways-variant of new floating environments here. |
| 1625 |
% \begin{macrocode} |
| 1626 |
\newfloat@ForEachNew[@rotfloat]{% |
| 1627 |
\newenvironment{sideways#1}{\@rotfloat{#1}}{\end@rotfloat}% |
| 1628 |
\newenvironment{sideways#1*}{\@rotdblfloat{#1}}{\end@rotdblfloat}} |
| 1629 |
% \end{macrocode} |
| 1630 |
% |
| 1631 |
% \pagebreak[3] |
| 1632 |
% \subsubsection{\package{sidecap}} |
| 1633 |
% |
| 1634 |
% We define a SC-variant of new floating environments here. |
| 1635 |
% \begin{macrocode} |
| 1636 |
\newcommand*\newfloat@For@SC[2]{% |
| 1637 |
\def#1{b}% = \sidecaptionvpos{#2}{b} (v1.6) |
| 1638 |
\newenvironment{SC#2}% |
| 1639 |
{\SC@float[#1]{#2}}{\endSC@float}% |
| 1640 |
\newenvironment{SC#2*}% |
| 1641 |
{\SC@dblfloat[#1]{#2}}{\endSC@dblfloat}} |
| 1642 |
\@onlypreamble\newfloat@For@SC |
| 1643 |
% \end{macrocode} |
| 1644 |
% \begin{macrocode} |
| 1645 |
\newfloat@ForEachNew[SC@float]{% |
| 1646 |
\expandafter\newfloat@For@SC\csname SC@#1@vpos\endcsname{#1}} |
| 1647 |
% \end{macrocode} |
| 1648 |
% |
| 1649 |
% \pagebreak[3] |
| 1650 |
% \subsubsection{\package{wrapfig}} |
| 1651 |
% |
| 1652 |
% We define a wrap-variant of new floating environments here. |
| 1653 |
% \begin{macrocode} |
| 1654 |
\newfloat@ForEachNew[wrapfloat]{% |
| 1655 |
\newenvironment{wrap#1}{\wrapfloat{#1}}{\endwrapfloat}} |
| 1656 |
% \end{macrocode} |
| 1657 |
% \iffalse |
| 1658 |
%</package> |
| 1659 |
% \fi |
| 1660 |
% |
| 1661 |
% \iffalse |
| 1662 |
% --------------------------------------------------------------------------- % |
| 1663 |
% \fi |
| 1664 |
% |
| 1665 |
% \Finale |
| 1666 |
% |
| 1667 |
\endinput |