mark-caprio / SciDraw

A system for preparing publication-quality scientific figures with Mathematica
GNU General Public License v3.0
28 stars 3 forks source link

It's a pity that this package is not compatible with Mathematica 13. #1

Closed hongyi-zhao closed 1 year ago

hongyi-zhao commented 2 years ago

I'm very glad to know this package from here. But it seems that it doesn't support Mathematica 13, as described here:

image

Unfortunately, I'm using Mathematica 13 at present. Is there really no expedient solution?

Regards, HZ

jasondbiggs commented 2 years ago

I was able to cobble together an automated fix for the existing package files, and posted it here: https://mathematica.stackexchange.com/a/264163/9490

I have no idea how much is still broken or not, but it allows you to run the examples.

Also it's a temp fix because it only modifies the package files and not the notebooks.

hongyi-zhao commented 2 years ago

Thank you for your quick fix. Further evaluation by @mark-caprio may be required.

mark-caprio commented 2 years ago

Thank you for the automated fix. However, in attempting to apply the fix, under Mathematica 13.0.0, I am encountering errors of the form:

image

Note that my intended replacements are "Canvas" -> "CanvasCoordinates" and "Scaled" -> "ScaledCoordinates". ("BoundingRegion" has already been replaced by "BoundingBox", and "MissingQ" has been eliminated, as of the current commit d387590.)

jasondbiggs commented 2 years ago

@mark-caprio is it possible you missed the SetOptions command? That position spec looks like the "LineColumn" source convention rather than the "SourceCharacterIndex".

Also I didn't realize this repository was here when I wrote up that function, I just was going off the .zip files.

mark-caprio commented 2 years ago

Thank you @jasondbiggs for helping to troubleshoot this. The issue does not seem to be with SetOptions, as far as I can tell. Let me attach the exact code I am running (specifically from the SciDraw directory, not the top of the package tree, as the current working directory), based on yours, and then the output obtained from this code. Please let me know if you can spot what is going wrong. (Failing that, perhaps you could share patched .m files with me to drop into the repository...)

rename_symbols.m.txt rename_symbols-220225.out.txt

mark-caprio commented 2 years ago

@jasondbiggs I think you may have missed being tagged on the previous message due to an editing error on my part. Source files with the replacement made would still be very welcome if you could provide them.

ahrendsen commented 2 years ago

Hi @mark-caprio,

I'm disappointed that @jasondbiggs wasn't able to get back to you. Maybe I can help by also trying my hand at debugging. I downloaded your code and ran it with a small modification and didn't receive any errors. The modification I made was to assign the $packagesDir with a FileNameJoin[], rather than setting it to the current directory with "." as you did. Obviously this shouldn't make a difference in how the code executes.

Once the files were converted, loading SciDraw results in a new error image

and trying to make a blank canvas has a bug in that the ticks aren't show by default. Perhaps it is related to the above error message. For example, the code

Figure[
 FigurePanel[  { },
  XPlotRange -> {-1, 1}, XFrameLabel -> "X"
  , YPlotRange -> {-1, 1}, YFrameLabel -> "Y"
  ] , CanvasSize -> {6.69, 4}
 ]

produces the following figure. image

Specifying the ticks manually allows them to appear.

I'm running Mathematica 13.1.0.0 on Windows 10.

mark-caprio commented 1 year ago

Thank you, @ahrendsen, for the further debugging information. The automated symbol substitution code provided by @jasondbiggs now runs successfully for me after upgrading to Mathematica 13.1.0.

Upon reflection, the most sensible solution seems to be to replace Canvas with Absolute. (This makes use of the undocumented Mathematica symbol System`Absolute.) Using Absolute to refer to coordinates/displacements/sizes in canvas coordinates, i.e., absolute coordinates in printer's points, is in keeping with the use of "Absolute" elsewhere within Mathematica to refer to measurements in printer's points (e.g., AbsoluteDashing, AbsoluteThickness).

The shadowing error with the new symbol System`AxisLabel (Mathematica 12.3) turns out to be straightforward to fix by adjusting the code which creates new symbol names for the SciDraw labeling options.

The issue you encountered regarding automatic tick generation (see https://github.com/mark-caprio/CustomTicks/issues/3) has already been addressed in an update to Customticks.

mark-caprio commented 1 year ago

Resolved with commit 541c9c6

The symbol Canvas must be replaced with Absolute in all SciDraw user code, e.g., Radius->Canvas[3] becomes Radius->Absolute[3].