Crossing branches in tikz-qtree
I'm translating a manual of syntax and they have some examples of non-valid structures. The first one I was able to reproduce, but not the second.
This is what I'm trying to reproduce:
My current code is the following:
documentclass{article}
usepackage{tikz-qtree}
begin{document}
begin{figure}[h]
centering
textbf{a}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
tikzset{every tree node/.style={align=center,anchor=base}}
tikzset{level 1+/.style={level distance=2baselineskip}}
tikzset{frontier/.style={distance from root=6baselineskip}}
Tree [.a [.b ] [.c ] ]
begin{scope}[grow'=up,yshift=-1.7cm]
Tree [.d [.b ] [.c ] ]
end{scope}
end{tikzpicture}qquad
textbf{b}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
Tree ??????????????????
end{figure}
end{document}
linguistics tikz-qtree qtree
New contributor
add a comment |
I'm translating a manual of syntax and they have some examples of non-valid structures. The first one I was able to reproduce, but not the second.
This is what I'm trying to reproduce:
My current code is the following:
documentclass{article}
usepackage{tikz-qtree}
begin{document}
begin{figure}[h]
centering
textbf{a}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
tikzset{every tree node/.style={align=center,anchor=base}}
tikzset{level 1+/.style={level distance=2baselineskip}}
tikzset{frontier/.style={distance from root=6baselineskip}}
Tree [.a [.b ] [.c ] ]
begin{scope}[grow'=up,yshift=-1.7cm]
Tree [.d [.b ] [.c ] ]
end{scope}
end{tikzpicture}qquad
textbf{b}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
Tree ??????????????????
end{figure}
end{document}
linguistics tikz-qtree qtree
New contributor
add a comment |
I'm translating a manual of syntax and they have some examples of non-valid structures. The first one I was able to reproduce, but not the second.
This is what I'm trying to reproduce:
My current code is the following:
documentclass{article}
usepackage{tikz-qtree}
begin{document}
begin{figure}[h]
centering
textbf{a}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
tikzset{every tree node/.style={align=center,anchor=base}}
tikzset{level 1+/.style={level distance=2baselineskip}}
tikzset{frontier/.style={distance from root=6baselineskip}}
Tree [.a [.b ] [.c ] ]
begin{scope}[grow'=up,yshift=-1.7cm]
Tree [.d [.b ] [.c ] ]
end{scope}
end{tikzpicture}qquad
textbf{b}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
Tree ??????????????????
end{figure}
end{document}
linguistics tikz-qtree qtree
New contributor
I'm translating a manual of syntax and they have some examples of non-valid structures. The first one I was able to reproduce, but not the second.
This is what I'm trying to reproduce:
My current code is the following:
documentclass{article}
usepackage{tikz-qtree}
begin{document}
begin{figure}[h]
centering
textbf{a}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
tikzset{every tree node/.style={align=center,anchor=base}}
tikzset{level 1+/.style={level distance=2baselineskip}}
tikzset{frontier/.style={distance from root=6baselineskip}}
Tree [.a [.b ] [.c ] ]
begin{scope}[grow'=up,yshift=-1.7cm]
Tree [.d [.b ] [.c ] ]
end{scope}
end{tikzpicture}qquad
textbf{b}) begin{tikzpicture}[level distance=30pt,sibling distance=5mm]
Tree ??????????????????
end{figure}
end{document}
linguistics tikz-qtree qtree
linguistics tikz-qtree qtree
New contributor
New contributor
New contributor
asked 1 hour ago
Ricardo Ricardo
132
132
New contributor
New contributor
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
These do not necessarily look like trees, so I would not necessarily recommend to use a library specialized on trees for that.
documentclass{article}
usepackage{subfig}
usepackage{tikz}
usetikzlibrary{matrix}
begin{document}
begin{figure}[h]
centering
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center,inner sep=2pt},ampersand replacement=&]
{
& a & \
b & & c\
& d &\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1.south) -- (mat-3-2.north) -- (mat-2-3.south);
end{tikzpicture}}
qquad
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center},ampersand replacement=&]
{
& a & \
b & & c\
e & & d\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1) -- (mat-3-3) (mat-2-3) -- (mat-3-1);
end{tikzpicture}}
end{figure}
end{document}
Perfect, thank you!
– Ricardo
1 hour ago
add a comment |
An alternative to marmot's nice answer:
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north)--(c.south);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north);
draw (c.south)--(e.north);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
But I prefer this
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b)--(a)--(c)--(d)--(b);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (d)--(b)--(a)--(c)--(e);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
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
});
}
});
Ricardo is a new contributor. Be nice, and check out our Code of Conduct.
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%2f475938%2fcrossing-branches-in-tikz-qtree%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
These do not necessarily look like trees, so I would not necessarily recommend to use a library specialized on trees for that.
documentclass{article}
usepackage{subfig}
usepackage{tikz}
usetikzlibrary{matrix}
begin{document}
begin{figure}[h]
centering
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center,inner sep=2pt},ampersand replacement=&]
{
& a & \
b & & c\
& d &\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1.south) -- (mat-3-2.north) -- (mat-2-3.south);
end{tikzpicture}}
qquad
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center},ampersand replacement=&]
{
& a & \
b & & c\
e & & d\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1) -- (mat-3-3) (mat-2-3) -- (mat-3-1);
end{tikzpicture}}
end{figure}
end{document}
Perfect, thank you!
– Ricardo
1 hour ago
add a comment |
These do not necessarily look like trees, so I would not necessarily recommend to use a library specialized on trees for that.
documentclass{article}
usepackage{subfig}
usepackage{tikz}
usetikzlibrary{matrix}
begin{document}
begin{figure}[h]
centering
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center,inner sep=2pt},ampersand replacement=&]
{
& a & \
b & & c\
& d &\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1.south) -- (mat-3-2.north) -- (mat-2-3.south);
end{tikzpicture}}
qquad
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center},ampersand replacement=&]
{
& a & \
b & & c\
e & & d\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1) -- (mat-3-3) (mat-2-3) -- (mat-3-1);
end{tikzpicture}}
end{figure}
end{document}
Perfect, thank you!
– Ricardo
1 hour ago
add a comment |
These do not necessarily look like trees, so I would not necessarily recommend to use a library specialized on trees for that.
documentclass{article}
usepackage{subfig}
usepackage{tikz}
usetikzlibrary{matrix}
begin{document}
begin{figure}[h]
centering
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center,inner sep=2pt},ampersand replacement=&]
{
& a & \
b & & c\
& d &\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1.south) -- (mat-3-2.north) -- (mat-2-3.south);
end{tikzpicture}}
qquad
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center},ampersand replacement=&]
{
& a & \
b & & c\
e & & d\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1) -- (mat-3-3) (mat-2-3) -- (mat-3-1);
end{tikzpicture}}
end{figure}
end{document}
These do not necessarily look like trees, so I would not necessarily recommend to use a library specialized on trees for that.
documentclass{article}
usepackage{subfig}
usepackage{tikz}
usetikzlibrary{matrix}
begin{document}
begin{figure}[h]
centering
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center,inner sep=2pt},ampersand replacement=&]
{
& a & \
b & & c\
& d &\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1.south) -- (mat-3-2.north) -- (mat-2-3.south);
end{tikzpicture}}
qquad
subfloat{begin{tikzpicture}
matrix (mat) [matrix of nodes,column sep=1em,row sep=1em,
nodes={align=center},ampersand replacement=&]
{
& a & \
b & & c\
e & & d\
};
draw (mat-2-1.north) -- (mat-1-2.south) -- (mat-2-3.north)
(mat-2-1) -- (mat-3-3) (mat-2-3) -- (mat-3-1);
end{tikzpicture}}
end{figure}
end{document}
answered 1 hour ago
marmotmarmot
102k4119229
102k4119229
Perfect, thank you!
– Ricardo
1 hour ago
add a comment |
Perfect, thank you!
– Ricardo
1 hour ago
Perfect, thank you!
– Ricardo
1 hour ago
Perfect, thank you!
– Ricardo
1 hour ago
add a comment |
An alternative to marmot's nice answer:
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north)--(c.south);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north);
draw (c.south)--(e.north);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
But I prefer this
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b)--(a)--(c)--(d)--(b);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (d)--(b)--(a)--(c)--(e);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
add a comment |
An alternative to marmot's nice answer:
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north)--(c.south);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north);
draw (c.south)--(e.north);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
But I prefer this
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b)--(a)--(c)--(d)--(b);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (d)--(b)--(a)--(c)--(e);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
add a comment |
An alternative to marmot's nice answer:
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north)--(c.south);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north);
draw (c.south)--(e.north);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
But I prefer this
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b)--(a)--(c)--(d)--(b);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (d)--(b)--(a)--(c)--(e);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
An alternative to marmot's nice answer:
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north)--(c.south);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (b.north)--(a.south)--(c.north);
draw (b.south)--(d.north);
draw (c.south)--(e.north);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
But I prefer this
documentclass{article}
usepackage{tikz}
usepackage{subcaption}
begin{document}
begin{figure}
centering
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (0,-2) {d};
draw (b)--(a)--(c)--(d)--(b);
end{tikzpicture}
caption{}
end{subfigure}%
begin{subfigure}[t]{0.5textwidth}
centering
begin{tikzpicture}[y=1.5cm,every node/.style={circle,draw,minimum size=0.75cm}]
node (a) at (0,0) {a};
node (b) at (-1,-1) {b};
node (c) at (1,-1) {c};
node (d) at (1,-2) {d};
node (e) at (-1,-2) {e};
draw (d)--(b)--(a)--(c)--(e);
end{tikzpicture}
caption{}
end{subfigure}
end{figure}
end{document}
answered 47 mins ago
JouleVJouleV
4,0411937
4,0411937
add a comment |
add a comment |
Ricardo is a new contributor. Be nice, and check out our Code of Conduct.
Ricardo is a new contributor. Be nice, and check out our Code of Conduct.
Ricardo is a new contributor. Be nice, and check out our Code of Conduct.
Ricardo is a new contributor. Be nice, and check out our Code of Conduct.
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%2f475938%2fcrossing-branches-in-tikz-qtree%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