Freigeben über


Entering Matrices

The Office math ribbon has a few examples of matrices, but you might like to be able to enter a lot more kinds of matrices and enter them substantially faster. For this you can use the linear format (see Sec. 3.9). For example, a 2x2 matrix is entered by \matrix(…&…@...&…), where the ellipses are the contents of the matrix elements. As in TeX, &’s separate matrix elements. Rows are separated by @’s.

You don’t have to enter anything in the matrix elements if you’re willing to enter them explicitly later. For example to enter a 4x4 empty matrix you can type \matrix(&&&@@@). This is missing the &’s for the second through fourth rows. But the build-up machinery automatically generates a rectangular matrix with each row containing the same number of elements as the row with the maximum number of elements. So in the 4x4 \matrix(&&&@@@) case, the first row has four elements and therefore each of the three subsequent rows has four elements as well.

The matrices don’t have to be square. A six-element, single row empty matrix is entered by\matrix(&&&&&) and a five element, single column empty matrix is entered by \matrix(@@@@).

Often you want parentheses surrounding the matrices. You can enter them explicitly as in (\matrix(&&@@)), or in Office 2010, you can use TeX’s control word \pmatrix(&&@@), which is slightly faster to enter. A little later this year, I’ll update the linear format paper to include the additions that appear in Office 2010.

The maximum number of elements is 254. So you can enter a 15x15 matrix and a 127x2 matrix without error. If anyone needs larger matrices, I’d like to hear about it. We don’t want to allow arbitrarily large matrices because unrealistic test scenarios might grind the machine to a virtual halt.

Comments

  • Anonymous
    August 18, 2009
    There are valid use cases for a bigger than 15x15 matrix is  in journal articles, manuscripts, technical reports and theses. It does not happen that often but when needed, it would be a big headache to find out you cannot do it as you're writing page 20 of your report... On the other hand, I agree that very long vectors would be very unlikely to happen.

  • Anonymous
    August 18, 2009
    The largest matrix I have entered in Word 2007 so far was 8 x 13.  I was illustrating a Kronecker product.  Somehow, though, 15 x 15 seems uncomfortably low.  

  • Anonymous
    August 18, 2009
    Is there a way to overlap symbols using ! as in LaTeX? E.g., $S!!!!{!}$ ?

  • Anonymous
    August 18, 2009
    I guess we should increase the upper limit on matrices, like to 20x20. Seems quite large. Re negative spacing like TeX's !, some need for such spacing is reduced by the automatic kerning between glyph pairs. There's also the hsmash phantom, which removes the width of its argument, allowing overlapping characters. But there isn't any negative thin space per se.

  • Anonymous
    August 19, 2009
    Murray, how do you use hsmach to create a symbol for superfactorial ('S' overlapped with '!') in Word?

  • Anonymous
    August 23, 2009
    Regarding the linear format paper, is there somewhere a full formal grammar of the linear format, or a reference parser?

  • Anonymous
    August 23, 2009
    The linear format has some special cases that don't lend themselves easily, at least, to a formal grammar. But if anyone succeeds in writing an accurate format grammar, I'd like to see it :-) The implementations in MS Office 2007 and 2010 are coded in C++, reside in the riched20.dll and communicate with clients using a math subset of the TOM2 interfaces. They don't use a formal grammar. Re Alex's question about creating a superfactorial in Word, it is possible to use a hsmash (horizontal smash) in Word to give the S a zero width and then space out a ! over it. But it doesn't look very convincing, since the ! needs to be a bit bigger. I'll probably do a post on negative spacing (or lack thereof) in the Office math model.

  • Anonymous
    August 24, 2009
    The superfactorial can be entered as "hsmash(S) hairsphairsp!". This "smashes" the width of the S, moves to the right by two hair spaces (a hair space is 1/18th em) and displays the !. Note that for Word 2007, hsmash wasn't defined, but you can use phantom(3&S) instead. The phantom(n&x) construction allows any combination of the five phantom bits to be set. One problem with the superfactorial is that the exclamation point needs to be a bit larger than the S in order to be legible. If the superfactorial is used in printed documents, we probably ought to add it to Unicode and then fonts can display a nicely legible version.

  • Anonymous
    November 10, 2009
    I am an engineering student, and I am currently writing a report for the design of a hybrid vehicle.  The analysis of the structure requires very rough finite element modelling, and the stiffness matrix (although sparse) requires minimum 19 nodes.  This set-up corresponds to a 19x19 matrix of which each element is a 3x3 submatrix so the 20x20 matrix or something bigger would be helpful.