以下是(第 604 页):
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.text,calc}
\begin{document}
\begin{tikzpicture}[decoration={text effects along path,
text={text effects along path!}, text align=center,
text effects/.cd,
character count=\i, character total=\n,
characters={evaluate={\c=\i/\n*100;}, text along path, text=red!\c!orange},
character widths={text along path, xslant=0, yscale=1}}]
\path [postaction={decorate}, preaction={decorate,
text effects={characters/.append={yscale=-1.5, opacity=0.5,
text=gray, xslant=(\i/\n-0.5)*3}}}]
(0,0) .. controls ++(2,1) and ++(-2,-1) .. (3,4);
\end{tikzpicture}
\end{document}
我不明白为什么它不能编译,有人能帮忙吗?我的 TeX Live 已完全更新。
日志报告:
!软件包 pgfkeys 错误:我不知道您传递了“\c =\i /\n *100;”的密钥“/tikz/evaluate”,我将忽略它。也许您拼错了。
答案1
密钥evaluate
是 Tikz 库的一部分math
。我在手册中搜索时找到了它evaluate=
;其定义位于 v3.0 手册第 648 页。
添加math
到加载的库列表中,示例编译时没有错误:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{math,decorations.text,calc} % added `math' here
\begin{document}
\begin{tikzpicture}[decoration={text effects along path,
text={text effects along path!}, text align=center,
text effects/.cd,
character count=\i, character total=\n,
characters={evaluate={\c=\i/\n*100;}, text along path, text=red!\c!orange},
character widths={text along path, xslant=0, yscale=1}}]
\path [postaction={decorate}, preaction={decorate,
text effects={characters/.append={yscale=-1.5, opacity=0.5,
text=gray, xslant=(\i/\n-0.5)*3}}}]
(0,0) .. controls ++(2,1) and ++(-2,-1) .. (3,4);
\end{tikzpicture}
\end{document}