我所做的一切都无法让我获得一条可编译的、修饰的路径。
MWE 显示有两次尝试
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\draw[help lines] grid (3,2);
\fill [draw=red,
fill=red!20,
postaction={decorate,
decoration={raise=2pt,
text along path,
text={this, is my text asldfj some more text and yet more text to come and even more test to come this, is my text asldfj some more text and yet more text to come and even more test to come}
}}]
plot[domain=-4:4,parametric] function{t,t*t};
%% this fails too %% plot[domain=-4:4,parametric] ({t},{t*t});
\end{tikzpicture}
\end{document}
就目前情况而言,我收到错误:
Package pgf Warning: Plot data file `mwe_01.pgf-plot.table' not found. on input
line 16.
! Package pgf Error: I cannot decorate an empty path.
See the pgf package documentation for explanation.
Type H <return> for immediate help.
...
l.16 ...t[domain=-4:4,parametric] function{t,t*t};
如果我反转plot
注释掉的行,我会收到错误:
! Package PGF Math Error: Unknown function `t' (in 't').
See the PGF Math package documentation for explanation.
Type H <return> for immediate help.
...
l.17 plot[domain=-4:4,parametric] ({t},{t*t})
;
?
目前,手册让我抓狂。示例很难使用,因为很少有示例明确指出需要调用哪些库。例如,我花了很长时间才弄清楚这还\usetikzlibrary{decorations}
不够。然后我又花了 100 年才弄清楚我需要哪些装饰库。:(::::::::::::::::::::::::::::
我确信修饰参数化路径的解决方案很简单。它甚至可能在手册中记录下来。但是,搜索了很长时间后,我找不到任何对我有帮助的东西。:(
有什么建议么?
答案1
这有效:
\documentclass{article}
\usepackage{tikz}
\usetikzlibrary{decorations.pathmorphing}
\usetikzlibrary{decorations.text}
\begin{document}
\begin{tikzpicture}
\draw[help lines] grid (3,2);
\fill [draw=red,
fill=red!20,
postaction={decorate,
decoration={raise=2pt,
text along path,
text={this, is my text asldfj some more text and yet more text to come and even more test to come this, is my text asldfj some more text and yet more text to come and even more test to come}
}}]
plot[domain=-4:4,parametric] ({\x},{(\x*\x)}); % or ({\x}, {(\x)^2})
%% this fails too %% plot[domain=-4:4,parametric] ({t},{t*t});
\end{tikzpicture}
\end{document}