# Use \multicolumn in array environment in Lyx

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

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?

• Don't use eqnarray -- it's outdated – user31729 Oct 13 '15 at 14:13
• This may have something to do with Evil Red Text ( wiki.lyx.org/FAQ/ERT ) – Marijn Oct 13 '15 at 14:58

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

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:

• Thanks. Would of course solve the problem but is not so satisfying at the same time. Is there a way to only insert ERT with the correct \multicloumn command? – Daniel Oct 14 '15 at 13:51