I am trying to overlay a TikZpicture over my table and would like it to look like this:
My code is the following
\documentclass{scrreprt}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[pdftex]{graphicx}
\usepackage{tikz}
\usetikzlibrary{calc}
\usetikzlibrary{shapes}
\usetikzlibrary{tikzmark}
\usepackage{caption}
\usepackage{subcaption}
\usepackage{booktabs}
\usepackage {tabularx}
\usepackage{multirow}
\begin{document}
\newcommand{\newfig}[3]{\begin{subfigure}[t]{\linewidth}\centering\includegraphics[width=#1]{#2}\vspace{-4pt}\caption*{\footnotesize\centering #3}\end{subfigure}}
\newcommand{\newfigg}[3]{\begin{subfigure}[t]{\linewidth}\centering \includegraphics[height=#1]{#2}\vspace{-4pt}\caption*{\footnotesize\centering #3}\end{subfigure}}
\newcommand{\myCoord}[1]{
\tikzmark{#1}
\tikz\draw[fill=red,color=red] (pic cs:#1) circle[radius=3pt];
}
\begin{table}%
\centering
\begin{tabularx}{\textwidth}{m{0.2\linewidth}|X}
\toprule
Teilaufgabe&Lösungsvarianten\\
\midrule
Heizelement&{\begin{tabularx}{\linewidth}{X|X|X|X}
\myCoord{a}\newfig{2.2cm}{example-image.png}{elektrischer Widerstand}&
\newfig{2.2cm}{example-image.png}{Heizkartusche}&
\newfig{2.2cm}{example-image.png}{Nickelchrom-draht}&
\newfig{2.2cm}{example-image.png}{Verbrennung}
\end{tabularx}}\\
\midrule
Temperatur- messung&{\begin{tabularx}{\linewidth}{*{2}{X|}X}
\newfigg{1.3cm}{example-image.png}{Widerstands-thermometer}&
\myCoord{b}\newfigg{1.3cm}{example-image.png}{Thermistor}&
\newfigg{1.3cm}{example-image.png}{Thermoelement}
\end{tabularx}}\\
\midrule
Mischverfahren&{\begin{tabularx}{\linewidth}{*{4}{X|}X}
\centering aktiv&\multicolumn{4}{c}{passiv}\\ \midrule
\newfig{1.8cm}{example-image.png}{Mischstab}&
\newfig{1.8cm}{example-image.png}{gestufte Labyrinthmischdüse}&
\myCoord{c}\newfig{1.8cm}{example-image.png}{Linear Edge Melt Filter}&
\newfig{1.8cm}{example-image.png}{Statische Mischdüse}&
\newfig{1.8cm}{example-image.png}{Statische Mischdüse}
\end{tabularx}}\\
\bottomrule
\end{tabularx}
\begin{tikzpicture}[remember picture]
\draw[overlay,color=red] (pic cs:a) -- (pic cs:b) -- (pic cs:c);
\end{tikzpicture}
\end{table}
\end{document}
And I'm getting the following result:
I'm thankful for any help!