Beamer:图片的绝对定位 | 意外填充

Beamer:图片的绝对定位 | 意外填充
  • 我想要beamer绝对地放置/定位图像/图片/元素。
  • 我使用众所周知的remember picture方法\node at (current page.xx)

在我的 MWE 中,我想将图片定位在右下角但有一个意想不到的剩余“填充”


% Compile twice (--> 'remember picture' option)!
\documentclass{beamer}
\usepackage{tikz}

\begin{document}

% Setting background to "not-white" in order to make the borders clearer.
\setbeamercolor{background canvas}{bg = green}

\begin{frame}[t]
\frametitle{Test}
Test

\begin{tikzpicture}[overlay, remember picture] 
    %
    \node at (current page.south east) [anchor = south east] {
    \includegraphics[width = 60mm]{example-image-a}
    };
    %
\end{tikzpicture}

\end{frame}

\end{document}

在此处输入图片描述


用户更新 1埃里克的评论

  • 添加inner sep = 0pt几乎\node at (current page.south east) [anchor = south east, inner sep = 0pt]可以解决问题。
  • 还剩下一些填充,或者这是查看器的问题?

在此处输入图片描述

用户更新 2土拨鼠的评论

最终解决方案!

\documentclass{beamer}
\usepackage{tikz}

\begin{document}

% Setting background to not white in order to make the borders clearer.
\setbeamercolor{background canvas}{bg = green}

\begin{frame}[t]
\frametitle{Test}
Test

\begin{tikzpicture}[overlay, remember picture] 
    %
    \node at (current page.south east) [
        anchor = south east, 
        inner sep = 0pt, % <-- Solution
        outer sep = 0pt, % <-- Solution
        ] {
    \includegraphics[width = 60mm]{example-image-a}
    };
    %
\end{tikzpicture}

\end{frame}

\end{document}

答案1

Z 会自动在节点周围添加一些空间。大部分空间是由于,但也inner sep有非常小的空间(我认为类似于 CSS 中的填充和边距)。您可以通过设置和来删除它。outer sepinner sep=0outer sep=0

\documentclass{beamer}
\usepackage{tikz}
\begin{document}
% Setting background to "not-white" in order to make the borders clearer.
\setbeamercolor{background canvas}{bg = green}
\begin{frame}[t]
\frametitle{Test}
Test

\begin{tikzpicture}[overlay, remember picture] 
    \node at (current page.south east) [anchor = south east,inner sep=0pt,outer sep=0pt] {
    \includegraphics[width = 60mm]{example-image-a}
    };
\end{tikzpicture}
\end{frame}
\end{document}

在此处输入图片描述

相关内容