1
$\begingroup$

In a .wl package, i use the package notation but it is presented as inputform and it is consequently not very easy to read.

Notation[ParsedBoxWrapper[SubsuperscriptBox["P", "b1_", "b2_"]] \[DoubleLongLeftRightArrow] ParsedBoxWrapper[RowBox[{"MatPassage", "[", RowBox[{"b1_", ",", "b2_"}], "]"}]]]

Is it possible to use the standard form presentation in a .wl package and if yes, how can i transform the lines in inputform in standard form?

Thanks a lot for your help

$\endgroup$
  • $\begingroup$ Ctrl+a and then Ctrl+Shift+N? $\endgroup$ – Kuba Apr 6 '17 at 20:14
  • $\begingroup$ Ctrl+Shift+N works well indeed. But, the altercations that I can conduct with Ctrl+Shift+N are not preserved after having saved my .wl package. How can I preserve this formatting ? $\endgroup$ – Bendesarts Apr 6 '17 at 20:19
  • 2
    $\begingroup$ impossible in .wl $\endgroup$ – Rolf Mertig Apr 6 '17 at 20:24
  • $\begingroup$ it is a pity for visualizing the lines that use my notation package $\endgroup$ – Bendesarts Apr 6 '17 at 20:26
  • $\begingroup$ Lots of these characters are built into Mathematica so a standard text editor won't have them. You can open and edit .m and .wl in Mathematica though. $\endgroup$ – b3m2a1 Apr 6 '17 at 20:31
3
$\begingroup$

You can't / it is not worth using Notation` package with .m/.wl files.

You can develop your package in a .nb file if you are going to only work with the FrontEnd. See NotebookEvaluate and be aware of subtle issues: Global context seems to be shared between kernels when using Clear?

Mathematica tries to save code from .m/.wl files as input text which excludes usage of 2D box expressions Notation package works with. If specific box structure can't be converted to input form it will be kept verbatim but there is no control over what gets translated and what not. You'd have to have access to how MMA parses and saves packages. Not possible / too cumbersome.

And packages were not meant for this anyway, they are supposed to contain input form which can be edited/read in external editors.

Related question: Symbolize Does Not Work in `.m` Files or What?

| improve this answer | |
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.