1

I am trying to use an overlay system on a beamer slide in order to display successively several images.

I start by displaying a blank box containing some text (using \itemize) then I add an associated image for each sentence printed in the box (displayed just under the box).

The first image is a \tikzpicture image and after that I use classical png images.

The problem is that if I start displaying the images after the tikzpicture I keep having them in a strange position (on the far right of the frame) like this :

enter image description here

The tikzpicture itself is well positioned but other images are constantly shifted and I don't know why.

I have used several methods to overlay the tikzfigure : the one used here is \onlyenv but I have also tried to implement the solution provided in the post : Beamer overlay specifications for a tikzpicture

But I keep having the same exact problem of positioning : how can I get rid of this ?

Thank you very much,

\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 -- node [fill=cyan!20,scale=0.55] {$Q_1$} (0.425,0); \draw yshift=-0.25cm, -stealth -- 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}

Waxler
  • 680

1 Answers1

1

\includegraphics is not a tikz command. It is not necessary or useful to warp the in a 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 -- node [fill=cyan!20,scale=0.55] {$Q_1$} (0.425,0); \draw yshift=-0.25cm, -stealth -- 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}

enter image description here

  • Thank you for the correction ! In fact I was trying to write something like : \begin{tikzpicture}[remember picture, overlay,] \begin{onlyenv}<1> \node[above=1.0cm, anchor= south,xshift= 1cm] at (current page.south) { \subfloat[\centering Caption ]{{\includegraphics[height = 0.275\textheight, width=0.275\linewidth ]{example-image} }} }; \end{onlyenv} \end{tikzpicture} This is why I have wrapped the image in tikzpicture – Waxler Oct 04 '22 at 13:12
  • 1
    @Wiss That's equally unnecessary. – samcarter_is_at_topanswers.xyz Oct 04 '22 at 13:16
  • Yes : thank you ! – Waxler Oct 04 '22 at 13:19