1

I have a weird issue with Tikz in particular because my document compiles as it is supposed to on Linux but not on macOS. The Tikz image I am trying to make is this:

enter image description here

Which is what is created on Linux, however on macOS the nodes have a white background, and I simply cannot figure out why.

The code below (minimal working example), is all the code involved when generating the image.
On Linux I use the newest latex in the fedora package repository and on macOS I use the newest MacTex. Any ideas why this is happening?

\documentclass[svgnames]{standalone}

\usepackage{xcolor}

\usepackage{tikz} \usepackage{lmodern}

\usetikzlibrary{shadows} \usetikzlibrary{arrows} \usetikzlibrary{shapes} \usetikzlibrary{positioning} \usetikzlibrary{fit} \usetikzlibrary{shadings}

\tikzset{ double color fill/.code 2 args={ \pgfdeclareverticalshading[% tikz@axis@top,tikz@axis@middle,tikz@axis@bottom% ]{diagonalfill}{100bp}{% color(0bp)=(tikz@axis@bottom); color(50bp)=(tikz@axis@bottom); color(50bp)=(tikz@axis@middle); color(50bp)=(tikz@axis@top); color(100bp)=(tikz@axis@top) } \tikzset{shade, left color=#1, right color=#2, shading=diagonalfill} } }

\tikzstyle{node-base}=[circle, draw, align=center, font=\footnotesize, minimum size=1.3cm] \tikzstyle{dc-node}=[node-base, double color fill={AntiqueWhite}{LightBlue}, shading angle=45] \tikzstyle{label}=[align=center]

\begin{document} \begin{tikzpicture} \node[dc-node] (n1) at (0, 0) {N$_1$}; \node[dc-node] (n2) at (2.5, -.5) {N$_2$}; \node[dc-node] (n3) at (2.5, -2.5) {N$_3$}; \node[dc-node] (n4) at (0, -3) {N$_4$}; \node[dc-node] (n5) at (-2.5, -2.5) {N$_5$}; \node[dc-node] (n6) at (-2.5, -.5) {N$_6$}; \node[label, rotate=-20] (lbl) at (-1.25, -3) {$\cdots$};

\draw (n1) to[bend right=4] (n2);
\draw (n1) to[bend right=4] (n3);
\draw (n1) to[bend left=4] (n6);
\draw (n1) to[bend left=4] (n5);
\draw (n1) -- (n4);

\draw (n2) to[bend left=4] (n3);
\draw (n2) to[bend left=10] (n4);
\draw (n2) to[bend left=10] (n5);
\draw (n2.north) to[bend right=35] (n6.north);

\draw (n3) to[bend right=4] (n4);
\draw (n3.south) to[bend left=35] (n5.south);
\draw (n3) to[bend left=10] (n6);

\draw (n4) to[bend right=4] (n5);
\draw (n4) to[bend left=10] (n6);

\draw (n5) to[bend left=4] (n6); 

\end{tikzpicture} \end{document}

  • unlikely to be operating system related (unless you mean the same pdf if copied from one system to the other renders differently) more likely to be a difference in the tex systems, add \listfiles and compare the file lists on the two systems for version differences – David Carlisle Jan 06 '22 at 08:04
  • The output looks as expected both in the free Adobe Acrobat Reader and in the TeXstudio built-in pdf viewer, which is poppler based. I'm on macOS 11.5.2 with latest texlive 2021. – muzimuzhi Z Jan 06 '22 at 08:10
  • I am also on MacOS using TeXLive 2021 (but has not been updated in some time), and am seeing the same output that you describe (with a white background). Once you installed MacTex, did you update the packages? That needs to be done as MacTeX release is frozen sometime around April. One soltuion I found is using the diagonal fill style from TikZ: Rectangle with diagonal fill (two colors) instead of double color fill does work. – Peter Grill Jan 06 '22 at 08:12
  • @PeterGrill Interesting that is actually the TexExchange post I took inspiration from :D and thanks and yes I updated after installing – Lars Nielsen Jan 06 '22 at 08:23
  • @DavidCarlisle I will try that later today when I am in front of my Mac thank you – Lars Nielsen Jan 06 '22 at 08:24
  • @muzimuzhiZ huh interesting. I will take a look and see if I can get it to working on my Mac – Lars Nielsen Jan 06 '22 at 08:24
  • More info is welcome, eg your latex2e version, tikz version, the engine you used, and maybe even a screenshot of the "white background" effect. – muzimuzhi Z Jan 06 '22 at 08:27
  • @DavidCarlisle is right. The output in Acrobat Reader looks as per your post but with TeXShop the nodes have the white background. TeXShop uses almost the same pdfkit as Preview so both have issues. This seems to be a bug with Apple's pdfkit. – Peter Grill Jan 06 '22 at 08:37
  • Interesting @PeterGrill and David Carlisle I will file a bug report with Apple then, when I have confirmed it later in the day that I experience the same :) – Lars Nielsen Jan 06 '22 at 08:39

1 Answers1

1

The LaTeX code works as it is supposed to.

What is not working is Apple Preview, as identified by David Carlisle and Peter Grill. The only solution I have found is to use an alternative PDF viewer.

I have filed a bug report with Apple.