On Thu, May 13, 2010 at 23:45, Marco
On Thu, 13 May 2010 22:58:46 +0200, Hans Hagen
wrote: On 13-5-2010 9:18, Marco wrote:
Hi,
I have a problem producing an ampersand in metapost. In ConTeXt it works as expected. Have a look at the following example.
\starttext \& % OK \startMPcode label(textext("\&"),origin); % produces error \stopMPcode \stoptext
The compile time error message is as follows: ! Misplaced alignment tab character&. l.1 \MPLIBsettext{1}{&
\letterpercent Doesn't work. I suppose you mean \letterampersand. If I change \& into \letterampersand I get exactly the same error as \& produces (BTW: \letterpercent also produces an error, but a different one).
So: - label(textext("\letterbackslash\letterampersand"),origin); - label(textext("\letterbackslash\&"),origin); This is because the commands are interpreted with TeX before they are written to mpgraph.mp. The \letterampersand or \& generates the character & alone: you need to preceed it with backslash, so that metapost finally knows what to do. Mojca PS: I would say: better use \sometxt which is far more reliable unless you have to use textext to do string manipulation.