Conditionally include a line based on an option with pgfpackagesSetting package option from the command...
Showing mass murder in a kid's book
How to I force windows to use a specific version of SQLCMD?
Animation: customize bounce interpolation
Why the "ls" command is showing the permissions of files in a FAT32 partition?
PTIJ: does fasting on Ta'anis Esther give us reward as if we celebrated 2 Purims? (similar to Yom Kippur)
Isometric embedding of a genus g surface
How much do grades matter for a future academia position?
Confusion over Hunter with Crossbow Expert and Giant Killer
Why do Radio Buttons not fill the entire outer circle?
Typing CO_2 easily
What is the meaning of "You've never met a graph you didn't like?"
How to get directions in deep space?
Cumulative Sum using Java 8 stream API
Quoting Keynes in a lecture
Would this string work as string?
Would a primitive species be able to learn English from reading books alone?
Make a border of symbols in Gimp
What does "tick" mean in this sentence?
Mimic lecturing on blackboard, facing audience
What's the name of the logical fallacy where a debater extends a statement far beyond the original statement to make it true?
Identifying "long and narrow" polygons in with Postgis
What should be the ideal length of sentences in a blog post for ease of reading?
What is this high flying aircraft over Pennsylvania?
How to write Quadratic equation with negative coefficient
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
33 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
27 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
20 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 2 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
33 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
27 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
20 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
33 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
27 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
20 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
33 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
33 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
27 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
27 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
20 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
20 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
33 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
27 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
20 mins ago