Document how to use Requires when there are multiple optional arguments.

Isaac Oscar Gariano <[email protected]>
Newsgroups gmane.editors.lyx.documentation
Message-ID <SY7P282MB3898D9DF3BD099C64AF7355B8CAFA@SY7P282MB3898.AUSP282.PROD.OUTLOOK.COM>
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
[email protected]
http://lists.lyx.org/mailman/listinfo/lyx-docs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.