Conditionally include a line based on an option with pgfpackagesSetting package option from the command...
Is stochastic gradient descent pseudo-stochastic?
How would a solely written language work mechanically
Why does the Persian emissary display a string of crowned skulls?
How do I tell my boss that I'm quitting in 15 days (a colleague left this week)
What does "tick" mean in this sentence?
ContourPlot — How do I color by contour curvature?
How to leave product feedback on macOS?
Telemetry for feature health
Why is the principal energy of an electron lower for excited electrons in a higher energy state?
How much do grades matter for a future academia position?
When and why was runway 07/25 at Kai Tak removed?
Why do Radio Buttons not fill the entire outer circle?
How do you justify more code being written by following clean code practices?
Can I cause damage to electrical appliances by unplugging them when they are turned on?
The Digit Triangles
Showing mass murder in a kid's book
Unable to disable Microsoft Store in domain environment
Why didn’t Eve recognize the little cockroach as a living organism?
Do I have to take mana from my deck or hand when tapping a dual land?
Why does a 97 / 92 key piano exist by Bösendorfer?
How do I prevent inappropriate ads from appearing in my game?
How to understand "he realized a split second too late was also a mistake"
If Captain Marvel (MCU) were to have a child with a human male, would the child be human or Kree?
What happens if I try to grapple mirror image?
Conditionally include a line based on an option with pgfpackages
Setting package option from the command lineHow to include package by some condition in custom packageHow does usepackage differ from a simple include or input?tcolorbox: `height fill` as option to `tcbraster`Problem with ifthenelseinclude vs usepackageTikz: separating items based on line separationMacro as option of tcolorboxDefine a required option with pgfoptstcolorbox newtcbtheorem “label separator” option
I am trying to design a small package, mostly for test purpose. Currently the package looks like this:
% eqbox.sty
NeedsTeXFormat{LaTeX2e}[1994/06/01]
ProvidesPackage{eqbox}[2019/01/01 Boxed Equations]
RequirePackage{xcolor}
RequirePackage{pgfopts}
RequirePackage{amsmath}
RequirePackage{fancybox}
RequirePackage[most]{tcolorbox}
pgfkeys{
/eqbox/.cd,
colframe/.store in = colframe,
colframe = black,
colback/.store in = colback,
colback = white,
shadow/.store in = shadow,
shadow = undefined,
}
ProcessPgfPackageOptions{/eqbox}
tcbset{
highlight math style={
enhanced,
sharp corners,
breakable,
colframe=colframe,
colback=colback,
ifxundefinedshadow
else
shadow={2pt}{-2pt}{0mm}{shadow},
fi
boxrule=0.4pt,
boxsep = 3pt,
left = 0pt,
right = 0pt,
top = 0pt,
bottom = 0pt
}
}
and I can try to use it this way:
documentclass[letterpaper, 11pt, onecolumn]{article}
usepackage{lipsum}
usepackage{eqbox}
begin{document}
lipsum[1]
begin{equation}
tcbhighmath{x^2 + 3}
end{equation}
lipsum[1]
end{document}
However it does not work. My intent is that:
- By default,
usepackage{eqbox}does not provide any shadow - If the user writes
usepackage[shadow=blue]{eqbox}then equations are put in boxes with a blue shadow
How to make that work? (I think I do not know how to use ifx to make that work)
EDIT: I also tried:
ifdefinedshadow
shadow={2pt}{-2pt}{0mm}{shadow},
fi
but it does not work either
tikz-pgf tcolorbox package-writing ifthenelse
add a comment |
I am trying to design a small package, mostly for test purpose. Currently the package looks like this:
% eqbox.sty
NeedsTeXFormat{LaTeX2e}[1994/06/01]
ProvidesPackage{eqbox}[2019/01/01 Boxed Equations]
RequirePackage{xcolor}
RequirePackage{pgfopts}
RequirePackage{amsmath}
RequirePackage{fancybox}
RequirePackage[most]{tcolorbox}
pgfkeys{
/eqbox/.cd,
colframe/.store in = colframe,
colframe = black,
colback/.store in = colback,
colback = white,
shadow/.store in = shadow,
shadow = undefined,
}
ProcessPgfPackageOptions{/eqbox}
tcbset{
highlight math style={
enhanced,
sharp corners,
breakable,
colframe=colframe,
colback=colback,
ifxundefinedshadow
else
shadow={2pt}{-2pt}{0mm}{shadow},
fi
boxrule=0.4pt,
boxsep = 3pt,
left = 0pt,
right = 0pt,
top = 0pt,
bottom = 0pt
}
}
and I can try to use it this way:
documentclass[letterpaper, 11pt, onecolumn]{article}
usepackage{lipsum}
usepackage{eqbox}
begin{document}
lipsum[1]
begin{equation}
tcbhighmath{x^2 + 3}
end{equation}
lipsum[1]
end{document}
However it does not work. My intent is that:
- By default,
usepackage{eqbox}does not provide any shadow - If the user writes
usepackage[shadow=blue]{eqbox}then equations are put in boxes with a blue shadow
How to make that work? (I think I do not know how to use ifx to make that work)
EDIT: I also tried:
ifdefinedshadow
shadow={2pt}{-2pt}{0mm}{shadow},
fi
but it does not work either
tikz-pgf tcolorbox package-writing ifthenelse
One quick remark: you haveshadow = undefined,but a backslash inifxundefinedshadow. (I am not saying that adding the backslash will fix it.)
– marmot
1 hour ago
You can addifxshadowemptyelsetcbset{shadow={2pt}{-2pt}{0mm}{shadow}}fioutside oftcbset. And then simply setshadow=(to set theshadowto empty) orshadow=redto set it to red. But I do not understand why you need theshadowmacro to do all this. You can simply set/eqbox/shadow/.style = {shadow={2pt}{-2pt}{0mm}{#1}}.
– Kpym
42 mins ago
@Kpym: would there be any trick to put the ifx/else inside the tcbset. In this specific case your trick works, but I'm sure I will encounter cases where I would like to have if/else conditions inside some command.
– Vincent
36 mins ago
I can't see why you need to put conditionals directly insidepgfset,tcbset,tikzset. The conditionals should be in the.codepart of the keys in general or outside this "key" environments.
– Kpym
29 mins ago
add a comment |
I am trying to design a small package, mostly for test purpose. Currently the package looks like this:
% eqbox.sty
NeedsTeXFormat{LaTeX2e}[1994/06/01]
ProvidesPackage{eqbox}[2019/01/01 Boxed Equations]
RequirePackage{xcolor}
RequirePackage{pgfopts}
RequirePackage{amsmath}
RequirePackage{fancybox}
RequirePackage[most]{tcolorbox}
pgfkeys{
/eqbox/.cd,
colframe/.store in = colframe,
colframe = black,
colback/.store in = colback,
colback = white,
shadow/.store in = shadow,
shadow = undefined,
}
ProcessPgfPackageOptions{/eqbox}
tcbset{
highlight math style={
enhanced,
sharp corners,
breakable,
colframe=colframe,
colback=colback,
ifxundefinedshadow
else
shadow={2pt}{-2pt}{0mm}{shadow},
fi
boxrule=0.4pt,
boxsep = 3pt,
left = 0pt,
right = 0pt,
top = 0pt,
bottom = 0pt
}
}
and I can try to use it this way:
documentclass[letterpaper, 11pt, onecolumn]{article}
usepackage{lipsum}
usepackage{eqbox}
begin{document}
lipsum[1]
begin{equation}
tcbhighmath{x^2 + 3}
end{equation}
lipsum[1]
end{document}
However it does not work. My intent is that:
- By default,
usepackage{eqbox}does not provide any shadow - If the user writes
usepackage[shadow=blue]{eqbox}then equations are put in boxes with a blue shadow
How to make that work? (I think I do not know how to use ifx to make that work)
EDIT: I also tried:
ifdefinedshadow
shadow={2pt}{-2pt}{0mm}{shadow},
fi
but it does not work either
tikz-pgf tcolorbox package-writing ifthenelse
I am trying to design a small package, mostly for test purpose. Currently the package looks like this:
% eqbox.sty
NeedsTeXFormat{LaTeX2e}[1994/06/01]
ProvidesPackage{eqbox}[2019/01/01 Boxed Equations]
RequirePackage{xcolor}
RequirePackage{pgfopts}
RequirePackage{amsmath}
RequirePackage{fancybox}
RequirePackage[most]{tcolorbox}
pgfkeys{
/eqbox/.cd,
colframe/.store in = colframe,
colframe = black,
colback/.store in = colback,
colback = white,
shadow/.store in = shadow,
shadow = undefined,
}
ProcessPgfPackageOptions{/eqbox}
tcbset{
highlight math style={
enhanced,
sharp corners,
breakable,
colframe=colframe,
colback=colback,
ifxundefinedshadow
else
shadow={2pt}{-2pt}{0mm}{shadow},
fi
boxrule=0.4pt,
boxsep = 3pt,
left = 0pt,
right = 0pt,
top = 0pt,
bottom = 0pt
}
}
and I can try to use it this way:
documentclass[letterpaper, 11pt, onecolumn]{article}
usepackage{lipsum}
usepackage{eqbox}
begin{document}
lipsum[1]
begin{equation}
tcbhighmath{x^2 + 3}
end{equation}
lipsum[1]
end{document}
However it does not work. My intent is that:
- By default,
usepackage{eqbox}does not provide any shadow - If the user writes
usepackage[shadow=blue]{eqbox}then equations are put in boxes with a blue shadow
How to make that work? (I think I do not know how to use ifx to make that work)
EDIT: I also tried:
ifdefinedshadow
shadow={2pt}{-2pt}{0mm}{shadow},
fi
but it does not work either
tikz-pgf tcolorbox package-writing ifthenelse
tikz-pgf tcolorbox package-writing ifthenelse
edited 10 mins ago
Bernard
173k776205
173k776205
asked 1 hour ago
VincentVincent
1,79021937
1,79021937
One quick remark: you haveshadow = undefined,but a backslash inifxundefinedshadow. (I am not saying that adding the backslash will fix it.)
– marmot
1 hour ago
You can addifxshadowemptyelsetcbset{shadow={2pt}{-2pt}{0mm}{shadow}}fioutside oftcbset. And then simply setshadow=(to set theshadowto empty) orshadow=redto set it to red. But I do not understand why you need theshadowmacro to do all this. You can simply set/eqbox/shadow/.style = {shadow={2pt}{-2pt}{0mm}{#1}}.
– Kpym
42 mins ago
@Kpym: would there be any trick to put the ifx/else inside the tcbset. In this specific case your trick works, but I'm sure I will encounter cases where I would like to have if/else conditions inside some command.
– Vincent
36 mins ago
I can't see why you need to put conditionals directly insidepgfset,tcbset,tikzset. The conditionals should be in the.codepart of the keys in general or outside this "key" environments.
– Kpym
29 mins ago
add a comment |
One quick remark: you haveshadow = undefined,but a backslash inifxundefinedshadow. (I am not saying that adding the backslash will fix it.)
– marmot
1 hour ago
You can addifxshadowemptyelsetcbset{shadow={2pt}{-2pt}{0mm}{shadow}}fioutside oftcbset. And then simply setshadow=(to set theshadowto empty) orshadow=redto set it to red. But I do not understand why you need theshadowmacro to do all this. You can simply set/eqbox/shadow/.style = {shadow={2pt}{-2pt}{0mm}{#1}}.
– Kpym
42 mins ago
@Kpym: would there be any trick to put the ifx/else inside the tcbset. In this specific case your trick works, but I'm sure I will encounter cases where I would like to have if/else conditions inside some command.
– Vincent
36 mins ago
I can't see why you need to put conditionals directly insidepgfset,tcbset,tikzset. The conditionals should be in the.codepart of the keys in general or outside this "key" environments.
– Kpym
29 mins ago
One quick remark: you have
shadow = undefined, but a backslash in ifxundefinedshadow. (I am not saying that adding the backslash will fix it.)– marmot
1 hour ago
One quick remark: you have
shadow = undefined, but a backslash in ifxundefinedshadow. (I am not saying that adding the backslash will fix it.)– marmot
1 hour ago
You can add
ifxshadowemptyelsetcbset{shadow={2pt}{-2pt}{0mm}{shadow}}fi outside of tcbset. And then simply set shadow= (to set the shadow to empty) or shadow=red to set it to red. But I do not understand why you need the shadow macro to do all this. You can simply set /eqbox/shadow/.style = {shadow={2pt}{-2pt}{0mm}{#1}}.– Kpym
42 mins ago
You can add
ifxshadowemptyelsetcbset{shadow={2pt}{-2pt}{0mm}{shadow}}fi outside of tcbset. And then simply set shadow= (to set the shadow to empty) or shadow=red to set it to red. But I do not understand why you need the shadow macro to do all this. You can simply set /eqbox/shadow/.style = {shadow={2pt}{-2pt}{0mm}{#1}}.– Kpym
42 mins ago
@Kpym: would there be any trick to put the ifx/else inside the tcbset. In this specific case your trick works, but I'm sure I will encounter cases where I would like to have if/else conditions inside some command.
– Vincent
36 mins ago
@Kpym: would there be any trick to put the ifx/else inside the tcbset. In this specific case your trick works, but I'm sure I will encounter cases where I would like to have if/else conditions inside some command.
– Vincent
36 mins ago
I can't see why you need to put conditionals directly inside
pgfset, tcbset, tikzset. The conditionals should be in the .code part of the keys in general or outside this "key" environments.– Kpym
29 mins ago
I can't see why you need to put conditionals directly inside
pgfset, tcbset, tikzset. The conditionals should be in the .code part of the keys in general or outside this "key" environments.– Kpym
29 mins ago
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%2f480580%2fconditionally-include-a-line-based-on-an-option-with-pgfpackages%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%2f480580%2fconditionally-include-a-line-based-on-an-option-with-pgfpackages%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
One quick remark: you have
shadow = undefined,but a backslash inifxundefinedshadow. (I am not saying that adding the backslash will fix it.)– marmot
1 hour ago
You can add
ifxshadowemptyelsetcbset{shadow={2pt}{-2pt}{0mm}{shadow}}fioutside oftcbset. And then simply setshadow=(to set theshadowto empty) orshadow=redto set it to red. But I do not understand why you need theshadowmacro to do all this. You can simply set/eqbox/shadow/.style = {shadow={2pt}{-2pt}{0mm}{#1}}.– Kpym
42 mins ago
@Kpym: would there be any trick to put the ifx/else inside the tcbset. In this specific case your trick works, but I'm sure I will encounter cases where I would like to have if/else conditions inside some command.
– Vincent
36 mins ago
I can't see why you need to put conditionals directly inside
pgfset,tcbset,tikzset. The conditionals should be in the.codepart of the keys in general or outside this "key" environments.– Kpym
29 mins ago