使用“记住”图片调整节点

使用“记住”图片调整节点

我几乎得到了我想要的东西,但我不知道如何降低 j_1 以使其与等号一致。我遗漏了什么?

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usepackage{tabularx}
\usepackage{amsmath,amssymb}

\begin{document}
\usetikzlibrary[arrows,shapes]

\begin{table}[h]
    \begin{minipage}[b]{1 \linewidth}\centering
    \begin{tabular}{ p{3cm} l}
        Principal & $P=\$100$\\
        Nominal \newline anual \newline interest rate & $j_m=5\frac{1}{2}\%=5.5\%=0.005=\tikz[remember picture] \node[] (n2) {$j_1$};$ \\
        Compounding annually, & i.e. $m=1$\tikz[remember picture] \node[] (n1) {};\\
        Frequency \newline of term & $t=5\text{ years}$
    \end{tabular}
\end{minipage}
\end{table}
\begin{tikzpicture}[remember picture, overlay]
\draw[->,very thick] (n1) to [out=45, in=270] node[below] {so} (n2);
\end{tikzpicture}

\end{document}

答案1

使用节点的基线n2作为图片的基线:

\tikz[remember picture,baseline=(n2.base)] \node[] (n2) {$j_1$};

在此处输入图片描述

代码:

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary[arrows,shapes]% <- load the libraries in the preamble
\usepackage{tabularx}
\usepackage{amsmath,amssymb}

\begin{document}
\begin{table}[h]
    \begin{minipage}[b]{1 \linewidth}\centering
    \begin{tabular}{ p{3cm} l}
        Principal & $P=\$100$\\
        Nominal \newline anual \newline interest rate & $j_m=5\frac{1}{2}\%=5.5\%=0.005=
          \tikz[remember picture,baseline=(n2.base)] \node[] (n2) {$j_1$};$ \\
        Compounding annually, & i.e. $m=1$\tikz[remember picture] \node[] (n1) {};\\
        Frequency \newline of term & $t=5\text{ years}$
    \end{tabular}
\end{minipage}
\end{table}
\begin{tikzpicture}[remember picture, overlay]
\draw[->,very thick] (n1) to [out=45, in=270] node[below] {so} (n2);
\end{tikzpicture}
\end{document}

答案2

使用 tikzmark 库:

\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\usetikzlibrary{arrows, quotes, shapes, tikzmark}
\usepackage{tabularx}
\usepackage{amsmath,amssymb}

\begin{document}
\begin{table}[h]
%    \begin{minipage}[b]{1 \linewidth}% no needed
    \centering
    \begin{tabular}{ p{3cm} l}
Principal   & $P=\$100$\\
Nominal \newline anual \newline interest rate 
            & $j_m=5\frac{1}{2}\%=5.5\%=0.005=j_1\pgfmark{a}$     \\
Compounding annually, 
            & i.e. $m=1$\pgfmark{b}\\
Frequency \newline of term 
            & $t=5\text{ years}$
    \end{tabular}
%\end{minipage}
\end{table}
\begin{tikzpicture}[remember picture, overlay]
\path[draw=red, very thick, ->] 
    ([yshift=1em]pic cs:b) to [out=60, in=240, "so"] ([shift={(-1ex,-1ex)}] pic cs:a);
\end{tikzpicture}
\end{document}

![在此处输入图片描述

相关内容