From: Taco Hoekwater <taco@elvenkind.com>
Subject: Re: small caps italic and font switching inside math
Date: Sun, 02 Jul 2006 16:16:36 +0200 [thread overview]
Message-ID: <44A7D544.8010301@elvenkind.com> (raw)
In-Reply-To: <6faad9f00607020459g27a9c66dteac6f4ca1474ddb4@mail.gmail.com>
Mojca Miklavec wrote:
>
>
> Seems like understanding \expandafter would solve 90% of my problems.
> I tried to understand that part in TeX book, but it's so cryptic (too
> short) ... I understand the concept, but I'm not able to write the
> code for it yet :(
The trick to \expandafter is that you (normally) write it backwards
until reaching a moment in time where TeX is not scanning an argument.
Say you have a macro that contains some stuff in it to be typeset by
\type:
\def\mystuff{Some literal stuff}
Then you begin with
\type{\mystuff}
but that obviously doesn't work, you want the final input to look like
\type{Some literal stuff}
Since \expandafter expands the token that follows the after next token
-- whatever the next token is -- you have to insert it backwards across
the opening brace of the argument, like so:
\type\expandafter{\mystuff}
But this wouldn't work, yet: you are still in the middle of an
expression (the \type expects an argument, and it gets \expandafter
as it stands).
Luckily, \expandafter *itself* is an expandable command, so you
jump back once more and insert another one:
\expandafter\type\expandafter{\mystuff}
Now you are on 'neutral ground', and can stop backtracking.
Easy, once you get the hang of it.
Taco
next prev parent reply other threads:[~2006-07-02 14:16 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-06-28 17:44 Mojca Miklavec
2006-06-28 18:33 ` Aditya Mahajan
2006-06-28 18:56 ` Taco Hoekwater
2006-06-29 2:11 ` Mojca Miklavec
2006-06-29 5:13 ` Aditya Mahajan
2006-06-29 7:27 ` Taco Hoekwater
2006-06-29 7:24 ` Taco Hoekwater
2006-06-29 7:30 ` Taco Hoekwater
2006-06-29 9:11 ` Hans Hagen
2006-06-29 9:15 ` Taco Hoekwater
2006-07-01 3:50 ` Mojca Miklavec
2006-07-01 6:52 ` Taco Hoekwater
2006-07-01 19:24 ` Mojca Miklavec
2006-07-02 8:44 ` Taco Hoekwater
2006-07-02 11:59 ` Mojca Miklavec
2006-07-02 14:16 ` Taco Hoekwater [this message]
2006-07-03 11:25 ` Vit Zyka
2006-06-28 18:54 ` Thomas A. Schmitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=44A7D544.8010301@elvenkind.com \
--to=taco@elvenkind.com \
--cc=ntg-context@ntg.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).