Questions tagged [key-value]

{key-value} is about packages and macros using the key=value syntax for named parameters instead of numbered parameters.

is about packages and macros using the key=value syntax for named parameters instead of numbered parameters.

A common package used to define these parameterized inputs is keyval and/or xkeyval. However, other packages providing similar functionality also exists. See, for example, How to create a command with key values?.

272 questions
7
votes
1 answer

How to convert the method to a key-value version?

I have been told a number of times now, that I should consider implementing a key-value version of my method \createPerson. I wan't to do this, but my problem is that I don't know how to go on with it. Could you help me get started and explain how…
7heViking
  • 1,183
6
votes
2 answers

How can you force keys to display in a certain order?

I am building a catalog of items and would like to ensure that my fields always display in a certain order (for the sakes of argument lets us say in the order "Intentory Number, Weight, Diameter" even if I am entering the data in a different order.…
5
votes
2 answers

Keycommand package - \commandkey{mykey} doesn't expand

UPDATED, see edit history for completeness I'm trying out the keycommand package but it's not working as expected. There seems to be some incompatibility with tables, but I've read and re-read the documentation and I can't figure out what it…
Tomas Aschan
  • 15,528
4
votes
1 answer

Pass variable as a parameter in \newgeometry

I have defined the following variable storing my margin settings: \def \geometryTitlepage { left=25mm, right=25mm, top=25mm, bottom=25mm } Then in the titlepage I want to set \newgeometry \begin{titlepage} \newgeometry{ …
Humberd
  • 143
4
votes
1 answer

When are {} needed to surround a string in a keyval pair

I am using the package kvoptions and declaring various stringoption's. When do you need to embrace a string value when calling your package/class? E.g. In mypackage: \DeclareStringOption[defaultval]{abc}[defaultval] In calling…
3
votes
1 answer

How to use keyval option processing

I'm trying to make a command/environments with a view key value options similar to many other popular packages. I found description on how to use key value but the examples don't work. Anyway can help to make a minimal key-value configured command…
Luman75
  • 225
3
votes
3 answers

Set font with keyreader as package option

Im developing a package an use keyreader to define it’s options, but I fail to set a font as an option. \begin{filecontents}{myfonts.sty} \ProvidesPackage{myfonts} \usepackage{keyreader} \krddefinekeys[TW]{fam}[my]{% …
Tobi
  • 56,353
3
votes
1 answer

The definition of key default value by keyval package

For a key keya defined by \define@key{fam}{keya}[\def\y#1{#1}]{\def\x##1{##1x#1}} the keyval package uses \def\KV@def#1#2[#3]#4{% \begingroup\toks@{#3}% \xdef\@gtempa{\expandafter\noexpand\csname KV@#1@#2\endcsname{\the\toks@}}% \endgroup …
Ahmed Musa
  • 11,742
2
votes
2 answers

How to assign a key of a package a key value of another package?

Scenario 1 Actually I can do like this: In mylistings.sty, I define \def\tabsize{3} \RequirePackage{listings} \lstset{tabsize=\tabsize} and in mytable.sty, I…
Display Name
  • 46,933
2
votes
1 answer

Processing key/value options with many non-predefined keys

Say I want to define a command \defineaspect that takes a key/value option list to associate values with keys that are not known in advance. For example, to associate certain aspects with a list of persons, a use of that command might look…
siracusa
  • 13,411
2
votes
1 answer

pgfkeys-values only in list of possible values

In the following example, the key formatting has the initial default value apmep. \pgfkeys{ /test/.is family, /test, formatting/.initial = apmep } I would also like that the value of the key formatting can only belong to the set of values…
projetmbc
  • 13,315
1
vote
2 answers

What is the most general form of key-value pairs for options?

Strange question I know. I know that it is possible to have options, to be more precise option keys, consisting of letters, but there seem to be possible more. some option keys seem to have a value attached in the form key=value but I cannot figure…
1
vote
1 answer

\SetKeys (ltkeys): property '.default' is unknown?

Reading 'source2e.dtx' suggests that the 'l3keys' property '.default' should be available. The following MWE doesn't work as I expected…
Daniel Flipo
  • 2,059
1
vote
3 answers

keyval: pass unknown options to a command

Consider the following MWE: \documentclass[a4paper]{article} \usepackage{keyval} \makeatletter \define@key{my}{foo}[]{foo is enabled\par} \define@key{my}{bar}[0]{bar is set to #1\par} \makeatother \newcommand{\somecommand}[2][none]{arg 1: #1, arg…
T. Pluess
  • 1,040
1
vote
1 answer

keyreader: How to save choice key value to a macro

Why does a choice key not save it’s value to a macro as a cmd key and as the corresponding xkeyval \define@choicekey do? In the following example I have to define my@key manually by using the…
Tobi
  • 56,353
1
2