1
$\begingroup$

How do you typeset a matrix like this in a notebook?

$$\begin{pmatrix} x|_1 & 1 & 0& 0&0\\ 1 & x^2|_1 & 0& 0&0\\ 0& 0&x|_2 & 1 &0\\ 0& 0&1 & x^2|_2 &0\\ 0& 0&0 & 0&\ddots\\ \end{pmatrix}$$

Also a column matrix with curly brackets?

Happy to be pointed to a duplicate (I searched but could not find one.) I would prefer not to have to use lots of box forms as here. I also note that we have no tag for typesetting. Thanks

$\endgroup$
2
  • $\begingroup$ Is it just for display purposes? Why not use MaTeX in this case? Or is this going to be used for actual mathematica code? $\endgroup$
    – Nasser
    Commented Mar 6, 2022 at 17:47
  • $\begingroup$ I only want it for display purposes. Further I sometimes want to copy such a form and then paste it into PowerPoint. This works if you copy as bitmap. $\endgroup$
    – Hugh
    Commented Mar 6, 2022 at 17:56

2 Answers 2

2
$\begingroup$

I only want it for display purposes.

Well, in this case I would use MaTex

Mathematica graphics

Code:

  << MaTeX`
  SetOptions[MaTeX, "Preamble" -> {"\\usepackage{amsmath}"}]
mat = "\\begin{Bmatrix}
\\left.  x\\right\\vert _{1} & 1 & 0 & 0 & 0\\\\
1 & \\left.  x^{2}\\right\\vert _{1} & 0 & 0 & 0\\\\
0 & 0 & \\left.  x\\right\\vert _{2} & 0 & 0\\\\
0 & 0 & 1 & \\left.  x^{2}\\right\\vert _{2} & 0\\\\
0 & 0 & 0 & 0 & \\ddots
\\end{Bmatrix}
";
MaTeX[mat, Magnification -> 2]

For an extra credit, the above could be made into a function which accepts the matrix size and automatically generate the above for different size $n$

The above can be copied to another application. (right click on the image).

$\endgroup$
1
  • $\begingroup$ Looks like one way forward. How long does it take to learn MaTex? $\endgroup$
    – Hugh
    Commented Mar 6, 2022 at 18:46
2
$\begingroup$

According to the link you give, your approach is to write :

RawBoxes[SubscriptBox[RowBox[{SuperscriptBox["x", "2"], "|"}], "1"]]  

enter image description here

RawBoxes,SubscriptBox etc .. belong to low level "Box Language".
It is simpler to use the normal (high level) Language :

 Subscript[Row[{x^2, "|"}], "1"]   

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.