>>>>> "A" == A Rosina Bignall <[EMAIL PROTECTED]> writes:

A> I'm trying to create a layout for a latex style that I use
A> regularly. One of the commands has two parameters. For example, in
A> LaTeX, I would write:

A> \addresses{my home address}{my work address}

A> How can I define this command to Lyx? My stab at it is

A> Style Addresses LatexType Command LatexName addresses LabelType
A> Static LabelString Addresses: End

A> But, I don't see any way to tell LyX that this command has two
A> parameters. I also have a command with three parameters to make
A> things yet more interesting. What do you suggest?


What I would do in this case is something like: 

Style Home_Address
  LatexName homeaddress
  LatexType command

  Preamble
    \newcommand{\homeaddress}[1]{\def\thehomeaddress{##1}}
    \homeaddress{Not Given!}
  EndPreamble
End

Style Work_Address
  LatexName workaddress
  LatexType command

  Preamble
    \newcommand{\workaddress}[1]{\def\theworkaddress{##1}}
    \workaddress{Not Given!}
  EndPreamble
End

Style Show_Addresses
  LatexName addresses
  LatexType command
  LatexParam "{\thehomeaddress}{\theworkaddress}"

  KeepEmpty 1
End


To use this, you should have the three styles given in a row, with no
text in the last one. Another solution to avoid the last paragraph, is
to setup the macro to work like the \title commands of LaTeX. In this
case, by adding "Intitle 1" to the layouts, a "\maketitle" will be
generated after those layouts automatically. 

Feel free to ask if I am not clear enough.

JMarc

Reply via email to