Review the item:
Latoya tried to concentrate on Professor Lemon's dull art history
lecture,
but the darkened classroom and endless slide show soon had her dozing
in her seat, Latoya knew that Beverly would poke her with a pencil if Professor
Lemon bothered to glance their way.
The comma between lecture and but is necessary. Latoya tried to concentrate on Professor Lemon's dull art history lecture is a main clause. The darkened classroom and endless slide show soon had her dozing in her seat is another main clause.
Connecting two main clauses with a comma and a coordinating conjunction like but is a perfectly legal move in writing.