Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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
share|improve this question
    
I'm assuming you're using the FrontEnd's package editor? –  rm -rf Oct 11 '12 at 17:00
    
Yes, I am using the FrontEnd editor. –  eacousineau Oct 12 '12 at 18:10
    
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. –  John Fultz Oct 25 '12 at 6:05
    
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. –  eacousineau Oct 25 '12 at 19:12
    
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. –  eacousineau Oct 25 '12 at 19:31

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.