现有图形上方的 Tikz 元素(投影仪)

现有图形上方的 Tikz 元素(投影仪)

我正在努力将 tikz 元素放置在 beamer 演示文稿中现有的图形(带有标题)上方。

我希望在我的演示文稿中,在之前的图形上方出现一个过度支撑和一个箭头。

除了将我的图形直接放在 tikz 环境中之外,我找不到任何答案。

有什么解决办法吗?

谢谢。

编辑:编辑代码

 %\documentclass[draft]{beamer}
\documentclass{beamer}
\usepackage{hyperref}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usecolortheme{orchid}
\usepackage[sort&compress]{natbib} %before babel ?
\bibliographystyle{apalike_perso}
\renewcommand{\bibsection}{\subsubsection*{\bibname}}
\usepackage[french,english]{babel}
\usefonttheme{serif}
\usepackage{pgfpages}
% other packages
\usepackage[justification=centering,font=tiny]{caption}
\captionsetup{width=0pt}

\usepackage[export]{adjustbox}
\usepackage{latexsym,amsmath,xcolor,multicol,booktabs,calligra}
\usepackage{graphicx,listings,stackengine}
\graphicspath{{figures}}
\usepackage{tabularx}
\usepackage{array}

\usepackage{pifont}  %symbols library (usefull for item or arrows




%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%SHOW AND USE BOXES%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage[absolute,showboxes,overlay]{textpos}     % déclaration du package
\textblockorigin{0mm}{0mm}                               % origine des positions
\TPshowboxestrue                                     % affiche le contour des textblock
\TPshowboxesfalse                                    % n'affiche pas le contour des textblock

%TIKZ
\usepackage{tikz}
\usepackage{tcolorbox}
\usetikzlibrary{shadings}
\tcbuselibrary{skins}
\usetikzlibrary{shapes,arrows} % Tikz libraries required for the flow chart in the template
\usetikzlibrary{arrows.meta,positioning}
%\usepackage[tightpage,active]{preview}

\usetikzlibrary{decorations}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.pathreplacing}
\usetikzlibrary{decorations.shapes}
% \usetikzlibrary{decorations.text}
% \usetikzlibrary{decorations.markings}
% \usetikzlibrary{decorations.fractals}
\usetikzlibrary{decorations.footprints}

\usepackage{animate}



\AtBeginEnvironment{frame}{\setcounter{figure}{1}}% Resets subfigure counter at start of figure environment
%\setcounter{figure}{1}

%mycaption
\newcommand{\mycaption}[1]{
\begin{center}
{\fontsize{5pt}{3.5pt}\selectfont
        {\textit{ \textcolor{deepblue}{{\textbf{ Fig. \alph{figure}:}} \textcolor{gray!95}{ #1}}}}
%        }
\par}
\end{center}  
 \stepcounter{figure}
}

%myenvironment for myfigure below
%\newenvironment{mc}[1]{\begin{center}  #1}{\end{center}}
%\newenvironment{ml}[1]{\begin{flushleft}  #1}{\end{flushleft}}
%\newenvironment{mr}[1]{\begin{flushright} #1}{\end{flushright}}
%myenvironment for myfigure below
\newenvironment{mc}{\centering  }{\par}
\newenvironment{ml}{\raggedleft }{\par}
\newenvironment{mr}{\raggedright}{\par}
%myfigure
\newcommand{\myfigure}[4]{
\begin{#1}
\begin{minipage}{#2cm}
\centering
\includegraphics[width=#2cm]{#3}
\mycaption{#4}
\end{minipage}
\end{#1}
}
\newcommand{\ifig}[1]{\addtocounter{figure}{#1}} %add to counter manualy


\begin{document}


\begin{frame}[b]{mytitle}
\onslide<1->{
\begin{textblock*}{4cm}(20mm,15mm)
\ifig{0} {%
\setlength{\fboxsep}{0pt}%
\setlength{\fboxrule}{2pt}%
\fbox{\myfigure{mc}{4}{example-image-a.png}{IP vs EM}}
}
 \end{textblock*}
}

\begin{tikzpicture}[overlay,remember picture,x=1cm,y=-1cm,shift={(current page.north west)}]
\draw<2->[ultra thick,color=red, ->] (4.75,1.925) .. controls (6,1) and  (7.25,2)  .. 
(7.25,2) .. controls (7.25,3.5) .. (8,3.5);
\draw<2->[thick,color=red,decorate,decoration={brace}] (3.9,2) -- (5.6,2) node[above,pos=0.5] {};
\end{tikzpicture}

\end{frame}

\end{document}

答案1

我发现了我的问题......tikz 和 includegraphics 什么也看不见。

这是文本块的错误,如果我理解得没错的话,文本块环境会覆盖框架中的所有内容。当我将图形放在文本块内时,它们会出现在“顶层”(在我的 tikz 元素上)

为了解决这个问题,我将我的 tikz 环境直接放入 textblock 环境中,如下所示:

\begin{textblock*}{4cm}(20mm,15mm)
\onslide<1->{\ifig{0} \myfigure{mc}{4}{IPvsEM.png}{IP vs EM}}
\begin{tikzpicture}[overlay,remember picture,x=1cm,y=-1cm,shift={(current page.north west)}]
\draw<2->[ultra thick,color=red, ->] (4.98,1.8) .. controls (6,0.9) and  (6.8,.9)  .. 
(7,2.5) .. controls (7,3) .. (8,3);
\draw<2->[thick,color=red,decorate,decoration={brace}] (4,1.9) -- (5.6,1.9) node[above,pos=0.5] {};
\end{tikzpicture}
\end{textblock*}

再见

相关内容