与 Tikzmark 对齐

与 Tikzmark 对齐

我正在尝试让我的箭笔直,并想知道我是否做得正确?

\documentclass{article}
\usepackage{tikz,amsmath,mathtools}
\usetikzlibrary{tikzmark}

 %%% Derivative Macro

\newcommand{\der}[2]{\dfrac{\mathrm{d}#1}{\mathrm{d}#2}}

 %%% Derivative Prime Notation

\newcommand{\pder}[2]{#1^{\prime}(#2)}


\begin{document}
\begin{align*}
        &\phantom{=}\tikzmarknode[red]{A1}{D(x)} \cdot \tikzmarknode[blue] 
  {A2}{\pder{N}{x}}- N(x) \cdot \pder{D}{x} \\ \\
  \pder{Q}{x}&=\dfrac{\tikzmarknode[red]{B1}{\hspace{3pt}x^{2}\hspace{3pt}} 
  \cdot \tikzmarknode[blue]{B2}{\hspace{3pt}5x^{4}\hspace{3pt}} - x^{5} 
  \cdot 2x}{(x^{2})^{2}}
 \end{align*}

\begin{tikzpicture}[overlay,remember picture]
\draw[thick,->] (A1.south)  to[out=-90, in=90] (B1.north);
\draw[thick,->] (A2.south)  to[out=-90, in=90] (B2.north);
\end{tikzpicture}
\end{document}

输出:

在此处输入图片描述

我正在尝试:

在此处输入图片描述

答案1

如果您想要获取一个节点的水平位置和另一个节点的垂直位置,请记住此操作有内置语法。

\documentclass{article}
\usepackage{tikz,amsmath,mathtools}
\usetikzlibrary{tikzmark}

 %%% Derivative Macro

\newcommand{\der}[2]{\dfrac{\mathrm{d}#1}{\mathrm{d}#2}}

 %%% Derivative Prime Notation

\newcommand{\pder}[2]{#1^{\prime}(#2)}


\begin{document}
\begin{align*}
        &\phantom{=}\tikzmarknode[red]{A1}{D(x)} \cdot \tikzmarknode[blue] 
  {A2}{\pder{N}{x}}- N(x) \cdot \pder{D}{x} \\ \\
  \pder{Q}{x}&=\dfrac{\tikzmarknode[red]{B1}{\hspace{3pt}x^{2}\hspace{3pt}} 
  \cdot \tikzmarknode[blue]{B2}{\hspace{3pt}5x^{4}\hspace{3pt}} - x^{5} 
  \cdot 2x}{(x^{2})^{2}}
 \end{align*}

\begin{tikzpicture}[overlay,remember picture]
\draw[thick,->] (B1.north |- A1.south)  -- (B1.north);
\draw[thick,->] (B2.north |- A2.south)  -- (B2.north);
\end{tikzpicture}
\end{document}

相关内容