我正在尝试在投影仪幻灯片上使用覆盖系统以便连续显示多幅图像。
我首先显示一个包含一些文本的空白框(使用\itemize
),然后为框中打印的每个句子添加关联图像(显示在框的正下方)。
第一张图片是\tikzpicture
图像,之后我使用经典的 png 图像。
问题是,如果我开始显示 tikzpicture 之后的图像,我会一直将它们置于一个奇怪的位置(在框架的最右边),如下所示:
tikzpicture 本身定位很好,但其他图像却不断移动,我不知道为什么。
我使用了几种方法来叠加 tikzfigure:这里使用的是这种方法\onlyenv
,但我也尝试过实施帖子中提供的解决方案:
Beamer 针对 tikzpicture 的覆盖规格
但我一直遇到完全相同的定位问题:我该如何摆脱它?
非常感谢,
\documentclass[t]{beamer}
%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}
%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,norndcorners]{hf-tikz}
%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}
\def\doubleunderline#1{\underline{\underline{#1}}}
% FONT SIZE %
\makeatletter
\newcommand\thefontsize{The current font size is: \f@size pt}
\makeatother
\usepackage{epstopdf} %Convertir en PDF
\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}
%%%%%% DEFINITIONS %%%%%%%%%
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}}
\def\env#1{\texttt{\color{blue}\footnotesize #1}}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\definecolor{halfgray}{gray}{0.55}
\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\bfseries\color{deepblue},
emphstyle=\ttfamily\color{deepred}, % Custom highlighting style
stringstyle=\color{deepgreen},
numbers=left,
numberstyle=\small\color{halfgray},
rulesepcolor=\color{red!20!green!20!blue!20},
frame=shadowbox,
}
%%%%%% BOX %%%%%%%%%%%%%%%%
\usepackage{fancybox}
\usepackage{varwidth}
\usepackage{subcaption}
%%%%%% PGFPLOTS %%%%%%%%%%%%
\usepackage[export]{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfmathdeclarefunction{gaussian}{2}
{%
\pgfmathparse{(1/(#1 * sqrt(2 * pi))) * exp((-1 / 2) * (((x - #2)/#1) ^ 2))}%
}
\pgfmathsetmacro{\mean}{7}
\pgfmathsetmacro{\std}{0.3}
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\definecolor{BgYellow}{HTML}{FFF59C}
\definecolor{FrameYellow}{HTML}{F7A600}
\usepackage{pgf, tikz, adjustbox}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{decorations.markings, arrows.meta,
patterns.meta
}
%%%%%%%CADRES DES EQUATIONS%%%%%
\usepackage[most]{tcolorbox}
\tcbset{highlight math style={enhanced,colframe=red,colback=red!10!white,boxsep=0pt,sharp corners,
equal height group=C,
minimum for equal height group=C:1.5cm,
valign=center,
}}
%%%%%%%DOCUMENT%%%%%%%%%%%%%
\begin{document}
\begin{frame}[t]
\begin{tcolorbox}[title = Perspectives futures, ams nodisplayskip,colback=yellow!10!white,colframe=red!50!black]
\begin{itemize}
\vskip0.3cm
\item<1-> Le cas de la coalescence de 2 gouttes élastiques
\item<3-> La formation de "doigts" avec des gouttes élastiques sur un plan incliné
\item<5-> L'origine des "plis" de la laccolithe à creuser
\end{itemize}
\end{tcolorbox}
\begin{center}
\begin{onlyenv}<2>
\begin{tikzpicture}[
declare function={gauss(\x)=3*exp(-(\x/3.25)^2);},
scale = 0.6,
s/.style={shift=(0:16)}]
\fill [cyan!20]
plot[domain= 0:8, samples=100] (\x, {gauss(\x)})
{[s] -- plot[domain=-8:0, samples=100] (\x, {gauss(\x)})
|- (-8,0)}
-| cycle;
\filldraw[fill=pink!20, thick]
plot[domain=0:8, samples=100] (\x, {gauss(\x)})
{[s] -- plot[domain=-8:0, samples=100] (\x, {gauss(\x)})
-- plot[domain=0:-8, samples=100] (\x, {gauss(\x)+0.6})}
-- plot[domain=8:0, samples=100] (\x, {gauss(\x)+0.6})
-- cycle;
% \draw[very thick] (0:8) -- ++ (up:.6);
\path[fill=cyan!20] (0,-2) -- (0,0) -- (0.85,0) -- (0.85,-2) -- (0,-2);
\path[fill=cyan!20] (16,-2) -- (16,0) -- (15.15,0) -- (15.15,-2) -- (16,-2);
\draw[black,thick] (0.85,-2) -- (0.85,0) -- (15.15,0) -- (15.15,-2);
\draw [yshift=-0.25cm, -stealth](0.425,-1.5) -- node [fill=cyan!20,scale=0.55] {$Q_1$} (0.425,0);
\draw [yshift=-0.25cm, -stealth](15.575,-1.5) -- node [fill=cyan!20,scale=0.55] {$Q_2$} (15.575,0);
\fill[pattern = north east lines] (-0.4,-2.25) -- (-0.4,{gauss(0)+0.625}) -- (0,{gauss(0)+0.625}) -- (0,-2.25) -- (-0.4,-2.25);
\fill[pattern = north east lines] (16.4,-2.25) -- (16.4,{gauss(0)+0.625}) -- (16,{gauss(0)+0.625}) -- (16,-2.25) -- (16.4,-2.25);
%\draw[fill=gray!20] (0.85,-1.5) -- (0.85,0) -- (15.15,0) -- (15.15,-1.5) -- (0.85,-1.5);
\end{tikzpicture}
\end{onlyenv}
\begin{onlyenv}<4>
\begin{tikzpicture}
\includegraphics[height= 0.5\textheight,width=0.6 \textwidth]{example-image}
\end{tikzpicture}
\end{onlyenv}
\begin{onlyenv}<6>
\begin{tikzpicture}
\includegraphics[height= 0.5\textheight,width=0.6 \textwidth]{example-image}
\end{tikzpicture}
\end{onlyenv}
\end{center}
\end{frame}
\end{document}
答案1
\includegraphics
不是 tikz 命令。没有必要或没有用处将 扭曲到 中tikzpicture
。
\documentclass[t]{beamer}
%%%%%% ENCODAGE %%%%%%%%%%%
\usepackage[utf8]{inputenc}
%%%%%% TIKZ %%%%%%%%%%%%%%%
\usepackage[beamer,customcolors,norndcorners]{hf-tikz}
%%%%%% OTHERS %%%%%%%%%%%%%
\usepackage{booktabs,calligra}
\usepackage{listings,stackengine}
\def\doubleunderline#1{\underline{\underline{#1}}}
% FONT SIZE %
\makeatletter
\newcommand\thefontsize{The current font size is: \f@size pt}
\makeatother
\usepackage{epstopdf} %Convertir en PDF
\author{XXX}
\title{XXX}
\subtitle{XXX}
\institute [XXX] {XXX \\ XXX}
\date{\today}
%%%%%% DEFINITIONS %%%%%%%%%
\def\cmd#1{\texttt{\color{red}\footnotesize $\backslash$#1}}
\def\env#1{\texttt{\color{blue}\footnotesize #1}}
\definecolor{deepblue}{rgb}{0,0,0.5}
\definecolor{deepred}{rgb}{0.6,0,0}
\definecolor{deepgreen}{rgb}{0,0.5,0}
\definecolor{halfgray}{gray}{0.55}
\lstset{
basicstyle=\ttfamily\small,
keywordstyle=\bfseries\color{deepblue},
emphstyle=\ttfamily\color{deepred}, % Custom highlighting style
stringstyle=\color{deepgreen},
numbers=left,
numberstyle=\small\color{halfgray},
rulesepcolor=\color{red!20!green!20!blue!20},
frame=shadowbox,
}
%%%%%% BOX %%%%%%%%%%%%%%%%
\usepackage{fancybox}
\usepackage{varwidth}
\usepackage{subcaption}
%%%%%% PGFPLOTS %%%%%%%%%%%%
\usepackage[export]{adjustbox}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}
\pgfmathdeclarefunction{gaussian}{2}
{%
\pgfmathparse{(1/(#1 * sqrt(2 * pi))) * exp((-1 / 2) * (((x - #2)/#1) ^ 2))}%
}
\pgfmathsetmacro{\mean}{7}
\pgfmathsetmacro{\std}{0.3}
\definecolor{mygreen}{RGB}{28,172,0} % color values Red, Green, Blue
\definecolor{mylilas}{RGB}{170,55,241}
\definecolor{BgYellow}{HTML}{FFF59C}
\definecolor{FrameYellow}{HTML}{F7A600}
\usepackage{pgf, tikz, adjustbox}
\usetikzlibrary{spy}
\usepgfplotslibrary{fillbetween}
\usetikzlibrary{patterns, matrix, positioning}
\usetikzlibrary{decorations.markings, arrows.meta,
patterns.meta
}
%%%%%%%CADRES DES EQUATIONS%%%%%
\usepackage[most]{tcolorbox}
\tcbset{highlight math style={enhanced,colframe=red,colback=red!10!white,boxsep=0pt,sharp corners,
equal height group=C,
minimum for equal height group=C:1.5cm,
valign=center,
}}
%%%%%%%DOCUMENT%%%%%%%%%%%%%
\begin{document}
\begin{frame}[t]
\begin{tcolorbox}[title = Perspectives futures, ams nodisplayskip,colback=yellow!10!white,colframe=red!50!black]
\begin{itemize}
\vskip0.3cm
\item<1-> Le cas de la coalescence de 2 gouttes élastiques
\item<3-> La formation de "doigts" avec des gouttes élastiques sur un plan incliné
\item<5-> L'origine des "plis" de la laccolithe à creuser
\end{itemize}
\end{tcolorbox}
\begin{center}
\begin{onlyenv}<2>
\begin{tikzpicture}[
declare function={gauss(\x)=3*exp(-(\x/3.25)^2);},
scale = 0.6,
s/.style={shift=(0:16)}]
\fill [cyan!20]
plot[domain= 0:8, samples=100] (\x, {gauss(\x)})
{[s] -- plot[domain=-8:0, samples=100] (\x, {gauss(\x)})
|- (-8,0)}
-| cycle;
\filldraw[fill=pink!20, thick]
plot[domain=0:8, samples=100] (\x, {gauss(\x)})
{[s] -- plot[domain=-8:0, samples=100] (\x, {gauss(\x)})
-- plot[domain=0:-8, samples=100] (\x, {gauss(\x)+0.6})}
-- plot[domain=8:0, samples=100] (\x, {gauss(\x)+0.6})
-- cycle;
% \draw[very thick] (0:8) -- ++ (up:.6);
\path[fill=cyan!20] (0,-2) -- (0,0) -- (0.85,0) -- (0.85,-2) -- (0,-2);
\path[fill=cyan!20] (16,-2) -- (16,0) -- (15.15,0) -- (15.15,-2) -- (16,-2);
\draw[black,thick] (0.85,-2) -- (0.85,0) -- (15.15,0) -- (15.15,-2);
\draw [yshift=-0.25cm, -stealth](0.425,-1.5) -- node [fill=cyan!20,scale=0.55] {$Q_1$} (0.425,0);
\draw [yshift=-0.25cm, -stealth](15.575,-1.5) -- node [fill=cyan!20,scale=0.55] {$Q_2$} (15.575,0);
\fill[pattern = north east lines] (-0.4,-2.25) -- (-0.4,{gauss(0)+0.625}) -- (0,{gauss(0)+0.625}) -- (0,-2.25) -- (-0.4,-2.25);
\fill[pattern = north east lines] (16.4,-2.25) -- (16.4,{gauss(0)+0.625}) -- (16,{gauss(0)+0.625}) -- (16,-2.25) -- (16.4,-2.25);
%\draw[fill=gray!20] (0.85,-1.5) -- (0.85,0) -- (15.15,0) -- (15.15,-1.5) -- (0.85,-1.5);
\end{tikzpicture}
\end{onlyenv}
\begin{onlyenv}<4>
%\begin{tikzpicture}
\includegraphics[height= 0.5\textheight,width=0.6 \textwidth]{example-image}
%\end{tikzpicture}
\end{onlyenv}
\begin{onlyenv}<6>
%\begin{tikzpicture}
\includegraphics[height= 0.5\textheight,width=0.6 \textwidth]{example-image}
%\end{tikzpicture}
\end{onlyenv}
\end{center}
\end{frame}
\end{document}