I am trying to plot a family of hyperbolas and don't want to repeat the function definition every time. So for example I have this:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=-2:2]
\draw plot ({exp(\x)+exp(-\x)}, {exp(\x)-exp(-\x)});
\end{tikzpicture}
\end{document}
But now I want to put the point in a function:
\documentclass{article}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}[domain=-2:2]
\def\hyper#1#2#3{({#1*exp(#3)+#2*exp(-#3)}, {#1*exp(#3)-#2*exp(-#3)})}
\draw plot \hyper{1}{1}{\x};
\end{tikzpicture}
\end{document}
But then I get
! Package tikz Error: Cannot parse this plotting data.
I there an easy way to use such predefined macro as a point? Or is it not possible with plot
?
I have seen Problem using macros to define tree substructures and Forcing tikz/pgf to expand macros within commands as well as pgf macro that returns a node and Programming in TikZ but I still don't understand what can be done when.
Any pointers to enlightening parts of the TikZ/PGF
manual are also welcome.