There is something that still confuses me when you say “which flanker image (i.e. the direction of the middle arrow) would precede the sentence task,” because the flanker image does not (immediately) precede any sentence in a `flanker-flanker` pair, and the sentence is not (immediately) preceded by any flanker image in a `sentence-sentence` pair. You say that my second solution should work, so I presume that you do not want `sentence-sentence` or `flanker-flanker` pairs in the end?
The `latinMix` function takes two sets of labeled trials, say “A” and “B,” and outputs a sequence of pairs of trials evenly distributed over `A-B`, `B-A`, `A-A` and `B-B`. For example, if you have four A trials and four B trials, you could get `A(1)-B(4)-A(3)-A(2)-B(1)-A(4)-B(3)-B(2)`. I hard-coded the function to output such a crossing from strictly two labels, but it could in theory be modified to accommodate any number of labels. For example, with three labels `A`, `B` and `C`, a generalized function would output an even distribution of triples of trials over `A-B-C`, `A-C-B`, `B-A-C`, `B-C-A`, `C-A-B`, `C-B-A`, `A-A-A`, `A-A-B`, `A-A-C`, `A-B-B`, `A-C-C`, `B-A-A`, `B-B-A`, `B-B-B`, `B-B-C`, `B-B-B`, `C-A-A`, `C-B-B`, `C-C-A`, `C-C-B` and `C-C-C`. Is that what you want?