A new problem with tex4ht and tikz












3















When run through pdflatex the code snippet below produces:



enter image description here



but when I run it through make4ht the following web page, without the numbers, is generated:



enter image description here



(The difference in scale is an artifact of my skills in taking screenshots.) Here is the code:



documentclass{article}
usepackage{tikz}
begin{document}

begin{tikzpicture}
foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
draw[thick,<->](-3.5,0)--(3.5,0);
filldraw[blue!50!white](1.5,0) circle (1mm);
draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
end{tikzpicture}

end{document}


Only the first line of the tikzpicture environment is necessary. The rest is just to show that everything else is OK.



I am using TeXLive 2018 and I have just updated all packages.










share|improve this question



























    3















    When run through pdflatex the code snippet below produces:



    enter image description here



    but when I run it through make4ht the following web page, without the numbers, is generated:



    enter image description here



    (The difference in scale is an artifact of my skills in taking screenshots.) Here is the code:



    documentclass{article}
    usepackage{tikz}
    begin{document}

    begin{tikzpicture}
    foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
    foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
    draw[thick,<->](-3.5,0)--(3.5,0);
    filldraw[blue!50!white](1.5,0) circle (1mm);
    draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
    end{tikzpicture}

    end{document}


    Only the first line of the tikzpicture environment is necessary. The rest is just to show that everything else is OK.



    I am using TeXLive 2018 and I have just updated all packages.










    share|improve this question

























      3












      3








      3








      When run through pdflatex the code snippet below produces:



      enter image description here



      but when I run it through make4ht the following web page, without the numbers, is generated:



      enter image description here



      (The difference in scale is an artifact of my skills in taking screenshots.) Here is the code:



      documentclass{article}
      usepackage{tikz}
      begin{document}

      begin{tikzpicture}
      foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
      foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
      draw[thick,<->](-3.5,0)--(3.5,0);
      filldraw[blue!50!white](1.5,0) circle (1mm);
      draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
      end{tikzpicture}

      end{document}


      Only the first line of the tikzpicture environment is necessary. The rest is just to show that everything else is OK.



      I am using TeXLive 2018 and I have just updated all packages.










      share|improve this question














      When run through pdflatex the code snippet below produces:



      enter image description here



      but when I run it through make4ht the following web page, without the numbers, is generated:



      enter image description here



      (The difference in scale is an artifact of my skills in taking screenshots.) Here is the code:



      documentclass{article}
      usepackage{tikz}
      begin{document}

      begin{tikzpicture}
      foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
      foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
      draw[thick,<->](-3.5,0)--(3.5,0);
      filldraw[blue!50!white](1.5,0) circle (1mm);
      draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
      end{tikzpicture}

      end{document}


      Only the first line of the tikzpicture environment is necessary. The rest is just to show that everything else is OK.



      I am using TeXLive 2018 and I have just updated all packages.







      tikz-pgf tex4ht make4ht






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked 1 hour ago









      AndrewAndrew

      30.5k34381




      30.5k34381






















          1 Answer
          1






          active

          oldest

          votes


















          4














          Try the following configuration file:



          Preamble{xhtml}
          tikzset{every node/.style={/pgf/tex4ht node/escape=true}}
          begin{document}
          EndPreamble


          From the TikZ manual:




          Selects the rendering method for a text node with the tex4ht driver.
          When this key is set to false, text is translated P R into svg text,
          which is somewhat limited: simple characters (letters, numerals,
          punctuation, , , . . . ), subscripts and superscripts (but not sub-
          subscripts) will display but everything else will be filtered out,
          ignored or will produce invalid html code (in the worst case). This
          means that two kind of texts render reasonably well:




          1. First, plain text without math mode, special characters or anything else special.



          2. Second, very simple mathematical text that contains subscripts or superscripts. Even then, variables are not correctly set in italics
            and, in general, text simple does not look very nice. If you use text
            that contains anything special, even something as simple as $alpha$,
            this may corrupt the graphic.



            tikz node[draw,/pgf/tex4ht node/escape=false]




          {Example :



          $(a+b)^2=a^2+2ab+b^2$}; 


          When you write node[/pgf/tex4ht
          node/escape=true] {htexti}, pgf escapes back to html to render the
          htexti. This method produces valid html code in most cases and the
          support for complicated text nodes is much better since code that
          renders well outside a {pgfpicture}, should also render well inside a
          text node. Another advantage is that inside text nodes with fixed
          width, html will produce line breaks for long lines. On the other
          hand, you need a browser with good svg support to display the picture.



          Also, the text will display differently, depending on your browsers,
          the fonts you have on your system and your settings. Finally, pgf has
          to guess the size of the text rendered by the browser to scale it and
          prevent it from sticking from the node. When it fails, the text will
          be either cropped or too small.




          The result on your file:



          enter image description here



          Another possibility is to use an alternative driver for tex4ht, which use Dvisvgm for the SVG generation. It has much better support for fonts and other advanced SVG features.



          The TeX file needs to be updated to use the driver:



          documentclass{article}
          ifdefinedHCode
          defpgfsysdriver{pgfsys-dvisvgm4ht.def}
          fi
          usepackage{tikz}
          begin{document}

          begin{tikzpicture}
          foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
          foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
          draw[thick,<->](-3.5,0)--(3.5,0);
          filldraw[blue!50!white](1.5,0) circle (1mm);
          draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
          end{tikzpicture}

          end{document}


          The result:



          enter image description here






          share|improve this answer


























          • Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

            – Andrew
            1 hour ago













          • @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

            – michal.h21
            58 mins ago











          • Thanks. I'll give it a try.

            – Andrew
            39 mins ago













          • @Andrew it seems to work nicely, see the update

            – michal.h21
            33 mins 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%2f471458%2fa-new-problem-with-tex4ht-and-tikz%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









          4














          Try the following configuration file:



          Preamble{xhtml}
          tikzset{every node/.style={/pgf/tex4ht node/escape=true}}
          begin{document}
          EndPreamble


          From the TikZ manual:




          Selects the rendering method for a text node with the tex4ht driver.
          When this key is set to false, text is translated P R into svg text,
          which is somewhat limited: simple characters (letters, numerals,
          punctuation, , , . . . ), subscripts and superscripts (but not sub-
          subscripts) will display but everything else will be filtered out,
          ignored or will produce invalid html code (in the worst case). This
          means that two kind of texts render reasonably well:




          1. First, plain text without math mode, special characters or anything else special.



          2. Second, very simple mathematical text that contains subscripts or superscripts. Even then, variables are not correctly set in italics
            and, in general, text simple does not look very nice. If you use text
            that contains anything special, even something as simple as $alpha$,
            this may corrupt the graphic.



            tikz node[draw,/pgf/tex4ht node/escape=false]




          {Example :



          $(a+b)^2=a^2+2ab+b^2$}; 


          When you write node[/pgf/tex4ht
          node/escape=true] {htexti}, pgf escapes back to html to render the
          htexti. This method produces valid html code in most cases and the
          support for complicated text nodes is much better since code that
          renders well outside a {pgfpicture}, should also render well inside a
          text node. Another advantage is that inside text nodes with fixed
          width, html will produce line breaks for long lines. On the other
          hand, you need a browser with good svg support to display the picture.



          Also, the text will display differently, depending on your browsers,
          the fonts you have on your system and your settings. Finally, pgf has
          to guess the size of the text rendered by the browser to scale it and
          prevent it from sticking from the node. When it fails, the text will
          be either cropped or too small.




          The result on your file:



          enter image description here



          Another possibility is to use an alternative driver for tex4ht, which use Dvisvgm for the SVG generation. It has much better support for fonts and other advanced SVG features.



          The TeX file needs to be updated to use the driver:



          documentclass{article}
          ifdefinedHCode
          defpgfsysdriver{pgfsys-dvisvgm4ht.def}
          fi
          usepackage{tikz}
          begin{document}

          begin{tikzpicture}
          foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
          foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
          draw[thick,<->](-3.5,0)--(3.5,0);
          filldraw[blue!50!white](1.5,0) circle (1mm);
          draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
          end{tikzpicture}

          end{document}


          The result:



          enter image description here






          share|improve this answer


























          • Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

            – Andrew
            1 hour ago













          • @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

            – michal.h21
            58 mins ago











          • Thanks. I'll give it a try.

            – Andrew
            39 mins ago













          • @Andrew it seems to work nicely, see the update

            – michal.h21
            33 mins ago
















          4














          Try the following configuration file:



          Preamble{xhtml}
          tikzset{every node/.style={/pgf/tex4ht node/escape=true}}
          begin{document}
          EndPreamble


          From the TikZ manual:




          Selects the rendering method for a text node with the tex4ht driver.
          When this key is set to false, text is translated P R into svg text,
          which is somewhat limited: simple characters (letters, numerals,
          punctuation, , , . . . ), subscripts and superscripts (but not sub-
          subscripts) will display but everything else will be filtered out,
          ignored or will produce invalid html code (in the worst case). This
          means that two kind of texts render reasonably well:




          1. First, plain text without math mode, special characters or anything else special.



          2. Second, very simple mathematical text that contains subscripts or superscripts. Even then, variables are not correctly set in italics
            and, in general, text simple does not look very nice. If you use text
            that contains anything special, even something as simple as $alpha$,
            this may corrupt the graphic.



            tikz node[draw,/pgf/tex4ht node/escape=false]




          {Example :



          $(a+b)^2=a^2+2ab+b^2$}; 


          When you write node[/pgf/tex4ht
          node/escape=true] {htexti}, pgf escapes back to html to render the
          htexti. This method produces valid html code in most cases and the
          support for complicated text nodes is much better since code that
          renders well outside a {pgfpicture}, should also render well inside a
          text node. Another advantage is that inside text nodes with fixed
          width, html will produce line breaks for long lines. On the other
          hand, you need a browser with good svg support to display the picture.



          Also, the text will display differently, depending on your browsers,
          the fonts you have on your system and your settings. Finally, pgf has
          to guess the size of the text rendered by the browser to scale it and
          prevent it from sticking from the node. When it fails, the text will
          be either cropped or too small.




          The result on your file:



          enter image description here



          Another possibility is to use an alternative driver for tex4ht, which use Dvisvgm for the SVG generation. It has much better support for fonts and other advanced SVG features.



          The TeX file needs to be updated to use the driver:



          documentclass{article}
          ifdefinedHCode
          defpgfsysdriver{pgfsys-dvisvgm4ht.def}
          fi
          usepackage{tikz}
          begin{document}

          begin{tikzpicture}
          foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
          foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
          draw[thick,<->](-3.5,0)--(3.5,0);
          filldraw[blue!50!white](1.5,0) circle (1mm);
          draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
          end{tikzpicture}

          end{document}


          The result:



          enter image description here






          share|improve this answer


























          • Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

            – Andrew
            1 hour ago













          • @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

            – michal.h21
            58 mins ago











          • Thanks. I'll give it a try.

            – Andrew
            39 mins ago













          • @Andrew it seems to work nicely, see the update

            – michal.h21
            33 mins ago














          4












          4








          4







          Try the following configuration file:



          Preamble{xhtml}
          tikzset{every node/.style={/pgf/tex4ht node/escape=true}}
          begin{document}
          EndPreamble


          From the TikZ manual:




          Selects the rendering method for a text node with the tex4ht driver.
          When this key is set to false, text is translated P R into svg text,
          which is somewhat limited: simple characters (letters, numerals,
          punctuation, , , . . . ), subscripts and superscripts (but not sub-
          subscripts) will display but everything else will be filtered out,
          ignored or will produce invalid html code (in the worst case). This
          means that two kind of texts render reasonably well:




          1. First, plain text without math mode, special characters or anything else special.



          2. Second, very simple mathematical text that contains subscripts or superscripts. Even then, variables are not correctly set in italics
            and, in general, text simple does not look very nice. If you use text
            that contains anything special, even something as simple as $alpha$,
            this may corrupt the graphic.



            tikz node[draw,/pgf/tex4ht node/escape=false]




          {Example :



          $(a+b)^2=a^2+2ab+b^2$}; 


          When you write node[/pgf/tex4ht
          node/escape=true] {htexti}, pgf escapes back to html to render the
          htexti. This method produces valid html code in most cases and the
          support for complicated text nodes is much better since code that
          renders well outside a {pgfpicture}, should also render well inside a
          text node. Another advantage is that inside text nodes with fixed
          width, html will produce line breaks for long lines. On the other
          hand, you need a browser with good svg support to display the picture.



          Also, the text will display differently, depending on your browsers,
          the fonts you have on your system and your settings. Finally, pgf has
          to guess the size of the text rendered by the browser to scale it and
          prevent it from sticking from the node. When it fails, the text will
          be either cropped or too small.




          The result on your file:



          enter image description here



          Another possibility is to use an alternative driver for tex4ht, which use Dvisvgm for the SVG generation. It has much better support for fonts and other advanced SVG features.



          The TeX file needs to be updated to use the driver:



          documentclass{article}
          ifdefinedHCode
          defpgfsysdriver{pgfsys-dvisvgm4ht.def}
          fi
          usepackage{tikz}
          begin{document}

          begin{tikzpicture}
          foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
          foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
          draw[thick,<->](-3.5,0)--(3.5,0);
          filldraw[blue!50!white](1.5,0) circle (1mm);
          draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
          end{tikzpicture}

          end{document}


          The result:



          enter image description here






          share|improve this answer















          Try the following configuration file:



          Preamble{xhtml}
          tikzset{every node/.style={/pgf/tex4ht node/escape=true}}
          begin{document}
          EndPreamble


          From the TikZ manual:




          Selects the rendering method for a text node with the tex4ht driver.
          When this key is set to false, text is translated P R into svg text,
          which is somewhat limited: simple characters (letters, numerals,
          punctuation, , , . . . ), subscripts and superscripts (but not sub-
          subscripts) will display but everything else will be filtered out,
          ignored or will produce invalid html code (in the worst case). This
          means that two kind of texts render reasonably well:




          1. First, plain text without math mode, special characters or anything else special.



          2. Second, very simple mathematical text that contains subscripts or superscripts. Even then, variables are not correctly set in italics
            and, in general, text simple does not look very nice. If you use text
            that contains anything special, even something as simple as $alpha$,
            this may corrupt the graphic.



            tikz node[draw,/pgf/tex4ht node/escape=false]




          {Example :



          $(a+b)^2=a^2+2ab+b^2$}; 


          When you write node[/pgf/tex4ht
          node/escape=true] {htexti}, pgf escapes back to html to render the
          htexti. This method produces valid html code in most cases and the
          support for complicated text nodes is much better since code that
          renders well outside a {pgfpicture}, should also render well inside a
          text node. Another advantage is that inside text nodes with fixed
          width, html will produce line breaks for long lines. On the other
          hand, you need a browser with good svg support to display the picture.



          Also, the text will display differently, depending on your browsers,
          the fonts you have on your system and your settings. Finally, pgf has
          to guess the size of the text rendered by the browser to scale it and
          prevent it from sticking from the node. When it fails, the text will
          be either cropped or too small.




          The result on your file:



          enter image description here



          Another possibility is to use an alternative driver for tex4ht, which use Dvisvgm for the SVG generation. It has much better support for fonts and other advanced SVG features.



          The TeX file needs to be updated to use the driver:



          documentclass{article}
          ifdefinedHCode
          defpgfsysdriver{pgfsys-dvisvgm4ht.def}
          fi
          usepackage{tikz}
          begin{document}

          begin{tikzpicture}
          foreach x in {-3,...,3} { draw(x,0.25) --(x,0)node[below]{x}; }
          foreach x in {-2.5,...,2.5} { draw(x,0.18) --(x,0); }
          draw[thick,<->](-3.5,0)--(3.5,0);
          filldraw[blue!50!white](1.5,0) circle (1mm);
          draw[red] (-3.5,-1) rectangle (3.5,1); % make bounding box higher
          end{tikzpicture}

          end{document}


          The result:



          enter image description here







          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited 33 mins ago

























          answered 1 hour ago









          michal.h21michal.h21

          30.8k447104




          30.8k447104













          • Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

            – Andrew
            1 hour ago













          • @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

            – michal.h21
            58 mins ago











          • Thanks. I'll give it a try.

            – Andrew
            39 mins ago













          • @Andrew it seems to work nicely, see the update

            – michal.h21
            33 mins ago



















          • Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

            – Andrew
            1 hour ago













          • @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

            – michal.h21
            58 mins ago











          • Thanks. I'll give it a try.

            – Andrew
            39 mins ago













          • @Andrew it seems to work nicely, see the update

            – michal.h21
            33 mins ago

















          Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

          – Andrew
          1 hour ago







          Thanks Michal. I had this line in before but took it out as it seemed to cause problems. My MWE now compiles properly with make4ht but it still fails with webquiz with only the top third of the numbers appearing. So evidently I am introducing a bug:( This sounds like the last sentence from your manual entry above... Thanks for telling me where to look.

          – Andrew
          1 hour ago















          @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

          – michal.h21
          58 mins ago





          @andrew you can also try the dvsvgm driver: github.com/michal-h21/dvisvgm4ht - but I haven't tested it with updated TikZ yet.

          – michal.h21
          58 mins ago













          Thanks. I'll give it a try.

          – Andrew
          39 mins ago







          Thanks. I'll give it a try.

          – Andrew
          39 mins ago















          @Andrew it seems to work nicely, see the update

          – michal.h21
          33 mins ago





          @Andrew it seems to work nicely, see the update

          – michal.h21
          33 mins 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.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2ftex.stackexchange.com%2fquestions%2f471458%2fa-new-problem-with-tex4ht-and-tikz%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

          Terni

          Sun Ra