82. Eating and Drinking in Shul
13:4 One may not eat, drink or sleep in a shul or a beis medrash, not even a nap. (Nor may one do his work there – Mishnah Brurah 151:3; the Mishnah Brurah permits one to nap in a beis medrash since they are designed for people to stay in for long periods of time – MB 151:16.) In the case of a mitzvah, one may sleep there (though not near the Aron HaKodesh, where the Torahs are kept) or eat there (though he may not become drunken or act lightheaded). Those who are regularly found in these places may eat and sleep there so as not to take them away from their studies. (It may also permitted to house guests who need a place to stay in these places – MB 151:5, though there are some caveats; see there.)
13:5 When building a shul, it is important to consult a scholar who is proficient in such matters to provide proper instructions.