Positioning node within rectangle Tikz
Without using phantom how can I place the text starting from the bottom up?
documentclass{article}
usepackage{tikz}
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
definecolor{carnationpink}{rgb}{1.0, 0.65, 0.79}
begin{tikzpicture}
%%%Ones Value
foreach x/xtext in {1/textcolor{black}
{hundredsphantom{xxxx}},2/textcolor{black}
{tens},3/textcolor{blue}{ones}}
draw[xshift=.5*x cm,fill=aqua] (0,.5) rectangle (n,3.5) node[midway,
rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {1/3,2/6,3/4}
draw[xshift=.5*x cm,fill=aqua] (0,0) rectangle (n,n) node[pos=.5]
{$d$};
%%%Thousands
foreach x/xtext in {0/textcolor{black}
{Thousandsphantom{xxxx}},1/textcolor{black}{Ten Thousandsphantom{x}}}
draw[xshift=-.5*x cm,fill=carnationpink] (0,.5) rectangle (n,3.5)
node[midway, rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {0/,1/}
draw[xshift=-.5*x cm,fill=carnationpink] (0,0) rectangle (n,n) node[pos=.5] {$d$};
end{tikzpicture}
end{document}
This outputs:
tikz-pgf
add a comment |
Without using phantom how can I place the text starting from the bottom up?
documentclass{article}
usepackage{tikz}
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
definecolor{carnationpink}{rgb}{1.0, 0.65, 0.79}
begin{tikzpicture}
%%%Ones Value
foreach x/xtext in {1/textcolor{black}
{hundredsphantom{xxxx}},2/textcolor{black}
{tens},3/textcolor{blue}{ones}}
draw[xshift=.5*x cm,fill=aqua] (0,.5) rectangle (n,3.5) node[midway,
rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {1/3,2/6,3/4}
draw[xshift=.5*x cm,fill=aqua] (0,0) rectangle (n,n) node[pos=.5]
{$d$};
%%%Thousands
foreach x/xtext in {0/textcolor{black}
{Thousandsphantom{xxxx}},1/textcolor{black}{Ten Thousandsphantom{x}}}
draw[xshift=-.5*x cm,fill=carnationpink] (0,.5) rectangle (n,3.5)
node[midway, rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {0/,1/}
draw[xshift=-.5*x cm,fill=carnationpink] (0,0) rectangle (n,n) node[pos=.5] {$d$};
end{tikzpicture}
end{document}
This outputs:
tikz-pgf
add a comment |
Without using phantom how can I place the text starting from the bottom up?
documentclass{article}
usepackage{tikz}
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
definecolor{carnationpink}{rgb}{1.0, 0.65, 0.79}
begin{tikzpicture}
%%%Ones Value
foreach x/xtext in {1/textcolor{black}
{hundredsphantom{xxxx}},2/textcolor{black}
{tens},3/textcolor{blue}{ones}}
draw[xshift=.5*x cm,fill=aqua] (0,.5) rectangle (n,3.5) node[midway,
rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {1/3,2/6,3/4}
draw[xshift=.5*x cm,fill=aqua] (0,0) rectangle (n,n) node[pos=.5]
{$d$};
%%%Thousands
foreach x/xtext in {0/textcolor{black}
{Thousandsphantom{xxxx}},1/textcolor{black}{Ten Thousandsphantom{x}}}
draw[xshift=-.5*x cm,fill=carnationpink] (0,.5) rectangle (n,3.5)
node[midway, rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {0/,1/}
draw[xshift=-.5*x cm,fill=carnationpink] (0,0) rectangle (n,n) node[pos=.5] {$d$};
end{tikzpicture}
end{document}
This outputs:
tikz-pgf
Without using phantom how can I place the text starting from the bottom up?
documentclass{article}
usepackage{tikz}
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
definecolor{carnationpink}{rgb}{1.0, 0.65, 0.79}
begin{tikzpicture}
%%%Ones Value
foreach x/xtext in {1/textcolor{black}
{hundredsphantom{xxxx}},2/textcolor{black}
{tens},3/textcolor{blue}{ones}}
draw[xshift=.5*x cm,fill=aqua] (0,.5) rectangle (n,3.5) node[midway,
rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {1/3,2/6,3/4}
draw[xshift=.5*x cm,fill=aqua] (0,0) rectangle (n,n) node[pos=.5]
{$d$};
%%%Thousands
foreach x/xtext in {0/textcolor{black}
{Thousandsphantom{xxxx}},1/textcolor{black}{Ten Thousandsphantom{x}}}
draw[xshift=-.5*x cm,fill=carnationpink] (0,.5) rectangle (n,3.5)
node[midway, rotate=90,text=blue] {textbf{xtext}};
foreach x/d in {0/,1/}
draw[xshift=-.5*x cm,fill=carnationpink] (0,0) rectangle (n,n) node[pos=.5] {$d$};
end{tikzpicture}
end{document}
This outputs:
tikz-pgf
tikz-pgf
edited 1 hour ago
MathScholar
asked 3 hours ago
MathScholarMathScholar
98229
98229
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
like this?
documentclass{article}
usepackage{tikz}
usetikzlibrary{chains, positioning} % <--- new
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
begin{tikzpicture}[
node distance = 0pt, % <--- new
start chain = A going above, % <--- new
box/.style = {draw, fill=aqua, text width=#1, minimum height=6mm,
outer sep=0pt, rotate=90, on chain}, % <--- new
box/.default = 35mm
]
node[box, text=blue] {ones}; % A-1
node[box] {hundreds};
node[box] {thousands}; % A-3
foreach i in {1,2,3}
node[box=6mm, fill=red!30, left=of A-i] {};
end{tikzpicture}
end{document}
@MathScholar, you are welcome! i slightly change answer: to node style i addouter sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).
– Zarko
2 hours ago
no, you only need to addfill=red!25
to boxes drawn in a loop. i will add this to answer asap.
– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 hours ago
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%2f477060%2fpositioning-node-within-rectangle-tikz%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
like this?
documentclass{article}
usepackage{tikz}
usetikzlibrary{chains, positioning} % <--- new
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
begin{tikzpicture}[
node distance = 0pt, % <--- new
start chain = A going above, % <--- new
box/.style = {draw, fill=aqua, text width=#1, minimum height=6mm,
outer sep=0pt, rotate=90, on chain}, % <--- new
box/.default = 35mm
]
node[box, text=blue] {ones}; % A-1
node[box] {hundreds};
node[box] {thousands}; % A-3
foreach i in {1,2,3}
node[box=6mm, fill=red!30, left=of A-i] {};
end{tikzpicture}
end{document}
@MathScholar, you are welcome! i slightly change answer: to node style i addouter sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).
– Zarko
2 hours ago
no, you only need to addfill=red!25
to boxes drawn in a loop. i will add this to answer asap.
– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 hours ago
add a comment |
like this?
documentclass{article}
usepackage{tikz}
usetikzlibrary{chains, positioning} % <--- new
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
begin{tikzpicture}[
node distance = 0pt, % <--- new
start chain = A going above, % <--- new
box/.style = {draw, fill=aqua, text width=#1, minimum height=6mm,
outer sep=0pt, rotate=90, on chain}, % <--- new
box/.default = 35mm
]
node[box, text=blue] {ones}; % A-1
node[box] {hundreds};
node[box] {thousands}; % A-3
foreach i in {1,2,3}
node[box=6mm, fill=red!30, left=of A-i] {};
end{tikzpicture}
end{document}
@MathScholar, you are welcome! i slightly change answer: to node style i addouter sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).
– Zarko
2 hours ago
no, you only need to addfill=red!25
to boxes drawn in a loop. i will add this to answer asap.
– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 hours ago
add a comment |
like this?
documentclass{article}
usepackage{tikz}
usetikzlibrary{chains, positioning} % <--- new
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
begin{tikzpicture}[
node distance = 0pt, % <--- new
start chain = A going above, % <--- new
box/.style = {draw, fill=aqua, text width=#1, minimum height=6mm,
outer sep=0pt, rotate=90, on chain}, % <--- new
box/.default = 35mm
]
node[box, text=blue] {ones}; % A-1
node[box] {hundreds};
node[box] {thousands}; % A-3
foreach i in {1,2,3}
node[box=6mm, fill=red!30, left=of A-i] {};
end{tikzpicture}
end{document}
like this?
documentclass{article}
usepackage{tikz}
usetikzlibrary{chains, positioning} % <--- new
begin{document}
defn{.5}
definecolor{aqua}{rgb}{0.0, 1.0, 1.0}
begin{tikzpicture}[
node distance = 0pt, % <--- new
start chain = A going above, % <--- new
box/.style = {draw, fill=aqua, text width=#1, minimum height=6mm,
outer sep=0pt, rotate=90, on chain}, % <--- new
box/.default = 35mm
]
node[box, text=blue] {ones}; % A-1
node[box] {hundreds};
node[box] {thousands}; % A-3
foreach i in {1,2,3}
node[box=6mm, fill=red!30, left=of A-i] {};
end{tikzpicture}
end{document}
edited 2 hours ago
answered 3 hours ago
ZarkoZarko
126k867164
126k867164
@MathScholar, you are welcome! i slightly change answer: to node style i addouter sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).
– Zarko
2 hours ago
no, you only need to addfill=red!25
to boxes drawn in a loop. i will add this to answer asap.
– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 hours ago
add a comment |
@MathScholar, you are welcome! i slightly change answer: to node style i addouter sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).
– Zarko
2 hours ago
no, you only need to addfill=red!25
to boxes drawn in a loop. i will add this to answer asap.
– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 hours ago
@MathScholar, you are welcome! i slightly change answer: to node style i add
outer sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).– Zarko
2 hours ago
@MathScholar, you are welcome! i slightly change answer: to node style i add
outer sep=0pt,
which allows the lines between the boxes to overlap (looks thinner).– Zarko
2 hours ago
no, you only need to add
fill=red!25
to boxes drawn in a loop. i will add this to answer asap.– Zarko
2 hours ago
no, you only need to add
fill=red!25
to boxes drawn in a loop. i will add this to answer asap.– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 hours ago
you should clarify your question, now i'm lost in your comments. if each box >(node) has own color, than is sensible to change code, i.e. introduce new parameter for coloring.
– Zarko
2 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.
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%2f477060%2fpositioning-node-within-rectangle-tikz%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