How to draw a slanted rectangle divided by two using tikzpicture environment
up vote
3
down vote
favorite
I would like to draw the following rectangle divided by two using tikzpicture
environment:
However, what I achieved so far is:
MWE:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[delay rect/.style={rectangle split, rectangle split parts=2,draw,
minimum width=1.5cm,minimum height=1cm,
text width=2cm,align=center,inner ysep=2cm,draw,inner ysep=3mm,inner
xsep=3mm}] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[rotate=60,delay rect] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
Thanks!
tikz-pgf
add a comment |
up vote
3
down vote
favorite
I would like to draw the following rectangle divided by two using tikzpicture
environment:
However, what I achieved so far is:
MWE:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[delay rect/.style={rectangle split, rectangle split parts=2,draw,
minimum width=1.5cm,minimum height=1cm,
text width=2cm,align=center,inner ysep=2cm,draw,inner ysep=3mm,inner
xsep=3mm}] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[rotate=60,delay rect] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
Thanks!
tikz-pgf
add a comment |
up vote
3
down vote
favorite
up vote
3
down vote
favorite
I would like to draw the following rectangle divided by two using tikzpicture
environment:
However, what I achieved so far is:
MWE:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[delay rect/.style={rectangle split, rectangle split parts=2,draw,
minimum width=1.5cm,minimum height=1cm,
text width=2cm,align=center,inner ysep=2cm,draw,inner ysep=3mm,inner
xsep=3mm}] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[rotate=60,delay rect] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
Thanks!
tikz-pgf
I would like to draw the following rectangle divided by two using tikzpicture
environment:
However, what I achieved so far is:
MWE:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[delay rect/.style={rectangle split, rectangle split parts=2,draw,
minimum width=1.5cm,minimum height=1cm,
text width=2cm,align=center,inner ysep=2cm,draw,inner ysep=3mm,inner
xsep=3mm}] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[rotate=60,delay rect] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
Thanks!
tikz-pgf
tikz-pgf
edited 3 hours ago
asked 4 hours ago
manooooh
8561313
8561313
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
3
down vote
accepted
to your style definition for delay rec
you need to add the option rectangle split horizontal
:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[
delay rect/.style = {rectangle split, % now all double and not used options are removed
rectangle split horizontal, % <---
rectangle split parts=2, draw,
minimum height=1cm,
align=center,
inner ysep=3mm,inner xsep=3mm}
] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[delay rect,rotate=60] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
edit:
regarding sub questions in your comment below:
1) reduce the font size of the rectangle (scriptsize)?
in node style definition just define font size with `font=scriptsize`
2) reduce a little more the height of the rectangle?
in height of a rectangles are defined by `minimum height = <desired height>`. you have selected 1cmm, if this is to much, reduce for example to 7mm
3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges
space between node border lines and nodes content (text) is controlled by `inner sep` (equal for all direction) or `inner ysep` in vertical direction) and `inner xsep` for horizontal. default value is `3pt`. if this is to much to you, than to node's style option add for example `inner sep=2pt`.
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)
– manooooh
3 hours ago
1
@manooooh, i belive that is now time to readtikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).
– Zarko
3 hours ago
Forget that.... That's perfect, I can solve the font size by using{scriptsize A1nodepart{two}scriptsize text here}
and addingminimum height=.1cm
.
– manooooh
3 hours ago
1
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
3
down vote
accepted
to your style definition for delay rec
you need to add the option rectangle split horizontal
:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[
delay rect/.style = {rectangle split, % now all double and not used options are removed
rectangle split horizontal, % <---
rectangle split parts=2, draw,
minimum height=1cm,
align=center,
inner ysep=3mm,inner xsep=3mm}
] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[delay rect,rotate=60] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
edit:
regarding sub questions in your comment below:
1) reduce the font size of the rectangle (scriptsize)?
in node style definition just define font size with `font=scriptsize`
2) reduce a little more the height of the rectangle?
in height of a rectangles are defined by `minimum height = <desired height>`. you have selected 1cmm, if this is to much, reduce for example to 7mm
3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges
space between node border lines and nodes content (text) is controlled by `inner sep` (equal for all direction) or `inner ysep` in vertical direction) and `inner xsep` for horizontal. default value is `3pt`. if this is to much to you, than to node's style option add for example `inner sep=2pt`.
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)
– manooooh
3 hours ago
1
@manooooh, i belive that is now time to readtikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).
– Zarko
3 hours ago
Forget that.... That's perfect, I can solve the font size by using{scriptsize A1nodepart{two}scriptsize text here}
and addingminimum height=.1cm
.
– manooooh
3 hours ago
1
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
add a comment |
up vote
3
down vote
accepted
to your style definition for delay rec
you need to add the option rectangle split horizontal
:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[
delay rect/.style = {rectangle split, % now all double and not used options are removed
rectangle split horizontal, % <---
rectangle split parts=2, draw,
minimum height=1cm,
align=center,
inner ysep=3mm,inner xsep=3mm}
] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[delay rect,rotate=60] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
edit:
regarding sub questions in your comment below:
1) reduce the font size of the rectangle (scriptsize)?
in node style definition just define font size with `font=scriptsize`
2) reduce a little more the height of the rectangle?
in height of a rectangles are defined by `minimum height = <desired height>`. you have selected 1cmm, if this is to much, reduce for example to 7mm
3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges
space between node border lines and nodes content (text) is controlled by `inner sep` (equal for all direction) or `inner ysep` in vertical direction) and `inner xsep` for horizontal. default value is `3pt`. if this is to much to you, than to node's style option add for example `inner sep=2pt`.
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)
– manooooh
3 hours ago
1
@manooooh, i belive that is now time to readtikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).
– Zarko
3 hours ago
Forget that.... That's perfect, I can solve the font size by using{scriptsize A1nodepart{two}scriptsize text here}
and addingminimum height=.1cm
.
– manooooh
3 hours ago
1
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
add a comment |
up vote
3
down vote
accepted
up vote
3
down vote
accepted
to your style definition for delay rec
you need to add the option rectangle split horizontal
:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[
delay rect/.style = {rectangle split, % now all double and not used options are removed
rectangle split horizontal, % <---
rectangle split parts=2, draw,
minimum height=1cm,
align=center,
inner ysep=3mm,inner xsep=3mm}
] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[delay rect,rotate=60] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
edit:
regarding sub questions in your comment below:
1) reduce the font size of the rectangle (scriptsize)?
in node style definition just define font size with `font=scriptsize`
2) reduce a little more the height of the rectangle?
in height of a rectangles are defined by `minimum height = <desired height>`. you have selected 1cmm, if this is to much, reduce for example to 7mm
3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges
space between node border lines and nodes content (text) is controlled by `inner sep` (equal for all direction) or `inner ysep` in vertical direction) and `inner xsep` for horizontal. default value is `3pt`. if this is to much to you, than to node's style option add for example `inner sep=2pt`.
to your style definition for delay rec
you need to add the option rectangle split horizontal
:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
usetikzlibrary{decorations.text}
begin{document}
% Bend curves from https://tex.stackexchange.com/a/22316/152550
begin{tikzpicture}[
delay rect/.style = {rectangle split, % now all double and not used options are removed
rectangle split horizontal, % <---
rectangle split parts=2, draw,
minimum height=1cm,
align=center,
inner ysep=3mm,inner xsep=3mm}
] % From https://tex.stackexchange.com/a/452609/152550
node (start) at (0,0) {Start};
node (end) at (6,0) {End};
node[delay rect,rotate=60] (delay) at (3,0) {A1nodepart{two}text here};
defmyshift#1{scriptsizeraisebox{1ex}}
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|hello}}}] (start) to [bend left=10] (delay);
draw [->,postaction={decorate,decoration={text along path,text align=center,text={|myshift|bye}}}] (delay) to [bend left=10] (end);
end{tikzpicture}
end{document}
edit:
regarding sub questions in your comment below:
1) reduce the font size of the rectangle (scriptsize)?
in node style definition just define font size with `font=scriptsize`
2) reduce a little more the height of the rectangle?
in height of a rectangles are defined by `minimum height = <desired height>`. you have selected 1cmm, if this is to much, reduce for example to 7mm
3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges
space between node border lines and nodes content (text) is controlled by `inner sep` (equal for all direction) or `inner ysep` in vertical direction) and `inner xsep` for horizontal. default value is `3pt`. if this is to much to you, than to node's style option add for example `inner sep=2pt`.
edited 3 hours ago
answered 3 hours ago
Zarko
118k865155
118k865155
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)
– manooooh
3 hours ago
1
@manooooh, i belive that is now time to readtikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).
– Zarko
3 hours ago
Forget that.... That's perfect, I can solve the font size by using{scriptsize A1nodepart{two}scriptsize text here}
and addingminimum height=.1cm
.
– manooooh
3 hours ago
1
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
add a comment |
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)
– manooooh
3 hours ago
1
@manooooh, i belive that is now time to readtikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).
– Zarko
3 hours ago
Forget that.... That's perfect, I can solve the font size by using{scriptsize A1nodepart{two}scriptsize text here}
and addingminimum height=.1cm
.
– manooooh
3 hours ago
1
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (
scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)– manooooh
3 hours ago
Nice, thank you! Do you know how can we 1) reduce the font size of the rectangle (
scriptsize
)?; 2) reduce a little more the height of the rectangle?; 3) reduce a little more the width of each part of the rectangle so that there is not so much space between the text and the edges? (the latter is not necessary)– manooooh
3 hours ago
1
1
@manooooh, i belive that is now time to read
tikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).– Zarko
3 hours ago
@manooooh, i belive that is now time to read
tikz & pgf manual
, at least part III :-). i will add some instruction to answer asap (however, this is not part of your question).– Zarko
3 hours ago
Forget that.... That's perfect, I can solve the font size by using
{scriptsize A1nodepart{two}scriptsize text here}
and adding minimum height=.1cm
.– manooooh
3 hours ago
Forget that.... That's perfect, I can solve the font size by using
{scriptsize A1nodepart{two}scriptsize text here}
and adding minimum height=.1cm
.– manooooh
3 hours ago
1
1
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
@manooooh, don't doing this. you will destroy baseline distance of text. use approach described in explanation added to answer.
– Zarko
3 hours ago
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%2f463758%2fhow-to-draw-a-slanted-rectangle-divided-by-two-using-tikzpicture-environment%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