MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Setting global InputAutoReplacements

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105333] Re: Setting global InputAutoReplacements
  • From: mkr <mileskrains at gmail.com>
  • Date: Sat, 28 Nov 2009 01:07:18 -0500 (EST)
  • References: <200911201139.GAA03471@smc.vnet.net> <hedu3u$m7v$1@smc.vnet.net>

On Nov 23, 4:10 am, Leo Alekseyev <dnqu... at gmail.com> wrote:
> John, much thanks for the quick reply.  Allow me to elaborate, for the
> benefits of whoever might be interested in setting up replacement
> aliases (I think they are very handy!)
>
> First, back up the existing Core.nb.
> Then, open the options inspector, select "Core.nb"   from the first
> drop-down box, and under Notebook Options -> File Options select
> "Editable" and Saveable" (in that order).  Then in Core.nb expand
> the last item, "Styles for Mathematica System-specific Elements" and
> then expand "FormatType Styles".  Find local definitions for
> StandardForm .
>
> At this point you could try fiddling with InputAutoReplacements via
> the options inspector , but this results in an error (at least for
> me).  So what you need to do is open Core.nb in a text editor, search
> for the line Cell[StyleData["StandardForm"], and add custom
> replacement (as per John's instruction).  Alternatively, select the
> cell, go to Edit->Copy As cell expression, paste it in a text editor
> somewhere, make the necessary modifications, paste the cell expression
> back (interpreting it) and delete the old cell.  You are done!
>
> I hope this procedure is made easier in future versions :)
>
>
>
> > This particular option isn't as easy to figure out or set as I'd like. 
>  Two
> > clarifications...
>
> > ParentList represents the ones which have been inherited from the notebook level
> > (which, in this case, actually refers to replacements that are set globally
> > throughout the system).
>
> > And the settings for "->", ":>", etc., are actually set in the StandardForm
> > style, not the Input style.
>
> > So, to add the "abc"->"123' replacement, you'd add a StandardForm style cell to
> > your stylesheet as follows...
>
> > Cell[StyleData["StandardForm"],
> >  InputAutoReplacements->{
> >  "abc" -> "123", "->" -> "\[Rule]", ":>" -> "\[RuleDelayed]", "<=" ->
> >   "\[LessEqual]", ">=" -> "\[GreaterEqual]", "!=" -> "\[NotEqual]",
> >   "==" -> "\[Equal]", ParentList}]
>
> > Sincerely,
>
> > John Fultz
> > jfu... at wolfram.com
> > User Interface Group
> > Wolfram Research, Inc.


I am new to OSX, and purchased TextExpander in order to handle text
substitution / auto expansion for Mathematica; unfortunately there
appears to be some sort of conflict between Mathematica's keystroke
filtering and TextExpander's, such that TE does not work for Mathematica
(searching this group revealed that it broke with v6).  Under Windows,
Autohotkey has been very useful in allowing me to expand a few
keystrokes into medium to large size boilerplate code blocks.
Consequently, I am looking around for other ways to do custom
substitutions, and it looks like modifying KeyEventTranslations.tr is
another option.

A bit of searching both at the WRI site and on this group revealed
surprising little guidance on either InputAutoReplacements or
KeyEventTranslations.  I find text expansion to be quite nice in Mathematica
programming (previously using Autohotkey on Windows), allowing a few
keystrokes to automatically expand into medium to large blocks of
boilerplate code, and I would imagine that making such a facility more
obvious/usable would be widely appreciated by the Mathematica user community.

Does anyone know of any decent guidance or resources for customizing
InputAutoReplacements and/or KeyEventTranslations?

Thanks,

Miles


  • Prev by Date: Bug ??????
  • Next by Date: Re: distorting an image
  • Previous by thread: Re: Setting global InputAutoReplacements
  • Next by thread: Re: Re: Setting global InputAutoReplacements