summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/latex/conv-xkv
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2016-12-20 22:56:32 +0000
committerKarl Berry <karl@freefriends.org>2016-12-20 22:56:32 +0000
commit7db88bf8a9b681417a440914e376013b13457d13 (patch)
treef0820593c9c19134730515c4589cc814dd2792e8 /Master/texmf-dist/doc/latex/conv-xkv
parente2419228ad39462619bd7051753e7125ca5ca626 (diff)
conv-xkv (20dec16)
git-svn-id: svn://tug.org/texlive/trunk@42757 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/doc/latex/conv-xkv')
-rw-r--r--Master/texmf-dist/doc/latex/conv-xkv/README.md19
-rw-r--r--Master/texmf-dist/doc/latex/conv-xkv/doc/conv-xkv.pdfbin0 -> 83223 bytes
-rw-r--r--Master/texmf-dist/doc/latex/conv-xkv/examples/convert2xkeyval.tex119
3 files changed, 138 insertions, 0 deletions
diff --git a/Master/texmf-dist/doc/latex/conv-xkv/README.md b/Master/texmf-dist/doc/latex/conv-xkv/README.md
new file mode 100644
index 00000000000..634bf0bfee8
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/conv-xkv/README.md
@@ -0,0 +1,19 @@
+The conv-xkv Package
+Author: D. P. Story
+Dated: 2016/12/20
+
+This small package supports key-value syntax other than the standard latex
+syntax of <key>=<value>. Using this package, create key-values of the form
+<key>:<value> or <key>-><value>, for example. The package converts the new
+notation to xkeyval notation and passes it on to xkeyval.
+
+Please test and give feedback.
+
+Enjoy.
+
+D. P. Story
+www.acrotex.net
+dpstory@uakron.edu
+dpstory@acrotex.net
+
+
diff --git a/Master/texmf-dist/doc/latex/conv-xkv/doc/conv-xkv.pdf b/Master/texmf-dist/doc/latex/conv-xkv/doc/conv-xkv.pdf
new file mode 100644
index 00000000000..3b7c4722706
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/conv-xkv/doc/conv-xkv.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/conv-xkv/examples/convert2xkeyval.tex b/Master/texmf-dist/doc/latex/conv-xkv/examples/convert2xkeyval.tex
new file mode 100644
index 00000000000..04a2cd1d9c5
--- /dev/null
+++ b/Master/texmf-dist/doc/latex/conv-xkv/examples/convert2xkeyval.tex
@@ -0,0 +1,119 @@
+\documentclass{article}
+\usepackage{conv-xkv}
+\usepackage{fancyvrb}
+
+% Use ordinary askii characters to declare a delimiter, usually
+% the delimiter is some combination of special characters: !@#:%^&*()_+=
+\DeclareDelimiter{arrow}{->}
+% The colon delimiter is already defined, and need not be declared
+%\DeclareDelimiter{colon}{:}
+
+% formatting cmd
+\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}}
+
+\makeatletter
+\define@key{dps}{fname}[]{\def\fname{#1}}
+\define@key{dps}{mname}[]{\def\mname{#1}}
+\define@key{dps}{lname}[]{\def\lname{#1}}
+\define@choicekey{dps}{favorite}{AeB, AeB Pro, conv-xkv}[AeB]{\def\favoritepkg{#1}}
+\define@key{kaf}{home}[]{\def\myhome{#1}}
+\makeatother
+
+% Process keys using the arrow delimiter
+\def\setName#1{\cxkvsetkeys[arrow]{dps,kaf}{#1}}
+% we use the default delimiter, colon (:)
+\def\setOtherName#1{\cxkvsetkeys{dps}{#1}}
+% we define the dps family for xkeyval
+\def\setStandName#1{\setkeys{dps}{#1}}
+
+\let\pkg\textsf
+\newcommand{\cs}[1]{\texttt{\char`\\#1}}
+\def\newtopic{\par\medskip}
+
+\parindent0pt
+
+\begin{document}
+
+In the preamble, we declare \verb~\DeclareDelimiter{arrow}{->}~.
+
+\newtopic
+The \pkg{conv-xkv} package converts key-values with alternate key-value delimiter
+to a form the \pkg{xkeyval} package expects them to be in.
+
+\setName {
+ fname-> D.,
+ mname-> P.,
+ lname-> Story,
+ favorite-> conv-xkv,
+ home-> {Niceville, FL}
+}
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\def\setName#1{\cxkvsetkeys[arrow]{dps,kaf}{#1}}
+\setName {
+ fname-> D.,
+ mname-> P.,
+ lname-> Story,
+ favorite-> conv-xkv,
+ home-> {Niceville, FL}
+}
+\end{Verbatim}
+The script above converts the notation \texttt{\ameta{key}\usekvdelim{arrow}\ameta{value}} to
+the notation of \pkg{xkeyval}, \texttt{\ameta{key}=\ameta{value}}. It is then passed to the
+\cs{setkeys} command of \pkg{xkeyval}.
+
+\newtopic\textbf{Results:}
+My name is {\fname} {\mname} {\lname} and my favorite {\LaTeX} package is
+\textsf{\favoritepkg}, my home is \myhome.
+
+\setOtherName {
+ fname: D.,
+ mname: Paul,
+ lname: Story,
+ favorite % use default
+}
+
+\newtopic Now we use the colon (:) delimiter:
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\def\setOtherName#1{\cxkvsetkeys{dps}{#1}}
+\setOtherName {
+ fname: D.,
+ mname: Paul,
+ lname: Story,
+ favorite % use default
+}
+\end{Verbatim}
+The script above converts the colon notation \texttt{\ameta{key}\usekvdelim{colon}\ameta{value}} to
+the notation of \pkg{xkeyval}, \texttt{\ameta{key}=\ameta{value}}. This enables the implementation of
+\pkg{xkeyval} in packages that want to use object-property notation. Other variations are
+possible.
+
+\newtopic\textbf{Results:}
+My name is {\fname} {\mname} {\lname} and my favorite {\LaTeX} package is
+\textsf{\favoritepkg}.
+
+\newtopic
+Now here are the same results using the \pkg{xkeyval} package with the key-value delimiter
+\texttt{\ameta{key}=\ameta{value}} to verify that nothing has been disturbed.
+
+\setStandName {
+ fname= Don,
+ mname= Paulo,
+ lname= Story,
+ favorite
+}
+\begin{Verbatim}[xleftmargin=\leftmargini,fontsize=\small]
+\def\setStandName#1{\setkeys{dps}{#1}}
+\setStandName {
+ fname=Don,
+ mname=Paulo,
+ lname=Story,
+ favorite
+}
+\end{Verbatim}
+\textbf{Results:}
+My name is {\fname} {\mname} {\lname} and my favorite {\LaTeX} package is
+\textsf{\favoritepkg}.
+
+
+\end{document}
+