Drawing stacks side-by-side in LaTeX
up vote
6
down vote
favorite
In this question, Alan Munn provided an example of how to draw a stack in LaTeX:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}]
node[stack=5] {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}
end{document}

However, I would like to display 4 stacks side-by-side. How can this be done?
tikz-pgf stack
add a comment |
up vote
6
down vote
favorite
In this question, Alan Munn provided an example of how to draw a stack in LaTeX:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}]
node[stack=5] {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}
end{document}

However, I would like to display 4 stacks side-by-side. How can this be done?
tikz-pgf stack
should be some distance between your "staks"? are all stack have the same number and size of cells? or this stacks form a matrix?
– Zarko
Dec 5 at 19:57
It dosn't matter how much distance is between the stacks. The stacks will have different amounts of cells but should all be aligned the the bottom. Cells may have different sizes.
– Paradox
Dec 5 at 20:12
add a comment |
up vote
6
down vote
favorite
up vote
6
down vote
favorite
In this question, Alan Munn provided an example of how to draw a stack in LaTeX:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}]
node[stack=5] {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}
end{document}

However, I would like to display 4 stacks side-by-side. How can this be done?
tikz-pgf stack
In this question, Alan Munn provided an example of how to draw a stack in LaTeX:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}]
node[stack=5] {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}
end{document}

However, I would like to display 4 stacks side-by-side. How can this be done?
tikz-pgf stack
tikz-pgf stack
asked Dec 5 at 19:53
Paradox
1336
1336
should be some distance between your "staks"? are all stack have the same number and size of cells? or this stacks form a matrix?
– Zarko
Dec 5 at 19:57
It dosn't matter how much distance is between the stacks. The stacks will have different amounts of cells but should all be aligned the the bottom. Cells may have different sizes.
– Paradox
Dec 5 at 20:12
add a comment |
should be some distance between your "staks"? are all stack have the same number and size of cells? or this stacks form a matrix?
– Zarko
Dec 5 at 19:57
It dosn't matter how much distance is between the stacks. The stacks will have different amounts of cells but should all be aligned the the bottom. Cells may have different sizes.
– Paradox
Dec 5 at 20:12
should be some distance between your "staks"? are all stack have the same number and size of cells? or this stacks form a matrix?
– Zarko
Dec 5 at 19:57
should be some distance between your "staks"? are all stack have the same number and size of cells? or this stacks form a matrix?
– Zarko
Dec 5 at 19:57
It dosn't matter how much distance is between the stacks. The stacks will have different amounts of cells but should all be aligned the the bottom. Cells may have different sizes.
– Paradox
Dec 5 at 20:12
It dosn't matter how much distance is between the stacks. The stacks will have different amounts of cells but should all be aligned the the bottom. Cells may have different sizes.
– Paradox
Dec 5 at 20:12
add a comment |
3 Answers
3
active
oldest
votes
up vote
7
down vote
accepted
To place additional stacks just portion the new nodes appropriately:

Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[
stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}
]
node[stack=5] (A) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=A] (B) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=B] (C) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=C] (D) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}%
end{document}
add a comment |
up vote
2
down vote
with library matrix:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix, positioning}
begin{document}
begin{tikzpicture}[node distance=1cm]
matrix (m) [matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = -pgflinewidth % <--- as matrix
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
matrix (n) [right=of m,
matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = 2em % <--- as separate stacks
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
end{tikzpicture}
end{document}

add a comment |
up vote
2
down vote
Really just 4 fun (and to answer a TikZ question with a non-TikZ answer, usually I am doing the opposite ;-).
documentclass{article}
usepackage{youngtab}
begin{document}
young(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)
end{document}

add a comment |
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
7
down vote
accepted
To place additional stacks just portion the new nodes appropriately:

Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[
stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}
]
node[stack=5] (A) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=A] (B) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=B] (C) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=C] (D) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}%
end{document}
add a comment |
up vote
7
down vote
accepted
To place additional stacks just portion the new nodes appropriately:

Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[
stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}
]
node[stack=5] (A) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=A] (B) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=B] (C) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=C] (D) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}%
end{document}
add a comment |
up vote
7
down vote
accepted
up vote
7
down vote
accepted
To place additional stacks just portion the new nodes appropriately:

Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[
stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}
]
node[stack=5] (A) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=A] (B) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=B] (C) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=C] (D) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}%
end{document}
To place additional stacks just portion the new nodes appropriately:

Code:
documentclass{article}
usepackage{tikz}
usetikzlibrary{shapes.multipart}
begin{document}
begin{tikzpicture}[
stack/.style={rectangle split, rectangle split parts=#1,draw, anchor=center}
]
node[stack=5] (A) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=A] (B) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=B] (C) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
node[stack=5, right of=C] (D) {
nodepart{two}a
nodepart{three}b
nodepart{four}c
nodepart{five}d
};
end{tikzpicture}%
end{document}
answered Dec 5 at 19:56
Peter Grill
163k24432744
163k24432744
add a comment |
add a comment |
up vote
2
down vote
with library matrix:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix, positioning}
begin{document}
begin{tikzpicture}[node distance=1cm]
matrix (m) [matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = -pgflinewidth % <--- as matrix
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
matrix (n) [right=of m,
matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = 2em % <--- as separate stacks
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
end{tikzpicture}
end{document}

add a comment |
up vote
2
down vote
with library matrix:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix, positioning}
begin{document}
begin{tikzpicture}[node distance=1cm]
matrix (m) [matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = -pgflinewidth % <--- as matrix
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
matrix (n) [right=of m,
matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = 2em % <--- as separate stacks
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
end{tikzpicture}
end{document}

add a comment |
up vote
2
down vote
up vote
2
down vote
with library matrix:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix, positioning}
begin{document}
begin{tikzpicture}[node distance=1cm]
matrix (m) [matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = -pgflinewidth % <--- as matrix
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
matrix (n) [right=of m,
matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = 2em % <--- as separate stacks
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
end{tikzpicture}
end{document}

with library matrix:
documentclass{article}
usepackage{tikz}
usetikzlibrary{matrix, positioning}
begin{document}
begin{tikzpicture}[node distance=1cm]
matrix (m) [matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = -pgflinewidth % <--- as matrix
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
matrix (n) [right=of m,
matrix of nodes,
nodes={draw, minimum width=1.5em, minimum height=2ex, outer sep=0pt},
row sep = -pgflinewidth,
column sep = 2em % <--- as separate stacks
]
{ a & a & a & a \
b & b & b & b \
c & c & c & c \
d & d & d & d \
};
end{tikzpicture}
end{document}

answered Dec 5 at 20:11
Zarko
118k865155
118k865155
add a comment |
add a comment |
up vote
2
down vote
Really just 4 fun (and to answer a TikZ question with a non-TikZ answer, usually I am doing the opposite ;-).
documentclass{article}
usepackage{youngtab}
begin{document}
young(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)
end{document}

add a comment |
up vote
2
down vote
Really just 4 fun (and to answer a TikZ question with a non-TikZ answer, usually I am doing the opposite ;-).
documentclass{article}
usepackage{youngtab}
begin{document}
young(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)
end{document}

add a comment |
up vote
2
down vote
up vote
2
down vote
Really just 4 fun (and to answer a TikZ question with a non-TikZ answer, usually I am doing the opposite ;-).
documentclass{article}
usepackage{youngtab}
begin{document}
young(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)
end{document}

Really just 4 fun (and to answer a TikZ question with a non-TikZ answer, usually I am doing the opposite ;-).
documentclass{article}
usepackage{youngtab}
begin{document}
young(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)quadyoung(~,a,b,c,~)
end{document}

answered Dec 5 at 20:46
marmot
81.7k491174
81.7k491174
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.
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%2f463378%2fdrawing-stacks-side-by-side-in-latex%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
should be some distance between your "staks"? are all stack have the same number and size of cells? or this stacks form a matrix?
– Zarko
Dec 5 at 19:57
It dosn't matter how much distance is between the stacks. The stacks will have different amounts of cells but should all be aligned the the bottom. Cells may have different sizes.
– Paradox
Dec 5 at 20:12