Skip to content

Conversation

@mmatera
Copy link
Contributor

@mmatera mmatera commented Jan 9, 2021

Tidier version of PR #995

@mmatera
Copy link
Contributor Author

mmatera commented Jan 10, 2021

What is missing now to make this work is to complete the implementation of OptionValue and related symbols:
https://reference.wolfram.com/language/ref/OptionValue.html
This is important for this specific package, as well as many others

@mmatera
Copy link
Contributor Author

mmatera commented Jan 25, 2021

Status update: Now all the structural issues in the mathics kernel seem to be solved, in a way that CellsToTeX loads properly and all the intricate WL idioms that this package uses for the conversion seem to be properly evaluated. Now, the next set of issues that are avoiding this particular library behaves like in WMA are related to Export functions (to PDF, to png, etc...). The next step is to fix them.

@rocky
Copy link
Member

rocky commented Jan 25, 2021

Status update: Now all the structural issues in the mathics kernel seem to be solved, in a way that CellsToTeX loads properly and all the intricate WL idioms that this package uses for the conversion seem to be properly evaluated. Now, the next set of issues that are avoiding this particular library behaves like in WMA are related to Export functions (to PDF, to png, etc...). The next step is to fix them.

When I follow the instructions at https://github.com/jkuczm/MathematicaCellsToTeX#no-installation , I get a number of failures in import:

In[1]:= Import@"https://raw.githubusercontent.com/jkuczm/MathematicaCellsToTeX/master/NoInstall.m"

Set::write: Tag FirstCase in FirstCase::usage is Protected.
Set::write: Tag Association in Association::usage is Protected.
Set::write: Tag AssociationQ in AssociationQ::usage is Protected.
Set::write: Tag Key in Key::usage is Protected.
Set::write: Tag Lookup in Lookup::usage is Protected.
Set::write: Tag Failure in Failure::usage is Protected.
Options::wrsym: Symbol FirstCase is Protected.
SetDelayed::write: Tag FirstCase in FirstCase[expr_, pattOrRule_, Shortest[default_ : Missing[NotFound], 1], Shortest[levelspec_ : {1}, 2], opts : OptionsPattern[]] is Protected.
SetDelayed::write: Tag FirstCase in FirstCase[pattOrRule_][expr_] is Protected.
SetDelayed::write: Tag Pattern in assoc_Association[key_] is Protected.
TagSetDelayed::tagnfd: Tag Association not found or too deep for an assigned rule.
TagSetDelayed::write: Tag Association in Append[Association[rules___], {newRules : (_Rule | _RuleDelayed)...} | (newRule : _Rule | _RuleDelayed)] is Protected.
Set::write: Tag AssociationQ in AssociationQ[Association[(_Rule | _RuleDelayed)...]] is Protected.
Set::write: Tag AssociationQ in AssociationQ[_] is Protected.
SetDelayed::write: Tag Lookup in Lookup[assoc_ ? AssociationQ, key_, default_] is Protected.
SetDelayed::write: Tag Lookup in Lookup[assoc_ ? AssociationQ, key_] is Protected.
Grid::optx: Alignment -> {Left, Top} is not a supported option for Grid[].
Grid::optx: Alignment -> {Left, Top} is not a supported option for Grid[].
TagSetDelayed::write: Tag Failure in MakeBoxes[Failure[tag_, assoc_Association], StandardForm] /; assoc[MessageTemplate] =!= Missing[KeyAbsent, MessageTemplate] && assoc[MessageParameters] =!= Missing[KeyAbsent, MessageParameters] && assoc[MessageParameters] =!= Missing[KeyAbsent, Type] is Protected.
Out[1]= {}

What's up here?

@mmatera
Copy link
Contributor Author

mmatera commented Jan 25, 2021

Status update: Now all the structural issues in the mathics kernel seem to be solved, in a way that CellsToTeX loads properly and all the intricate WL idioms that this package uses for the conversion seem to be properly evaluated. Now, the next set of issues that are avoiding this particular library behaves like in WMA are related to Export functions (to PDF, to png, etc...). The next step is to fix them.

When I follow the instructions at https://github.com/jkuczm/MathematicaCellsToTeX#no-installation , I get a number of failures in import:

In[1]:= Import@"https://raw.githubusercontent.com/jkuczm/MathematicaCellsToTeX/master/NoInstall.m"

Set::write: Tag FirstCase in FirstCase::usage is Protected.
Set::write: Tag Association in Association::usage is Protected.
Set::write: Tag AssociationQ in AssociationQ::usage is Protected.
Set::write: Tag Key in Key::usage is Protected.
Set::write: Tag Lookup in Lookup::usage is Protected.
Set::write: Tag Failure in Failure::usage is Protected.
Options::wrsym: Symbol FirstCase is Protected.
SetDelayed::write: Tag FirstCase in FirstCase[expr_, pattOrRule_, Shortest[default_ : Missing[NotFound], 1], Shortest[levelspec_ : {1}, 2], opts : OptionsPattern[]] is Protected.
SetDelayed::write: Tag FirstCase in FirstCase[pattOrRule_][expr_] is Protected.
SetDelayed::write: Tag Pattern in assoc_Association[key_] is Protected.
TagSetDelayed::tagnfd: Tag Association not found or too deep for an assigned rule.
TagSetDelayed::write: Tag Association in Append[Association[rules___], {newRules : (_Rule | _RuleDelayed)...} | (newRule : _Rule | _RuleDelayed)] is Protected.
Set::write: Tag AssociationQ in AssociationQ[Association[(_Rule | _RuleDelayed)...]] is Protected.
Set::write: Tag AssociationQ in AssociationQ[_] is Protected.
SetDelayed::write: Tag Lookup in Lookup[assoc_ ? AssociationQ, key_, default_] is Protected.
SetDelayed::write: Tag Lookup in Lookup[assoc_ ? AssociationQ, key_] is Protected.
Grid::optx: Alignment -> {Left, Top} is not a supported option for Grid[].
Grid::optx: Alignment -> {Left, Top} is not a supported option for Grid[].
TagSetDelayed::write: Tag Failure in MakeBoxes[Failure[tag_, assoc_Association], StandardForm] /; assoc[MessageTemplate] =!= Missing[KeyAbsent, MessageTemplate] && assoc[MessageParameters] =!= Missing[KeyAbsent, MessageParameters] && assoc[MessageParameters] =!= Missing[KeyAbsent, Type] is Protected.
Out[1]= {}

What's up here?

This is an issue related to $VersionNumber. Depending on the version, CellsToTeX tryies to implement a set of Symbols that are available in WMA 10, but not in WMA <10. To avoid it, you need to execute
Unprotect[$VersionNumber];$VersionNumber=11;Protect[$VersionNumber];
before loading the package. This is already implemented in tests/test_cellstotex.py

@rocky
Copy link
Member

rocky commented Jan 26, 2021

I think that more than defining something inside the kernel, we just could have a folder with "proxies" to packages that needs this kind of workarounds. Also, this could be useful to list what packages are actually working, and at which level are working, at the time to let know to the authors of those packages how to make them compatible with mathics.

Sure - make it so!

Can we split off part of useful working parts of this PR like we did before? Thanks!

1 similar comment
@rocky
Copy link
Member

rocky commented Jan 26, 2021

I think that more than defining something inside the kernel, we just could have a folder with "proxies" to packages that needs this kind of workarounds. Also, this could be useful to list what packages are actually working, and at which level are working, at the time to let know to the authors of those packages how to make them compatible with mathics.

Sure - make it so!

Can we split off part of useful working parts of this PR like we did before? Thanks!

@mmatera
Copy link
Contributor Author

mmatera commented Jan 26, 2021

I think that more than defining something inside the kernel, we just could have a folder with "proxies" to packages that needs this kind of workarounds. Also, this could be useful to list what packages are actually working, and at which level are working, at the time to let know to the authors of those packages how to make them compatible with mathics.

Sure - make it so!

Can we split off part of useful working parts of this PR like we did before? Thanks!

Most of the improvements are already in PR # #1116. There are a few other changes I am working on splitting now as a new PR.

Copy link
Member

@rocky rocky left a comment

Choose a reason for hiding this comment

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

@mmatera now that things have settled a bit, can we get this adjusted so we can merge it into master please?

Thanks.

expr = parse(definitions, MathicsSingleLineFeeder(str_expression))
return expr.evaluate(evaluation)

_evaluate('LoadModule["pymathics.asy"]')
Copy link
Member

Choose a reason for hiding this comment

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

Hmmm... maybe it would be better to put this test in the pymathics repository instead of here.

If done here, we would have to have to check to see if pymathics.asy is installed.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The idea would be to download and load the module in the test. But first I need to complete the package and make it works...

Copy link
Member

Choose a reason for hiding this comment

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

If you do it in pymathics-asy then you don't have to download and everything is simpler.

Is there a reason not to do it there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it could be there but is a little bit unrelated to that package. The idea of having this branch in mathics is not to actually merge it, but just to discover and collect several fixed required by the Mathics suit to load this package (and potentially, many others). Once this package (CellToTeX) pass the tests, we could put this test in a different repository, with the corresponding comments about how to actually make it run.

@rocky rocky force-pushed the master branch 2 times, most recently from 96ec58b to e8a5440 Compare March 14, 2021 13:55
@rocky rocky force-pushed the newcellstotexfixes2 branch from 5a9782f to 9b69dd5 Compare March 21, 2021 00:11
@mmatera
Copy link
Contributor Author

mmatera commented Mar 31, 2021

superseded by #1215

@mmatera mmatera closed this Mar 31, 2021
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.

4 participants