From: Davide P. C. <dp...@un...> - 2006-08-27 15:58:00
|
Folks: While working on my essay-answer tools, I ended up making a modified version of EV3 that I think might be more generally useful. My original intent was to include the ability to enter mathematics not in TeX form but in the answer-checker-style text strings, so that something like sin(x/(x+1)) would produce \sin\!\left(\frac{x}{x+1} \right). There are times when that would be a more convenient form. So I made a copy of EV3 called EV3P and added a feature like \(...\) and \[...\] where a text string could be passed to the Parser, and the Parser would produce the TeX form of the result. I used `...` for in-line math and ``...`` for display math (and if either is used within math mode already, it uses whatever that mode is). So you can say Suppose \(f(x) = `sin(x/(x+1))`\) is a function of `x` for example. As I was using this, I found that I wanted to be able to control which substitutions were being performed (for example, when writing an answer box that allowed students to preview an essay answer that includes mathematics, I didn't want them to be able to do command substition via \{...\}). Rather than have yet another copy of EV3, I decided to allow my new EV3P to have parameters where you could control which substitutions are done. If the first argument to EV3P is a HASH reference, this is taken to be the list of options. These include processCommands, processVariables, processMath and processParser. Using EV3P({processCommands=>0},$string) would not do command substitution, for example. Setting processParser=>0 would make EV3P functionally equivalent to EV3. The code for EVP3 is in my answerEssay.pl file (see http:// cvs.webwork.rochester.edu/viewcvs.cgi/union_problib/examples/ answerEssay/?cvsroot=Union+College). I think EV3P could be used to replace EV3 to allow another simple means of entering mathematics. (I'm also thinking of defining a parser Context in which more mathematical notation is available, like limits, sums, integrals, and so on, to make this more useful.) What do you think? You can try essay5.pg in the directory linked above to experiment with the results of EV3P. Davide |