2

I found the perfect solution to my problem but it's using something other than Tikz. Does anyone know how to change it to tikz.

Here is the code used:

\documentclass[svgnames]{article}
\usepackage{mathtools}
\usepackage{pst-node, auto-pst-pdf}

\begin{document}

\begin{postscript} \begin{gather} x^2-\Rnode{8}{8x} + 16 \[2.5ex] x^2-\Rnode{4-4}{ 4x -4x} + 16 \end{gather} \psset{linewidth=0.6pt, linecolor=LightSteelBlue,linejoin=1, arrows=->, arrowinset=0.12, nodesepA=2pt, angleA=-90, nodesepB=1pt, angleB=90} \ncangle[offsetB=1.2em]{8}{4-4} \ncangle[offsetB=-1.2em]{8}{4-4} \end{postscript}

\end{document}

enter image description here

And the link to the original source. Showing Factorising via Tikz

  • This is pstricks code, if you use Lualatex (or dvips) you can use it directly. You juste have to remove auto-pst-pdf, \begin{postscript} and \end{postscript}. With pdflatex, its more complicated, you need shell-escape. – Manuel Cart Mar 13 '24 at 09:05
  • Unfortunately I am unfamiliar with it. But will see how it'll work for me. – Ms Thanh Mar 15 '24 at 02:37

1 Answers1

7
\documentclass[preview]{standalone}
\usepackage{mathtools}
\usepackage{tikz}
\usetikzlibrary{tikzmark, arrows.meta}
\begin{document}
\begin{gather*}
x^2-\tikzmarknode{a}{$8x$}+16\\[2.5ex]
x^2-\tikzmarknode{b}{4x}-\tikzmarknode{c}{4x}+16
\end{gather*}
\begin{tikzpicture}[overlay, remember picture]
\draw[blue!20!lightgray, thick, -{Latex[scale=0.6]}, shorten <=2pt, shorten >=2pt] (a) -- +(0,-0.4) -| (b);
\draw[blue!20!lightgray, thick, -{Latex[scale=0.6]}, shorten >=2pt] (a) +(0,-0.4) -| (c);
\end{tikzpicture}
\end{document}

Two equations with arrow between them