On three mornings each week, some 40 or 50 people gather on clear days in the plaza of the Salt Lake City Library’s downtown branch for tai chi. Wednesday was not a clear day, so they improvised.

Marita Hart took about half of the group, many of them homeless people who had waited in the rain for the library to open, inside to the basement level of the library’s atrium. Her husband, Bernie, took the rest across the street to the lawn of City Hall.

What do dozens of homeless people get from tai chi at the library? One participant, Chris Coons, put it plainly: “Sanity. Just a positive, happy, peaceful, tranquil environment.”

Librarians nationwide have known for decades, from firsthand experience, that some of their most regular patrons were homeless. Much of the public had no clue until 2007, when Chip Ward, then the assistant director at the Salt Lake City Library’s main branch, wrote an essay about the issue before his retirement after 30 years in libraries.

“I wanted to be a good witness and bear my testimony on the way out the door,” said Ward, 69, now living in Torrey. “I just wanted to raise awareness that public libraries had, in fact, become de facto shelters for the homeless during the day, and librarians were coping with a pretty serious challenge.”

One person who read the essay was the actor and filmmaker Emilio Estevez.

Estevez — whose onscreen history with libraries goes back to “The Breakfast Club” in the 1980s — was so taken with Ward’s essay that he bought the film rights to it and wrote a script inspired by it. After several starts and stops, Estevez’s movie, “The Public,” is opening Friday in theaters nationwide.

Estevez saw what Ward was describing years before the essay was published. Estevez did most of the research for his 2006 drama “Bobby,” about the days before Robert F. Kennedy’s assassination, in the Los Angeles Public Library.

“It wasn’t localized to Salt Lake City, it was the epidemic,” Estevez said over the phone from Cincinnati, where he was screening the movie on a cross-country tour. “He was talking about every urban library, which was experiencing a very similar situation.”

Homeless people, Estevez said, “are outcasts and misfits and marginalized and poor, yet they all have a story. Oftentimes, we assign a story to an individual, that is our own bias. ... I’m hoping that people will take another look and treat these individuals with dignity. Because they have a name and a face, and some of them have a family. Homelessness is not a condition, it’s a situation.”

That sense of individual humanity is something libraries can provide beyond services or assistance, said Peter Bromberg, executive director of the Salt Lake City Library.

“It’s a place where someone can come, and just make eye contact with them, and smile, and say, ‘How are you today?’” Bromberg said. “If you go to the mall, you might get kicked out. If you’re on the corner, someone might say, ‘Move it along.’ But a public library, by design, is open and welcoming to every resident.”

One of the library’s additions to help the homeless is a first-floor desk staffed by Volunteers for America. The partnership with VOA, started in 2010, connects people with resources — whether it’s getting housing vouchers or providing socks or a jacket. (The library provides some storage space for such items, as well as administrative support.)

“The population on the street tends to be not very trusting. You can’t just walk up and say, ‘Hey, let me give you some help,’” Bromberg said. “If they’re coming to the library on a regular basis, and the VOA staff are here, over time they can say hello, make eye contact, build up a relationship, build up a sense of trust.”

Other services simply offer people ways to pass the time. At computer terminals in the main branch, people access their email accounts or watch YouTube videos. On the main branch’s first floor, two guys play chess using 3-foot-tall chess pieces.

Bromberg said the library has adjusted its daytime programming, which usually had been child-focused events like preschool story time, to provide events adults could enjoy. These include arts and crafts programs, designed to “get people engaged creatively, getting their hands moving — there’s therapeutic value in that,” Bromberg said.

The tai chi sessions, which the Harts started three years ago, aren’t officially part of the library’s services, Marita Hart said, but the library’s permission to use the space is a blessing.

The group splits between the library atrium and the City Hall lawn for two reasons, Marita Hart said. One is that the library would require a permit for any group over 50 people. The other is that some participants are barred from the library, for violating the rules of conduct inside — a list that includes public intoxication, committing a crime, engaging in lewd behavior or damaging library property. Bans for the worst offenses can last up to three years.

On the plaza before the library opens, the Harts and other volunteers offer hot coffee and breakfast burritos. Once the doors open, people take their spots and follow the tai chi leader’s moves.

Above them, on a staircase between the first and second floors, Larry Winn — known as “Wolf” by others on the street — plays a recorder. The soothing music echoes through the atrium, creating a sound like the world’s largest day spa.

One woman, Nancy Humphrey, said tai chi gave her “self-confidence. Realizing I can, too, learn. I’m learning socialization, which I’m not so good with.”

“Our goal,” Marita Hart said, “is to [help them] step up to another level. To want something better, to have a voice.”

Ward didn’t know immediately that his voice, in that 2007 essay, was heard.

“The first signal I got that somebody else was paying attention,” Ward said, was when Estevez’s father, the actor Martin Sheen, contacted Ward’s publisher to ask permission to use the essay in a speech. Shortly after that, Estevez contacted Ward about acquiring the film rights.

When Estevez read the essay, first in the Los Angeles Times and in longer form on TomDispatch.com, “I began to imagine what it would look like if these people, these patrons, staged an old-fashioned, 1960s-style sit-in,” Estevez said. “How would law enforcement react? How would the media spin it and report on it? How, ultimately, would politicians use the event, and maybe change the narrative to their own political gain?”

All those things happen in “The Public,” when a group of homeless men decide to occupy the third floor of The Public Library in Cincinnati on a bitterly cold night. The librarian, Stuart Goodson (played by Estevez), takes up their cause and becomes their spokesman. He faces a police negotiator (Alec Baldwin), a prosecutor (Christian Slater) running for mayor and a reporter (Gabrielle Union) more interested in soundbites than substance.

(Photo courtesy of Greenwich Entertainment) Emilio Estevez plays Stuart Goodson, a librarian who gets in the middle of a standoff between homeless patrons and police, in the drama "The Public," which Estevez wrote and directed.

Estevez had financial backing to make “The Public” in 2008, but it fell apart in the financial crisis that year. Estevez went to Spain to direct “The Way,” a movie about a father (played by Sheen) fulfilling his son’s wish to walk the Camino de Santiago pilgrimage.

“In the meantime, I just couldn’t shake this, and I thought it was a story that needed to be told,” Estevez said. “Every aspect of this movie feels very timely and relevant, and perhaps more so than if we had made it 10 years ago.”

Over that 12 years, Ward found his essay was having its impact. In some reprintings, the essay’s headline was “What they didn’t teach us in library school.” Ward is proud to note that many colleges that teach library science now do. “Apparently, I made it into the curriculum,” he said.

Ward said he and Estevez have been “like pen pals for the last 11 years,” but never met in person until last month. That’s when Estevez, as part of a six-week tour showing “The Public” to groups around the country, brought it to the Salt Lake City Library.

Estevez recalled “how kind and how gracious and generous Chip was. He had been somewhat of a north star for me. He kept encouraging me. ... He said, ‘Have faith,’ ‘You’re on the right track,’ ‘Don’t abandon this’ and ‘Godspeed.’ There was a part of me that didn’t want to disappoint him.”

(By the way, Estevez kind of fell in love with the Salt Lake City Library. “It is absolutely breathtaking, architecturally, and how it’s organized,” he said. “The staff there was just a bunch of really terrific folks.”)

Ward enjoyed the movie. “I thought it was sort of an old-fashioned feel-good kind of movie, and there’s nothing wrong with that,” Ward said. “It underscores how libraries have become de facto shelters, the struggle that librarians pursue, and the grace that they bring to that struggle. And the homeless characters in the movie were sympathetic, and that’s not a population that gets a very sympathetic treatment.”

Estevez said he hopes “The Public” will make people appreciate their local library anew. “I hope people occupy their library,” Estevez said. “I hope they go back and discover that librarians were the first Google. Libraries are where facts live. These days, when we’re not getting a lot of facts delivered on a daily basis, it requires some effort. We have to do a little digging to uncover the truth.”

Correction: 11:30 a.m. April 8: This story has been updated to correct the title of Chip Ward, who retired as assistant director at the Salt Lake City Public Library’s Main branch.