方程式下的变量的自定义标记 TikZ

方程式下的变量的自定义标记 TikZ

我想这样做:(您有权选择方法)。它基本上是标记一个等式:

\begin{equation} Y\simeq Y(\lambda,\,h,\,A,\,V,\,\beta,n) \end{equation}

在此处输入图片描述

TikZ您认为这样做可行吗?

答案1

这可能不是世界上最好的风格,但你明白我的意思。需要两份汇编。

参考:http://texample.net/tikz/examples/beamer-arrows/

在此处输入图片描述

\documentclass{article} %

\usepackage{amsmath}
\usepackage{tikz}

\usetikzlibrary{arrows,shapes}
\tikzset{%
    every picture/.style={remember picture},%
    na/.style={baseline=-.5ex},%
}

\everymath{\displaystyle}

\begin{document}
\begin{equation*}       
Y \simeq Y(
    \tikz[baseline]{
        \node[fill=blue!20,anchor=base] (lambda1)
    {$\lambda$};
    },
    \tikz[baseline]{
        \node[fill=red!20,anchor=base] (h1)
    {$h$};
    },
    \tikz[baseline]{
        \node[fill=green!20,anchor=base] (A1)
    {$A$};
    },
    \tikz[baseline]{
        \node[fill=yellow!20,anchor=base] (V1)
    {$V$};
    },
    \tikz[baseline]{
        \node[fill=magenta!20,anchor=base] (beta1)
    {$\beta$};
    },
    \tikz[baseline]{
        \node[fill=cyan!20,anchor=base] (n1)
    {$n$};
    }
)
\end{equation*}
\begin{itemize}
    \item lambda blah blah
        \tikz[na]\node [coordinate] (lambda2) {};
    \item h blah blah
        \tikz[na]\node [coordinate] (h2) {};
    \item A blah blah
        \tikz[na]\node [coordinate] (A2) {};
    \item V blah blah
        \tikz[na]\node [coordinate] (V2) {};
    \item beta blah blah
        \tikz[na]\node [coordinate] (beta2) {};
    \item n blah blah
        \tikz[na]\node [coordinate] (n2) {};
\end{itemize}
\begin{tikzpicture}[overlay]
        \path[->] (lambda2) edge [bend right] (lambda1);
        \path[->] (h2)      edge [bend right] (h1);
        \path[->] (A2)      edge [bend right] (A1);
        \path[->] (V2)      edge [bend right] (V1);
        \path[->] (beta2)   edge [bend right] (beta1);
        \path[->] (n2)      edge [bend right] (n1);
\end{tikzpicture}
\end{document}

编辑:这是一个更加自动化的解决方案,尽管不是很灵活;\eqexplanation但是没有什么可以阻止您进一步定制我的命令以更好地满足您的需要。

在此处输入图片描述

\documentclass{article}

\usepackage{tikz}

\newcommand*\eqexplanation[3]{% % #1: whatever precedes the first delimiter
                                % #2: list of argument/description
                                %       (do not use "/" in description!)
                                % #3: unique identifier (choose it carefully)
    \tikzset{%
        every picture/.style={remember picture},%
        na/.style={baseline=-.5ex},%
    }
    \[
        #1%
        ( % <---- opening delimiter
        \foreach \myarg/\mydescription [count=\myargi] in #2{%
            \ifnum\myargi=1\else,\fi% print a comma for all but first element of #1
            \tikz[baseline]{\node[anchor=base] (#3A\myargi){$\myarg$};}%
        }%
        ) % <---- closing delimiter
    \]
    where
    \begin{itemize}
        \foreach \myarg/\mydescription [count=\myargi] in #2{%
            \item $\myarg$ \mydescription                   \tikz[na] \node[coordinate] (#3B\myargi) {};
        }
    \end{itemize}
    \begin{tikzpicture}[overlay]
        \foreach \myarg/\mydescription [count=\myargi] in #2{%
            \path[->] (#3B\myargi) edge[bend right] (#3A\myargi) {};%
        }
    \end{tikzpicture}
}

\begin{document}
\def\myarglist{%
    \lambda/is some wavelength,%
    h/is some height,%
    A/is some area,%
    V/is some volume,%
    \beta/is some angle,%
    n/is some integer%
}
\eqexplanation{Y \simeq Y}{\myarglist}{egreg}
\end{document}

相关内容