Drawing stacks side-by-side in LaTeX











up vote
6
down vote

favorite
1












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}


output of code



However, I would like to display 4 stacks side-by-side. How can this be done?










share|improve this question






















  • 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

















up vote
6
down vote

favorite
1












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}


output of code



However, I would like to display 4 stacks side-by-side. How can this be done?










share|improve this question






















  • 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















up vote
6
down vote

favorite
1









up vote
6
down vote

favorite
1






1





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}


output of code



However, I would like to display 4 stacks side-by-side. How can this be done?










share|improve this question













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}


output of code



However, I would like to display 4 stacks side-by-side. How can this be done?







tikz-pgf stack






share|improve this question













share|improve this question











share|improve this question




share|improve this question










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




















  • 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












3 Answers
3






active

oldest

votes

















up vote
7
down vote



accepted










To place additional stacks just portion the new nodes appropriately:



enter image description here



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}





share|improve this answer




























    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}


    enter image description here






    share|improve this answer




























      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}


      enter image description here






      share|improve this answer





















        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',
        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
        });


        }
        });














        draft saved

        draft discarded


















        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

























        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:



        enter image description here



        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}





        share|improve this answer

























          up vote
          7
          down vote



          accepted










          To place additional stacks just portion the new nodes appropriately:



          enter image description here



          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}





          share|improve this answer























            up vote
            7
            down vote



            accepted







            up vote
            7
            down vote



            accepted






            To place additional stacks just portion the new nodes appropriately:



            enter image description here



            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}





            share|improve this answer












            To place additional stacks just portion the new nodes appropriately:



            enter image description here



            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}






            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 5 at 19:56









            Peter Grill

            163k24432744




            163k24432744






















                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}


                enter image description here






                share|improve this answer

























                  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}


                  enter image description here






                  share|improve this answer























                    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}


                    enter image description here






                    share|improve this answer












                    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}


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Dec 5 at 20:11









                    Zarko

                    118k865155




                    118k865155






















                        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}


                        enter image description here






                        share|improve this answer

























                          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}


                          enter image description here






                          share|improve this answer























                            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}


                            enter image description here






                            share|improve this answer












                            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}


                            enter image description here







                            share|improve this answer












                            share|improve this answer



                            share|improve this answer










                            answered Dec 5 at 20:46









                            marmot

                            81.7k491174




                            81.7k491174






























                                draft saved

                                draft discarded




















































                                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.




                                draft saved


                                draft discarded














                                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





















































                                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







                                Popular posts from this blog

                                Paul Cézanne

                                UIScrollView CustomStickyHeader Resize height generates problems when scroll is too fast

                                Angular material date-picker (MatDatepicker) auto completes the date on focus out