# macros that won't accept other macros as arguments

I'm trying to pass a counter to a macro that uses macros from the fp package.

I can pass hard coded values and \results from the fp package BUT if I pass the counter it complains that it is not a valid floating point value.

Is there any way to make this is work? There should be no diference between \cmd{1} and \cmd{\count0} as logically and mathematically when \count0 is 1.

I'm not sure what is going on behind the scenes but there should be some way to get it to work. This will save me trouble of having to create a \result variable that follows the counter which adds unnecessary clutter.

-
Perhaps what is the proper method of accessing a counter will help. But, it is always best to compose a fully compilable MWE that illustrates the problem including the \documentclass and the appropriate packages so that those trying to help don't have to recreate it. –  Peter Grill Mar 16 '12 at 3:25
I've tried all logical combinations of \the, \value, \arabic, \count0, {\count0} and I always get an \endcsname error. I think it has to do with how fp handles the arguments more than anything. –  Uiy Mar 16 '12 at 3:46
Without a MWE, it is really difficult to help you. So, please start from scratch (or reduce from your full code) to compose a really small example to show the problem. Personally, I have often solved my own problems in the process of reducing the amount of code actually required to reproduce the problem. –  Peter Grill Mar 16 '12 at 3:48

At face value, or as the current question stands, it seems like you're merely interested in passing counter values to "some command", which may even be macros supplied by the fp package.

Here is a minimal example of passing counter values to the fp package macros:

\documentclass{article}
\usepackage{fp}% http://ctan.org/pkg/fp
\begin{document}
\newcounter{count0} \newcounter{test}
\setcounter{count0}{5} \setcounter{test}{6}
\csname thecount0\endcsname \par
\thetest \par
\FPeval\result{clip(2*3+5*6)}\result \par
\FPeval\result{clip(2*3+\csname thecount0\endcsname*6)}\result \par
\FPeval\result{clip(2*3+5*\thetest)}\result
\end{document}


Note that if you're using count0 as a counter name, value extraction is not as simple as saying \thecount0, since macro definitions with numerals need special care. Also, \value{count0} (internal representation of count0) may be different from \csname thecount0\endcsname (the typesetting of count0), which may be different from \arabic{count0} (a fixed \arabic representation of count0).

Counters without numerals in their name are handled much easier (like test) in the above example.

-

You can't expect that a macro such as \FretDist that you defined in this question is fed to another macro so that \FretDist{3} is interpreted as the number resulting from the calculation.

An instruction such as

\FPmul\resulta{-1}{3}


tells LaTeX to store the result of the multiplication in the macro \resulta. So you can't expect that

\cmd{\FPmul\resulta{-1}{3}}


is equivalent to calling \cmd{-3}, nor hiding the calculation in another macro, say

\newcommand{\mycalc}[1]{\FPmul\resulta{-1}{#1}}


and calling \cmd{\mycalc{3}} would help. Also

\newcommand{\mycalc}[1]{\FPmul\resulta{-1}{#1}\resulta}


would not work, because \cmd must know what number to use, not the process to getting it. Depending on the definition of \cmd, saying

\FPmul\resulta{-1}{3}\cmd{\resulta}


might work. Notice that \resulta is not something to which \the, \value or \arabic might apply, nor is your \FretDist macro.

-

Without a MWE is not obvious to find a correct answer

\documentclass{scrartcl}
\usepackage{fp,tikz}
\newcount\cnt