I figured it out myself: The DependsOn property apparently doesn't actually work for insets (only for styles).
2018-01-23 18:27 GMT+01:00 Klaus-Dieter Bauer <bauer.klaus.die...@gmail.com> : > Hello! > > Is there some way to specify layouts, that depend on the preamble of > another? > > Consider e.g. the following LyX file: > > #LyX 2.3 created this file. > \lyxformat 544 > \begin_document > \begin_header > \begin_local_layout > InsetLayout Flex:AAA > LyxType custom > LabelString AAA > LatexName AAA > LatexType command > Preamble > \newcommand\AAA[1]{hello #1 world} > EndPreamble > End > > InsetLayout Flex:BBB > LyxType custom > LabelString BBB > LatexName BBB > LatexType command > DependsOn Flex:AAA > Preamble > \newcommand\BBB[1]{bye(\AAA{#1})} > EndPreamble > End > > \end_local_layout > \end_header > \begin_body > \begin_layout Standard > \begin_inset Flex BBB > status open > \begin_layout Plain Layout > Hello. > \end_layout > \end_inset > \end_layout > \end_body > \end_document > > > The dependency of BBB on AAA is explicitly declared, but using \BBB in the > body adds only the preamble of \BBB, but not the preamble of \AAA, causing > an "undefined control sequence" error on compilation. > > As I understand, DependsOn merely declares that the preamble of AAA should > be added *before* the preamble of BBB, but only _if_ AAA is used itself. > > I couldn't find any feature that allows to declare an actual dependency, > rather than just the ordering. Am I missing something? > > - Klaus >