Hey,
So I wanted to create an inset with multiple optional arguments; lyx's 
Customization documenation mentions a Requires [int=0]​ option which "defines 
another argument (by its number) which this argument requires to be output if 
it is itself output."

So I tried to do this:
​InsetLayout Flex:MyInset
        LatexType environment
        LatexName LatexEnv
        Argument 1
                       Mandatory 0
        EndArgument
        Argument 2
                 Mandatory 0
                 Requires 1
         EndArgument
         Argument 3
                Mandatory 0
                Requires 2
         EndArgument
End

The idea is that all 3 arguments to the inset are optional, but if you only 
provided Argument 3 (say with the value "value"), I'd expect the latex to be:

\begin{LatexEnv}[][][value]​

However it only outputs one '[]' which is wrong (as then 'value' is the 2nd 
argument, not the 3rd ).

So I went into the source code of LyX wanting to fix this issue,  and found 
that the "Requires" doesn't actually take an integer, but a comma-seperated 
list of integers!
So the solution was to put Requires "1, 2"​ (with the quotation marks) in my 
Layout instead of just Requires 2​.

I think this behaviour should be documented. I would modify the documentation 
myself, and submit a patch, but you appear to be using some kind of change 
tracking thing, and I'm completely unformaliary with it.

— Isaac Oscar Gariano​
-- 
lyx-docs mailing list
lyx-docs@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-docs

Reply via email to