# Re: Unsupported math environments

On 2014-06-30, Jacob Bishop wrote:
> On Sun, Jun 29, 2014 at 1:52 AM, Georg Baum <georg.b...@post.rwth-aachen.de>
> wrote:


>> Unfortunately it is not possible to use unsupported math environments
>> in LyX without putting the whole formula in ERT or do some advanced
>> macro tricks.

This depends

* on the type of math environment:

It is possible to write \begin{foo} .... \end{foo},

it is possible to write \begin{foo}{c} .... \end{foo} where the second
opening bracket needs to be input as Ctrl-l {,

but I did not find a way to write unescaped & and \ in math-mode.

* on the notation of "advanced":

if there is a compatible (in input requirements) math environment that
LyX supports and that is not used in the document, a simple
re-definition in the user-preable would do the trick.

>> The reason for this is that the native LyX format for
>> math formulas is LaTeX. This is implemented in such a way that
>> _everything_ is parsed, so it is not possible to have a true ERT in
>> mathed. The parser supports unknown commands somewhat (so they appear
>> in red), but not environments.

>> This is of course a problem and needs to be fixed, but up to now nobody
>> worked on it. If it does not exist already please file a bug report at
>> http://www.lyx.org/trac/wiki/BugTrackerHome to support unknown
>> environments
>> in math.

> I fully agree with Georg that it is not currently possible to use
> unsupported math environments in LyX without using ERT or macro tricks.
> I also agree that this is a problem that should be fixed (although I
> can't immediately think of an easy way to fix it)

As defining an array/multiline type of equation for LyX is a nontrivial
task, there will be no easy way. I can imagine several ways:

* simple hack: ERT for math: allow unescaped special characters like \ and &
this would still provide a LyX-rendering for the "normal" content of the
unsupported environment.

* Define math environments in LyX-layout rules instead of hard-coded. Then,
a LyX-module can add support for new math environments.

* math-macro with "inheritance": base math macros on existing commands and
environments, allowing to change name and maybe some more aspects.

Günter