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 1:44
  • @percusse Any advice on how to use those shadows in a tikz picture? – user3188445 Jan 13 '16 at 5:31
  • Yes it is given in the shadows library which beamer uses – percusse Jan 13 '16 at 5: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 5:37
  • 1
    Is there anything to do with tex.stackexchange.com/questions/226598/… ? – Symbol 1 Jan 15 '16 at 9:43
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

  • 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

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.