Hot answers tagged

18

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 ...


15

You could do it using the following (this is the first version of the answer; don't use it if you want the more complete solution below): SetOptions[EvaluationNotebook[],InputAliases->{"bn"-> FormBox[TemplateBox[{"\[SelectionPlaceholder]", "\[Placeholder]"},"Binomial"],InputForm]}] Then enter escbnesc to get a placeholder that you can tab ...


13

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: ...


13

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, ...


12

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

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


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} /. {"[" -> "]", "{" -> "}", "(" -> ")"}; ...


8

The problem is that you gave "\[Equal]" as the centering character, but you should have given "\[LongEqual]". Column[TraditionalForm /@ {HoldForm[y] == x, HoldForm[R^2] == 0.998}, Alignment -> "\[LongEqual]"] To see that TraditionalForm replaces == with "[LongEqual]", you can open up the output cell your code produces by clicking on Show ...


7

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 ...


6

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 : ...


5

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


4

Manipulate[ToExpression[func, TraditionalForm] /. x -> val, {{val, Pi, "x"}, InputField}, {{func, "", "f(x)"}, InputField[##, String] &}]


4

You can try using Format along with Inactive First, need to Unprotect NonCommutativeMultiply: Unprotect[NonCommutativeMultiply]; Format[NonCommutativeMultiply[x__], TraditionalForm] := Inactive[Times][x] This will look like: NonCommutativeMultiply[a, c + d, c] // TraditionalForm $a*(c+d)*c$ which is not quite right yet. For the finishing touches we ...


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)]


4

As an alternative/followup to my comment, you could use the $PrePrint variable to ensure that your outputs are always in TraditionalForm. Once you assign a value to $PrePrint, it will be applied to all inputs before printing them. Just make sure that in your notebook you Clear[$PrePrint] before evaluating any cells which you do not want in TraditionalForm. ...


4

My approach is to use the Option Inspector (menu command Format > OptionInspector) to set the option for the relevant cells UnderscriptBoxOptions -> {LimitsPositioning -> False} If I'm doing this a lot, I might create a new style that inherits from "Text", or change "Text" itself (e.g., via a private stylesheet). Or one can create a template of ...


4

This should be as simple as wrapping any one of the answers to your previous question within Tooltip. In this case, I prefer to start from Mr. Wizard's answer, because it allows me to stay away from explicitly building up the necessary Box expression. MakeBoxes[pvB[n_, P_, _, x__], fmt : TraditionalForm] := MakeBoxes[#, fmt] &@ Tooltip[ ...


3

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", ...


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[ ...


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 can write a function that processes the boxforms produced by TraditionalForm to replace the parentheses by square brackets: tF=RawBoxes[ToBoxes[TraditionalForm[#]]/.{"("->"[",")"->"]"}]&; TraditionalForm/@{C[x,y], Sin[x], f[x,y], H[x], h[x,y,z], H[x,y], h[{x,y}]} (* {C[x,y], sin(x), f(x,y), H(x), h(x,y,z), H(x,y), h({x,y})} *) tF/@{C[x,y], ...


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

Manipulate[ Plot[If[f, .5 x + 1], {x, -3, 6}, PlotRange -> {{-1, 6}, {-1, 5}}, Ticks -> {Range[-3, 6], Range[-1, 5]}, GridLines -> Automatic, GridLinesStyle -> Opacity[.03], AxesStyle -> Arrowheads[.03]], {{f, False, TraditionalForm[Style["f", Italic][x] == (1/2) x + 1]}, {True, False}}]


3

I fiddled a little and this works too. I went into the Option Inspector and changed the "InputInline" Cell option to Traditional Form. The code below works so long as I use an Inlinecell inside the quotation marks. One of the positives of doing it this way is that Mathematica doesn't simplify the (1/2)x to x/2. Manipulate[ Plot[If[f, .5 x + 1], {x, -3, ...


3

A possible approach: Format[f[args___], TraditionalForm] := f; Format[Derivative[n_][fun_][args___], TraditionalForm] := Derivative[n][fun]; f[t, x, y, z]*D[f[t, x, y, z], x] (* 2 (-t v + x) f[(-t v + x)^2 + y^2 + z^2] Derivative[1][f][(-t v + x)^2 + y^2 + z^2] *) f[t, x, y, z]*D[f[t, x, y, z], x] // 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


2

res = TraditionalForm[ HoldForm[Subscript[W, f[a, b]][ c] == \[Rho]^f[a, b] \[Omega][c] \[Rho]^-f[a, b]]]; res /. {c -> 7, f[a, b] -> 5}; For your second question you can try this: g[a_,b_]:=a Sin[b]; res /. {c -> 7, f[a, b] -> g[2 , 3]}


2

ls = HoldForm[Subscript[W, f[a, b]][c] = ρ^f[a, b] ω[c] ρ^-f[a, b]] ReplaceRepeated[ls, {f[a, b] -> 5, c -> 7}] Then just TraditionalForm that...


2

Crucial, for answer to this question, is: why parts of our expression should "stay unevaluated". = in Mathematica is Set function. If we want to express assignment, but just don't want to evaluate it, then we can use = and HoldForm like in rasher's answer, or, if we just want to suppress Set evaluation, we can Inactivate it: Inactivate[Subscript[W, f[a, ...



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