Questions tagged [pgfkeys]
{pgfkeys} concerns a flexible key management system in TikZ/PGF.
521
questions
1
vote
2
answers
31
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 ...
0
votes
1
answer
28
views
How to detect if one of the arguments of a key defined by \pgfkeys has been given value
I define a key test who has two arguments by /.code n args from \pgfkeys. Please see the code below.
Now, I want to detect if #2 has been given a value, but causes error.
So, my questions are:
(1)How ...
5
votes
1
answer
97
views
+100
PGFPlots possible keys
The general structure of a plot is:
\begin{figure}
\centering
...
0
votes
1
answer
44
views
How to set up an optional arg in pgfkeys
I wonder if there is any way in \pgfkeys of tikz to define optional arg(s) as the following code illustrate:
Code:
\documentclass[a4paper]{article}
\usepackage{pgf,graphicx}
\usepackage{geometry}
\...
4
votes
2
answers
79
views
Adding a hook to the color keys in TikZ
Trying to solve pgf basic layer: struggling (again) with colors, I had an idea for a workaround (saving a state for circuitikz...).
But although I know how to add a hook to the color= key, TikZ let ...
1
vote
1
answer
37
views
How to fix the value of a key(or macro) when it gets value from another macro
The following code showes that the value of key constant changes with the macro \aaa.
My question is: how to fix the value of key constant once it gets value from \aaa at the first time, so that both \...
2
votes
2
answers
70
views
Best way to check the value of a key (pgfkey)
I looked at Check-the-value-of-a-pgfkey but I don't feel like using etoolbox.
I found a method but I am not sure it is the right one and I would like to find more concise.
My problem is to test all ...
0
votes
1
answer
39
views
How to manage argument pattern, keys (and subways ?)
I have two methods to draw an arrow on a segment but I would like to find a third more explicit one.
1) \draw[arrow scale=3,pos=.75,arrow=Stealth] (A) -- (B);
2) \draw[new arrow={.3}{3}{To}](A)-- (B);
...
1
vote
1
answer
53
views
How to make a macro as the value of a key in \pgfkeys
I want to make a key by \pgfkeys whose value is a macro. But the following try fails. Please see my question in the code.
\documentclass[a4paper]{article}
\usepackage{xcolor,pgf}
\usepackage{geometry}
...
1
vote
1
answer
29
views
How to make the value of a key in \pgfkeys change with another key?
In \pgfkeys, I want the value of a key(b in my following example) changes with another key(a in my example) wihout introducing a new macro. How to get it?
Example:
\documentclass[a4paper]{article}
\...
0
votes
1
answer
25
views
Why is \pgfkeysnovalue not settable?
TL;DR
Why is it impossible to set a key in pgfkeys to \pgfkeysnovalue?
\pgfkeys{
/foo/bar/.initial=\pgfkeysnovalue,
% ...
% This will not work
/foo/bar=\pgfkeysnovalue
}
Main question
I have ...
3
votes
1
answer
51
views
Possible bug in pgfmanual: pgfkeys with /.initial handler works not as expected
I am a bit surprised by the behavior of pgfkeys. To make my point clear, let me give you a MWE:
\documentclass{article}
\usepackage{pgfkeys}
\begin{document}
Output:
\pgfkeys{
/foo/.initial=3,
% /...
2
votes
2
answers
49
views
How can I store colors to be reused later for pgf-pie charts?
I am trying to store a set of colors in the corresponding pgf key and then recall it later. However attempting to do this:
\documentclass{standalone}
\usepackage{pgf-pie}
\begin{document}
\...
5
votes
2
answers
77
views
Why pfgkeys don't redefine my command on default?
I'm doing this:
\documentclass{article}
\usepackage{pgfkeys}
\pgfkeys{
/foo/.is family,
/foo,
a/.estore in = \bar,
a/.default = bye,
a
}
\newcommand\go[1]{
\pgfkeys{/foo, #1}
\bar
}
\...
2
votes
2
answers
107
views
Conditional clause with \ifnum and \pgfkeysvalueof{/data point/y}
I got the following problem. My aim is to build a barplot with tikz. Using a function to display the sum of the bars in a stacked ybar I want to add a superscript to one specific sum below the x axis.
...
0
votes
1
answer
52
views
Using pgfkeys to create list of theorem environments defined by tcolorbox [duplicate]
I'm having trouble trying to get a list of various theorem environments I've created with \newtcbtheorem. After doing some digging, I found this answer from 2012 by @cmhughes: https://tex....
0
votes
2
answers
58
views
Pass multiple keylists
I want to create a macro that will draw a complex shape with several parts (like a circle and a rectangle):
\newcommand{\drawCircleAndRectangle}[1][]{%
\draw[%my or default circle style props%] (0,...
1
vote
1
answer
25
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 ...
0
votes
1
answer
75
views
Error Compiling Beamer Presentation
With due respect, my file having the following environment:
\documentclass{beamer}
\usepackage{beamerthemeshadow}
\usepackage{graphicx}
\usepackage{epsfig}
\usepackage{subfigure}
\usepackage{amsfonts}
...
2
votes
1
answer
65
views
Tikz/pgfkeys, how to copy a style
In tikz/pgfkeys, how could I copy (like /styleA/*/.cp) all keys or a single key (like /styleA/colorA/.cp) inside a given path, say styleB in the current path, exactly like if I had copied all the keys ...
1
vote
2
answers
70
views
Passing #1 to \pgfkeys
I have the following setup to apply macros to certain data of a command:
\makeatletter
\def\myqu@rck{\myqu@rck}
\pgfkeys{/mykeys/macro/.code=\mykeys@defmacro{#1}}
\def\mykeys@defmacro#1{\mykeys@@...
0
votes
1
answer
40
views
Define custom subtree macros in `forest`? [duplicate]
I am using forest to typeset some trees that contain many repetitive structures. For example:
\begin{forest}
[ [ NP [ N : \textit{John} ] ]
[ VP
[ V : \textit{ate} ]
[ NP
[ ...
0
votes
0
answers
40
views
Placing Nodes in a Path Picture [duplicate]
Unfavorably all thirteen ports of my rack switch are placed in the middle of the path picture on top of each other. How can i place the ports side by side like the numbers.
\documentclass[tikz,border=...
0
votes
0
answers
49
views
Placing a fully defined picture absolutely at any point inside a path picture
The following example generates a rack switch with a single port.
The front oft the rack switch is defined by a path picture.
I add the port to path picture by using \node and i am placing the node ...
10
votes
3
answers
270
views
tikz pic custom keys
The example code below defines a tikz pic that displays an n-by-m grid of circles. It is called by using code like pic {grid={3}{5}} in a tikz path.
However, when code like this starts to have a large ...
1
vote
1
answer
40
views
How to trick the macro \pgfkeys into not removing surrounding spaces from values that are put in braces?
I tried to use pgfkeys for providing keys' values that have surrounding space-tokens:
\documentclass{article}
\usepackage{pgfkeys}
\pgfkeys{/WeirdKeys/weird/.initial=weird}%
\newcommand\Weird[1]{\...
0
votes
1
answer
31
views
pgfkeys not parsing equals (=) or comma (,) in assembled string of key/value pairs
This is a somewhat recherche question but you'll have to take my word for it that these toy examples have been extracted from something useful (to me). Everything is explained in the code below, but ...
2
votes
2
answers
38
views
How do I use pgfkeys .try handler for selecting a choice that could not exist?
The problem is the following:
\documentclass{article}
\usepackage{tikz}
\def\cmd{0}
\tikzset{/test/.is choice,
/test/one/.code={\def\cmd{A}},
/test/two/.code={\def\cmd{B}},
}
\begin{document}
\...
0
votes
1
answer
58
views
What is the problem with \node[red]{X}; in RTL context (xelatex)
This example on tikz node if I use \node[red]{x}; in math mode (RTL context) the node appears faraway unlike \node[color=red]{x};, I thought the two were equivalent
In pgfmanual (Page 173) we can find ...
0
votes
3
answers
89
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{...
0
votes
1
answer
67
views
pgfkeys: Dynamic definition of keys
I want to define a list of keynames in a macro.
Then I want to initialize multiple keys with this keynames.
I've tried with \foreach, also with .list but the keys are never defined.
But, nothing it's ...
1
vote
1
answer
43
views
Set PGF anchor position in custom pgfshape with pgfkey as string?
How can I go about using a pgfkey to place an anchor if the key is a string?
Previous answers imply that setting anchors based on keys is possible using numerical keys (like this question on Creating ...
3
votes
1
answer
56
views
Using pgfmath results in pgfkeys
I'm trying to create a simple variable system using pgfkeys, but I want to be able to create new "var" using other var, see this MWE where I have tried to use \pgfmathprintnumber. I thought ...
0
votes
0
answers
41
views
“pgfkeys package error ” when doing a molecule (texmaker, linux)
The following code works fine when I run it on overleaf or texmaker for windows:
\documentclass{article}
\usepackage{chemfig}
\begin{document}
\chemfig[atom sep=2em]{*6(=-=-=-)}
\end{...
2
votes
1
answer
152
views
Plot factorial function in TikZ datavisualization
I'm trying to replicate this graph following the tips in this solution with TikZ datavisualization package (see Part VI).
[edit] related question: How to make a figure showing growth of functions but ...
1
vote
1
answer
77
views
Using pics/port/.style n args = {3} doesn't work correctly in \tikzset environment
In TikZ i use the pics/ command inside the \tikzset enviroment to define the picture port, which is a element of a network switch. As you can see, the call of picture port in line 34 an 38 requires ...
4
votes
2
answers
807
views
pgfkeys Error: I do not know the key '/tikz/green '
I want to set the fill-color of a rectangle depending on a number stored in a counter. This is my try:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{calc}
\newcommand{\background}[1]{%
\...
2
votes
1
answer
74
views
TikZ: update key value in family when calling style
I would like to run some code to decorate a node, and I would like to control that via a TikZ style. I would also like that tikz style to take some parameters, for example in the form mystyle={arg1=...
3
votes
2
answers
173
views
Dynkin-diagrams package labels problem
i'm struggling with the labels of some biforcate dynkin-diagram
my code is the following
\usepackage{dynkin-diagrams}
\begin{document
\begin{center}
\begin{dynkinDiagram}
\dynkin[labels={m \cosh \...
1
vote
1
answer
190
views
LaTeX CircuiTikZ I do not know the key '/tikz/tr circle'
I am learning LaTeX, and i was trying to follow some examples, and i came across this one from CircuiTikZ
\begin{circuitikz}[]
\draw (0,2) node[npn, tr circle](Q1){};
\ctikzset{transistor circle/...
1
vote
1
answer
34
views
TikZ ignores temporary overridden macro value and uses the previous one
I'm racking my brains with the strange behaviour of this simple TikZ graphic:
I have the following pgf keys:
\tikzset{
the name/.store in=\nodename,
the name=OLD,
my node/.style={
...
1
vote
1
answer
32
views
Node that creates another one which reads its values dynamically
I'm trying to understand how the expansion of a \pgfextra which in turn is inside an append after command is done. My idea is to read some value from a pgf key when the append after command code is ...
3
votes
2
answers
153
views
TikZ node parameter and pgfkeys
I am trying to pass some parameters to a node style and found an answer for simple cases: Is it possible to consider a single optional parameter among three in node declaration?
However, I cannot ...
0
votes
1
answer
41
views
Should loading a package with no options behave the same as calling a macro with no options using pgfopts and pgfkeys?
This is a followup to my previous question Why does pgfkeys .initial not work in these cases?. In that question I created a macro with a key-value interface using pgfkeys and it works perfectly. Now, ...
0
votes
1
answer
40
views
Using passed value as the name of a control sequence with pgfkeys
I have the following family of options
\pgfkeys{
/opts/.is family,
/opts,
name/.store in = \@@Style@Name,
property/.code = {
\expandafter\gdef\expandafter\csname @@Style@ \@@...
2
votes
2
answers
138
views
Why does pgfkeys .initial not work in these cases?
I think I finally have a reasonable understanding of pgfkeys, but initializing a key with or without the .initial handler is giving me trouble. I do understand the distinction between .default and ....
0
votes
0
answers
35
views
Is inclusion of packages using absolute paths not supported anymore?
I used to import a custom package using an absolute path for years, but at some point during the last month this stopped working. I created this minimal example to reproduce the error. When I include ...
2
votes
1
answer
132
views
TikZ: create a button to show something or not
In some cases I create some (plenty of) buttons of the kind
\def\myshow{1}% 1 'yes', '0' no
and then \ifnum\myshow=1 .... \fi
But I had to hear, this is not so correct.
So: What is the correct ...
1
vote
1
answer
65
views
Parameterized pgf shape with optional dashed lines
Based on similar questions I found on SE, I have finally managed to create a relatively simple ‘folded document’ shape in tikz with a few horizontal lines inside:
\documentclass[tikz,border=1mm]{...
1
vote
1
answer
38
views
Why does this pgfopts example using ".is choice" not work?
I'm trying to get this trivial proof of concept demo of pgfopts to work and I keep getting inconsistent results. I have another version working in which the keys are handled with an .is if handler and ...