The coordinates for a text node in tikz specifies the centre of the box. Is there a way to get it to specify...
I would like the two lines of text to the right of the diagonal lines to be left aligned. Is there any way to do this?
begin{tikzpicture}
node[text] at (2,4) {/p/};
draw (2.5,4) -- (5,5);
draw (2.5,4) -- (5,3);
node[text,align=left] at (7.2,5) {textipa{[b]} / [+voice] __ [+voice]};
node[text,align=left] at (6.5,3) {[p] / elsewhere};
end{tikzpicture}

tikz-pgf positioning text
add a comment |
I would like the two lines of text to the right of the diagonal lines to be left aligned. Is there any way to do this?
begin{tikzpicture}
node[text] at (2,4) {/p/};
draw (2.5,4) -- (5,5);
draw (2.5,4) -- (5,3);
node[text,align=left] at (7.2,5) {textipa{[b]} / [+voice] __ [+voice]};
node[text,align=left] at (6.5,3) {[p] / elsewhere};
end{tikzpicture}

tikz-pgf positioning text
Welcome to TeX-SE! Are you looking foranchor=west?
– marmot
Feb 26 at 6:10
add a comment |
I would like the two lines of text to the right of the diagonal lines to be left aligned. Is there any way to do this?
begin{tikzpicture}
node[text] at (2,4) {/p/};
draw (2.5,4) -- (5,5);
draw (2.5,4) -- (5,3);
node[text,align=left] at (7.2,5) {textipa{[b]} / [+voice] __ [+voice]};
node[text,align=left] at (6.5,3) {[p] / elsewhere};
end{tikzpicture}

tikz-pgf positioning text
I would like the two lines of text to the right of the diagonal lines to be left aligned. Is there any way to do this?
begin{tikzpicture}
node[text] at (2,4) {/p/};
draw (2.5,4) -- (5,5);
draw (2.5,4) -- (5,3);
node[text,align=left] at (7.2,5) {textipa{[b]} / [+voice] __ [+voice]};
node[text,align=left] at (6.5,3) {[p] / elsewhere};
end{tikzpicture}

tikz-pgf positioning text
tikz-pgf positioning text
edited Feb 26 at 6:09
marmot
106k4127242
106k4127242
asked Feb 26 at 6:05
Michael BarrieMichael Barrie
61
61
Welcome to TeX-SE! Are you looking foranchor=west?
– marmot
Feb 26 at 6:10
add a comment |
Welcome to TeX-SE! Are you looking foranchor=west?
– marmot
Feb 26 at 6:10
Welcome to TeX-SE! Are you looking for
anchor=west?– marmot
Feb 26 at 6:10
Welcome to TeX-SE! Are you looking for
anchor=west?– marmot
Feb 26 at 6:10
add a comment |
2 Answers
2
active
oldest
votes
You could use anchor=west to specify the location of the box via its leftmost point, or just right.
documentclass{article}
usepackage{tikz}
usepackage{tipa}
begin{document}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[right,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[right,align=left] {[p] / elsewhere};
end{tikzpicture}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[anchor=west,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[anchor=west,align=left] {[p] / elsewhere};
end{tikzpicture}
end{document}

add a comment |
There are many ways to do that, besides of marmot's methods. Here are three of them (I will add more if I find one in the future).
Method 1
documentclass[tikz,margin=3mm]{standalone}
begin{document}
begin{tikzpicture}
draw (0,0) node[right] {Something} -- (-2,-1) node[left] {Dummy text} -- (0,-2) node[right] {Hello World};
end{tikzpicture}
end{document}

You can use polar coordinates instead of Cartesian coordinates. Also, this way is quite natural (I prefer this way) and doesn't require any TikZ libraries. However, this is not quite a standard way (draw is not supposed to do this stuff, as far as I know).
Method 2
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
node (x) {Something};
node[below left=1cm and 2cm of x.south west] (o) {Dummy text};
node[below right=1cm and 2cm of o.south east] (y) {Hello World};
draw (x.west)--(o.east)--(y.west);
end{tikzpicture}
end{document}

This way use the standard command for inserting strings to TikZ pictures: node. However, aligning the texts and controlling the positions are not really easy IMHO. You need positioning library.
Method 3
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
coordinate[label=right: Something] (x);
coordinate[label=right: Hello World,below=2cm of x] (y);
coordinate[label=left: Dummy text,below left=1cm and 2cm of x] (o);
draw (x)--(o)--(y);
end{tikzpicture}
end{document}

This way uses coordinate command with label option.
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%2f476706%2fthe-coordinates-for-a-text-node-in-tikz-specifies-the-centre-of-the-box-is-ther%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
You could use anchor=west to specify the location of the box via its leftmost point, or just right.
documentclass{article}
usepackage{tikz}
usepackage{tipa}
begin{document}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[right,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[right,align=left] {[p] / elsewhere};
end{tikzpicture}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[anchor=west,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[anchor=west,align=left] {[p] / elsewhere};
end{tikzpicture}
end{document}

add a comment |
You could use anchor=west to specify the location of the box via its leftmost point, or just right.
documentclass{article}
usepackage{tikz}
usepackage{tipa}
begin{document}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[right,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[right,align=left] {[p] / elsewhere};
end{tikzpicture}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[anchor=west,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[anchor=west,align=left] {[p] / elsewhere};
end{tikzpicture}
end{document}

add a comment |
You could use anchor=west to specify the location of the box via its leftmost point, or just right.
documentclass{article}
usepackage{tikz}
usepackage{tipa}
begin{document}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[right,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[right,align=left] {[p] / elsewhere};
end{tikzpicture}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[anchor=west,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[anchor=west,align=left] {[p] / elsewhere};
end{tikzpicture}
end{document}

You could use anchor=west to specify the location of the box via its leftmost point, or just right.
documentclass{article}
usepackage{tikz}
usepackage{tipa}
begin{document}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[right,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[right,align=left] {[p] / elsewhere};
end{tikzpicture}
begin{tikzpicture}
node at (2,4) {/p/};
draw (2.5,4) -- (5,5) node[anchor=west,align=left] {textipa{[b]} / [+voice] __ [+voice]};
draw (2.5,4) -- (5,3) node[anchor=west,align=left] {[p] / elsewhere};
end{tikzpicture}
end{document}

answered Feb 26 at 6:15
marmotmarmot
106k4127242
106k4127242
add a comment |
add a comment |
There are many ways to do that, besides of marmot's methods. Here are three of them (I will add more if I find one in the future).
Method 1
documentclass[tikz,margin=3mm]{standalone}
begin{document}
begin{tikzpicture}
draw (0,0) node[right] {Something} -- (-2,-1) node[left] {Dummy text} -- (0,-2) node[right] {Hello World};
end{tikzpicture}
end{document}

You can use polar coordinates instead of Cartesian coordinates. Also, this way is quite natural (I prefer this way) and doesn't require any TikZ libraries. However, this is not quite a standard way (draw is not supposed to do this stuff, as far as I know).
Method 2
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
node (x) {Something};
node[below left=1cm and 2cm of x.south west] (o) {Dummy text};
node[below right=1cm and 2cm of o.south east] (y) {Hello World};
draw (x.west)--(o.east)--(y.west);
end{tikzpicture}
end{document}

This way use the standard command for inserting strings to TikZ pictures: node. However, aligning the texts and controlling the positions are not really easy IMHO. You need positioning library.
Method 3
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
coordinate[label=right: Something] (x);
coordinate[label=right: Hello World,below=2cm of x] (y);
coordinate[label=left: Dummy text,below left=1cm and 2cm of x] (o);
draw (x)--(o)--(y);
end{tikzpicture}
end{document}

This way uses coordinate command with label option.
add a comment |
There are many ways to do that, besides of marmot's methods. Here are three of them (I will add more if I find one in the future).
Method 1
documentclass[tikz,margin=3mm]{standalone}
begin{document}
begin{tikzpicture}
draw (0,0) node[right] {Something} -- (-2,-1) node[left] {Dummy text} -- (0,-2) node[right] {Hello World};
end{tikzpicture}
end{document}

You can use polar coordinates instead of Cartesian coordinates. Also, this way is quite natural (I prefer this way) and doesn't require any TikZ libraries. However, this is not quite a standard way (draw is not supposed to do this stuff, as far as I know).
Method 2
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
node (x) {Something};
node[below left=1cm and 2cm of x.south west] (o) {Dummy text};
node[below right=1cm and 2cm of o.south east] (y) {Hello World};
draw (x.west)--(o.east)--(y.west);
end{tikzpicture}
end{document}

This way use the standard command for inserting strings to TikZ pictures: node. However, aligning the texts and controlling the positions are not really easy IMHO. You need positioning library.
Method 3
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
coordinate[label=right: Something] (x);
coordinate[label=right: Hello World,below=2cm of x] (y);
coordinate[label=left: Dummy text,below left=1cm and 2cm of x] (o);
draw (x)--(o)--(y);
end{tikzpicture}
end{document}

This way uses coordinate command with label option.
add a comment |
There are many ways to do that, besides of marmot's methods. Here are three of them (I will add more if I find one in the future).
Method 1
documentclass[tikz,margin=3mm]{standalone}
begin{document}
begin{tikzpicture}
draw (0,0) node[right] {Something} -- (-2,-1) node[left] {Dummy text} -- (0,-2) node[right] {Hello World};
end{tikzpicture}
end{document}

You can use polar coordinates instead of Cartesian coordinates. Also, this way is quite natural (I prefer this way) and doesn't require any TikZ libraries. However, this is not quite a standard way (draw is not supposed to do this stuff, as far as I know).
Method 2
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
node (x) {Something};
node[below left=1cm and 2cm of x.south west] (o) {Dummy text};
node[below right=1cm and 2cm of o.south east] (y) {Hello World};
draw (x.west)--(o.east)--(y.west);
end{tikzpicture}
end{document}

This way use the standard command for inserting strings to TikZ pictures: node. However, aligning the texts and controlling the positions are not really easy IMHO. You need positioning library.
Method 3
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
coordinate[label=right: Something] (x);
coordinate[label=right: Hello World,below=2cm of x] (y);
coordinate[label=left: Dummy text,below left=1cm and 2cm of x] (o);
draw (x)--(o)--(y);
end{tikzpicture}
end{document}

This way uses coordinate command with label option.
There are many ways to do that, besides of marmot's methods. Here are three of them (I will add more if I find one in the future).
Method 1
documentclass[tikz,margin=3mm]{standalone}
begin{document}
begin{tikzpicture}
draw (0,0) node[right] {Something} -- (-2,-1) node[left] {Dummy text} -- (0,-2) node[right] {Hello World};
end{tikzpicture}
end{document}

You can use polar coordinates instead of Cartesian coordinates. Also, this way is quite natural (I prefer this way) and doesn't require any TikZ libraries. However, this is not quite a standard way (draw is not supposed to do this stuff, as far as I know).
Method 2
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
node (x) {Something};
node[below left=1cm and 2cm of x.south west] (o) {Dummy text};
node[below right=1cm and 2cm of o.south east] (y) {Hello World};
draw (x.west)--(o.east)--(y.west);
end{tikzpicture}
end{document}

This way use the standard command for inserting strings to TikZ pictures: node. However, aligning the texts and controlling the positions are not really easy IMHO. You need positioning library.
Method 3
documentclass[tikz,margin=3mm]{standalone}
usetikzlibrary{positioning}
begin{document}
begin{tikzpicture}
coordinate[label=right: Something] (x);
coordinate[label=right: Hello World,below=2cm of x] (y);
coordinate[label=left: Dummy text,below left=1cm and 2cm of x] (o);
draw (x)--(o)--(y);
end{tikzpicture}
end{document}

This way uses coordinate command with label option.
edited Feb 26 at 6:45
answered Feb 26 at 6:22
JouleVJouleV
4,88611139
4,88611139
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%2f476706%2fthe-coordinates-for-a-text-node-in-tikz-specifies-the-centre-of-the-box-is-ther%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
Welcome to TeX-SE! Are you looking for
anchor=west?– marmot
Feb 26 at 6:10