Daniel Vainsencher wrote: >> I think the second one is doable as well. Ideally, a local layout (or >> module) would be generated for all unknown commands and environments. The >> needed infrastructure is all in place: you can define new known commands >> in tex2lyx during runtime, and since very recently layouts can be written >> in .layout file syntax. Of course such an automatically generated local >> layout might not be the optimal and most flexible way to use these >> commands, but at least better than ERT. > > Glad to know its there, more specifics would be welcome. From a quick > peek I would guess I need to call add_known_environment? That seems to > be called only from Preamble.cpp, so I guess I would need to add a call > to text.cpp, maybe in parse_unknown_environment? does that sound right?
Partly. I would not do it in parse_unknown_environment (sometimes we need ERT even for known commands, see the first invocation of parse_unknown_environment). I would put it just in front of the second invocation of parse_unknown_environment. Something similar would be needed for commands as well (call add_known_command). Please note that add_known_command and add_known_environment do not create new styles, they only ensure that tex2lyx knows which arguments are allowed for commands/environments, so that it outputs the ERT correctly. You would need to create the new style yourself and add it to the text class. > Pointers on how to create the layout file? The syntax is explained in lib/doc/Customization.lyx, but for the very first version I would not write a file. Instead, I would put the layout definitions into the preamble (inside begin_local_layout/end_local_layout), then you do not need to worry about file names and file management. Georg