Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #10247

Re: Print TraditionalForm

From Alexei Boulbitch <Alexei.Boulbitch@iee.lu>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Print TraditionalForm
Date 2012-05-29 09:47 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <jq25vu$6i0$1@smc.vnet.net> (permalink)

Show all headers | View raw


I want to typeset a math equation that is is printed in TraditionalForm. Here is an example:



t = (Subscript[c, v1] Subscript[n, 1] Subscript[T, 1] + 

   Subscript[c, v2] Subscript[n, 2] Subscript[T, 2])/(

  Subscript[c, v1] Subscript[n, 1] + Subscript[c, v2] Subscript[n, 2]);



Print["T" // TraditionalForm, " = ", t]



The Print statement gives me the equation I want but in Courier font, which is default for Print. If I select the output cell and use the notebook interface to Convert to TraditionalForm, then the equation is printed in the default font for text, which is really how I want it. Is it possible to obtain the final result using only Mathematica expressions, without having to go through the notebook interface?





If you do not especially attached to using Print, this could be done in a number of ways. If I would want it in an output cell (as you seems to want it) and to have a full control on font, size, slanting and so on, I would do like this:



ExpressionCell[

 Style["T=\!\(\*FractionBox[\(\*SubscriptBox[\(c\), \(v1\)]\\\ \

\*SubscriptBox[\(n\), \(1\)]\\\ \*SubscriptBox[\(T\), \(1\)] + \

\*SubscriptBox[\(c\), \(v2\)]\\\ \*SubscriptBox[\(n\), \(2\)]\\\ \

\*SubscriptBox[\(T\), \(2\)]\), \(\*SubscriptBox[\(c\), \(v1\)]\\\ \

\*SubscriptBox[\(n\), \(1\)] + \*SubscriptBox[\(c\), \(v2\)]\\\ \

\*SubscriptBox[\(n\), \(2\)]\)]\)", 18, Italic, Bold, 

  RGBColor[0, 0.5, 0], FontFamily -> "Tahoma"], "Output"]



Try it. Otherwise you may do it like this:



ExpressionCell[

 Style[HoldForm[

   T = (Subscript[c, v1] Subscript[n, 1] Subscript[T, 1] + 

     Subscript[c, v2] Subscript[n, 2] Subscript[T, 2])/(

    Subscript[c, v1] Subscript[n, 1] + 

     Subscript[c, v2] Subscript[n, 2])], 18, Italic, Bold, Blue, 

  FontFamily -> "Arial"], "Output"]



Try this also. Have fun.



Alexei BOULBITCH, Dr., habil.

IEE S.A.

ZAE Weiergewan,

11, rue Edmond Reuter,

L-5326 Contern, LUXEMBOURG



Office phone :  +352-2454-2566

Office fax:       +352-2454-3566

mobile phone:  +49 151 52 40 66 44



e-mail: alexei.boulbitch@iee.lu






Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: Print TraditionalForm Alexei Boulbitch <Alexei.Boulbitch@iee.lu> - 2012-05-29 09:47 +0000

csiph-web