BRASÍLIA — Before becoming Brazil’s interim president, Michel Temer had a bit more free time on his hands. As a lawmaker shuttling between Brasília and São Paulo a few years ago, he found himself jotting his musings on cocktail napkins in airport lounges.

In 2013, his first book of poetry, “Anonymous Intimacy,” was published, drawing mostly yawns from Brazilians.

Mr. Temer, 75, a button-down career politician whose demeanor is so cryptically ceremonious that his rivals liken him to a butler in a horror movie, was apparently inspired by an array of themes.

He brooded about the demise of letter-writing in the text-messaging era. He described a rookie lawyer’s pride in winning a case. Then there was his septuagenarian’s lustful ardor — after all, he had courted a new bride 42 years his junior.