MathGroup Archive 1998

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

Search the Archive

Re: Keyboard/Mouse macros in Mathematica 3.0 for Win95?


  • To: mathgroup@smc.vnet.net
  • Subject: [mg11104] Re: Keyboard/Mouse macros in Mathematica 3.0 for Win95?
  • From: "P.J. Hinton" <paulh@wolfram.com>
  • Date: Sun, 22 Feb 1998 14:55:30 -0500
  • Organization: Wolfram Research, Inc.
  • References: <6cg979$rtj@smc.vnet.net>

On 18 Feb 1998, L. Dwynn Lafleur wrote:

> I am using Mathematica 3.0 on the Win95 platform.  On many occasions, I
> find myself repeatedly using the same set of keystrokes and mouse
> actions, especially when typing a lot of documentation in text cells. 
> One example of many: If I want to display the names of several
> functions in boldface Courier, I repetitively perform the actions
> corresponding to (1) select last typed word via Ctrl-Shift-Left_Arrow,
> (2) convert to boldface via Ctrl-B, (3) select Format menu, (4) select
> Font, (5) select Courier.  It would be nice to automate such steps.
> 
> I have tried Macro Magic, Keyboard Express, EZ Macros, and even the
> lowly Recorder from Win 3.1.  Although each works to a degree, they all
> fail when replaying keystrokes such as Ctrl-Left_Arrow or
> Ctrl-Shift-Left_Arrow.  When entered manually in Mathematica, these
> keystrokes move the cursor and and highlight the text over which it
> passes.  When replayed by the above utitilities, the cursor moves but
> the text is neither highlighted nor selected. 
> 
> Has anyone found a Win95 keyboard macro utility that works well in
> Mathematica 3.0?  

I'm not sure how macro utilities interface with a particular
application, so I don't know how you might go getting something like
this to work.

You may want to try the following approach:  Type in your text to the
point where you're ready to enter the word or character that you want
to set in Courier-Bold.  Hit Alt-9.  Enter your boldface text.  Hit
Alt-7 to get back to the normal appearance.  

Now here is the long-winded discussion of why you would want to use this
alternate route.

You are probably aware that Mathematica uses style sheet notebooks to
control the appearance of each cell style.  For example, the default
configuration for a Title cell uses Helvetica-Bold 36pt.  The use of
styles allows you to specify a set of parameters that govern the
appearance of a cell so you can give it a convenient name without
having to adjust the font, face, color, size, etc. every time you want
to make a new cell of that type. 

You can also impose the font, face, and size, etc. from a given style
within a cell that is of a totally different style.  This is done
internally through StyleBoxes, and that is what you accomplished by
hitting Alt-9 and Alt-7.  Alt-9 tells Mathematica to use Input style. 
Alt-7 puts the style back to Text.

If you paste the following Cell expression into a notebook:

Cell[TextData[{
  "Enter the ",
  StyleBox["2+2", "Input"],
  " and then press \[ShiftKey]+\[EnterKey]" }], "Text"]

You will see the effect of the StyleBox.  Be sure to hit "Yes" when the
front end prompts you whether you want the cell expression to be
interpreted.

The effect seen here from the Default.nb style sheet is a mixture of the
Input style and the FormatType option associated with the Input cell
style.  

If we look at the prototype Cell for Input, we see that the following
options are set:

	FormatType->InputForm
	FontWeight->"Bold"

Which means that this style will look to see what the font setting for
InputForm is and then set the font weight to bold.

The prototype for InputForm is set to:
	
	FontFamily->"Courier"

which means that whatever I place in an Input StyleBox will be
automagically set in Courier-Bold.  

ASIDE: For the experimentalists, you can try changing the font family
setting to whatever your favorite font is, and this will actually
change the font used in StyleBoxes of this type.  You may be wondering
whether this will impact the appearance of standlone Input cells.  The
answer is "no."  This is because the DefaultInputFormatType option
dictates what gets used there.  In the default notebook,
DefaultInputFormatType is set to be StandardForm, so you'll need to
change the StandardForm prototype to get this to work. 

For the really industrious, you can actually introduce new styles in
your style sheet and use Alt-0 to invoke them if they're not listed on
the Format -> Style menu. 

I hope this clarifies things for you.

--
P.J. Hinton
Mathematica Programming Group           paulh@wolfram.com Wolfram
Research, Inc.                  http://www.wolfram.com/~paulh/
Disclaimer: Opinions expressed herein are those of the author alone.




  • Prev by Date: random number generation
  • Next by Date: Re plot graph
  • Prev by thread: Keyboard/Mouse macros in Mathematica 3.0 for Win95?
  • Next by thread: Forcing Mathematica 3.0 to display a superscript 1/2 rather than a square root sign