Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Various LaTeX-->HTML/SVG support features #1262

Merged
merged 7 commits into from
Oct 12, 2023

Conversation

windymilla
Copy link
Collaborator

Tools support conversion of existing LaTeX file (one taken from PG for reprocessing & reposting as an HTML/SVG project) or a project that has been through the rounds with HTML/SVG as the target format.

  1. Add LaTeX Tools submenu to the File menu
  2. Convert LaTeX page separators (comment format used commonly by PG submitters) to Guiguts format to link pngs (if available) to the correct page, and also to allow setting of printed page numbers for HTML format.
  3. Convert LaTeX-style curly quote markup to standard curly quotes
  4. Preview selected piece of LaTeX from an HTML/SVG file (for use while checking/adjusting the chunks of LaTeX in the HTML file as it comes out of the rounds)
  5. Preview whole file by converting HTML/SVG file using m2svg tool
  6. HTML autogen is a bit overenthusiastic, e.g. changing ampersands to HTML entity codes everywhere, which would break LaTeX code that contains ampersands. Add option to undo such changes.

1. Convert selected LaTeX text to a preview file
2. Preview the file
3. Convert whole file using m2svg
4. View the converted file
HTML autogen blindly changes `&` to `&`, etc.
That is not wanted inside LaTeX markup.
Similarly for super/subscripts and angle brackets
Instead of writing an HTML that requires MathJax to interpret it,
write an HTML that m2svg can convert (as it will later for the
whole file).

It creates the preview in a subdir `latexpreviewselect` of the
project folder. LaTeX conversion errors appear in `errors.err`
Convert LaTeX `\PageSep{nnn}` markup to GG-compatible page
separator, and calculate labels to match `nnn` values. Clear any
existing labels first.

Also move LaTeX menu to File menu to hide it away.
Inside LaTeX blocks, we don't want indented lines to be marked up
with spans & margins.

Also, warn user if errors file from `m2svg` contains messages.
@windymilla windymilla requested review from cpeel and srjfoo October 10, 2023 18:55
@windymilla
Copy link
Collaborator Author

DP user has been requesting/trialling these features in the work they have been doing. Regular PPers will not use them at all. I thought it would be good to get them into the system, rather than hanging around in a test version.
TBH, I'm not too worried about them being tested independently, and I think it would be hard for someone to test them who was not doing this type of work.
If problems do arise in the future relating to these tools, they can be fixed as needed.

Copy link
Member

@cpeel cpeel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like m2svg is a nodejs package and I'm assuming we want to leave (the optional) installation of that up to the user rather than try to package that with all its dependencies. Do we need to include anything about that in INSTALL.md?

@windymilla
Copy link
Collaborator Author

windymilla commented Oct 11, 2023

Thanks, Casey - I don't think we need to mention it in INSTALL.md at this point (since it probably affects either 1 or 2 users, both of whom already have m2svg installed of course) but it's something to bear in mind if HTML/SVG gets a sudden increase in popularity amongst PMs & PPers.

Also, yes - I don't think we'll try to package m2svg. As well as the additional complication, I suspect it would be quite a large size increase.

Copy link
Member

@srjfoo srjfoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

6. HTML autogen is a bit overenthusiastic, e.g. changing ampersands to HTML entity codes everywhere, which would break LaTeX code that contains ampersands. Add option to undo such changes.

I wondered about this one when I looked at the menu. Just confirming that it's non-selective; all such changes are reverted by using this button? I think it was the "some" that confused me, but I can't think of a better word.

Just a note that I looked over the code, but since you feel like it's been adequately tested, let's go with it. Let me know if you do need me to do testing on macOS, but if so, I'll probably need help in the testing.

@windymilla windymilla merged commit 305948c into DistributedProofreaders:master Oct 12, 2023
1 check passed
@windymilla windymilla deleted the LaTeX branch October 12, 2023 19:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants