答案1
\mathclap
这是一个使用包的宏mathtools
和包\substack
的宏的解决方案amsmath
。(附言:包会自动mathtools
加载包。)amsmath
\documentclass{article} % or some other suitable docuemnt class
\usepackage{mathtools,xcolor}
% \usepackage{graphicx} % optional, for \rotatebox macro
\begin{document}
\[
a+b\underset{\substack{\color{red}\uparrow \\ % or: \rotatebox{90}{$\longrightarrow$}
\mathclap{\textup{\tiny commutative}} \\
\mathclap{\textup{\tiny property}}}}{=}b+a
\]
\end{document}
答案2
一个使用库的示例tikzmark
,正如我在上面的评论中提到的:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
tikzmark}
\usepackage{lipsum}
\begin{document}
\lipsum[66]
\[
a + b
\tikzmarknode[inner xsep=3pt]{A}{ = }
b + a
\begin{tikzpicture}[overlay, remember picture, shorten <=1mm,
nodes={font=\small, text=black, align=center}]
\draw[thick, red, Straight Barb-] (A.south) -- ++ (0,-1) node[below] {commutative\\ property};
\end{tikzpicture}
\vspace{17mm}
\]
\lipsum[66]
\end{document}
经过三次编译结果是:
答案3
和https://www.mathcha.io/editor做法很简单。这里有一个例子。
\documentclass[a4paper,12pt]{article}
\usepackage{tikz}
\begin{document}
\tikzset{every picture/.style={line width=0.75pt}}
\begin{tikzpicture}[x=0.75pt,y=0.75pt,yscale=-1,xscale=1]
\draw [color={rgb, 255:red, 208; green, 2; blue, 27 } ,draw opacity=1 ] (192,108) -- (192,66) ;
\draw [shift={(192,64)}, rotate = 90] [color={rgb, 255:red, 208; green, 2; blue, 27 } ,draw opacity=1 ][line width=0.75] (10.93,-3.29) .. controls (6.95,-1.4) and (3.31,-0.3) .. (0,0) .. controls (3.31,0.3) and (6.95,1.4) .. (10.93,3.29) ;
\draw (192,53) node [color={rgb, 255:red, 0; green, 0; blue, 0 } ,opacity=1 ] {$a+b=b+a$};
\draw (121,108) node [anchor=north west][inner sep=0.75pt] [align=left] {commutative property};
\end{tikzpicture}
\end{document}