pgfplotstable adding vertical space between fractions












4















enter image description here



MWE



% stand-alone file to test writing a table in pgfplotstable
documentclass{book}
usepackage{booktabs,multirow} % required
usepackage{pgfplotstable}
pgfplotsset{compat=1.16}
begin{document}
%renewcommand{arraystretch}{1.2}
pgfplotstabletypeset
[
after row = vspace{0.8mm},
every head row/.style =
{
before row = toprule,
after row = midrule,
},
every last row/.style =
{
after row = bottomrule,
},
columns/x/.style =
{
column type = r,
column name = $x$,
frac,
},
columns/y/.style =
{
column type = r,
column name = ${y=frac{2}{x}}$,
frac,
},
]
{
x y
-4 -0.5 % vertical space not added after this row
-3 -0.66666666 % vert space added below here
-2 -1
-1 -2
-0.5 -4
0.5 4
1 2
2 1
3 0.66666666
4 0.5
} % pgfplotstabletypeset{} END
end{document}


To display columns of fractions (with pgfplotstable, booktabs and multirows), I need to add vertical space between the rows so the fraction of the current row does not step on the fraction of the previous row. As shown in the MWE, I added



after row = {vspace{0.8mm}},


to the options for pgfplotstabletypeset, but it compiled by adding space to every row after row 1, not between rows 0 and 1. See image.



I added the usual arraystretch command (commented out in MWE) prior to pgfplotstabletypeset, but it is outside my block, and since I have dozens of tables in this document, not all need to have the array stretch applied. Yes, I could put braces around the source text, but I hope there is something cleaner to add to the options that I missed.



Why is the space not added between rows 0 and 1?










share|improve this question



























    4















    enter image description here



    MWE



    % stand-alone file to test writing a table in pgfplotstable
    documentclass{book}
    usepackage{booktabs,multirow} % required
    usepackage{pgfplotstable}
    pgfplotsset{compat=1.16}
    begin{document}
    %renewcommand{arraystretch}{1.2}
    pgfplotstabletypeset
    [
    after row = vspace{0.8mm},
    every head row/.style =
    {
    before row = toprule,
    after row = midrule,
    },
    every last row/.style =
    {
    after row = bottomrule,
    },
    columns/x/.style =
    {
    column type = r,
    column name = $x$,
    frac,
    },
    columns/y/.style =
    {
    column type = r,
    column name = ${y=frac{2}{x}}$,
    frac,
    },
    ]
    {
    x y
    -4 -0.5 % vertical space not added after this row
    -3 -0.66666666 % vert space added below here
    -2 -1
    -1 -2
    -0.5 -4
    0.5 4
    1 2
    2 1
    3 0.66666666
    4 0.5
    } % pgfplotstabletypeset{} END
    end{document}


    To display columns of fractions (with pgfplotstable, booktabs and multirows), I need to add vertical space between the rows so the fraction of the current row does not step on the fraction of the previous row. As shown in the MWE, I added



    after row = {vspace{0.8mm}},


    to the options for pgfplotstabletypeset, but it compiled by adding space to every row after row 1, not between rows 0 and 1. See image.



    I added the usual arraystretch command (commented out in MWE) prior to pgfplotstabletypeset, but it is outside my block, and since I have dozens of tables in this document, not all need to have the array stretch applied. Yes, I could put braces around the source text, but I hope there is something cleaner to add to the options that I missed.



    Why is the space not added between rows 0 and 1?










    share|improve this question

























      4












      4








      4








      enter image description here



      MWE



      % stand-alone file to test writing a table in pgfplotstable
      documentclass{book}
      usepackage{booktabs,multirow} % required
      usepackage{pgfplotstable}
      pgfplotsset{compat=1.16}
      begin{document}
      %renewcommand{arraystretch}{1.2}
      pgfplotstabletypeset
      [
      after row = vspace{0.8mm},
      every head row/.style =
      {
      before row = toprule,
      after row = midrule,
      },
      every last row/.style =
      {
      after row = bottomrule,
      },
      columns/x/.style =
      {
      column type = r,
      column name = $x$,
      frac,
      },
      columns/y/.style =
      {
      column type = r,
      column name = ${y=frac{2}{x}}$,
      frac,
      },
      ]
      {
      x y
      -4 -0.5 % vertical space not added after this row
      -3 -0.66666666 % vert space added below here
      -2 -1
      -1 -2
      -0.5 -4
      0.5 4
      1 2
      2 1
      3 0.66666666
      4 0.5
      } % pgfplotstabletypeset{} END
      end{document}


      To display columns of fractions (with pgfplotstable, booktabs and multirows), I need to add vertical space between the rows so the fraction of the current row does not step on the fraction of the previous row. As shown in the MWE, I added



      after row = {vspace{0.8mm}},


      to the options for pgfplotstabletypeset, but it compiled by adding space to every row after row 1, not between rows 0 and 1. See image.



      I added the usual arraystretch command (commented out in MWE) prior to pgfplotstabletypeset, but it is outside my block, and since I have dozens of tables in this document, not all need to have the array stretch applied. Yes, I could put braces around the source text, but I hope there is something cleaner to add to the options that I missed.



      Why is the space not added between rows 0 and 1?










      share|improve this question














      enter image description here



      MWE



      % stand-alone file to test writing a table in pgfplotstable
      documentclass{book}
      usepackage{booktabs,multirow} % required
      usepackage{pgfplotstable}
      pgfplotsset{compat=1.16}
      begin{document}
      %renewcommand{arraystretch}{1.2}
      pgfplotstabletypeset
      [
      after row = vspace{0.8mm},
      every head row/.style =
      {
      before row = toprule,
      after row = midrule,
      },
      every last row/.style =
      {
      after row = bottomrule,
      },
      columns/x/.style =
      {
      column type = r,
      column name = $x$,
      frac,
      },
      columns/y/.style =
      {
      column type = r,
      column name = ${y=frac{2}{x}}$,
      frac,
      },
      ]
      {
      x y
      -4 -0.5 % vertical space not added after this row
      -3 -0.66666666 % vert space added below here
      -2 -1
      -1 -2
      -0.5 -4
      0.5 4
      1 2
      2 1
      3 0.66666666
      4 0.5
      } % pgfplotstabletypeset{} END
      end{document}


      To display columns of fractions (with pgfplotstable, booktabs and multirows), I need to add vertical space between the rows so the fraction of the current row does not step on the fraction of the previous row. As shown in the MWE, I added



      after row = {vspace{0.8mm}},


      to the options for pgfplotstabletypeset, but it compiled by adding space to every row after row 1, not between rows 0 and 1. See image.



      I added the usual arraystretch command (commented out in MWE) prior to pgfplotstabletypeset, but it is outside my block, and since I have dozens of tables in this document, not all need to have the array stretch applied. Yes, I could put braces around the source text, but I hope there is something cleaner to add to the options that I missed.



      Why is the space not added between rows 0 and 1?







      vertical-alignment pgfplotstable fractions






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Apr 2 at 14:45









      kpo7057kpo7057

      697




      697






















          1 Answer
          1






          active

          oldest

          votes


















          3














          pgfplotstable allows you to specify the code for fractions via frac TeX. This can be used to add more vertical space where fractions appear e.g. by adding a vertical phantom.



          documentclass{book}
          usepackage{booktabs,multirow} % required
          usepackage{pgfplotstable}
          pgfplotsset{compat=1.16}
          begin{document}
          %renewcommand{arraystretch}{1.2}
          pgfplotstabletypeset
          [
          after row ={[0.3ex]}, %<use this instead of vspace
          frac TeX=vphantom{displaystylefrac{1}{2}}frac,
          every head row/.style =
          {
          before row = toprule,
          after row = midrule,
          },
          every last row/.style =
          {
          after row = bottomrule,
          },
          columns/x/.style =
          {
          column type = r,
          column name = $x$,
          frac,
          },
          columns/y/.style =
          {
          column type = r,
          column name = ${y=frac{2}{x}}$,
          frac,
          },
          ]
          {
          x y
          -4 -0.5
          -3 -0.66666666
          -2 -1
          -1 -2
          -0.5 -4
          0.5 4
          1 2
          2 1
          3 0.66666666
          4 0.5
          } % pgfplotstabletypeset{} END
          end{document}


          enter image description here






          share|improve this answer
























          • Is it possible to add hline to each line?

            – manooooh
            Apr 3 at 5:18






          • 1





            @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

            – marmot
            Apr 3 at 5:21












          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%2f482785%2fpgfplotstable-adding-vertical-space-between-fractions%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          pgfplotstable allows you to specify the code for fractions via frac TeX. This can be used to add more vertical space where fractions appear e.g. by adding a vertical phantom.



          documentclass{book}
          usepackage{booktabs,multirow} % required
          usepackage{pgfplotstable}
          pgfplotsset{compat=1.16}
          begin{document}
          %renewcommand{arraystretch}{1.2}
          pgfplotstabletypeset
          [
          after row ={[0.3ex]}, %<use this instead of vspace
          frac TeX=vphantom{displaystylefrac{1}{2}}frac,
          every head row/.style =
          {
          before row = toprule,
          after row = midrule,
          },
          every last row/.style =
          {
          after row = bottomrule,
          },
          columns/x/.style =
          {
          column type = r,
          column name = $x$,
          frac,
          },
          columns/y/.style =
          {
          column type = r,
          column name = ${y=frac{2}{x}}$,
          frac,
          },
          ]
          {
          x y
          -4 -0.5
          -3 -0.66666666
          -2 -1
          -1 -2
          -0.5 -4
          0.5 4
          1 2
          2 1
          3 0.66666666
          4 0.5
          } % pgfplotstabletypeset{} END
          end{document}


          enter image description here






          share|improve this answer
























          • Is it possible to add hline to each line?

            – manooooh
            Apr 3 at 5:18






          • 1





            @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

            – marmot
            Apr 3 at 5:21
















          3














          pgfplotstable allows you to specify the code for fractions via frac TeX. This can be used to add more vertical space where fractions appear e.g. by adding a vertical phantom.



          documentclass{book}
          usepackage{booktabs,multirow} % required
          usepackage{pgfplotstable}
          pgfplotsset{compat=1.16}
          begin{document}
          %renewcommand{arraystretch}{1.2}
          pgfplotstabletypeset
          [
          after row ={[0.3ex]}, %<use this instead of vspace
          frac TeX=vphantom{displaystylefrac{1}{2}}frac,
          every head row/.style =
          {
          before row = toprule,
          after row = midrule,
          },
          every last row/.style =
          {
          after row = bottomrule,
          },
          columns/x/.style =
          {
          column type = r,
          column name = $x$,
          frac,
          },
          columns/y/.style =
          {
          column type = r,
          column name = ${y=frac{2}{x}}$,
          frac,
          },
          ]
          {
          x y
          -4 -0.5
          -3 -0.66666666
          -2 -1
          -1 -2
          -0.5 -4
          0.5 4
          1 2
          2 1
          3 0.66666666
          4 0.5
          } % pgfplotstabletypeset{} END
          end{document}


          enter image description here






          share|improve this answer
























          • Is it possible to add hline to each line?

            – manooooh
            Apr 3 at 5:18






          • 1





            @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

            – marmot
            Apr 3 at 5:21














          3












          3








          3







          pgfplotstable allows you to specify the code for fractions via frac TeX. This can be used to add more vertical space where fractions appear e.g. by adding a vertical phantom.



          documentclass{book}
          usepackage{booktabs,multirow} % required
          usepackage{pgfplotstable}
          pgfplotsset{compat=1.16}
          begin{document}
          %renewcommand{arraystretch}{1.2}
          pgfplotstabletypeset
          [
          after row ={[0.3ex]}, %<use this instead of vspace
          frac TeX=vphantom{displaystylefrac{1}{2}}frac,
          every head row/.style =
          {
          before row = toprule,
          after row = midrule,
          },
          every last row/.style =
          {
          after row = bottomrule,
          },
          columns/x/.style =
          {
          column type = r,
          column name = $x$,
          frac,
          },
          columns/y/.style =
          {
          column type = r,
          column name = ${y=frac{2}{x}}$,
          frac,
          },
          ]
          {
          x y
          -4 -0.5
          -3 -0.66666666
          -2 -1
          -1 -2
          -0.5 -4
          0.5 4
          1 2
          2 1
          3 0.66666666
          4 0.5
          } % pgfplotstabletypeset{} END
          end{document}


          enter image description here






          share|improve this answer













          pgfplotstable allows you to specify the code for fractions via frac TeX. This can be used to add more vertical space where fractions appear e.g. by adding a vertical phantom.



          documentclass{book}
          usepackage{booktabs,multirow} % required
          usepackage{pgfplotstable}
          pgfplotsset{compat=1.16}
          begin{document}
          %renewcommand{arraystretch}{1.2}
          pgfplotstabletypeset
          [
          after row ={[0.3ex]}, %<use this instead of vspace
          frac TeX=vphantom{displaystylefrac{1}{2}}frac,
          every head row/.style =
          {
          before row = toprule,
          after row = midrule,
          },
          every last row/.style =
          {
          after row = bottomrule,
          },
          columns/x/.style =
          {
          column type = r,
          column name = $x$,
          frac,
          },
          columns/y/.style =
          {
          column type = r,
          column name = ${y=frac{2}{x}}$,
          frac,
          },
          ]
          {
          x y
          -4 -0.5
          -3 -0.66666666
          -2 -1
          -1 -2
          -0.5 -4
          0.5 4
          1 2
          2 1
          3 0.66666666
          4 0.5
          } % pgfplotstabletypeset{} END
          end{document}


          enter image description here







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Apr 3 at 5:05









          marmotmarmot

          117k5150283




          117k5150283













          • Is it possible to add hline to each line?

            – manooooh
            Apr 3 at 5:18






          • 1





            @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

            – marmot
            Apr 3 at 5:21



















          • Is it possible to add hline to each line?

            – manooooh
            Apr 3 at 5:18






          • 1





            @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

            – marmot
            Apr 3 at 5:21

















          Is it possible to add hline to each line?

          – manooooh
          Apr 3 at 5:18





          Is it possible to add hline to each line?

          – manooooh
          Apr 3 at 5:18




          1




          1





          @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

          – marmot
          Apr 3 at 5:21





          @manooooh Yes, e.g. with after row ={[0.3ex] midrule},.

          – marmot
          Apr 3 at 5:21


















          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%2f482785%2fpgfplotstable-adding-vertical-space-between-fractions%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

          Biblatex bibliography style without URLs when DOI exists (in Overleaf with Zotero bibliography)

          ComboBox Display Member on multiple fields

          Is it possible to collect Nectar points via Trainline?