如何修复以下内容以text
使用动态变量在键内进行数学运算?
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.text, math, intersections}
\begin{document}
\newcommand{\adhesion}{5}
\begin{tikzpicture}
\begin{axis}[
cycle list name = color list,
]
%
\pgfplotsinvokeforeach{1, 2}{
\addplot+ [
variable = \Fbr,
postaction = {
decoration = {
text along path,
text = {$\mu = #1 + \adhesion$},
}, decorate,
},
]
{#1 - \Fbr};
}
\end{axis}
\end{tikzpicture}
\end{document}
答案1
答案2
我不知道为什么,但将数学括起来{$ $}
并在之后添加空{}
就可以了,并使我能够解析完整的数学输入。
\documentclass{article}
\usepackage{pgfplots}
\usetikzlibrary{decorations.text, math, intersections}
\begin{document}
\newcommand{\adhesion}{5}
\begin{tikzpicture}
\begin{axis}[
cycle list name = color list,
]
%
\pgfplotsinvokeforeach{1, 2}{
\addplot+ [
variable = \Fbr,
postaction = {
decoration = {
text along path,
text = {$\mu = #1 + \adhesion \sqrt{\theta}$}{},
}, decorate,
},
]
{#1 - \Fbr};
}
\end{axis}
\end{tikzpicture}
\end{document}