如何用箭头标记将文字指向方程式的周围

如何用箭头标记将文字指向方程式的周围
\documentclass{book}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage[T1,mtbold]{mathtime}
\usepackage[charter]{mathdesign}
\usepackage{tikz}
\usetikzlibrary{tikzmark}
\usetikzlibrary{arrows.meta}

\begin{document}
\definecolor{voilet}{cmyk}{.69,.93,0,0}
\begin{equation}
\tikzmarknode{t}{\mathrm{t_c}}=0.01378\left(\frac{\mathrm{\tikzmarknode{L}{L}_w\tikzmarknode{r}{r}_{ke}}}{\mathrm{{S}_w^{0.5}\tikzmarknode{w}{}}}\right)
\end{equation}
\begin{tikzpicture}[overlay,remember picture,voilet,>=Stealth,node distance=1cm,font=\scriptsize]
  \draw[Latex-] (t) -- ++ (-1,0) node[left,minimum size=.5cm] {\small{time of}\\ {concentration [hr]}};
  \draw[Latex-] (L) -- ++ (0,1) node[align=left]{\small watershed length [ft]};
  \draw[Latex-] (r) -- ++ (0,1) node[align=right] {\small Kerby coefficient [-] (Table 3-3)};
  \draw[Latex-] (w.south west) -- ++ (0,-1) node[right,xshift=3pt] {\small watershed slope [ft ft$^{-1}$]};
\end{tikzpicture}
\end{document}

所需输出:

用箭头围绕文本的方程式

答案1

在此处输入图片描述

为了在节点中写入多行文本,您需要添加到节点样式align=center和/或text width=...节点定义:

\documentclass{book}
\usepackage{amsmath}
\usepackage[T1]{fontenc}
\usepackage[T1,mtbold]{mathtime}
\usepackage[charter]{mathdesign}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,
                tikzmark}
\definecolor{voilet}{cmyk}{.69,.93,0,0}

\usepackage{lipsum}

\begin{document}
\lipsum[11]

\begin{equation}
\tikzmarknode{t}{\mathrm{t_c}}=0.01378\left(\frac{\mathrm{\tikzmarknode{L}{L}_w\tikzmarknode{r}{r}_{ke}}}{\mathrm{{S}_w^{0.5}\tikzmarknode{w}{}}}\right)
\end{equation}
~\\
    \begin{tikzpicture}[overlay,remember picture,
    color=voilet,
    >=Stealth,
    node distance=1cm, 
    lbl/.style = {align=center, font=\small}  % <--- new
                        ]
\draw[<-] (t) -- ++ (-0.5,0)    node[lbl,left]        {time of\\ concentration [hr]}; % <--- now the text is in two lines
\draw[<-] (L) -- ++ (-0.5,0.5)  node[lbl,above left]  {watershed length [ft]}; % node position is moved to left
\draw[<-] (r) -- ++ ( 0.5,0.5)  node[lbl,above right] {Kerby coefficient\\ {[-]} (Table 3-3)};% node position is moved to right
\draw[<-] (w.south west) -- ++ (0.5,-0.5)
                                node[lbl,right]       {watershed slope\\ {[ft ft$^{-1}$]}};
\end{tikzpicture}

\lipsum[12]
\end{document}

笔记:

  • 节点文本中的方括号,后面\\必须用花括号括起来。
  • tikzpicture需要额外的垂直空间,我们必须在公式前后添加(前:空行 + \vspace{2\baselineskip},后:空行)。否则,所写的标签tikzpicture将侵入公式上方和下方的文本中。

相关内容