[Tex/LaTex] Use \multicolumn in array environment in Lyx

arraysbreqnlyxmulticolumn

I want to break an equation in a longer equation array in Lyx. In pure Latex I can do something like

\documentclass[a4paper,10pt]{article}    
\usepackage{amsmath}
\begin{document}
\begin{eqnarray}
  \begin{array}{lllllll}
  a & = & Term_1   &+ & Term_2   &+ &Term_3\\
    & = & Term_1^* &+ & Term_2^* &+ &Term_3^*\\  
  Z & = &\multicolumn{5}{l}{ \text{A long long long long Term}}
  \end{array}
\end{eqnarray}
\end{document}

which gives this result
enter image description here

In the last row the RHS of the equal sign should NOT use the alignment. In contrast to the example above, The second and the third row should have an equation number.

My idea was to achieve this in Lyx with a \multicolumn command as above. However, when I manually enter the multicolumn command, the compilation quits with an error and in the source view the lyx code looks like

\multicolumn\{5\}\{l\}

Is there a way to get this working in Lyx?

Best Answer

My suggestion would be to place the equation construction inside an ERT:

enter image description here

You may have to set amsmath to be "load always" (Document > Settings... > Math Options) or add

\usepackage{amsmath}

to your Document > LaTeX Preamble.

Here is what the output looks like:

enter image description here

Related Question