I am writing my first LaTeX/TeX macro and not going anywhere with it. Could you please tell me what I am doing wrong in the code below.
I have the following definitions.
\def\defcolor#1#2{%
\expandafter\def\csname #1\endcsname{#2}}
\def\colortext#1#2{%
\special{ts: text fillcolor \csname#1\endcsname}{#2}%
}
I use them in my LaTeX file as follows:
\defcolor{red}{1.0,0.0,0.0}
Now when I use \red I see 1.0,0.0,0.0 in the text. Which is what I am expecting and happy to see! The problem is the \colortext command. When I call the \colortext command like the following
\colortext{red}{sometext}
I see the following output in my .dvi file
ts: text fillcolor \red
Instead of what I want
ts: text fillcolor 1.0,0.0,0.0
The \red macro is not getting expanded inside the replacement text of the \colortext macro.
How do I fix this problem?
ts: text fillcolor 1.0,0.0,0.0in dvi file. – Leo Liu Feb 5 '11 at 18:02