1

I am trying to change the shape of the highlighted area in the MWE below (based on this @BambOo's solution).

\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}

enter image description here

Neither

\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}

nor

\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}

does the job.

How can I get it working?

1 Answers1

2

If you add even odd rule option, it works. Why? I don't know, it seems that combining a rectangle with a circle doesn't need to explicitely fix the 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}

enter image description here

Ignasi
  • 136,588