Tikz、范围缩放和共享节点

Tikz、范围缩放和共享节点

为了在主图中包含一个小的子图,我尝试使用缩放范围。但是,当我尝试引用缩放范围之外的节点时,指向的节点位于旧的非缩放节点的位置……这是一张图片:

在此处输入图片描述

你知道如何避免这种情况吗?

谢谢 !

附言:这是我的 WME。

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}     
\usepackage{float}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric,arrows}
\usetikzlibrary{mindmap,backgrounds,positioning}
\usetikzlibrary{automata,positioning,fit,backgrounds}
\usetikzlibrary{positioning,arrows,matrix,calc}

\begin{document}

\begin{figure}[H]
  \centering
  \begin{tikzpicture}
    \begin{scope}[transform canvas={scale=1},overlay]
      \node[fill=green]   (a) {A};
      \node[fill=green,right=of a] (b) {B};
    \end{scope}
    \node[draw,below=5mm of b] (c) {C};
    \draw[<->] (c) -- (b);
  \end{tikzpicture}%
  \hspace{3cm}%
  \begin{tikzpicture}
    \begin{scope}[transform canvas={scale=0.2},overlay]
      \node[fill=green]   (a) {A};
      \node[fill=green,right=of a] (b) {B};
    \end{scope}
    \node[draw,below=5mm of b] (c) {C};
    \draw[<->] (c) -- (b);
  \end{tikzpicture}%
\end{figure}

\end{document}

答案1

也许你想要这个?

缩放和不缩放

\documentclass{report}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage[francais]{babel}
\usepackage{tikz}
\usetikzlibrary{positioning,babel}

\begin{document}

\begin{figure}
  \centering
  \begin{tikzpicture}
    \node[fill=green]   (a) {A};
    \node[fill=green,right=of a] (b) {B};
    \node[draw,below=5mm of b] (c) {C};
    \draw[<->] (c) -- (b);
  \end{tikzpicture}
  \hspace{3cm}
  \begin{tikzpicture}
    \begin{scope}[scale=0.2, every node/.append style={transform shape}]
      \node [fill=green]   (a) {A};
      \node [fill=green,right=of a] (b) {B};
    \end{scope}
    \node [draw,below=5mm of b] (c) {C};
    \draw [<->] (c) -- (b);
  \end{tikzpicture}
\end{figure}

\end{document}

相关内容