答案1
有很多可能性,这是其中之一。
\documentclass{article}
\usepackage{amsmath,xcolor}
\usepackage{tikz}
\newcommand{\tikznode}[2]{\relax
\ifmmode%
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {$%\tikznodestyle
#2$};
\else
\tikz[remember picture,baseline=(#1.base),inner sep=0pt] \node (#1) {#2};%
\fi}
\begin{document}
$\tikznode{Al}{\textcolor{cyan}{\text{Al}}}^{\tikznode{3p}{\scriptstyle
\textcolor{cyan}{3+}}}
\quad\tikznode{O}{\textcolor{red}{\text{O}}}^{\tikznode{2m}{\textcolor{red}{\scriptstyle
2-}}}_{\tikznode{dummy}{\phantom{x}}}
\longrightarrow
\text{\textcolor{cyan}{Al}}_{\textcolor{red}{2}}\textcolor{red}{\text{O}}_{\textcolor{cyan}{3}}$
\tikz[overlay,remember picture]{
\draw[-latex] (3p)--(dummy.center);
\draw[-latex] (2m)--(Al.south east);
}
\end{document}
答案2
这看起来像你喜欢的吗
以下是代码
\usepackage{tikz}
\usetikzlibrary{arrows.meta} %% Includes arrow head styles.
\begin{figure}[h]
\centering
\begin{tikzpicture}
\draw (-2,0) node[blue,left=0.02cm] {$\mathrm{Al^{3 +}}$}; %% write the Al ion
\draw (0,0) node[red,left=0.02cm] {$\mathrm{O^{2 -}}$}; %% write the O ion
\draw (3,0) node[left=0.02cm] {$\mathrm{{\color{blue}Al}_{{\color{red}2}} {\color{red}O}_{\color{blue}3}}$}; %% write the product
\draw [-{Stealth[round,scale=1.5]}] (-0.5 , 0.06) -- (-2.4 , -0.17); %% Arrow from O ion to Al ion.
\draw [-{Stealth[round,scale=1.5]}] (-2.15 , 0.06) --(-0.5 , -0.13); %% arrow from Al ion to O ion
\draw [-{Stealth[round,scale=1.5]}] (0 , 0) -- (1.7 , 0);
\end{tikzpicture}
\end{figure}
代码中的顺序\draw
是实际绘制的顺序,这意味着后者将位于前者的之上。