How to specify the row height in LaTeX table?












60















I want to create a LaTeX table with three rows which have different row heights.
How can I do this?



The following code



renewcommandarraystretch{2.4} setlengthminrowclearance{2.4pt}


seems make each row has the same height.










share|improve this question




















  • 6





    you could probably use rule{0pt}{<lenght>} to create a line with 0 width but a certain vertical length.

    – Martin H
    Jun 1 '11 at 7:32
















60















I want to create a LaTeX table with three rows which have different row heights.
How can I do this?



The following code



renewcommandarraystretch{2.4} setlengthminrowclearance{2.4pt}


seems make each row has the same height.










share|improve this question




















  • 6





    you could probably use rule{0pt}{<lenght>} to create a line with 0 width but a certain vertical length.

    – Martin H
    Jun 1 '11 at 7:32














60












60








60


27






I want to create a LaTeX table with three rows which have different row heights.
How can I do this?



The following code



renewcommandarraystretch{2.4} setlengthminrowclearance{2.4pt}


seems make each row has the same height.










share|improve this question
















I want to create a LaTeX table with three rows which have different row heights.
How can I do this?



The following code



renewcommandarraystretch{2.4} setlengthminrowclearance{2.4pt}


seems make each row has the same height.







tables






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jun 1 '11 at 10:40









xport

22.2k30140263




22.2k30140263










asked Jun 1 '11 at 7:29









evaeva

426277




426277








  • 6





    you could probably use rule{0pt}{<lenght>} to create a line with 0 width but a certain vertical length.

    – Martin H
    Jun 1 '11 at 7:32














  • 6





    you could probably use rule{0pt}{<lenght>} to create a line with 0 width but a certain vertical length.

    – Martin H
    Jun 1 '11 at 7:32








6




6





you could probably use rule{0pt}{<lenght>} to create a line with 0 width but a certain vertical length.

– Martin H
Jun 1 '11 at 7:32





you could probably use rule{0pt}{<lenght>} to create a line with 0 width but a certain vertical length.

– Martin H
Jun 1 '11 at 7:32










3 Answers
3






active

oldest

votes


















71














Try this:



documentclass{article}
begin{document}
begin{tabular}{cc}
hline
hi & tall one\[10ex]
hline
hi & medium one\[5ex]
hline
hi & standard one\
hline
end{tabular}
end{document}


So you can specify the height of a row with the optional argument






share|improve this answer





















  • 20





    how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

    – Ivan Machado
    Nov 21 '12 at 22:57






  • 10





    Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

    – Nathanael Farley
    Dec 17 '12 at 11:03








  • 5





    @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

    – Aram Papazian
    Aug 15 '14 at 13:07











  • @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

    – Nathanael Farley
    Aug 18 '14 at 9:12





















1














As none of the current answers address the issue of how to center the content vertically, I here introduce xrowht[<footprint>]{<length>} to add an extra .5<length> of height above and below a vphantom of a <footprint>. The default footprint takes the height of a 0 character, which is great if the data has no descenders. For data with descenders, an optionally specified footprint of () makes more sense.



xrowht can be added to any cell in the row. Here, I add it to the 1st column cells, for convenience.



In the MWE, the 1st row is unmodified, then for successive rows, 10pt, 20pt, 30pt, and 40pt are symmetrically added. I also use an optional footprint in the 2nd row, which contains descenders.



documentclass{article}
usepackage{stackengine}
newcommandxrowht[2][0]{addstackgap[.5dimexpr#2relax]{vphantom{#1}}}
begin{document}
begin{table}[h]
begin{tabular}{|c|l|}
hline
col1 & col2 \
hlinexrowht[()]{10pt}
1 & 2g \
hlinexrowht{20pt}
3 & 4 \
hlinexrowht{30pt}
5 & 6 \
hlinexrowht{40pt}
7 & 8 \
hline
end{tabular}
end{table}
end{document}


enter image description here






share|improve this answer

































    0














    Code for a latex table with adjustable row height. (Credits to previous posts)



        begin{table}[h]
    begin{tabular}{|c|l|}
    hline
    col1 & col2 \%[2ex]
    hline
    & \[-2ex]
    1 & 2 \[0.75ex]
    hline
    & \[-2ex]
    3 & 4 \[2ex]
    hline
    & \[2ex]
    5 & 6 \[3ex]
    hline
    & \
    7 & 8 \
    hline
    end{tabular}
    end{table}


    Your table will look like this.






    share|improve this answer








    New contributor




    vineeshvs 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%2f19589%2fhow-to-specify-the-row-height-in-latex-table%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









      71














      Try this:



      documentclass{article}
      begin{document}
      begin{tabular}{cc}
      hline
      hi & tall one\[10ex]
      hline
      hi & medium one\[5ex]
      hline
      hi & standard one\
      hline
      end{tabular}
      end{document}


      So you can specify the height of a row with the optional argument






      share|improve this answer





















      • 20





        how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

        – Ivan Machado
        Nov 21 '12 at 22:57






      • 10





        Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

        – Nathanael Farley
        Dec 17 '12 at 11:03








      • 5





        @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

        – Aram Papazian
        Aug 15 '14 at 13:07











      • @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

        – Nathanael Farley
        Aug 18 '14 at 9:12


















      71














      Try this:



      documentclass{article}
      begin{document}
      begin{tabular}{cc}
      hline
      hi & tall one\[10ex]
      hline
      hi & medium one\[5ex]
      hline
      hi & standard one\
      hline
      end{tabular}
      end{document}


      So you can specify the height of a row with the optional argument






      share|improve this answer





















      • 20





        how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

        – Ivan Machado
        Nov 21 '12 at 22:57






      • 10





        Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

        – Nathanael Farley
        Dec 17 '12 at 11:03








      • 5





        @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

        – Aram Papazian
        Aug 15 '14 at 13:07











      • @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

        – Nathanael Farley
        Aug 18 '14 at 9:12
















      71












      71








      71







      Try this:



      documentclass{article}
      begin{document}
      begin{tabular}{cc}
      hline
      hi & tall one\[10ex]
      hline
      hi & medium one\[5ex]
      hline
      hi & standard one\
      hline
      end{tabular}
      end{document}


      So you can specify the height of a row with the optional argument






      share|improve this answer















      Try this:



      documentclass{article}
      begin{document}
      begin{tabular}{cc}
      hline
      hi & tall one\[10ex]
      hline
      hi & medium one\[5ex]
      hline
      hi & standard one\
      hline
      end{tabular}
      end{document}


      So you can specify the height of a row with the optional argument







      share|improve this answer














      share|improve this answer



      share|improve this answer








      edited Jul 15 '17 at 15:01









      David Carlisle

      497k4111441891




      497k4111441891










      answered Jun 1 '11 at 7:58









      SpikeSpike

      4,64311923




      4,64311923








      • 20





        how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

        – Ivan Machado
        Nov 21 '12 at 22:57






      • 10





        Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

        – Nathanael Farley
        Dec 17 '12 at 11:03








      • 5





        @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

        – Aram Papazian
        Aug 15 '14 at 13:07











      • @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

        – Nathanael Farley
        Aug 18 '14 at 9:12
















      • 20





        how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

        – Ivan Machado
        Nov 21 '12 at 22:57






      • 10





        Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

        – Nathanael Farley
        Dec 17 '12 at 11:03








      • 5





        @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

        – Aram Papazian
        Aug 15 '14 at 13:07











      • @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

        – Nathanael Farley
        Aug 18 '14 at 9:12










      20




      20





      how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

      – Ivan Machado
      Nov 21 '12 at 22:57





      how do you vertically centralize the elements in a cell, using the [ex] optional argument?!

      – Ivan Machado
      Nov 21 '12 at 22:57




      10




      10





      Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

      – Nathanael Farley
      Dec 17 '12 at 11:03







      Using \[<space>] adds space to the end of the last cell, so if the last cell of each row has significantly different contents, then the row height can vary. This is easily solved by adding an extra column, and keeping it empty. Then \[<space>] always makes the row <space> as a minimum.

      – Nathanael Farley
      Dec 17 '12 at 11:03






      5




      5





      @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

      – Aram Papazian
      Aug 15 '14 at 13:07





      @NathanaelFarley This won't help when you have hlines as then adding an additional column will produce extra lines at the end. Additionally, it still keeps the contents vertically spaced near the top rather than within the cell in the center vertically

      – Aram Papazian
      Aug 15 '14 at 13:07













      @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

      – Nathanael Farley
      Aug 18 '14 at 9:12







      @AramPapazian This can be fixed by using columns like {cc@{}c@{}} as the @{} will make the space either side of the empty column 0 pt.

      – Nathanael Farley
      Aug 18 '14 at 9:12













      1














      As none of the current answers address the issue of how to center the content vertically, I here introduce xrowht[<footprint>]{<length>} to add an extra .5<length> of height above and below a vphantom of a <footprint>. The default footprint takes the height of a 0 character, which is great if the data has no descenders. For data with descenders, an optionally specified footprint of () makes more sense.



      xrowht can be added to any cell in the row. Here, I add it to the 1st column cells, for convenience.



      In the MWE, the 1st row is unmodified, then for successive rows, 10pt, 20pt, 30pt, and 40pt are symmetrically added. I also use an optional footprint in the 2nd row, which contains descenders.



      documentclass{article}
      usepackage{stackengine}
      newcommandxrowht[2][0]{addstackgap[.5dimexpr#2relax]{vphantom{#1}}}
      begin{document}
      begin{table}[h]
      begin{tabular}{|c|l|}
      hline
      col1 & col2 \
      hlinexrowht[()]{10pt}
      1 & 2g \
      hlinexrowht{20pt}
      3 & 4 \
      hlinexrowht{30pt}
      5 & 6 \
      hlinexrowht{40pt}
      7 & 8 \
      hline
      end{tabular}
      end{table}
      end{document}


      enter image description here






      share|improve this answer






























        1














        As none of the current answers address the issue of how to center the content vertically, I here introduce xrowht[<footprint>]{<length>} to add an extra .5<length> of height above and below a vphantom of a <footprint>. The default footprint takes the height of a 0 character, which is great if the data has no descenders. For data with descenders, an optionally specified footprint of () makes more sense.



        xrowht can be added to any cell in the row. Here, I add it to the 1st column cells, for convenience.



        In the MWE, the 1st row is unmodified, then for successive rows, 10pt, 20pt, 30pt, and 40pt are symmetrically added. I also use an optional footprint in the 2nd row, which contains descenders.



        documentclass{article}
        usepackage{stackengine}
        newcommandxrowht[2][0]{addstackgap[.5dimexpr#2relax]{vphantom{#1}}}
        begin{document}
        begin{table}[h]
        begin{tabular}{|c|l|}
        hline
        col1 & col2 \
        hlinexrowht[()]{10pt}
        1 & 2g \
        hlinexrowht{20pt}
        3 & 4 \
        hlinexrowht{30pt}
        5 & 6 \
        hlinexrowht{40pt}
        7 & 8 \
        hline
        end{tabular}
        end{table}
        end{document}


        enter image description here






        share|improve this answer




























          1












          1








          1







          As none of the current answers address the issue of how to center the content vertically, I here introduce xrowht[<footprint>]{<length>} to add an extra .5<length> of height above and below a vphantom of a <footprint>. The default footprint takes the height of a 0 character, which is great if the data has no descenders. For data with descenders, an optionally specified footprint of () makes more sense.



          xrowht can be added to any cell in the row. Here, I add it to the 1st column cells, for convenience.



          In the MWE, the 1st row is unmodified, then for successive rows, 10pt, 20pt, 30pt, and 40pt are symmetrically added. I also use an optional footprint in the 2nd row, which contains descenders.



          documentclass{article}
          usepackage{stackengine}
          newcommandxrowht[2][0]{addstackgap[.5dimexpr#2relax]{vphantom{#1}}}
          begin{document}
          begin{table}[h]
          begin{tabular}{|c|l|}
          hline
          col1 & col2 \
          hlinexrowht[()]{10pt}
          1 & 2g \
          hlinexrowht{20pt}
          3 & 4 \
          hlinexrowht{30pt}
          5 & 6 \
          hlinexrowht{40pt}
          7 & 8 \
          hline
          end{tabular}
          end{table}
          end{document}


          enter image description here






          share|improve this answer















          As none of the current answers address the issue of how to center the content vertically, I here introduce xrowht[<footprint>]{<length>} to add an extra .5<length> of height above and below a vphantom of a <footprint>. The default footprint takes the height of a 0 character, which is great if the data has no descenders. For data with descenders, an optionally specified footprint of () makes more sense.



          xrowht can be added to any cell in the row. Here, I add it to the 1st column cells, for convenience.



          In the MWE, the 1st row is unmodified, then for successive rows, 10pt, 20pt, 30pt, and 40pt are symmetrically added. I also use an optional footprint in the 2nd row, which contains descenders.



          documentclass{article}
          usepackage{stackengine}
          newcommandxrowht[2][0]{addstackgap[.5dimexpr#2relax]{vphantom{#1}}}
          begin{document}
          begin{table}[h]
          begin{tabular}{|c|l|}
          hline
          col1 & col2 \
          hlinexrowht[()]{10pt}
          1 & 2g \
          hlinexrowht{20pt}
          3 & 4 \
          hlinexrowht{30pt}
          5 & 6 \
          hlinexrowht{40pt}
          7 & 8 \
          hline
          end{tabular}
          end{table}
          end{document}


          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 10 hours ago

























          answered 10 hours ago









          Steven B. SegletesSteven B. Segletes

          160k9205413




          160k9205413























              0














              Code for a latex table with adjustable row height. (Credits to previous posts)



                  begin{table}[h]
              begin{tabular}{|c|l|}
              hline
              col1 & col2 \%[2ex]
              hline
              & \[-2ex]
              1 & 2 \[0.75ex]
              hline
              & \[-2ex]
              3 & 4 \[2ex]
              hline
              & \[2ex]
              5 & 6 \[3ex]
              hline
              & \
              7 & 8 \
              hline
              end{tabular}
              end{table}


              Your table will look like this.






              share|improve this answer








              New contributor




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

























                0














                Code for a latex table with adjustable row height. (Credits to previous posts)



                    begin{table}[h]
                begin{tabular}{|c|l|}
                hline
                col1 & col2 \%[2ex]
                hline
                & \[-2ex]
                1 & 2 \[0.75ex]
                hline
                & \[-2ex]
                3 & 4 \[2ex]
                hline
                & \[2ex]
                5 & 6 \[3ex]
                hline
                & \
                7 & 8 \
                hline
                end{tabular}
                end{table}


                Your table will look like this.






                share|improve this answer








                New contributor




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























                  0












                  0








                  0







                  Code for a latex table with adjustable row height. (Credits to previous posts)



                      begin{table}[h]
                  begin{tabular}{|c|l|}
                  hline
                  col1 & col2 \%[2ex]
                  hline
                  & \[-2ex]
                  1 & 2 \[0.75ex]
                  hline
                  & \[-2ex]
                  3 & 4 \[2ex]
                  hline
                  & \[2ex]
                  5 & 6 \[3ex]
                  hline
                  & \
                  7 & 8 \
                  hline
                  end{tabular}
                  end{table}


                  Your table will look like this.






                  share|improve this answer








                  New contributor




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










                  Code for a latex table with adjustable row height. (Credits to previous posts)



                      begin{table}[h]
                  begin{tabular}{|c|l|}
                  hline
                  col1 & col2 \%[2ex]
                  hline
                  & \[-2ex]
                  1 & 2 \[0.75ex]
                  hline
                  & \[-2ex]
                  3 & 4 \[2ex]
                  hline
                  & \[2ex]
                  5 & 6 \[3ex]
                  hline
                  & \
                  7 & 8 \
                  hline
                  end{tabular}
                  end{table}


                  Your table will look like this.







                  share|improve this answer








                  New contributor




                  vineeshvs 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




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









                  answered 11 hours ago









                  vineeshvsvineeshvs

                  11




                  11




                  New contributor




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





                  New contributor





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






                  vineeshvs 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%2f19589%2fhow-to-specify-the-row-height-in-latex-table%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

                      A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

                      Calculate evaluation metrics using cross_val_predict sklearn

                      Insert data from modal to MySQL (multiple modal on website)