Tikz 不透明度不适用于 beamer,但适用于文章

Tikz 不透明度不适用于 beamer,但适用于文章

我正在使用 Miktex 2.9 + pdflatex,但遇到了一个奇怪的问题。每当我在 Beamer 中对 Tikz 使用不透明度时,它都不起作用,即使相同的代码对常规文章文档运行良好

\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}

产生

在此处输入图片描述

然后有了文章,一切都很好:

\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}

产生 在此处输入图片描述

答案1

删除pst-node即可解决问题。

不要收集包裹——寻找另一种收集爱好,我听说收集邮票很好。或者可能是这个:

在此处输入图片描述

借自@PauloCereda,希望你不介意。

您应该只使用特定文档所需的软件包,以避免此类问题,而不要只是将文章中的前言复制到 beamer。这可以降低此类问题的风险。

除此之外

  • 因为 beamer 已经提供了诸如 之类的东西\usepackage{xcolor}\usepackage{graphicx, graphics}不要同时加载两者,一个就够了:),再次加载它们只会导致选项冲突。

  • 对于多次加载的包也一样,例如amsmath, bbm, amsthm, amssymb, amsthm,

在此处输入图片描述

相关内容