答案1
你真的需要像 TikZ 这样的大锤吗?
\documentclass{article}
\usepackage{mathtools}
\begin{document}
\begin{gather*}
x^2-8x + 16 \\[-1ex]
x^2-\overbrace{\mathstrut 4x -4x} + 16
\end{gather*}
\end{document}
如果您确实想使用图形工具,我建议使用pstricks
,即的功能pst-node
:
\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}
答案2
建议不使用tikzmark
。
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\[
\begin{array}{c}
x^2-\tikz[baseline,remember picture] \node[anchor=base,inner xsep=0pt] (1) {$8x$};+16\\[3em]
x^2-\tikz[baseline,remember picture] \node[anchor=base,inner xsep=0pt] (11) {$4x$};-\tikz[baseline,remember picture] \node[anchor=base,inner xsep=0pt] (12) {$4x$};+16
\end{array}
\]
\begin{tikzpicture}[remember picture,overlay]
\draw (1) to[out=-100,in=90] (11);
\draw (1) to[out=-80,in=90] (12);
\end{tikzpicture}
\end{document}
有些箭一定很棒!
\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\begin{document}
\[
\begin{array}{c}
x^2-\tikz[baseline,remember picture] \node[anchor=base,inner xsep=0pt] (1) {$8x$};+16\\[3em]
x^2-\tikz[baseline,remember picture] \node[anchor=base,inner xsep=0pt] (11) {$4x$};-\tikz[baseline,remember picture] \node[anchor=base,inner xsep=0pt] (12) {$4x$};+16
\end{array}
\]
\begin{tikzpicture}[remember picture,overlay,>=stealth]
\draw[->] (1) to[out=-100,in=90] (11);
\draw[->] (1) to[out=-80,in=90] (12);
\end{tikzpicture}
\end{document}
答案3
正如 Joule V 所指出的,使用标准 LaTeX 工具排版方程式可能更容易,我个人喜欢使用tikzmark
它,因为除其他外,它可以检测您当前所处的模式。
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\begin{document}
\[\begin{array}{c}
x^2 \tikzmarknode{8}{-8x} + 16\\[0.6cm]
x^2\tikzmarknode{4a}{-4x}\tikzmarknode{4b}{-4x}+16
\end{array}
\begin{tikzpicture}[overlay,remember picture]
\foreach \X in {a,b}
{\draw[-latex] (8) to[out=-90,in=90] (4\X);}
\end{tikzpicture}\]
\end{document}