From 01c5b7b8dfc848413685e16692be37a4cad2a14a Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 12 Jun 2016 16:12:11 +0000 Subject: caption (24may16) git-svn-id: svn://tug.org/texlive/trunk@41409 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/caption/bicaption.dtx | 57 +++++++++++++---- .../texmf-dist/source/latex/caption/caption3.dtx | 61 ++++++++++++------ .../texmf-dist/source/latex/caption/subcaption.dtx | 73 +++++++++++++++------- 3 files changed, 138 insertions(+), 53 deletions(-) (limited to 'Master/texmf-dist/source/latex/caption') diff --git a/Master/texmf-dist/source/latex/caption/bicaption.dtx b/Master/texmf-dist/source/latex/caption/bicaption.dtx index 5975f9561d2..149a58acfcc 100644 --- a/Master/texmf-dist/source/latex/caption/bicaption.dtx +++ b/Master/texmf-dist/source/latex/caption/bicaption.dtx @@ -2,7 +2,7 @@ % % This is file `bicaption.dtx'. % -% $Id: bicaption.dtx 136 2016-02-02 09:41:30Z sommerfeldt $ +% $Id: bicaption.dtx 158 2016-03-27 17:17:41Z sommerfeldt $ % $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/branches/3.3/source/bicaption.dtx $ % % Copyright (C) 2010-2016 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) @@ -28,7 +28,7 @@ % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{393} +% \CheckSum{409} % % \iffalse %<*driver> @@ -797,7 +797,7 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] \def\caption@tempa$Id: #1 #2 #3-#4-#5 #6${% \def\caption@tempa{#3/#4/#5 }\def\caption@tempb{#2 }} -\caption@tempa $Id: bicaption.dtx 136 2016-02-02 09:41:30Z sommerfeldt $ +\caption@tempa $Id: bicaption.dtx 158 2016-03-27 17:17:41Z sommerfeldt $ \ProvidesPackage{bicaption}[\caption@tempa v1.1-\caption@tempb Bilingual Captions (AR)] % \end{macrocode} % \begin{macrocode} @@ -904,31 +904,66 @@ % \end{macrocode} % % The option |lang=|\meta{language} will setup the language of the caption. +% We can't set the language immediately because otherwise we will get in trouble, e.g. when +% using the \package{microtype} package via |\usepackage[babel]{microtype}|. +% So we store the selected language to |\bicaption@language| instead and will set it later on. +% But this has a drawback, option settings which will be overwritten by the selection of +% the language do not work correctly anymore. +% The only option affected I'm aware off is the |name=| option, so this will be saved +% and set later on, too. +% (Since the user can declare own options it would be nice to have a new command for handling +% delayed option settings because of the language selection, +% e.g. |\DeclareCaptionLangOption|\marg{option key}. +% This will be offered by a future version of \thispackage.) +% \begin{macrocode} +\DeclareCaptionOption{lang}{% + \caption@ifundefined\bicaption@language + {\let\KV@bicaption@name\KV@caption@name + \def\KV@caption@name{\bicaption@KV{name}}}% + {}% + \def\bicaption@language{#1}% + \let\bicaption@language@options\@empty} +% \end{macrocode} % \begin{macrocode} -\DeclareCaptionOption{lang}{\def\bicaption@language{#1}} \let\KV@caption@language\KV@caption@lang % \end{macrocode} % +% \begin{macro}{\bicaption@KV} +% \changes{v1.1}{2016/03/27}{This macro added} +% |\bicaption@KV|\marg{option key}\marg{option value}\par +% This macro do execute the given caption package option, and store it additionally for +% delayed execution after setting the language. +% \begin{macrocode} +\newcommand\bicaption@KV[2]{% + \@bicaption@KV{#1}{#2}% + \l@addto@macro\bicaption@language@options{\@bicaption@KV{#1}{#2}}} +% \end{macrocode} +% \begin{macrocode} +\newcommand\@bicaption@KV[1]{% + \@nameuse{KV@bicaption@#1}} +% \end{macrocode} +% \end{macro} +% % \begin{macro}{\bicaption@selectlanguage} % \changes{v1.0}{2011/08/31}{Starred variant added} % \changes{v1.1}{2012/04/09}{Support of \cs{selectcaptionlanguage} added} +% \changes{v1.1}{2016/03/25}{Patching of \cs{caption@applyfont} replaced by \cs{caption@beginhook}} +% \changes{v1.1}{2016/03/27}{Usage of \cs{bicaption@language@options} added} +% |\bicaption@selectlanguage|\marg{font-or-list-entry}\par % Set the language (stored in |\bi|\-|caption@lan|\-|guage|) % via |\select|\-|bi|\-|caption|\-|lan|\-|guage|. % \begin{macrocode} \newcommand*\bicaption@selectlanguage[1]{% \caption@ifundefined\bicaption@language{}{% - \expandafter\selectcaptionlanguage\expandafter#1\expandafter{\bicaption@language}}} + \expandafter\selectcaptionlanguage\expandafter#1\expandafter{\bicaption@language}% + \bicaption@language@options}} % \end{macrocode} -% |\caption@applyfont| (of the \package{caption} package kernel) will be extended here +% |\caption@beginhook| (of the \package{caption} package kernel) will be extended here % so the language setting will actually take effect. % \begin{macrocode} -\g@addto@macro\caption@applyfont{% +\g@addto@macro\caption@beginhook{% \bicaption@selectlanguage\@firstoftwo} % \end{macrocode} -% \begin{macrocode} -\g@addto@macro\caption@prepareslc{% - \let\bicaption@language\@undefined} -% \end{macrocode} % \end{macro} % % \begin{macro}{\selectcaptionlanguage} diff --git a/Master/texmf-dist/source/latex/caption/caption3.dtx b/Master/texmf-dist/source/latex/caption/caption3.dtx index 50fc631aba2..f1bf4b7088d 100644 --- a/Master/texmf-dist/source/latex/caption/caption3.dtx +++ b/Master/texmf-dist/source/latex/caption/caption3.dtx @@ -2,7 +2,7 @@ % % This is file `caption3.dtx'. % -% $Id: caption3.dtx 139 2016-02-04 10:26:00Z sommerfeldt $ +% $Id: caption3.dtx 166 2016-05-22 18:50:55Z sommerfeldt $ % $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/branches/3.3/source/caption3.dtx $ % % Copyright (C) 1994-2016 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) @@ -28,7 +28,7 @@ % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{3664} +% \CheckSum{3679} % % \iffalse %<*driver> @@ -203,7 +203,7 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] \def\caption@tempa$Id: #1 #2 #3-#4-#5 #6${% \def\caption@tempa{#3/#4/#5 }\def\caption@tempb{#2 }} -\caption@tempa $Id: caption3.dtx 139 2016-02-04 10:26:00Z sommerfeldt $ +\caption@tempa $Id: caption3.dtx 166 2016-05-22 18:50:55Z sommerfeldt $ \ProvidesPackage{caption3}[\caption@tempa v1.7-\caption@tempb caption3 kernel (AR)] % \end{macrocode} % @@ -243,7 +243,7 @@ % \end{macro} % % \begin{macro}{\l@addto@macro} -% \changes{v3.3}{2013/04/26}{Revised} +% \changes{v1.5}{2013/04/26}{Revised} % The \LaTeXe\ kernel offers the internal helper macro |\g@addto@macro| which % globally adds tokens to existing macros, like in |\AtBeginDocument|. % This is the same but it works local, not global. @@ -1756,6 +1756,7 @@ % % \changes{v1.2}{2007/12/16}{Caption label format \opt{brace} added} % \changes{v1.7}{2015/09/16}{Caption label format \opt{autodot} added} +% \changes{v1.7}{2016/05/22}{Caption label format \opt{autodot} fixed} % There are five pre-defined label formats, called `empty', `simple', % `parens', `brace', and `autodot'. % \begin{macrocode} @@ -1763,7 +1764,7 @@ \DeclareCaptionLabelFormat{simple}{\bothIfFirst{#1}{\nobreakspace}#2} \DeclareCaptionLabelFormat{parens}{\bothIfFirst{#1}{\nobreakspace}(#2)} \DeclareCaptionLabelFormat{brace}{\bothIfFirst{#1}{\nobreakspace}#2)} -\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}\autodot} +\DeclareCaptionLabelFormat{autodot}{\bothIfFirst{#1}{\nobreakspace}#2\autodot} % \end{macrocode} % % `default' usually maps to `simple'. @@ -2742,9 +2743,10 @@ % \end{macrocode} % % \subsubsection{The beamer class (Part one)} -% \changes{v1.1}{2007/03/10}{beamer class support added} -% \changes{v1.3}{2011/08/06}{beamer class support revised} -% \changes{v3.3}{2013/04/27}{The beamer template \texttt{caption label separator} will be used now} +% \changes{v1.1}{2007/03/10}{\package{beamer} class support added} +% \changes{v1.3}{2011/08/06}{\package{beamer} class support revised} +% \changes{v1.5}{2013/04/27}{The \package{beamer} template \texttt{caption label separator} will be used now} +% \changes{v1.7}{2016/05/22}{Re-definition of label format \texttt{simpleMagyar} added to \package{beamer} class support} % % \begin{macro}{\caption@ifbeamerclass} % \begin{macrocode} @@ -2774,24 +2776,41 @@ \fi \nobreak\vskip\belowcaptionskip\nobreak}} % \end{macrocode} +% % \begin{macro}{\caption@ifbeamertemplate} % |\caption@ifbeamertemplate|\marg{caption template name}\marg{yes-code}\marg{no-code}\\ % tests if the given beamer caption template was selected by the user (or not). % \begin{macrocode} -\newcommand*\caption@ifbeamertemplate[1]{% - \begingroup - \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption - \@nameuse{beamer@@tmpop@caption@#1}% - \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption - \endgroup\expandafter\@firstoftwo - \else - \endgroup\expandafter\@secondoftwo - \fi} + \newcommand*\caption@ifbeamertemplate[1]{% + \begingroup + \let\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption + \@nameuse{beamer@@tmpop@caption@#1}% + \ifx\beamer@@tmpl@caption@ORI\beamer@@tmpl@caption + \endgroup\expandafter\@firstoftwo + \else + \endgroup\expandafter\@secondoftwo + \fi} % \end{macrocode} % \end{macro} +% % \begin{macrocode} \DeclareCaptionLabelFormat{default}{% - #1\caption@ifbeamertemplate{numbered}{~#2}{}} + \caption@ifbeamertemplate{numbered}{% + \caption@lfmt@simple{#1}{#2}}{#1}} +% \end{macrocode} +% The \package{magyar} babel package redefines the current label format to a one called |simple|\-|Magyar|, +% defined within |\@@magyar@caption|\-|fix| which will be executed |\At|\-|Begin|\-|Document|. +% But without accounting for the \package{beamer} document class, so we will make up leeway here. +% \begin{macrocode} + \DeclareCaptionLabelFormat{default@magyar}{% + \caption@ifbeamertemplate{numbered}{% + \caption@lfmt@simple@magyar{#1}{#2}}{#1}} + \@ifundefined{@@magyar@captionfix}\AtBeginDocument\@firstofone{% + \g@addto@macro\@@magyar@captionfix{% + \let\caption@lfmt@simple@magyar\caption@lfmt@simpleMagyar + \let\caption@lfmt@simpleMagyar\caption@lfmt@default@magyar}} +% \end{macrocode} +% \begin{macrocode} \caption@declarelabelseparator {\caption@ifbeamertemplate{caption name own line}\@gobble\@firstofone} {default} @@ -2804,6 +2823,8 @@ \usebeamercolor[fg]{caption name}% \usebeamerfont*{caption name}} \DeclareCaptionDefaultJustification{\raggedright} +% \end{macrocode} +% \begin{macrocode} \DeclareOption{beamerclass}{% \renewcommand\caption@ifslc{% \caption@ifbeamertemplate{caption name own line}\@secondoftwo\@firstoftwo} @@ -3385,7 +3406,7 @@ % \changes{v1.1d}{2007/10/23}{`SingleLine' renamed to `singleline' for consistency} % \changes{v1.3}{2010/09/04}{Split into \cs{caption@slc} and \cs{caption@@slc}} % \changes{v1.5}{2012/12/26}{Merged into a single macro again} -% \changes{v3.3}{2013/04/14}{Definition and usage of \cs{ifsinglelinecaption} added} +% \changes{v1.5}{2013/04/14}{Definition and usage of \cs{ifsinglelinecaption} added} % |\caption@slc|\marg{label}\marg{text}\marg{single-line-code}\marg{multi-line-code}\par % This one does the single-line-check. % \begin{macrocode} @@ -3431,7 +3452,7 @@ % \changes{v1.3}{2011/07/07}{Bugfix 11-07-06: Redefinition of \cs{footnote} and \cs{footnotemark} added, redefinition of \cs{stepcounter} and \cs{refstepcounter} dropped} % \changes{v1.4a}{2011/10/21}{Redefinition of \cs{pagenote} from \textsf{memoir} document class added} % \changes{v1.4a}{2011/10/22}{Redefinition of \cs{footnote} revised} -% \changes{v3.3}{2013/04/13}{Redefinition os \cs{glsunset} added} +% \changes{v1.5}{2013/04/13}{Redefinition os \cs{glsunset} added} % Re-define anything which would disturb the single-line-check. % \begin{macrocode} \newcommand*\caption@prepareslc{% diff --git a/Master/texmf-dist/source/latex/caption/subcaption.dtx b/Master/texmf-dist/source/latex/caption/subcaption.dtx index 74ba9ac7b13..5ca25e16531 100644 --- a/Master/texmf-dist/source/latex/caption/subcaption.dtx +++ b/Master/texmf-dist/source/latex/caption/subcaption.dtx @@ -2,7 +2,7 @@ % % This is file `subcaption.dtx'. % -% $Id: subcaption.dtx 142 2016-02-20 19:59:43Z sommerfeldt $ +% $Id: subcaption.dtx 161 2016-05-22 14:39:14Z sommerfeldt $ % $HeadURL: svn+ssh://sommerfeldt@svn.code.sf.net/p/latex-caption/code/branches/3.3/source/subcaption.dtx $ % % Copyright (C) 2007-2016 Axel Sommerfeldt (axel.sommerfeldt@f-m.fm) @@ -28,7 +28,7 @@ % and the user manuals caption-deu.tex, caption-eng.tex, and caption-rus.tex. % % \fi -% \CheckSum{147} +% \CheckSum{165} % % \iffalse %<*driver> @@ -903,7 +903,7 @@ \NeedsTeXFormat{LaTeX2e}[1994/12/01] \def\caption@tempa$Id: #1 #2 #3-#4-#5 #6${% \def\caption@tempa{#3/#4/#5 }\def\caption@tempb{#2 }} -\caption@tempa $Id: subcaption.dtx 142 2016-02-20 19:59:43Z sommerfeldt $ +\caption@tempa $Id: subcaption.dtx 161 2016-05-22 14:39:14Z sommerfeldt $ \ProvidesPackage{subcaption}[\caption@tempa v1.1-\caption@tempb Sub-captions (AR)] % \end{macrocode} % @@ -913,32 +913,61 @@ % \begin{macrocode} \RequirePackage{caption}[2012/03/25] % needs v3.3 or newer % \end{macrocode} -% \changes{v1.1}{2011/09/01}{Compatibility error added} -% \begin{macrocode} -\caption@AtBeginDocument{\caption@ifcompatibility{% - \caption@Error{% - The `subcaption' package does not work correctly\MessageBreak - in compatibility mode}}{}} -% \end{macrocode} % +% \begin{macro}{\subcaption@CheckCompatibility} +% \changes{v1.1}{2011/09/01}{Compatibility error added} +% \changes{v1.1}{2016/05/22}{The presence of \package{subfigure} or \package{subfig} will be checked \cs{AtBeginDocument}, too} % Since we are incompatible to them an error message will be issued when % the \package{subfigure} or \package{subfig} package is loaded. % \begin{macrocode} -\@ifpackageloaded{subfigure}{% - \PackageError{subcaption}% - {This package can't be used in cooperation\MessageBreak - with the subfigure package}% - {RTFM}% - \endinput}{}% +\newcommand\subcaption@CheckCompatibility{% +% \end{macrocode} +% \begin{macrocode} + \@ifpackageloaded{subfigure}{% + \PackageError{subcaption}% + {This package can't be used in cooperation\MessageBreak + with the subfigure package}% + {\subcaption@EH}% + \endinput}{}% % \end{macrocode} % \begin{macrocode} -\@ifpackageloaded{subfig}{% - \PackageError{subcaption}% - {This package can't be used in cooperation\MessageBreak - with the subfig package}% - {RTFM}% - \endinput}{}% + \@ifpackageloaded{subfig}{% + \PackageError{subcaption}% + {This package can't be used in cooperation\MessageBreak + with the subfig package}% + {\subcaption@EH}% + \endinput}{}% % \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% \begin{macrocode} +\newcommand*\subcaption@EH{% + If you do not understand this error, please take a closer look\MessageBreak + at the documentation of the `subcaption' package, especially the\MessageBreak + section about errors.\MessageBreak\@ehc} +% \end{macrocode} +% \begin{macrocode} +\subcaption@CheckCompatibility +% \end{macrocode} +% \begin{macrocode} +\caption@AtBeginDocument{% +% \end{macrocode} +% \begin{macrocode} + \caption@ifcompatibility{% + \caption@Error{% + The `subcaption' package does not work correctly\MessageBreak + in compatibility mode}}{}% +% \end{macrocode} +% \begin{macrocode} + \subcaption@CheckCompatibility + \let\subcaption@CheckCompatibility\@undefined + \let\subcaption@EH\@undefined +% \end{macrocode} +% \begin{macrocode} +} +% \end{macrocode} +% \end{macro} % % \iffalse % \subsection{Declaration of options} -- cgit v1.2.3