TransWikia.com

How to position multiple images or tikzpictures in beamer background

TeX - LaTeX Asked on May 21, 2021

I’d like to rebuild a PowerPoint template with beamer. For this, I need to position several graphic elements in the background of a frame. I have tried so many ways and codes but have several problems. Please consider this MWE, for example:

documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{tikz}

begin{document}

{usebackgroundtemplate{
begin{picture}(0,0)
put(0,-50){
begin{tikzpicture}[overlay]
node [anchor=south west] (rect) at (0,0) [fill=blue, minimum width=16.0cm,minimum height=0.5cm] {};
node [anchor=south west] (rect) at (0,0.5) [fill=black, minimum width=16cm, minimum height=2cm] {};
end{tikzpicture}}
end{picture}

begin{picture}(0,0)
put(0,-225){
includegraphics[width=3cm]{pictures/image1.png}
end{picture}

begin{picture}(0,0)
begin{tikzpicture}[overlay]
node[anchor=south west, inner sep=0pt] (image2) at (current page.south west){includegraphics[width=8cm]{pictures/image2.png}};
end{tikzpicture}
end{picture}
}
begin{frame}
Test
end{frame}

}

end{document}

Commenting the second picture at least gives an output. Besides this problem, I am struggling with the following thing: How can I force beamer to place the figures at left side of the frame without any margins. Working with negative values for put works but is not a good solution and has to be done separately for every graphical element.

Why is image2 not even showing up? I thought working with a node at the south west corner of the page would be a clever idea.

Adding stuff makes the elements change their postion – for example some text above of image 1. How can a force element to just stay where I have placed them?

One Answer

Try this

documentclass{beamer}
usepackage[utf8]{inputenc}
usepackage[T1]{fontenc}
usepackage{tikz}

begin{document}

usebackgroundtemplate{

begin{tikzpicture}[remember picture, overlay] % <----------
node [anchor=north west] (black rect) at (current page.north west) 
        [fill=black, minimum width=16cm, minimum height=2cm] {};

node [anchor=north] at (black rect.south) 
     [fill=blue, minimum width=16.0cm,minimum height=0.5cm] {};

node[anchor=south west, inner sep=0pt] (image2) at (current page.south west)
     {includegraphics[width=8cm]{pictures/image2.png}};

node[anchor=south east, inner sep=0pt] at (current page.south east)
     {includegraphics[width=3cm]{pictures/image1.png}};
end{tikzpicture}
}



begin{frame}
Test
end{frame}


end{document}

Correct answer by Hafid Boukhoulda on May 21, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP