如何在使用“外部” tikz 库时在所有“tikzpicture”结束之前插入命令?

如何在使用“外部” tikz 库时在所有“tikzpicture”结束之前插入命令?

当我使用tikz带有库的包时external,在每个tikzpicture环境结束之前,我想插入一个命令,例如,\node at (current bounding box.south)[below=3mm]{\small\textbf{note}};但该命令不会被 pdflatex 显示。

当我清除\tikzexternalize命令时,它正常导出。请修复我的以下文档(保留\tikzexternalize)。感谢您的帮助!

\documentclass{article}
\usepackage{pgf,tikz}
\usetikzlibrary{arrows,external}
\tikzexternalize

\let\oldtikzpicture\tikzpicture
\let\endoldtikzpicture\endtikzpicture

\renewenvironment{tikzpicture}[1][]{\oldtikzpicture[#1]}{
    \node at (current bounding box.south)[below=3mm]{\small\textbf{note}};
    \endoldtikzpicture}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
\draw [line width=0.8pt] (0.,0.) circle (2.5cm);
\draw [line width=0.8pt] (0.,0.) --(0,-4);
\end{tikzpicture}
\end{document}

答案1

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows,external}% arrows is deprecated
\tikzexternalize
\tikzset{%
  every picture/.style={%
    execute at end picture={%
      \node at (current bounding box.south)[below=3mm]{\small\textbf{note}};
    },
  },
}

\begin{document}
\begin{tikzpicture}[line cap=round,line join=round,>=triangle 45,x=1.0cm,y=1.0cm]
  \draw [line width=0.8pt] (0.,0.) circle (2.5cm);
  \draw [line width=0.8pt] (0.,0.) --(0,-4);
\end{tikzpicture}
\end{document}

著名的

相关内容