Am 19.06.2012 um 10:59 schrieb Andreas Schneider:
On Tuesday, June 19, 2012, at 10:42 Wolfgang Schuster wrote:
Am 19.06.2012 um 10:39 schrieb Andreas Schneider:
Hello,
I'm a bit lost with macro expansion here. I try to use some macros to set the title (and subject) of the PDF document. The attached minimal example shows what I want to achieve.
I tried def, edef, gdef, define, explicit expand, expandoneafter, etc. etc. without any success. Whatever I do, the title field in the PDF metadata always contains the raw "\date..." command instead of the formatted date.
Any suggestions?
You can’t use \date (or any other unexpandable command) in an expandable context.
Wolfgang
Hmm I see, so \date is simply not possible for that case. Ok, thanks for explaining that I wasn't aware (until now) that commands can be unexpandable.
To explain it in a simple way: Commands which can be used in \edef\comecommand{…} are expandable and commands which fail in \edef are unexpandable. It’s also important to know that commands with optional arguments are always unexpandable because the underlying mechanism to check for the optional bracket, brace etc. can’t be used in \edef, you can also make a expandable command (e.g. \def\foo{FOO}) unexpandable by adding \unexpanded in front of the \def (e.g. \unexpanded\def\bar{BAR}). Wolfgang