Discussion:
Keyval and its variants -- making them accessible to the mere LaTeX users
(too old to reply)
Dave94705
2017-09-14 23:26:30 UTC
Permalink
Raw Message
I am posting to suggest a substantial amount of work for someone else; however, my suggestion, while self-serving, is not as selfish as it may appear at first:

It would be very helpful to a large part of the (La)TeX community if someone could write a package making Keyval or something reasonably like it easy to implement in basic, user defined macros. Or getting as close to that as reasonably practical.

Almost 10 years ago https://groups.google.com/forum/#!searchin/comp.text.tex/keyval%7Csort:relevance/comp.text.tex/iCekhYvT7UM/NiddXGRk25AJ
asked about making the documentation more readable/accessible. There was interest, talk, and some useful references, but as far as I can tell most non-programmers (types) would still say the documentation is "Greek to me." Even if you do master the documentation, implementing Keyval and its variants seems way too long winded than needed for 90% of basic uses.

If a package could be written to easily create a value family given a list of names and their default values (unless required) which can then be used within the document's own macros that would make macro programming much, much easier and readable for us mere mortals.

An example might be something like:

\CreateKeyvalList[myNamesAndAddresses,{name, {weight,"N/A"}, streetAddress, {town, "South Lake Tahoe"},{state, California}, {zip,"N/A"}}]

which would create the family of names myNamesAndAddresses. name would be required to be set/inputted as would streetAddress. The {} entries are names and their default values.

Then a user macro would refer to myNamesAndAddresses when called and load default and inputs. Something like Glossaries' \gls command could be used within the macro to refer to name, weight, etc.

I realize it is likely very clear to people who are capable of doing what I am suggesting that I am going about it the wrong way, but I want to give enough of a simple minded explanation that at least my objective is clear.

Have a nice day. ds
Ulrike Fischer
2017-09-15 10:44:49 UTC
Permalink
Raw Message
Post by Dave94705
It would be very helpful to a large part of the (La)TeX community
if someone could write a package making Keyval or something
reasonably like it easy to implement in basic, user defined
macros.
The last thing imho that it is needed is another keyval-package.

There exist already packages that can be used on the user level,
e.g. pgfkeys, options, simplekv, keycommand and more. See
https://ctan.org/topic/keyval

And while in packages like keyval, xkeyval or the l3keys from expl3
the command names contains special chars like "@" an ":" none of
these systems is very difficult to use. Basically you always have to
define the keys, to set the keys and to use the result.
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Axel Berger
2017-09-15 12:38:17 UTC
Permalink
Raw Message
Post by Ulrike Fischer
Basically you always have to
define the keys, to set the keys and to use the result.
Can you recommend a good introductory manual? So far I have always shied
away from using keyval in spite of the obvious and undoubted advantages.
--
/¯\ No | Dipl.-Ing. F. Axel Berger Tel: +49/ 221/ 7771 8067
\ / HTML | Roald-Amundsen-Straße 2a Fax: +49/ 221/ 7771 8069
 X in | D-50829 Köln-Ossendorf http://berger-odenthal.de
/ \ Mail | -- No unannounced, large, binary attachments, please! --
Ulrike Fischer
2017-09-15 13:49:14 UTC
Permalink
Raw Message
Post by Axel Berger
Post by Ulrike Fischer
Basically you always have to
define the keys, to set the keys and to use the result.
Can you recommend a good introductory manual?
You can look at
http://www.tug.org/tugboat/tb30-1/tb94wright-keyval.pdf.
But every documentation of one of the keyval packages I mentioned
is ok too. There is absolutly no magic here, the basic idea is easy
to understand and use. It's when you have a lot of keys and e.g.
want to order them that the details can get complicated.

\documentclass{article}
\usepackage{keyval}

\begin{document}
\makeatletter
Define:
\***@key{UFkeys}{store}{\def\UFstored{#1}}
\***@key{UFkeys}{print}{-- #1 --}

Set: \setkeys{UFkeys}{store=ABC}

Use: \UFstored

Set: \setkeys{UFkeys}{store=Bla,print=Hello Welt}

Use: \UFstored
\end{document}
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Dave94705
2017-09-15 22:18:54 UTC
Permalink
Raw Message
Post by Ulrike Fischer
Post by Dave94705
It would be very helpful to a large part of the (La)TeX community
if someone could write a package making Keyval or something
reasonably like it easy to implement in basic, user defined
macros.
The last thing imho that it is needed is another keyval-package.
There exist already packages that can be used on the user level,
e.g. pgfkeys, options, simplekv, keycommand and more. See
https://ctan.org/topic/keyval
And while in packages like keyval, xkeyval or the l3keys from expl3
these systems is very difficult to use. Basically you always have to
define the keys, to set the keys and to use the result.
--
Ulrike Fischer
http://www.troubleshooting-tex.de/
Thank you very much for the info link. the keycommand package appears to solve the problem I posted about. I appreciate your help and efforts.
Loading...