我正在尝试改变下面突出显示区域的形状MWE
(基于这是@BambOo 的解决方案)。
\documentclass{beamer}
\usepackage{tikz}
\tikzset{
use page relative coordinates/.style={
shift={(current page.south west)},
x={(current page.south east)},
y={(current page.north west)}
},
}
\begin{document}
\begin{frame}{title}{subtitle}
\begin{block}{Block title}
Some content
\end{block}
\includegraphics[width=0.5\textwidth]{example-image-a}
\begin{tikzpicture}[remember picture,overlay,use page relative coordinates]
\fill[opacity=0.5,black] (0,0) rectangle (1,1) (0.25,0.5) circle (2cm);
\end{tikzpicture}
\end{frame}
\end{document}
两者都不
\begin{tikzpicture}[remember picture,overlay,use page relative coordinates]
\fill[opacity=0.5,black] (0,0) rectangle (1,1) (0.15,0.15) rectangle (0.2,0.2);
\end{tikzpicture}
也不
\begin{tikzpicture}[remember picture,overlay,use page relative coordinates]
\fill[opacity=0.5,black] (0,0) rectangle (1,1);
\fill[opacity=0,black] (0.15,0.15) rectangle (0.2,0.2);
\end{tikzpicture}
完成工作。
我怎样才能让它工作?
答案1
如果你添加even odd rule
选项,它就会起作用。为什么?我不知道,似乎将矩形与圆形组合不需要明确修复规则
\documentclass{beamer}
\usepackage{tikz}
\tikzset{
use page relative coordinates/.style={
shift={(current page.south west)},
x={(current page.south east)},
y={(current page.north west)}
},
}
\begin{document}
\begin{frame}{title}{subtitle}
\begin{block}{Block title}
Some content
\end{block}
\includegraphics[width=0.5\textwidth]{example-image-a}
\begin{tikzpicture}[remember picture,overlay,use page relative coordinates]
\filldraw[opacity=0.5, black, even odd rule] (0,0) rectangle (1,1) (0.2,0.2) rectangle (0.38,0.6);
\end{tikzpicture}
\end{frame}
\end{document}