![如何自定义 todonotes 不在边距中](https://linux22.com/image/440601/%E5%A6%82%E4%BD%95%E8%87%AA%E5%AE%9A%E4%B9%89%20todonotes%20%E4%B8%8D%E5%9C%A8%E8%BE%B9%E8%B7%9D%E4%B8%AD.png)
我想要提供带有如下注释的解决例子。
我尝试todonotes
使用以下代码进行打包
\documentclass[12pt,openany,twoside,fleqn]{book}
\usepackage{amsmath}
%\usepackage[width=16cm,height=24cm,margin=5cm]{geometry}
\usepackage[textwidth=\marginparwidth,linecolor=red,bordercolor=yellow,backgr
oundcolor=yellow]{todonotes}
\usepackage{mathspec}
\setmainfont{Tekton Pro}
\everymath{\displaystyle}
\setmathsfont(Digits,Greek,Latin){Tekton Pro}
\usepackage{siunitx}
\begin{document}
\noindent
\(V=\frac{4}{3}\pi r^{3}\)\\[2ex]
\(\frac{dV}{dr}=4\pi r^{2}\)\todo{{\fontspec{ITC Berkeley Oldstyle
Std}Differentiate $V$ with respect to $r$. Remember that $\pi$ is a
constant.}}\\[2ex]
When $ r=5$, \(\frac{dV}{dr}=4\pi\times 5^{2}\)\todo{{\fontspec{ITC Berkeley
Oldstyle Std}Substitute $r=5$}}\\[2ex]
\hspace*{3.2cm}\(=314\) (3 s.f.)\\[2ex]
So the rate of change is 314 \si{\cubic\centi\meter} per
\si{\centi\meter}\todo{{\fontspec{ITC Berkeley Oldstyle Std}Interpret the
answer with units.}}
\end{document}
编译时我得到了
我还意识到todonotes
无法在内部工作tcolorbox
,但它是目标的一部分。抱歉,这对我来说就像是多个问题合在一起。我非常乐意收到来自社区的任何帮助。
答案1
您无需做任何事todonotes
,就可以使用 TikZ overlay, remember picture
。
我没有你的字体,但添加它没有问题。
\documentclass[12pt,openany,twoside,fleqn]{book}
%\usepackage[width=16cm,height=24cm,margin=5cm]{geometry}
\usepackage{amsmath}
\usepackage{tikz}
\usetikzlibrary{positioning}
\tikzset{
mypoint/.style={
fill=red,
circle,
inner sep=1pt,
xshift=5pt, yshift=3pt
},
myblock/.style={
fill=yellow,
text width=4cm,
},
}
\usepackage{tcolorbox}
\tcbuselibrary{skins}
\tcbset{
enhanced,
colframe=gray!30,
colback=white,
boxrule=10pt,
sharp corners,
width=.65\linewidth
}
\usepackage{mathspec}
%\setmainfont{Tekton Pro}% I don't have this font
\everymath{\displaystyle}
%\setmathsfont(Digits,Greek,Latin){Tekton Pro}% I don't have this font
\usepackage{siunitx}
\begin{document}
\begin{tcolorbox}
\(\begin{aligned}
V=\frac{4}{3}\pi r^{3}\\[2ex]
\frac{dV}{dr}=4\pi r^{2}\tikz[overlay, remember picture]{\node[mypoint] (P1) {};}\\[2ex]
\end{aligned}\)
\(\begin{aligned}
\text{When } r=5\text{, } \frac{dV}{dr}&=4\pi\times 5^{2}\tikz[overlay, remember picture]{\node[mypoint] (P2) {};}\\[2ex]
&=314 \text{ (3 s.f.)}\\[2ex]
\end{aligned}\)
So the rate of change is 314 \si{\cubic\centi\meter} per
\si{\centi\meter}\tikz[overlay, remember picture]{\node[mypoint] (P3) {};}
\begin{tikzpicture}[overlay, remember picture]
\node[myblock, xshift=20em, yshift=3ex] (B1) at (P1) {Differentiate $V$ with respect to $r$. Remember that $\pi$ is a constant.};
\node[myblock] (B2) at (P2 -| B1) {Substitute $r=5$};
\node[myblock] (B3) at (P3 -| B1) {Interpret the answer with units.};
\draw[red] (P1) -- ++(1,0) |- (B1.west);
\draw[red] (P2) -- (B2.west);
\draw[red] (P3) -- (B3.west);
\end{tikzpicture}
\end{tcolorbox}
\end{document}