10

I am trying to add blur shadows to a beamer presentation using the pgf-blur package. Here is a minimal working example:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{shadows.blur}

\begin{document}

\begin{frame}
\begin{tikzpicture}
\node[minimum height=1cm, minimum width=3cm,
  rounded corners, fill=red!30, blur shadow] {};
\end{tikzpicture}
\end{frame}

\end{document}

Unfortunately, when I try to present my slides using any of the poppler-based renderers (like xpdf, evince, okular, impressive), I get an extremely ugly artifact at the border and especially corners. Here is what it looks like:

artifacts

Interestingly, the problem goes away if I do the same thing in a \documentclass{article}. Here is a screenshot of the same image without beamer:

rendered with \documentclass{article}

Because the problem does not happen with mupdf, this may actually just be a bug in libpoppler. However, libpoppler is so prevalent that I need to find a way to work around it. The fact that the bug goes away without beamer gives me some hope there is a way around this, but I have no idea what beamer might be doing to cause the artifact. I'd also be happy with an alternative to pgf-blur, if there is one.

  • You don't need blur here. Beamer has its own shadows and they are hardly distinguishable. – percusse Jan 12 '16 at 01:44
  • @percusse Any advice on how to use those shadows in a tikz picture? – user3188445 Jan 13 '16 at 05:31
  • Yes it is given in the shadows library which beamer uses – percusse Jan 13 '16 at 05:32
  • @percusse You mean like in beamerbaseboxes.sty, the stuff that happens \ifbmb@shadow? It doesn't seem to be using much of a library but rather implementing a lot of the stuff inline with low-level pgf commands... – user3188445 Jan 13 '16 at 05:37
  • See the shadows library of TikZ. TikZ also uses a lot of PGF whioch doesn't mean it is bad. – percusse Jan 13 '16 at 05:45
  • @percusse Yeah, it works if I use a regular shadow from stock TikZ instead of blur shadow from pgf-blur, but the blur shadows look so much better. What's frustrating is that they work fine in article mode, so I just wonder what beamer is doing... – user3188445 Jan 13 '16 at 05:49
  • 1
    Is there anything to do with http://tex.stackexchange.com/questions/226598/beamers-implicit-options-regarding-tikzpictures-and-shadows ? – Symbol 1 Jan 15 '16 at 09:43
  • @Symbol1 Indeed, this could well be the same issue. Too bad the other question doesn't have a solution, either, or that would be the first thing to try... – user3188445 Jan 15 '16 at 22:07
  • Here's a question where a similar artifact in an older version of acroread seems to be related to a show thin lines "optimization" http://tex.stackexchange.com/questions/11272/faded-drop-shadow-using-tikz-based-rounded-rectangle – user3188445 Jan 16 '16 at 21:57

1 Answers1

5

Here is a workaround:

\documentclass{beamer}

\usepackage{tikz}
\usetikzlibrary{shadows.blur}
\tikzset{
  my blur shadow layer/.style={
    preaction={fill=black,fill opacity=.025,transform canvas={xshift=#1,yshift=-1*#1}},
  },
  my blur shadow/.style={
    my blur shadow layer/.list={.3pt,.6pt,...,2.7pt},
  },
}
\begin{document}

\begin{frame}
\begin{tikzpicture}
\node[minimum height=1cm, minimum width=3cm,
  rounded corners, fill=red!30,
  blur shadow,
  ] {};
\node[minimum height=1cm, minimum width=3cm,
  rounded corners, fill=orange!30,
  my blur shadow,
  ] at (0, -1.2){};
\end{tikzpicture}
\end{frame}

\end{document}

enter image description here

Paul Gaborit
  • 70,770
  • 10
  • 176
  • 283
  • 1
    Thanks for the suggestion, which definitely gets rid of the artifacts. Unfortunately, now the shadow looks too small--it's exactly the size of the shape, when it should be slightly bigger. Any suggestions on how to make it look more like a shadow? Maybe shift it left and down separately or something? – user3188445 Jan 12 '16 at 21:16