שולחן ערוך, יורה דעה שמ״ד

Shulchan Arukh, Yoreh De'ah 344

חיוב ההספד וגודל שכרו וכיצד ועל מי מספידין. ובו כ' סעיפים:
מצוה גדולה להספיד על המת כראוי ומצותו שירים קולו לומר עליו דברים המשברים את הלב כדי להרבות בכיה ולהזכיר שבחו ואסור להפליג בשבחו יותר מדאי אלא מזכירין מדות טובות שבו ומוסיפין בהם קצת רק שלא יפליג ואם לא היו בו מדות טובות כלל לא יזכיר עליו וחכם וחסיד מזכירין להם חכמתם וחסידותם וכל המזכיר על מי שלא היה בו כלל או שמוסיף להפליג יותר מדאי על מה שהיה בו גורם רעה לעצמו ולמת:
It is an important religious duty to lament the dead fittingly; and the religious duty [is fulfilled] when one raises his voice [in funereal lamentations] to utter over him [the dead] words which break the heart in order to cause much weeping, and to mention his praise. It is forbidden to over-praise him too much, save to mention his good characteristic features [to which] a little may be added, provided one does not overexaggerate. And if he possessed no good characteristic features whatever, one should not mention [this] regarding him. [With respect to] a Sage and a pious man one may mention their wisdom and piety [respectively]. And one who mentions [aught] regarding one who did not possess [it] at all, or exaggerates too much that which he did possess, causes harm to himself and to the dead.
כשם שמספידין על האנשים כך מספידין על הנשים כראוי להן. (ונספדות בין האנשים וחכמים) (טור):
Just as [funerary] lamentations are made for men, so too, are [funerary] lamentations made for women as is fitting for them. And they are lamented amongst men and scholars.
במקום שרגילין להשכיר מקוננות להספיד חייב להשכיר מקוננות להספיד על אשתו ואם לא רצה בא אביה ומשכיר ומוציא ממנו בעל כרחו:
In a locality where it is customary to hire wailing women to make the lamentation, one is dutibound to hire wailing women to make the lamentation for his wife. If he [the husband] was unwilling [to provide wailing women], her father comes and provides [this] and collects from him [the husband] against his will.
קטן בן כמה שנים יהיה כשמספידין עליו עניים בני חמשה עשירים בני ששה בני זקנים כבני עניים אבל צדוק הדין וקדיש אומרים על תינוק משעברו עליו שלשים יום: הגה ואין נוהגים כן אלא עד שיהיה בן י"ב חדש שיוצא במטה כדלקמן סימן שנ"ג סעיף ה':
How old must an infant be with respect to making a lamentation for him? — With respect to the poor [a lamentation is made] for children of five years old; with respect to the rich, for children of six years old, and with respect to the children of elders, they are [regarded] as the children of the poor. However, one should recite Zidduk Haddin and Kaddish for an infant [who died] after thirty days have passed [from birth]. Gloss: We do not follow this practice unless the infant is twelve months old and is taken out [for burial] on a bier as explained infra § 353, par. 5.
בני עשירים ובני חכמים מוסיפין קצת על שבח מעשיהם:
[In the case of] the children of the rich and the children of scholars, one may add a little to the praise of their deeds.
תינוק שיודע לישא וליתן מספידין אותו במעשה עצמו ואם אין לו מעשים מספידין אותו במעשה אבותיו ואם אין להם מעשים מספידין להם במעשה קרוביו:
For a child who knows how to argue, a lamentation is made on account of his own deeds; and if he has no deeds, a lamentation is made for him on account of his parents' deeds; and if they [the parents] possess no deeds, a lamentation is made for them on account of the deeds of his relatives.
הכלה מספידין אותה בין במעשה אביה בין במעשה בעלה:
For a daughter-in-law a lamentation is made both on account of her father's deeds as well as on account of her husband's deeds.
המחותך והמסורס והנפלים ובן ח' וכן בן ט' מת והעובד כוכבים והעבדים אין מתעסקין להספד וללוות:
[For an embryo that came out] by pieces or with its feet foremost; for premature-born children; for a [viable] birth [which takes place after] eight [months of pregnancy] or a still birth [after] nine [months of pregnancy]; for a heathen or slaves, one does not engage in making a lamentation nor does one follow the funeral procession.
יורשים שאינן רוצים לפרוע שכר הספדן מוציאין מהם בעל כרחם:
Heirs who refuse to pay the honorarium of the funerary orator are made to pay against their will.
מי שצוה שלא יספדוהו שומעין לו. (אבל אם צוה שלא לנהוג עליו ז' וגזירת שלשים אין שומעין לו) (מהרי"ו סימן ד'):
One who left instructions that no lamentation be made for him, is obeyed. But if one instructed not to observe for him the seven or the restrictions of the thirty [days of mourning] is not obeyed.
איסור תלישת שיער וכן שריטה על מת בסימן ק"פ:
The prohibition against tearing the hair or lacerating the flesh [in token of mourning] for a dead person, is found [supra] § 180.
העם העוסקים בהספד כל זמן שהמת מוטל לפניהם נשמטים אחד אחד וקורין את שמע ומתפללין אין המת מוטל לפניהם הם יושבים וקורין והאונן יושב ודומם הם עומדים ומתפללין והוא מצדיק עליו את הדין ואומר יהי רצון מלפניך ה' אלהי שתגדור פרצותינו ופרצות עמך בית ישראל:
The people who are engaged in the lamentation, as long as the corpse lies before them, they slip out one by one and read the Shema and recite the Tefillah; [if] the corpse does not lie before them, they sit and read [the Shema] and the Onen sits in silence; they stand and recite the Tefillah and he acknowledges the justice of the [Divine] verdict, and says, 'May it be Thy Will, O Lord, my God, that Thou repare our breaches and the breaches of Thy people the House of Israel.'
לאחר קבורה מפסיקין ההספד בין לקריאת שמע בין לתפלה. (ועיין באורח חיים סימן ע"ב):
After burial, the lamentation is interrupted both for the purpose of reading the Shema as well as [the recital of] the Tefillah.
אין עושין שני הספדין בעיר אחת אלא א"כ יש שם רוב עם ליחלק לשנים ויהיה בכל הספד עם כדי צרכו:
Two lamentations are not made [simultaneously] in the same city, unless there is a multitude of people that could be divided into two [groups, so that] at every lamentation there will be a sufficient number of people [present].
אין עושים שני הספדים בעיר אחת אלא אם כן יש כדי לספר שבחיו של זה ושבחיו של זה:
Two lamentations are not made [simultaneously] in the same city, unless there is [a funerary orator available] in order to tell the praises of one [dead] and [another funerary orator to tell] the praises of the other [dead].
אין אומרים בפני המת אלא דברים של מת כגון צרכי קבורתו והספד אבל שאר כל דבר אסור והני מילי בדברי תורה אבל במילי דעלמא לית לן בה:
One may discuss in the presence of the corpse only those matters which concern the dead person, e.g., [matters pertaining to] his burial needs and lamentation; but all other matters are forbidden. And this ruling obtains only with respect to Torah discussions, but in [the case of] secular matters we do not mind.
מותר לומר פסוקים ודרשה לכבוד המת בתוך ארבע אמותיו או בבית הקברות (מהרא"י בביאור מא"ח לדעת רמ"ה):
It is permissible to recite Biblical verses and [render] expositions in honour of the dead person within his four cubits, or on the cemetery.
חכם שמת בית מדרשו בטל שסופדין אותו כל שבעה אבל שאר מדרשות עוסקין בתורה אפי' בשעת הספד ואחר ההספד אין תלמידיו מתקבצים בבית מדרשו אלא מתחברים שנים שנים ולומדים בבתיהם. אב בית דין שמת כל מדרשות שבעיר בטלין והרגילין להתפלל בב"ה משנים מקומם. נשיא שמת כל בתי מדרשות שבכל מקום שמספידין אותו בטלים ואחר ההספד אין נכנסים לבית המדרש אלא מתחברי' שנים שנים ולומדין בבתיה' וכל בני העיר מתפללים בבית האבל בין בחול בין בשבת חוץ מקריאת התורה בשבת ושני וחמישי שקורין בב"ה ולא [יטיילו] בשוק אלא יושבים משפחות משפחות ודוים כל היום:
When a Hakam dies, his Academy is in recess, for they make a lamentation for him throughout the seven [days of mourning]; but [all] the other Academies engage in [the study of] the Torah, even during the time that the lamentation is held; and after the lamentation his disciples do not assemble in his Academy, but join in pairs and study at their homes. When an Ab Beth Din dies, all the Academies of the city are in recess, and those who are in the habit of saying their prayers [the Tefillah] in the Synagogue, change their [customary] places. When a Nasi dies, all Academies, wherever a lamentation is made for him, are in recess; and after the lamentation, they do not enter the Academy, but join in pairs and study at their homes, and all the townspeople say their prayers [the Tefillah] in the house of mourning, both on a weekday and on the Sabbath save the reading of [the weekly portions] of the Torah on the Sabbath, the second and the fifth [days of the week] which they read in the Synagogue. And they should not walk about in the street, but they sit [at home] in family groups and feel the affliction all day.
מספידין תלמידי חכמי' ונשותיהם בב"ה ובבית המדרש אבל לא שאר העם:
Lamentations are made for scholars and their wives in the Synagogue and in the Academy, but not for the rest of the people.
חכם ואלוף וגאון מכניסין אותו לבית המדרש ומניחין המטה במקום שהיה דורש וסופדין אותו שם וכשמוציאים המטה סופדים אותו עד בית הקברות וביום הז' עולים לבית הקברות ומבקרין אותו וכן ביום שלשים ותכלית י"ב חדש מבקרין ומשכיבין אותו:
A Hakam or an Aluf or a Gaon is brought into the Academy and the bier is placed on the spot where he used to lecture and a lamentation is made for him there, and when they take the bier out they make a lamentation for him until [they reach] the cemetery, and on the seventh day they go up to the cemetery and visit him, and likewise on the thirtieth day, and [thus] for twelve complete months they visit [him] and recite the Hashkabah.

Ashlei Ravrevei: Shulchan Aruch Yoreh Deah, Lemberg, 1888 (Public Domain) · Code of Hebrew Law by Chaim N. Denburg, Montreal, 1955 (CC-BY) · 20 se'ifim