In-line Fraction with Horizontal Line (Solution)

Mark Greenberg markgreenberg at cox.net
Sun Mar 12 08:27:36 EST 2006


Thank you to Gordon, Ken Ray, Cubist, Glenn, and both Jims for your  
solutions to this problem.  With your help I was able to write script  
that produced a perfectly satisfying result.  After a few  
experiments, I went with Ken's suggestion to use TextShift, but with  
a twist.  Here's what worked:

Sample Desired Equation:  y = 3/5x + 12
(in a centered field 1 line in height)

Put "y = 3x + 12" into field QBox
Put Return & "y = 5x + 12" after field QBox

This is so the 5 is directly under the 3, since there is quite a bit  
of variation in the width of the equations.  The second equation is  
not visible to the user because of the height of the field.

Then I shrank and raised the 3 with TextSize and TextShift (-18 in my  
case, but it depends on the lineheight and font).  I set the  
TextStyle of the 3 to "Underlined" to form the dividing line.  (Good  
idea, Ken.)

Here's the twist.  I used an extreme TextShift value (-85) to move  
the 5 all the way up into the first line of the field, just under the  
dividing line.  I also changed its size to match that of the 3.

The 3 and 5 needed to be padded with a space on either side to make  
it look right.  I looks perfect, as if horizontal-line fractions are  
built right into the font.

I can send the stack (not yet finished) if anyone is interested.   
Just contact me off-list.

Thanks again.  I couldn't have done it without your help.

	Mark Greenberg



More information about the Use-livecode mailing list