Hi, when trying to set fractions or non-square roots in Metapost figures using the Metafun macro textext (textext("\frac{a}{b}") or textext("\root a \of b")), I get the error message !Undefined control sequence $\setbox \rootbox \hbox {$\mathsurround \z @ \scriptscriptstyle {a }$}\m... in case of the root and !Missing $ inserted. <inserted text> $ <to be read again> \mathchoice l.11 $\relax ${{\mathchoice {\displaystyle a}{\textstyle a}{\scriptstyle a}{... in case of the fraction. I probably made some stupid error, but I can't seem to find it. Best regards, Sebastian
On Sun, 16 May 2004, Sebastian Sturm wrote:
when trying to set fractions or non-square roots in Metapost figures using the Metafun macro textext (textext("\frac{a}{b}") or textext("\root a \of b")), I get the error message
!Missing $ inserted.
Hello Sebastian, I don't know much about Metafun yet, but shouldn't you use math-mode for \root and \frac? Cheers, Peter -- http://pmrb.free.fr/contact/ ________________________________________________________________ FilmSearch engine with a lot of new features: http://f-s.sf.net/
Hi,
Hello Sebastian, I don't know much about Metafun yet, but shouldn't you use math-mode for \root and \frac?
oops, stupid typo. The code that didn't want to compile was textext("$\root a \of b$") and textext("$\frac{a}{b}$"), so I only forgot the math signs when writing the email. Thanks for pointing that out. Best regards, Sebastian
Hello Sebastian,
oops, stupid typo. The code that didn't want to compile was textext("$\root a \of b$") and textext("$\frac{a}{b}$"), so I only forgot the math signs when writing the email.
Well, you should post a *complete* and *minimal* examplefile showing your problem, together with the context/metafun version numbers (or logfile). This way emails like the last one can be avoided and the others can try to reproduce the problem without hassle. Patrick
Hi,
Well, you should post a *complete* and *minimal* examplefile showing your problem, together with the context/metafun version numbers (or logfile). This way emails like the last one can be avoided and the others can try to reproduce the problem without hassle.
okay, sorry for that. I've included a simple test file and the corresponding *.log files. The error message can be found in the tmpgraph.log file. I'm using the i-Installer teTeX distribution with the main TeX package dating from 2004/05/05. Best regards, Sebastian
Hello Sebastian (sorry for sending twice; this time to the list),
\startuseMPgraphic{test} draw textext("$\frac{a}{b}$"); draw textext("$\root a \of b$"); \stopuseMPgraphic
any reason you use textext here? Do you need changing labels? If not, you should use -------------------------------------------------- \startuseMPgraphic{test} draw btex $\frac{a}{b}$ etex; draw btex $\root a \of b$ etex shifted (10,10) \stopuseMPgraphic \useMPgraphic{test} -------------------------------------------------- as a workaround. But this still looks like an unwanted behaviour to me. Patrick
Hi,
any reason you use textext here? Do you need changing labels? If not, you should use [...] draw btex $\frac{a}{b}$ etex; [...]
I thought textext was just a faster version of btex ... etex and supposed that this would be the 'way to go', since it is a part of MetaFun. But I checked out the btex ... etex version and that worked out like a charm. As you can tell from my previous posts, I'm a TeX newbie, so I don't know what's wrong here (if at all), but since it's working now and there is no noticeable speed difference, I'm happy with it. So, thanks for your help and best regards, Sebastian
Hello again,
I thought textext was just a faster version of btex ... etex and supposed that this would be the 'way to go', since it is a part of MetaFun.
I guess you know now; but for the record: btex....etex does not allow any variable part in the text to be typeset. This is due to the fact that metapost scans for btex ... etex parts in the input file and creates the text in one single TeX run (preprocessing) and then executes the macros (so the texts are fixed). There are several approaches to allow texts with variable data such as %% does not work! for i=0 upto 10: btex "i is now " + decimal i etex; endfor; one of them is textext: for i=0 upto 10: textext ("i is now " + decimal i); endfor; should work (untested) Patrick
participants (3)
-
Patrick Gundlach
-
Peter Münster
-
SebastianSturm@t-online.de