如何设置箭头从边距文本指向文本内部?

如何设置箭头从边距文本指向文本内部?

如何设置箭头从边距文本指向文本内部?

像下面的风格

在此处输入图片描述

平均能量损失

\documentclass{book}
\usepackage{amsmath,xcolor,marginnote}
\usepackage[skins,breakable]{tcolorbox}
\usepackage[framemethod=TikZ]{mdframed}


\begin{document}

\definecolor{cyn}{cmyk}{.15,0,0,0}
\definecolor{bl}{cmyk}{1,0.9,0.1,0}


\definecolor{org}{cmyk}{.02,.12,.15,0}
\definecolor{forg}{cmyk}{.1,.8,1,0}


\def\margintext#1{\marginnote{\noindent\hspace*{-12pt}\colorbox{cyan}{\parbox{10pc}{\noindent#1}}}}


\begin{tcolorbox}[enhanced,title=\textcolor{white}{Key Facts},sharp corners,
fonttitle=\fontfamily{\sfdefault}\bfseries,coltitle=green!25!black,colbacktitle=bl,
boxed title style={arc=0pt,outer arc=0pt,boxrule=0pt},
attach boxed title to top left={yshift=-6mm,yshifttext=-1mm},colframe=bl,colback=white,boxsep=0pt,width=27pc]
\vspace*{12pt}
From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing
\begin{equation*}
a+b+c+d\margintext{Rewrite the expression using
fractional and negative indices.}
\end{equation*}

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing
\end{tcolorbox}
\end{document}

答案1

如果您使用tikzmark,请考虑使用其命令\tikzmarknode,它允许您使用锚点等等。

\documentclass{book}
\usepackage{amsmath,xcolor,marginnote}
\usepackage[skins,breakable]{tcolorbox}
\usepackage{tikz}
\usetikzlibrary{tikzmark}

\begin{document}

\definecolor{cyn}{cmyk}{.15,0,0,0}
\definecolor{bl}{cmyk}{1,0.9,0.1,0}


\definecolor{org}{cmyk}{.02,.12,.15,0}
\definecolor{forg}{cmyk}{.1,.8,1,0}


\newcommand\margintext[2][]{\marginnote{\noindent\hspace*{-12pt}\tikzmarknode{#1}{\colorbox{cyan}{\parbox{10pc}{\noindent#2}}}}}


\begin{tcolorbox}[enhanced,title=\textcolor{white}{Key Facts},sharp corners,
fonttitle=\fontfamily{\sfdefault}\bfseries,coltitle=green!25!black,colbacktitle=bl,
boxed title style={arc=0pt,outer arc=0pt,boxrule=0pt},
attach boxed title to top left={yshift=-6mm,yshifttext=-1mm},colframe=bl,colback=white,boxsep=0pt,width=27pc]
\vspace*{12pt}
From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing
\begin{equation*}
\tikzmarknode{eq}{a+b+c+d}\margintext[M]{Rewrite the expression using
fractional and negative indices.}
\begin{tikzpicture}[overlay,remember picture]
 \draw[orange!50,thick,-latex] (M) -- (eq.east);
\end{tikzpicture}
\end{equation*}

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing
\end{tcolorbox}
\end{document}

在此处输入图片描述

答案2

您可以使用tikzmark库来执行此操作。

在此处输入图片描述

\documentclass{book}
\usepackage{amsmath,xcolor,marginnote}
\usepackage[skins,breakable]{tcolorbox}
\usepackage[framemethod=TikZ]{mdframed}
\usetikzlibrary{calc,tikzmark}

\begin{document}

\definecolor{cyn}{cmyk}{.15,0,0,0}
\definecolor{bl}{cmyk}{1,0.9,0.1,0}


\definecolor{org}{cmyk}{.02,.12,.15,0}
\definecolor{forg}{cmyk}{.1,.8,1,0}


\def\margintext#1{\marginnote{\noindent\hspace*{-12pt}\colorbox{cyan}{\parbox{10pc}{\noindent#1}}}}


\begin{tcolorbox}[enhanced,title=\textcolor{white}{Key Facts},sharp corners,
fonttitle=\fontfamily{\sfdefault}\bfseries,coltitle=green!25!black,colbacktitle=bl,
boxed title style={arc=0pt,outer arc=0pt,boxrule=0pt},
attach boxed title to top left={yshift=-6mm,yshifttext=-1mm},colframe=bl,colback=white,boxsep=0pt,width=27pc]
\vspace*{12pt}
From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing
\begin{equation*}
a+b+c+d \tikzmark{eqmark} \margintext{\tikzmark{marginmark}Rewrite the expression using
fractional and negative indices.}
\end{equation*}

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing

From the table it follows that as $x$ gets closer to $1$ from the left side
of $1,$ $f(x)$ gets closer to $3.$ Similarly, when $x$ gets closer to $1$
from the right side of $1,$ then $f(x)$ gets closer to $3.$ In cases such as
these, we say that limit of $f(x)$ as $x$ approaches to $1$ is $3,$ and we
expresses this by writing
\end{tcolorbox}

\begin{tikzpicture}[overlay,remember picture]
 %   \draw[->,red] (pic cs:marginmark) -- (pic cs:eqmark)
     \draw[-stealth,red] ($(pic cs:marginmark)+(-3pt,0)$) -- ($(pic cs:eqmark)+(3pt,4pt)$);
\end{tikzpicture}
\end{document}

相关内容