Standalone does not produce a transparent background

standalonetikz-pgftransparent

In https://tex.stackexchange.com/a/382726/240454, the author claims that the background of tikzpictures are transparent by default.

In this MWE, for me, using either pdflatex or xelatex, I remain with a white background. Is there a problem with my installation?

\documentclass[crop,multi=tikzpicture,varwidth=false,border=1cm]{standalone}
\usepackage{tikz}

\begin{document}
    \begin{tikzpicture}
        \draw[red,line width=1mm,fill=blue] (-1,-1) -- (-1,1) -- (1,1) -- cycle;
    \end{tikzpicture}
\end{document}

Compiled using

xelatex.exe -synctex=1 -interaction=nonstopmode "test".tex

The result is then, after exporting the pdf as png using Adobe Acrobat Pro DC:

Best Answer

PDF's can and will have transparency since PDF 1.4. https://en.wikipedia.org/wiki/PDF#Transparency

Your code generates a PDF with transparent background(Correction: No background). Apparently, your export settings of Adobe Acrobat makes your PNG white.

I compile your code, and use:

convert triangle.pdf triangle.png

to create this PNG:

Window showing a triangle.png with transparent background

(Here shown viewed in Mac preview)

convert is from ImageMagick: https://imagemagick.org (free for all platforms)

Related Question