BEIJING — China, the world’s largest tobacco producer and home to a third of all smokers, has issued a national ban on lighting up in hotels, restaurants and other indoor public spaces, the Health Ministry said on Thursday.

The rules, which take effect on May 1 and spell out education provisions about the dangers of tobacco, include restrictions on cigarette vending machines and on outdoor smoking that affects pedestrians.

But there are considerable loopholes. The rules do not cover factories, offices or government workplaces, and, more important, they lack specific penalty guidelines. That detail has prompted shrugs among devoted smokers, many of whom have long since learned to ignore the no-smoking signs in hospital waiting areas, gymnasium locker rooms and elevators.