Grid overlay yields arithmetic error












2














The line draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);, which is of course taken from Drawing on an image with TikZ, nowadays generates an error. I must admit I have not kept up with LaTeX, specifically TikZ, that much. Why does this not work?



Picture of wrong output



enter image description here



Error message



! Arithmetic overflow.
pgf@pathgrid ...de c@pgf@counta byc@pgf@countb
relax pgfutil@tempdima =...
l.42 ... lines,xstep=.1,ystep=.1] (0,0) grid (1,1)
; %%% --- this is the firs...
I can't carry out that multiplication or division,
since the result is out of range.


MWE for extra-picture.pdf



documentclass[
]{standalone}

usepackage{
tikz,
}

usepackage{lmodern}
usepackage{microtype}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}

begin{document}
begin{tikzpicture}
filldraw[fill=black!50] (0,0) rectangle (4,2);
end{tikzpicture}
end{document}


MWE



documentclass[
fontsize=11pt,
DIV=12,
]{standalone}

usepackage{
tikz,
}

usetikzlibrary{
calc,
}

usepackage{lmodern}
usepackage{microtype}
usepackage[T1]{fontenc}
usepackage[utf8]{inputenc}

begin{document}
begin{tikzpicture}[
every node/.style={
node font=sffamily,
},
month/.style={
rectangle,
draw=black,
very thick,
fill=black!40,
},
normal/.style={
draw,
font=small,
rectangle,
},
]
node [month, anchor=west] (AAA) at (0,0) {kkkkk};
node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$) {includegraphics[width=2cm]{extra-picture.pdf}};
begin{scope}[x={(ENVimage.south east)},y={(ENVimage.north west)}]
draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
%draw[help lines,] (0,0) grid (1,1);
%foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
%foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
%node[fill=white] at (0.5,0.5) {111111};
end{scope}

end{tikzpicture}
end{document}









share|improve this question



























    2














    The line draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);, which is of course taken from Drawing on an image with TikZ, nowadays generates an error. I must admit I have not kept up with LaTeX, specifically TikZ, that much. Why does this not work?



    Picture of wrong output



    enter image description here



    Error message



    ! Arithmetic overflow.
    pgf@pathgrid ...de c@pgf@counta byc@pgf@countb
    relax pgfutil@tempdima =...
    l.42 ... lines,xstep=.1,ystep=.1] (0,0) grid (1,1)
    ; %%% --- this is the firs...
    I can't carry out that multiplication or division,
    since the result is out of range.


    MWE for extra-picture.pdf



    documentclass[
    ]{standalone}

    usepackage{
    tikz,
    }

    usepackage{lmodern}
    usepackage{microtype}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}

    begin{document}
    begin{tikzpicture}
    filldraw[fill=black!50] (0,0) rectangle (4,2);
    end{tikzpicture}
    end{document}


    MWE



    documentclass[
    fontsize=11pt,
    DIV=12,
    ]{standalone}

    usepackage{
    tikz,
    }

    usetikzlibrary{
    calc,
    }

    usepackage{lmodern}
    usepackage{microtype}
    usepackage[T1]{fontenc}
    usepackage[utf8]{inputenc}

    begin{document}
    begin{tikzpicture}[
    every node/.style={
    node font=sffamily,
    },
    month/.style={
    rectangle,
    draw=black,
    very thick,
    fill=black!40,
    },
    normal/.style={
    draw,
    font=small,
    rectangle,
    },
    ]
    node [month, anchor=west] (AAA) at (0,0) {kkkkk};
    node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

    node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$) {includegraphics[width=2cm]{extra-picture.pdf}};
    begin{scope}[x={(ENVimage.south east)},y={(ENVimage.north west)}]
    draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
    %draw[help lines,] (0,0) grid (1,1);
    %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
    %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
    %node[fill=white] at (0.5,0.5) {111111};
    end{scope}

    end{tikzpicture}
    end{document}









    share|improve this question

























      2












      2








      2







      The line draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);, which is of course taken from Drawing on an image with TikZ, nowadays generates an error. I must admit I have not kept up with LaTeX, specifically TikZ, that much. Why does this not work?



      Picture of wrong output



      enter image description here



      Error message



      ! Arithmetic overflow.
      pgf@pathgrid ...de c@pgf@counta byc@pgf@countb
      relax pgfutil@tempdima =...
      l.42 ... lines,xstep=.1,ystep=.1] (0,0) grid (1,1)
      ; %%% --- this is the firs...
      I can't carry out that multiplication or division,
      since the result is out of range.


      MWE for extra-picture.pdf



      documentclass[
      ]{standalone}

      usepackage{
      tikz,
      }

      usepackage{lmodern}
      usepackage{microtype}
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      begin{document}
      begin{tikzpicture}
      filldraw[fill=black!50] (0,0) rectangle (4,2);
      end{tikzpicture}
      end{document}


      MWE



      documentclass[
      fontsize=11pt,
      DIV=12,
      ]{standalone}

      usepackage{
      tikz,
      }

      usetikzlibrary{
      calc,
      }

      usepackage{lmodern}
      usepackage{microtype}
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      begin{document}
      begin{tikzpicture}[
      every node/.style={
      node font=sffamily,
      },
      month/.style={
      rectangle,
      draw=black,
      very thick,
      fill=black!40,
      },
      normal/.style={
      draw,
      font=small,
      rectangle,
      },
      ]
      node [month, anchor=west] (AAA) at (0,0) {kkkkk};
      node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

      node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$) {includegraphics[width=2cm]{extra-picture.pdf}};
      begin{scope}[x={(ENVimage.south east)},y={(ENVimage.north west)}]
      draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
      %draw[help lines,] (0,0) grid (1,1);
      %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
      %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
      %node[fill=white] at (0.5,0.5) {111111};
      end{scope}

      end{tikzpicture}
      end{document}









      share|improve this question













      The line draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1);, which is of course taken from Drawing on an image with TikZ, nowadays generates an error. I must admit I have not kept up with LaTeX, specifically TikZ, that much. Why does this not work?



      Picture of wrong output



      enter image description here



      Error message



      ! Arithmetic overflow.
      pgf@pathgrid ...de c@pgf@counta byc@pgf@countb
      relax pgfutil@tempdima =...
      l.42 ... lines,xstep=.1,ystep=.1] (0,0) grid (1,1)
      ; %%% --- this is the firs...
      I can't carry out that multiplication or division,
      since the result is out of range.


      MWE for extra-picture.pdf



      documentclass[
      ]{standalone}

      usepackage{
      tikz,
      }

      usepackage{lmodern}
      usepackage{microtype}
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      begin{document}
      begin{tikzpicture}
      filldraw[fill=black!50] (0,0) rectangle (4,2);
      end{tikzpicture}
      end{document}


      MWE



      documentclass[
      fontsize=11pt,
      DIV=12,
      ]{standalone}

      usepackage{
      tikz,
      }

      usetikzlibrary{
      calc,
      }

      usepackage{lmodern}
      usepackage{microtype}
      usepackage[T1]{fontenc}
      usepackage[utf8]{inputenc}

      begin{document}
      begin{tikzpicture}[
      every node/.style={
      node font=sffamily,
      },
      month/.style={
      rectangle,
      draw=black,
      very thick,
      fill=black!40,
      },
      normal/.style={
      draw,
      font=small,
      rectangle,
      },
      ]
      node [month, anchor=west] (AAA) at (0,0) {kkkkk};
      node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

      node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$) {includegraphics[width=2cm]{extra-picture.pdf}};
      begin{scope}[x={(ENVimage.south east)},y={(ENVimage.north west)}]
      draw[help lines,xstep=.1,ystep=.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
      %draw[help lines,] (0,0) grid (1,1);
      %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
      %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
      %node[fill=white] at (0.5,0.5) {111111};
      end{scope}

      end{tikzpicture}
      end{document}






      tikz-pgf






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 3 hours ago









      henry

      2,85232367




      2,85232367






















          1 Answer
          1






          active

          oldest

          votes


















          1














          I guess you want something like this.



          documentclass[
          fontsize=11pt,
          DIV=12,
          ]{standalone}

          usepackage{
          tikz,
          }

          usetikzlibrary{
          calc,
          }

          usepackage{lmodern}
          usepackage{microtype}
          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[
          every node/.style={
          node font=sffamily,
          },
          month/.style={
          rectangle,
          draw=black,
          very thick,
          fill=black!40,
          },
          normal/.style={
          draw,
          font=small,
          rectangle,
          },
          ]
          node [month, anchor=west] (AAA) at (0,0) {kkkkk};
          node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

          node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$)
          {includegraphics[width=2cm]{example-image-duck.pdf}};
          begin{scope}[shift={(ENVimage.south west)},x={(ENVimage.south east)},y={(ENVimage.north west)}]
          draw[help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
          %draw[help lines,] (0,0) grid (1,1);
          %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
          %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
          %node[fill=white] at (0.5,0.5) {111111};
          end{scope}

          end{tikzpicture}
          end{document}


          enter image description here



          I think you used the code that puts a grid on top of an image at the origin, but your image is not at the origin, so I added shift={(ENVimage.south west)} and there is no issue.






          share|improve this answer

















          • 1




            And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
            – henry
            3 hours ago











          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%2f468345%2fgrid-overlay-yields-arithmetic-error%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









          1














          I guess you want something like this.



          documentclass[
          fontsize=11pt,
          DIV=12,
          ]{standalone}

          usepackage{
          tikz,
          }

          usetikzlibrary{
          calc,
          }

          usepackage{lmodern}
          usepackage{microtype}
          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[
          every node/.style={
          node font=sffamily,
          },
          month/.style={
          rectangle,
          draw=black,
          very thick,
          fill=black!40,
          },
          normal/.style={
          draw,
          font=small,
          rectangle,
          },
          ]
          node [month, anchor=west] (AAA) at (0,0) {kkkkk};
          node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

          node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$)
          {includegraphics[width=2cm]{example-image-duck.pdf}};
          begin{scope}[shift={(ENVimage.south west)},x={(ENVimage.south east)},y={(ENVimage.north west)}]
          draw[help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
          %draw[help lines,] (0,0) grid (1,1);
          %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
          %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
          %node[fill=white] at (0.5,0.5) {111111};
          end{scope}

          end{tikzpicture}
          end{document}


          enter image description here



          I think you used the code that puts a grid on top of an image at the origin, but your image is not at the origin, so I added shift={(ENVimage.south west)} and there is no issue.






          share|improve this answer

















          • 1




            And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
            – henry
            3 hours ago
















          1














          I guess you want something like this.



          documentclass[
          fontsize=11pt,
          DIV=12,
          ]{standalone}

          usepackage{
          tikz,
          }

          usetikzlibrary{
          calc,
          }

          usepackage{lmodern}
          usepackage{microtype}
          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[
          every node/.style={
          node font=sffamily,
          },
          month/.style={
          rectangle,
          draw=black,
          very thick,
          fill=black!40,
          },
          normal/.style={
          draw,
          font=small,
          rectangle,
          },
          ]
          node [month, anchor=west] (AAA) at (0,0) {kkkkk};
          node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

          node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$)
          {includegraphics[width=2cm]{example-image-duck.pdf}};
          begin{scope}[shift={(ENVimage.south west)},x={(ENVimage.south east)},y={(ENVimage.north west)}]
          draw[help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
          %draw[help lines,] (0,0) grid (1,1);
          %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
          %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
          %node[fill=white] at (0.5,0.5) {111111};
          end{scope}

          end{tikzpicture}
          end{document}


          enter image description here



          I think you used the code that puts a grid on top of an image at the origin, but your image is not at the origin, so I added shift={(ENVimage.south west)} and there is no issue.






          share|improve this answer

















          • 1




            And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
            – henry
            3 hours ago














          1












          1








          1






          I guess you want something like this.



          documentclass[
          fontsize=11pt,
          DIV=12,
          ]{standalone}

          usepackage{
          tikz,
          }

          usetikzlibrary{
          calc,
          }

          usepackage{lmodern}
          usepackage{microtype}
          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[
          every node/.style={
          node font=sffamily,
          },
          month/.style={
          rectangle,
          draw=black,
          very thick,
          fill=black!40,
          },
          normal/.style={
          draw,
          font=small,
          rectangle,
          },
          ]
          node [month, anchor=west] (AAA) at (0,0) {kkkkk};
          node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

          node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$)
          {includegraphics[width=2cm]{example-image-duck.pdf}};
          begin{scope}[shift={(ENVimage.south west)},x={(ENVimage.south east)},y={(ENVimage.north west)}]
          draw[help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
          %draw[help lines,] (0,0) grid (1,1);
          %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
          %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
          %node[fill=white] at (0.5,0.5) {111111};
          end{scope}

          end{tikzpicture}
          end{document}


          enter image description here



          I think you used the code that puts a grid on top of an image at the origin, but your image is not at the origin, so I added shift={(ENVimage.south west)} and there is no issue.






          share|improve this answer












          I guess you want something like this.



          documentclass[
          fontsize=11pt,
          DIV=12,
          ]{standalone}

          usepackage{
          tikz,
          }

          usetikzlibrary{
          calc,
          }

          usepackage{lmodern}
          usepackage{microtype}
          usepackage[T1]{fontenc}
          usepackage[utf8]{inputenc}

          begin{document}
          begin{tikzpicture}[
          every node/.style={
          node font=sffamily,
          },
          month/.style={
          rectangle,
          draw=black,
          very thick,
          fill=black!40,
          },
          normal/.style={
          draw,
          font=small,
          rectangle,
          },
          ]
          node [month, anchor=west] (AAA) at (0,0) {kkkkk};
          node [normal, anchor=west] (AAAstuff) at ($(AAA.east)+(1cm,0)$) {Text};

          node[anchor=west, inner sep=0] (ENVimage) at ($(AAAstuff.east)+(2cm,0)$)
          {includegraphics[width=2cm]{example-image-duck.pdf}};
          begin{scope}[shift={(ENVimage.south west)},x={(ENVimage.south east)},y={(ENVimage.north west)}]
          draw[help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); %%% --- this is the first line that yields the non-working MWE
          %draw[help lines,] (0,0) grid (1,1);
          %foreach x in {0,1,...,9} { node [anchor=north] at (x/10,0) {0.x}; }
          %foreach y in {0,1,...,9} { node [anchor=east] at (0,y/10) {0.y}; }
          %node[fill=white] at (0.5,0.5) {111111};
          end{scope}

          end{tikzpicture}
          end{document}


          enter image description here



          I think you used the code that puts a grid on top of an image at the origin, but your image is not at the origin, so I added shift={(ENVimage.south west)} and there is no issue.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered 3 hours ago









          marmot

          88k4101189




          88k4101189








          • 1




            And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
            – henry
            3 hours ago














          • 1




            And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
            – henry
            3 hours ago








          1




          1




          And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
          – henry
          3 hours ago




          And the genius I am, I made the background gray as well, so one could-should use draw[red,help lines,xstep=0.1,ystep=0.1] (0,0) grid (1,1); to make the grid lines distinguishable. :) Thanks!
          – henry
          3 hours ago


















          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%2f468345%2fgrid-overlay-yields-arithmetic-error%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

          Contact image not getting when fetch all contact list from iPhone by CNContact

          count number of partitions of a set with n elements into k subsets

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