add tag
topnush
Take this MWE:

```
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage[many]{tcolorbox}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage{accents}
\usepackage{listings}
\lstdefinestyle{duckstyle}{%
    moredelim=[is][\color{red}]{|}{|},
    mathescape=true,
    escapechar=@,
    basicstyle=\ttfamily,
    columns=fullflexible
}
\lstset{style=duckstyle}
\tcbuselibrary{skins}
\tcbset{
	colback=white,
}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
	shapes,
	tikzmark}
\usetikzlibrary{tikzmark,shapes.geometric}
\usetikzmarklibrary{listings} 
\usepackage[beamer,customcolors]{hf-tikz}
\begin{document}

\begin{frame}[fragile]{Majority algorithm}
\begin{tcolorbox}[colback=blue!5!white, text width=4.5cm,  left=7pt, right=10pt]
\begin{lstlisting}[basicstyle=\linespread{0.9}\ttfamily, mathescape]
\end{lstlisting}
\end{tcolorbox}
\end{frame}
\end{document}
```

It doesn't compile. But if you comment out `\usepackage[beamer,customcolors]{hf-tikz}` it does. What is causing the incompatibility and how to get round it?
Top Answer
samcarter
Just load the `hf-tikz` package earlier

```
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage[many]{tcolorbox}
\usepackage{adjustbox}
\usepackage{blindtext}
\usepackage{accents}
\usepackage{listings}
\lstdefinestyle{duckstyle}{%
    moredelim=[is][\color{red}]{|}{|},
    mathescape=true,
    escapechar=@,
    basicstyle=\ttfamily,
    columns=fullflexible
}
\lstset{style=duckstyle}

\usepackage[beamer,customcolors]{hf-tikz}
\tcbuselibrary{skins}
\tcbset{
%	arc=0pt,
%	outer arc=0pt,
	colback=white,
}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
	shapes,
	tikzmark}
\usetikzmarklibrary{listings} 

\begin{document}

\begin{frame}[fragile]
\frametitle{Majority algorithm}
\begin{tcolorbox}[colback=blue!5!white, text width=4.5cm,  left=7pt, right=10pt]
\begin{lstlisting}[basicstyle=\linespread{0.9}\ttfamily, mathescape]
test
\end{lstlisting}
\end{tcolorbox}
\end{frame}

\end{document}
```
Answer #2
user 3.14159
To answer the question of the title, as [mentioned by samcarter](https://topanswers.xyz/transcript?room=1412&id=72196#c72196), the incomatibility that is between `tikzmark` and `hf-tikz`. In more detail, both of them define a `\savepointas` command, but the definitions do not coincide. Whether this is the only problem, I do not know, but it is a problem, I think. To answer the follow-up question whether one could avoid `hf-tikz`, the answer is yes. Here is an example. To avoid that Claudio Fiandrino becomes mad at me, I use one of his other creations instead, `overlay-beamer-styles`. :smile_cat: This solution combines `\tikzmarknode` with `visible on`, both of which I use extensively and without problems so far.

```
\documentclass{beamer}
\beamertemplatenavigationsymbolsempty
\setbeamersize{text margin left=10mm,text margin right=5mm} 
\setbeamertemplate{frametitle}[default][center]
\usepackage[many]{tcolorbox}
\usepackage{listings}
\lstdefinestyle{duckstyle}{%
    moredelim=[is][\color{red}]{|}{|},
    mathescape=true,
    escapechar=@,
    basicstyle=\ttfamily,
    columns=fullflexible
}
\lstset{style=duckstyle}
\tcbuselibrary{skins}
\tcbset{colback=white}
\usetikzlibrary{arrows.meta,bending,tikzmark,overlay-beamer-styles}
% if you wish to annotate listings without modifying their source:
% \usetikzmarklibrary{listings} 
\newcommand{\Var}[1]{\ensuremath{\textcolor{varcolor}{#1}}}
\definecolor{varcolor}{RGB}{15,122,183}
\tikzset{show on/.style={inner sep=1pt,draw=purple,rounded
corners,fill=red!20,visible on=<#1>,text opacity=1}}
\begin{document}

\begin{frame}[fragile]
\frametitle{Majority algorithm}
\begin{tcolorbox}[colback=blue!5!white, text width=4.5cm,  left=7pt, right=10pt]
\begin{lstlisting}[basicstyle=\linespread{0.9}\ttfamily, mathescape]
set $\Var{A}$ = $\emptyset$
For each $\Var{i}$
  if $\Var{a_i} \in \Var{A}$
    @$
        \Var{\tikzmarknode[show on=2]{fai}{\tilde{f}_{a_i}}}
      = \Var{\tilde{f}_{a_i}} + 1$@
\end{lstlisting}
\end{tcolorbox}
\begin{tikzpicture}[remember picture, overlay,visible on=<2>]
     \draw[dashed,{Stealth[bend]}-] (fai) to [bend left]++ (4.5,0) node[right]{pft};
   \end{tikzpicture}
\end{frame}
\end{document}
```
![ani.gif](/image?hash=463e2626a496cadf5626e88cef56a145a4ed29efab707dfa2ecfffee01e131bc)

Enter question or answer id or url (and optionally further answer ids/urls from the same question) from

Separate each id/url with a space. No need to list your own answers; they will be imported automatically.