3

The MWE below yields

Runaway argument?
3\pgfflt@EOI \ifpgfmathfloatparsenumberpendingperiod \pgfmathfloat@a@Mtok \ETC.
./TeX-SE.tex:29: Paragraph ended before \pgfflt@readlowlevelfloat was complete.
<to be read again> 
                   \par 

when I attempt to use the int() function as documented in the pgf manual:

enter image description here

Notes:

  • The floor plot is added just to show that the syntax is correct. So, commuting out the second \addplot produces an output.

Code:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\begin{document} \begin{tikzpicture} \begin{axis}[ axis lines=middle ] %% This works \addplot [ jump mark mid, domain=-3:3, samples=100, very thick, red ] {floor(x)}; %%% This now no work. \addplot [ jump mark mid, domain=-3:3, samples=100, very thick, red ] {int(x)}; \end{axis} \end{tikzpicture} \end{document}

Peter Grill
  • 223,288

1 Answers1

4

In case anyone else comes across this bug I am posting my workaround, until the bug is fixed. I defined

MyInt(\x)=x-mod(\x,1)

which yields:

enter image description here

Notes

Code:

\documentclass{article}
\usepackage{pgfplots}
\pgfplotsset{compat=newest}

\tikzset{ declare function={Floor(\x)=round(\x-0.5);},% floor() is broken. declare function={MyInt(\x)=x-mod(\x,1);}, }

\begin{document} \begin{tikzpicture} \begin{axis}[ xmin=-3.2, xmax=3.2, ymin=-2.2, ymax=2.2, axis lines=middle ]

\addplot [ jump mark mid, domain=-3:3, samples=100, very thick, red ] {MyInt(x)}; \end{axis} \end{tikzpicture} \end{document}

Peter Grill
  • 223,288