Protesters outside the Pennsylvania capitol try to persuade electors to vote against Donald Trump. (Mark Makela/Getty Images)

Electors gathered in every state Monday to formally elect Donald Trump president of the United States, even as anti-Trump forces tried to deny him the White House.

Protesters gathered at state capitols, but they were unable to persuade the electoral college to reject Trump. More than 200 demonstrators stood on the steps of Pennsylvania’s capitol, waving signs in 25-degree weather.

Republican electors say they received many emails, letters and phone calls urging them not to support Trump. There is no federal law that requires electors to vote for the candidate who won their state. But more than 99 percent of electors throughout U.S. history have done so.

[Read more from KidsPost about the electoral college.]

With several states still voting early Monday evening, Trump had 304 votes and former secretary of state Hillary Clinton had 169. It takes 270 electoral college votes to win the presidency. Texas put Trump over the top, despite two Republican electors casting protest votes.

Rex Teter, a member of the electoral college, holds two days’ worth of mail last week at his home in Pasadena, Texas. Republican electors say they had received many emails, phone calls and letters urging them not to support Trump. (David J. Phillip/AP)

The number of electors a state has is based on how many representatives it has in the House of Representatives plus one for each senator.

Electors are selected by state parties and are often insiders who can be trusted to vote for the party’s candidate. Many Republican electors said they feel duty-bound to honor their pledge to vote for the candidate who won their state, regardless of how they feel about Trump.

A joint session of Congress is scheduled for January 6 to certify the results of the electoral college vote. The winner will be sworn in January 20.