Menu

#643 (curiousity) to show figures as svg rather than png

workingwiki
open
nobody
None
2
2015-01-09
2015-01-04
Anonymous
No

Hi Lee,

I am wondering, if I start to show my figures as svg files, how slower or inconvenient would it be? I remember I read a part of your discussion about math formulas to be shown as svg and you concluded that it would be very slow. What's about figures?

Thank you in advance,
Andrei

Discussion

  • Lee Worden

    Lee Worden - 2015-01-04

    Thanks Andrei -
    I tried converting whole LaTeX articles to multiple full pages in SVG
    format, and it was a lot slower to display in the browser than big
    PNGs. It might be okay for smaller things such as figures. Also it
    seems like there are a lot of advantages to displaying figures as SVG,
    such as ability to scale them with high resolution. Would it be hard to
    try it and see what happens? Keep in mind performance might be very
    different on Firefox vs. Chrome/Safari.
    LW

     
  • Andrei Akhmetzhanov

    Hi Lee, thanks for your response.

    Just wondering and looking forward: any improvements can be expected with SVG2?

    I think in case of having just one or few figures on one WW-page, it makes sense to show it as svg-files. However, if we have ten of them - it might lead to slowing down the process. For example, a very simple one: http://yushan.mcmaster.ca/theobio/akhmetzhanov/index.php/SEER_cancer_incidence works fine.

    I think to make a page with all figures for one of my papers with all svgs. (Only if you would be kind to explain me how to avoid all those red errors from LATEXML http://lalashan.mcmaster.ca/theobio/akhmetzhanov/index.php/AkhmHoch15 - I remember that you had promised me that once :))

     
    • Lee Worden

      Lee Worden - 2015-01-05

      On 01/05/2015 03:36 PM, Andrei Akhmetzhanov wrote:

      Hi Lee, thanks for your response.

      Thanks for your feedback and interest, as always!

      Just wondering and looking forward: any improvements can be expected
      with SVG2?

      I don't know! Is it supposed to be faster in browsers?

      I think in case of having just one or few figures on one WW-page, it
      makes sense to show it as svg-files. However, if we have ten of them -
      it might lead to slowing down the process. For example, a very simple
      one:
      http://yushan.mcmaster.ca/theobio/akhmetzhanov/index.php/SEER_cancer_incidence
      works fine.

      If you find that doing all the figures on one page in SVG is too slow,
      maybe you can put PNG figures on the page and make each of them a link
      to the SVG figure?

       

      Last edit: Lee Worden 2015-01-06
    • Lee Worden

      Lee Worden - 2015-01-06

      On 01/05/2015 03:36 PM, Andrei Akhmetzhanov wrote:

      I think to make a page with all figures for one of my papers with all
      svgs. (Only if you would be kind to explain me how to avoid all those
      red errors from LATEXML
      http://lalashan.mcmaster.ca/theobio/akhmetzhanov/index.php/AkhmHoch15
      - I remember that you had promised me that once :))

      I made a small edit:
      http://lalashan.mcmaster.ca/theobio/akhmetzhanov/index.php?title=AkhmHoch15&diff=3400&oldid=3389
      - it looks better now :)

      I don't have any general advice for removing LaTeXML errors. They
      generally come from commands that LaTeXML doesn't have defined. LaTeXML
      needs to use its own versions of all the LaTeX style files, and these
      missing commands usually happen when you use a .sty that doesn't have a
      LaTeXML version. In your case, I guessed that revtex4-1 was missing. I
      looked in the LaTeXML source directory, in blib/lib/LaTeXML/Package
      where the .sty.ltxml files are, and found that there is a revtex4 but no
      revtex4-1. So I added a command to use the revtex4 package when using
      latexml, and now \email, \author, etc, work without producing error
      messages. It would probably work okay to include any package that
      defines those commands - many different styles do.

      LW

       

      Last edit: Lee Worden 2015-01-06
      • Lee Worden

        Lee Worden - 2015-01-06

        If you want the latexml to be better formatted (it's pretty untidy), you could probably use \providecommand to provide a better implementation of \author, \affiliation, etc, that includes line breaks, appropriate use of \footnote, or whatever. You would do that instead of \usepackage{revtex4}. Or you could try some other latexml packages instead of revtex4 to see if they do a better job.

         
  • Andrei Akhmetzhanov

     
    • Lee Worden

      Lee Worden - 2015-01-08

      1. it's true. And I see there are some problems with CSS formatting as well. For one thing, the CSS is supposed to suppress the numbers in section headings in the latex output.

      2. That's a wiki page, not a part of WW software. https://en.wikipedia.org/wiki/Wikipedia:Be_bold :)

       
  • Andrei Akhmetzhanov

     
    • Lee Worden

      Lee Worden - 2015-01-10

      Thanks - I don't think we should try to use something like grunt in WW
      because we allow people direct control over the files they display. It
      would be great to try adding some of these image compression tools to
      the makefile flow - why don't you try adding some of these as rules in
      your makefiles and let us know if you develop rules that we could move
      to the global makefiles?

       
      • Andrei Akhmetzhanov

        Hi Lee,

        I have a question: how can I use or install grunt? (more precisely, grunt-svgmin)

         
        • Lee Worden

          Lee Worden - 2015-01-25

          Hi Andrei -

          Please clarify! Do you want to use grunt on lalashan? Or with your own
          wiki? Or outside of WW?

          I don't know how to install grunt. If you want to install it on
          lalashan, talk to Jonathan.

          Again, I do not recommend using grunt to compress SVG files within WW
          projects, because it conflicts with the design of WW. Instead I
          recommend writing a make rule that runs SVGO in the same way that grunt
          would run it.

          If I don't understand, please tell me more.

          Thanks!
          LW

           
          • Andrei Akhmetzhanov

            Hi Lee,

            on lalashan.

            I am interested in this, because, for example, http://lalashan.mcmaster.ca/theobio/akhmetzhanov/index.php/AkhmHoch15/Figures/figure_2 gives a svg-file of >1Mb. SVGmin promises to make it 70% less, so it will be approximately like a png-file.

             
            • Lee Worden

              Lee Worden - 2015-01-25

              Yes, you want to minimize it. But I'm pretty sure you don't want to use
              grunt. Just use svgmin, or SVGO or whatever minimizing tool.

               
              • Andrei Akhmetzhanov

                Yes, the only reason why I mentioned grunt, because you did that. Honestly, I don't know what the grunt is (sorry for that).

                SVGO - do I not need to install it?

                 
              • Andrei Akhmetzhanov

                thank you for helping :)

                 
                • Lee Worden

                  Lee Worden - 2015-01-25

                  No, you mentioned grunt and I said don't use it! :)

                  Anyway, I think you should email Jonathan to work out what you need
                  installed on lalashan.

                  Thanks!

                   
                  • Andrei Akhmetzhanov

                    I will.

                    Thanks as well!

                     

Anonymous
Anonymous

Add attachments
Cancel