# LyX: Configure a command for 3x3 determinant

I've been trying to add a new command to LyX to easen my way through physics, when mostly 3x3 determinants are used.

I clicked Document -> Settings -> Preamble and wrote the following:

% det 3x3
\newcommand{\ninedet}{$\begin{vmatrix}\\ \\ \\ \end{vmatrix}$}


Now, there are a few problems:

1. I understand that this code is supposed to make a 3x1 det, not 3x3.
2. It doesn't seem to work either way.

Thoughts? Any help would be deeply appreciated. :)

-

## migrated from stackoverflow.comMar 20 '13 at 18:47

This question came from our site for professional and enthusiast programmers.

Welcome to TeX.sx! Your post was migrated here from Stack Overflow. Please register on this site, too, and make sure that both accounts are associated with each other (by using the same OpenID), otherwise you won't be able to comment on or accept answers or edit your question. –  Werner Mar 20 '13 at 23:52

I do not see the need of defining something new. With following approach, LyX will make use of the vmatrix environment automatically.
Use "Insert > Math > Matrix..." or alternatively, in math mode the toolbar to create an empty 3x3 matrix possible with some decoration like "|...|". Then you can copy and paste this matrix (either empty or already filled) to other locations in the document.