Cross Multiplication Calculator for Unknown Numerator/Denominator

(Screenshot way below.)

\define okay() [X0123456789\.]

<style>
.edit_w {width:4em;}
table {border:none;}
tr {border:none !important;}
td {border:none !important;}
</style>

''Enter numbers in three of the cells, and enter X in one of the cells:''

<table style="nob">
<tr><td><$edit-text field="numerator1" class="edit_w"/></td><td></td><td><$edit-text field="numerator2" class="edit_w"/></td></tr>
<tr style="font-weight:bold;"><td><hr></td><td style="vertical-align:top;">=</td><td><hr></td></tr>
<tr><td><$edit-text field="denominator1" class="edit_w"/></td><td></td><td><$edit-text field="denominator2" class="edit_w"/></td></tr>
</table>

<$list variable="show" filter="=[{!!numerator1}!match[]] =[{!!numerator2}!match[]] =[{!!denominator1}!match[]] =[{!!denominator2}!match[]] +[uppercase[]] +[regexp<okay>] +[unique[]]+[count[]] +[match[4]]">

''Result:''

<$list variable="thisGuy" filter="[{!!numerator1}] [[*]] [{!!denominator2}] +[uppercase[]] +[join[ ]] +[regexp[X]]">

<$vars divider={{{ [<thisGuy>split[ ]!match[X]!match[*]] }}}>
X = <$text text={{{ [{!!numerator2}multiply{!!denominator1}divide<divider>] }}}/>
</$vars>
</$list>

<$list variable="thisGuy" filter="[{!!numerator2}] [[*]] [{!!denominator1}] +[uppercase[]] +[join[ ]] +[regexp[X]]">

<$vars divider={{{ [<thisGuy>split[ ]!match[X]!match[*]] }}}>
X = <$text text={{{ [{!!numerator1}multiply{!!denominator2}divide<divider>] }}}/>
</$vars>
</$list>

</$list>

2 Likes

If you add a class to the table, it will not be needed to use !important to get rid of the border.

<style>
.edit_w {width:4em;}
table {border:none;}
.xx tr {border:none;}
.xx td {border:none;}
</style>


<table class="xx">
....

Yup, that’s what I started out with.

Then I decided I preferred to junk up the style section and not junk up the code section, so I got rid of the class and went with !important.