Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2010

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

Search the Archive

Re: Templates from Usage Messages

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

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

http://sites.google.com/site/xprintforxact/

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
scratch.

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 \
c.";

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

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

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.