Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Broken TikZ SVGs on macOS #44

Open
davidstraka2 opened this issue Jul 12, 2021 · 1 comment
Open

Broken TikZ SVGs on macOS #44

davidstraka2 opened this issue Jul 12, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@davidstraka2
Copy link
Owner

The SVG images in the preview of the !tikz outer environments are broken on macOS. Only the text is shown, all of it aligned to the top of the image, no other shapes are displayed. See an image example below.

tikz-svg-error

Compare that to the correctly displayed SVG on Windows 10 and Arch Linux, shown below.

tikz-svg-correct

The WooWoo source of the .Figure object from the examples shown is included below. Note that the preview examples use dark editor theme and inverted SVG colors.

.Figure:
  label: fig-vektory

  !tikz:
    filename: fig-vektory-1

    \draw[blue,thick,->] (0,0) -- (3,3) node[anchor=south east] {$\alpha \cdot \vec a,\, \alpha > 1$};
    \draw[very thick,black,->] (0,0) -- (2,2) node[anchor=north west] {$\vec a$};
    \draw[red,very thick,->] (0,0) -- (1,1) node[anchor=south east] {$\alpha \cdot \vec a,\, 0 < \alpha < 1$};
    \draw[brown,thick,->] (0,0) -- (-1,-1) node[anchor=north west] {$\alpha \cdot \vec a,\, \alpha < 0$};
    \fill[black] (0,0) circle (2pt) node[anchor=south east] {$O$};
    \node at (1,-2) {(a)};

  !tikz:
    filename: fog-vektory-2
    options: 'scale=1.5'

    \draw[black,thick,->] (0,0) -- (.5,2) node[above] {$\vec a$};
    \draw[blue,thick,->] (0,0) -- (1.5,-.5) node[below] {$\vec b$};
    \draw[blue,dashed] (.5,2) -- (2,1.5);
    \draw[black,dashed] (1.5,-.5) -- (2,1.5);
    \draw[red,very thick,->] (0,0) -- (2,1.5) node[anchor=south west] {$\vec a + \vec b$};
    \node at (1,-1.5) {(b)};
    \fill[black] (0,0) circle (1pt) node[left] {$O$};

  .caption:

    Geometrický význam násobení vektoru číslem (a) a sčítání vektorů (b).

The TeX file used for generating the SVG, the DVI file generated from it on macOS using latex (from an up to date MacTeX distribution), the log file from the process, as well as both the broken SVG generated on macOS and correct SVG generated on Windows 10 - both using dvisvgm included in the TeX distribution (that being full texlive on Windows) - can all be found attached in this zip archive attachment.

@davidstraka2 davidstraka2 added the bug Something isn't working label Jul 12, 2021
@davidstraka2
Copy link
Owner Author

The problem has been isolated to be with dvisvgm on macOS. A minimal reproducible example has been created and checked utilizing GitHub Actions. An issue has been submitted to the dvisvgm issue tracker.

TeX source of a minimal reproducible example:

\documentclass[tikz]{standalone}
\begin{document}
  \begin{tikzpicture}[]
    \draw (0,0) -- (1,1) node[pos=0.5]{x};
  \end{tikzpicture}
\end{document}

A GitHub Actions workflow to generate outputs on macOS and upload job artifacts:

name: CI
on: [push, pull_request]
jobs:
  Test:
    name: Test macOS
    runs-on: macos-10.15
    steps:
      - uses: actions/checkout@v2
      - name: Install MacTex
        run: |
          export HOMEBREW_NO_INSTALL_CLEANUP=1
          brew install --cask mactex
          echo "/Library/TeX/texbin" >> $GITHUB_PATH
      - name: Process image
        run: |
          latex image.tex
          dvisvgm --no-fonts image.dvi
      - name: Archive artifacts
        uses: actions/upload-artifact@v2
        with:
          name: output
          path: |
            image.dvi
            image.log
            image.svg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant