I just updated Miktex. When I compile a Latex document with the commands :

\usepackage {tikz}

\usetikzlibrary {shadows}

a big black logo appears at the top left of the first page of the DVI file, but not in the pdf file. It is the "shadows" library that creates this problem. Do you have a solution ?

  • 5
    Welcome to the site. Whenever you have a problem, it is custom here to post a full but minimal example example that others can copy and test as is. Additionally, tikz requires postscript or pdf features which are seldomly shown in dvi viewers (no-one hardly uses dvi anymore) – daleif Oct 27 '20 at 17:31
  • Hi and welcome. Please give a Minimum Working Example (MWE). To do this read and do what is indicated here: How to make a “minimum example” – AndréC Oct 27 '20 at 18:41

Short answer: This is a feature of the latex+dvips+ps2pdf workflow and cannot be avoided in connection with the recent (v3.1.6) release of PGF and its shadows and fadings TikZ libraries.

Long answer:

The shadows library also loads the fadings library.

Fadings, also known as transparency gradients or soft masks, are a PDF-only feature (as is basic, constant transparency too). Fadings have been made available for the DVI->PS->PDF route only recently (PGF-3.1.6). User- and pre-defined fadings were just ignored in previous PGF versions.

Defining a soft mask involves the creation of a so-called PDF-XObject, a self-sufficient, graphical object that is later used to mask (i.e. to add transparency to) other graphical objects, as shown in the example below.

Creating a soft mask takes place at the upper left corner on the page of its definition. Pre-defined soft masks of the fadings library are created on the first document page. What you see in the intermediate PS output are the underlying graphical objects that are used in this process. They cannot be hidden, but disappear in the final PDF-making step (ps2pdf -dALLOWPSTRANSPARENCY ...).

Since Fadings are a PDF-only feature, it does not make sense to publish/to release the intermediate PS version of a document containing these. You will have to produce (ps2pdf -dALLOWPSTRANSPARENCY ...) and ship the PDF instead.

If you really need to send out PS, perhaps because the publisher wants it, convert the PDF back to Postscript, using pdf2ps. The resulting Postscript is visually indistinguishable from its PDF precursor.

Example document ex.tex with a user-defined soft mask. Typeset with

latex ex
latex ex
dvips ex

(Note that processing documents relying on transparency features requires Ghostscript-9.52 or later.)




% define soft mask
  \tikz\shade [left color=pgftransparent!0, right color=pgftransparent!100] (0,0) rectangle (2,2);
  % checkerboard background
  \pattern [pattern=checkerboard, pattern color=black!30] (0,0) rectangle (9,4);
  % blue rect with transparency gradient
  \fill [color=blue, path fading=myFading] (1,1) rectangle (3,3); 
  % red rect with transparency gradient
  \fill [color=red, path fading=myFading] (4,1) rectangle (8,3); 


Intermediate Postscript (as shown in gv or GSview or printed on paper): enter image description here

Final PDF (after ps2pdf -dALLOWPSTRANSPARENCY ex.ps): enter image description here

Postscript, back-converted from PDF (pdf2ps ex.pdf ex2.ps): enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.