¿Ghostscript rompe las sombras de TikZ?
Uso elegantes sombras TikZ en mi pdflatexdocumento, funciona bien. Sin embargo, si proceso el documento PDF con ghostscript (o su ps2pdfinterfaz), las sombras se rompen. El procesamiento tiene como objetivo reducir el tamaño del documento debido a muchas imágenes, reconozco que es un problema no relacionado.
Aquí están los detalles. El MWE:
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\usetikzlibrary{fit}
\usetikzlibrary{through}
\usetikzlibrary{positioning}
\usetikzlibrary{arrows.meta}
\usetikzlibrary{shadows}
\usetikzlibrary{shadings}
%% even fancier shadows
\usetikzlibrary{shadows.blur}
%% fade
\usetikzlibrary{fadings}
\begin{document}
\begin{tikzpicture}[align=center,node distance = 1.2em and 1.2em,
rounded corners=10, blur shadow={shadow blur steps=50}]
\tikzstyle{block} = [rectangle, fill=blue!10, draw, text width=6em,
text centered, minimum height=2.1\baselineskip,
blur shadow={shadow blur steps=50}
]
\node (t) [block] {Test};
\end{tikzpicture}
\end{document}
El documento original después de latexmk -pdf mwe:
Ahora llamo gs:
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.7 -dPDFSETTINGS=/printer -dColorImageDownsampleType=/Bicubic -dColorImageResolution=72 -dGrayImageDownsampleType=/Bicubic -dGrayImageResolution=72 -dMonoImageResolution=150 -dOptimize=true -q -o small-gs.pdf mwe.pdf
El resultado es:
También puedo llamar a ps2pdf: ps2pdf mwe.pdf small-2pdf.pdf, el resultado es el mismo. (No es de extrañar, es una interfaz para gs.)
Versiones:
$ pdflatex --version pdfTeX 3.14159265-2.6-1.40.21 (TeX Live 2020) kpathsea version 6.3.2 Copyright 2020 Han The Thanh (pdfTeX) et al. There is NO warranty. Redistribution of this software is covered by the terms of both the pdfTeX copyright and the Lesser GNU General Public License. For more information about these matters, see the file named COPYING and the pdfTeX source. Primary author of pdfTeX: Han The Thanh (pdfTeX) et al. Compiled with libpng 1.6.37; using libpng 1.6.37 Compiled with zlib 1.2.11; using zlib 1.2.11 Compiled with xpdf version 4.02 $ gs --version
9.52
Verificado en MacOS 10.15.6 y en un sistema de compilación en GitLab ( texlive-latest, imagen de Ubuntu). Veo los archivos PDF en Preview.app.
¿Qué estoy haciendo mal? (Aparte de usar Vista previa, obviamente).
¿Cómo conservar una compatibilidad más amplia de mis archivos PDF?
Respuestas
El soporte de Fadings (transparencia no uniforme) para dvips+ ps2pdfse ha agregado pgfmuy recientemente y está disponible solo en su repositorio de GitHub . Para probar, descargarhttps://github.com/pgf-tikz/pgf/archive/master.zipy copie la texcarpeta que contiene en el directorio de trabajo. Además, se necesita Ghostscript-9.52 y ps2pdfdebe ejecutarse con la opción -dALLOWPSTRANSPARENCY.
Una versión inferior de PDF ayuda, ps2pdf13 mwe.pdf test-pdf13.pdffunciona según lo previsto con la representación de las sombras. El tamaño es otro tema...