> From: [EMAIL PROTECTED]
> Date: Mon, 2 Nov 1998 09:54:27 -0500

Hi Joel, I think you found the solution ...

> \if{#2}\empty\relax\else\leftline{\Bigtype #2}\fi}}% 
>    ^  ^....BRACKETS here around #2 are all that changes.
> 
> This ultimately explains most of what you were seeing.  When the \if tested
> #2 without brackets, it ultimately tested just X, and (for some reason I can't 
> explain) concluded it was empty, [...]

... and I found the explanation and wrote it already to Don in a
private mail.

\if#2\empty\relax

If you now insert something which starts with twice the same character
e.g. XXXDesus TeX compares the first X with the 2nd X(!), eats them 
because they are equal and returns the remainder "XDesus" and "\empty\relax"
as result. If the first two tokens of #2 are not equal then the "else"-part 
is executed and the whole string displayed :-)

Up to now this hasn't been detected because the else-part for an
empty string is nearly the same as the \relax in the then-part :-)

-- Werner






and then concluded the macro (\relax)... It 
> appears that this was tested a second time (accounting for the two X removals), 
> and then (here's the fun part), it was left with inline text "XDessus" but was 
> NOT executing your macro \titles anymore, so it just set the text as \tenrm 
> XDessus.  (TeX was just doing what TeX would do when it runs into inline text.)
> 
> By putting brackets around the argument in that setting, it appears that TeX is 
> forced to consider all of the argument to determine the logic outcome, and (when
> I ran it) it appeared to be more what you might expect.
> 
> By the way, all this can be seen by putting \tracingall% right before the first 
> instance of your macro.  A patient person can then search the resultant .log 
> file for a step-by-step record of what TeX is doing.  This is where it can be 
> seen that Tex was processing your \if test based only on the first X.
> 
> I hope the result here is just what you need.  It is possible that the \if test 
> activity has more complications than this suggestion might handle, (for 
> example)... I worry that maybe the brackets will make it always fail the test, 
> then you wouldn't have what you wanted either...  but as was once written 
> "Sufficient for the day is the trouble thereof."
> 
> Regards
> Joel Hunsberger
> [EMAIL PROTECTED]         
> 
> ______________________________ Reply Separator _________________________________
> Subject: TeX Problem
> Author:  [EMAIL PROTECTED] (Don Simons) at SMTPpost
> Date:    11/1/98 9:16 PM
> 
> 
> In the following tex file, can anyone figure out why "Dessus" and 
> "XXXDessus" come out in different fonts?  And what happened to the 
> first two X's in "XXXDessus"?
> 
> --Don Simons
> 
> ============================
> \input musixtex
> \font\BIGfont=\fontid bx10 scaled\magstep4 
> \font\Bigfont=\fontid bx10 scaled\magstep2 
> \hsize=524pt
> \vsize740pt
> \def\nbinstruments{1}
> \setstaffs11
> \setclef10
> \makeatletter%
> \def\titles#1#2{\kern-\lin@pos%
> \kern-3.2\Interligne\kern-\parindent\kern-\afterruleskip% 
> \kern-\sign@skip\vbox{\vskip#1\Interligne% 
> \if#2\empty\relax\else\leftline{\Bigtype #2}\fi}}% 
> \makeatother%
> \startmuflex\startpiece\addspace\afterruleskip% 
> \znotes\zcharnote{16}{\titles{2.0}{XXXDessus}}\en% 
> \alaligne
> \znotes\zcharnote{16}{\titles{2.0}{Dessus}}\en% 
> \Endpiece
> \vfill\eject\endmuflex
> \bye
> 
> 

Reply via email to