0

I want to graph the function x(t) = tan(t), -pi

Package PGF Math Error: Could not parse input '' as a floating
point number, sorry. The unreadable part was near ''. (in '$-\pi $').

as my error.

any suggestions?

cfr
  • 198,882
  • 7
    Welcome! You have the code and don't know what's wrong, but you expect us to tell you what is wrong with code we've never seen? Please provide code we can compile to reproduce the error you posted. – cfr Jan 28 '17 at 01:34

2 Answers2

7

It's hard to tell without an example of your code. My guess is you are using the pi symbol ($\pi$) rather than the pi constant (pi).

This should work:

\begin{tikzpicture}
    \begin{axis}[
        domain  = -pi/2+0.1:pi/2-0.1,
        samples = 200
    ]
    \addplot[black]{tan(deg(x))};
    \end{axis}
\end{tikzpicture}

Also see here for a more comprehensive example.

Maurizio
  • 282
  • 1
  • 6
1

Another solution with PSTricks using pst-plot and pst-math.

enter image description here

\documentclass{article}

\usepackage{pst-plot}
\usepackage{pst-math}

\begin{document}

\begin{pspicture}*(-4.5,-2)(4.5,2)
\SpecialCoor 
\psaxes[trigLabelBase=2,dx=\psPiH,xunit=\psPi,trigLabels]%
        {->}(0,0)(-2,-4.5)(2,5.5)[$x$,0][$y$,90]
\psset{algebraic=true}
\psplot[yMaxValue=6,yMinValue=-3,linewidth=1.6pt,plotpoints=2000,
        linecolor=red]{-5}{5}{tan(x)}
\psline[linestyle=dotted](-\psPiH,-5)(-\psPiH,5)
\psline[linestyle=dotted](\psPiH,-5)(\psPiH,5)
\end{pspicture}

\end{document}
Sebastiano
  • 54,118