Centre cell contents vertically












3















Consider this example:



documentclass{article}                                                                                                                                                                                       
begin{document}
begin{tabular}{ p{0.1textwidth}l }
gdgd asfsdf akku & 5 \
end{tabular}
end{document}


enter image description here



How can I centre the contents of cell 01 vertically?










share|improve this question


















  • 1





    use m (array package) not p

    – David Carlisle
    Apr 21 at 12:02
















3















Consider this example:



documentclass{article}                                                                                                                                                                                       
begin{document}
begin{tabular}{ p{0.1textwidth}l }
gdgd asfsdf akku & 5 \
end{tabular}
end{document}


enter image description here



How can I centre the contents of cell 01 vertically?










share|improve this question


















  • 1





    use m (array package) not p

    – David Carlisle
    Apr 21 at 12:02














3












3








3


0






Consider this example:



documentclass{article}                                                                                                                                                                                       
begin{document}
begin{tabular}{ p{0.1textwidth}l }
gdgd asfsdf akku & 5 \
end{tabular}
end{document}


enter image description here



How can I centre the contents of cell 01 vertically?










share|improve this question














Consider this example:



documentclass{article}                                                                                                                                                                                       
begin{document}
begin{tabular}{ p{0.1textwidth}l }
gdgd asfsdf akku & 5 \
end{tabular}
end{document}


enter image description here



How can I centre the contents of cell 01 vertically?







tables vertical-alignment






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Apr 21 at 11:26









ViestursViesturs

2,12141327




2,12141327








  • 1





    use m (array package) not p

    – David Carlisle
    Apr 21 at 12:02














  • 1





    use m (array package) not p

    – David Carlisle
    Apr 21 at 12:02








1




1





use m (array package) not p

– David Carlisle
Apr 21 at 12:02





use m (array package) not p

– David Carlisle
Apr 21 at 12:02










3 Answers
3






active

oldest

votes


















5














Here are three different possible solutions:



documentclass{article}
usepackage{array} % Only needed for the first example.
usepackage{multirow} % Only needed for the third example.
begin{document}

Using the vertically centered m type column:

begin{tabular}{ m{0.1textwidth}l }
gdgd asfsdf akku & 5 \
end{tabular}

bigskip

Using three different rows for the text in the first column:

begin{tabular}{ p{0.1textwidth}l }
gdgd\
asfsdf & 5\
akku \
end{tabular}

bigskip

Using multirow:

begin{tabular}{ p{0.1textwidth}l }
gdgd asfsdf akku & multirow{3}{*}{5} \
end{tabular}
end{document}


enter image description here






share|improve this answer































    4














    You can use multirow with a single cell, but you have to count the number of lines in this cell, on order to vertically centre its contents. Note that you can use decimal numbers to fine-tune the placement.



    Alternatively, use the m{...} column type for the left column (requires loading array):



    documentclass{article}
    usepackage{array}
    usepackage{multirow}

    begin{document}

    begin{tabular}{m{0.1textwidth}l }
    gdgd asfsdf akku & 5 \
    end{tabular}
    qquad
    begin{tabular}{p{0.1textwidth}l }
    gdgd asfsdf akku & multirow{3}{*}{5}\
    end{tabular}

    end{document}


    enter image description here






    share|improve this answer































      1














      A possible solution would be using the multirow package (But it requires you to split cell on the left into three cells and putting the text of the right cell into a multirow-cell that spans over three rows).
      A working example would be:



      documentclass{article}                                                                     usepackage{multirow}                                                                                                
      begin{document}
      begin{tabular}{ p{0.1textwidth}l }
      gdgd & multirow{3}{*}{5} \
      asfsdf \
      akku \
      end{tabular}
      end{document}


      Result



      A little explanation on the code:



      gdgd & multirow{3}{*}{5} \


      Inserts gdgd as the first entry of the first row and an multirow-cell that spans over three rows (the first parameter) inherits the width of the original column (second parameter set as *) and contains the text "5" (last parameter). \ indicates the linebreak



      asfsdf \ 


      Inserts asfsdf into the first entry of the second line. Another entry in this line is not necessary because of the multirow-cell above.






      share|improve this answer








      New contributor




      Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





















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


        }
        });














        draft saved

        draft discarded


















        StackExchange.ready(
        function () {
        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485886%2fcentre-cell-contents-vertically%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









        5














        Here are three different possible solutions:



        documentclass{article}
        usepackage{array} % Only needed for the first example.
        usepackage{multirow} % Only needed for the third example.
        begin{document}

        Using the vertically centered m type column:

        begin{tabular}{ m{0.1textwidth}l }
        gdgd asfsdf akku & 5 \
        end{tabular}

        bigskip

        Using three different rows for the text in the first column:

        begin{tabular}{ p{0.1textwidth}l }
        gdgd\
        asfsdf & 5\
        akku \
        end{tabular}

        bigskip

        Using multirow:

        begin{tabular}{ p{0.1textwidth}l }
        gdgd asfsdf akku & multirow{3}{*}{5} \
        end{tabular}
        end{document}


        enter image description here






        share|improve this answer




























          5














          Here are three different possible solutions:



          documentclass{article}
          usepackage{array} % Only needed for the first example.
          usepackage{multirow} % Only needed for the third example.
          begin{document}

          Using the vertically centered m type column:

          begin{tabular}{ m{0.1textwidth}l }
          gdgd asfsdf akku & 5 \
          end{tabular}

          bigskip

          Using three different rows for the text in the first column:

          begin{tabular}{ p{0.1textwidth}l }
          gdgd\
          asfsdf & 5\
          akku \
          end{tabular}

          bigskip

          Using multirow:

          begin{tabular}{ p{0.1textwidth}l }
          gdgd asfsdf akku & multirow{3}{*}{5} \
          end{tabular}
          end{document}


          enter image description here






          share|improve this answer


























            5












            5








            5







            Here are three different possible solutions:



            documentclass{article}
            usepackage{array} % Only needed for the first example.
            usepackage{multirow} % Only needed for the third example.
            begin{document}

            Using the vertically centered m type column:

            begin{tabular}{ m{0.1textwidth}l }
            gdgd asfsdf akku & 5 \
            end{tabular}

            bigskip

            Using three different rows for the text in the first column:

            begin{tabular}{ p{0.1textwidth}l }
            gdgd\
            asfsdf & 5\
            akku \
            end{tabular}

            bigskip

            Using multirow:

            begin{tabular}{ p{0.1textwidth}l }
            gdgd asfsdf akku & multirow{3}{*}{5} \
            end{tabular}
            end{document}


            enter image description here






            share|improve this answer













            Here are three different possible solutions:



            documentclass{article}
            usepackage{array} % Only needed for the first example.
            usepackage{multirow} % Only needed for the third example.
            begin{document}

            Using the vertically centered m type column:

            begin{tabular}{ m{0.1textwidth}l }
            gdgd asfsdf akku & 5 \
            end{tabular}

            bigskip

            Using three different rows for the text in the first column:

            begin{tabular}{ p{0.1textwidth}l }
            gdgd\
            asfsdf & 5\
            akku \
            end{tabular}

            bigskip

            Using multirow:

            begin{tabular}{ p{0.1textwidth}l }
            gdgd asfsdf akku & multirow{3}{*}{5} \
            end{tabular}
            end{document}


            enter image description here







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Apr 21 at 12:25









            leandriisleandriis

            11.9k1733




            11.9k1733























                4














                You can use multirow with a single cell, but you have to count the number of lines in this cell, on order to vertically centre its contents. Note that you can use decimal numbers to fine-tune the placement.



                Alternatively, use the m{...} column type for the left column (requires loading array):



                documentclass{article}
                usepackage{array}
                usepackage{multirow}

                begin{document}

                begin{tabular}{m{0.1textwidth}l }
                gdgd asfsdf akku & 5 \
                end{tabular}
                qquad
                begin{tabular}{p{0.1textwidth}l }
                gdgd asfsdf akku & multirow{3}{*}{5}\
                end{tabular}

                end{document}


                enter image description here






                share|improve this answer




























                  4














                  You can use multirow with a single cell, but you have to count the number of lines in this cell, on order to vertically centre its contents. Note that you can use decimal numbers to fine-tune the placement.



                  Alternatively, use the m{...} column type for the left column (requires loading array):



                  documentclass{article}
                  usepackage{array}
                  usepackage{multirow}

                  begin{document}

                  begin{tabular}{m{0.1textwidth}l }
                  gdgd asfsdf akku & 5 \
                  end{tabular}
                  qquad
                  begin{tabular}{p{0.1textwidth}l }
                  gdgd asfsdf akku & multirow{3}{*}{5}\
                  end{tabular}

                  end{document}


                  enter image description here






                  share|improve this answer


























                    4












                    4








                    4







                    You can use multirow with a single cell, but you have to count the number of lines in this cell, on order to vertically centre its contents. Note that you can use decimal numbers to fine-tune the placement.



                    Alternatively, use the m{...} column type for the left column (requires loading array):



                    documentclass{article}
                    usepackage{array}
                    usepackage{multirow}

                    begin{document}

                    begin{tabular}{m{0.1textwidth}l }
                    gdgd asfsdf akku & 5 \
                    end{tabular}
                    qquad
                    begin{tabular}{p{0.1textwidth}l }
                    gdgd asfsdf akku & multirow{3}{*}{5}\
                    end{tabular}

                    end{document}


                    enter image description here






                    share|improve this answer













                    You can use multirow with a single cell, but you have to count the number of lines in this cell, on order to vertically centre its contents. Note that you can use decimal numbers to fine-tune the placement.



                    Alternatively, use the m{...} column type for the left column (requires loading array):



                    documentclass{article}
                    usepackage{array}
                    usepackage{multirow}

                    begin{document}

                    begin{tabular}{m{0.1textwidth}l }
                    gdgd asfsdf akku & 5 \
                    end{tabular}
                    qquad
                    begin{tabular}{p{0.1textwidth}l }
                    gdgd asfsdf akku & multirow{3}{*}{5}\
                    end{tabular}

                    end{document}


                    enter image description here







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Apr 21 at 12:24









                    BernardBernard

                    177k779211




                    177k779211























                        1














                        A possible solution would be using the multirow package (But it requires you to split cell on the left into three cells and putting the text of the right cell into a multirow-cell that spans over three rows).
                        A working example would be:



                        documentclass{article}                                                                     usepackage{multirow}                                                                                                
                        begin{document}
                        begin{tabular}{ p{0.1textwidth}l }
                        gdgd & multirow{3}{*}{5} \
                        asfsdf \
                        akku \
                        end{tabular}
                        end{document}


                        Result



                        A little explanation on the code:



                        gdgd & multirow{3}{*}{5} \


                        Inserts gdgd as the first entry of the first row and an multirow-cell that spans over three rows (the first parameter) inherits the width of the original column (second parameter set as *) and contains the text "5" (last parameter). \ indicates the linebreak



                        asfsdf \ 


                        Inserts asfsdf into the first entry of the second line. Another entry in this line is not necessary because of the multirow-cell above.






                        share|improve this answer








                        New contributor




                        Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                        Check out our Code of Conduct.

























                          1














                          A possible solution would be using the multirow package (But it requires you to split cell on the left into three cells and putting the text of the right cell into a multirow-cell that spans over three rows).
                          A working example would be:



                          documentclass{article}                                                                     usepackage{multirow}                                                                                                
                          begin{document}
                          begin{tabular}{ p{0.1textwidth}l }
                          gdgd & multirow{3}{*}{5} \
                          asfsdf \
                          akku \
                          end{tabular}
                          end{document}


                          Result



                          A little explanation on the code:



                          gdgd & multirow{3}{*}{5} \


                          Inserts gdgd as the first entry of the first row and an multirow-cell that spans over three rows (the first parameter) inherits the width of the original column (second parameter set as *) and contains the text "5" (last parameter). \ indicates the linebreak



                          asfsdf \ 


                          Inserts asfsdf into the first entry of the second line. Another entry in this line is not necessary because of the multirow-cell above.






                          share|improve this answer








                          New contributor




                          Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                          Check out our Code of Conduct.























                            1












                            1








                            1







                            A possible solution would be using the multirow package (But it requires you to split cell on the left into three cells and putting the text of the right cell into a multirow-cell that spans over three rows).
                            A working example would be:



                            documentclass{article}                                                                     usepackage{multirow}                                                                                                
                            begin{document}
                            begin{tabular}{ p{0.1textwidth}l }
                            gdgd & multirow{3}{*}{5} \
                            asfsdf \
                            akku \
                            end{tabular}
                            end{document}


                            Result



                            A little explanation on the code:



                            gdgd & multirow{3}{*}{5} \


                            Inserts gdgd as the first entry of the first row and an multirow-cell that spans over three rows (the first parameter) inherits the width of the original column (second parameter set as *) and contains the text "5" (last parameter). \ indicates the linebreak



                            asfsdf \ 


                            Inserts asfsdf into the first entry of the second line. Another entry in this line is not necessary because of the multirow-cell above.






                            share|improve this answer








                            New contributor




                            Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.










                            A possible solution would be using the multirow package (But it requires you to split cell on the left into three cells and putting the text of the right cell into a multirow-cell that spans over three rows).
                            A working example would be:



                            documentclass{article}                                                                     usepackage{multirow}                                                                                                
                            begin{document}
                            begin{tabular}{ p{0.1textwidth}l }
                            gdgd & multirow{3}{*}{5} \
                            asfsdf \
                            akku \
                            end{tabular}
                            end{document}


                            Result



                            A little explanation on the code:



                            gdgd & multirow{3}{*}{5} \


                            Inserts gdgd as the first entry of the first row and an multirow-cell that spans over three rows (the first parameter) inherits the width of the original column (second parameter set as *) and contains the text "5" (last parameter). \ indicates the linebreak



                            asfsdf \ 


                            Inserts asfsdf into the first entry of the second line. Another entry in this line is not necessary because of the multirow-cell above.







                            share|improve this answer








                            New contributor




                            Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            share|improve this answer



                            share|improve this answer






                            New contributor




                            Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.









                            answered Apr 21 at 12:06









                            Freshly_Brewed_CaffeineFreshly_Brewed_Caffeine

                            111




                            111




                            New contributor




                            Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.





                            New contributor





                            Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






                            Freshly_Brewed_Caffeine is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                            Check out our Code of Conduct.






























                                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.




                                draft saved


                                draft discarded














                                StackExchange.ready(
                                function () {
                                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f485886%2fcentre-cell-contents-vertically%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

                                Plaza Victoria

                                In PowerPoint, is there a keyboard shortcut for bulleted / numbered list?

                                How to put 3 figures in Latex with 2 figures side by side and 1 below these side by side images but in...