Setting label in newcommand via a pgfkeyHow do you test whether a known key value has been set in...
How to make readers know that my work has used a hidden constraint?
Best mythical creature to use as livestock?
Can the druid cantrip Thorn Whip really defeat a water weird this easily?
Potentiometer like component
Straight line with arrows and dots
US to Europe trip with Canada layover- is 52 minutes enough?
Is all copper pipe pretty much the same?
Provisioning profile doesn't include the application-identifier and keychain-access-groups entitlements
Is it true that real estate prices mainly go up?
Confusion with the nameplate of an induction motor
Is King K. Rool's down throw to up-special a true combo?
What Happens when Passenger Refuses to Fly Boeing 737 Max?
If the Captain's screens are out, does he switch seats with the co-pilot?
Why does Deadpool say "You're welcome, Canada," after shooting Ryan Reynolds in the end credits?
Humans have energy, but not water. What happens?
How do anti-virus programs start at Windows boot?
Prove that the total distance is minimised (when travelling across the longest path)
Replacing Windows 7 security updates with anti-virus?
Touchscreen-controlled dentist office snowman collector game
Ban on all campaign finance?
Am I not good enough for you?
Sword in the Stone story where the sword was held in place by electromagnets
Life insurance that covers only simultaneous/dual deaths
Deleting missing values from a dataset
Setting label in newcommand via a pgfkey
How do you test whether a known key value has been set in pgfkeysAssociate dynamic text to a labelSectioning created via titlesec have wrong labelCreating tikz anchors based on pgfkey valuePass a list through pgfkeySetting distance from label to node in TikZCreating own ref-label system without using additional parameters using newcommand?Label naming strategyIgnoring redefined labelChange label numbering prefixManual label to figureSetting polar coordinates for coordinate system in TikZ via macro
I'm attempting to set a label in a macro(?) I created with a new command. I'm passing several values to the command in the first argument via pgfkeys, but the label
macro is just using the literal string I've put in to expand the pgfkey instead of the actual expanded value.
I've tried both of the solutions presented in these answers, together and separately, but not luck.
https://tex.stackexchange.com/a/308164
https://tex.stackexchange.com/a/125099
I've an inkling that what's happening is related to the timing of the expansion for the pgfkey value, but I'll be honest I don't have a firm understanding of how the underlying tex engine does it's magic. I'm also just learning pgfkeys so my understanding of what's happening there is still at a beginner level.
Here's my mwe of what I'm trying to do:
documentclass[twocolumn]{book}
usepackage[framemethod=TikZ]{mdframed}%boxes
usepackage{pgfkeys}
newcounter{myCounter}
newmdenv[%
frametitlebackgroundcolor=blue,
frametitlefontcolor=white,
backgroundcolor=blue!25,
linecolor=blue,
outerlinewidth=1pt,
roundcorner=1mm,
skipabove=baselineskip,
skipbelow=baselineskip,
font=small,
nobreak=true,
settings={globalrefstepcounter{myCounter}},
]{myTextBox}
%Define Macros
makeatletter
pgfkeys{/mykeys/textbox/.cd,
title/.initial=,
body/.initial=,
label/.initial=,
}
defmykeys@set@textbox@keys#1{%%
pgfkeys{/mykeys/textbox/.cd,#1}}
defmykeys@get@textbox#1{%%
pgfkeysvalueof{/mykeys/textbox/#1}}
newcommandmyBox[1]{%%
bgroup
mykeys@set@textbox@keys{#1}%%
begin{myTextBox}[frametitle=textbf{mykeys@get@textbox{title}hfill NOTE}]
mykeys@get@textbox{body}
label{box:mykeys@get@textbox{label}}
end{myTextBox}
egroup
}
makeatother
begin{document}
section{A Section}
myBox{
title=Box Title,
body=A not so long string of text to go in the box,
label=firstbox
}
ref{firstbox}
end{document}
Here's my current result:
I'm not tied to a particular solution (I would prefer a solution that works with pgfkeys) as long as I can get labels and references working properly.
tikz-pgf cross-referencing
add a comment |
I'm attempting to set a label in a macro(?) I created with a new command. I'm passing several values to the command in the first argument via pgfkeys, but the label
macro is just using the literal string I've put in to expand the pgfkey instead of the actual expanded value.
I've tried both of the solutions presented in these answers, together and separately, but not luck.
https://tex.stackexchange.com/a/308164
https://tex.stackexchange.com/a/125099
I've an inkling that what's happening is related to the timing of the expansion for the pgfkey value, but I'll be honest I don't have a firm understanding of how the underlying tex engine does it's magic. I'm also just learning pgfkeys so my understanding of what's happening there is still at a beginner level.
Here's my mwe of what I'm trying to do:
documentclass[twocolumn]{book}
usepackage[framemethod=TikZ]{mdframed}%boxes
usepackage{pgfkeys}
newcounter{myCounter}
newmdenv[%
frametitlebackgroundcolor=blue,
frametitlefontcolor=white,
backgroundcolor=blue!25,
linecolor=blue,
outerlinewidth=1pt,
roundcorner=1mm,
skipabove=baselineskip,
skipbelow=baselineskip,
font=small,
nobreak=true,
settings={globalrefstepcounter{myCounter}},
]{myTextBox}
%Define Macros
makeatletter
pgfkeys{/mykeys/textbox/.cd,
title/.initial=,
body/.initial=,
label/.initial=,
}
defmykeys@set@textbox@keys#1{%%
pgfkeys{/mykeys/textbox/.cd,#1}}
defmykeys@get@textbox#1{%%
pgfkeysvalueof{/mykeys/textbox/#1}}
newcommandmyBox[1]{%%
bgroup
mykeys@set@textbox@keys{#1}%%
begin{myTextBox}[frametitle=textbf{mykeys@get@textbox{title}hfill NOTE}]
mykeys@get@textbox{body}
label{box:mykeys@get@textbox{label}}
end{myTextBox}
egroup
}
makeatother
begin{document}
section{A Section}
myBox{
title=Box Title,
body=A not so long string of text to go in the box,
label=firstbox
}
ref{firstbox}
end{document}
Here's my current result:
I'm not tied to a particular solution (I would prefer a solution that works with pgfkeys) as long as I can get labels and references working properly.
tikz-pgf cross-referencing
add a comment |
I'm attempting to set a label in a macro(?) I created with a new command. I'm passing several values to the command in the first argument via pgfkeys, but the label
macro is just using the literal string I've put in to expand the pgfkey instead of the actual expanded value.
I've tried both of the solutions presented in these answers, together and separately, but not luck.
https://tex.stackexchange.com/a/308164
https://tex.stackexchange.com/a/125099
I've an inkling that what's happening is related to the timing of the expansion for the pgfkey value, but I'll be honest I don't have a firm understanding of how the underlying tex engine does it's magic. I'm also just learning pgfkeys so my understanding of what's happening there is still at a beginner level.
Here's my mwe of what I'm trying to do:
documentclass[twocolumn]{book}
usepackage[framemethod=TikZ]{mdframed}%boxes
usepackage{pgfkeys}
newcounter{myCounter}
newmdenv[%
frametitlebackgroundcolor=blue,
frametitlefontcolor=white,
backgroundcolor=blue!25,
linecolor=blue,
outerlinewidth=1pt,
roundcorner=1mm,
skipabove=baselineskip,
skipbelow=baselineskip,
font=small,
nobreak=true,
settings={globalrefstepcounter{myCounter}},
]{myTextBox}
%Define Macros
makeatletter
pgfkeys{/mykeys/textbox/.cd,
title/.initial=,
body/.initial=,
label/.initial=,
}
defmykeys@set@textbox@keys#1{%%
pgfkeys{/mykeys/textbox/.cd,#1}}
defmykeys@get@textbox#1{%%
pgfkeysvalueof{/mykeys/textbox/#1}}
newcommandmyBox[1]{%%
bgroup
mykeys@set@textbox@keys{#1}%%
begin{myTextBox}[frametitle=textbf{mykeys@get@textbox{title}hfill NOTE}]
mykeys@get@textbox{body}
label{box:mykeys@get@textbox{label}}
end{myTextBox}
egroup
}
makeatother
begin{document}
section{A Section}
myBox{
title=Box Title,
body=A not so long string of text to go in the box,
label=firstbox
}
ref{firstbox}
end{document}
Here's my current result:
I'm not tied to a particular solution (I would prefer a solution that works with pgfkeys) as long as I can get labels and references working properly.
tikz-pgf cross-referencing
I'm attempting to set a label in a macro(?) I created with a new command. I'm passing several values to the command in the first argument via pgfkeys, but the label
macro is just using the literal string I've put in to expand the pgfkey instead of the actual expanded value.
I've tried both of the solutions presented in these answers, together and separately, but not luck.
https://tex.stackexchange.com/a/308164
https://tex.stackexchange.com/a/125099
I've an inkling that what's happening is related to the timing of the expansion for the pgfkey value, but I'll be honest I don't have a firm understanding of how the underlying tex engine does it's magic. I'm also just learning pgfkeys so my understanding of what's happening there is still at a beginner level.
Here's my mwe of what I'm trying to do:
documentclass[twocolumn]{book}
usepackage[framemethod=TikZ]{mdframed}%boxes
usepackage{pgfkeys}
newcounter{myCounter}
newmdenv[%
frametitlebackgroundcolor=blue,
frametitlefontcolor=white,
backgroundcolor=blue!25,
linecolor=blue,
outerlinewidth=1pt,
roundcorner=1mm,
skipabove=baselineskip,
skipbelow=baselineskip,
font=small,
nobreak=true,
settings={globalrefstepcounter{myCounter}},
]{myTextBox}
%Define Macros
makeatletter
pgfkeys{/mykeys/textbox/.cd,
title/.initial=,
body/.initial=,
label/.initial=,
}
defmykeys@set@textbox@keys#1{%%
pgfkeys{/mykeys/textbox/.cd,#1}}
defmykeys@get@textbox#1{%%
pgfkeysvalueof{/mykeys/textbox/#1}}
newcommandmyBox[1]{%%
bgroup
mykeys@set@textbox@keys{#1}%%
begin{myTextBox}[frametitle=textbf{mykeys@get@textbox{title}hfill NOTE}]
mykeys@get@textbox{body}
label{box:mykeys@get@textbox{label}}
end{myTextBox}
egroup
}
makeatother
begin{document}
section{A Section}
myBox{
title=Box Title,
body=A not so long string of text to go in the box,
label=firstbox
}
ref{firstbox}
end{document}
Here's my current result:
I'm not tied to a particular solution (I would prefer a solution that works with pgfkeys) as long as I can get labels and references working properly.
tikz-pgf cross-referencing
tikz-pgf cross-referencing
asked 13 mins ago
TuffwerTuffwer
1507
1507
add a comment |
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "85"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479387%2fsetting-label-in-newcommand-via-a-pgfkey%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to TeX - LaTeX Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f479387%2fsetting-label-in-newcommand-via-a-pgfkey%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown