put a label inside loop made by path
I am completely new to tikz
so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}
Thanks for any guide.
tikz-pgf
add a comment |
I am completely new to tikz
so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}
Thanks for any guide.
tikz-pgf
Your code is not compileable. It must start with thedocument{class}
and end with thedocument{document}
.
– AndréC
Jan 12 at 8:21
Where exactly do you want to add the text?
– AndréC
Jan 12 at 8:23
@AndréC just in the middle of three nodes.
– Abolfazl
Jan 12 at 8:33
add a comment |
I am completely new to tikz
so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}
Thanks for any guide.
tikz-pgf
I am completely new to tikz
so excuse me if it seems easy.
I am going to put a label inside the closed path I have written(mostly taken from here):
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
end{tikzpicture}
Thanks for any guide.
tikz-pgf
tikz-pgf
asked Jan 12 at 8:14
AbolfazlAbolfazl
133
133
Your code is not compileable. It must start with thedocument{class}
and end with thedocument{document}
.
– AndréC
Jan 12 at 8:21
Where exactly do you want to add the text?
– AndréC
Jan 12 at 8:23
@AndréC just in the middle of three nodes.
– Abolfazl
Jan 12 at 8:33
add a comment |
Your code is not compileable. It must start with thedocument{class}
and end with thedocument{document}
.
– AndréC
Jan 12 at 8:21
Where exactly do you want to add the text?
– AndréC
Jan 12 at 8:23
@AndréC just in the middle of three nodes.
– Abolfazl
Jan 12 at 8:33
Your code is not compileable. It must start with the
document{class}
and end with the document{document}
.– AndréC
Jan 12 at 8:21
Your code is not compileable. It must start with the
document{class}
and end with the document{document}
.– AndréC
Jan 12 at 8:21
Where exactly do you want to add the text?
– AndréC
Jan 12 at 8:23
Where exactly do you want to add the text?
– AndréC
Jan 12 at 8:23
@AndréC just in the middle of three nodes.
– Abolfazl
Jan 12 at 8:33
@AndréC just in the middle of three nodes.
– Abolfazl
Jan 12 at 8:33
add a comment |
2 Answers
2
active
oldest
votes
If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
13.2.2 Barycentric Systems)
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
node at (barycentric cs:1=1,2=1 ,3=1) {Text};
end{tikzpicture}
end{document}
add a comment |
off-topic:
- use only numbers for node names is not good practice. instead
1
,2
and3
is better to use for examplen1
, orn2
andn3
- if you not label edges than don't clutter code with empty nodes.
- for labeling of edges is handy to use
quotes
library - at using
barycentric
coordinates be careful: between colon or comas and node names had not be an empty space - it seems that you have a mess in code for drawing arrows
using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:
documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{arrows.meta, positioning, quotes}
begin{document}
begin{tikzpicture}[
node distance = 17.3mm and 10mm,
every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
every edge quotes/.style = {inner sep=1pt,
font=footnotesize, text=gray,
sloped, auto=left},
main/.style = {circle, draw, semithick,
minimum size=3ex, inner sep=2pt,
font=bfseries}
]
node (n1) [main] {1};
node (n2) [main, above right=of n1] {2};
node (n3) [main, below right=of n2] {3};
% note: between ":" or "," and "<node name>" had not to be empty space!
node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};
draw (n1) edge ["2" '] (n3)
(n1) edge ["3"] (n2)
(n2) edge ["1"] (n3);
end{tikzpicture}
end{document}
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%2f469798%2fput-a-label-inside-loop-made-by-path%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
If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
13.2.2 Barycentric Systems)
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
node at (barycentric cs:1=1,2=1 ,3=1) {Text};
end{tikzpicture}
end{document}
add a comment |
If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
13.2.2 Barycentric Systems)
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
node at (barycentric cs:1=1,2=1 ,3=1) {Text};
end{tikzpicture}
end{document}
add a comment |
If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
13.2.2 Barycentric Systems)
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
node at (barycentric cs:1=1,2=1 ,3=1) {Text};
end{tikzpicture}
end{document}
If you don't know which "center" you're talking about, I suggest you use the barycentric coordinates to do so. (See pages 136 et seq. of manual 3.1
13.2.2 Barycentric Systems)
documentclass[tikz,border=5mm]{standalone}
usetikzlibrary{arrows}
begin{document}
begin{tikzpicture}[->,>=stealth',shorten >=1pt,auto,node distance=3cm,
thick,main node/.style={circle,draw,font=Largebfseries}]
node[main node] (2) {2};
node[main node] (1) [below left of=2] {1};
node[main node] (3) [below right of=2] {3};
path
(1) edge node [below]{} (2)
edge node[below] {} (3)
(2) edge node[right] {} (3)
(3) ;
node at (barycentric cs:1=1,2=1 ,3=1) {Text};
end{tikzpicture}
end{document}
edited Jan 12 at 13:45
Zarko
122k865160
122k865160
answered Jan 12 at 8:37
AndréCAndréC
8,50111446
8,50111446
add a comment |
add a comment |
off-topic:
- use only numbers for node names is not good practice. instead
1
,2
and3
is better to use for examplen1
, orn2
andn3
- if you not label edges than don't clutter code with empty nodes.
- for labeling of edges is handy to use
quotes
library - at using
barycentric
coordinates be careful: between colon or comas and node names had not be an empty space - it seems that you have a mess in code for drawing arrows
using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:
documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{arrows.meta, positioning, quotes}
begin{document}
begin{tikzpicture}[
node distance = 17.3mm and 10mm,
every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
every edge quotes/.style = {inner sep=1pt,
font=footnotesize, text=gray,
sloped, auto=left},
main/.style = {circle, draw, semithick,
minimum size=3ex, inner sep=2pt,
font=bfseries}
]
node (n1) [main] {1};
node (n2) [main, above right=of n1] {2};
node (n3) [main, below right=of n2] {3};
% note: between ":" or "," and "<node name>" had not to be empty space!
node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};
draw (n1) edge ["2" '] (n3)
(n1) edge ["3"] (n2)
(n2) edge ["1"] (n3);
end{tikzpicture}
end{document}
add a comment |
off-topic:
- use only numbers for node names is not good practice. instead
1
,2
and3
is better to use for examplen1
, orn2
andn3
- if you not label edges than don't clutter code with empty nodes.
- for labeling of edges is handy to use
quotes
library - at using
barycentric
coordinates be careful: between colon or comas and node names had not be an empty space - it seems that you have a mess in code for drawing arrows
using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:
documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{arrows.meta, positioning, quotes}
begin{document}
begin{tikzpicture}[
node distance = 17.3mm and 10mm,
every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
every edge quotes/.style = {inner sep=1pt,
font=footnotesize, text=gray,
sloped, auto=left},
main/.style = {circle, draw, semithick,
minimum size=3ex, inner sep=2pt,
font=bfseries}
]
node (n1) [main] {1};
node (n2) [main, above right=of n1] {2};
node (n3) [main, below right=of n2] {3};
% note: between ":" or "," and "<node name>" had not to be empty space!
node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};
draw (n1) edge ["2" '] (n3)
(n1) edge ["3"] (n2)
(n2) edge ["1"] (n3);
end{tikzpicture}
end{document}
add a comment |
off-topic:
- use only numbers for node names is not good practice. instead
1
,2
and3
is better to use for examplen1
, orn2
andn3
- if you not label edges than don't clutter code with empty nodes.
- for labeling of edges is handy to use
quotes
library - at using
barycentric
coordinates be careful: between colon or comas and node names had not be an empty space - it seems that you have a mess in code for drawing arrows
using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:
documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{arrows.meta, positioning, quotes}
begin{document}
begin{tikzpicture}[
node distance = 17.3mm and 10mm,
every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
every edge quotes/.style = {inner sep=1pt,
font=footnotesize, text=gray,
sloped, auto=left},
main/.style = {circle, draw, semithick,
minimum size=3ex, inner sep=2pt,
font=bfseries}
]
node (n1) [main] {1};
node (n2) [main, above right=of n1] {2};
node (n3) [main, below right=of n2] {3};
% note: between ":" or "," and "<node name>" had not to be empty space!
node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};
draw (n1) edge ["2" '] (n3)
(n1) edge ["3"] (n2)
(n2) edge ["1"] (n3);
end{tikzpicture}
end{document}
off-topic:
- use only numbers for node names is not good practice. instead
1
,2
and3
is better to use for examplen1
, orn2
andn3
- if you not label edges than don't clutter code with empty nodes.
- for labeling of edges is handy to use
quotes
library - at using
barycentric
coordinates be careful: between colon or comas and node names had not be an empty space - it seems that you have a mess in code for drawing arrows
using solution for placing nodes inside triangle suggested in @AndréC answer (+1) the mwe can be as follows:
documentclass[tikz, margin=3mm]{standalone}
usetikzlibrary{arrows.meta, positioning, quotes}
begin{document}
begin{tikzpicture}[
node distance = 17.3mm and 10mm,
every edge/.style = {draw, semithick, -Stealth, shorten >=1pt},
every edge quotes/.style = {inner sep=1pt,
font=footnotesize, text=gray,
sloped, auto=left},
main/.style = {circle, draw, semithick,
minimum size=3ex, inner sep=2pt,
font=bfseries}
]
node (n1) [main] {1};
node (n2) [main, above right=of n1] {2};
node (n3) [main, below right=of n2] {3};
% note: between ":" or "," and "<node name>" had not to be empty space!
node at (barycentric cs:n1=1 ,n2=1 ,n3=1) {text};
draw (n1) edge ["2" '] (n3)
(n1) edge ["3"] (n2)
(n2) edge ["1"] (n3);
end{tikzpicture}
end{document}
answered Jan 12 at 14:00
ZarkoZarko
122k865160
122k865160
add a comment |
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%2f469798%2fput-a-label-inside-loop-made-by-path%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
Your code is not compileable. It must start with the
document{class}
and end with thedocument{document}
.– AndréC
Jan 12 at 8:21
Where exactly do you want to add the text?
– AndréC
Jan 12 at 8:23
@AndréC just in the middle of three nodes.
– Abolfazl
Jan 12 at 8:33