\tikzmark 根据帧顺序工作异常

\tikzmark 根据帧顺序工作异常

使用 \tikzmark 时,我遇到了非常奇怪的行为,其行为会根据两个帧的顺序而变化。我有一个 MWE(???- 不是那么简单,因为我想保留那些幻灯片上的内容,因为我不确定是什么导致了问题)... 以下顺序产生了我想要的正确行为,如第一张图片所示:

\documentclass[table,xcolor=pdftex,dvipsnames]{beamer} % uncomment this for presentation

\usepackage{tikz}
\usepackage[absolute,overlay]{textpos}
\usepackage{textcomp}
\usepackage{xcolor}
\usepackage{attachfile}
\usepackage{scrextend}
\usepackage{soul}

\usetikzlibrary{shapes%
    ,backgrounds %
    ,fit %
    ,positioning %
    ,bending%
    ,tikzmark%
}
\begin{document}

%---This is for highlighting text on overlays ----
\sethlcolor{yellow}
\renewcommand<>{\hl}[1]{\only#2{\beameroriginal{\hl}}{#1}}
\makeatletter
\newcommand\SoulColor{%
  \let\set@color\beamerorig@set@color
  \let\reset@color\beamerorig@reset@color}
\makeatother
\SoulColor
%Usage: \hl<2>{...} highlights the text on overlay 2
%-------

%This is to circle text
\newcounter{nodemarkers}
\newcommand\circletext[1]{%
    \tikz[overlay,remember picture] 
        \node (marker-\arabic{nodemarkers}-a) at (0,1.5ex) {};%
    #1%
    \tikz[overlay,remember picture]
        \node (marker-\arabic{nodemarkers}-b) at (0,0){};%
    \tikz[overlay,remember picture,inner sep=1.5pt]
        \node[draw,ellipse,red, thick, fit=(marker-\arabic{nodemarkers}-a.center) (marker-\arabic{nodemarkers}-b.center)] {};%
    \stepcounter{nodemarkers}%
}

\begin{frame}[fragile,t]
   \frametitle{UniProt in RDF -- What does the data look like?}


\begin{itemize}
    \item<1-> UniProt accession for the human CYP51 protein -- Q16850
    \item<1-> Encode it as RDF: \textattachfile{Q16850.rdf}{{\textcolor{blue}{http://purl.uniprot.org/uniprot/Q16850.rdf}}}
    \item<2-> XML/RDF format
    \begin{addmargin}[2em]{0em}\tiny
        $<$rdf:Description  \hl<2->{rdf:about}="http://purl.uniprot.org/citations/\tikzmark{a}8619637"$>$ \\
        $<$\tikzmark{b}rdf:type \hl<2->{rdf:resource}="http://purl.uniprot.org/core/\tikzmark{c}Journal\_Citation"/$>$\\
        $<$title$>$The ubiquitously expressed human CYP51 encodes lanosterol 14 alpha-demethylase, a cytochrome P450 whose expression is regulated by oxysterols.$<$/title$>$ \\
        $<$author$>$Stroemstedt M.$<$/author$>$ \\
        $<$author$>$Rozman D.$<$/author$>$ \\
        $<$author$>$Waterman M.R.$<$/author$>$ \\
        $<$skos:exactMatch rdf:resource="http://purl.uniprot.org/pubmed/8619637"/$>$ \\
        $<$/rdf:Description$>$  
    \end{addmargin}
    \item<3-> This can be shown as a table $<$Subject, Predicate, Object $>$
\end{itemize}

\only<2->{\protect
%
\begin{tikzpicture}[remember picture,overlay]
  \node [right=2.5cm,above=0.5cm,minimum width=0pt] at (pic cs:a) (A) {};
  \node[right=0.5cm of A] (A1) {\small \alert{Subject}};
  \draw [<-,red,thick] ([yshift=5pt,xshift=5pt]{pic cs:a}) to ([xshift=3pt,yshift=-4pt]{A1});
%
  \node [right=1cm,below=0.5cm,minimum width=0pt] at (pic cs:b) (B) {};
  \node[left=0.2cm of B] (B1) {\small \alert{Predicate}}; 
  \draw [<-,red,thick] ([xshift=15pt]{pic cs:b}) to (B1);
%
  \node [right=2.5cm,below=0.8cm,minimum width=0pt] at (pic cs:c) (C) {};
  \node[right=0.5cm of C] (C1) {\small \alert{Object}}; 
  \draw [<-,red,thick] ([xshift=15pt]{pic cs:c}) to (C1);
\end{tikzpicture}
}
\end{frame}


%
%This slide contains an example from IMDb
%
\begin{frame}[fragile]
   \frametitle{RDF Example Instance}

\tikzset{
every picture/.style={remember picture,baseline},
every node/.style={
  inner sep=0pt,
  anchor=base,
 minimum width=1.8cm,
 align=center,
 text depth=.25ex,
 outer sep=1.5pt},
every path/.style={
  thick, 
  rounded corners
  }
}  

\hspace{2cm}{\tiny 
Prefixes: {\texttt mdb=http://data.linkedmdb.org/resource/; 
geo=http://sws.geonames.org/ \\
\hspace{2.9cm}bm=http://wifo5-03.informatik.uni-mannheim.de/bookmashup/ \\ \vspace{-1em}
\hspace{2.9cm}lexvo=http://lexvo.org/id/;wp=http://en.wikipedia.org/wiki/
}}

\centering

\scalebox{0.52}{
\begin{tabular}{|l|l|l|c|} \hline
Subject & Predicate & Object \\ \hline
\tikzmark{a} \circletext{mdb: film/2014} & rdfs:label & \circletext{``The Shining''}\tikzmark{b} \\
mdb:film/2014 & movie:initial\_release\_date &  ``1980-05-23''' \\
mdb:film/2014 & movie:director & mdb:director/8476 \\
mdb:film/2014  &  movie:actor & mdb:actor/29704 \\
mdb:film/2014 & movie:actor & \circletext{mdb: actor/30013}\tikzmark{c} \\
mdb:film/2014  &  movie:music\_contributor & mdb: music\_contributor/4110 \\
mdb:film/2014  &  foaf:based\_near & geo:2635167 \\
mdb:film/2014  &  movie:relatedBook & bm:0743424425 \\
mdb:film/2014  &  movie:language & lexvo:iso639-3/eng \\
mdb:director/8476 & movie:director\_name & ``Stanley Kubrick'' \\
mdb:film/2685   &  movie:director & mdb:director/8476 \\
mdb:film/2685  &  rdfs:label & ``A Clockwork Orange'' \\
mdb:film/424  &  movie:director & \circletext{mdb:director/8476}\tikzmark{d} \\
mdb:film/424   &  rdfs:label & ``Spartacus'' \\
\hline
 \end{tabular}

%
%Labels on the sides
%
\begin{tikzpicture}[remember picture,overlay]
  \node [left=3cm,below=0.5cm,minimum width=0pt] at (pic cs:a) (A) {};
  \node[left=2cm of A] (A1) {\Huge \alert{URI}};
  \draw [<-,red,thick] ([xshift=-15pt]{pic cs:a}) to (A1);

%
  \node [right=6cm,below=0.5cm,minimum width=0pt] at (pic cs:b) (B) {};
  \node[right=4cm of B] (B1) {\Huge \alert{Literal}}; 
  \draw [<-,out=5,in=180,red,thick] ([xshift=15pt]{pic cs:b}) to (B1);
%  
  \node [right=5cm,below=1.5cm,minimum width=0pt] at (pic cs:c) (C) {};
  \node[right=4cm of C] (C1) {\Huge \alert{URI}}; 
  \draw[<-,red,thick] ([xshift=15pt]{pic cs:c}) to (C1);
  \draw[<-,red,thick] ([xshift=15pt,yshift=7pt]{pic cs:d}) to (C1);

\end{tikzpicture}
}

\end{frame}


\end{document}

但如果我改变帧的顺序,那么第二帧就会完全错误,如第二张图片所示。我不知道哪里出了问题,如果能得到帮助,我将不胜感激。

图片1图片2

答案1

\tikzmark在两个框架中使用不同的标签。在两个框架中,您都有标签abc。这些标签会从一次运行记住,直到下一次使用该aux文件。后一个定义取代前一个定义。

相关内容