我想从公式内的方框画一个箭头指向公式外文本中的
特定部分(例如符号)。 箭头不应穿过文本。=
我的代码:
\documentclass[
pdftex,a4paper,11pt,oneside,fleqn,
bibliography=totoc,listof=totoc,
headlines=2.1,headsepline,
numbers=noenddot
]{scrreprt}
%%%----- Mathe ----------------------------------
\usepackage{amsmath,amsfonts,amssymb,bm}
\usepackage[squaren,textstyle]{SIunits}
\usepackage{icomma}
\usepackage{mathtools}
\usepackage[makeroom]{cancel}
\usepackage{trfsigns}
%%% ------ Formel schöner darstellen ------------
\usepackage{tcolorbox}
\tcbuselibrary{listings,theorems}
\def\mathunderline#1#2{\color{#1}\underline{{\color{black}#2}}\color{black}}
%%%--------------------------------------------------------
%%%----- Beginn Dokument ----------------------------------
\begin{document}
\begin{equation}
\tcbset{fonttitle=\scriptsize}
\begin{split}
\sigma_{\mathrm{n}} &= \sigma_{\mathrm{n}, \nu = 1} + \sigma_{\mathrm{n}, \nu = 1, \mu = 1} + \sigma_{\mathrm{n}, \mu = 1}\\
&= \Bigg( \dfrac{\hat{B}_{\delta \mathrm{s}, \nu = 1}^{2} + \hat{B}_{\delta \mathrm{r}, \mu = 1}^{2}}{4 \cdot \mu_{0}} + \dfrac{\hat{B}_{\delta \mathrm{s}, \nu = 1} \cdot \hat{B}_{\delta \mathrm{r}, \mu = 1}}{2 \cdot \mu_{0}} \Bigg) \cdot \Big( 1 + \cos \left(2 p \alpha - 2 \omega_{\mathrm{el}} t \right) \Big)\\
&= \dfrac{\hat{B}_{\delta \mathrm{s}, \nu = 1}^{2} + \hat{B}_{\delta \mathrm{r}, \mu = 1}^{2} + 2 \cdot \hat{B}_{\delta \mathrm{s}, \nu = 1} \cdot \hat{B}_{\delta \mathrm{r}, \mu = 1}}{4 \cdot \mu_{0}} \cdot \Big( 1 + \cos \left(2 p \alpha - 2 \omega_{\mathrm{el}} t \right) \Big)\\
&= \dfrac{\left( \hat{B}_{\delta \mathrm{s}, \nu = 1} + \hat{B}_{\delta \mathrm{r}, \mu = 1} \right)^{2}}{4 \cdot \mu_{0}} \cdot \Big( 1 + \cos \big(2 p \alpha - \tcboxmath[boxsep=1pt,left=2pt,right=2pt,top=1pt,bottom=1pt, colback=white,colframe=red]{2 \omega_{\mathrm{el}}} \, t \big) \Big) \, \text{.}
\end{split}
\label{eq: Radialkraftwelle_Grundwelle}
\end{equation}
Das Ergebnis für das Grundwellen-Luftspaltfeld ist eine Radialkraftwelle, die sich mit einer Frequenz von $f_{\mathrm{h}} = 2f_{\mathrm{el}}$ (1. Hauptordnung) ausbreitet.
\end{document}
答案1
您可以使用tikzmarks
它来实现这一点。它作为 Ti 的一个库提供钾Z,如果您加载了skins
库,则会自动加载tcolorbox
,无论如何您都需要它才能工作。使用此库,您可以在文本中放置标记或节点,并使用tikzpicture
具有选项的引用这些标记和节点remember picture, overlay
。例如,如果您将标记或节点放在\tikzmarknode{mynode}{some text}
文本中,则稍后可以使用类似的东西绘制一条指向此节点的线\tikz \draw (mynode) -- +(0,1);
。此技术允许您从等式中的绘制箭头\tcboxmath
到下面文本中公式的相关部分。
为了能够参考\tcboxmath
,您需要添加选项enhanced, remember as=[name]
,这些选项只有在您skins
预先加载库时才可用。
为了让箭头围绕页面上的文本,您可以使用包tikzpagenodes
来引用文本的右边缘。为了方便起见,我首先创建了一些坐标,这样可以更轻松地对齐箭头。
\documentclass[
pdftex,a4paper,11pt,oneside,fleqn,
bibliography=totoc,listof=totoc,
headlines=2.1,headsepline,
numbers=noenddot
]{scrreprt}
%%%----- Mathe ----------------------------------
\usepackage{amsmath,amsfonts,amssymb,bm}
\usepackage[squaren,textstyle]{SIunits}
\usepackage{icomma}
\usepackage{mathtools}
\usepackage[makeroom]{cancel}
\usepackage{trfsigns}
%%% ------ Formel schöner darstellen ------------
\usepackage{tcolorbox}
\tcbuselibrary{listings,theorems,skins}
\def\mathunderline#1#2{\color{#1}\underline{{\color{black}#2}}\color{black}}
\usepackage{tikzpagenodes}
\usetikzlibrary{tikzmark}
%%%--------------------------------------------------------
%%%----- Beginn Dokument ----------------------------------
\begin{document}
\begin{equation}
\tcbset{fonttitle=\scriptsize}
\begin{split}
\sigma_{\mathrm{n}} &= \sigma_{\mathrm{n}, \nu = 1} + \sigma_{\mathrm{n}, \nu = 1, \mu = 1} + \sigma_{\mathrm{n}, \mu = 1}\\
&= \Bigg( \dfrac{\hat{B}_{\delta \mathrm{s}, \nu = 1}^{2} + \hat{B}_{\delta \mathrm{r}, \mu = 1}^{2}}{4 \cdot \mu_{0}} + \dfrac{\hat{B}_{\delta \mathrm{s}, \nu = 1} \cdot \hat{B}_{\delta \mathrm{r}, \mu = 1}}{2 \cdot \mu_{0}} \Bigg) \cdot \Big( 1 + \cos \left(2 p \alpha - 2 \omega_{\mathrm{el}} t \right) \Big)\\
&= \dfrac{\hat{B}_{\delta \mathrm{s}, \nu = 1}^{2} + \hat{B}_{\delta \mathrm{r}, \mu = 1}^{2} + 2 \cdot \hat{B}_{\delta \mathrm{s}, \nu = 1} \cdot \hat{B}_{\delta \mathrm{r}, \mu = 1}}{4 \cdot \mu_{0}} \cdot \Big( 1 + \cos \left(2 p \alpha - 2 \omega_{\mathrm{el}} t \right) \Big)\\
&= \dfrac{\left( \hat{B}_{\delta \mathrm{s}, \nu = 1} + \hat{B}_{\delta \mathrm{r}, \mu = 1} \right)^{2}}{4 \cdot \mu_{0}} \cdot \Big( 1 + \cos \big(2 p \alpha - \tcboxmath[enhanced,remember as=from,boxsep=1pt,left=2pt,right=2pt,top=1pt,bottom=1pt,colback=white,colframe=red,]{2 \omega_{\mathrm{el}}} \, t \big) \Big) \, \text{.}
\end{split}
\label{eq:Radialkraftwelle_Grundwelle}
\end{equation}
Das Ergebnis für das Grundwellen-Luftspaltfeld ist eine Radialkraftwelle, die sich mit einer Frequenz von $f_{\mathrm{h}} = \tikzmarknode{to}{2f_{\mathrm{el}}}$ (1. Hauptordnung) ausbreitet.
\begin{tikzpicture}[overlay, remember picture]
\coordinate (south of from) at ([yshift=-0.25cm]from.south);
\coordinate (south of to) at ([yshift=-0.25cm]to.south);
\coordinate (text margin right) at ([xshift=0.5cm]current page text area.east);
\draw[thick, red, -stealth, rounded corners=2.5pt] (from.south) -- (south of from) --
(south of from -| text margin right) -- (south of to -| text margin right) -- (south of to) -- (to.south);
\end{tikzpicture}
\end{document}