summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/caption/bicaption.dtx
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-06-12 16:12:11 +0000
committerKarl Berry <karl@freefriends.org>2016-06-12 16:12:11 +0000
commit01c5b7b8dfc848413685e16692be37a4cad2a14a (patch)
treeb0c3b60b2864a8b2d094bdef920cb993da777a94 /Master/texmf-dist/source/latex/caption/bicaption.dtx
parent1da26fe4bf4ac2b50bbce09e9874582c8593a2d3 (diff)
caption (24may16)
git-svn-id: svn://tug.org/texlive/trunk@41409 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/caption/bicaption.dtx')
-rw-r--r--Master/texmf-dist/source/latex/caption/bicaption.dtx57
1 files changed, 46 insertions, 11 deletions
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}