Jeremy Daily a écrit :
Mael,

Thanks for the suggestion. The logic made sense, but your suggestion did not work. LyX generated an extra line between the commands in the tex file.


This is now possible by using character styles (available in LyX 1.4.0pre3). The following layout sample won't produce any extra line between the two commands:

CharStyle Author
  Margin        Static
  LatexType     Command
  InTitle       1
  LatexName     AddAuthor
End

CharStyle Affiliation
  Margin        Static
  LatexType     Command
  InTitle       1
  LatexName     donothing
  Preamble
    \newcommand{\donothing}[1]{#1}
  EndPreamble
End

Note: I don't know if "InTitle" works with character styles -- you'll have to test it...

In order to use these character styles, make a new paragraph (Standard), go to "Insert>Character style>Author", type in the author name, put the cursor at the right of the author name (out of the Author character style) and then go to "Insert>Character style>Affiliation", and type in the author's affiliation. You'll then have the following displayed into LyX window:

 Mael     IFTS
|_______||_____________|
 Author    Affiliation

Compile your document. That's it! LyX then actually generates the right LaTeX code: \AddAuthor{Mael}\donothing{IFTS}

This workaround can be used to manage LaTeX macros with any number of arguments. It also has the advantage of allowing the user to combine commands with environments, which may be useful for example in order to manage packages such as "acronym.sty".

Regards,
Mael.

--
Mael Hilléreau

Reply via email to