Questions tagged [key-value]
{key-value} is about packages and macros using the key=value syntax for named parameters instead of numbered parameters.
258
questions
7
votes
2
answers
137
views
l3keys equivalent of pgfkeys' .code 2 args
What is the recommended way to emulate pgfkeys' /.code 2 args (or more generally /.code n args) handler with l3keys? For example, with pgfkeys one can do
\documentclass{article}
\usepackage{pgfkeys}
...
1
vote
1
answer
60
views
Strict version of \keys_set_groups:nnn
Here's a little code where the key-value allowed by the macro is an unwanted feature : for example, single[both = OK, only = KO] doesn't give any error as I'd hoped. But on the other hand, I would ...
2
votes
1
answer
25
views
Setting beamer label from xparse option
I want to write a custom environment that handles some layouts that default beamer slides aren't designed to do.
I use xparse's \NewDocumentEnvironment to achieve this, but have problems passing down ...
4
votes
1
answer
42
views
key property .notif is unknown
Following the example in The LaTeX Companion, 3rd edition, Part II, page 700, I'm trying the following .sty file and .tex file that loads it, but I get error:
./myfont.sty:8: LaTeX Error: The key ...
5
votes
4
answers
156
views
Passing macro parameters with \DeclareKeys/\SetKeys
Just as an exercise I'm trying to make a keyval interface to amsthm's \newtheoremstyle in the manner of thmtools, but using the kernel's \DeclareKeys instead of keyval and kvsetkeys. Every argument of ...
0
votes
1
answer
38
views
Multilange support - need some help in xkeyval
I'm trying to do some improvements in the multiaudience package. In particular, I would like to have one latex document containing multiple languages.
For simplification reasons the texts of the ...
1
vote
2
answers
133
views
Good practice with \DeclareKeys
I'm trying to make a "one-off" theorem environment for theorems with custom names that shouldn't be numbered at all. The goal is to copy the behavior of thmtools
\declaretheorem[thmbox=M]{...
1
vote
0
answers
94
views
Use of xparse macro and expl3 key-value pairs
I'm trying to set up a family of key-pairs to be used in a \NewDocumentCommand. The goal is to have a function with two key-pairs. I want to be able to get the values of the two keys within the macro, ...
1
vote
1
answer
76
views
Using \DeclareKeys as a document author/designer
Say I want to use a package using l3keys for it options, e.g. I want to print numbers using siunitx's \num. I load it with my desired default options (e.g. just \usepackage{siunitx}) but have a ...
1
vote
1
answer
47
views
How to find out available key-value pair for CircuiTikZ
I'm using CircuiTikZ and I came across this issue frequently: every time I want to tweak some options using tikzset, there is no documentation for the available key-value pairs.
For example, if I want ...
1
vote
1
answer
49
views
\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 though:
\documentclass[a4paper]{article}
\usepackage{color}
\...
0
votes
1
answer
41
views
Handling "family=" and "given=" within the "author" field
My zotero+BetterBibTeX has exported some citations like this
@article{abduMagneticDeclinationControl1981,
title = {Magnetic Declination Control of the Equatorial {{F}} Region Dynamo Electric Field ...
0
votes
1
answer
50
views
Can't make a list of keys work
I am trying to make my own chapter-heading formatting command, using a key=value approach:
\coolchap[
chapstyle=<chapter-word formatting>,
titlestyle=<chapter-title formatting>,
befchap=&...
1
vote
2
answers
89
views
Define custom keys for graphicx
I would like to define some shorthand keys for includegraphics[]{} like so:
fullwidth -> width=\textwidth, halfwidth -> width=0.5\textwidth etc.
What is the best approach for this?
0
votes
1
answer
62
views
Loop in a specific list to define class options
I have a class beamer-rl to create beamer presentation for RTL languages (like persian) and I need a way to include RTL language as a class option like this \documentclass[persian]{beamer-rl}
So class ...
2
votes
0
answers
49
views
Options passed to babel with article class and not with beamer
In this example using article class options arabic-ma and provide=* are passed to babel, but when changing to beamer class options are not passed to babel. Is there an explanation?
\documentclass[...
3
votes
2
answers
256
views
Is there a way to reset all l3keys keys to their initial value?
This is a general and documented feature of latex3, but I shall still provide an MWE in order to illustrate the problem, see below.
Suppose I have a function which uses the l3keys key-value interface, ...
1
vote
1
answer
60
views
Pgfkeys associated with macros lead to unexpected results
Consider the following class:
% CLASS
% Preamble
\NeedsTeXFormat{LaTeX2e}[1994/06/01]
\ProvidesClass{myclass}[2022/10/11]
\LoadClass[varwidth]{standalone}
\makeatletter
% Pgfoptions
\RequirePackage{...
0
votes
1
answer
59
views
keyval being picky about empty options
I am trying to automate the generation of beamer handouts, with the help of \pgfpagesuselayout. I want them with 2 slides on 1 page, my colleagues with 4 in landscape orientation. So we generate both ...
0
votes
1
answer
55
views
Split nested and simple comma lists the same way
\documentclass{article}
\usepackage{kvsetkeys,kvdefinekeys}
\makeatletter
\def\Process@Split#1{%
\if@tempswa
\edef\ST@LastName{\comma@entry}%
\typeout{* LastName:\ST@LastName}%
\@...
0
votes
2
answers
86
views
Taking in optional boolean flags in a macro without expl3
I want to create a macro \verticalStep which will produce a vertical skip of fixed length, and take two optional arguments, negative and small.
So for you could use
\verticalStep for a standard ...
3
votes
0
answers
123
views
Unknown options fail to pass with new expl3 method [closed]
Recently I switched my packages to use the new \ProcessKeyOptions method for processing package options. However, I just found out that with
\keys_define:nn { projlib-theorem }
{
...
, ...
1
vote
1
answer
91
views
Is it safe to use \globaldefs for setting global pgf key-value pairs?
With the help of this post (Is there a way to set a *global* key value using `pgfkeys`?), I found a simpler way to implement a solution to my own question (How can I create commands using multiple ...
0
votes
3
answers
117
views
How can I create commands using multiple arguments with pgfkeys in custom environments with tabulars? [duplicate]
I am trying to create my own template package.
In this package, there are several custom environments defined. One of those environments starts and ends a table, i.e:
\newenvironment{customenvtab}{\...
7
votes
3
answers
492
views
How to define new key properties in l3keys
Related Meta Question
From interface3.pdf, we can see l3keys has provided several key properties such as .code:n, .tl_set:N, .usage:n. But I don't know how to define a new key property.
At this time, ...
6
votes
1
answer
338
views
As of 2022, how should one build class/package options without l3keys2e? [duplicate]
In a comment of this question,David Carlisle wrote:
[l3keys2e] should be considerd legacy now, the new built in option code is based on the same core expl3 code but extended and improved so hopefully ...
5
votes
4
answers
221
views
What is the best way to expand macros inside keyval input in expl3
I think LaTeX packages rarely use macros as key names. And some users expect macros inside the keyval input will be expanded recursively first. But l3keys in expl3 doesn't provide this functionality ...
1
vote
2
answers
80
views
pgfkeys strips braces from argument
This is most likely a dupe of
pgfkeys overeager in stripping away my braces
If I pass {[[To]], [[From]]} to a macro as the value of an optional argument using pgfkeys, the outermost bracket is ...
0
votes
1
answer
94
views
How can I define this new math mode environment with comma-separated keyval options?
My MWE using LuaLaTeX:
\documentclass[oneside,DIV=12]{scrbook}
\usepackage{scrhack}
\usepackage[automark]{scrlayer-scrpage}
\usepackage[english]{babel}
\usepackage[babel]{microtype}
\usepackage{...
1
vote
2
answers
62
views
pgfkeys - is choice + value pass to graphicx
I'm trying to implement a macro which is a wrapper over the graphicx \includegraphics command (because I'd like to pass the parameters for cropping in a key-value fashion). While doing so, at first I ...
1
vote
1
answer
74
views
listings lstdefinestyle not work with custom defined command
I defined a new command named '\showLineNo', and used in '\lstdefinestyle', got an error:
Package Listings Error: Numbers none unknown. \lstset{style=customstyleone}
sample code:
\documentclass{...
0
votes
2
answers
47
views
keyval first pair not shown
How to change the following so the name1 and caption1 is also used - not only the second pair of keys:
\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{keyval}
\makeatletter
\define@...
3
votes
1
answer
132
views
How can I parse a clist into a keyval prop?
I'm trying to store a comma-separated list into a key-value property to use it later, but I can't get it to work properly.
I don't really understand how latex parses a keyval parameter but my guess is ...
0
votes
2
answers
200
views
Check if key is set in xkeyval
I am working with the xkeyval package.
Sometimes I want to check by hand if a key is contained in a list of keys.
That is, I want a if-command like the following:
\contains@key{<family>}{<key ...
0
votes
1
answer
233
views
Changing some options in \newgeometry while retaining all others by default
I have a document whose preamble says something in this style:
\RequirePackage[a=3,b=7]{geometry}
Later in the document I want to temporarily change one parameter, i.e., in pseudocode:
\newgeometry{...
1
vote
1
answer
71
views
Class with keyval option consisting of lists of keyval pairs
I'm trying to figure out how to write a class that would allow for a key-value option where the key is called people, which would take a list of grouped key-value pairs (e.g., name, title, and role) ...
2
votes
4
answers
69
views
How to pass the value of a command for a key (xticklabels and yticklabels of an axis environment for pgfplots)
I have a square matrix plot with identical x and y ticks and tick labels, for which I hope to use a pre-defined command to avoid repeating xticklabels and yticklabels with the same value "{A, B, ...
4
votes
2
answers
112
views
Appending a token list keeps referring to it instead of copying
I actually had some workarounds and overcame my issue. But I still cannot understand some points.
I'm trying to write a command to draw a table. I started with this:
\documentclass[10pt]{article}
\...
3
votes
2
answers
274
views
Conditional title in tcolorbox: not equivalent to an untitled box when empty
Consider the following code :
\documentclass[10pt]{article}
\usepackage{ifmtarg}
\usepackage{xcolor-material}
\usepackage[most]{tcolorbox}
\makeatletter
\newcommand{\makeboxtitle}[1]{\@ifmtarg{#1}{}{\...
1
vote
1
answer
85
views
Passing a command as option in pgfkeys
I want to pass a command as an option, so that the command is applied to the argument, something like
\PrintSomething{opt = \makebox[5cm]{\textbf{\sffamily #1}}}{Hello}
which should produce the word ...
1
vote
1
answer
97
views
Get one value from a pgf/tikz style
Considering
\pgfkeys{
A/.style={
key=value,
key2=value2,
}
}
how do I retrieve "value" from "A" and "key"?
After some experiments, next seems to work for at ...
3
votes
1
answer
76
views
Using definitions for key-val arguments
I'm making a \logo command like the \title command used for the title page. By default, I would like to use the graphbox smash key-val arg to be tl. But later on (depending on a users choice, say by ...
3
votes
1
answer
137
views
Getting the package options as a lua string, and allow arbitrary package options
I am making a lualatex-based class, which will be a thin wrapper around a lua library. I would like to use the luakeys package to process my options in lua, and would like to avoid declaring options. ...
2
votes
2
answers
239
views
How to distinguish "no value" from "empty value" when setting `l3keys`?
I'm trying to create an option with l3keys such that, if it receives a value, even if an empty one, it gets added to a property list, but if it receives no value, it gets removed from the property ...
0
votes
1
answer
129
views
Is there an equivalent of datatool's \DTLifhaskey for value?
I'm looking for a way to test if a (non-key) value in a column does exist. I basically want to check if
\DTLfetch{db name}{col1 name}{col1 value}{col2 name}
is giving me a value from the db or an '...
1
vote
1
answer
423
views
noframenumbering in Metropolis' standout frames
I would like to make it optional to exclude the standout frames from the beamer theme Metropolis from the frame count. This works as long as I write my frame options as noframenumbering, standout. But ...
0
votes
1
answer
94
views
Is it possible to define key macros without the equality sign (i.e., [keya=value])
I was wondering if the xkeyval package allows for defining key macros which do not include an equality symbol.
For instance, I wish to create a package based on the geometry package with the following ...
4
votes
0
answers
125
views
The 'inverted' attribute is not recognized if a \DefineName abbreviation is used in an AMSRefs \bib entry
In Section 8.1 of the AMSRefs package documentation, it is explained that to properly typeset author names that are to be written with the family name first, one should set the attribute inverted on ...
0
votes
2
answers
79
views
Entering ten authors in an AMSRefs \bib entry using \DefineName abbreviations throws an rkeyval error
I am using the commands \DefineName, \DefineJournal and \DefinePublisher to use abbreviations in my bibliography along the lines mentioned in Section 8.4 of the AMSRefs package documentation. Now, I ...
0
votes
3
answers
343
views
How to construct a macro with key=value by \pgfkeys
I just learn \pgfkeys, but don't quite understand how to use it for making a macro with key=value options.
I'd like to give the following simple example as a practice to show my idea.
\documentclass{...