Tag Info

Hot answers tagged

16

To prevent this from happening, you may be able to make use of the new-in-8 keyboard shortcut EscketEsc, and similarly for the other symbols, EscbraEsc, EscbraketEsc. These shortcuts bring up a template which is already delimited appropriately. After entering this, you have to press Tab to get "teleported" into the placeholder where the contents of the ket ...


12

Your are in computational mode, when Mathematica cares that you do not have any corresponding bra. It seems to me that you do not really care for computation and a reasonable thing would be to got to a typesetting realm. Then what about entering things as strings? I used palettes to type it, but the code for this is: ...


11

I don't know if it qualifies as an answer to your question if I suggest to change the structure of the labeling in the first place. As you write it, the m is -- from the rendering point of view -- treated as a symbol, if you inclose it with quotation marks it will be treated as a string and no auto-italic is performed at all. E.g.: PlotLabel -> "Test ...


10

This is a nice exercise on boxing: MakeBoxes[u[v_[r_[b_]]], TraditionalForm] := Module[{b1, b2, b3, t}, t = ToBoxes[#, TraditionalForm] &; {bl1, bl2, bl3} = StyleBox[#1, #2] & @@@ { {"{", {20, Orange}}, {"[", {15, Purple}}, {"(", {12, Blue}}}; {br1, br2, br3} = {bl1, bl2, bl3} /. {"[" -> "]", "{" -> "}", "(" -> ")"}; ...


10

Here is the formatting command that does this: pvB /: MakeBoxes[pvB[n1_, n2_, x_, s_, m0_, m1_], TraditionalForm] := RowBox[{SubscriptBox["B", RowBox[{Sequence @@ Riffle[Table["0", {n1}], "\[ThinSpace]"], "\[ThinSpace]", Sequence @@ Riffle[Table["1", {n2 - n1}], "\[ThinSpace]"]}]], "(", Sequence @@ Riffle[Map[ToBoxes, {x, s, m0, ...


9

It's in the style sheet. Use a custom style sheet to override the default. Format > Edit Stylesheet... then enter style name: TraditionalForm Open Format > Option Inspector... and set SingleLetterItalics to False


9

You could do it using the following: SetOptions[EvaluationNotebook[],InputAliases->{"bn"-> FormBox[TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]"},"Binomial"],InputForm]}] Then enter escbnesc to get a placeholder that you can tab through: Then enter the numbers and press shift-enter to evaluate. Edit To make the output appear ...


6

As Daniel Lichtblau wrote in the comment you can use TraditionalForm Expand[(x^2 - 1) ((-3 + x)^2 - 4)] // TraditionalForm $x^4-6 x^3+4 x^2+6 x-5$ However, it works perfectly only with univariate polynomials Expand[(x + y + 1)^5] // TraditionalForm $x^5+5 x^4 y+5 x^4+10 x^3 y^2+20 x^3 y+10 x^3+10 x^2 y^3+30 x^2 y^2+30 x^2 y+10 x^2+5 x y^4+20 x ...


5

Answer inspired by this : Style[Grid[{{TraditionalForm[ Defer[1/Pi = 2*Sum[((-1)^k*(6*k)!*(13591409 + 545140134*k))/((3*k)!* k!^3*640320^(3*k + 3/2)), {k, 0, 44}]]]}}], UnderoverscriptBoxOptions -> {LimitsPositioning -> False}] gives : EDIT Rojo's solution (see comments) is better because it doesn't reduce the sigma : ...


4

The key option here is LimitsPositioning. This is an option of UnderoverscriptBox and related boxes which determines how under and overscripts of "∑", "∏", "⋂", "⋃", "⊎", "⋀", "⋁", "lim", "max", "min", "⊕", "⊖", "⊗", "⊙" behave when displayed in a display formula or an inlined equation. You can set them in Mathematica typesetting (box) language, but it can ...


4

The correct attribute to set would be HoldAll, but modifying built-in functions like this (setting attributes that affect evaluation) is very likely to break things. Instead, use HoldForm: TraditionalForm@HoldForm[(17.517*CuS^2 - 12.081*CuS + 54.875)/(1.121)]


3

Let us inspect the built-in behavior ToBoxes@TraditionalForm[f[a, b]] (* TagBox[FormBox[RowBox[{"f", "(", RowBox[{"a", ",", "b"}], ")"}], TraditionalForm], TraditionalForm, Editable -> True] *) So myfuncF /: MakeBoxes[myfuncF[a_, b_], TraditionalForm] := RowBox[{"f", "(", RowBox@Riffle[Map[ToBoxes, {a, b}], ","], ")"}] x myfuncF[a, b] // ...


3

Here's an alternate way to format it using Format: Format[pvB[n_, P_, x_, s_, m0_, m1_], TraditionalForm] := DisplayForm@RowBox[{ SubscriptBox["B", StringJoin@SparseArray[{i_ :> "1" /; i > P - n}, P, "0"]], RowBox[{ "(", Sequence @@ Riffle[ToBoxes /@ {s, m0, m1}, ","], ")" }] }] This definition will be saved in the FormatValues for pvB.


3

You need to use BoxData. Because ToString creates something strange you also obviously have to change "\\" -> "". I don't know if this is a bug or working as designed. equat = (StringReplace[ToString[#1, TraditionalForm], "\\" -> ""] & )[ Expand[ Product[x - RandomInteger[{-10, 10}], {i, 3 + RandomInteger[]}]]]; CellPrint[ ...


2

Jens's answer provides a good idea, but for some users (with v7 or older versions), "ket", "bra" and "braket" are not built-in Mathematica input aliases. To define these aliases in Mathematica, one may execute the following code: SetOptions[$FrontEnd, InputAliases -> Join[{"ket" -> TemplateBox[{"\[Placeholder]"}, "Ket", ...


2

I might be oversimplifying something but I believe you can use: MakeBoxes[pvB[n_, P_, _, x__], fmt : TraditionalForm] := MakeBoxes[#, fmt] & @ Subscript[Defer @ B, Row[1 ~Table~ {n} ~PadLeft~ P]][x] pvB[2, 4, x, s, m0, m1] // TraditionalForm


2

myfuncF /: MakeBoxes[myfuncF[a_, b_], TraditionalForm] := RowBox[{"f", "(", RowBox[{ToString@a, ",", ToString@b}], ")"}] x myfuncF[a, b] // TraditionalForm myfuncF[a, b] > 0 // TraditionalForm


1

PrettyPoint /: MakeBoxes[PrettyPoint[e___], TraditionalForm] := With[{mb = MakeBoxes[#, TraditionalForm] & /@ {e}}, RowBox[{"(", Sequence @@ Riffle[mb, ","], ")"}] ] PrettyPoint[Log[x/y], Log[1 + y/x]] // TraditionalForm


1

MatrixForm[{Log[x/y], ",", Log[1 + y/x]}, TableDirections->Row, TableSpacing->0.3] // TraditionalForm The spacing around the comma is not perfect but the parentheses look good.


1

All the comments notwithstanding, I think there may be an acceptable compromise between notational simplicity and formal accuracy. It involves defining functions really as Function, not by patterns. Here is an example of how that looks in TraditionalForm. It's the replacement for the standard definition a[x_]:= Sin[x], now written in a notation that you'll ...


1

A problem with the given solutions exists at least in version 7.0.1 on Win7, (but not in version 8), in that a space is added to a string when Inset is used. Starting with the default format this text appears in italics, with an extra space: ab = Graphics[{{Yellow, Rectangle[{0, 0}, {1, 0.5}]}, Inset["A&B", {0.5, 0.25}]}, AspectRatio -> 0.5, ...


1

Having set the notebook style definition as described in Mr.Wizard's answer, the value can be obtained and applied to new notebooks programmatically. I.e. In a manually style-edited notebook obtain the style definition: newstyle = StyleDefinitions /. Options[SelectedNotebook[]] Notebook[{Cell[StyleData[StyleDefinitions -> "Default.nb"]], ...



Only top voted, non community-wiki answers of a minimum length are eligible