If you cast your first spell with X in its mana cost during a turn before Lattice Library is on the battlefield (including Lattice Library itself), casting another spell with X in its mana cost later in the turn won't cause its last ability to trigger.

Artwork
Loading artwork…
Lattice Library
Secrets of Strixhaven Commander · #40 · EN
Nonfoil—Foil—
Card rules
This enchantment enters with X study counters on it.
When this enchantment enters and whenever you cast your first spell with X in its mana cost each turn, create a 0/0 green and blue Fractal creature token. Put a number of +1/+1 counters on it equal to the number of study counters on this enchantment.
Rare · Illustrated by Constantin Marin
Format legality
Commander Legal
Duel Legal
Legacy Legal
Oathbreaker Legal
Tlr Legal
Vintage Legal
Alchemy Not Legal
Brawl Not Legal
Competitive Brawl Not Legal
Future Not Legal
Gladiator Not Legal
Historic Not Legal
Modern Not Legal
Old School Not Legal
Pauper Not Legal
Pauper Commander Not Legal
Penny Not Legal
Pioneer Not Legal
PreDH Not Legal
Premodern Not Legal
Standard Not Legal
Standard Brawl Not Legal
Timeless Not Legal
Rulings
Published rulings from the downloaded Scryfall catalog. Source card record · Rules and interactions
Lattice Library's last ability resolves before the spell that caused it to trigger. It resolves even if that spell is countered or otherwise leaves the stack.