无法使用 tikzmark 编译文件

无法使用 tikzmark 编译文件

在下面的示例中,我无法编译该文件,因为出现错误:

LaTeX Error: Command \tikzmark already defined. Or name \end... illegal,

你能帮我编译我的文件吗?谢谢。

以下是代码:

\documentclass{article}
\pagestyle{empty}% for cropping
\usepackage{tikz}
\usetikzlibrary{tikzmark,decorations.pathreplacing,calc}
\usepackage{amsmath,amsfonts,amssymb,amsthm}

\begin{document}
\newcommand{\tikzmark}[2]{\tikz[remember picture,baseline=(#1.base)]{\node[inner sep=0pt] (#1) {#2};}}
\begin{enumerate}
    \item First item
    \item \tikzmark{L}{Second is a much longer item}
    \item \tikzmark{I}{Third item}
    \item Fourth item
    \item Fifth item
\end{enumerate}
\begin{tikzpicture}[remember picture,overlay]
    \draw[decorate,decoration={brace}] (L.north east) -- node[right] {Noise} (L.north east |- I.south east);
\end{tikzpicture}

$\left.\begin{minipage}{5.5cm}
\begin{enumerate}
\item First item
\item Second is a much longer item
\item Third item
\end{enumerate}
\end{minipage}\right\rbrace$ Some comment

\begin{equation}
  \mathcal{L}_{\omega_{m}}=\frac{1}{8}\dfrac{FkT}{\tikzmark{startf}P_{s~av}\tikzmark{endf}}\dfrac{\omega_{o}^{2}}{\omega_{m}^{2}}\left(\dfrac{P_{in}}{\tikzmark{startg}\omega_{o}W_{e}\tikzmark{endg}}%
  + \dfrac{1}{\tikzmark{starth}Q_{unl}\tikzmark{endh}}+\dfrac{P_{sig}}{\tikzmark{starti}\omega_{o}W_{e}\tikzmark{endi}} \right)^{2} \left(1 + \dfrac{\omega_{c}}{\tikzmark{startj}\omega_{m}\tikzmark{endj}} \right)
\end{equation}

\begin{tikzpicture}[remember picture,overlay]
\foreach \Value/\Length/\Text in {%
  f/15pt/{Phase\\perturbation},%
  g/40pt/{Input power\\over\\reactive power},%
  h/20pt/{Resonator $Q$},%
  i/40pt/{Signal power\\over\\reactive power},%
  j/20pt/{Flicker\\effect}%
  }
{
\draw[decorate,decoration={brace,mirror,raise=5pt}]
  ({pic cs:start\Value}) -- coordinate (aux-\Value) ({pic cs:end\Value}|-{pic cs:start\Value});
\draw
  ([yshift=-7pt]aux-\Value) -- ++(0pt,-\Length)
  node[below,align=center] {\Text};
}
\end{tikzpicture}

\end{document} 

相关内容