Mr. Trump campaigned to help both kinds of coal recover.

But natural gas may prove unbeatable. The hydraulic fracturing boom in shale fields that began a decade ago flooded the market with cheap natural gas that continues to erode coal’s market share. As recently as early 2008, coal was the source of roughly half of the electricity generated in the United States. Now it is down to about 30 percent.

“There’s just a lot of gas in this country, and that is going to hold gas prices down,” said Scott Sheffield, chief executive of Pioneer Natural Resources, a major oil and natural gas producer, who said he voted for Mr. Trump.

The bleak outlook for coal may explain why some of the industry’s executives have been reluctant to comment on how the Trump presidency may help their business: They may be wary of raising false hopes among their workers. And many may be reluctant to repeat past industry arguments that climate change was a hoax. Instead, coal producers would rather have tax incentives to support environmental improvements for coal-fired plants, as a way to ensure coal’s long-term viability even beyond a Trump administration.

“Any exuberance has to be tempered,” said Richard Reavey, vice president for government and public affairs at Cloud Peak Energy, a major Western coal producer. “The view should be cautious optimism.”

Beyond the declining demand for coal, there has been an even more fundamental factor behind the shift in coal mining employment, which peaked decades ago. As with those in many industries, jobs in mining have fallen victim to automation. High-tech shears can now shave coal from underground seams — work that formerly required hundreds of miners. Surface mining, which has been increasing in recent years, has also replaced many workers with heavy machinery.

As a result, there are now just over 50,000 jobs in the American coal mining industry, down from a peak of more than 250,000 in 1980.