Nicola thank you for taking an interest in my question. I note and understand what you write. It is, however, not altogether relevant to my question. At least I think not.
Here is a MWE of the sort of thing I want to be able to
avoid happening.
Code: Select all
\documentclass{minimal}%
%
\begin{document}
\newcommand{\firstmacro}%
{%
\newcommand{\temp}{Hello}%
\temp\par%
}%
%
\newcommand{\secondmacro}
{%
\newcommand{\temp}{World}%
\firstmacro%
\temp\par%
}%
\secondmacro%
%
\end{document}%
Running this through Latex gives the following (edited) log.
Code: Select all
! LaTeX Error: Command \temp already defined.
Or name \end... illegal, see p.192 of the manual.
See the LaTeX manual or LaTeX Companion for explanation.
Type H <return> for immediate help.
...
l.16 \secondmacro
%
?
Output written on example.dvi (1 page, 264 bytes).
Strangely if one simply does a carriage return the processing finishes with output
World
World
Thus \secondmacro proceeds by interpreting the \temp in \firstmacro as ‘local’ to \secondmacro and not to \firstmacro. I must say that the reference to p. 192 of the Manual does not clarify matters for me.
[The outcome is interesting if you put a call of \firstmacro in front of that of \secondmacro, by the way. It would seem that the first call determines to which macro \temp is local.]
The two definitions of \temp conflict. What I should wish to be able to do is to use the definition of \temp locally in \firstmicro and, so to speak, kill it off once it has done its job. I want to be able to make the two definitions of \temp local to their respective macros. Does that make better sense? I hope so. The problem seems to lie in the way that Latex interprets the source and that is what I need clarifying I suspect.
Thanks again extal