daverosoff / PreTeXtual

A Sublime Text 2/3 package for PreTeXt files.
Other
1 stars 3 forks source link

Syntax highlighting with var tag, pm tag, possibly other similar things #31

Closed Alex-Jordan closed 3 years ago

Alex-Jordan commented 6 years ago

With the following code, something goes wrong with syntax highlighting once the first var tag is encountered.

            <solution>
                <p>We <em>add</em> the exponents as follows:</p>
                <md>
                    <mrow><var name="$expression" />\amp=x^{<var name="$a" />+<var name="$b" />}</mrow>
                    <mrow>\amp=x^{<var name="$c" />}</mrow>
                </md>
            </solution>

And in the following, I'm not sure why the nbsp delimiters are colored blue. Maybe all self-closing tags are supposed to be blue, but then the webwork and pm tags are not being colored that way.

<p>The topics that we cover in a week have exercises that are typically due in <webwork /> the middle of the following week at 10:00<nbsp /><pm /> on the night in between the days we meet.</p>
daverosoff commented 6 years ago

Thanks for catching this. The way I coded the <mrow> tag in the syntax definition, the LaTeX syntax is invoked inside. So the XML tags are confusing the syntax. I might have to abandon LaTeX to respect them (one of my goals for the syntax is to properly highlight parts of the source that aren't really XML, like LaTeX, Python/Sage, and Javascript, but it's not working perfectly as you see). I will look for a fix later today.

The <nbsp> is coded as a constant punctuation value, so it is highlighted a bit differently. Do you find it distracting? All the things that are highlighted that way are self-closing (IIRC) but obviously not all self-closing tags are punctuation elements.

Alex-Jordan commented 6 years ago

OK, that makes sense. There are a few tags that can go inside math tags that come to mind: var, fillin, and xref (under certain conditions). Actually, a PTX author should not be using < inside math mode when they mean \lt, so maybe with that assumption there can be a smooth solution.

nbsp etc makes sense. I just didn't see the distinction. Should it maybe apply to all the things from 6.1.4? Or maybe there is a natural division of those things.

daverosoff commented 6 years ago

I think for now the best thing would be for me to release a version that simply doesn't try to highlight LaTeX in mrow, me, etc. This just may never work as well as I want it to, but I'm not yet convinced of that. Are you all back on Package Control for this plugin? I can do a prerelease version that won't affect others' installations (unless they opt in).

Alex-Jordan commented 6 years ago

Personally, I don't think it's a big enough deal to act too hastily. If you'd like to explore your original vision more first to see if it can still work, I think that would be awesome. Did you try the example I gave? It's not the end of everything with the syntax highlighting, and you can still edit with ease.

I'm back on Package Control with PreTeXtual, and I sent everyone here an email with step by step instructions to get their ST back using PreTeXtual. I can't say if they all followed through, but they should have what they need.

I really like the improvements! For one thing, I'm happily zapping away white space now in each old document I open :)

On Fri, Mar 30, 2018 at 10:50 PM, Dave Rosoff notifications@github.com wrote:

I think for now the best thing would be for me to release a version that simply doesn't try to highlight LaTeX in mrow, me, etc. This just may never work as well as I want it to, but I'm not yet convinced of that. Are you all back on Package Control for this plugin? I can do a prerelease version that won't affect others' installations (unless they opt in).

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/daverosoff/PreTeXtual/issues/31#issuecomment-377668559, or mute the thread https://github.com/notifications/unsubscribe-auth/AEg3AMHViNrqFKOTIkr_037x9oU32A_Rks5tjxlDgaJpZM4TCF76 .

-- Alex Jordan Mathematics Instructor Portland Community College

daverosoff commented 5 years ago

@Alex-Jordan has anything changed with regard to this issue, which I'm just now remembering? ;)

Alex-Jordan commented 5 years ago

Hi Dave, I'm not sure if I should do something in SublimeText to update or if the updates roll in automatically. Right now I can paste the same example from the issue report and things don't work out. Here is a screenshot. You can see it go wring after entering the first mrow and getting to the first var.

daverosoff commented 5 years ago

I think you told me months ago that you are back on Package Control, so you should have the most recent version (0.6.0). Thanks, this is back in my to-do list.

daverosoff commented 3 years ago

Closed at #46.