wombats-writing-code / fbw-components

Fly-by-Wire components for building user interfaces
http://fbw.mit.edu
MIT License
0 stars 1 forks source link

Math/TeX editing workflow #5

Closed chadlieberman closed 8 years ago

chadlieberman commented 8 years ago

Could we please try to make the authoring with TeX a bit smoother?

When authoring questions for College Algebra in particular, but also with Accounting, there is a lot of math. As I understand it and have been using it, the workflow for entering any math involves: (1) Clicking the math editor button (2) Deleting the automatically populated content (3) Writing the TeX (4) Clicking OK (5) Wrestling with the rich text editor to position the cursor properly after the included TeX This process is painful and time consuming. It probably more than doubles the time it takes to author questions.

It would be best if we could just author TeX directly into the editor like:

( y = x^2 + 2x - 10 )

This is the way we had it set up in Qualtrics and it worked well for us. There are a few options in terms of when to render the TeX then: (1) queue it in MathJax on blur (2) don't render it in the modal, only in the main display I'm happy with either of these approaches. I'm not sure if Dipa has a preference.

coleshaw commented 8 years ago

Chad, I think what you are asking for is “power user” mode. You can do this already in the modal by just putting in raw HTML. You have to format it somewhat like:

\(x = {-b \pm \sqrt{b^2-4ac} \over 2a}\)

Note that it must be wrapped in a

tag, and then a then escaped with ( and ) (to get the iFrame to render correctly later).

You would be responsible for making sure that HTML is correct, to not break any further rendering.

Does that work as an option?

El may 26, 2016, a las 10:09 AM, Chad Lieberman notifications@github.com escribió:

Could we please try to make the authoring with TeX a bit smoother?

When authoring questions for College Algebra in particular, but also with Accounting, there is a lot of math. As I understand it and have been using it, the workflow for entering any math involves: (1) Clicking the math editor button (2) Deleting the automatically populated content (3) Writing the TeX (4) Clicking OK (5) Wrestling with the rich text editor to position the cursor properly after the included TeX This process is painful and time consuming. It probably more than doubles the time it takes to author questions.

It would be best if we could just author TeX directly into the editor like ( y = x^2 + 2x - 10 ). This is the way we had it set up in Qualtrics and it worked well for us. There are a few options in terms of when to render the TeX then: (1) queue it in MathJax on blur (2) don't render it in the modal, only in the main display I'm happy with either of these approaches. I'm not sure if Dipa has a preference.

— You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub https://github.com/wombats-writing-code/fbw-components/issues/5

chadlieberman commented 8 years ago

I have been doing that sometimes. It is probably a little faster than using the editor. I understand why you want to use the rich text editor --- it's probably better for general purpose. If we need to create a lot of items though, I think it is worth trying to streamline the process and customize it a bit for ourselves.

Do you post the raw HTML when the question is created/edited? I could write a simple function to parse the raw HTML and substitute the appropriate span tags in the right places. I know this is hacky... but just consider that we have to do this process 1200 times over. A little goes a long way.

coleshaw commented 8 years ago

Yes, we post raw HTML, but I’m unclear about your suggestion — that assumes that every text field includes TeX? Probably true for college algebra, partially true for accounting, and I’m not sure how true that is for CAD.

Unfortunately, I think we have to use the rich text editor for accounting and CAD, given that non-Chad people will be authoring (and accounting has stuff like images / tables / etc.).

Another alternative is, if you don’t mind coding a bit and using the command line, I can send you a script that I use to bulk upload stuff from a .json file, and you can modify it to fit your needs. I think any UI-based tool (even if not using the rich text editor) will be slower than script, so I’d rather not waste time modifying the rich text editor only to still have it be slower than you’d like. Of course, as with any bulk script, you run the risk then of having 1) duplicate items or 2) deleting the wrong things (if someone else is also authoring into college algebra). I typically only use the script to seed data, not modify stuff on an ongoing basis, so you’ll have to manage that process yourself.

El may 26, 2016, a las 10:29 AM, Chad Lieberman notifications@github.com escribió:

I have been doing that sometimes. It is probably a little faster than using the editor. I understand why you want to use the rich text editor --- it's probably better for general purpose. If we need to create a lot of items though, I think it is worth trying to streamline the process and customize it a bit for ourselves.

Do you post the raw HTML when the question is created/edited? I could write a simple function to parse the raw HTML and substitute the appropriate span tags in the right places. I know this is hacky... but just consider that we have to do this process 1200 times over. A little goes a long way.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/wombats-writing-code/fbw-components/issues/5#issuecomment-221887506

chadlieberman commented 8 years ago

Well, my suggestion was to just run a regex replace on ( content ) and turn it into <span class="math-tex">content</span> on all of the raw HTML before posting. But in the process of inspecting what happens in the rich text editor when I write something like ( y = 3x^2 ) -- to check if anything is escaped -- it seems that the MathJax is rendering that content! I am 99% sure I tried this the other day and it didn't work, but it seems to work. In any case, this is great news! I will just do what I wanted to do from the beginning I guess. I'll let you know if anything goes wrong, but for now, I will close.

coleshaw commented 8 years ago

Hm….okay, I’m not sure I would expect that to render properly…so if you still run into issues, feel free to re-open and we can discuss alternatives.

Another idea would be to just make MathJax try to render everything (even without the special span), it just might load some content slower that doesn’t have TeX in it.

El may 26, 2016, a las 11:07 AM, Chad Lieberman notifications@github.com escribió:

Well, my suggestion was to just run a regex replace on ( content ) and turn it into content on all of the raw HTML before posting. But in the process of inspecting what happens in the rich text editor when I write something like ( y = 3x^2 ) -- to check if anything is escaped -- it seems that the MathJax is rendering that content! I am 99% sure I tried this the other day and it didn't work, but it seems to work. In any case, this is great news! I will just do what I wanted to do from the beginning I guess. I'll let you know if anything goes wrong, but for now, I will close.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/wombats-writing-code/fbw-components/issues/5#issuecomment-221899037

coleshaw commented 8 years ago

(that might be the same as your option 1 from your initial comment)

El may 26, 2016, a las 11:19 AM, Cole Shaw cjshaw@mit.edu escribió:

Hm….okay, I’m not sure I would expect that to render properly…so if you still run into issues, feel free to re-open and we can discuss alternatives.

Another idea would be to just make MathJax try to render everything (even without the special span), it just might load some content slower that doesn’t have TeX in it.

El may 26, 2016, a las 11:07 AM, Chad Lieberman <notifications@github.com mailto:notifications@github.com> escribió:

Well, my suggestion was to just run a regex replace on ( content ) and turn it into content on all of the raw HTML before posting. But in the process of inspecting what happens in the rich text editor when I write something like ( y = 3x^2 ) -- to check if anything is escaped -- it seems that the MathJax is rendering that content! I am 99% sure I tried this the other day and it didn't work, but it seems to work. In any case, this is great news! I will just do what I wanted to do from the beginning I guess. I'll let you know if anything goes wrong, but for now, I will close.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/wombats-writing-code/fbw-components/issues/5#issuecomment-221899037

chadlieberman commented 8 years ago

Well... I'm back. It appears that entering TeX directly into the editor works only if there was previously some TeX included in that element via the math editor. I'm guessing that the element gets added to the MathJax queue when that happens, so the element is then "MathJax-enabled".

I am open to having MathJax try to render everything. I think 95%+ of our content will have some math in it -- that is to say, have it render everything, but maybe not in the modal? This has us back to choosing between (1) and (2) of initial comment.

coleshaw commented 8 years ago

Okay, give it a shot now. It tries to render MathJax on every input field, regardless of what is there. You just have to use TeX like ( blah blah ) to enclose your text. For example, the Quadratic Inequality question you put in renders properly for me, even though it appears like you didn’t use the editor’s MathJax plugin and just typed in the text inline.

El may 26, 2016, a las 11:20 AM, Chad Lieberman notifications@github.com escribió:

Well... I'm back. It appears that entering TeX directly into the editor works only if there was previously some TeX included in that element via the math editor. I'm guessing that the element gets added to the MathJax queue when that happens, so the element is then "MathJax-enabled".

I am open to having MathJax try to render everything. I think 95%+ of our content will have some math in it.

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/wombats-writing-code/fbw-components/issues/5#issuecomment-221902904

chadlieberman commented 8 years ago

That's great. I see the same. Thanks!