5

In the following MWE, the strike out content is shifted horizontally and vertically. How avoid these shifts?

\documentclass{beamer}
\usepackage{mwe}
\usepackage{tikz}
\usepgflibrary{shapes.misc}
\begin{document}
\begin{frame}
  \includegraphics[width=\linewidth]{image-a}
\end{frame}
\begin{frame}
  \tikz \node [strike out,draw=red,line width=5pt]
  {\includegraphics[width=\linewidth]{image-a}};%
\end{frame}
\end{document}

enter image description here

Denis Bitouzé
  • 9,652
  • 4
  • 27
  • 85

1 Answers1

7

The bounding box adjusts to its contents, that is why your picture jumps around. In order to keep the bounding box without figuring out how much bigger it gets from the strike out command, we need to draw the red line with full transparency. Just a simple opacity=0 makes the contained node transparent as well; A way around it is to specify opacities for different aspects of the picture. There are draw opacity, fill opacity and text opacity (pgf manual sec. 23.2). We need draw opacity=0 and text opacity=1, the latter because the includegraphics is inside the text part of the node. Hence on the first frame we need the code:

\begin{frame}
\tikz \node [draw opacity=0, text opacity=1,strike out,draw=red,line width=5pt]{
  \includegraphics[width=\linewidth]{image-a}};
\end{frame}
Huang_d
  • 1,797