According to Setting margins below and above figures does not have any effect in beamer, in beamer, figures are not floats. That is why How to change the spacing between figures/tables and text? doesn't work there.
The question is about removing all margins. However, I want to keep some margins, just modify them appropriately.
Is there a way how to do this in beamer?
MWE:
\documentclass{beamer}
\begin{document}
\begin{frame}
\begin{figure}[h]
\centering
\includegraphics[width=0.4\linewidth]{example-image-a}
\caption{Test}
\end{figure}
\begin{figure}[h]
\centering
\includegraphics[width=0.4\linewidth]{example-image-a}
\caption{Test}
\end{figure}
\end{frame}
\end{document}


\floatsep(i.e. for all figures). I guess that means redefining the figure environment (as in the other question) and adding custom margins there? – clel Mar 12 '24 at 14:07\AtBeginEnvironment{figure}{\vskip-0.5cm} \AfterEndEnvironment{figure}{\vskip-0.5cm}but be aware that this might lead to misplaced images at the top/bottom of a frame. – samcarter_is_at_topanswers.xyz Mar 12 '24 at 14:10\floatsepdoes with normal figures.Basically, I don't want to customize this for each frame individually (this is very time-consuming and might lead to inconsistencies in style). Also, doing this by removing margin space is not really what I want (as it can mean accidentally removing too much).
– clel Mar 12 '24 at 14:13centerenvironment – samcarter_is_at_topanswers.xyz Mar 12 '24 at 14:24Probably, the best way is to redefine the figure environment like this:
And in that add some margins (that got previously removed by using
– clel Mar 12 '24 at 14:30\centeringinstead ofcenter)?mycenterenvironment with different margins and then redefine thefigureenvironment using that. – clel Mar 12 '24 at 14:35captionpackage in your answer. That is also something, I am doing right now in a similar way as a workaround (and it seems to also work with the figure environment). – clel Mar 12 '24 at 14:47