summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/source/latex/l3packages/l3keys2e
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-01-19 22:49:40 +0000
committerKarl Berry <karl@freefriends.org>2012-01-19 22:49:40 +0000
commit1148f4718708f720f250d1e258b9cc429bf30168 (patch)
tree53fa63c41b0c657d758836916573cc5a1cd10652 /Master/texmf-dist/source/latex/l3packages/l3keys2e
parent8764984f07460a77b8200111ddb513c8af6c23f3 (diff)
l3packages 3209 (19jan12)
git-svn-id: svn://tug.org/texlive/trunk@25159 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/latex/l3packages/l3keys2e')
-rw-r--r--Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex43
-rw-r--r--Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx33
2 files changed, 59 insertions, 17 deletions
diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex
new file mode 100644
index 00000000000..96d007999ac
--- /dev/null
+++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e-demo.tex
@@ -0,0 +1,43 @@
+% This file demonstrates the use of the l3keys2e module to allow
+% LaTeX3 keyvals (created using l3keys) to be used as LaTeX2e
+% package or class options.
+%
+
+% First, create a class
+\begin{filecontents}{l3keys2e-class.cls}
+ \LoadClass{article}
+ \RequirePackage{l3keys2e}
+ \ProvidesExplClass{l3keys2e-class}{0000/00/00}{0.0}{test}
+ \keys_define:nn { test1 } {
+ option1 .code:n = {\wlog{You~gave~`#1'~for~option1}}
+ }
+ \ProcessKeysOptions { test1 }
+\end{filecontents}
+
+% Load the class with some options.
+% The class itself recognises `option1', leaving `option2' and
+% `option3' as global optons which are not yet used.
+\documentclass[option1=check,option2=more stuff,option3=unused]
+ {l3keys2e-class}
+
+%Now create a package
+\begin{filecontents}{l3keys2e-package.sty}
+ \RequirePackage{l3keys2e}
+ \ProvidesExplPackage{l3keys2e-package}{0000/00/00}{0.0}{test}
+ \keys_define:nn { test2 } {
+ option1 .code:n = {\wlog{You~gave~`#1'~for~option1~(again)}},
+ option2 .code:n = {\wlog{You~gave~`#1'~for~option2}},
+ option4 .code:n = {\wlog{You~gave~`#1'~for~option4}},
+ }
+ \ProcessKeysOptions { test2 }
+\end{filecontents}
+
+% Load the package.
+\usepackage[option4={extra stuff},option5=undefined!]
+ {l3keys2e-package}
+
+\begin{document}
+% The log should show that option3 is an unused global option, and that
+% option5 is not known by the l3keys2e-demo package. Everything else
+% should simply be listed in the log.
+\end{document}
diff --git a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
index 240b7f2ceb2..23904106533 100644
--- a/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
+++ b/Master/texmf-dist/source/latex/l3packages/l3keys2e/l3keys2e.dtx
@@ -1,6 +1,6 @@
% \iffalse meta-comment
%
-%% File: l3keys2e.dtx (C) Copyright 2009,2011 The LaTeX3 Project
+%% File: l3keys2e.dtx (C) Copyright 2009,2011,2012 The LaTeX3 Project
%%
%% It may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License (LPPL), either version 1.3c of this
@@ -35,8 +35,22 @@
%%
%
%<*driver|package>
+% The version of expl3 required is tested as early as possible, as
+% some really old versions do not define \ProvidesExplPackage.
+\RequirePackage{expl3}[2012/01/19]
+%<package>\@ifpackagelater{expl3}{2012/01/19}
+%<package> {}
+%<package> {
+%<package> \PackageError{l3keys2e}{Support package l3kernel too old.}
+%<package> {
+%<package> Please install an up to date~version of l3kernel
+%<package> using your TeX package manager or from CTAN.\\ \\
+%<package> Loading l3keys2e will abort!
+%<package> }
+%<package> \endinput
+%<package> }
\RequirePackage{xparse}
-\GetIdInfo$Id: l3keys2e.dtx 3109 2011-12-29 10:42:27Z joseph $
+\GetIdInfo$Id: l3keys2e.dtx 3207 2012-01-19 08:50:24Z joseph $
{LaTeX2e option processing using LaTeX3 keys}
%</driver|package>
%<*driver>
@@ -134,21 +148,6 @@
\ProvidesExplPackage
{\ExplFileName}{\ExplFileDate}{\ExplFileVersion}{\ExplFileDescription}
% \end{macrocode}
-%
-% A check to make sure that \pkg{expl3} is not too old
-% \begin{macrocode}
-\@ifpackagelater { expl3 } { 2011/12/29 }
- { }
- {
- \PackageError { l3keys2e } { Support~package~l3kernel~too~old. }
- {
- Please~install~an~up~to~date~version~of~l3kernel~
- using~your~TeX~package~manager~or~from~CTAN.\\ \\
- Loading~l3keys2e~will~abort!
- }
- \tex_endinput:D
- }
-% \end{macrocode}
%
% \begin{macro}{\keys_latexe_options_clist}
% A single list is used for all options, into which they are collected