Arek Kuźniewski
2007-03-06 01:05:23 UTC
Hello
I have 2 prolems:
First: I want to create a new command, which tests 2 parameters. If
parameter 1 is the same as parameter 2 i want to have the "1" otherwise
I want "0".My definition is:
\def\testit#1#2{\ifx#1#2 1\else 0\fi}
Why it not work. Why I must define it like this:
\def\testit#1#2{\def\@***@a{#1}\def\@***@b{#2}\ifx\@***@a\@***@b
1\else 0\fi}
Can I use my parameters (#1 and #2) directly in some test (\if...)
command. I don't want to use "ifthen.sty".
After all I can define my command in second way (with temporary
parameter/command definition).
The second problem is worse. I want to define command, which give me "1"
when all of parameter are "1" and "0" otherwise. The number of
parameters is unknown, so I define it like this:
%accesory commands\def\@true{1}
\def\@***@stan{1}
\def\***@test[#1]{\def\ifnum\@***@stan=1\def\@temp{#1}\ifx\@temp\@true\else\def\@***@stan{0}\fi\fi\myand}
%my commands definition\def\myand{\***@ifnextchar
[{\***@test}{\@***@stan}}
And everything is ok when I use this command in my document (between
\begin{document} and \end{document}) like this (using "1" or "0" as a
parameter):
\myand[1][1][1] %it give me "1"
\myand[1][0][1] %it give me "0"
\myand[1][0] %it give me "0"
etc.
The problem is when I try to combine \myand and \testit commands.
It looks like this:
\testit{aaa}{aaa}% give me "1"
%so
\myand[\testit{aaa}{aaa}][1][1] %should give me "1" but it give me "0".
I don't have idea why its not work?
If someone can help me? Maybe I don't understand the latex activity :( ?
Greetings, Arek
------------------------ Yahoo! Groups Sponsor --------------------~-->
Something is new at Yahoo! Groups. Check out the enhanced email design.
http://us.click.yahoo.com/kOt0.A/gOaOAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->
I have 2 prolems:
First: I want to create a new command, which tests 2 parameters. If
parameter 1 is the same as parameter 2 i want to have the "1" otherwise
I want "0".My definition is:
\def\testit#1#2{\ifx#1#2 1\else 0\fi}
Why it not work. Why I must define it like this:
\def\testit#1#2{\def\@***@a{#1}\def\@***@b{#2}\ifx\@***@a\@***@b
1\else 0\fi}
Can I use my parameters (#1 and #2) directly in some test (\if...)
command. I don't want to use "ifthen.sty".
After all I can define my command in second way (with temporary
parameter/command definition).
The second problem is worse. I want to define command, which give me "1"
when all of parameter are "1" and "0" otherwise. The number of
parameters is unknown, so I define it like this:
%accesory commands\def\@true{1}
\def\@***@stan{1}
\def\***@test[#1]{\def\ifnum\@***@stan=1\def\@temp{#1}\ifx\@temp\@true\else\def\@***@stan{0}\fi\fi\myand}
%my commands definition\def\myand{\***@ifnextchar
[{\***@test}{\@***@stan}}
And everything is ok when I use this command in my document (between
\begin{document} and \end{document}) like this (using "1" or "0" as a
parameter):
\myand[1][1][1] %it give me "1"
\myand[1][0][1] %it give me "0"
\myand[1][0] %it give me "0"
etc.
The problem is when I try to combine \myand and \testit commands.
It looks like this:
\testit{aaa}{aaa}% give me "1"
%so
\myand[\testit{aaa}{aaa}][1][1] %should give me "1" but it give me "0".
I don't have idea why its not work?
If someone can help me? Maybe I don't understand the latex activity :( ?
Greetings, Arek
------------------------ Yahoo! Groups Sponsor --------------------~-->
Something is new at Yahoo! Groups. Check out the enhanced email design.
http://us.click.yahoo.com/kOt0.A/gOaOAA/yQLSAA/dkFolB/TM
--------------------------------------------------------------------~->