MathGroup Archive 2010

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

Search the Archive

Re: Templates from Usage Messages

  • To: mathgroup at
  • Subject: [mg110993] Re: Templates from Usage Messages
  • From: magma <maderri2 at>
  • Date: Fri, 16 Jul 2010 05:17:03 -0400 (EDT)
  • References: <i1k0d6$nhn$>

I was confronted with a similar problem a couple of months ago, while
developing my package xPrint, a point-and-click interface to the
tensor algebra suite xAct.
You can read more on xPrint here

I needed to create custom made menu-driven templates for the functions
used to define various geometric objects (manifolds,tensors, covariant
derivatives, ect).
I ended up developing what I called enhanced-template-technology,
which basically recreated the exact look and feel of the normal
templates, but with some extra features and completely programmable
and menu-driven.

Although Mathematica offers the ctrl-shift-K (Make Template) menu facility, to
this functionality there does not seem to correspond any programmable
function, so I had to create the input cell (with the template) from

In David's specific case however, this might not be necessary.
Consider this workaround:

foo::usage =
  "foo[a, Span[b,c]] will operate on structure a between parts b and \

foo[a_, (b_Integer?Positive) ;; (c_Integer?Positive)] := {a, b, c}

Now you can achieve the same ";;" effect using the standard template

If this is not good enough, I suppose one could intercept the ctrl-
shift-K command (or create another one) and insert her/his own special
function, like David's makeTemplate.

  • Prev by Date: Re: Accessing static members with J/Link
  • Next by Date: Re: Accessing static members with J/Link
  • Previous by thread: Templates from Usage Messages
  • Next by thread: Using GatherBy, Select, and Sort to process data.