summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/skeycommand
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2010-05-21 15:36:37 +0000
committerKarl Berry <karl@freefriends.org>2010-05-21 15:36:37 +0000
commit71810b2e12c199d5fd05a223269388f5d35cf10a (patch)
tree9366b4c50d0480bb93e0589a299b577d2de1d4da /Master/texmf-dist/doc/latex/skeycommand
parenta818412461fe2267a0056ce5ab9a25a0032ea2c4 (diff)
skeycommand 0.2 (20may10)
git-svn-id: svn://tug.org/texlive/trunk@18402 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/skeycommand')
-rw-r--r--Master/texmf-dist/doc/latex/skeycommand/README2
-rw-r--r--Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.pdfbin162439 -> 162771 bytes
-rw-r--r--Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.tex99
3 files changed, 65 insertions, 36 deletions
diff --git a/Master/texmf-dist/doc/latex/skeycommand/README b/Master/texmf-dist/doc/latex/skeycommand/README
index 89b8247d749..ff03feac03f 100644
--- a/Master/texmf-dist/doc/latex/skeycommand/README
+++ b/Master/texmf-dist/doc/latex/skeycommand/README
@@ -1,6 +1,6 @@
%+++++++++++++++++++++++++++++++++++ INTRODUCTION +++++++++++++++++++++++++++++++++++%
% %
-% This is the Readme file for the skeycommand package, version 0.1. %
+% This is the Readme file for the skeycommand package, version 0.2. %
% May 2010 %
% %
% Copyright (c) 2010 Ahmed Musa (a.musa@rocketmail.com). %
diff --git a/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.pdf b/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.pdf
index 4ae71dec09f..694e5c21714 100644
--- a/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.pdf
+++ b/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.tex b/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.tex
index 32f3f96cf66..e2fdedd6c11 100644
--- a/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.tex
+++ b/Master/texmf-dist/doc/latex/skeycommand/skeycommand-guide.tex
@@ -12,7 +12,7 @@
}{%
\titlenote[t1]{The package is available at \url{\@shorttitleurl}.}%
}
-\subtitle{Version 0.1}
+\subtitle{Version 0.2}
\titleurl{http://www.ctan.org/tex-archive/macros/latex/contrib/skeycommand/}
\shorttitleurl{http://www.ctan.org/}
\author{Ahmed Musa\Email{a.musa@rocketmail.com}\\Preston, Lancashire, UK}
@@ -43,8 +43,9 @@
\end{license}
\end{frontmatter}
+\newpage
\frameshade[fillcolor=yellow!20,framecolor=brown,framerule=2pt,framesep=2pt,
- width=1.1\hsize]{\tableofcontents}
+ width=\hsize]{\tableofcontents}
\section{Package options}
\label{sec:pack-options}
@@ -52,9 +53,11 @@
The package has only one option (namely, \acmdm{verbose}) and can be invoked at the time of loading the package or via the \acmd{\skeycommand} macro. The option \fx{verbose} is a boolean, initially set to false (\ie, its complement, \acmdm{silent}, is true by default). Setting \fx{silent} to \fx{false} is tantamount to setting \fx{verbose} to \fx{true}.
\begin{example}
|comm(In style files:)
-\RequirePackage[verbose=true |orr false]{skeycommand}
+\RequirePackage[verbose=true |orr false |orr on |orr off]{skeycommand}
+
|comm(In document files:)
-\usepackage[verbose=true |orr false]{skeycommand}
+\usepackage[verbose=true |orr false |orr on |orr off]{skeycommand}
+
|comm(In all cases:)
\skeycommand{verbose=true |orr false |orr on |orr off}
\end{example}
@@ -67,30 +70,22 @@ If you enter the boolean \fx{verbose} (or \fx{silent}) without value, the value
The user interfaces for defining new key commands and environments are as follows:
\begin{macro}
-\newkeycmd|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-\newkeycmd|redstar|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-
-\renewkeycmd|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-\renewkeycmd|redstar|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-
-\newkeyenviron|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-\newkeyenviron|redstar|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-
-\renewkeyenviron|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
-\renewkeyenviron|redstar|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)]
- [|vang(default1)]{|vang(defn)}
+\newkeycmd|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+\newkeycmd|redstar|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+
+\renewkeycmd|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+\renewkeycmd|redstar|vang(cmd)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+
+\newkeyenviron|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+\newkeyenviron|redstar|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+
+\renewkeyenviron|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
+\renewkeyenviron|redstar|vang(env)<|vang(mprefix)>|:|vang(keyval)|![|vang(narg)][|vang(default1)]{|vang(defn)}
\end{macro}
-Here, \ang{narg} is the number of user arguments, as usual in \fx{\newcommand} and \fx{\newenvironment} (excluding the \ang{keyval} list); \ang{cmd} is the new command sequence; \ang{env} is the new environment name; \ang{mprefix} is the prefix for macros deriving from the defined keys whose values will be used in the new command or environment (this is called the \emph{macro prefix} in the parlance of keys); \ang{keyval} is the key-value list [\eg, (\fx{keya=valuea}, \fx{keyb=valueb})]; \ang{narg} is the number of arguments for the new command or environment (excluding the keys), as you would enter it in \fx{\newcommand} and \fx{\newenvironment}; \ang{default1} is the default value for your optional argument (normally the first argument in \fx{\newcommand} and \fx{\newenvironment}); \ang{defn} is the replacement text (as in \fx{\newcommand} and \fx{\newenvironment}). If you don't supply the optional \ang{mprefix}, the package will use the first three letters of the key command or environment name, excluding the escape character but including an added ``at sign'' (\fx{@}). The aim of default ``at sign'' is to aid the visual separation of key names from macro prefixes.
+Here, \ang{cmd} is the new control sequence; \ang{env} is the new environment name; \ang{mprefix} is the prefix for macros deriving from the defined keys whose values will be used in the new command or environment (this is called the \emph{macro prefix} in the parlance of keys); \ang{keyval} is the key-value list [\eg, (\fx{keya=valuea}, \fx{keyb=valueb})]; \ang{narg} is the number of arguments for the new command or environment (excluding the keys), as you would enter it in \fx{\newcommand} and \fx{\newenvironment}; \ang{default1} is the default value for your optional argument (normally the first argument in \fx{\newcommand} and \fx{\newenvironment}); \ang{defn} is the replacement text (as in \fx{\newcommand} and \fx{\newenvironment}). If you don't supply the optional \ang{mprefix}, the package will use the first three letters of the key command or environment name, excluding the escape character but including an added ``at sign'' (\fx{@}). The aim of default ``at sign'' is to aid the visual separation of key names from macro prefixes.
-Please note the angles surrounding \ang{mprefix}, and the parenthesis surrounding \ang{keyval} in the above syntaxes. The \ang{mprefix} can't be empty (\ie, don't enter \texttt{<>}) because it will be used by the package to build unique names for the macros that will hold the key values. You can choose not to enter anything for \ang{mprefix}, and the package will happily use the default prefix \fx{<xxx@>}, where ``\fx{xxx}'' represents the first three letters of the new command or environment name. Also, \ang{keyval} can't be empty: if it was empty, then we should ask: why use key commands instead of \latex's \fx{\newcommand} and \fx{\newenvironment}?
+Please note the angle bracket surrounding \ang{mprefix}, and the parenthesis surrounding \ang{keyval} in the above syntaxes. The \ang{mprefix} can't be empty (\ie, don't enter \texttt{<>}) because it will be used by the package to build unique names for the macros that will hold the key values. You can choose not to enter anything for \ang{mprefix}, and the package will happily use the default prefix \fx{<xxx@>}, where ``\fx{xxx}'' represents the first three letters of the new command or environment name. Also, \ang{keyval} can't be empty: if it was empty, then we should ask: why use key commands instead of \latex's \fx{\newcommand} and \fx{\newenvironment}?
In \ang{defn}, you refer to your arguments in the normal way. You refer to the values of the keys using macros whose first three characters (after the escape character) are the \ang{mprefix} or, if \ang{mprefix} is not supplied, the first three letters of the declared key command (excluding the escape character). The family name of the keys defined via a key command is the key command name itself (without the escape character). The package uses this internally in developing the keys. The key prefix is always ``KV''. If any of your key values contains parenthesis, simply enclose it in braces, to avoid confusing it with \ang{keyval} list.
@@ -111,7 +106,8 @@ The syntaxes for calling new key commands and environments are as follows:
\end{macro}
where \fx{\cmd} and \fx{env} have been previously defined using key command and key environment. You refer to your arguments using parameter number one \hash{1} onwards, up to a maximum of \hash{8} (yes, \hash{8}, not \hash{9}). Here, \ang{keyval} (including the parenthesis) are optional arguments: you can omit them if you want to use the values of the keys set at key command definition time. Using keys is preferable to using parameters: you don't have to match parameters to arguments and, in principle, there is no limit to the number of keys that are permissible.
-\subsection{Commands and environments with two optional arguments}
+\subsection[Commands with two optional arguments]
+{Commands and environments with two optional arguments}
The \pkg{skeycommand} uses the following macros internally. They can be used to define new commands and environments with two optional arguments. Their philosophy, intent, and use syntaxes differ from those of the \pkgm{twoopt}. They may be useful to some users, although I recommend the use of the above key commands.
@@ -132,7 +128,7 @@ The \pkg{skeycommand} uses the following macros internally. They can be used to
\ang{narg} is the total number of arguments, including the first and second optional arguments.
Where are the second optional arguments here, you might be wondering? The second optional argument is usually empty and doesn't appear at command definition time. The second optional argument isn't the second argument of your command (as in \pkg{twoopt}), but the last. At command invocation, if you don't supply a value for the second optional argument, the command will assume it to be empty. But how do you supply a value for the second optional argument? The next section shows how.
-\subsubsection[Calling commands and environments]
+\subsubsection[Invoking commands and environments]
{Invoking commands and environments with two optional arguments}
The syntaxes for calling commands and environments with two optional arguments are as follows:
@@ -155,11 +151,15 @@ If \ang{2nd optarg} is empty at command or environment invocation, the command o
|makered(\newkeycmd*)\demomacro|:name=Steve,height=1.60m,weight=75kg,
tested=true|![3][Registered]{%
\def\x{#1}\def\y{#2}\def\z{#3}%
- \edef\xxx{\dem@name}%
+ \ifdem@tested
+ \edef\cleared{\dem@name}%
+ \else
+ \let\cleared\relax
+ \fi
}
|comm(|makered(\dem@name) will hold the value supplied for |makered(`name'))
|comm(by the user of \demomacro. |makered(`dem') is from |makered(`demomacro').)
-|comm(Observe the LaTeX-like syntax of this command.)
+|comm(Notice the LaTeX-like syntax of this command.)
|comm(The user doesn't have to bother about the nitty-gritty)
|comm(of key infrastructure.)
@@ -173,8 +173,9 @@ Instead of using the macro \acmd{\uservaluekeys}, you can use the full pointer s
\begin{example}
|makered(\newkeycmd)*\demomacro|:|makered(\uservalue\savevalue|mcolor({)name|mcolor(}))=Steve,
height=1.60m,wieght=75kg,tested=true|![3][Registered]{%
- \def\x{#1}\def\y{#2}\def\z{#3}}%
+ \def\x{#1}\def\y{#2}\def\z{#3}%
\edef\xxx{\dem@name}%
+}
|comm(User now calls the \demomacro macro:)
\demomacro[data1]{data2}{data3}|:name,height=1.55m,wieght=55kg,
@@ -182,9 +183,16 @@ Instead of using the macro \acmd{\uservaluekeys}, you can use the full pointer s
|makered(|tto Error: no value supplied for `name')
\end{example}
-Now you can use \fx{\demomacro}. If you don't supply a key-value pair here, the macro will use the above defaults:
+You can use the saved value of key \fx{name} within \fx{\demomacro}. Suppose, oddly, that the key \fx{height} can use the value of the key \fx{name}, then we can do
+
\begin{example}
-\demomacro[data1]{data2}{data3}|:name=John,height=1.55m,
+\demomacro[data1]{data2}{data3}|:name=John,
+ height=|makered(\usevalue){|mcolor(name)},wieght=55kg,tested=true|!
+\end{example}
+
+If in \fx{\demomacro} you don't supply a key-value pair, the macro will use the above defaults:
+\begin{example}
+\demomacro[data1]{data2}{data3}|:name=John,|comm(|makered(height) missing here.)
weight=55kg,tested=true|!
\end{example}
@@ -198,8 +206,8 @@ Now you can use \fx{\demomacro}. If you don't supply a key-value pair here, the
}
\begin{document}
-\firstmacro[1]{-2}{-3}{-4}{-5}{-6}{-7}{-8}
- |:name=John {|:Winne|!}r,height=1.54m|!
+\firstmacro[1]{-2}{-3}{-4}{-5}{-6}{-7}{-8}%
+ |:name=John {|:Winner|!},height=1.54m|!
\end{document}
\end{example}
@@ -234,9 +242,11 @@ Now you can use \fx{\demomacro}. If you don't supply a key-value pair here, the
men, foreigners who, after having committed some grievous
error, can easily disappear and return to their own country.}
\def\hieronymus{HIERONYMUS HORNSCHUCH |:1608|!}
+\def\@elgar{If I write
|comm(The macros \@barbara, \barbara, etc. are just shorthands:)
-|comm(you can enter their contents directly in key commands.)
+|comm(you can enter their contents directly in key commands,)
+|comm(as we shall see later.)
|makered(\newkeyenviron){Quote}<mp@>|:leftmargin=\leftmargin,
rightmargin=\rightmargin,mode=false,whoby=\null,
@@ -264,6 +274,25 @@ Now you can use \fx{\demomacro}. If you don't supply a key-value pair here, the
whoby=\hieronymus,source={The \TeX Book}|!
{\ifmp@mode\color{red}\else\color{blue}\fi\@hieronymus}
\end{Quote}
+
+\lipsum[1]
+\begin{Quote}|:leftmargin=40pt,rightmargin=40pt,mode=false,
+ whoby={Edward Elgar},source={Letter to A.\ J.\ Jaeger |:1898|!}|!
+ {\ifmp@mode\color{red}\else\color{blue}\fi
+ If I write a tune you all say it's commonplace---if I
+ don't, you all say it's rot.%
+ }%
+\end{Quote}
+
+\begin{Quote}|:leftmargin=40pt,rightmargin=40pt,mode=false,
+ whoby={Albert Einstein},source={The World As I See It}|!
+ {\ifmp@mode\color{red}\else\color{blue}\fi
+ If you want to find out anything from the theoretical physicists
+ about the methods they use, I advise you to stick closely to
+ one principle: don't listen to their words, fix your attention
+ on their deeds.%
+ }%
+\end{Quote}
\end{example}
\begin{example}