在 Tikzmarknodes 之间画线

在 Tikzmarknodes 之间画线

我试图在输出中的节点之间画一条线:

\documentclass{article}
\usepackage{tikz,amsmath}
\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{center}
$\der{}{x} \bigg [\dfrac{N(x)}{D(x)} \bigg ] = \dfrac{\tikzmarknode{1}{D(x)} 
\cdot \tikzmarknode[red]{2}{\pder{N}{x}}\tikzmarknode{3}{-}\tikzmarknode{4} 
{N(x)} \cdot \tikzmarknode[red]{5}{\pder{D}{x}}}{\tikzmarknode{6} 
{(D(x))^{2}}}$
\end{center}

\begin{tikzpicture}[overlay,remember picture,cyan!70]
\path ([yshift=0.1cm]1.north) coordinate (aux);
\foreach \X in {1,...,5}
{\draw   (\X |-aux) node[above,circle,draw,font=\small,inner sep=1pt]
(L\X){\X};}
\path ([yshift=-0.1cm]6.south) coordinate (aux);
\draw   (6 |-aux) node[below,circle,draw,font=\small,inner sep=1pt]
(L6){6};
\end{tikzpicture}

\end{document}

输出:

在此处输入图片描述

我想要得到:

在此处输入图片描述

答案1

我尝试简单地将 L 节点与路径连接起来,并且成功了,所以我很好奇我是否遗漏了你想要的某些细节。无论如何,我会发布这个,以防这是你想要的。要获得更多花哨的箭头,请查看arrows.metatikz 库。

\documentclass{article}
%\url{https://tex.stackexchange.com/q/463829/86}
\usepackage{tikz,amsmath}
\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}

\[
\der{}{x} \bigg [\dfrac{N(x)}{D(x)} \bigg ] = \dfrac{\tikzmarknode{1}{D(x)} 
\cdot \tikzmarknode[red]{2}{\pder{N}{x}}\tikzmarknode{3}{-}\tikzmarknode{4} 
{N(x)} \cdot \tikzmarknode[red]{5}{\pder{D}{x}}}{\tikzmarknode{6} 
{(D(x))^{2}}}
\]

\begin{tikzpicture}[overlay,remember picture,cyan!70]
\path ([yshift=0.1cm]1.north) coordinate (aux);
\foreach \X in {1,...,5}
{\draw   (\X |-aux) node[above,circle,draw,font=\small,inner sep=1pt]
(L\X){\X};}
\path ([yshift=-0.1cm]6.south) coordinate (aux);
\draw   (6 |-aux) node[below,circle,draw,font=\small,inner sep=1pt]
(L6){6};
\draw[-<] (L1) -- +(-1,0);
\draw (L1) -- (L2) -- (L3) -- (L4) -- (L5);
\draw[->] (L5.east) to[out=0,in=0,looseness=2] (L5.east |- L6.east) -- (L6);
\end{tikzpicture}

\end{document}

箭头连接的节点

相关内容