On 01/23/2018 12:27 PM, Klaus-Dieter Bauer wrote:
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
    LyxTypecustom
    LabelStringAAA
    LatexNameAAA
    LatexTypecommand
    Preamble
    \newcommand\AAA[1]{hello #1 world}
    EndPreamble
    End

    InsetLayout Flex:BBB
    LyxTypecustom
    LabelStringBBB
    LatexNameBBB
    LatexTypecommand
    DependsOnFlex: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
What about putting the AAA and BBB insets in separate .inc files (say AAA.inc and BBB.inc), and then inputing the AAA.inc file near the top of the BBB.inc file?

Paul

Reply via email to