方程中的直线

方程中的直线

您将如何编写此表达式的代码?:

在此处输入图片描述

答案1

我添加了一些示例 - 它们并不完美,但是是一个开始。

% Based on https://tex.stackexchange.com/questions/34452 and https://tex.stackexchange.com/questions/35717
% Remark: Please compile at least 2 times (otherwise the arrow position may be wrong).

\documentclass{article}
%\usepackage{amsmath}
\usepackage{tikz}
%\usetikzlibrary{calc}

\newcommand{\tikzmark}[1]{\tikz[overlay,remember picture] \node (#1) {};}

\begin{document}

\begin{equation}
  a\tikzmark{a_mark}x^2 + bx + c = 5\tikzmark{b_mark}x^2 + bx + c.
  \begin{tikzpicture}[
    overlay,
    remember picture,
    out = 315, % degree
    in = 225, % degree
    distance = 5mm,
    ]
    \draw[
        ->,
        red,
        ] (a_mark.center) to (b_mark.center);
  \end{tikzpicture}
\end{equation}

\begin{equation}
  a\tikzmark{a_mark}x^2 + bx + c = 5\tikzmark{b_mark}x^2 + bx + c.
  \begin{tikzpicture}[
    overlay,
    remember picture,
    out = 45, % degree
    in = 135, % degree
    distance = 10mm,
    ]
    \draw[
        ->,
        blue,
        ] (a_mark.center) to (b_mark.center);
  \end{tikzpicture}
\end{equation}

\begin{equation}
  a\tikzmark{a_mark}x^2 + bx + c = 5\tikzmark{b_mark}x^2 + bx + c.
  \begin{tikzpicture}[
    overlay,
    remember picture,
    out = 45, % degree
    in = 135, % degree
    distance = 10mm,
    ]
    \draw[
        ->,
        green,
        shorten > = 15pt,
        shorten < = 15pt,
        ] (a_mark.center) to (b_mark.center);
  \end{tikzpicture}
\end{equation}

\end{document}

在此处输入图片描述

或者使用tikzmark

\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark,arrows.meta,bending}
\begin{document}
\[ f(0) = \tikzmarknode{1}{1}
\foreach \X in {2,3,4}
{\;,\quad f(\the\numexpr\X-1)= \tikzmarknode{\X}{\the\numexpr2*\X-1}}
\begin{tikzpicture}[overlay,remember picture]
 \foreach \X [count=\Y] in {2,3,4}
  {\draw[-{Stealth[bend]},red!80!black] (\Y.north east) 
  to[bend left] node[above]{$+2$}
  (\X.north west);}
\end{tikzpicture}\]
\end{document}

在此处输入图片描述

答案2

带有 的短代码pstricks:每个值都为\rnode,并且这些节点通过节点连接与相关形状 ( ) 链接在一起,\ncarc上面带有标签:

\documentclass[svgnames]{article}
\usepackage{nccmath}

\usepackage{pst-node}

\begin{document}

    \[ f(0) = \rnode{1}{1},\; f(1)= \rnode{2}{3},\; f(2)= \rnode{3}{5},\; f(3)= \rnode{4}{7}
    \psset{linewidth = 0.5pt, arrows=->, arrowinset=0.15, arcangle=45, labelsep=1pt, nodesep=1pt, linecolor=IndianRed}
    \foreach \s/\t in{1/2,2/3,3/4}{\ncarc[offset=2pt]{\s}{\t}\naput{\color{IndianRed}\medmath{+2}}}\]%

\end{document} 

在此处输入图片描述

相关内容