Re: Re: Making parts of formulae blinking
- To: mathgroup at smc.vnet.net
- Subject: [mg91277] Re: Re: Making parts of formulae blinking
- From: Alexei Boulbitch <Alexei.Boulbitch at iee.lu>
- Date: Wed, 13 Aug 2008 04:39:31 -0400 (EDT)
Dear David,
thank you for your helpful comment. I agree that it is an important problem, especially if
one wants to use Mathematica for giving talks on subjects of general interest, rather than
only on Mathematica itself. The question we discuss is thus, in no case a "disposable" one.
You are right, it is much easier, if one can avoid going to graphics, and I like your approach much.
However, I still have an unsolved question concerning using the operator Accentuate[].
In my previous letter for the sake of shortness I have given an oversimplified
expression AB+xy. The procedure "Accentuate" works perfectly on it. In reality however, one often
needs to accentuate parts of an expression that have different lengths. Further, often there are more than two
parts of the same expression that should be accentuated separately. In this case a straightforward use
of the operator Accentuate results in a change of the order of the parts of the expression.
For example, I need to discuss four parts of the same expression. They should be discussed separately
from one another. Here they are:
a1 = Text[Style["\!\(\*SuperscriptBox[\"\[Alpha]\[Eta]\",
RowBox[{\" \", \"2\"}]]\)+\!\(\*SuperscriptBox[\"\[Beta]\[Eta]\",
RowBox[{\" \", \"4\"}]]\)", FontFamily -> "Times New Roman", 22,
Italic]]
a2 = Text[
Style["g(\[CapitalDelta]\[Eta]\!\(\*SuperscriptBox[\")\", \
\"2\"]\)", FontFamily -> "Times New Roman", 22, Italic]]
a3 = Text[
Style["\!\(\*FractionBox[\"1\", \"2\"]\)\!\(\*SubscriptBox[\"C\", \
\"ijkl\"]\)\!\(\*SubscriptBox[\"\[Epsilon]\", \
\"ij\"]\)\!\(\*SubscriptBox[\"\[Epsilon]\", \"kl\"]\)",
FontFamily -> "Times New Roman", 22, Italic]]
a4 = Text[Style["\!\(\*SuperscriptBox[\"A\[Eta]\",
RowBox[{\" \", \"2\"}]]\)\!\(\*SubscriptBox[\"\[Epsilon]\", \
\"ii\"]\)", "Times New Roman", 22, Italic]]
These illustrate a problem from the area of phase transitions.
Applying the operator Accentuate to these parts in a direct way:
expression=Accentuate[a1]+Accentuate[a2]+Accentuate[a3]+Accentuate[a4]
or like this
a1 + a2 + a3 + a4;
Accentuate /@ %
I get a nicely working output, but no control on the order in which the parts appear. This may make
my message obscure to the audience and therefore, should be changed.
Could you give a hint of how this problem could be fixed?
Best regards, Alexei
Alexei,
This is a very interesting question because in the larger sense it relates
to how one manipulates expressions and presents concepts, in a clear and
elegant manner, to a reader of a notebook. I think this is somewhat an open
question and we have to learn how to do it. So my answer is not going to be
totally responsive and I think that your first approach is not the best
because it draws you off into computer science and away from the math and
physics. Also, a blinking graphical display may serve a tutorial purpose but
it is a dead-end expression that can't be further used. (Also I don't know
right off how to get some blinking in, but I'm certain some member of
MathGroup will do it.)
So instead of going to graphics, which in general might be quite complicated
to get all the formatting correct, let's try to stay with regular
expressions that can be accentuated with EventHandlers and then returned
again to regular expressions. Here are two routines to help do that:
Accentuate[expr_] :=
Module[{col = Black, size = Medium},
EventHandler[
Style[expr, FontColor -> Dynamic[col],
FontSize ->
Dynamic[size]], {"MouseClicked" :> (col =
col /. {Black -> Red, Red -> Black};
size = size /. {Large -> Medium, Medium -> Large})}]]
ClearAccentuate[expr_] :=
expr /. HoldPattern[EventHandler[Style[subexpr_, __], __]] -> subexpr
Now we can use these on your example and then return to a normal expression.
Or we could have just saved the initial expression. In any case, we don't
have to go to graphics.
A B + x y
Accentuate /@ %
% // ClearAccentuate // InputForm
--
Alexei Boulbitch, Dr., Habil.
Senior Scientist
IEE S.A.
ZAE Weiergewan
11, rue Edmond Reuter
L-5326 Contern
Luxembourg
Phone: +352 2454 2566
Fax: +352 2454 3566
Website: www.iee.lu
This e-mail may contain trade secrets or privileged, undisclosed or otherwise confidential information. If you are not the intended recipient and have received this e-mail in error, you are hereby notified that any review, copying or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal from your system. Thank you for your co-operation.