summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/newfloat.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2013-01-09 00:39:21 +0000
committerKarl Berry <karl@freefriends.org>2013-01-09 00:39:21 +0000
commit60cbc8437dcfde310f54a43fd254865ec7e5296a (patch)
tree119dc082348b649e2fa1fb8eb6ba90639fe764df /Master/texmf-dist/source/latex/caption/newfloat.dtx
parent7e39ebb4ceedd3a7699e90140504b8373cdf26cf (diff)
caption (8jan13)
git-svn-id: svn://tug.org/texlive/trunk@28765 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/newfloat.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/newfloat.dtx112
1 files changed, 94 insertions, 18 deletions
diff --git a/Master/texmf-dist/source/latex/caption/newfloat.dtx b/Master/texmf-dist/source/latex/caption/newfloat.dtx
index 00f04984a80..05198f0d5f4 100644
--- a/Master/texmf-dist/source/latex/caption/newfloat.dtx
+++ b/Master/texmf-dist/source/latex/caption/newfloat.dtx
@@ -2,7 +2,7 @@
%
% This is file `newfloat.dtx'.
%
-% Copyright (C) 2011 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
+% Copyright (C) 2011-2012 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm)
%
% --------------------------------------------------------------------------
%
@@ -25,13 +25,13 @@
% and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex.
%
% \fi
-% \CheckSum{1204}
+% \CheckSum{1291}
%
% \iffalse
%<*driver>
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\ProvidesFile{newfloat.drv}%
- [2011/11/06 v1.0 This package offers a command for defining new floating environments]
+ [2012/05/18 v1.0 This package offers a command for defining new floating environments]
\hbadness=9999 \newcount\hbadness \hfuzz=48pt % Make TeX shut up.
%
\documentclass{ltxdoc}
@@ -117,7 +117,7 @@
% 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}
+% |chapterlistsgap=| & \meta{value}~\footnotemark[1]
% \end{tabular}\end{quote}
%
% The ``within'' counter specifies the counter which will be used to reset
@@ -167,8 +167,13 @@
% |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}
+% |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,
@@ -447,16 +452,20 @@
%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{newfloat}[2011/11/16 v1.0a Defining new floating environments (AR)]
+\ProvidesPackage{newfloat}[2012/05/19 v1.0b 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@Error}
% |\newfloat@Error|\marg{message}
@@ -947,6 +956,7 @@
% \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}
@@ -955,6 +965,8 @@
\ifcsname ext@#1\endcsname
\@cons\newfloat@list{{#1}}%
\@namedef{newfloat@ext@\@nameuse{ext@#1}}{#1}%
+ \@ifundefined{@ifchapterlistsgap@#1}{%
+ \expandafter\let\csname @ifchapterlistsgap@#1\endcsname\@iden}{}%
\else
\newfloat@Error{`#1' does not seem to be a floating environment}%
\fi}}
@@ -1015,7 +1027,7 @@
% \begin{macrocode}
\providecommand*\@@addchapterlistsgap[2]{%
\@ifundefined{@addchapterlistsgap@#2}{% only once per extension
- \@namedef{@addchapterlistsgap@#2}{}%
+ \@namedef{@addchapterlistsgap@#2}{#1}%
\@@@addchapterlistsgap{#2}}{}}
% \end{macrocode}
% \begin{macrocode}
@@ -1027,14 +1039,16 @@
% \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{%
- \def\@elt##1{%
- \@expandtwoargs\@addchapterlistsgap{##1}{\@nameuse{ext@##1}}}%
- \newfloat@list
- \let\@elt\relax}
+ \begingroup
+ \def\@elt##1{%
+ \@expandtwoargs\@addchapterlistsgap{##1}{\@nameuse{ext@##1}}}%
+ \newfloat@list
+ \endgroup}
% \end{macrocode}
% \end{macro}
%
@@ -1119,11 +1133,42 @@
% \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$=$off)
+% \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}{\@ptionlist{\@currname.\@currext}}%
+\@expandtwoargs\setkeys{newfloat}{planb,\@ptionlist{\@currname.\@currext}}%
\AtEndOfPackage{\let\@unprocessedoptions\relax}
% \end{macrocode}
%
@@ -1473,14 +1518,45 @@
% \pagebreak[3]
% \subsubsection{Compatibility warning}
%
-% If we were not able to patch |\@chapter| a warning message is issued
-% since we are not able to support chapter lists gaps then.
% \begin{macrocode}
\ifx\newfloat@replace@chapter\@gobbletwo \else
- \PackageWarningNoLine{newfloat}{%
- Unsupported document class, or\MessageBreak
- \noexpand\@chapter was already redefined by another package}
- \newfloat@Info{\string\@chapter\space=\space\meaning\@chapter}
+% \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 |\addtocontents| instead, and keep our fingers crossed in the hope
+% that this redefinition actually will fit.
+% \begin{macrocode}
+ \newfloat@ifplanb{%
+ \newfloat@InfoNoLine{Trying Plan B..}%
+ \let\newfloat@addtocontents@ORI\addtocontents
+ \long\def\addtocontents#1#2{%
+ \newfloat@addtocontents{#1}{#2}#2\addvspace\newfloat@nil}%
+ \long\def\newfloat@addtocontents#1#2#3\addvspace#4\newfloat@nil{%
+ \def\newfloat@tempa{#4}%
+ \ifx\newfloat@tempa\@empty
+ \newfloat@addtocontents@ORI{#1}{#2}%
+ \else
+ \ifx\newfloat@addtocontents@ext\@undefined
+ \newfloat@Info{Setting Plan B file extension to `#1'...}%
+ \xdef\newfloat@addtocontents@ext{#1}%
+ \fi
+ \edef\newfloat@tempa{#1}%
+ \ifx\newfloat@tempa\newfloat@addtocontents@ext
+ \begingroup
+ \let\addtocontents\newfloat@addtocontents@ORI
+ \@addchapterlistsgaps
+ \endgroup
+ \fi
+ \fi}}
+% \end{macrocode}
+% \begin{macrocode}
\fi
% \end{macrocode}
%