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.
Best Answer
To have an equivalent of the LaTeX
\left\| \begin{array}{l} \mbox{For } a \\ f(a') \\ \end{array} \right.
First, you go I̲nsert>Math̲>Delimiter̲s
You uncheck the box "Keep matched" and you chose the correct left and right:
Then, inside these delimiters, you will be in maths mode and have access to the maths toolbar. Add a matrix 2x1:
Finally, you may want to use a \mbox for your "For ", Lyx should auto-complete.
Fill the matrix with the wanted elements, and you get:
You could also use
\textit
instead of the\mbox
and have: