INTERRUPTING TALMUD TORAH FOR KEVURAS MESIM [burial:Talmud Torah]
Gemara
(Beraisa): We cease from learning Torah to escort a Mes or a Kalah. R. Yehudah used to do this. If enough people are at the funeral, we remain learning.
Question: What is considered enough?
Answer#1: (Rav Shmuel bar Ini): 12,000 men and 6,000 Shofar blowers suffice. Some say that the 6,000 Shofar blowers are counted in the 12,000 men.
Answer#2 (Ula): It must be enough people to reach from the gate of the city to the grave.
Answer#3 (Rav Sheshes): The taking of Torah is like its giving, with 600,000 people.
This applies to one who learned written and oral Torah. For one who taught there is no limit.
Megilah 3b: A Beraisa teaches that a Mes Mitzvah has precedence over learning Torah:
(Beraisa): We cease from learning Torah to escort a Mes or a Kalah
Rishonim
The Rif (Kesuvos 5b) and Rosh (Mo'ed Katan 3:61) bring the Gemara in Kesuvos verbatim.
Rambam (Hilchos Evel 14:9): We are Mevatel Talmud Torah for burial and Hachnasas Kalah. This is if there are not enough people; if there are enough, we are not Mevatel.
Lechem Mishneh: The Rambam holds like BaHaG that if people are taking care of the Mes, even if there is not a Minyan, others need not be Mevatel. Alternatively, 'enough' refers to a Minyan, and the Rambam holds like R. Netrunai Gaon.
Rambam (11): If a Chacham died, we are Mevatel Talmud Torah for Hotza'as ha'Mes (taking out the body) only if there are less than 600,000 people there. If a Chacham who taught Torah died, we are Mevatel no matter how many people are there.
Beis Yosef (YD 361 DH V'Chol): The Rambam connotes that he agrees with the Rosh and Ramban that we Mevatel only for Hotza'ah. Other needs of burial can be done by the heirs or burial group.
Rosh (Kesuvos 2:5): The Gemara (Megilah 3b) says that we are Mevatel Torah for a Mes Mitzvah. Really, we are Mevatel for any Mes. It mentioned Mes Mitzvah due to other laws mentioned there. If the city is divided into different groups regarding burial, each needs to engage only with its Mes, but at the time of Hotza'ah all must come.
Rosh (ibid.): Some say that it is Reshus to be Batel from Torah for a Mes. They explain the Gemara in Megilah to say that since one may be Batel for other Mesim, presumably one is obligated to be Batel for a Mes Mitzvah. Also, it says that R. Yehudah used to be Mevatel for a Mes. This implies that not everyone did. Also, the Yerushalmi (Kil'ayim 40b) says that we are not particular about Mesim or Kil'ayim in the Beis Medrash. R. Yosi was teaching; there was a Mes (in the city). Nothing was said to those who left or to those who stayed.
Rebuttal (Rosh): The Gemara says 'just like Torah was given to 600,000...', which connotes that it is obligatory. Even R. Yehudah, who had no occupation other than Torah, used to Mevatel, all the more so others. The Yerushalmi teaches that it is optional for a Kohen to remain in Ohel ha'Mes for the sake of Talmud Torah. The Bavli disagrees and permits only Beis ha'Peras and Chutz la'Aretz, which are Tum'os mid'Rabanan. The Yerushalmi similarly permits one who is wearing Kil'ayim to continue learning.
Rosh (2:6): Some say that a woman is like one who did not learn. Others disagree, for she is exempt. Rather, we honor her like one who learns, because she oversees the learning of her husband and children, and this is her merit (for the world to come).
Beis Yosef (DH u'Mah she'Chosav): The Rosh did not side with either opinion. The Tur says that the Rosh favors the opinion he brought last.
Rosh (Mo'ed Katan 3:61): The She'altos says that we are not Mevatel for one who did not learn, if there are enough taking care of him. R. Elyakim says that we are Mevatel only at the time of Hotza'ah. When a Chacham dies, his Beis Medrash is Batel for one day, but other Batei Medrash are not. R. Yom Tov says that children are not Batel even at the time of Hotza'ah, since they are not Batel even to build the Beis ha'Mikdash (Shabbos 119b). This is because Torah of one who never sinned is greater than that of one who sinned.
Poskim
Shulchan Aruch (361:1): We are Mevatel Talmud Torah for Hotza'as ha'Mes. If a Chacham taught Torah, we are Mevatel no matter how many people are there. If he learned Mikra and Mishnah but did not teach, we Mevatel if there are less than 600,000 there. If the Mes did not learn Mikra or Mishnah, we do not Mevatel if there are 10 engaging with him.
Shach (2): It seems that 600,000 is only if one learned Mikra and Mishnah. However, the Ritva connotes that it is even if he learned one of them.
Shach (4): We need 10 to say Kaddish and Birkas Avelim.
Shach (5): The Agudah says that if there is a group that takes care of burial, one who learns l'Shem Shomayim need not be Batel. The Bach says that this applies to one who learned, but not to one who taught. This is difficult, for the Agudah discusses not at the time of Hotza'ah, and then the exemption is even for one who taught!
Rema: Some say that nowadays, we are Mevatel for Stam Yisraelim, for they all learn some Mikra or Mishnah.
Shulchan Aruch (ibid.): Some say that a woman is like one who learned. Others say that she is like one who did not learn. The custom is to be lenient about women and children. We are not Mevatel if there are enough engaging with the Mes. If one is learning and he does not know, he need not go to check if there are enough.
Source (Beis Yosef DH v'Chosav Od): We learn this from the Yerushalmi.
Taz (1): This is unlike the Rema. It seems that a Rav teaching Talmidim should not be Batel unless we know that the Mes learned.
Shulchan Aruch (2): We are Mevatel from Torah only at the time of Hotza'ah, not as long as it is incumbent to bury him.
Beis Yosef (DH Kasuv b'Piskei): Piskei ha'Tosfos says that when a Chacham dies, his Beis Medrash is Batel only for one day. For other Mesim it is Batel only for Hotza'ah. It is a bad custom to be Batel as long as the Mes is in the city. It is done because otherwise everyone will learn and not enough will engage with the Mes.