TraditionalForm[HoldForm[...]] query
- To: mathgroup at smc.vnet.net
- Subject: [mg74338] TraditionalForm[HoldForm[...]] query
- From: Matthew Fairtlough <matthew at fairtlough.net>
- Date: Mon, 19 Mar 2007 02:01:35 -0500 (EST)
Dear Group, I've been asked (by the moderators?) to resend my earlier message as it had mangled characters in it, so here it is again. Apologies. I think there is enough information to see what traditional form is doing even if what you see here isn't exactly what you'd get. <next intro para deleted> 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) \!\(TraditionalForm[ HoldForm[y\_h \[Equal] A\ \[ExponentialE]\^\(\[Alpha]\ x\) + B\ \[ExponentialE]\^\(\[Beta]\ x\)]]\) \!\(\*FormBox[ TagBox[\(y\_h \[Equal] \[ExponentialE]\^\(\[Alpha]\ x\)\ A + B\ \[ExponentialE]\^\(\[Beta]\ x\)\), HoldForm], TraditionalForm]\) \!\(StandardForm[ HoldForm[y\_h \[Equal] A\ \[ExponentialE]\^\(\[Alpha]\ x\) + B\ \[ExponentialE]\^\(\[Beta]\ x\)]]\) \!\(\* TagBox[\(y\_h \[Equal] A\ \[ExponentialE]\^\(\[Alpha]\ x\) + B\ \[ExponentialE]\^\(\[Beta]\ x\)\), HoldForm]\) \!\(TraditionalForm[ HoldForm[y\_h \[Equal] A\ Exp[\[Alpha]\ x] + B\ Exp[\[Beta]\ x]]]\) \!\(\*FormBox[ TagBox[\(y\_h \[Equal] A\ \[ExponentialE]\^\(\[Alpha]\ x\) + B\ \[ExponentialE]\^\(\[Beta]\ x\)\), HoldForm], TraditionalForm]\)