1

On page 3/7 fp package documentation we read:

%repeat last test

\ifFPtest ...\else...\fi % repeat last test

I really could not understand this. That is why I wrote a code as below to see what \ifFPtest does:

\documentclass{standalone}
\usepackage{tikz}
\usepackage[debug]{fp}
\begin{document}

\FPset\x{-2} %sets x=-2 \FPset\y{3} %sets y=3

\begin{tikzpicture} \node at ( 0,1) {$x=\x$}; \node at ( 0,2) {\ifFPtest {1}\else{2}\fi };% repeat last test \end{tikzpicture} \end{document}

But got an error: ! Undefined control sequence. l.11 \node at ( 0,2) {\ifFPtest {1}\else{2}\fi };% repeat last test ? Does anyone know what \ifFPtest does and how it works?

Aria
  • 1,523

1 Answers1

2

\ifFPtest allows you to use the result of a test later:

\documentclass{article}

\usepackage{fp}

\begin{document}

\FPset\y{3}

\FPifint\y\fi some text ... \ifFPtest yes \else no\fi

\FPset\y{3.2} \FPifint\y\fi some text ... \ifFPtest yes \else no\fi

\end{document}

Side remark: I wouldn't use tikz and standalone to test such things. Both add layers that can make it difficult to trace code and errors.

enter image description here

Ulrike Fischer
  • 327,261