Re: TraditionalForm[HoldForm[...]] query

*To*: mathgroup at smc.vnet.net*Subject*: [mg74347] Re: TraditionalForm[HoldForm[...]] query*From*: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>*Date*: Mon, 19 Mar 2007 02:06:26 -0500 (EST)*Organization*: The Open University, Milton Keynes, UK*References*: <etijls$iu4$1@smc.vnet.net>

Matthew Fairtlough wrote: > Dear Group, > > I've just joined this newsgroup although I've used Mathematica on a > nearly daily basis for nearly 3 years now. I use it for teaching, > assessment and exploring geometry and programming language features such > as monads and monad comprehensions. > > I'm attempting to use Mathematica as part of a document production > system and so I'm interested in displaying mathematical text with its > structure intact (although taking advantage of the conversions from > input forms to output forms that functions such as TraditionalForm > provide). I thought I had found a solution using HoldForm, and it > worked on many examples, but now I've found very simple cases where > expressions are rearranged, and not to my liking, within HoldForm. More > troubling is that the rearrangement depends on whether TraditionalForm > or some other form is used such as StandardForm, and also on the > different input forms that are used, even if they "should" produce the > same output forms in some cases. My example of Exp vs \[ExponentialE]\^ > below is a case in point. When TraditionalForm[HoldForm[expression > involving \[ExponentialE]]] is used then the expression is rearranged, > while the same expression using Exp is not; no rearrangement is done in > either case if I use StandardForm instead of TraditionalForm. > > Can anyone suggest a way forward and/or give a relatively simple > explanation (or even justification?) of this behaviour? I'm finding it > frustrating that I haven't been able to find a good way of combining > Mathematica's symbolic and computational tools to produce documents I > can publish to my students, none of whom use Mathematica (more's the > pity...). > > Do I need to create my own version of HoldAll (perhaps with attribute > HoldAllComplete) and ensure that it does not normally appear in the > output in the same way that HoldAll does not? Can I rely on that > attribute to ensure nothing wrapped in MyHoldAll is evaluated or > rearranged in any way? > > I have looked through the newsgroup and seen some related articles but > found nothing that exactly matches my interest and needs. > > [I have pasted the cells below; is there a better way of displaying > Mathematica examples apart from attaching a notebook?] > > in hope, > Matthew Fairtlough. > > $Version > > 5.0 for Microsoft Windows (November 18, 2003) > Hi Matthew, Could you, please, repost your message with another set of fonts or use InputForm. You may have not notice when you sent it, but there is some garbage in the code pasted. Regards, Jean-Marc > In[112]:= > \!\(TraditionalForm[HoldForm[y\_h \[Equal] A\ \[ExponentialE]\^\(=CE=B1\ > x\) + B\ \[ExponentialE]\^\(=CE=B2\ x\)]]\) =======================================^^^^^^ etc. > > Out[112]//TraditionalForm= > \!\(\*FormBox[ > TagBox[\(y\_h \[Equal] \[ExponentialE]\^\(=CE=B1\ x\)\ A + B\ \ > \[ExponentialE]\^\(=CE=B2\ x\)\), > HoldForm], TraditionalForm]\) > > In[113]:= > \!\(StandardForm[HoldForm[y\_h \[Equal] A\ \[ExponentialE]\^\(=CE=B1\ x\)= > + B\ \ > \[ExponentialE]\^\(=CE=B2\ x\)]]\) > > Out[113]//StandardForm= > \!\(\* > TagBox[\(y\_h \[Equal] > A\ \[ExponentialE]\^\(=CE=B1\ x\) + B\ \[ExponentialE]\^\(=CE=B2\ x\= > )\), > HoldForm]\) > > In[114]:= > \!\(TraditionalForm[HoldForm[y\_h \[Equal] A\ Exp[=CE=B1\ x] + B\ Exp[=CE= > =B2\ x]]]\) > > Out[114]//TraditionalForm= > \!\(\*FormBox[ > TagBox[\(y\_h \[Equal] > A\ \[ExponentialE]\^\(=CE=B1\ x\) + B\ \[ExponentialE]\^\(=CE=B2\ x= > \)\), > HoldForm], TraditionalForm]\) >