SAN FRANCISCO — The author M.G. Hennessey remembers the moment a few years ago, after reading a book with a disappointed 9-year-old. “He wished there was a book about a kid like him,” she said.

The child was transgender, and although born female was living as a boy.

Ms. Hennessey decided she would write the book the child needed. “The Other Boy,” published by HarperCollins for young readers, follows the life of Shane, a fictional transgender boy. Ms. Hennessey, who is heterosexual, hoped the book would enlighten children to be accepting of others.

“The more you see representations in the media, the more familiar it becomes,” Ms. Hennessey said.

“The Other Boy” is part of a new battleground for rights for people who identify as lesbian, gay, bisexual, transgender or queer. As the L.G.B.T.Q. community has gained greater acceptance in America, some advocates now see an opportunity to prevent bigotry from taking root by reaching out to the youngest hearts and minds.

The fight is being waged in state legislatures and schools, but perhaps the most visible efforts are in the media, building on the “Will & Grace” effect, an acknowledgment that the TV sitcom has helped normalize L.G.B.T.Q. people as part of the nation’s fabric.