Tikz 记住错误页面上的图片

Tikz 记住错误页面上的图片

我想用注释注释一些方程式tikz,偶然发现了一个tikzmark使用该remember picture命令的命令。它工作正常,我可以在方程式的下方和上方绘图,但只要方程式太靠近页面末尾,“注释”就会打印在下一页上。我该如何避免这种情况?

梅威瑟:

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{tikz}
\usepackage{lipsum}
\usetikzlibrary{arrows,bending}
\newcommand{\tikzmmark}[2]{\tikz[remember picture,baseline,inner sep=0pt,outer sep=0pt,anchor=base] \node (#1) {\ensuremath{#2}};}

\begin{document}

\lipsum[1]
\begin{equation}
    J = \tikzmmark{mb}{J_2}
    \vspace{0.7cm}
\end{equation}%
\begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
    \draw (mb) ++(0,-0.3) |- ++( 1.0,-0.4) node[right] {second};
\end{tikzpicture}%
End of paragraph text.

\lipsum[2]
\vspace{0.5cm}%
\begin{equation}
    J = \tikzmmark{mb}{J_2}
\end{equation}%
\begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
    \draw (mb) ++(0,+0.3) |- ++( 1.0,+0.4) node[right] {second};
\end{tikzpicture}%
\lipsum[4]

\lipsum[5]
\vspace{0.5cm}%
\begin{equation}
    J = \tikzmmark{mb}{J_2}
\end{equation}%
\begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
    \draw (mb) ++(0,+0.3) |- ++( 1.0,+0.4) node[right] {second};
\end{tikzpicture}%
\lipsum[2]

\lipsum[4-6]

\end{document}

结果是: 方程式 3 的注释在错误页面上

答案1

为了完整起见,我自己回答了这个问题,但功劳归于敲击,他在上面的评论中发布了解决方案(4周前)。

绘图命令必须放在环境中equation,例如

\begin{equation}
    J = \tikzmmark{mb}{J_2}
        \begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
                \draw (mb) ++(0,+0.3) |- ++( 1.0,+0.4) node[right] {second};
        \end{tikzpicture}%
\end{equation}%

以确保绘图命令不会在下一页上执行。

梅威瑟:

\documentclass{article}

\usepackage[ngerman]{babel}
\usepackage{tikz}
\usepackage{lipsum}
\usetikzlibrary{arrows,bending}
\newcommand{\tikzmmark}[2]{\tikz[remember picture,baseline,inner sep=0pt,outer sep=0pt,anchor=base] \node (#1) {\ensuremath{#2}};}

\begin{document}

\lipsum[1]
\begin{equation}
    J = \tikzmmark{mb}{J_2}
    \vspace{0.7cm}%
        \begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
                \draw (mb) ++(0,-0.3) |- ++( 1.0,-0.4) node[right] {second};
        \end{tikzpicture}%
\end{equation}%
End of paragraph text.

\lipsum[2]
\vspace{0.5cm}%
\begin{equation}
    J = \tikzmmark{mb}{J_2}
        \begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
                \draw (mb) ++(0,+0.3) |- ++( 1.0,+0.4) node[right] {second};
        \end{tikzpicture}%
\end{equation}%
\lipsum[4]

\lipsum[5]
\vspace{0.5cm}%
\begin{equation}
    J = \tikzmmark{mb}{J_2}
        \begin{tikzpicture}[<-,overlay,remember picture,inner sep=1.5pt,shorten <=0.2em,font=\small]%
                \draw (mb) ++(0,+0.3) |- ++( 1.0,+0.4) node[right] {second};
        \end{tikzpicture}%
\end{equation}%
\lipsum[2]

\lipsum[4-6]

\end{document}

相关内容