Pass a label in a loop (TiKz)
I want to reproduce the attached figure but I encounter some troubles for the display of labels.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}
tikz-pgf
add a comment |
I want to reproduce the attached figure but I encounter some troubles for the display of labels.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}
tikz-pgf
1
One common trick in TikZ is to use the.try
handler. Ideally speaking, you addpgfkeys{ /Fabrice/i/j/.try }
in the for loop. And then, before the for loop, addpgfkeys{ /Fabrice/i/j/.code = draw the arrow }
.
– Symbol 1
Jan 28 at 19:11
1
Or, you can usecoordinate
in apic
and name every instance ofpic
s. That will give you access to those corner points.
– Symbol 1
Jan 28 at 19:17
add a comment |
I want to reproduce the attached figure but I encounter some troubles for the display of labels.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}
tikz-pgf
I want to reproduce the attached figure but I encounter some troubles for the display of labels.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
foreach j in {0,...,3}{
pic at (4*i,-4*j){zellige};}
foreach i in {0,...,9}
foreach j in {10,...,19}{
node[draw,circle,inner sep=15pt,] at (4*i +2.5,0.1){LARGE j};
}
end{tikzpicture}
end{document}
tikz-pgf
tikz-pgf
asked Jan 28 at 19:10
FabriceFabrice
1,4201922
1,4201922
1
One common trick in TikZ is to use the.try
handler. Ideally speaking, you addpgfkeys{ /Fabrice/i/j/.try }
in the for loop. And then, before the for loop, addpgfkeys{ /Fabrice/i/j/.code = draw the arrow }
.
– Symbol 1
Jan 28 at 19:11
1
Or, you can usecoordinate
in apic
and name every instance ofpic
s. That will give you access to those corner points.
– Symbol 1
Jan 28 at 19:17
add a comment |
1
One common trick in TikZ is to use the.try
handler. Ideally speaking, you addpgfkeys{ /Fabrice/i/j/.try }
in the for loop. And then, before the for loop, addpgfkeys{ /Fabrice/i/j/.code = draw the arrow }
.
– Symbol 1
Jan 28 at 19:11
1
Or, you can usecoordinate
in apic
and name every instance ofpic
s. That will give you access to those corner points.
– Symbol 1
Jan 28 at 19:17
1
1
One common trick in TikZ is to use the
.try
handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try }
in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }
.– Symbol 1
Jan 28 at 19:11
One common trick in TikZ is to use the
.try
handler. Ideally speaking, you add pgfkeys{ /Fabrice/i/j/.try }
in the for loop. And then, before the for loop, add pgfkeys{ /Fabrice/i/j/.code = draw the arrow }
.– Symbol 1
Jan 28 at 19:11
1
1
Or, you can use
coordinate
in a pic
and name every instance of pic
s. That will give you access to those corner points.– Symbol 1
Jan 28 at 19:17
Or, you can use
coordinate
in a pic
and name every instance of pic
s. That will give you access to those corner points.– Symbol 1
Jan 28 at 19:17
add a comment |
2 Answers
2
active
oldest
votes
I would just add the node to the definition of the pic
(since pic
s can take arguments).
documentclass[tikz]{standalone}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
end{tikzpicture}
end{document}
As for your comment, I added some vectors. (I do not know what your command vv
does.) If you want to use every node/.style
and give some nodes extra font information, you could use font
and node font
.
documentclass[tikz]{standalone}
usepackage{amsmath}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}[scale=0.5, every node/.style={transform
shape,node font=LARGE}]
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
draw[color=red,-latex,very thick] (0,0)
node [left,node font=boldmathHuge]{{$vec u$}} -- ++ (12,-8);
draw[color=red,-latex,very thick] (20,2)
node [left,font=boldmathHuge]{{$vec w$}} -- ++ (12,-8);
end{tikzpicture}
end{document}
As you see, these vectors are boldface, and Huge
does have an impact. And by using transform shape
you do not have to add scale=0.5
twice.
I would like the size of the name of the vectors to be bigger. If I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you
– Fabrice
Jan 31 at 20:56
@Fabrice It does work if you switch into math mode:tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors withdraw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is thatvv
, whose definition I do not know, does something unexpected.
– marmot
Jan 31 at 21:50
I think I'm not clear enough ! I have to reduce the size of the image but if I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small
– Fabrice
Jan 31 at 22:18
|
show 2 more comments
It is enough to place the labels in the loop that builds the zelliges.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}{
foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
pic at (4*i,-4*j){zellige};
node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
}
end{tikzpicture}
end{document}
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
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%2f472293%2fpass-a-label-in-a-loop-tikz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
I would just add the node to the definition of the pic
(since pic
s can take arguments).
documentclass[tikz]{standalone}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
end{tikzpicture}
end{document}
As for your comment, I added some vectors. (I do not know what your command vv
does.) If you want to use every node/.style
and give some nodes extra font information, you could use font
and node font
.
documentclass[tikz]{standalone}
usepackage{amsmath}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}[scale=0.5, every node/.style={transform
shape,node font=LARGE}]
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
draw[color=red,-latex,very thick] (0,0)
node [left,node font=boldmathHuge]{{$vec u$}} -- ++ (12,-8);
draw[color=red,-latex,very thick] (20,2)
node [left,font=boldmathHuge]{{$vec w$}} -- ++ (12,-8);
end{tikzpicture}
end{document}
As you see, these vectors are boldface, and Huge
does have an impact. And by using transform shape
you do not have to add scale=0.5
twice.
I would like the size of the name of the vectors to be bigger. If I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you
– Fabrice
Jan 31 at 20:56
@Fabrice It does work if you switch into math mode:tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors withdraw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is thatvv
, whose definition I do not know, does something unexpected.
– marmot
Jan 31 at 21:50
I think I'm not clear enough ! I have to reduce the size of the image but if I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small
– Fabrice
Jan 31 at 22:18
|
show 2 more comments
I would just add the node to the definition of the pic
(since pic
s can take arguments).
documentclass[tikz]{standalone}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
end{tikzpicture}
end{document}
As for your comment, I added some vectors. (I do not know what your command vv
does.) If you want to use every node/.style
and give some nodes extra font information, you could use font
and node font
.
documentclass[tikz]{standalone}
usepackage{amsmath}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}[scale=0.5, every node/.style={transform
shape,node font=LARGE}]
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
draw[color=red,-latex,very thick] (0,0)
node [left,node font=boldmathHuge]{{$vec u$}} -- ++ (12,-8);
draw[color=red,-latex,very thick] (20,2)
node [left,font=boldmathHuge]{{$vec w$}} -- ++ (12,-8);
end{tikzpicture}
end{document}
As you see, these vectors are boldface, and Huge
does have an impact. And by using transform shape
you do not have to add scale=0.5
twice.
I would like the size of the name of the vectors to be bigger. If I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you
– Fabrice
Jan 31 at 20:56
@Fabrice It does work if you switch into math mode:tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors withdraw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is thatvv
, whose definition I do not know, does something unexpected.
– marmot
Jan 31 at 21:50
I think I'm not clear enough ! I have to reduce the size of the image but if I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small
– Fabrice
Jan 31 at 22:18
|
show 2 more comments
I would just add the node to the definition of the pic
(since pic
s can take arguments).
documentclass[tikz]{standalone}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
end{tikzpicture}
end{document}
As for your comment, I added some vectors. (I do not know what your command vv
does.) If you want to use every node/.style
and give some nodes extra font information, you could use font
and node font
.
documentclass[tikz]{standalone}
usepackage{amsmath}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}[scale=0.5, every node/.style={transform
shape,node font=LARGE}]
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
draw[color=red,-latex,very thick] (0,0)
node [left,node font=boldmathHuge]{{$vec u$}} -- ++ (12,-8);
draw[color=red,-latex,very thick] (20,2)
node [left,font=boldmathHuge]{{$vec w$}} -- ++ (12,-8);
end{tikzpicture}
end{document}
As you see, these vectors are boldface, and Huge
does have an impact. And by using transform shape
you do not have to add scale=0.5
twice.
I would just add the node to the definition of the pic
(since pic
s can take arguments).
documentclass[tikz]{standalone}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
end{tikzpicture}
end{document}
As for your comment, I added some vectors. (I do not know what your command vv
does.) If you want to use every node/.style
and give some nodes extra font information, you could use font
and node font
.
documentclass[tikz]{standalone}
usepackage{amsmath}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
node[draw,circle,inner sep=15pt,font=LARGE] at (2.75,0.25) {#1};
}
}
begin{document}
begin{tikzpicture}[scale=0.5, every node/.style={transform
shape,node font=LARGE}]
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}
{foreach j [evaluate=j as k using {int(10+10*j+i)}] in {0,...,3}{
pic at (4*i,-4*j){zellige=k};}}
draw[color=red,-latex,very thick] (0,0)
node [left,node font=boldmathHuge]{{$vec u$}} -- ++ (12,-8);
draw[color=red,-latex,very thick] (20,2)
node [left,font=boldmathHuge]{{$vec w$}} -- ++ (12,-8);
end{tikzpicture}
end{document}
As you see, these vectors are boldface, and Huge
does have an impact. And by using transform shape
you do not have to add scale=0.5
twice.
edited Jan 31 at 22:30
answered Jan 28 at 19:54
marmotmarmot
97.5k4112215
97.5k4112215
I would like the size of the name of the vectors to be bigger. If I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you
– Fabrice
Jan 31 at 20:56
@Fabrice It does work if you switch into math mode:tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors withdraw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is thatvv
, whose definition I do not know, does something unexpected.
– marmot
Jan 31 at 21:50
I think I'm not clear enough ! I have to reduce the size of the image but if I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small
– Fabrice
Jan 31 at 22:18
|
show 2 more comments
I would like the size of the name of the vectors to be bigger. If I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you
– Fabrice
Jan 31 at 20:56
@Fabrice It does work if you switch into math mode:tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors withdraw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is thatvv
, whose definition I do not know, does something unexpected.
– marmot
Jan 31 at 21:50
I think I'm not clear enough ! I have to reduce the size of the image but if I do thisbegin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small
– Fabrice
Jan 31 at 22:18
I would like the size of the name of the vectors to be bigger. If I do this
begin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you– Fabrice
Jan 31 at 20:56
I would like the size of the name of the vectors to be bigger. If I do this
begin{tikzpicture} [scale=0.5, every node/.style={scale=0.8,font=boldmathLARGE}]
it does not work. Thank you– Fabrice
Jan 31 at 20:56
@Fabrice It does work if you switch into math mode:
tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
@Fabrice It does work if you switch into math mode:
tikzset{ zellige/.pic={ draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0) --(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle; node[draw,circle,inner sep=15pt,font=LARGEboldmath] at (2.75,0.25) {$#1$}; } }
– marmot
Jan 31 at 20:58
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors with
draw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
I'm sorry but this code does not work. I'm talking about the labels u, v, w ... vectors with
draw[color=red,->] (0,14) node [left]{{$vv u$}} --(12,6);
– Fabrice
Jan 31 at 21:27
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is that
vv
, whose definition I do not know, does something unexpected.– marmot
Jan 31 at 21:50
@Fabrice I added some vectors and find that it does work. The only way I see that it may not work is that
vv
, whose definition I do not know, does something unexpected.– marmot
Jan 31 at 21:50
I think I'm not clear enough ! I have to reduce the size of the image but if I do this
begin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small– Fabrice
Jan 31 at 22:18
I think I'm not clear enough ! I have to reduce the size of the image but if I do this
begin{tikzpicture} [scale=0.5, every node/.style={scale=0.5,font=boldmathLARGE}]end{tikzpicture}
, the vector labels are too small– Fabrice
Jan 31 at 22:18
|
show 2 more comments
It is enough to place the labels in the loop that builds the zelliges.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}{
foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
pic at (4*i,-4*j){zellige};
node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
}
end{tikzpicture}
end{document}
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
add a comment |
It is enough to place the labels in the loop that builds the zelliges.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}{
foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
pic at (4*i,-4*j){zellige};
node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
}
end{tikzpicture}
end{document}
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
add a comment |
It is enough to place the labels in the loop that builds the zelliges.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}{
foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
pic at (4*i,-4*j){zellige};
node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
}
end{tikzpicture}
end{document}
It is enough to place the labels in the loop that builds the zelliges.
documentclass[tikz]{standalone}
usepackage{color}
tikzset{
zellige/.pic={
draw[ultra thick] (0,0)--(3,3)--(4,2)--(6,2)--(4,0)
--(5,-2)--(4,-2)--(3,-1)--(2,-2)--(1,-2)--cycle;
}
}
begin{document}
begin{tikzpicture}
draw[cyan] (0,-14) grid (42,3);
foreach i in {0,...,9}{
foreach j [evaluate=j as lab using int((j+1)*10+i)]in {0,...,3}{
pic at (4*i,-4*j){zellige};
node[draw,circle,inner sep=15pt] at (4*i+2.5,-4*j){LARGE lab};}
}
end{tikzpicture}
end{document}
answered Jan 28 at 19:41
AndréCAndréC
8,82911447
8,82911447
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
add a comment |
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
@Marmot and AndréC Thanks !
– Fabrice
Jan 28 at 20:25
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%2f472293%2fpass-a-label-in-a-loop-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
1
One common trick in TikZ is to use the
.try
handler. Ideally speaking, you addpgfkeys{ /Fabrice/i/j/.try }
in the for loop. And then, before the for loop, addpgfkeys{ /Fabrice/i/j/.code = draw the arrow }
.– Symbol 1
Jan 28 at 19:11
1
Or, you can use
coordinate
in apic
and name every instance ofpic
s. That will give you access to those corner points.– Symbol 1
Jan 28 at 19:17