Strange error for passing parameter to forestset to draw tree
up vote
5
down vote
favorite
I am trying to draw a simple probability tree, where the probabilites could sometimes be fraction or decimals., this means, I will have to adjust the spacing. So I tried the below code. This produces tree but label gone, and error thrown.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style 3 args={
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased, my edge label={above}{xshift=-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Output:
Error:
tikz-pgf tikz-styles forest arguments
add a comment |
up vote
5
down vote
favorite
I am trying to draw a simple probability tree, where the probabilites could sometimes be fraction or decimals., this means, I will have to adjust the spacing. So I tried the below code. This produces tree but label gone, and error thrown.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style 3 args={
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased, my edge label={above}{xshift=-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Output:
Error:
tikz-pgf tikz-styles forest arguments
Might be useful if you also cite the error
– daleif
Nov 24 at 14:15
I have added the screenshot
– Parthiban Rajendran
Nov 24 at 14:16
add a comment |
up vote
5
down vote
favorite
up vote
5
down vote
favorite
I am trying to draw a simple probability tree, where the probabilites could sometimes be fraction or decimals., this means, I will have to adjust the spacing. So I tried the below code. This produces tree but label gone, and error thrown.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style 3 args={
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased, my edge label={above}{xshift=-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Output:
Error:
tikz-pgf tikz-styles forest arguments
I am trying to draw a simple probability tree, where the probabilites could sometimes be fraction or decimals., this means, I will have to adjust the spacing. So I tried the below code. This produces tree but label gone, and error thrown.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style 3 args={
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased, my edge label={above}{xshift=-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Output:
Error:
tikz-pgf tikz-styles forest arguments
tikz-pgf tikz-styles forest arguments
edited Nov 24 at 15:14
Bernard
164k769192
164k769192
asked Nov 24 at 14:14
Parthiban Rajendran
3387
3387
Might be useful if you also cite the error
– daleif
Nov 24 at 14:15
I have added the screenshot
– Parthiban Rajendran
Nov 24 at 14:16
add a comment |
Might be useful if you also cite the error
– daleif
Nov 24 at 14:15
I have added the screenshot
– Parthiban Rajendran
Nov 24 at 14:16
Might be useful if you also cite the error
– daleif
Nov 24 at 14:15
Might be useful if you also cite the error
– daleif
Nov 24 at 14:15
I have added the screenshot
– Parthiban Rajendran
Nov 24 at 14:16
I have added the screenshot
– Parthiban Rajendran
Nov 24 at 14:16
add a comment |
1 Answer
1
active
oldest
votes
up vote
6
down vote
accepted
There are actually 2 issues.
style 3 args
does not exist, usestyle n args={3}{...
instead.- You define for the 2nd argument
xshift=#2
but add one morexshift
when you are sayingmy edge label={above}{xshift=-2mm}{0.002}
.
Working code:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={3}{
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above}{-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Simpler code: pgfkeys already accept comma-separated arguments, which is illustrated in my edge label={above,xshift=-3mm}{0.002}
. And instead the xshift
you my just use above left
or below left
etc., as in my edge label={below left}{0.998}
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={2}{
edge label={node[midway, font=sffamilyscriptsize,#1]{#2}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above,xshift=-3mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease,my edge label={below left}{0.998}
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Instead ofabove
and a negativexshift
you may also tryabove left
.
– marmot
Nov 24 at 14:25
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
1
@PaariVendhannode
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.
– marmot
Nov 24 at 18:07
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
6
down vote
accepted
There are actually 2 issues.
style 3 args
does not exist, usestyle n args={3}{...
instead.- You define for the 2nd argument
xshift=#2
but add one morexshift
when you are sayingmy edge label={above}{xshift=-2mm}{0.002}
.
Working code:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={3}{
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above}{-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Simpler code: pgfkeys already accept comma-separated arguments, which is illustrated in my edge label={above,xshift=-3mm}{0.002}
. And instead the xshift
you my just use above left
or below left
etc., as in my edge label={below left}{0.998}
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={2}{
edge label={node[midway, font=sffamilyscriptsize,#1]{#2}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above,xshift=-3mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease,my edge label={below left}{0.998}
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Instead ofabove
and a negativexshift
you may also tryabove left
.
– marmot
Nov 24 at 14:25
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
1
@PaariVendhannode
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.
– marmot
Nov 24 at 18:07
add a comment |
up vote
6
down vote
accepted
There are actually 2 issues.
style 3 args
does not exist, usestyle n args={3}{...
instead.- You define for the 2nd argument
xshift=#2
but add one morexshift
when you are sayingmy edge label={above}{xshift=-2mm}{0.002}
.
Working code:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={3}{
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above}{-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Simpler code: pgfkeys already accept comma-separated arguments, which is illustrated in my edge label={above,xshift=-3mm}{0.002}
. And instead the xshift
you my just use above left
or below left
etc., as in my edge label={below left}{0.998}
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={2}{
edge label={node[midway, font=sffamilyscriptsize,#1]{#2}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above,xshift=-3mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease,my edge label={below left}{0.998}
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Instead ofabove
and a negativexshift
you may also tryabove left
.
– marmot
Nov 24 at 14:25
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
1
@PaariVendhannode
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.
– marmot
Nov 24 at 18:07
add a comment |
up vote
6
down vote
accepted
up vote
6
down vote
accepted
There are actually 2 issues.
style 3 args
does not exist, usestyle n args={3}{...
instead.- You define for the 2nd argument
xshift=#2
but add one morexshift
when you are sayingmy edge label={above}{xshift=-2mm}{0.002}
.
Working code:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={3}{
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above}{-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Simpler code: pgfkeys already accept comma-separated arguments, which is illustrated in my edge label={above,xshift=-3mm}{0.002}
. And instead the xshift
you my just use above left
or below left
etc., as in my edge label={below left}{0.998}
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={2}{
edge label={node[midway, font=sffamilyscriptsize,#1]{#2}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above,xshift=-3mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease,my edge label={below left}{0.998}
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
There are actually 2 issues.
style 3 args
does not exist, usestyle n args={3}{...
instead.- You define for the 2nd argument
xshift=#2
but add one morexshift
when you are sayingmy edge label={above}{xshift=-2mm}{0.002}
.
Working code:
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={3}{
edge label={node[midway, font=sffamilyscriptsize, #1,xshift=#2]{#3}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above}{-2mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
Simpler code: pgfkeys already accept comma-separated arguments, which is illustrated in my edge label={above,xshift=-3mm}{0.002}
. And instead the xshift
you my just use above left
or below left
etc., as in my edge label={below left}{0.998}
.
documentclass{article}
usepackage[utf8]{inputenc}
usepackage[linguistics]{forest}
usepackage{philex}
forestset{
my edge label/.style n args={2}{
edge label={node[midway, font=sffamilyscriptsize,#1]{#2}},
},
}
title{Problem customizing forest tree}
author{parthi292929 }
date{November 2018}
begin{document}
maketitle
section{Introduction}
scalebox{1.2}{
begin{forest}
for tree={grow'=east}
[0
[Diseased,my edge label={above,xshift=-3mm}{0.002}
[Positive
]
[Negative(FN)
]
]
[No Disease,my edge label={below left}{0.998}
[Positive
]
[Negative
]
]
]
]
end{forest}
}
end{document}
edited Nov 24 at 18:16
answered Nov 24 at 14:23
marmot
82.1k492175
82.1k492175
Instead ofabove
and a negativexshift
you may also tryabove left
.
– marmot
Nov 24 at 14:25
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
1
@PaariVendhannode
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.
– marmot
Nov 24 at 18:07
add a comment |
Instead ofabove
and a negativexshift
you may also tryabove left
.
– marmot
Nov 24 at 14:25
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
1
@PaariVendhannode
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.
– marmot
Nov 24 at 18:07
Instead of
above
and a negative xshift
you may also try above left
.– marmot
Nov 24 at 14:25
Instead of
above
and a negative xshift
you may also try above left
.– marmot
Nov 24 at 14:25
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
thanks marmot :) any way I could make that optional also, so I need not always give that some default value?
– Parthiban Rajendran
Nov 24 at 14:52
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
@PaariVendhan Yes, of course, with pgfkeys. (Sorry, I was hibernating.) What do you want to make default? (Will decouple now again for one hour.)
– marmot
Nov 24 at 17:24
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
No, not default, just optional (so even if i do not pass anything, nothing happens foreg, what happens if i did not send xshift value - result should be if what if i did not use xshift in the style)
– Parthiban Rajendran
Nov 24 at 17:35
1
1
@PaariVendhan
node
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.– marmot
Nov 24 at 18:07
@PaariVendhan
node
s already allow for optional keys, so IMHO you only need 2 arguments, not three. I illustrated this in another example.– marmot
Nov 24 at 18:07
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f461558%2fstrange-error-for-passing-parameter-to-forestset-to-draw-tree%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
Might be useful if you also cite the error
– daleif
Nov 24 at 14:15
I have added the screenshot
– Parthiban Rajendran
Nov 24 at 14:16