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

learn more… | top users | synonyms

47
votes
4answers
3k views

How to create a command with key values?

I am trying to create a command that the user can enter keys for values. How can I create one, for example: \myparbox[width=50,height=10,color=blue, align=left -10px]{}
43
votes
17answers
3k views

A big list of every keyval package

I lose track of all the different keyval packages. Can we maintain a list here? (Community wiki, one package per answer with a brief description of scope. I've started things off but need help ...
27
votes
1answer
3k views

How can I make a package that accepts an optional argument?

I am writing a package that has a bunch of values that are going to be the same most of the time, but that I might want to change in select cases. I want to do this by giving this package an optional ...
15
votes
3answers
3k views

A package template using xkeyval?

I would like to write a package offering a number of commands. The package should accept options, and some of these options should be available as command options. Usage should be as follows: ... ...
7
votes
2answers
2k views

How to control enumitem's description list via leftmargin and labelwidth keys

I am trying to learn how to use enumitem's keys to adjust a description list. In this case, I would like to have my list items and description text both left aligned, but the description text should ...
9
votes
2answers
1k views

Simple example of pgfkeys

I'm struggling to get my head around the pgfkeys package. I currently use the keycommand package, which I find very easy to understand: it's just ordinary LaTeX commands with named rather than ...
17
votes
2answers
291 views

When to use a regular .initial key or a .store in key?

The excellent pgfkeys package provides, among others, two kinds of keys: regular "value-centric" keys that can be declared with /.initial, and "macro-centric" keys are declared with /.store in. Here ...
17
votes
2answers
241 views

Can I turn a collection of optional parameters into a macro?

I currently have several environments from mdframed that have a large number of options that are shared between them. The situation looks like \newmdtheoremenv[options0,options1]{env1}{Environment 1} ...
4
votes
1answer
186 views

How do I use \ifcommandkey , or how do I check if a key was given?

I'm trying to create a keycommand with optional arguments, but I can't get it to work. I looked at Comparing an argument to a string when argument is a result of a command with etoolbox and although ...
8
votes
3answers
866 views

How to write a class that accepts an optional key-value pair?

a user-defined class: \ProvidesClass{preview}[2012/12/15 v 0.01 class for creating a tight PSTricks diagram] \DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}} \ProcessOptions\relax ...
6
votes
2answers
1k views

TikZ: Track the bounding rectangle of created nodes (Storing values?)

In the main part of the tikzpicture I'd like to simply create blocks. So I need somewhere in theirs' style definition to perform tracking of their common bounding rectangle. I've tried to access ...
8
votes
2answers
193 views

How to pass a macro as a value for a key?

I want to pass a macro to a showgrid key. The macro can be redefined later. Its possible values are top, bottom, false, true. The following MWE produces a blank page. How to fix it? ...
7
votes
1answer
184 views

Reading - and effect - of (default) tikz/pgf keys?

Consider the following MWE: \documentclass[varwidth,tightpage,border=1bp]{standalone} \usepackage{tikz} \pagecolor{yellow!15} % ignored with preview, but not w/ varwidth \begin{document} ...
14
votes
2answers
392 views

PGF Keys differences between .initial and .default

I am not too sure just by reading the manual as to the subtle differences between the .initial and .default PGF key types. Can someone explain and demonstrate the differences with a minimal example?
11
votes
2answers
308 views

How can I define a new minted environment with optional arguments?

I have the following mwe: % arara: pdflatex: { shell: true } % arara: pdflatex: { shell: true } \documentclass{article} \usepackage{minted} \usepackage{listings} \usepackage{caption} ...
8
votes
3answers
226 views

How to use named variables with one environment

Just after there is one code which has been proposed to me in this site. Instead of using \begin{MyFrame}[1.5cm][2pt][1.3cm][blue][2][8ex], I would like to use something more friendly like ...
3
votes
1answer
128 views

Passing arguments to a .sty-file - a specific case

After having plowed through (i.e. read and trimmed down the given examples in an attempt to apply them to my case) these documentations and guides: Implementing key-value input: An introduction The ...
3
votes
1answer
589 views

beamerposter custom style with keyval definition

I'm creating a beamerposter style accordingly to my department specification. I would like to create a theme where the definitions of the blocks can vary accordingly to a keyword in the calling of the ...
6
votes
1answer
751 views

Using a macro as value of addtotoc in \includepdf

I would like to include pages from an external PDF file into my document, using the pdfpages package. The following works for me: \documentclass{article} \usepackage{pdfpages} \begin{document} ...
10
votes
1answer
2k views

Use \setkeys{Gin} to set default scale value doesn’t work

I’d like to make all my graphic a little smaller and tried to set the scale-value of \includegraphics globally with \setkeys{Gin} but while changing width works fine scale has no effect. ...
9
votes
1answer
125 views

xkvltxp gives keyval error in case of biblatex's options on multiple lines

A keyval error arises if both: xkvltxp is loaded biblatex is loaded with options on multiple lines. The following MWE shows this strange behavior: \documentclass{article} % \usepackage{xkvltxp} ...
8
votes
2answers
121 views

Is there a way to define starred variants for a keyvalue system?

I've created an environment for which various parameters are set through key values. Instead of creating a hornet's nest of various booleans, I would just like to have a slight variant form for some ...
8
votes
3answers
183 views

More complicated key definitions in loops/for each statements

While writing a package with a key-value interface, I had a lot of repetitive key definitions. Naturally, one would like to express these definitions with a loop. When the definition contains ...
7
votes
2answers
139 views

Generate l3keys meta key from subkey

I’ve created a simple package with options settable via l3keys2e. I was able to figure out how to make the syntax \usepackage[format = international]{phone} work, but I’d like to make the syntax ...
7
votes
1answer
436 views

How to access the value of a biblatex package option/key

Is it possible to access a value which is given as a bibliography option. For example if I have \usepackage[somekey=foobar]{biblatex} can I get the value (foobar) of somekey as a macro like ...
6
votes
1answer
89 views

Use choice key with choices setting booleans

When defining choice keys with l3keys2e there are two possible ways and I use the one with sub-keys in a new package. When defining watch each value should do interface3.pdf says that I can use .code ...
4
votes
2answers
83 views

Optional argument not getting set to \makebox through expl3 key assignment

The basic idea that I wanted was to create a key to pass a value that would inform \makebox how the contents of the box should be aligned. Big fail here. The intended contents of the \makebox are ...
4
votes
1answer
56 views

Bad interaction between keycommand and environ?

I suspect the keycommand and environ packages are not playing nicely together, because the following code gives an error. Can anybody explain what's going on? \documentclass{article} ...
4
votes
2answers
369 views

Pass several comma separated TikZ options to a single keyval key

I'm still improving my answer to Need help creating a 3D cube from a 2D set of nodes in TikZ. One of the options should be to emphasize the edges of the cuboid. This would mean e.g. \draw[red, very ...
2
votes
2answers
124 views

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 define \RequirePackage{mylistings} ...
1
vote
1answer
266 views

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 ...
1
vote
1answer
43 views

kprefix in \krddefinekeys seems to be not optional

Maybe I misunderstood something but the following example doesn’t compile with out a optional argument defining the kprefix \documentclass{article} \usepackage{keyreader} % [KV]------\/ ...