# How can I parse fractions in student input?

I would like to write some activities where students need to enter fractions.

I would like to be able to extract the numerator and denominator separately.

Is there any way that I can do this with a function like parseEquation(…) and parseOrderedPair(…) but for fractions?

(I can see from the documentation that there seems to be a large parsing library in the works but I’m assured that it’s not ready for prime time; in the meanwhile could perhaps a parseFraction emerge?)

add a table , you can ask your students to enter numerator and denominator separately. you will be able to see a fraction generated from Num and denominator.

CL to add on Note: content:"\\frac{${table.cellContent(2,1)}}{${table.cellContent(2,2)}}"

1 Like

What is the purpose? If it’s for correction, you can use countNumberUsage().

1 Like

Yep at the moment this is my best option, just as with coordinates before they added the option to parse.

Agree that for one off questions this is the best way.

The problem is that I want to have generalizable screens, where I can either randomly generate fractions or to specify the numerators and denominators in computation layer. But countNumberUsage only checks for constant numbers, so I don’t think you could code a general checker.