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

learn more… | top users | synonyms

4
votes
1answer
141 views

How to hijack a key assignment to raise an event that triggers its event handler?

Whenever I invoke \degrees the definition of operator au (angle unit) will be updated. It is easily done by redefining the \degrees with \let and \renewcommand. So far so good. Now I want to create ...
5
votes
1answer
125 views

How to pass comma in value of a (xkeyval) comma separated list of values at \documentclass level?

At \usepackage level, xkeyval allows us to insert commas in value of a comma separated list of values: it is enough to enclose in braces the values containing commas. For instance, the following MCE ...
10
votes
1answer
107 views

How to dynamically give key names with expl3?

I have a property list which associate names with values name 1 -> value 1 name 2 -> value 2 ... I want to use names from the property list to dynamically create keys. The following code ...
5
votes
1answer
78 views

How to choose between arguments and keys when defining a macro

I would like to know if there are guidelines for package writers regarding the interface preferred for passing arguments to macros. Suppose I am writing a package for typesetting a titlepage. There ...
4
votes
2answers
136 views

Keyword command parameters with table (tabular)

I am trying to make a command with named (key-value) parameters to produce a table row. The reason is that table has more than 9 columns (command parameters) that will have position changed, be ...
1
vote
2answers
2k views

package keyval error: compat2 undefined

I am using MiKTeX 2.9, geometry v5.6. I am getting the following error package keyval error: compat2 undefined. The LaTeX code is attached here: \documentclass[phD,synopsis,a4paper]{iitmdiss} ...
4
votes
0answers
92 views

Difficulty getting pgfkeys to set my fontsizes as I want

I apologize that this isn't particularly short. I'm going through old code and refactoring. In the process, I'm running into various bugs in how I've written things. In this particular example, the ...
18
votes
2answers
346 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 ...
8
votes
2answers
127 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 ...
10
votes
1answer
136 views

What are best practices when augmenting and building on the keys provided by someone else's package

The situation is one where I'm developing my own commands and environments which build on the commands and environments provided by another package: for ease of talking let's call this other package ...
4
votes
3answers
2k views

DeclareDocumentEnvironment: missing control sequence inserted — \inaccessible

I'm setting up a skeleton CV package for a friend for him to customize, and I'd like to make it as user-friendly as possible. To effect this, I'm using keyval and xparse. ...
5
votes
2answers
157 views

Can I refer to key value in general code?

Related: keyreader: How to save choice key value to a macro. I’m using l3keys2e, but I suspect this might not be the ideal way to go about what I’m trying to do. I’m building a private package ...
7
votes
2answers
221 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 ...
8
votes
2answers
541 views

xparse and key value arguments

I'm trying to learn how to do macros. I want to use xparse as it seems the most powerful tool. I also want named arguments, as numbered arguments make me, as a programmer, uncomfortable. I had some ...
4
votes
2answers
89 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
59 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} ...
10
votes
2answers
2k 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 ...
3
votes
1answer
149 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 ...
11
votes
2answers
408 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} ...
10
votes
1answer
134 views

Expandable, very specific keyval processing

I am having a hard time trying to come up with an fully expandable keyval parsing macro which deals only with specific keys/values. I wouldn't even attempt this in full generality, that's way beyond ...
3
votes
1answer
74 views

Add key for new Listings environment

I'm trying to add a new key to a custom listings environment. I have tried to modify this example. My problem is that the value I am attempting to pass through in the document for the key does not ...
1
vote
1answer
140 views

How to expand keyval options immediately

I am trying to build up a macro that creates other macros depending on kvoptions' options. But then, the outcoming macros are dependent on the actual state of the options instead of their state at the ...
9
votes
2answers
817 views

Pass named arguments to macro

I notice that includegraphics takes what seems to be named arguments: \includegraphics[width=50,height=25,trim=1 2 3 4,clip]{an_img.png} I'd like to wrap a number of my includegraphics calls in a ...
7
votes
1answer
179 views

Forcing macro expansion with keyval

While trying to provide an answer to this question, I've run into a stumbling block that I can't seem to get over. The listings package (like many others) uses keyval to handle configuration. What ...
5
votes
1answer
126 views

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 ...
2
votes
1answer
193 views

xkeyval's \presetkeys

Please is there a way to avoid xkeyval package bombing out in endless loop, as implied by the following simplified case? \documentclass{article} \usepackage{xkeyval} \makeatletter ...
3
votes
1answer
221 views

Filter exercises according to their difficulty

This is somehow a follow-up question after this question. I came across this problem when writing the answer, but I was wrong when I thought I would easily be able to get this to work later. Shame. ...
3
votes
1answer
273 views

How to define package options in a command (for reuse)?

I need some options of the listings package several times in my document. I am thus wondering if one can define (and later change) these options once somewhere in the preamble via a command/macro, for ...
1
vote
0answers
53 views

How can I pass class/package options with spaces in values? [duplicate]

Possible Duplicate: Spaces in pfgopts options I have read Joseph Wright's excellent article on key-value systems, as well as questions on this site about how to pass arguments to class ...
8
votes
2answers
273 views

Filtering options with pgfkeys

I am looking for an example of how to get pgfkeys to split a list of options so that: (1) some of the options are processed now, and (2) the rest of the options are passed to a second macro for ...
7
votes
1answer
231 views

Choice keys and exception handling

Recently, I switched a self-written "bundle package" from using xkeyval to keyreader. One reason for this, beside the backward compatibility, was that the definition of keys is more convenient in ...
3
votes
1answer
721 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 ...
8
votes
3answers
187 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 ...
8
votes
2answers
199 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? ...
21
votes
4answers
382 views

Does the order of specified key-values matter?

The following screen shot shows how the order of specified key-values affects the output. When using dx=\psPiH,xunit=\psPi. When using xunit=\psPi,dx=\psPiH. Minimal Working Example ...
3
votes
1answer
307 views

Extract key-value pairs from a string

I want to extract key value pairs from a string. I need this to define a new glossary style and want to pass some additional information through a existing parameter. \newglossarystyle{meinglossar}{% ...
2
votes
1answer
475 views

newcommand key value

This is a completely noob question for LaTeX package writers. Could somebody share a piece of code or a MWE for the following situation. I would like to define a newcommand which will depend on the ...
7
votes
3answers
497 views

How to define a key=value that has an equivalent boolean value key

Assume you're defining a key=value align for some environment realign that you'll use in the following way: \usepackage{xkeyval}% http://ctan.org/pkg/xkeyval \newenvironment{realign}[1][] ...
9
votes
2answers
264 views

Key Value option in package

I trying to write a package, and I'd like to specify whether there should be colour or not. I'd like to do: \usepackage[color=false]{foo} and have this set \RequirePackage[color=false]{hyperref} ...
17
votes
2answers
467 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?
4
votes
1answer
227 views

Iterate over all defined PGF keys

Is there a way to iterate over all PGF keys that have been defined previously? My idea is to capture the value of all keys in order to do Proper nesting of tikzpicture environments: Reset all PGF ...
7
votes
1answer
885 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} ...
4
votes
1answer
70 views

How to make xkvview record keyreader defined keys?

Since keyreader is based on xkeyval i wonder if it’s possible to make it wokr with xkvview which comes with xkeyval. \documentclass{scrartcl} \usepackage{xkvview} \usepackage{keyreader} ...
2
votes
1answer
74 views

How to encapsulate a package to rename keys defined in it?

I use pst-eucl package and I am not so happy with the names defined for its keys (because the names are difficult to remember). I want to rename some of the keys for my own purpose by creating a new ...
4
votes
2answers
1k views

Environment in \NewEnviron style, with key-value parameters

I want to define an environment that read its content before processing (like \newEnviron from the package environ) but also that allows key-value parameters (like \newkeyenvironment from the package ...
3
votes
3answers
150 views

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} ...
1
vote
1answer
293 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
47 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]------\/ ...
6
votes
2answers
158 views

Writing a macro with parameters

I'm trying to write a macro which should be able to do several different yet somewhat similar things. I thought that instead of writing different macros for every thing, I should be able to write just ...
2
votes
1answer
189 views

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 ...