MathGroup Archive 2009

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

Search the Archive

Re: Howto change TraditionalForm Output

  • To: mathgroup at
  • Subject: [mg96574] Re: Howto change TraditionalForm Output
  • From: Albert Retey <awnl at>
  • Date: Mon, 16 Feb 2009 16:38:36 -0500 (EST)
  • References: <gnbkel$3gd$>


> In some (IMHO mainly European) countries, there is tradition to use other
> names of the function then are these used in american English. For example
> here in Czech Republic we use "tg" and "cotg" in place of "tan" and "cot".
> I'm trying to modify the behaviour of M7 like this:
> Unprotect[Tan];
> Format[Tan[x_], TraditionalForm] := "tg(" <> ToString[x] <> ")";
> Protect[Tan] ; 
> It seems to work fine in the cases:
> TraditionalForm[Tan[a + b]]
> TraditionalForm[Tan[z]]
> TraditionalForm[Tan[Pi]/5]
> but it doesn't work in case like:
> TraditionalForm[Tan[z/5]]
> Does anybody know what is the right syntax to change the Format of
> TraditionalForm?

I'm not sure whether this is still a recommended way to do it with all
the higher level functions available for version >= 6, but the following
should work, even with versions < 6:

Format[Tan[x_], TraditionalForm] := DisplayForm[RowBox[{
     "tg", "(", ToBoxes[x], ")"}]];

If you wonder what all this is about, you might want to learn about the
two dimensional formatting via boxes, some entry points for that can be
found in the documentation:




  • Prev by Date: Re: Re: Log[]//TraditionalForm
  • Next by Date: Re: Try again to send my message: problems about "for"
  • Previous by thread: Re: Howto change TraditionalForm Output
  • Next by thread: Re: Howto change TraditionalForm Output