獨立 tikz 和記住圖片:縮放時不起作用

獨立 tikz 和記住圖片:縮放時不起作用

當我縮放 時\includestandalone[width=...],我記住的座標 (A) 不再位於正確的位置。我該如何解決這個問題?

A.tex:定義中心座標(A)的獨立 tikz

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture]
      \node at (0,0) {\includegraphics{example-image-a}};
      \node (A) at (0,0) {A};
    \end{tikzpicture}
\end{document}

Main.tex:包含獨立文件並在 (A) 處畫一個圓圈

\documentclass{book}
\usepackage{standalone}
\usepackage{tikz}
\begin{document}
  \includestandalone[width=5cm]{A}
  \begin{tikzpicture}[remember picture,overlay]
      \draw[red] (A) circle(1);
  \end{tikzpicture}
\end{document}

該圓不是以 (A) 為中心! 在此輸入影像描述

即使獨立縮放,如何保持圓以 (A) 為中心?

答案1

如果該選項是在文件中而不是在文件中[width=5cm]給出的,則該範例有效。\includegraphicsA.tex\includestandaloneMain.tex

根據 pgfmanual,文法\draw[red] (A) circle(1);很舊。較新的語法是\draw[red] (A) circle [radius=1];.

在此輸入影像描述

文件A.tex

\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[remember picture]
      \node at (0,0) {\includegraphics[width=5cm]{example-image-a}};
      \node (A) at (0,0) {A};
    \end{tikzpicture}
\end{document}

檔案Main.tex

\documentclass{book}
\usepackage{standalone}
\usepackage{tikz}
\begin{document}
  \includestandalone{A}
  \begin{tikzpicture}[remember picture,overlay]
      \draw[red] (A) circle [radius=1];
  \end{tikzpicture}
\end{document}

相關內容