[Tex/LaTex] LyX: Configure a command for 3×3 determinant

lyxmatrices

I've been trying to add a new command to LyX to easen my way through physics, when mostly 3×3 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 3×1 det, not 3×3.
  2. It doesn't seem to work either way.

Thoughts? Any help would be deeply appreciated. :)

Best Answer

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.

enter image description here

Related Question