[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: how to compare two macros in TeX?



martin f krafft <madduck@debian.org> writes:
> what's \edef compared to \def?

\edef expands its argument before defining it:

\def\foo{Foo}
\def\bar{Bar}
\def\baz{\foo\bar}
\edef\quux{\foo\bar}
\def\foo{fOO}
\def\bar{bAR}
\baz\quux\bye

Should result in fOObARFooBar: \baz's value is still \foo\bar, but
\edef\quux... expands \foo\bar, and sets \quux to the result (FooBar).

> and why do TeX people put % at the end of the line so frequently?

It inhibits a newline, for cases where you really absolutely want no
whitespace.  I'm not convinced it's absolutely necessary all the time
either, but it does seem to be common practice.

-- 
David Maze         dmaze@debian.org      http://people.debian.org/~dmaze/
"Theoretical politics is interesting.  Politicking should be illegal."
	-- Abra Mitchell



Reply to: