请问为什么footline中用tikz画直线,最左边有空隙。尝试了\hspace{-1pt},overlay,remember picture这些办法可以,是否可以不用这些,使得左边没有空隙。以下是代码
\documentclass{ctexbeamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\setbeamertemplate{footline}{
%\hspace*{-0.2pt}%
\begin{tikzpicture}
\def\r{1pt}
\def\d{0.3pt}
\coordinate (A) at (0,1.3em);
\coordinate (B) at ($(A)+(0:{\paperwidth-(\r)-(\d)})$);
\draw[red] (A)--(B);
\fill[fill=white,line width=\d] (B) circle (\r);
\node[anchor=south west,inner sep=0pt,outer sep=0pt,fill=red] at (0,0){\color{white}测试测试测试};
\end{tikzpicture}
}
\begin{document}
\begin{frame}
测试
\end{frame}
\end{document}
加上overlay.
\documentclass{ctexbeamer}
\usepackage{tikz}
\usetikzlibrary{calc}
\setbeamertemplate{footline}{
%\hspace*{-0.2pt}%
\begin{tikzpicture}
\def\r{1pt}
\def\d{0.3pt}
\coordinate (A) at (0,1.3em);
\coordinate (B) at ($(A)+(0:{\paperwidth-(\r)-(\d)})$);
\draw[red,overlay] (A)--(B);
\fill[fill=white,line width=\d] (B) circle (\r);
\node[anchor=south west,inner sep=0pt,outer sep=0pt,fill=red] at (0,0){\color{white}测试测试测试};
\end{tikzpicture}
}
\begin{document}
\begin{frame}
测试
\end{frame}
\end{document}具体原因我也不是非常清楚,因为\draw (A)--(B);会向左增大整个tikzpicture的bounding box.
我相信其他坛友能给出更详细的解释...

一个简化的测试例子:
x-post: https://tex.stackexchange.com/questions/756040/odd-left-side-space-in-tikz
嗯忽然想到,这种情况用
beamercolorbox是不是可以避免...当然我不熟悉...