Suppose you have a preview inset wrapped around some latex that gives a value to a control sequence, call it \foo. If you put \foo in ERT later in the text and wrap a preview inset around that, the value of \foo is not shown until the buffer is reloaded (when *every* preview inset is re-evaluated). If you change the contents of the initial preview inset, so that the value of \foo changes, that change is not reflected in the later use of \foo until the document is reloaded again (and every preview inset is re-evaluated). Looking at the lyxpreview.tex files in the temporary directory where LyX does its work, it doesn't look hard to my c++less eyes to include the child (or dependent) preview items along with the parent so that they are all updated at the same time, but unconnected preview insets are left undisturbed.

Two ways come to mind:

1. number all preview insets from 1 from the start of the document. (Perhaps that is done already?) Right-clicking on a preview inset would show two items, one giving the number of the inset, the other having a slot for the number of a parent preview inset. The parent would then need to be informed of the child's number, and one would need to check that the parent's number is smaller than the child's, that it occurs earlier in the document. Insertion of a new preview inset early in the document would require updating all numbers.

2. alternatively, make preview insets label-able and cross-reference-able, although in the nature of a preview inset the labels and references should not be displayed, but be accessible by right-clicking. LyX already keeps track of parent-child relations among labels and references. A change to a labelled preview inset would send not only it to lyxpreview.tex but all preview insets referencing it. Using labels would avoid the renumbering problem if a new preview inset is inserted early in the document, although I don't know how you check that the parent precedes the child in the document.

Andrew


Reply via email to