DRMF/texvcjs

Make --semanticLaTeX switch

Closed this issue · 16 comments

Add a CLI option to control if @ -symbols are used in the output
Constraint: One should not need to recompile to switch the behaiviour.
PS:
This would be also helpful to solve wikimedia#7 which is somehow stalled because I don't know how to implement a --MathJax switch

For parser.pegjs and parser.js, wouldn't it be easier to just make a copy of them so that one has the @ symbols while one doesn't? Or is that not allowed?

Also, would the additions such as (a)_n -> \pochhammer{a}{n} and \qPochhammer{x}{y}{z} still be in the parser without the @ signs?

Good question about the \pochhammer.

I don't know anything about the first question @physikerwelt.

I think the --useAt switch is not a good descriptor. Perhaps, --semanticLaTeX ?

In this case, the \pochhammer and \qPochhammer replacements fall in this category.

👍 for @HowardCohl 's suggestions w.r.t to --semanticLaTeX
I'm not sure if I understand the pochhammer question. texvcjs provides a list with required packages you need to list all packages that are required to render the output in a standard latex document.
Look at
wikimedia@11bc16d
to see how such a switch can be implemented

@physikerwelt, what I meant was that since the issue only explicitly states to use it for commands that use the @ symbol, should the program without using --semanticLaTeX still perform replacements that I added previously and do not use the @ symbol?

I think the answer to the question is that, if the switch is set, then perform the replacements, if it isn't then don't. All the replacements that we have identified for you are specifically for Semantic LaTeX only.

@physikerwelt do you then think --SemanticLaTeX is preferred to --useSemanticLaTeX ?

@ClaudeZou I think that are two mixed things. The replacement $\sin x$ -> $\sin@x$ should be performed only if the --useSemanticLaTeX switch is ON. Macros that require the DRMF sty files should indacte that by activating the required package here https://github.com/DRMF/texvcjs/blob/master/bin/texvcjs#L3

@physikerwelt tell me if you agree. The "required list" should be obtained from a csv file. Which should be demarked using .gitignore so that it does not show up on the repository.

@HowardCohl use the name for the switch that you think is best.
The required list ist the list of required packages. I currently do not see how that would come from a csv unless the information is stored in that file.

@physikerwelt am I allowed to make two copies of parser.js and parser.pegjs, one with the replacements and one without them? It isn't explicitly prohibited in the constraints given but I want to ask just to be safe.

@ClaudeZou did you have a look at wikimedia/mediawiki-services-texvcjs@11bc16d I think this shows why it`s not required to make copies.
The goal of this project is to make things work. If something is allowed or not is not is probably not the best question to ask. If you make a copy of a file this has advanatages and disadvantages. So if you think it's a good idea to make a copy please explain why this is the way to go.

Finished with pull request #41

@physikerwelt @ClaudeZou I'm glad this works, but it should be also added as a issue on the texer repo.

This issue was moved to DRMF/texer#12