Am 14.10.2010 um 14:57 schrieb Mojca Miklavec: > 2010/10/14 Ulrike Fischer wrote: >> >> I don't have a context currently to try, but what would happen if >> you use it e.g. this way: >> >> \usemodule[translate] >> \translateinput[im][mm] >> >> \enableinputtranslation >> >> \starttext\tt >> \scratchdimen=2mm 2mm: \the\scratchdimen\crlf >> \scratchdimen=1im 1im: \the\scratchdimen >> immens >> \stoptext >> >> Would this replace every occurence of "im" in the input? Including >> the "im" in \scratchdimen, the "im" in the second 1im and the "im" >> in immens? > > Yes. This is why I said that the solution cannot work out-of-the-box > (it could work for a limited number of cases).
Another way is to use the string library from lua to replace μμ with mm: \unprotected\def\interfaceddimension#1% {\ctxlua{commands.interfaceddimension(\!!bs\detokenize{#1}\!!es)}} \startluacode function commands.interfaceddimension(str) if string.match(str,"\\") then -- dimension or macro else str = string.gsub(str,"μμ","mm") end tex.print(str) end \stopluacode \setupbodyfont[palatino] \starttext \def\foo{4mm} \def\bar{\textwidth} \scratchdimen\interfaceddimension{2mm} 2mm: \the\scratchdimen\crlf \scratchdimen\interfaceddimension{1μμ} 1μμ: \the\scratchdimen\crlf \scratchdimen\interfaceddimension\foo foo: \the\scratchdimen\crlf \scratchdimen\interfaceddimension\bar bar: \the\scratchdimen \stoptext Wolfgang -------------------------------------------------- Subscriptions, Archive, and List information, etc.: http://tug.org/mailman/listinfo/xetex