独立文档中的多个 tikzpictures

独立文档中的多个 tikzpictures

我有一份standalone以下形式的文件:

\documentclass[tikz]{standalone}
%\documentclass{article}
%\usepackage{tikz}

\usetikzlibrary{positioning}

\newcommand{\tikzmark}[2]{\tikz[remember picture, baseline] \node[inner sep=0pt, outer sep=0pt, anchor=base] (#1) {#2};}

\begin{document}

\begin{tikzpicture}[remember picture]
\node (A) {
\begin{tabular}{ll}
1 & \tikzmark{two}{2} \\
3 & 4 \\
\end{tabular}};

\node[right=of A] (B) {
\begin{tabular}{ll}
5 & 6 \\
\tikzmark{seven}{7} & 8 \\
\end{tabular}};
\end{tikzpicture}
\begin{tikzpicture}[remember picture, overlay]
\draw[->] (two) -- (seven);
\end{tikzpicture}
\end{document}

article documentclass当使用而不是 时,内容可以正确显示standalone

有人能建议如何使所有的内容tikzpicture都显示出来吗?

答案1

这里只用一个就可以了tikzpicture。当然,你必须编译两次。

\documentclass[tikz]{standalone}
\usetikzlibrary{positioning}

\newcommand{\tikzmark}[2]{\tikz[remember picture, baseline] \node[inner sep=0pt, outer sep=0pt, anchor=base] (#1) {#2};}

\begin{document}

\begin{tikzpicture}[remember picture]
\node (A) {
\begin{tabular}{ll}
1 & \tikzmark{two}{2} \\
3 & 4 \\
\end{tabular}};

\node[right=of A] (B) {
\begin{tabular}{ll}
5 & 6 \\
\tikzmark{seven}{7} & 8 \\
\end{tabular}};

\draw[->] (two) -- (seven);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容