How to draw a node with two options using TikZ graphs in LaTeX
I'm trying to draw a node optionA
with two options option1
and option3
which should appear in 45 degrees from the center. Actually, I tried to change this:
tikz graph [grow right=2cm] { optionA -> option1 -> option2 };
to
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
But option1
and option2
should equally distanced (45/-45 degrees) from optionA
.
Thanks for any suggestion.
Edit:
Here is this within a document:
documentclass{article}
usepackage{tikz}
usetikzlibrary{graphs}
begin{document}
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
end{document}
tikz-pgf
add a comment |
I'm trying to draw a node optionA
with two options option1
and option3
which should appear in 45 degrees from the center. Actually, I tried to change this:
tikz graph [grow right=2cm] { optionA -> option1 -> option2 };
to
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
But option1
and option2
should equally distanced (45/-45 degrees) from optionA
.
Thanks for any suggestion.
Edit:
Here is this within a document:
documentclass{article}
usepackage{tikz}
usetikzlibrary{graphs}
begin{document}
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
end{document}
tikz-pgf
@marmot, Binary trees appears in a vertical manner. I wanted just 2 options that will appear horizontally.
– user4712458
Feb 24 at 12:18
add a comment |
I'm trying to draw a node optionA
with two options option1
and option3
which should appear in 45 degrees from the center. Actually, I tried to change this:
tikz graph [grow right=2cm] { optionA -> option1 -> option2 };
to
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
But option1
and option2
should equally distanced (45/-45 degrees) from optionA
.
Thanks for any suggestion.
Edit:
Here is this within a document:
documentclass{article}
usepackage{tikz}
usetikzlibrary{graphs}
begin{document}
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
end{document}
tikz-pgf
I'm trying to draw a node optionA
with two options option1
and option3
which should appear in 45 degrees from the center. Actually, I tried to change this:
tikz graph [grow right=2cm] { optionA -> option1 -> option2 };
to
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
But option1
and option2
should equally distanced (45/-45 degrees) from optionA
.
Thanks for any suggestion.
Edit:
Here is this within a document:
documentclass{article}
usepackage{tikz}
usetikzlibrary{graphs}
begin{document}
tikz graph [grow right=2cm] { optionA -> {option1, option2} };
end{document}
tikz-pgf
tikz-pgf
edited Feb 24 at 12:20
user4712458
asked Feb 24 at 11:57
user4712458user4712458
926
926
@marmot, Binary trees appears in a vertical manner. I wanted just 2 options that will appear horizontally.
– user4712458
Feb 24 at 12:18
add a comment |
@marmot, Binary trees appears in a vertical manner. I wanted just 2 options that will appear horizontally.
– user4712458
Feb 24 at 12:18
@marmot, Binary trees appears in a vertical manner. I wanted just 2 options that will appear horizontally.
– user4712458
Feb 24 at 12:18
@marmot, Binary trees appears in a vertical manner. I wanted just 2 options that will appear horizontally.
– user4712458
Feb 24 at 12:18
add a comment |
1 Answer
1
active
oldest
votes
binary tree layout
gives you such graphs. The following example requires lualatex
.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs, graphdrawing}
usegdlibrary{trees}
begin{document}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm,
grow=right] { optionA -> {option1, option2} };
end{tikzpicture}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm] { optionA -> {option1, option2} };
end{tikzpicture}
end{document}
For trees you may want to consider using forest
, which, unlike the above, does not require lualatex
, and is really powerful.
documentclass[tikz,border=3.14mm]{standalone}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={grow'=east,edge = {-latex},
s sep=2cm,l sep=2cm
}
[optionA
[option1]
[option2]
]
end{forest}
end{document}
The first option is exactly how I want to appear them. Thegraphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/
– user4712458
Feb 24 at 12:34
1
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off withforest
, which does not requirelualatex
. AFAIK the graph drawing libraries, on the other hand, do requirelualatex
.
– marmot
Feb 24 at 12:35
1
Yes, using theforest
now it's perfect! Thank you!!
– user4712458
Feb 24 at 12:44
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%2f476447%2fhow-to-draw-a-node-with-two-options-using-tikz-graphs-in-latex%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
binary tree layout
gives you such graphs. The following example requires lualatex
.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs, graphdrawing}
usegdlibrary{trees}
begin{document}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm,
grow=right] { optionA -> {option1, option2} };
end{tikzpicture}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm] { optionA -> {option1, option2} };
end{tikzpicture}
end{document}
For trees you may want to consider using forest
, which, unlike the above, does not require lualatex
, and is really powerful.
documentclass[tikz,border=3.14mm]{standalone}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={grow'=east,edge = {-latex},
s sep=2cm,l sep=2cm
}
[optionA
[option1]
[option2]
]
end{forest}
end{document}
The first option is exactly how I want to appear them. Thegraphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/
– user4712458
Feb 24 at 12:34
1
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off withforest
, which does not requirelualatex
. AFAIK the graph drawing libraries, on the other hand, do requirelualatex
.
– marmot
Feb 24 at 12:35
1
Yes, using theforest
now it's perfect! Thank you!!
– user4712458
Feb 24 at 12:44
add a comment |
binary tree layout
gives you such graphs. The following example requires lualatex
.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs, graphdrawing}
usegdlibrary{trees}
begin{document}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm,
grow=right] { optionA -> {option1, option2} };
end{tikzpicture}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm] { optionA -> {option1, option2} };
end{tikzpicture}
end{document}
For trees you may want to consider using forest
, which, unlike the above, does not require lualatex
, and is really powerful.
documentclass[tikz,border=3.14mm]{standalone}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={grow'=east,edge = {-latex},
s sep=2cm,l sep=2cm
}
[optionA
[option1]
[option2]
]
end{forest}
end{document}
The first option is exactly how I want to appear them. Thegraphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/
– user4712458
Feb 24 at 12:34
1
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off withforest
, which does not requirelualatex
. AFAIK the graph drawing libraries, on the other hand, do requirelualatex
.
– marmot
Feb 24 at 12:35
1
Yes, using theforest
now it's perfect! Thank you!!
– user4712458
Feb 24 at 12:44
add a comment |
binary tree layout
gives you such graphs. The following example requires lualatex
.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs, graphdrawing}
usegdlibrary{trees}
begin{document}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm,
grow=right] { optionA -> {option1, option2} };
end{tikzpicture}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm] { optionA -> {option1, option2} };
end{tikzpicture}
end{document}
For trees you may want to consider using forest
, which, unlike the above, does not require lualatex
, and is really powerful.
documentclass[tikz,border=3.14mm]{standalone}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={grow'=east,edge = {-latex},
s sep=2cm,l sep=2cm
}
[optionA
[option1]
[option2]
]
end{forest}
end{document}
binary tree layout
gives you such graphs. The following example requires lualatex
.
documentclass[tikz,border=3.14mm]{standalone}
usetikzlibrary{graphs, graphdrawing}
usegdlibrary{trees}
begin{document}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm,
grow=right] { optionA -> {option1, option2} };
end{tikzpicture}
begin{tikzpicture}
graph [binary tree layout, level distance=2cm, sibling distance=2cm] { optionA -> {option1, option2} };
end{tikzpicture}
end{document}
For trees you may want to consider using forest
, which, unlike the above, does not require lualatex
, and is really powerful.
documentclass[tikz,border=3.14mm]{standalone}
usepackage[edges]{forest}
begin{document}
begin{forest}
for tree={grow'=east,edge = {-latex},
s sep=2cm,l sep=2cm
}
[optionA
[option1]
[option2]
]
end{forest}
end{document}
edited Feb 24 at 12:40
answered Feb 24 at 12:20
marmotmarmot
112k5144271
112k5144271
The first option is exactly how I want to appear them. Thegraphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/
– user4712458
Feb 24 at 12:34
1
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off withforest
, which does not requirelualatex
. AFAIK the graph drawing libraries, on the other hand, do requirelualatex
.
– marmot
Feb 24 at 12:35
1
Yes, using theforest
now it's perfect! Thank you!!
– user4712458
Feb 24 at 12:44
add a comment |
The first option is exactly how I want to appear them. Thegraphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/
– user4712458
Feb 24 at 12:34
1
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off withforest
, which does not requirelualatex
. AFAIK the graph drawing libraries, on the other hand, do requirelualatex
.
– marmot
Feb 24 at 12:35
1
Yes, using theforest
now it's perfect! Thank you!!
– user4712458
Feb 24 at 12:44
The first option is exactly how I want to appear them. The
graphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/– user4712458
Feb 24 at 12:34
The first option is exactly how I want to appear them. The
graphdrawing
requires to run LuaLaTex, is it any way that I can avoid to use it :/– user4712458
Feb 24 at 12:34
1
1
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off with
forest
, which does not require lualatex
. AFAIK the graph drawing libraries, on the other hand, do require lualatex
.– marmot
Feb 24 at 12:35
@user4712458 Honestly, if you want to draw such trees you will IMHO be much better off with
forest
, which does not require lualatex
. AFAIK the graph drawing libraries, on the other hand, do require lualatex
.– marmot
Feb 24 at 12:35
1
1
Yes, using the
forest
now it's perfect! Thank you!!– user4712458
Feb 24 at 12:44
Yes, using the
forest
now it's perfect! Thank you!!– user4712458
Feb 24 at 12:44
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%2f476447%2fhow-to-draw-a-node-with-two-options-using-tikz-graphs-in-latex%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
@marmot, Binary trees appears in a vertical manner. I wanted just 2 options that will appear horizontally.
– user4712458
Feb 24 at 12:18