From bc810e6340a36baa5a2918ed256a605f54f04811 Mon Sep 17 00:00:00 2001
From: Karl Berry <karl@freefriends.org>
Date: Wed, 3 Oct 2018 22:44:10 +0000
Subject: caption (3oct18)

git-svn-id: svn://tug.org/texlive/trunk@48824 c570f23f-e606-0410-a88d-b1316a301751
---
 Master/texmf-dist/tex/latex/caption/caption.sty | 183 ++++++++++++++++--------
 1 file changed, 121 insertions(+), 62 deletions(-)

(limited to 'Master/texmf-dist/tex/latex/caption/caption.sty')

diff --git a/Master/texmf-dist/tex/latex/caption/caption.sty b/Master/texmf-dist/tex/latex/caption/caption.sty
index d9690ed6337..0636ca6d7e5 100644
--- a/Master/texmf-dist/tex/latex/caption/caption.sty
+++ b/Master/texmf-dist/tex/latex/caption/caption.sty
@@ -37,8 +37,8 @@
 %%   caption-deu.tex, caption-eng.tex, and caption-rus.tex.
 %% 
 \NeedsTeXFormat{LaTeX2e}[1994/12/01]
-\ProvidesPackage{caption}[2018/05/01 v3.3-147 Customizing captions (AR)]
-\RequirePackage{caption3}[2018/05/01] % needs v1.8 or newer
+\ProvidesPackage{caption}[2018/09/12 v3.3-152 Customizing captions (AR)]
+\RequirePackage{caption3}[2018/09/12] % needs v1.8c or newer
 \caption@ifbool{documentclass}{}{%
   \caption@WarningNoLine{%
     Unsupported document class (or package) detected,\MessageBreak
@@ -287,21 +287,23 @@
 }
 \caption@SetupOptions{caption}{\caption@setkeys{#1}{#2}}
 \caption@ProcessOptions*{caption}
-\newif\ifcaption@caption
-\newif\ifcaption@subcaption
-\newif\ifcaption@ContinuedFloat
+\newcounter{caption@flags}
+\newcommand*\caption@ifflag[1]{%
+  \@tempcnta\c@caption@flags
+  \divide\@tempcnta #1\relax
+  \ifodd\@tempcnta
+    \expandafter\@firstoftwo
+  \else
+    \expandafter\@secondoftwo
+  \fi}
+\newcommand*\caption@clrflags{%
+  \setcounter{caption@flags}\z@}
 \newcommand*\caption@clrflag[1]{%
-  \caption@chgflag{#1}{false}}
+  \caption@ifflag{#1}{\caption@addtoflags{-#1}}{}}
 \newcommand*\caption@setflag[1]{%
-  \caption@chgflag{#1}{true}}
-\newcommand*\caption@chgflag[2]{%
-  \global\csname caption@#1#2\endcsname}
-\caption@AtBeginDocument{%
-  \caption@ifundefined\FR@loc@{}{%
-    \caption@InfoNoLine{floatrow package is loaded}%
-    \g@addto@macro\FR@loc@{%
-      \renewcommand*\caption@chgflag[2]{%
-        \csname caption@#1#2\endcsname}}}}
+  \caption@ifflag{#1}{}{\caption@addtoflags{#1}}}
+\newcommand*\caption@addtoflags{%
+  \addtocounter{caption@flags}}
 \def\caption@caption{%
   \caption@iftype
     {\caption@checkgrouplevel\@empty\caption
@@ -480,6 +482,44 @@
       \def\@currentlabelname{#2}%
       \M@gettitle{#2}%
     }}%
+  \caption@CheckCommand\@caption{%
+    % arabicore.sty [2006/01/01 v1.0 Arabi Core switching commands (may still change)]
+    \long\def\@caption#1[#2]#3{%
+      \par
+      \addtocontents{\csname ext@#1\endcsname}{\xstring\select@language{\main@Arabi@language}}%
+      \addcontentsline{\csname ext@#1\endcsname}{#1}%
+        {\protect\numberline{\csname the#1\endcsname}{\ignorespaces \if@rl{\textRL{#2}}\else\textLR{#2}\fi}}%
+      \begingroup
+        \@parboxrestore
+        \if@minipage
+          \@setminipage
+        \fi
+        \normalsize
+        \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces \if@rl{\textRL{#3}}\else\textLR{#3}\fi}\par
+      \endgroup}}%
+  \caption@CheckCommand\@caption{%
+    % rlbabel.def [2005/03/30 v2.3h Right-to-Left support from the babel system Hebrew language support from the babel system]
+    \long\def\@caption#1[#2]#3{%
+      \par
+      \addcontentsline{\csname ext@#1\endcsname}{#1}%
+        {\protect\numberline{\csname the#1\endcsname}%
+        {\ignorespaces #2}}%
+      \def\@fignm{figure}
+      \ifx#1\@fignm\addcontentsline{fol}{#1}%
+         {\protect\numberline{\csname the#1\endcsname}%
+         {\ignorespaces #2}}\fi%
+      \def\@tblnm{table}
+      \ifx#1\@tblnm\addcontentsline{tol}{#1}%
+         {\protect\numberline{\csname the#1\endcsname}%
+         {\ignorespaces #2}}\fi%
+      \begingroup
+        \@parboxrestore
+        \if@minipage
+          \@setminipage
+        \fi
+        \normalsize
+        \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #3}\par
+      \endgroup}}%
   \caption@CheckCommand\@caption{%
     % magyar.ldf [2005/03/30 v1.4j Magyar support from the babel system]
     \long\def\@caption#1[#2]#3{%
@@ -671,6 +711,16 @@
     % subfig.sty [2005/06/28 ver: 1.3 subfig package]
     \def\@caption{\caption@}%
     }%
+  \caption@CheckCommand\@caption{%
+    % chkfloat.sty [2012/08/19 v0.1 chkfloat: check for moved floats]
+    \def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}%
+      \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}%
+    }}%
+  \caption@CheckCommand\@caption{%
+    % chkfloat.sty [20??/??/?? v0.? chkfloat: check for moved floats]
+    \def\@caption#1[#2]#3{\chkfloat@caption{#1}[#2]{#3}%
+      \chkfloat@addcontentsline{#1}{#2}%
+    }}%
   \caption@IfCheckCommand{}{%
     \caption@InfoNoLine{%
       Incompatible package detected (regarding \string\@caption).\MessageBreak
@@ -739,9 +789,7 @@
     {\caption@@settype{sub}*{sub\@captype}}%
     {\caption@@settype{sub}{sub\@captype}}}%
 \newcommand*\caption@settype{%
-  \caption@clrflag{caption}%
-  \caption@clrflag{subcaption}%
-  \caption@clrflag{ContinuedFloat}%
+  \caption@clrflags
   \caption@set@type}
 \newcommand*\caption@set@type{%
   \caption@@settype{}}
@@ -880,7 +928,7 @@
     \caption@Error{Continued `#1' after `\caption@CFtype'}%
   \fi}
 \newcommand*\caption@@ContinuedFloat{%
-  \caption@setflag{ContinuedFloat}%
+  \caption@setflag1% ContinuedFloat
   \caption@@@ContinuedFloat}
 \newcommand*\caption@@@ContinuedFloat{%
   \stepcounter{ContinuedFloat}%
@@ -909,21 +957,21 @@
     {\caption@Error{No float type '#1' defined}}%
     {\caption@ref@stepcounter{#1}%
      \caption@fixposition
-     \caption@iftop\caption@setflag\caption@clrflag{caption}%
-     \caption@clrflag{subcaption}%
+     \caption@iftop\caption@setflag\caption@clrflag2% caption
+     \caption@clrflag4% subcaption
      \@nameuse{donemaincaptiontrue}}}
 \newcommand*\caption@ref@stepcounter{%
-  \ifcaption@ContinuedFloat
+  \caption@ifflag1{% ContinuedFloat
     \let\caption@tempa\caption@@refcounter
-    \caption@clrflag{ContinuedFloat}%
-  \else
+    \caption@clrflag1% ContinuedFloat
+  }{%
     \let\caption@tempa\caption@@refstepcounter
-    \ifcaption@caption \else
-      \ifcaption@subcaption
+    \caption@ifflag2{}{% caption
+      \caption@ifflag4{% subcaption
         \let\caption@tempa\caption@@refcounter
-      \fi
-    \fi
-  \fi
+      }{}%
+    }%
+  }%
   \caption@tempa}
 \newcommand*\caption@@refcounter[1]{%
   \let\caption@stepcounter@ORI\stepcounter
@@ -1010,20 +1058,21 @@
 \newcommand*\caption@subtypehook{%
   \ifx\caption\caption@subcaption \else
     \caption@warmup
-    \ifcaption@caption \else
+    \caption@ifflag2{}{% caption
       \let\caption@add@contentsline\caption@addsubcontentsline
       \let\caption@addsubcontentslines\@gobble
-      \ifcaption@subcaption \else
-        \ifcaption@ContinuedFloat
-          \caption@clrflag{ContinuedFloat}%
-        \else
+      \caption@ifflag4{}{% subcaption
+        \caption@ifflag1{% ContinuedFloat
+          \caption@clrflag1%
+        }{%
           \caption@@stepcounter\@captype
-        \fi
-        \caption@setflag{subcaption}%
-      \fi
-    \fi
+        }%
+        \caption@setflag4% subcaption
+      }%
+    }%
     \c@ContinuedFloat=0\relax
     \let\caption@setfloatcapt\@firstofone
+    \let\caption@chkfloat\@gobbletwo
     \caption@setbox{none}%
     \caption@clearmargin
     \caption@iflist{}{\let\caption@setlist\@gobble}%
@@ -1153,16 +1202,15 @@
   }%
 }}
 \def\caption@tempa#1{%
-  \@ifundefined{extras#1}\caption@AtBeginDocument\@firstofone{%
-    \@ifundefined{extras#1}{}{%
-      \caption@InfoNoLine{#1 babel option is loaded}%
-      \expandafter\addto\csname extras#1\endcsname{%
-         % reverse changes made by magyar.ldf
-         \let\@makecaption\caption@makecaption
-         \babel@save\@makecaption
-         \caption@redefine
-         \babel@save\@caption}%
-    }}}
+  \@ifpackagewith{babel}{#1}{%
+    \caption@InfoNoLine{#1 babel option is loaded}%
+    \expandafter\addto\csname extras#1\endcsname{%
+       % reverse changes made by magyar.ldf
+       \let\@makecaption\caption@makecaption
+       \babel@save\@makecaption
+       \caption@redefine
+       \babel@save\@caption}%
+  }{}}
 \caption@tempa{hungarian}%
 \caption@tempa{magyar}%
 \newcommand\caption@IfPackageLoaded[1]{%
@@ -1253,6 +1301,15 @@
   }{}%
   \caption@undefbool{needfreeze}}
 \let\caption@warmup\relax
+\caption@IfPackageLoaded{chkfloat}[2012/08/19 v0.1]{%
+  \caption@ifundefined\chkfloat@addcontentsline{%
+    \renewcommand\caption@chkfloat[2]{%
+      \caption@ifundefined\chkfloat@page{}{%
+        \addtocontents{fof}{\protect\chkfloat@{\thepage}{\chkfloat@page}{\csname fnum@#1\endcsname: #2}}}}%
+  }{%
+    \renewcommand\caption@chkfloat{\chkfloat@addcontentsline}%
+  }%
+  }{}%
 \caption@IfPackageLoaded{float}[2001/11/08 v1.3d]{%
  \@ifpackageloaded{floatrow}{%
   \caption@If@Package@Loaded{floatrow}[2007/08/24 v0.2a]{}{}%
@@ -1508,7 +1565,7 @@
 }{}
 \providecommand*\LTcaptype{table}
 \caption@IfPackageLoaded{longtable}[1995/05/24 v3.14]{%
-  \RequirePackage{ltcaption}[2007/09/01]%
+  \RequirePackage{ltcaption}[2018/08/26]%
   \let\LT@@makecaption\@undefined
   \caption@AtBeginDocument{%
     \let\caption@ORI@LT@array\LT@array
@@ -1525,10 +1582,8 @@
       \def\@captionabovefalse{\LT@captionsetup{position=b}}%
       \def\captionlistentry{%
         \noalign\bgroup
-        \@ifstar{\egroup\LT@captionlistentry}% gobble *
-                {\egroup\LT@captionlistentry}}%
-      \def\LT@captionlistentry##1{%
-        \caption@listentry\@firstoftwo[\LTcaptype]{##1}}%
+        \@ifstar{\egroup\LT@listentry}% gobble *
+                {\egroup\LT@listentry}}%
 %%        \let\Hy@LT@currentHlabel\@currentHlabel
 %%          \let\@currentHlabel\Hy@LT@currentHlabel
       \def\ContinuedFloat{\noalign{%
@@ -1539,17 +1594,9 @@
     \@ifstar
       {\egroup\LT@c@ption\@gobble[]}%
       {\egroup\caption@xdblarg{\LT@c@ption\@firstofone}}}
-  \long\def\LT@c@ption#1[#2]#3{%
-    \LT@makecaption#1{\csname fnum@\LTcaptype\endcsname}{#3}%
-    \LT@captionlistentry{#2}}%
   \renewcommand\LT@makecaption[3]{%
     \caption@LT@make{%
-      \caption@settype*\LTcaptype
-      \ifdim\LTcapwidth=4in \else
-        \setcaptionwidth\LTcapwidth
-      \fi
-      \caption@setoptions{longtable}%
-      \caption@setoptions{@longtable}%
+      \caption@LT@settype\LTcaptype
       \caption@LT@setup
       \caption@setautoposition{\ifcase\LT@rows t\else b\fi}%
       \caption@startrue#1\caption@starfalse
@@ -1561,6 +1608,18 @@
         \caption@@make{#2}{#3}\endgraf
         \caption@iftop{\vskip\abovecaptionskip}{\vskip\belowcaptionskip}%
       \caption@end}}%
+  \renewcommand*\LT@listentry[2]{%
+    \begingroup
+      \caption@LT@settype{#1}%
+      \caption@listentry\@firstoftwo[#1]{#2}%
+    \endgroup}%
+  \newcommand*\caption@LT@settype[1]{%
+    \caption@settype*\LTcaptype
+    \ifdim\LTcapwidth=4in \else
+      \setcaptionwidth\LTcapwidth
+    \fi
+    \caption@setoptions{longtable}%
+    \caption@setoptions{@longtable}}
 }{}
 \providecommand*\caption@LT@setup{}
 \caption@IfPackageLoaded{picinpar}{%
-- 
cgit v1.2.3

