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?
2 Answers
When in mathmode, go to Insert --> Math --> Matrix (or click the button on the bottom toolbar:
).
Make it two rows by one column, and in the lower right of the window choose the appropriate type:

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.
- 206,688
-
great answer! is there a shortcut for this? – Danny Rancher May 04 '12 at 15:35
-
1@DannyRancher Torbjørn T. already gave the shortest way by default. There is no default shortcut key for inserting a matrix but you can make your own: Preferences > Editing > Shortcuts > Mathematical Symbols > math-matrix. This won't open the dialog, but it will create a 1 by 1 matrix where you can then add additional rows and/or columns as desired (using the add column and add row buttons in the math toolbar). – JohnReed May 04 '12 at 16:31
-
@DannyRancher I added a section about adding a keyboard shortcut. – Torbjørn T. May 05 '12 at 07:21
Torbjørn T. posted the correct answer. I just want to show this alternative way because it is good practice for adding other kinds of "shortcuts" for cases where there is not an explicit LyX command. For more information on math macros, see Section 22 in Help > Math

- 13,164