<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Nice examples.<br><div><div>Am 15.10.2010 um 15:29 schrieb Philip Taylor (Webmaster, Ret'd):</div><br class="Apple-interchange-newline"><blockquote type="cite"><div><br>Keith, I don't see enough in your answer to enable me to understand<br>how you propose to resolve what seem to me to be very serious<br>problems of semantic ambiguity. Let me give a simple example,<br>using a fictitious language (Mekon) that use the basic latin character set.<br><br>Mekon defines the following translations :<br><br>\efg = \def<br>\emph = \centerline<br>\foe = \end<br>\joqvu = \input<br><br><br>File-1 contains :<br><br>%!Markup-language = Mekon<br>\joqvu File-2<br>\emph {Ifmmp xpsme !}<br>\foe<br><br>File-2 contains :<br><br>%!Markup-language = Mekon<br>\efg \emph #1{}<br>\end<br><br>When the processing engine encounters \emph at line 3 of File-1,<br>should it translate \emph into \centerline, as required by the<br>translation rules for Mekon, or should it leave it untranslated<br>so that it can reference the definition of \emph that occurs<br>at line 2 of File-2 ?<br></div></blockquote><div><span class="Apple-tab-span" style="white-space:pre"> </span>That one is simple it should translate, because it was defined.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Naturally, it is a bad idea to overload like this.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>But, since it is overload one should translate.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>If you wanted the "normal" emphasis then use: </div><br><div><font class="Apple-style-span" color="#000000"><span class="Apple-tab-span" style="white-space:pre"> </span>%!Markup-language = Mekon<br><span class="Apple-tab-span" style="white-space:pre"> </span>\joqvu File-2<br><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space: pre; "> </span>%!Markup-language = </span>normal</font></div><div><font class="Apple-style-span" color="#000000"><span class="Apple-tab-span" style="white-space:pre"> </span>\emph {Ifmmp xpsme !}</font><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><font class="Apple-style-span" color="#000000"><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space: pre; "><span class="Apple-tab-span" style="white-space: pre; "> </span>%!Markup-language = </span>M</span>ekon</font></div><div><font class="Apple-style-span" color="#000000"><span class="Apple-tab-span" style="white-space:pre"> </span>\foe<br></font></div><div><font class="Apple-style-span" color="#000000"><br></font></div><div><font class="Apple-style-span" color="#000000"><span class="Apple-tab-span" style="white-space:pre"> </span></font></div><br><blockquote type="cite"><div>And when that same processing engine is called upon to process<br>File-2, should it translate \emph as \centerline, so that it<br>is \centerline that is being defined, or should it leave it<br>untranslated and therefore it is \emph that is being defined ?<br></div></blockquote><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>O.K. This is somewhat complex.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>The way I look at it.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>1) Markup language in both cases is set to Mekon</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>2) When the parser finds \emph iot translate it to \centerline</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> <span class="Apple-tab-span" style="white-space:pre"> </span>\efg \emph #1{} becomes \def \centerline #1{}</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>3) All actions are to take place in the "normal" markup that is why it is translated</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> before being processed.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>4) It would parse O.K. since it did not find a translation for \end</div><div> and thereby reverting to the "normal" \end</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>I agree that this seems complex, but is logical. and one has to be aware or in which</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>"language" one is.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Now, lets see what happens if File-2 look different.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span> </div><div><div>File-2 contains :<br><br>\def \emph #1{}<br>\end<br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Here the result would be the same as, that \centerline is affected, since "Mekon" is still active.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"></span><span class="Apple-tab-span" style="white-space:pre"> </span>Now, if File-2 look like </div><div><span class="Apple-tab-span" style="white-space:pre"> </span>File-2 contains :</div><div><br><span class="Apple-tab-span" style="white-space:pre"> </span><span class="Apple-tab-span" style="white-space: pre; ">%!Markup-language = </span>normal</div><div><span class="Apple-tab-span" style="white-space:pre"></span><span class="Apple-tab-span" style="white-space:pre"> </span>\def \emph #1{}<br><span class="Apple-tab-span" style="white-space:pre"> </span>\end<br></div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Then, we have the normal tex effect.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>BUT, with File-1 containing :</div></div><div><div><br><span class="Apple-tab-span" style="white-space:pre"> </span>%!Markup-language = Mekon<br><span class="Apple-tab-span" style="white-space:pre"> </span>\joqvu File-2<br><span class="Apple-tab-span" style="white-space:pre"> </span>\emph {Ifmmp xpsme !}<br><span class="Apple-tab-span" style="white-space:pre"> </span>\foe<br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>\emph stays \emph as the "language" is normal.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Furthermore, \foe will trigger a undefined command error, since "normal" is active, due to</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>the switch in File-2. But, such global scope is the way of TeX.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"><span class="Apple-tab-span" style="white-space:pre"> </span></span></div></div><br><blockquote type="cite"><div><br>In other words, can we, with 100% precision, define in which<br>contexts strings should be translated and in which contexts they<br>should not, bearing in mind the fundamental ability of TeX<br>programs to change the meaning of virtually everything on<br>the fly ?<br></div></blockquote></div><br><div><span class="Apple-tab-span" style="white-space:pre"> </span>Yes, but you have to know in what "language" mode you are in.</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Like you mentioned this is a semantical problem and off the bat I can not</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>think of any way to catch a semantical error. I believe TeX can not do this.</div><div><br></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>regards</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>Keith.</div><div><br></div></body></html>