davidfarmer / LaTeXtoLaTeX

Utilities for converting LaTeX markup to a standard form
1 stars 8 forks source link

No Intro's in Explorations #10

Open Pelonza opened 7 years ago

Pelonza commented 7 years ago

The most recent version seems to have missed including introductions into the explorations when there is content before the first task.

Pelonza commented 7 years ago

This seems to specifically occur when an exploration has a chunk of commented out text... or maybe an xml:id tag

You can find several examples of this in section6-4.mbx

davidfarmer commented 7 years ago

Ah, yes! I found the same thing when I used the script on Bruce's PTX.

My script does not understand XML comments.

If you don't need the comments, then just deleting them (which can be the first step of the script) is an option.

Another option (which I did with Bruce) is to just skip the environments that contain comments. Then you need to fix those by hand.

Actually dealing properly with comments will involve real work.

Let me know which approach you prefer.

Pelonza commented 7 years ago

For now, I think the best way to deal with them is to skip the environment. I still need to pull information from the comments. Sadly, as we have parsed the latex, a large portion of the explorations have comments.

On Sep 5, 2017 10:32 AM, "David W. Farmer" notifications@github.com wrote:

Ah, yes! I found the same thing when I used the script on Bruce's PTX.

My script does not understand XML comments.

If you don't need the comments, then just deleting them (which can be the first step of the script) is an option.

Another option (which I did with Bruce) is to just skip the environments that contain comments. Then you need to fix those by hand.

Actually dealing properly with comments will involve real work.

Let me know which approach you prefer.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidfarmer/LaTeXtoLaTeX/issues/10#issuecomment-327213451, or mute the thread https://github.com/notifications/unsubscribe-auth/AMRGU2jWJast4eHVde4mEOMoJjvo5Ry2ks5sfWmKgaJpZM4PNFbE .

davidfarmer commented 7 years ago

If you pull master branch on my LaTeXtoLaTeX repository, I think it will skip environments with comments (see lines 251-2 of myoperations.py, which in GitHub says

 if "<!--" in the_text:   # comments mess things up
     return "<" + outertag + the_text + "</" + outertag + ">"

Maybe do that on a branch, in case it messes things up. (That code is not new: I added that for Bruce, so I have tested it before.)

Note that it is not the comments that mess things up: it is the PTX tags inside comments. Another option is to write a script that just changes the inside of comments to obscure any tags. Something as simple as replacing "<" by "< " inside comments should do it.

On Tue, 5 Sep 2017, Karl R. B. Schmitt wrote:

For now, I think the best way to deal with them is to skip the environment. I still need to pull information from the comments. Sadly, as we have parsed the latex, a large portion of the explorations have comments.

On Sep 5, 2017 10:32 AM, "David W. Farmer" notifications@github.com wrote:

Ah, yes! I found the same thing when I used the script on Bruce's PTX.

My script does not understand XML comments.

If you don't need the comments, then just deleting them (which can be the first step of the script) is an option.

Another option (which I did with Bruce) is to just skip the environments that contain comments. Then you need to fix those by hand.

Actually dealing properly with comments will involve real work.

Let me know which approach you prefer.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/davidfarmer/LaTeXtoLaTeX/issues/10#issuecomment-327213451, or mute the thread https://github.com/notifications/unsubscribe-auth/AMRGU2jWJast4eHVde4mEOMoJjvo5Ry2ks5sfWmKgaJpZM4PNFbE .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or mute the thread.[AAM6LEemnu9sR27lP0MwOvwVnT3a7VAgks5sfXbvgaJpZM4PNFbE.gif]

Pelonza commented 7 years ago

Ok. One of the nice things about the recursive conversion is it creates a whole new copy so I can compare without screwing up original code :)

I'm going to try and play a little bit with reg-exp to see if I can just temporarily extract the contents between the commenting tags. I.E., pull just the comments out, then toss it back after the modifications.

Pelonza commented 7 years ago

Ok, so a reg-exp that catches an entire comment is: (<--.*?-->)

Though, I noticed that apparently we missed a macro in the conversion from latex to mbx -- \larsonfive

I think if you do a recursive call to the interior tag matching. In the matching function, search the text for any complete comment, group the before and after, and mash it together with another call to the tag match.... I'll try and mess with it some more this afternoon or tomorrow.

Pelonza commented 7 years ago

Actually.... as I'm trying to go back and fix this all...

I think I'll be better served by us re-converting from latex for the chapters I haven't manually fixed. Then we can delete any of the textbook references/marginpar and turn any OTHER marginpars to asides (which is what they should be).

This ought to eliminate the vast majority of the commented out sections of text.... Otherwise I've got a ton of manual fixing to do per file (again).

Pelonza commented 7 years ago

I'll reopen the issue on my calc book.