forest, changing `s sep` such that it is at each second end node larger? The Next CEO of Stack...
Does the Brexit deal have to be agreed by both Houses?
How do I get the green key off the shelf in the Dobby level of Lego Harry Potter 2?
Return the Closest Prime Number
Rotate a column
What does this shorthand mean?
Is HostGator storing my password in plaintext?
Too much space between section and text in a twocolumn document
Can the Reverse Gravity spell affect the Meteor Swarm spell?
Science fiction novels about a solar system spanning civilisation where people change their bodies at will
MAZDA 3 2006 (UK) - poor acceleration then takes off at 3250 revs
How can I quit an app using Terminal?
Apart from "berlinern", do any other German dialects have a corresponding verb?
How to count occurrences of text in a file?
Explicit solution of a Hamiltonian system
How to start emacs in "nothing" mode (`fundamental-mode`)
Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?
How can I open an app using Terminal?
Increase performance creating Mandelbrot set in python
Is it a good idea to use COLUMN AS (left([Another_Column],(4)) instead of LEFT in the select?
Customer Requests (Sometimes) Drive Me Bonkers!
Anatomically Correct Mesopelagic Aves
How to be diplomatic in refusing to write code that breaches the privacy of our users
Science fiction (dystopian) short story set after WWIII
How do spells that require an ability check vs. the caster's spell save DC work?
forest, changing `s sep` such that it is at each second end node larger?
The Next CEO of Stack OverflowOverlapping nodes in a decision treeCreating a tree using the forest package such that different nodes are alignedLaTeX: how to make a horizontal tree that is closed at the end (forest)Radial node arrangement in Forest
The following MWE generate a tree diagram (using the forest
package) as I like to have:
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep= 1 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
I wonder, if it is possible to obtain the same result without inserting phantom nodes? Also I will appreciate any improvements of the my MWE code.
addendum: one way is insert manually s sep
as is done code below:
[Start,s sep=4mm
[A, EL=leq 0.5,s sep=4mm
[A1, EL=leq 0.3,s sep=1mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3,s sep=1mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5,s sep=4mm
[B1, EL=leq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
considering above solution the question is now: is possible to write a code in fortree
preamble, which will replace tose manulaly inserted s sep=...
?
forest
add a comment |
The following MWE generate a tree diagram (using the forest
package) as I like to have:
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep= 1 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
I wonder, if it is possible to obtain the same result without inserting phantom nodes? Also I will appreciate any improvements of the my MWE code.
addendum: one way is insert manually s sep
as is done code below:
[Start,s sep=4mm
[A, EL=leq 0.5,s sep=4mm
[A1, EL=leq 0.3,s sep=1mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3,s sep=1mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5,s sep=4mm
[B1, EL=leq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
considering above solution the question is now: is possible to write a code in fortree
preamble, which will replace tose manulaly inserted s sep=...
?
forest
add a comment |
The following MWE generate a tree diagram (using the forest
package) as I like to have:
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep= 1 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
I wonder, if it is possible to obtain the same result without inserting phantom nodes? Also I will appreciate any improvements of the my MWE code.
addendum: one way is insert manually s sep
as is done code below:
[Start,s sep=4mm
[A, EL=leq 0.5,s sep=4mm
[A1, EL=leq 0.3,s sep=1mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3,s sep=1mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5,s sep=4mm
[B1, EL=leq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
considering above solution the question is now: is possible to write a code in fortree
preamble, which will replace tose manulaly inserted s sep=...
?
forest
The following MWE generate a tree diagram (using the forest
package) as I like to have:
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep= 1 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
I wonder, if it is possible to obtain the same result without inserting phantom nodes? Also I will appreciate any improvements of the my MWE code.
addendum: one way is insert manually s sep
as is done code below:
[Start,s sep=4mm
[A, EL=leq 0.5,s sep=4mm
[A1, EL=leq 0.3,s sep=1mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3,s sep=1mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5,s sep=4mm
[B1, EL=leq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3,s sep=1mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
considering above solution the question is now: is possible to write a code in fortree
preamble, which will replace tose manulaly inserted s sep=...
?
forest
forest
edited 3 hours ago
Zarko
asked 5 hours ago
ZarkoZarko
128k868167
128k868167
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Yes. Use s sep+
.
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep+=2mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3,s sep+=-3mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3,s sep+=-3mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
And I had this on my machine before Zarko pinged me. (I didn't think it is worthwhile to add an update for it.)
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
s sep=4mm,
l sep=13 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
},
where level=2{s sep+=-1mm}{s sep+=0.5mm}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller betweenA11
andA12
and bigger betweenA21
andA22
, etc.
– Zarko
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
with help of your answer and after readingforest
documentation again (and again) i figured out solution which i like to have: from your code i remove alls sep+=-3mm
from nodes on the second level and tofortree
add optionwhere level=2{s sep+=-1mm}{}
. it works fine.
– Zarko
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.where level=2{s sep+=...}{s sep+=...}
but with other dimensions.
– marmot
1 hour ago
add a comment |
Just for record. With help of nice @marmot answer and after reading forest
documentation again (and again) i figured out the solution which i looked for:
documentclass[border=3mm, preview]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesizesffamily, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "ELS=east"
pos=0.6}
}
begin{forest}
for tree={
draw,
semithick,
% fill=orange!20,
parent anchor=children,
l sep=13 mm,
s sep=4mm,
where level=2{s sep=1mm}{}
},
EL/.style = {
before typesetting nodes={%
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
] end{forest}
end{document}
which gives desired result:
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%2f481967%2fforest-changing-s-sep-such-that-it-is-at-each-second-end-node-larger%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
Yes. Use s sep+
.
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep+=2mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3,s sep+=-3mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3,s sep+=-3mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
And I had this on my machine before Zarko pinged me. (I didn't think it is worthwhile to add an update for it.)
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
s sep=4mm,
l sep=13 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
},
where level=2{s sep+=-1mm}{s sep+=0.5mm}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller betweenA11
andA12
and bigger betweenA21
andA22
, etc.
– Zarko
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
with help of your answer and after readingforest
documentation again (and again) i figured out solution which i like to have: from your code i remove alls sep+=-3mm
from nodes on the second level and tofortree
add optionwhere level=2{s sep+=-1mm}{}
. it works fine.
– Zarko
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.where level=2{s sep+=...}{s sep+=...}
but with other dimensions.
– marmot
1 hour ago
add a comment |
Yes. Use s sep+
.
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep+=2mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3,s sep+=-3mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3,s sep+=-3mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
And I had this on my machine before Zarko pinged me. (I didn't think it is worthwhile to add an update for it.)
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
s sep=4mm,
l sep=13 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
},
where level=2{s sep+=-1mm}{s sep+=0.5mm}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller betweenA11
andA12
and bigger betweenA21
andA22
, etc.
– Zarko
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
with help of your answer and after readingforest
documentation again (and again) i figured out solution which i like to have: from your code i remove alls sep+=-3mm
from nodes on the second level and tofortree
add optionwhere level=2{s sep+=-1mm}{}
. it works fine.
– Zarko
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.where level=2{s sep+=...}{s sep+=...}
but with other dimensions.
– marmot
1 hour ago
add a comment |
Yes. Use s sep+
.
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep+=2mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3,s sep+=-3mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3,s sep+=-3mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
And I had this on my machine before Zarko pinged me. (I didn't think it is worthwhile to add an update for it.)
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
s sep=4mm,
l sep=13 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
},
where level=2{s sep+=-1mm}{s sep+=0.5mm}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
Yes. Use s sep+
.
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
l sep=13 mm,
s sep+=2mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3,s sep+=-3mm
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3,s sep+=-3mm
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3,s sep+=-3mm
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
And I had this on my machine before Zarko pinged me. (I didn't think it is worthwhile to add an update for it.)
documentclass[border=3mm]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesize, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "EL=east"
pos=0.6}
}
newcommandEL{edge label}
begin{forest}
for tree={
draw, semithick,
parent anchor=children,
s sep=4mm,
l sep=13 mm,
anchor=parent,% <--- work around alignment issue
},
EL/.style = {
before typesetting nodes={%% <--- work around edge labels positioning
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
},
where level=2{s sep+=-1mm}{s sep+=0.5mm}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
%[,phantom,fit=band] % <---
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
%[,phantom,fit=band] % <---
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
]
end{forest}
end{document}
edited 47 mins ago
answered 4 hours ago
marmotmarmot
112k5143270
112k5143270
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller betweenA11
andA12
and bigger betweenA21
andA22
, etc.
– Zarko
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
with help of your answer and after readingforest
documentation again (and again) i figured out solution which i like to have: from your code i remove alls sep+=-3mm
from nodes on the second level and tofortree
add optionwhere level=2{s sep+=-1mm}{}
. it works fine.
– Zarko
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.where level=2{s sep+=...}{s sep+=...}
but with other dimensions.
– marmot
1 hour ago
add a comment |
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller betweenA11
andA12
and bigger betweenA21
andA22
, etc.
– Zarko
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
with help of your answer and after readingforest
documentation again (and again) i figured out solution which i like to have: from your code i remove alls sep+=-3mm
from nodes on the second level and tofortree
add optionwhere level=2{s sep+=-1mm}{}
. it works fine.
– Zarko
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.where level=2{s sep+=...}{s sep+=...}
but with other dimensions.
– marmot
1 hour ago
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by
% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller between A11
and A12
and bigger between A21
and A22
, etc.– Zarko
3 hours ago
thank you very much for answer. apparently my question is not clear enough. i like to obtain in question showed image with removed ˙phantom` nodes (indicated by
% <---
). as i see, in your suggestion the distances between nodes at level 0 are equal. i like to have smaller between A11
and A12
and bigger between A21
and A22
, etc.– Zarko
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
@Zarko Sorry, didn't read carefully. Better now?
– marmot
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
yes, that is. i need to check how you achieve this :-)
– Zarko
3 hours ago
with help of your answer and after reading
forest
documentation again (and again) i figured out solution which i like to have: from your code i remove all s sep+=-3mm
from nodes on the second level and to fortree
add option where level=2{s sep+=-1mm}{}
. it works fine.– Zarko
1 hour ago
with help of your answer and after reading
forest
documentation again (and again) i figured out solution which i like to have: from your code i remove all s sep+=-3mm
from nodes on the second level and to fortree
add option where level=2{s sep+=-1mm}{}
. it works fine.– Zarko
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.
where level=2{s sep+=...}{s sep+=...}
but with other dimensions.– marmot
1 hour ago
@Zarko Yes, I have almost the same thing on my machine.
where level=2{s sep+=...}{s sep+=...}
but with other dimensions.– marmot
1 hour ago
add a comment |
Just for record. With help of nice @marmot answer and after reading forest
documentation again (and again) i figured out the solution which i looked for:
documentclass[border=3mm, preview]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesizesffamily, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "ELS=east"
pos=0.6}
}
begin{forest}
for tree={
draw,
semithick,
% fill=orange!20,
parent anchor=children,
l sep=13 mm,
s sep=4mm,
where level=2{s sep=1mm}{}
},
EL/.style = {
before typesetting nodes={%
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
] end{forest}
end{document}
which gives desired result:
add a comment |
Just for record. With help of nice @marmot answer and after reading forest
documentation again (and again) i figured out the solution which i looked for:
documentclass[border=3mm, preview]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesizesffamily, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "ELS=east"
pos=0.6}
}
begin{forest}
for tree={
draw,
semithick,
% fill=orange!20,
parent anchor=children,
l sep=13 mm,
s sep=4mm,
where level=2{s sep=1mm}{}
},
EL/.style = {
before typesetting nodes={%
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
] end{forest}
end{document}
which gives desired result:
add a comment |
Just for record. With help of nice @marmot answer and after reading forest
documentation again (and again) i figured out the solution which i looked for:
documentclass[border=3mm, preview]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesizesffamily, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "ELS=east"
pos=0.6}
}
begin{forest}
for tree={
draw,
semithick,
% fill=orange!20,
parent anchor=children,
l sep=13 mm,
s sep=4mm,
where level=2{s sep=1mm}{}
},
EL/.style = {
before typesetting nodes={%
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
] end{forest}
end{document}
which gives desired result:
Just for record. With help of nice @marmot answer and after reading forest
documentation again (and again) i figured out the solution which i looked for:
documentclass[border=3mm, preview]{standalone}
usepackage{forest}
begin{document}
tikzset{ELS/.style={% Edge Label Style
font=footnotesizesffamily, inner sep=2pt,
anchor=south #1, % label position: "ELS=west" or "ELS=east"
pos=0.6}
}
begin{forest}
for tree={
draw,
semithick,
% fill=orange!20,
parent anchor=children,
l sep=13 mm,
s sep=4mm,
where level=2{s sep=1mm}{}
},
EL/.style = {
before typesetting nodes={%
where n=1{%
edge label/.wrap value={node[ELS=east]{$#1$}}
}{%
edge label/.wrap value={node[ELS=west]{$#1$}}
}
}
}
[Start
[A, EL=leq 0.5
[A1, EL=leq 0.3
[A11, EL=leq 0.7]
[A12, EL=geq 0.7]
]
[A2, EL=geq 0.3
[A21, EL=leq 0.7]
[A22, EL=geq 0.7]
]
]
[B, EL=geq 0.5
[B1, EL=leq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
[B2, EL=geq 0.3
[B11, EL=leq 0.7]
[B12, EL=geq 0.7]
]
]
] end{forest}
end{document}
which gives desired result:
edited 27 mins ago
answered 1 hour ago
ZarkoZarko
128k868167
128k868167
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%2f481967%2fforest-changing-s-sep-such-that-it-is-at-each-second-end-node-larger%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