我知道類似的問題,但由於它們並不完全使用與我嘗試做的語法相同的語法,因此我看不出我編寫函數的方式與其他方式之間有什麼不同。這就是我想做的:
\documentclass[13pt,a4paper,headlines=6,headinclude=true]{scrartcl}
\usepackage{amsmath,amssymb,stmaryrd}
\usepackage{tikz,pgfplots}
\usetikzlibrary{datavisualization.formats.functions}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{tikzpicture}[yscale=.5, xscale=.5, scale=3.5]
\datavisualization
[school book axes,
legend={below,rows=1},
visualize as smooth line/.list={f1,f2},
f1={style=blue, style=very thick,label in legend={text=$\frac{1}{x-1}$}},
f2={style=green, style=very thick,label in legend={text=$\frac{1}{x^2 - 7x - 30}$}}
]
data [set=f1, format=function] {
var x : interval[0.5:4];
func y = 1/(\value{x}-1);
}data [set=f2, format=function] {
var x : interval[0.5:4];
func y = \frac{1}{x^2 - 7x - 30};
};
\end{tikzpicture}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
我必須改變什麼?謝謝
func y = 1/(\value x - 1)
這導致: