bazel-latex icon indicating copy to clipboard operation
bazel-latex copied to clipboard

Add support for generating svgs from tex files

Open solsjo opened this issue 3 years ago • 4 comments

This can be a nice feature when a .tex file contains a tikz figure.

This is enabled by exposing the dvisvgm binary in the defined latex texlive toolchan.

dvisvgm is dependent on ghostscript as a dynamic lib, which is why it has been added.

solsjo avatar Aug 31 '22 00:08 solsjo

Result from github actions here: https://github.com/solsjo/bazel-latex/actions/runs/2976895982

solsjo avatar Sep 02 '22 05:09 solsjo

One should be able to do something of the following to support testing on mac and windows as well: https://github.com/features/actions

    strategy:
      matrix:
        platform: [ubuntu-latest, macos-latest, windows-latest]
    runs-on: ${{ matrix.platform }}

That way we aren't in the dark about where things work or not.

solsjo avatar Sep 02 '22 05:09 solsjo

@patbro Do you have any objections about switching from Cirrus to GitHub Actions for CI? I'm happy to implement it if that's fine with you.

Kernald avatar Sep 28 '22 20:09 Kernald

@patbro Do you have any objections about switching from Cirrus to GitHub Actions for CI? I'm happy to implement it if that's fine with you.

No, definitely not. Go ahead! You're in the lead to decide whatever works best for the repo.

patbro avatar Sep 29 '22 20:09 patbro

@patbro @Kernald , I have, as far as I’ve been able to, tried to handle and add support for OS X in svg generation. But there is still something failing. (Maybe if we build ghost script from source in the same pipeline?)

Can we move on with only Linux support to start with?

solsjo avatar Feb 25 '23 21:02 solsjo

@patbro @Kernald , I have, as far as I’ve been able to, tried to handle and add support for OS X in svg generation. But there is still something failing. (Maybe if we build ghost script from source in the same pipeline?)

Can we move on with only Linux support to start with?

I guess that would be acceptable for now, given two things:

  • This doesn't break anything else on macOS
  • This is clearly outlined in the README.

I can take a look at it in a few days to try and figure out what's going on.

Kernald avatar Feb 26 '23 04:02 Kernald

@Kernald Thanks!

I'll update the readme.

Regarding os x, I suspect that it is related to runtime hardening. But I'm not certain. In that case (and I've only read at about it this far), solutions might involve passing the absolute path to --libgs, as dlopen might require that. It might be easy to fix by using run_shell instead of run.

E.g. ... actions.run_shell( cmd = ["--libgs=$(abs {})".format(libgs_path)], ) ...

I guess the best thing would have been to have a dvisvgm artifact statically linked to Ghostscript. (I did try that a few times) But not using the full texlive source. Only using the dvisvgm source. Should be something along the lines:

configure --disable-all-pkgs --enable-dvipdfm-x \
 -C CFLAGS=-g CXXFLAGS=-g

Though, that might require having a set of other dependencies available for dvisvgm.

solsjo avatar Feb 27 '23 05:02 solsjo

@Kernald The pipeline fails to download artifacts, seems like a temporary problem.

But I updated the dvisvgm rule to take the full path. If you could try that out locally, or re-trigger the pipeline at some point, that would be appreciated. I seem to lack permission to re-trigger.

solsjo avatar Feb 27 '23 22:02 solsjo

@Kernald Perhaps a bit random, but mainly from a convenience perspective: I'm happy to add @solsjo as an external collaborator, might that help to make life a little easier? Let me know!

patbro avatar Feb 28 '23 08:02 patbro

@Kernald Perhaps a bit random, but mainly from a convenience perspective: I'm happy to add @solsjo as an external collaborator, might that help to make life a little easier? Let me know!

I'd be really happy with that! Life is sadly getting in the way at the moment...

Kernald avatar Feb 28 '23 08:02 Kernald

Support for OS X sort of in place 😊 Updated the README.

solsjo avatar Feb 28 '23 19:02 solsjo

@Kernald @patbro :)

solsjo avatar Feb 28 '23 19:02 solsjo

@patbro I accept 😊 I noticed that I now have merge capabilities. But I'd rather not merge my own commits in someone else's repo. I can wait patiently until you or @Kernald, consider it reviewed.

solsjo avatar Mar 03 '23 18:03 solsjo