Skip to main content
replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.

Edit: why use MakeBoxes?

I prefer to use MakeBoxes to define output formats, even though there is the function Format too. The reason my default choice is MakeBoxes is described in this postthis post. Essentially, this becomes important if you want to be able to re-use your formatted output as input in later computations.

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.

Edit: why use MakeBoxes?

I prefer to use MakeBoxes to define output formats, even though there is the function Format too. The reason my default choice is MakeBoxes is described in this post. Essentially, this becomes important if you want to be able to re-use your formatted output as input in later computations.

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.

Edit: why use MakeBoxes?

I prefer to use MakeBoxes to define output formats, even though there is the function Format too. The reason my default choice is MakeBoxes is described in this post. Essentially, this becomes important if you want to be able to re-use your formatted output as input in later computations.

Difference to Format
Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.

Edit: why use MakeBoxes?

I prefer to use MakeBoxes to define output formats, even though there is the function Format too. The reason my default choice is MakeBoxes is described in this post. Essentially, this becomes important if you want to be able to re-use your formatted output as input in later computations.

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.

Edit: why use MakeBoxes?

I prefer to use MakeBoxes to define output formats, even though there is the function Format too. The reason my default choice is MakeBoxes is described in this post. Essentially, this becomes important if you want to be able to re-use your formatted output as input in later computations.

Source Link
Jens
  • 97.9k
  • 7
  • 215
  • 510

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, m1}], ","], ")"}]

For example:

pvB[2, 4, x, s, m0, m1] // TraditionalForm

$B_{0\,0\,1\,1}(s,m0,m1)$

The \[ThinSpace] will display as a small empty string, but is useful to insure that the indices are separated by just a tiny bit.