4
$\begingroup$

I am working on some code, and have found it easier to use a Mathematica package because

  • it is easier to run via command-line (lightweight)
  • it allows for easier source versioning (Git), and
  • it allows me to use another text editor for indentation alignment (for me, the FrontEnd does not behave too well in this regard).

I notice that it parses the package files and substitutes symbol escape sequences \[MathSymbol], but it does not parse out subscripts.

I can add subscripts in when editing via the FrontEnd, but once I save it and reload it, the subscripts are simply represented as InputFormat[].

I looked through the Option Inspector for parsing options and found the DefaultPackageStyleDefinitions at

$InstallationDirectory/SystemFiles/FrontEnd/StyleSheets/Package.nb

EDIT: Four years later, but yes, I agree with the comments below in that I did not specify a clear question. Thinking back, my question here was: Is there a way to have the FrontEnd display symbols rather than their long-form version?

$\endgroup$
5
  • $\begingroup$ I'm assuming you're using the FrontEnd's package editor? $\endgroup$
    – rm -rf
    Commented Oct 11, 2012 at 17:00
  • $\begingroup$ Yes, I am using the FrontEnd editor. $\endgroup$ Commented Oct 12, 2012 at 18:10
  • 3
    $\begingroup$ This just isn't supported in the FE. The FE tries very hard not to put unreadable typesetting markup into packages to facilitate easy exchange with other programming editors. Possibly workarounds...putting the code in a notebook with an auto-save package would work, but then the package file is no longer the primary source file, and that probably won't satisfy you. You could post-process the save file, but that seems dicey to me. $\endgroup$
    – John Fultz
    Commented Oct 25, 2012 at 6:05
  • $\begingroup$ I'm not sure I understand why this would introduce unreadable typesetting. To my understanding, the FE would only need to evaluate 1st-level children of a Symbol[] expression in-place to return the math-style subscript expression. When it saves the file, it would simply save as it normally does, as Subscript[A, ...] in plain-text. $\endgroup$ Commented Oct 25, 2012 at 19:12
  • $\begingroup$ To clarify, I meant that the FE should only evaluate the head Symbol[] of an expression in-place, holding any child expressions so it only changes type-setting. Couldn't edit after 5 minutes, meh. $\endgroup$ Commented Oct 25, 2012 at 19:31

1 Answer 1

2
$\begingroup$

I think that's a fair answer to this topic, which doesn't really state any question precisely. Also, hard to find more authoritative source.

This just isn't supported in the FrontEnd. The FE tries very hard not to put unreadable typesetting markup into packages to facilitate easy exchange with other programming editors.

Possibly workarounds...putting the code in a notebook with an auto-save package would work, but then the package file is no longer the primary source file, and that probably won't satisfy you. You could post-process the save file, but that seems dicey to me.

–John Fultz Oct 25 '12 at 6:05

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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