numexpr behavior in math mode and/or TikZ Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)nullfont in mathmodeTable of 2x2 tikzpicturesDefine tikz node based on pagenodesBehavior of , in both text and math modeWeird Behavior of Math mode in beamerDefault spaces between letters in math-modeLegends in Externalized Graphics with TikZnarrow mode math environment in tikz nodesMath mode and beamermacros and math mode
Why not send Voyager 3 and 4 following up the paths taken by Voyager 1 and 2 to re-transmit signals of later as they fly away from Earth?
Trying to understand entropy as a novice in thermodynamics
How does the math work when buying airline miles?
NERDTreeMenu Remapping
"klopfte jemand" or "jemand klopfte"?
Google .dev domain strangely redirects to https
What is the chair depicted in Cesare Maccari's 1889 painting "Cicerone denuncia Catilina"?
GDP with Intermediate Production
How does light 'choose' between wave and particle behaviour?
If Windows 7 doesn't support WSL, then what is "Subsystem for UNIX-based Applications"?
Universal covering space of the real projective line?
Did Mueller's report provide an evidentiary basis for the claim of Russian govt election interference via social media?
I can't produce songs
Show current row "win streak"
A proverb that is used to imply that you have unexpectedly faced a big problem
Putting class ranking in CV, but against dept guidelines
What adaptations would allow standard fantasy dwarves to survive in the desert?
How do living politicians protect their readily obtainable signatures from misuse?
Was Kant an Intuitionist about mathematical objects?
One-one communication
License to disallow distribution in closed source software, but allow exceptions made by owner?
Why are vacuum tubes still used in amateur radios?
Understanding p-Values using an example
What is the "studentd" process?
numexpr behavior in math mode and/or TikZ
Announcing the arrival of Valued Associate #679: Cesar Manara
Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern)nullfont in mathmodeTable of 2x2 tikzpicturesDefine tikz node based on pagenodesBehavior of , in both text and math modeWeird Behavior of Math mode in beamerDefault spaces between letters in math-modeLegends in Externalized Graphics with TikZnarrow mode math environment in tikz nodesMath mode and beamermacros and math mode
I am attempting to create a triangular grid of numbers like shown below:
This was created in TikZ by hard-coding each point, but I would like to generate the grid procedurally so I can make adjustments easily with a large number of points. The following code is how I have approached the problem:
documentclassarticle
usepackagetikz
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
defns-m
draw (n,-m) node $a_mn$;
endtikzpicture
However this produces the following undesired result:
My thought to resolve this issue was to add numexpr
in the n
definition or prior to n
in the nodes. However this produces the error you can't use 'numexpr' in math mode
.
I'm at a loss as to what to do next. How can I evaluate variables like this in math mode in a TikZ picture?
As a further note, if I for testing purposes ignore my need for math mode and simply put numexprn
in the node text I instead receive the similar error message you can't use 'numexpr' in restricted horizontal mode
.
Also, if possible I would like to preserve this foreach
iteration structure as it is ideal for other annotations I am using in my full application.
tikz-pgf math-mode programming
add a comment |
I am attempting to create a triangular grid of numbers like shown below:
This was created in TikZ by hard-coding each point, but I would like to generate the grid procedurally so I can make adjustments easily with a large number of points. The following code is how I have approached the problem:
documentclassarticle
usepackagetikz
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
defns-m
draw (n,-m) node $a_mn$;
endtikzpicture
However this produces the following undesired result:
My thought to resolve this issue was to add numexpr
in the n
definition or prior to n
in the nodes. However this produces the error you can't use 'numexpr' in math mode
.
I'm at a loss as to what to do next. How can I evaluate variables like this in math mode in a TikZ picture?
As a further note, if I for testing purposes ignore my need for math mode and simply put numexprn
in the node text I instead receive the similar error message you can't use 'numexpr' in restricted horizontal mode
.
Also, if possible I would like to preserve this foreach
iteration structure as it is ideal for other annotations I am using in my full application.
tikz-pgf math-mode programming
Probablythenumexprs-1relax
– Henri Menke
Apr 4 at 8:38
add a comment |
I am attempting to create a triangular grid of numbers like shown below:
This was created in TikZ by hard-coding each point, but I would like to generate the grid procedurally so I can make adjustments easily with a large number of points. The following code is how I have approached the problem:
documentclassarticle
usepackagetikz
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
defns-m
draw (n,-m) node $a_mn$;
endtikzpicture
However this produces the following undesired result:
My thought to resolve this issue was to add numexpr
in the n
definition or prior to n
in the nodes. However this produces the error you can't use 'numexpr' in math mode
.
I'm at a loss as to what to do next. How can I evaluate variables like this in math mode in a TikZ picture?
As a further note, if I for testing purposes ignore my need for math mode and simply put numexprn
in the node text I instead receive the similar error message you can't use 'numexpr' in restricted horizontal mode
.
Also, if possible I would like to preserve this foreach
iteration structure as it is ideal for other annotations I am using in my full application.
tikz-pgf math-mode programming
I am attempting to create a triangular grid of numbers like shown below:
This was created in TikZ by hard-coding each point, but I would like to generate the grid procedurally so I can make adjustments easily with a large number of points. The following code is how I have approached the problem:
documentclassarticle
usepackagetikz
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
defns-m
draw (n,-m) node $a_mn$;
endtikzpicture
However this produces the following undesired result:
My thought to resolve this issue was to add numexpr
in the n
definition or prior to n
in the nodes. However this produces the error you can't use 'numexpr' in math mode
.
I'm at a loss as to what to do next. How can I evaluate variables like this in math mode in a TikZ picture?
As a further note, if I for testing purposes ignore my need for math mode and simply put numexprn
in the node text I instead receive the similar error message you can't use 'numexpr' in restricted horizontal mode
.
Also, if possible I would like to preserve this foreach
iteration structure as it is ideal for other annotations I am using in my full application.
tikz-pgf math-mode programming
tikz-pgf math-mode programming
edited Apr 10 at 4:51
JouleV
14.6k22665
14.6k22665
asked Apr 4 at 7:58
PGmathPGmath
20315
20315
Probablythenumexprs-1relax
– Henri Menke
Apr 4 at 8:38
add a comment |
Probablythenumexprs-1relax
– Henri Menke
Apr 4 at 8:38
Probably
thenumexprs-1relax
– Henri Menke
Apr 4 at 8:38
Probably
thenumexprs-1relax
– Henri Menke
Apr 4 at 8:38
add a comment |
3 Answers
3
active
oldest
votes
You could use edefnthenumexprs-m
, or just use it in the subscript:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
draw (s-m,-m) node $a_mthenumexprs-m$;
endtikzpicture
enddocument
add a comment |
There is already one answer how to use numexpr
, one how to rewrite your loop to avoid it, and here is another possibility : you can use the tools provided by foreach
to make calculations. You can use count
and evaluate
:
documentclass[tikz,border=7pt]standalone
begindocument
begintikzpicture[scale=1.5]
foreach[count=t from 1] s in 2,...,4
foreach[evaluate=n=int(s-m)] m in 1,...,t
draw (n,-m) node $a_mn$;
endtikzpicture
enddocument
add a comment |
Avoid additional calculations. Try to think of another way of using nested foreach
s.
documentclass[tikz]standalone
begindocument
begintikzpicture[scale=1.5]
foreach y in 1,...,3
foreach x in 1,...,numexpr4-y
draw (x,-y) node $a_yx$;
endtikzpicture
enddocument
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
add a comment |
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%2f483102%2fnumexpr-behavior-in-math-mode-and-or-tikz%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You could use edefnthenumexprs-m
, or just use it in the subscript:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
draw (s-m,-m) node $a_mthenumexprs-m$;
endtikzpicture
enddocument
add a comment |
You could use edefnthenumexprs-m
, or just use it in the subscript:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
draw (s-m,-m) node $a_mthenumexprs-m$;
endtikzpicture
enddocument
add a comment |
You could use edefnthenumexprs-m
, or just use it in the subscript:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
draw (s-m,-m) node $a_mthenumexprs-m$;
endtikzpicture
enddocument
You could use edefnthenumexprs-m
, or just use it in the subscript:
documentclassarticle
usepackagetikz
begindocument
begintikzpicture[scale=1.5]
foreach s in 2,...,4
foreach m in 1,...,numexprs-1
draw (s-m,-m) node $a_mthenumexprs-m$;
endtikzpicture
enddocument
answered Apr 4 at 9:08
egregegreg
735k8919343260
735k8919343260
add a comment |
add a comment |
There is already one answer how to use numexpr
, one how to rewrite your loop to avoid it, and here is another possibility : you can use the tools provided by foreach
to make calculations. You can use count
and evaluate
:
documentclass[tikz,border=7pt]standalone
begindocument
begintikzpicture[scale=1.5]
foreach[count=t from 1] s in 2,...,4
foreach[evaluate=n=int(s-m)] m in 1,...,t
draw (n,-m) node $a_mn$;
endtikzpicture
enddocument
add a comment |
There is already one answer how to use numexpr
, one how to rewrite your loop to avoid it, and here is another possibility : you can use the tools provided by foreach
to make calculations. You can use count
and evaluate
:
documentclass[tikz,border=7pt]standalone
begindocument
begintikzpicture[scale=1.5]
foreach[count=t from 1] s in 2,...,4
foreach[evaluate=n=int(s-m)] m in 1,...,t
draw (n,-m) node $a_mn$;
endtikzpicture
enddocument
add a comment |
There is already one answer how to use numexpr
, one how to rewrite your loop to avoid it, and here is another possibility : you can use the tools provided by foreach
to make calculations. You can use count
and evaluate
:
documentclass[tikz,border=7pt]standalone
begindocument
begintikzpicture[scale=1.5]
foreach[count=t from 1] s in 2,...,4
foreach[evaluate=n=int(s-m)] m in 1,...,t
draw (n,-m) node $a_mn$;
endtikzpicture
enddocument
There is already one answer how to use numexpr
, one how to rewrite your loop to avoid it, and here is another possibility : you can use the tools provided by foreach
to make calculations. You can use count
and evaluate
:
documentclass[tikz,border=7pt]standalone
begindocument
begintikzpicture[scale=1.5]
foreach[count=t from 1] s in 2,...,4
foreach[evaluate=n=int(s-m)] m in 1,...,t
draw (n,-m) node $a_mn$;
endtikzpicture
enddocument
answered Apr 4 at 9:39
KpymKpym
17.9k24192
17.9k24192
add a comment |
add a comment |
Avoid additional calculations. Try to think of another way of using nested foreach
s.
documentclass[tikz]standalone
begindocument
begintikzpicture[scale=1.5]
foreach y in 1,...,3
foreach x in 1,...,numexpr4-y
draw (x,-y) node $a_yx$;
endtikzpicture
enddocument
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
add a comment |
Avoid additional calculations. Try to think of another way of using nested foreach
s.
documentclass[tikz]standalone
begindocument
begintikzpicture[scale=1.5]
foreach y in 1,...,3
foreach x in 1,...,numexpr4-y
draw (x,-y) node $a_yx$;
endtikzpicture
enddocument
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
add a comment |
Avoid additional calculations. Try to think of another way of using nested foreach
s.
documentclass[tikz]standalone
begindocument
begintikzpicture[scale=1.5]
foreach y in 1,...,3
foreach x in 1,...,numexpr4-y
draw (x,-y) node $a_yx$;
endtikzpicture
enddocument
Avoid additional calculations. Try to think of another way of using nested foreach
s.
documentclass[tikz]standalone
begindocument
begintikzpicture[scale=1.5]
foreach y in 1,...,3
foreach x in 1,...,numexpr4-y
draw (x,-y) node $a_yx$;
endtikzpicture
enddocument
answered Apr 4 at 8:17
JouleVJouleV
14.6k22665
14.6k22665
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
add a comment |
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
Like I said in the post, due to the way I other annotations are drawn I would like to keep the same loop structure I used.
– PGmath
Apr 4 at 19:51
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
@PGmath Of course you can always keep the loop structure. However, that means you are making your problem unnecessarily complicated.
– JouleV
Apr 5 at 5:35
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
It's not unnecessarily complicated if I necessarily need that structure though.
– PGmath
Apr 5 at 5:36
add a comment |
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%2f483102%2fnumexpr-behavior-in-math-mode-and-or-tikz%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
Probably
thenumexprs-1relax
– Henri Menke
Apr 4 at 8:38