グラフのノード内の方程式を参照する

グラフのノード内の方程式を参照する

私はtikzパッケージにあまり詳しくありません。インターネットであちこち読んで、これをなんとかできました

\begin{tikzpicture}
  [node distance=.8cm,
  start chain=going below,]
     \node[punktchain, join] (Telegrapher){Telegrapher's equations $\begin{aligned}
          \frac{d}{d z} {\vec V} \left(z,s\right) &=-\vec Z'(s){\vec I}\left(z,s\right) \\
       \frac{d}{d z} {\vec I} \left(z,s\right) &=-\vec Y'(s){\vec V} \left(z,s\right)\label{test}
       \end{aligned}$};
     \node[punktchain, join] (test) {test};
  \end{tikzpicture}

ノードの定義は次のようになります:

\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}
\tikzset{
>=stealth',
  punktchain/.style={
    rectangle, 
    rounded corners, 
    % fill=black!10,
    draw=black, very thick,
    text width=25em, 
    minimum height=3em, 
    text centered, 
    on chain},
  line/.style={draw, thick, <-},
  element/.style={
    tape,
    top color=white,
    bottom color=blue!50!black!60!,
    minimum width=8em,
    draw=blue!40!black!90, very thick,
    text width=10em, 
    minimum height=3.5em, 
    text centered, 
    on chain},
  every join/.style={->, thick,shorten >=1pt},
  decoration={brace},
  tuborg/.style={decorate},
  tubnode/.style={midway, right=2pt},
}

さて、私の質問は、ノードに方程式があるということです。LaTeX 内の他のすべての方程式と同じように番号を付けたい、または少なくとも参照できるようにしたいです。現在は を使用しています \label{test}が、 で参照すると、\ref{label}セクションが参照として扱われるようです。

グラフ内のノード内に組み込まれた方程式を適切に参照する方法をご存知ですか?

答え1

コメントで解決策が構築されましたが、回答として投稿されていなかったため、将来この問題に遭遇する人のために、ここに解決策を示します。この質問にコメントしたユーザーに感謝します。

参照する方程式番号が必要な場合は、equationまたはalign環境を使用しますが、デフォルトではこれは TikZ ノード内では機能しません。したがって、 をミニページ: \begin{minipage}{0.9\textwidth}...でラップする\end{minipage}と、 を使用できるようになりますalign。これで、相互参照は通常どおり機能し、 でも機能しますhyperref

また、ちょっとした注意点ですが、通常サイズの括弧を使用する場合は、 andではなく(and を使用する方が、間隔が少し広くなるので良いでしょう。)\left(\right)この郵便受け詳細については。

これを動作させるコードは次のとおりです。

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{calc,trees,positioning,arrows,chains,shapes.geometric,%
    decorations.pathreplacing,decorations.pathmorphing,shapes,%
    matrix,shapes.symbols}
\tikzset{
% ... same settings as in the question post ... 
}
\usepackage[colorlinks=true]{hyperref}
\begin{document}
\begin{tikzpicture}
  [node distance=.8cm,
  start chain=going below,]
     \node[punktchain, join] (Telegrapher){Telegrapher's equations
     % Here's the difference: a minipage and align environment
     \begin{minipage}{0.9\textwidth}
     \begin{align}
       % now, we can use \label, \ref, and \eqref as usual
       \frac{d}{d z} \vec V(z,s) &= -\vec Z'(s)\vec I(z,s) \label{test1}\\
       \frac{d}{d z} \vec I(z,s) &= -\vec Y'(s)\vec V(z,s) \label{test2}
       \end{align}
       \end{minipage}};
     % Reference from another node
     \node[punktchain, join] (test) {Test: reference to equation~\eqref{test1}.};
  \end{tikzpicture}

% References from outside the tikzpicture also work
Reference to equation~\eqref{test2}.
\end{document}

以下は PDF 出力の画像です。

ここに画像の説明を入力してください

関連情報