Center align text decoration along path
up vote
3
down vote
favorite
I am trying to duplicate the node highlighted in green but along a curved path. It mostly works, but when I attempt to apply the text align=center
effect to the decoration
, I get
Dimension too large.
I get pretty good results if I set defRadius{2.8cm}
.
But, if I set defRadius{2.6cm}
, then I get the same error as above. This I suspect is due to the fact that the text can no longer fit along the given path.
To avoid this problem in the future, if I can get the text align=center
to work, I can provide a path
which is more than sufficient to place the text and draw the node
separately.
As per AndreC's comment, commenting out the fill=yellow
and rounded corners=2pt
:
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
text align=center,% <---- Uncommented
},
decorate,
},
%% No error with these commented, but results are wack!!
%fill=yellow,
%rounded corners=2pt,
]
no longer results in an error. However, with this I get the following:
Notes:
- The MWE as is produces the image shown above as the
text align=center
is commented out. To get the railing case, that needs to be uncommented.
Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations}
usetikzlibrary{decorations.text}
newcommand{MyText}{ABCDEF}
tikzset{My Node Style/.style={
fill=green,
draw=red,
inner sep=2pt,
rounded corners=2pt,
font=tiny,
}}
begin{document}
begin{tikzpicture}
node [My Node Style] at (0,2.5) {textsc{MyText}};
defRadius{3.0cm}
defStartAngle{100}
defEndAngle{80}
defNodeThickness{1.6ex}
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
%text align=center,% <---- ????? Dimension too big ?????
},
decorate,
},
fill=yellow,
rounded corners=2pt,
]
([shift={(StartAngle:Radius)}]0,0)
arc [start angle=StartAngle, end angle=EndAngle, radius=Radius]
-- ++(EndAngle:NodeThickness)
arc [start angle=EndAngle, end angle=StartAngle, radius=Radius+NodeThickness]
-- cycle
;
end{tikzpicture}
end{document}
tikz-pgf nodes text-decorations rounded-corners
|
show 4 more comments
up vote
3
down vote
favorite
I am trying to duplicate the node highlighted in green but along a curved path. It mostly works, but when I attempt to apply the text align=center
effect to the decoration
, I get
Dimension too large.
I get pretty good results if I set defRadius{2.8cm}
.
But, if I set defRadius{2.6cm}
, then I get the same error as above. This I suspect is due to the fact that the text can no longer fit along the given path.
To avoid this problem in the future, if I can get the text align=center
to work, I can provide a path
which is more than sufficient to place the text and draw the node
separately.
As per AndreC's comment, commenting out the fill=yellow
and rounded corners=2pt
:
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
text align=center,% <---- Uncommented
},
decorate,
},
%% No error with these commented, but results are wack!!
%fill=yellow,
%rounded corners=2pt,
]
no longer results in an error. However, with this I get the following:
Notes:
- The MWE as is produces the image shown above as the
text align=center
is commented out. To get the railing case, that needs to be uncommented.
Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations}
usetikzlibrary{decorations.text}
newcommand{MyText}{ABCDEF}
tikzset{My Node Style/.style={
fill=green,
draw=red,
inner sep=2pt,
rounded corners=2pt,
font=tiny,
}}
begin{document}
begin{tikzpicture}
node [My Node Style] at (0,2.5) {textsc{MyText}};
defRadius{3.0cm}
defStartAngle{100}
defEndAngle{80}
defNodeThickness{1.6ex}
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
%text align=center,% <---- ????? Dimension too big ?????
},
decorate,
},
fill=yellow,
rounded corners=2pt,
]
([shift={(StartAngle:Radius)}]0,0)
arc [start angle=StartAngle, end angle=EndAngle, radius=Radius]
-- ++(EndAngle:NodeThickness)
arc [start angle=EndAngle, end angle=StartAngle, radius=Radius+NodeThickness]
-- cycle
;
end{tikzpicture}
end{document}
tikz-pgf nodes text-decorations rounded-corners
If you comment on the two linesfill=yellow
androunded corners=2pt
, there are no more errors.
– AndréC
Nov 28 at 20:10
You could just measure the width of the text and then adjustStartAngle
andEndAngle
to be such that the text is centered. (Of course, this will make the node smaller.)
– marmot
Nov 28 at 20:18
There is no error withtext align=left
, but there is one withtext align=right
, would that be a bug with these key?
– AndréC
Nov 28 at 20:25
@AndréC: Yes, no error, but not quite the results I want. See updated question.
– Peter Grill
Nov 28 at 20:41
@marmot: Yep, that was the comment regarding usingdefRadius{2.8cm}
. However, if the text changes in the future it'll take time for me to figure out what is going on, so would prefer a more robust solution.
– Peter Grill
Nov 28 at 20:42
|
show 4 more comments
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I am trying to duplicate the node highlighted in green but along a curved path. It mostly works, but when I attempt to apply the text align=center
effect to the decoration
, I get
Dimension too large.
I get pretty good results if I set defRadius{2.8cm}
.
But, if I set defRadius{2.6cm}
, then I get the same error as above. This I suspect is due to the fact that the text can no longer fit along the given path.
To avoid this problem in the future, if I can get the text align=center
to work, I can provide a path
which is more than sufficient to place the text and draw the node
separately.
As per AndreC's comment, commenting out the fill=yellow
and rounded corners=2pt
:
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
text align=center,% <---- Uncommented
},
decorate,
},
%% No error with these commented, but results are wack!!
%fill=yellow,
%rounded corners=2pt,
]
no longer results in an error. However, with this I get the following:
Notes:
- The MWE as is produces the image shown above as the
text align=center
is commented out. To get the railing case, that needs to be uncommented.
Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations}
usetikzlibrary{decorations.text}
newcommand{MyText}{ABCDEF}
tikzset{My Node Style/.style={
fill=green,
draw=red,
inner sep=2pt,
rounded corners=2pt,
font=tiny,
}}
begin{document}
begin{tikzpicture}
node [My Node Style] at (0,2.5) {textsc{MyText}};
defRadius{3.0cm}
defStartAngle{100}
defEndAngle{80}
defNodeThickness{1.6ex}
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
%text align=center,% <---- ????? Dimension too big ?????
},
decorate,
},
fill=yellow,
rounded corners=2pt,
]
([shift={(StartAngle:Radius)}]0,0)
arc [start angle=StartAngle, end angle=EndAngle, radius=Radius]
-- ++(EndAngle:NodeThickness)
arc [start angle=EndAngle, end angle=StartAngle, radius=Radius+NodeThickness]
-- cycle
;
end{tikzpicture}
end{document}
tikz-pgf nodes text-decorations rounded-corners
I am trying to duplicate the node highlighted in green but along a curved path. It mostly works, but when I attempt to apply the text align=center
effect to the decoration
, I get
Dimension too large.
I get pretty good results if I set defRadius{2.8cm}
.
But, if I set defRadius{2.6cm}
, then I get the same error as above. This I suspect is due to the fact that the text can no longer fit along the given path.
To avoid this problem in the future, if I can get the text align=center
to work, I can provide a path
which is more than sufficient to place the text and draw the node
separately.
As per AndreC's comment, commenting out the fill=yellow
and rounded corners=2pt
:
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
text align=center,% <---- Uncommented
},
decorate,
},
%% No error with these commented, but results are wack!!
%fill=yellow,
%rounded corners=2pt,
]
no longer results in an error. However, with this I get the following:
Notes:
- The MWE as is produces the image shown above as the
text align=center
is commented out. To get the railing case, that needs to be uncommented.
Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{decorations}
usetikzlibrary{decorations.text}
newcommand{MyText}{ABCDEF}
tikzset{My Node Style/.style={
fill=green,
draw=red,
inner sep=2pt,
rounded corners=2pt,
font=tiny,
}}
begin{document}
begin{tikzpicture}
node [My Node Style] at (0,2.5) {textsc{MyText}};
defRadius{3.0cm}
defStartAngle{100}
defEndAngle{80}
defNodeThickness{1.6ex}
draw [draw=red,
postaction={
decoration={
text along path,
text={|+tinyscshape|MyText},
raise=0.5ex,
%text align=center,% <---- ????? Dimension too big ?????
},
decorate,
},
fill=yellow,
rounded corners=2pt,
]
([shift={(StartAngle:Radius)}]0,0)
arc [start angle=StartAngle, end angle=EndAngle, radius=Radius]
-- ++(EndAngle:NodeThickness)
arc [start angle=EndAngle, end angle=StartAngle, radius=Radius+NodeThickness]
-- cycle
;
end{tikzpicture}
end{document}
tikz-pgf nodes text-decorations rounded-corners
tikz-pgf nodes text-decorations rounded-corners
edited Nov 28 at 20:40
asked Nov 28 at 19:46
Peter Grill
163k24432743
163k24432743
If you comment on the two linesfill=yellow
androunded corners=2pt
, there are no more errors.
– AndréC
Nov 28 at 20:10
You could just measure the width of the text and then adjustStartAngle
andEndAngle
to be such that the text is centered. (Of course, this will make the node smaller.)
– marmot
Nov 28 at 20:18
There is no error withtext align=left
, but there is one withtext align=right
, would that be a bug with these key?
– AndréC
Nov 28 at 20:25
@AndréC: Yes, no error, but not quite the results I want. See updated question.
– Peter Grill
Nov 28 at 20:41
@marmot: Yep, that was the comment regarding usingdefRadius{2.8cm}
. However, if the text changes in the future it'll take time for me to figure out what is going on, so would prefer a more robust solution.
– Peter Grill
Nov 28 at 20:42
|
show 4 more comments
If you comment on the two linesfill=yellow
androunded corners=2pt
, there are no more errors.
– AndréC
Nov 28 at 20:10
You could just measure the width of the text and then adjustStartAngle
andEndAngle
to be such that the text is centered. (Of course, this will make the node smaller.)
– marmot
Nov 28 at 20:18
There is no error withtext align=left
, but there is one withtext align=right
, would that be a bug with these key?
– AndréC
Nov 28 at 20:25
@AndréC: Yes, no error, but not quite the results I want. See updated question.
– Peter Grill
Nov 28 at 20:41
@marmot: Yep, that was the comment regarding usingdefRadius{2.8cm}
. However, if the text changes in the future it'll take time for me to figure out what is going on, so would prefer a more robust solution.
– Peter Grill
Nov 28 at 20:42
If you comment on the two lines
fill=yellow
and rounded corners=2pt
, there are no more errors.– AndréC
Nov 28 at 20:10
If you comment on the two lines
fill=yellow
and rounded corners=2pt
, there are no more errors.– AndréC
Nov 28 at 20:10
You could just measure the width of the text and then adjust
StartAngle
and EndAngle
to be such that the text is centered. (Of course, this will make the node smaller.)– marmot
Nov 28 at 20:18
You could just measure the width of the text and then adjust
StartAngle
and EndAngle
to be such that the text is centered. (Of course, this will make the node smaller.)– marmot
Nov 28 at 20:18
There is no error with
text align=left
, but there is one with text align=right
, would that be a bug with these key?– AndréC
Nov 28 at 20:25
There is no error with
text align=left
, but there is one with text align=right
, would that be a bug with these key?– AndréC
Nov 28 at 20:25
@AndréC: Yes, no error, but not quite the results I want. See updated question.
– Peter Grill
Nov 28 at 20:41
@AndréC: Yes, no error, but not quite the results I want. See updated question.
– Peter Grill
Nov 28 at 20:41
@marmot: Yep, that was the comment regarding using
defRadius{2.8cm}
. However, if the text changes in the future it'll take time for me to figure out what is going on, so would prefer a more robust solution.– Peter Grill
Nov 28 at 20:42
@marmot: Yep, that was the comment regarding using
defRadius{2.8cm}
. However, if the text changes in the future it'll take time for me to figure out what is going on, so would prefer a more robust solution.– Peter Grill
Nov 28 at 20:42
|
show 4 more comments
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
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%2f462237%2fcenter-align-text-decoration-along-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
If you comment on the two lines
fill=yellow
androunded corners=2pt
, there are no more errors.– AndréC
Nov 28 at 20:10
You could just measure the width of the text and then adjust
StartAngle
andEndAngle
to be such that the text is centered. (Of course, this will make the node smaller.)– marmot
Nov 28 at 20:18
There is no error with
text align=left
, but there is one withtext align=right
, would that be a bug with these key?– AndréC
Nov 28 at 20:25
@AndréC: Yes, no error, but not quite the results I want. See updated question.
– Peter Grill
Nov 28 at 20:41
@marmot: Yep, that was the comment regarding using
defRadius{2.8cm}
. However, if the text changes in the future it'll take time for me to figure out what is going on, so would prefer a more robust solution.– Peter Grill
Nov 28 at 20:42