2

I'm using Miktex 2.9 + pdflatex and I'm having a bizarre issue. Whenever I use opacity for Tikz in beamer it does not work even if the same code works perfectly fine for a regular article document

\documentclass[12pt]{beamer}
\usepackage{amsmath,bbm,amssymb}
\usepackage{amsthm}
\usepackage{comment}
\usepackage{xcolor}
\usepackage{graphicx, graphics}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{url}
\usepackage{enumitem}
\usepackage{psfrag,pst-node,subfigure,rotating, amsmath, bbm, amsthm, amssymb, amsthm, setspace, picture, epsfig, amsfonts, upgreek}
\usepackage{mathtools}
\usepackage[round]{natbib}
\usepackage{helvet}
\usepackage[eulergreek]{sansmath}
\usepackage{tikz} % for venn diagrams
\usetikzlibrary{shapes,backgrounds,shapes.misc, positioning,shapes.geometric,arrows,matrix,fit,calc,arrows.meta, trees, hobby}
%\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

%%% Added on 04/13/2009 for getting multiple rows in Table 4.
\usepackage{multirow}



\tikzset{
    buffer/.style={
        isosceles triangle,
        isosceles triangle apex angle=66,
        shape border rotate=90,
        draw,
        thick,
        fill=blue!20,
        node distance=5cm,
        rounded corners=60pt,
        opacity=0.6,
        minimum height=6.25cm
    }
}

\pgfdeclarelayer{foreground} 
\pgfdeclarelayer{background}
   \pgfsetlayers{background,%
                 main,%
                 foreground%
                 }


\setbeameroption{hide notes}
\setbeamertemplate{note page}[plain]

% get rid of junk
\usetheme{default}
\beamertemplatenavigationsymbolsempty
\hypersetup{pdfpagemode=UseNone} % don't show bookmarks on initial view

% page number
\setbeamertemplate{footline}{%
    \raisebox{5pt}{\makebox[\paperwidth]{\hfill\makebox[20pt]{\color{gray}
          \scriptsize\insertframenumber}}}\hspace*{5pt}}

% add a bit of space at the top of the notes page
\addtobeamertemplate{note page}{\setlength{\parskip}{12pt}}


\setbeamertemplate{itemize subitem}{{\textendash}}
\setbeamerfont{itemize/enumerate subbody}{size=\footnotesize}
\setbeamerfont{itemize/enumerate subitem}{size=\footnotesize}
\setlength{\abovecaptionskip}{0pt}


\setbeamerfont{title}{size=\LARGE}
\setbeamerfont{subtitle}{size=\normalsize}
\setbeamerfont{framesubtitle}{size=\normalsize}
\setbeamerfont{institute}{size=\scriptsize}


\begin{document}


%\section[Content]{}
%\frame{\tableofcontents}

%\section{Introduction}



% ====================================================================== %



\begin{frame}[fragile]{Title}

\begin{figure}[!h]
\centering
\resizebox{.7\textwidth}{!}{% <------ Don't forget this %
\tikzstyle{background rectangle}=
[draw=blue!8,fill=blue!8,rounded corners=1.5ex]
\begin{tikzpicture}[font=\sffamily\sansmath,show background rectangle]
% \node (1) [draw, rounded rectangle] {none};
  \tikzset{venn circle/.style={draw,circle,minimum width=6.2cm,fill=#1,opacity=0.6}}

  \node [venn circle = red] (A) at (0,0) {\Large {}};
  \node [venn circle = yellow] (C) at (0:4cm) {\Large {}};
  \node [venn circle = blue] (B) at (60:4cm) {\Large {}};
  \node[left] at (barycentric cs:A=0.9/3,B=1/2 ) {\Large$A \cap B$}; %$$
  \node[below] at (barycentric cs:A=1/2,C=1/2 ) {\Large$A \cap C$};   %$$
  \node[right] at (barycentric cs:B=1/2,C=0.9/3 ) {\Large$B \cap C$};   %$$
  \node[below] at (barycentric cs:A=1.1/3,B=1/3,C=1.1/3 ){$A \cap B \cap C$};%$$
  \node[left] at (barycentric cs:A=3/4,B=-1/12) {{\Large$A$}}; %$$
  \node[right] at (barycentric cs:C=3/4,B=-1/12 ) {{\Large$C$}}; %$$
  \node[left] at (barycentric cs:A=-1/9,B=4/5 ) {{\Large$B$}};  %$$


  \node[label=right:\Large$None$] (Non) at (5,5)  {}; %$$

  %\draw[thick,green]  (-3.5,0) --(7.5,0);
  %\draw[thick,green]  (0,-3.5) --(0,6.9);

  \path(-3.5,0) --(7.5,0);
  \path(0,-3.5) --(0,6.9);
\end{tikzpicture}   
}
\end{figure}

\end{frame}



\end{document}

which produces

enter image description here

and then with article, everything is fine:

\documentclass[12pt]{article}
\usepackage{amsmath,bbm,amssymb}
\usepackage{amsthm}
\usepackage{comment}
\usepackage{xcolor}
\usepackage{graphicx, graphics}
\usepackage{algorithmic}
\usepackage{algorithm}
\usepackage{url}
\usepackage{enumitem}
\usepackage{psfrag,pst-node,subfigure,rotating, amsmath, bbm, amsthm, amssymb, amsthm, setspace, picture, epsfig, amsfonts, upgreek}
\usepackage{mathtools}
\usepackage[round]{natbib}
\usepackage{helvet}
\usepackage[eulergreek]{sansmath}
\usepackage{tikz} % for venn diagrams
\usetikzlibrary{shapes,backgrounds,shapes.misc, positioning,shapes.geometric,arrows,matrix,fit,calc,arrows.meta, trees, hobby}
%\DeclarePairedDelimiter{\norm}{\lVert}{\rVert}

%%% Added on 04/13/2009 for getting multiple rows in Table 4.
\usepackage{multirow}



\tikzset{
    buffer/.style={
        isosceles triangle,
        isosceles triangle apex angle=66,
        shape border rotate=90,
        draw,
        thick,
        fill=blue!20,
        node distance=5cm,
        rounded corners=60pt,
        opacity=0.6,
        minimum height=6.25cm
    }
}

\pgfdeclarelayer{foreground} 
\pgfdeclarelayer{background}
   \pgfsetlayers{background,%
                 main,%
                 foreground%
                 }




\begin{document}


%\section[Content]{}
%\frame{\tableofcontents}

%\section{Introduction}



% ====================================================================== %


\begin{figure}[!h]
\centering
\resizebox{.7\textwidth}{!}{% <------ Don't forget this %
\tikzstyle{background rectangle}=
[draw=blue!8,fill=blue!8,rounded corners=1.5ex]
\begin{tikzpicture}[font=\sffamily\sansmath,show background rectangle]
% \node (1) [draw, rounded rectangle] {none};
  \tikzset{venn circle/.style={draw,circle,minimum width=6.2cm,fill=#1,opacity=0.6}}

  \node [venn circle = red] (A) at (0,0) {\Large {}};
  \node [venn circle = yellow] (C) at (0:4cm) {\Large {}};
  \node [venn circle = blue] (B) at (60:4cm) {\Large {}};
  \node[left] at (barycentric cs:A=0.9/3,B=1/2 ) {\Large$A \cap B$}; %$$
  \node[below] at (barycentric cs:A=1/2,C=1/2 ) {\Large$A \cap C$};   %$$
  \node[right] at (barycentric cs:B=1/2,C=0.9/3 ) {\Large$B \cap C$};   %$$
  \node[below] at (barycentric cs:A=1.1/3,B=1/3,C=1.1/3 ){$A \cap B \cap C$};%$$
  \node[left] at (barycentric cs:A=3/4,B=-1/12) {{\Large$A$}}; %$$
  \node[right] at (barycentric cs:C=3/4,B=-1/12 ) {{\Large$C$}}; %$$
  \node[left] at (barycentric cs:A=-1/9,B=4/5 ) {{\Large$B$}};  %$$


  \node[label=right:\Large$None$] (Non) at (5,5)  {}; %$$

  %\draw[thick,green]  (-3.5,0) --(7.5,0);
  %\draw[thick,green]  (0,-3.5) --(0,6.9);

  \path(-3.5,0) --(7.5,0);
  \path(0,-3.5) --(0,6.9);
\end{tikzpicture}  
}
\end{figure}




% ====================================================================== %


\end{document}

which produces enter image description here

  • Your example is very far from being minimal. I get the correct opacity with your code stripped down to the essential (beamer/tikz/frame/tikzpicture with venn nodes, no extra styles). – Christoph Frings Aug 23 '16 at 15:01
  • If you get the correct opacity, could you at least post what you did to get it? – jjdd Aug 23 '16 at 15:02
  • 1
    Remove pst-node – user36296 Aug 23 '16 at 15:04
  • Thanks, samcarter. Removing pst-node did the trick. Why was that an issue? – jjdd Aug 23 '16 at 15:05
11

Removing pst-node solves the issue.

Don't collect packages - look for another collecting passion, I heard stamps are good to collect. Or maybe this:

enter image description here

Borrowed from @PauloCereda, I hope you don't mind.

You should only use the packages necessary for the specific document, to prevent such problems and don't just copy your preamble from article to beamer. This reduces the risk for such problems.

Besides this

  • as things like \usepackage{xcolor}, \usepackage{graphicx, graphics} (and don't load both, one is enough :) are already provided by beamer, loading them again might only lead to option clashes.

  • same for the packages you load multiple times, e.g. amsmath, bbm, amsthm, amssymb, amsthm,

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.