[Tex/LaTex] How to write a vertical vector in LaTeX for LyX

lyxmath-modematrices

I can't work out how to write a vertical (two dimensional) vector, with brackets spanning two lines. Do you know how to write it for LyX?

Best Answer

When in mathmode, go to Insert --> Math --> Matrix (or click the button on the bottom toolbar: enter image description here).

Make it two rows by one column, and in the lower right of the window choose the appropriate type:

enter image description here

Keyboard shortcut

As mentioned by JohnReed in the comments, you could create a shortcut for inserting a math-matrix, but this would add an array without delimiters. It is however possible to add the desired delimiters, rows and columns with one shortcut.

Shortcuts are added in Tools --> Preferences --> Editing --> Shortcuts (see Shortcuts for Lemma, Claim, Theorem etc for some more details). The LyX function you need to use for this new shortcut is of the form

math-ams-matrix <# columns> <# rows> <name of amsmath matrix type>

The amsmath package provides several matrix environments with different delimiters:

  • pmatrix: ( )
  • bmatrix: [ ]
  • Bmatrix: { }
  • vmatrix: | |
  • Vmatrix: || ||

So for creating a matrix with two rows, one column and square brackets around it, the necessary LyX function is

math-ams-matrix 1 2 bmatrix

If this is the only type of matrix you need a shortcut for, just choose an appropriate shortcut. Should you want to have shortcuts for different size matrices and delimiters, using the same pattern for all would be helpful in remembering them. For the example above you could use a shortcut such as

  • Ctrl + Alt + Shift + M 2 1 b

in other words, hold down Ctrl, Alt and Shift and tap M, then release all the keys and type 2 1 b. You could set up similar shortcuts where the numbers indicate number of rows and columns, and the final letter the delimiter.

Related Question