Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

I would like to create a style for a command that takes multiple arguments:

\classify{A}{B}{C}

I started creating a style

Style Classify
    Category   FrontMatter

    LatexType  Command
    LatexName  classify
End

but this kind of style works only for commands that take a single argument. How can I modify the style definition so that it accepts multiple arguments and optional arguments?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

This is not possible in LyX 2.0.x. LyX 2.1 provides a very flexible argument framework. LyX 2.1 will be released in a couple of months. You can use the development version (pretty stable) now alongside your current version on Ubuntu very easily with the LyX PPA.

To accomplish what you want to do in LyX 2.1, use the following:

Style Classify
    Category   FrontMatter
    LatexType  Command
    LatexName  refine
 Argument 1
    Mandatory 1
    LabelString "FirstMandatoryArg"
  EndArgument
 Argument 2
    Mandatory 1
    LabelString "SecondMandatoryArg"
  EndArgument
End

Attached is a screenshot that shows you how to use it. Note that the items are greyed out in the Insert menu because I've already inserted them. Note also that the order doesn't matter (thus A C B will still be {A}{B}{C}). You can see this in the LaTeX preview at the bottom of the screenshot.

enter image description here

share|improve this answer
    
What are the suggested workarounds for 2.0. I think that many other classes suffer the same problem, don't they? –  gioele May 16 '13 at 20:43
1  
@gioele As far as I know, ERT (that is, not using a layout) is the only workaround. –  scottkosty May 16 '13 at 20:45
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.