注释带箭头的方框方程

注释带箭头的方框方程

我想用箭头注释方框方程内的变量(如图a),希望有人能帮助我。

我以前经常用上下括号来注释公式,但如果文字太多,公式就会被占用很大的空间(如图 b)。如果这个问题也能解决,我将不胜感激。 在此处输入图片描述

答案1

这似乎是一个工作tikzmark

\documentclass{article}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\[
\boxed{F_{\tikzmark{a}1,n}= ...}
\]

\begin{tikzpicture}[remember picture,overlay]
\draw[->] ([xshift=2pt,yshift=-1pt]pic cs:a) -- ++(-45:20pt) coordinate (aux);
\node[yshift=-8pt] at (aux) {we only consider 1 unknown.};
\end{tikzpicture}

\end{document} 

在此处输入图片描述

\boxed在前面的例子中,我使用from 来框住表达式,amsmath但如果你想要更漂亮的结果,你可以用 TikZ 构建框或使用 from 的功能tcolorbox

\documentclass{article}
\usepackage{amsmath}
\usepackage{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\tcbuselibrary{most}

\begin{document}

\[
\tcbhighmath{F_{\tikzmark{a}1,n}= ...}
\]

\begin{tikzpicture}[remember picture,overlay]
\draw[->] ([xshift=2pt,yshift=-1pt]pic cs:a) -- ++(-45:20pt) coordinate (aux);
\node[yshift=-8pt] at (aux) {we only consider 1 unknown.};
\end{tikzpicture}

\end{document} 

在此处输入图片描述

答案2

调整我的答案图形方程式:在方程式上添加文字

\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\def\calloutsym{%
  \ensurestackMath{%
  \scalebox{1.7}{\color{red}\stackunder[0pt]{\bigcirc}{\downarrow}}}%
}
\newcommand\callouttext[1]{%
  \def\stacktype{S}\renewcommand\useanchorwidth{T}\stackText%
  \stackunder{\calloutsym}{\scriptsize\Longstack{#1}}\stackMath%
}
\newcommand\callout[3][1.5pt]{%
  \def\stacktype{L}\stackMath\stackunder[#1]{#2}{\callouttext{#3}}%
}
\begin{document}
\fbox{$\displaystyle
\smash{\callout{F}{\stackunder{$1,n$}{we only consider 1 unknown}}} = 
\left[
\frac{\partial f}{\partial l_1}\quad
\frac{\partial f}{\partial l_2}\quad
\frac{\partial f}{\partial l_3}
\cdots
\frac{\partial f}{\partial l_n}
\right]
$}
\end{document}

在此处输入图片描述

如果您不喜欢“F”周围的圆圈,请删除\bigcirc,或者将向下箭头缩放得更大,如下所示:

\documentclass{article}
\usepackage{graphicx}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\def\calloutsym{%
  \ensurestackMath{%
  \scalebox{2}{\color{red}\stackunder[2pt]{}{\downarrow}}}%
}
\newcommand\callouttext[1]{%
  \def\stacktype{S}\renewcommand\useanchorwidth{T}\stackText%
  \stackunder{\calloutsym}{\scriptsize\Longstack{#1}}\stackMath%
}
\newcommand\callout[3][1.5pt]{%
  \def\stacktype{L}\stackMath\stackunder[#1]{#2}{\callouttext{#3}}%
}
\begin{document}
\fbox{$\displaystyle
\smash{\callout{F}{\stackunder{$1,n$}{we only consider 1 unknown}}} = 
\left[
\frac{\partial f}{\partial l_1}\quad
\frac{\partial f}{\partial l_2}\quad
\frac{\partial f}{\partial l_3}
\cdots
\frac{\partial f}{\partial l_n}
\right]
$}
\end{document}

在此处输入图片描述

请注意,由于我打破了底线,您可能需要一些底线\vspace来防止后续文本干扰。

相关内容