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

Borrowing triangularArrayLayout from herehere, I have:

triangularArrayLayout[triArray_List, opts___] := 
 Module[{n = Length[triArray]}, 
  Graphics[MapIndexed[
    Text[Style[#1, 
       Large], {Sqrt[3] (n - 1 + #2.{-1, 2}), 3 (n - First[#2] + 1)}/
       2] &, triArray, {2}], opts]]

n = 6;
s = 500;
coeffs = triangularArrayLayout[Table[Row[{"C(", i, ",", j, ")"}], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
tri = triangularArrayLayout[Table[Binomial[i, j], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
layers = {Overlay[{coeffs, Show[tri, TextStyle -> GrayLevel[.8]]}, Alignment -> Top], 
   Overlay[{tri, Show[coeffs, TextStyle -> GrayLevel[.8]]}, Alignment -> Top]};

Manipulate[layers[[u]], {{u, 1, " "}, {1 -> "binomial coefficients", 
   2 -> "Pascal's triangle"}}, ControlType -> RadioButtonBar]

but the vertical alignment is off:

Mathematica graphics Mathematica graphics

This is the main issue, but I am also curious how to:

  1. typeset the $C(n,r)$ as TraditionalForm (with the varying $n$ and $r$ values throughout)
  2. typeset the $C(n,r)$ as $_{n}C_{r}$ (also with the varying $n$ and $r$ values).

Borrowing triangularArrayLayout from here, I have:

triangularArrayLayout[triArray_List, opts___] := 
 Module[{n = Length[triArray]}, 
  Graphics[MapIndexed[
    Text[Style[#1, 
       Large], {Sqrt[3] (n - 1 + #2.{-1, 2}), 3 (n - First[#2] + 1)}/
       2] &, triArray, {2}], opts]]

n = 6;
s = 500;
coeffs = triangularArrayLayout[Table[Row[{"C(", i, ",", j, ")"}], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
tri = triangularArrayLayout[Table[Binomial[i, j], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
layers = {Overlay[{coeffs, Show[tri, TextStyle -> GrayLevel[.8]]}, Alignment -> Top], 
   Overlay[{tri, Show[coeffs, TextStyle -> GrayLevel[.8]]}, Alignment -> Top]};

Manipulate[layers[[u]], {{u, 1, " "}, {1 -> "binomial coefficients", 
   2 -> "Pascal's triangle"}}, ControlType -> RadioButtonBar]

but the vertical alignment is off:

Mathematica graphics Mathematica graphics

This is the main issue, but I am also curious how to:

  1. typeset the $C(n,r)$ as TraditionalForm (with the varying $n$ and $r$ values throughout)
  2. typeset the $C(n,r)$ as $_{n}C_{r}$ (also with the varying $n$ and $r$ values).

Borrowing triangularArrayLayout from here, I have:

triangularArrayLayout[triArray_List, opts___] := 
 Module[{n = Length[triArray]}, 
  Graphics[MapIndexed[
    Text[Style[#1, 
       Large], {Sqrt[3] (n - 1 + #2.{-1, 2}), 3 (n - First[#2] + 1)}/
       2] &, triArray, {2}], opts]]

n = 6;
s = 500;
coeffs = triangularArrayLayout[Table[Row[{"C(", i, ",", j, ")"}], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
tri = triangularArrayLayout[Table[Binomial[i, j], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
layers = {Overlay[{coeffs, Show[tri, TextStyle -> GrayLevel[.8]]}, Alignment -> Top], 
   Overlay[{tri, Show[coeffs, TextStyle -> GrayLevel[.8]]}, Alignment -> Top]};

Manipulate[layers[[u]], {{u, 1, " "}, {1 -> "binomial coefficients", 
   2 -> "Pascal's triangle"}}, ControlType -> RadioButtonBar]

but the vertical alignment is off:

Mathematica graphics Mathematica graphics

This is the main issue, but I am also curious how to:

  1. typeset the $C(n,r)$ as TraditionalForm (with the varying $n$ and $r$ values throughout)
  2. typeset the $C(n,r)$ as $_{n}C_{r}$ (also with the varying $n$ and $r$ values).
Tweeted twitter.com/#!/StackMma/status/275868040896319488
Source Link
JohnD
  • 3.4k
  • 3
  • 23
  • 42

Overlay alignment

Borrowing triangularArrayLayout from here, I have:

triangularArrayLayout[triArray_List, opts___] := 
 Module[{n = Length[triArray]}, 
  Graphics[MapIndexed[
    Text[Style[#1, 
       Large], {Sqrt[3] (n - 1 + #2.{-1, 2}), 3 (n - First[#2] + 1)}/
       2] &, triArray, {2}], opts]]

n = 6;
s = 500;
coeffs = triangularArrayLayout[Table[Row[{"C(", i, ",", j, ")"}], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
tri = triangularArrayLayout[Table[Binomial[i, j], {i, 0, n}, {j, 0, i}], 
   ImageSize -> s];
layers = {Overlay[{coeffs, Show[tri, TextStyle -> GrayLevel[.8]]}, Alignment -> Top], 
   Overlay[{tri, Show[coeffs, TextStyle -> GrayLevel[.8]]}, Alignment -> Top]};

Manipulate[layers[[u]], {{u, 1, " "}, {1 -> "binomial coefficients", 
   2 -> "Pascal's triangle"}}, ControlType -> RadioButtonBar]

but the vertical alignment is off:

Mathematica graphics Mathematica graphics

This is the main issue, but I am also curious how to:

  1. typeset the $C(n,r)$ as TraditionalForm (with the varying $n$ and $r$ values throughout)
  2. typeset the $C(n,r)$ as $_{n}C_{r}$ (also with the varying $n$ and $r$ values).