On 11/27/10 10:03 PM, Michal wrote:
Some time ago I've suggested to allow for differentiating preambles wrt branches, ie. allowing different preambles for different branches in the same document.Granted, this change was probably too big, and too little would be gained... but now I have some idea which, as I suppose, would be far easier to implement. The idea is to use the "preamble inset", which will look just like the ERT, but instead of inserting the TeX code inside the document, it will append this code to the end of the preamble (preferably with a newline at the end). That way the goal of multiple preambles could easily be achieved by putting such "preamble insets" inside branches.
I think this may be quite easy to do already, though it is a bit of a hack. LyX 2.0's layouts have an "InPreamble" tag, intended primarily for use with document classes that want, say, \title to be in the preamble. It should be possible to create a "Preamble" layout, with InPreamble true, that will just write its contents to the preamble. Richard
