Siman 72
Presented here for study, not as a practical ruling. The Shulchan Aruch rules by Sephardi custom, the Rema's glosses by Ashkenazi custom, and the Kitzur follows Ashkenazi custom. For a practical question, ask your rabbi.
א נוֹשְׂאֵי הַמִּטָּה וְחִלּוּפֵיהֶן וְחִלּוּפֵי חִלּוּפֵיהֶן, בֵּין אוֹתָם שֶׁהֵם לִפְנֵי הַמִּטָּה בֵּין אוֹתָם שֶׁהֵם לְאַחֲרֶיהָ, מֵאַחַר שֶׁלַּמִּטָּה צֹרֶךְ בָּהֶם, פְּטוּרִים. וּשְׁאָר הַמְלַוִּין אֶת הַמֵּת, שֶׁאֵין לַמִּטָּה צֹרֶךְ בָּהֶם, חַיָּבִים.
1 Laws of Those who Carry the Bier and Those who Comfort and Escort, Containing 5 S'ifim Those who carry the bier and the substitutes (ie. those who will take over for the first ones) and the substitutes for the substitutes, whether they are those who are in front of the bier (ie. who have not yet carried it) or those who are in back of it (ie. who carried it already), since they are needed for the sake of the bier, they are exempt. And the rest of the escorters of the dead (ie. they are just escorting it but not carrying it) who are not needed for the sake of the bier, are obligated.
ב אֵין מוֹצִיאִין אֶת הַמֵּת סָמוּךְ לִקְרִיאַת שְׁמַע, שֶׁאֵין שְׁהוּת לְהוֹצִיאוֹ וּלְקָבְרוֹ קֹדֶם שֶׁיַּגִּיעַ זְמַן קְרִיאַת שְׁמַע. וְאִם הִתְחִילוּ לְהוֹצִיאוֹ, אֵין מַפְסִיקִין כְּדֵי לִקְרוֹת.
2 We do not bring out the body close to [the time for the] Recitation of the Sh'ma, in that there is not [enough] time to bring it out and to bury it before the time of the Recitation of the Sh'ma will arrive. But if they [already] began to bring it out, then we do not interrupt in order to recite [it].
ג הָעָם הָעוֹסְקִים בְּהֶסְפֵּד בִּזְמַן שֶׁהַמֵּת מֻטָּל לִפְנֵיהֶם, נִשְׁמָטִים אֶחָד אֶחָד וְקוֹרִין וּמִתְפַּלְּלִין. אֵין הַמֵּת מֻטָּל לִפְנֵיהֶם, הֵם קוֹרִין וּמִתְפַּלְּלִין, וְהָאוֹנֵן יוֹשֵׁב וְדוֹמֵם.
3 The people occupied with the eulogy at the time that the body is lying before them slip away one by one and recite [the Sh'ma] and pray [the Amidah]. If the body is not lying before them, they recite [Sh'ma] and pray, and the pre-burial-mourner sits and is silent.
ד קָבְרוּ אֶת הַמֵּת וְחָזְרוּ הָאֲבֵלִים לְקַבֵּל תַּנְחוּמִין, וְכָל הָעָם הוֹלְכִין אַחֲרֵיהֶם מִמְּקוֹם הַקֶּבֶר לַמָּקוֹם שֶׁעוֹמְדִין שָׁם הָאֲבֵלִים לַעֲשׂוֹת שׁוּרָה לְקַבֵּל תַּנְחוּמִין, אִם יְכוֹלִין הָעָם לְהַתְחִיל וְלִגְמֹר אֲפִלּוּ פָּסוּק אֶחָד קֹדֶם שֶׁיַּגִּיעוּ לַשּׁוּרָה, יַתְחִילוּ. וְאִם לָאו, לֹא יַתְחִילוּ: הַגָּה: אִם יֵשׁ שְׁהוּת בַּיּוֹם לִקְרֹא אַחַר כָּךְ (בֵּית יוֹסֵף בְּשֵׁם (הָרַמְבַּ"ן) [הַרַמְבַּ"ם]).
4 They buried the deceased and the mourners returned to receive condolences, and all the people go after them from the place of the grave to the place that the mourners are standing to do a line to receive condolences - if the people are able to begin and to finish even one verse before they arrive at the line, they begin. And if not, they don't begin. Rema: if there is time [left] in the day to recite afterwards (Beit Yosef in the name of the Ramban).
ה הָעוֹמְדִים בְּשׁוּרָה לְנַחֲמוֹ, הַפְּנִימִים שֶׁרוֹאִים פְּנֵי הָאָבֵל, פְּטוּרִים. וְהַחִיצוֹנִים שֶׁאֵינָם רוֹאִים פְּנֵי הָאָבֵל, חַיָּבִים:
5 The ones standing in line to comfort [the mourner], the inner ones that see the face of the mourner are exempt, and the outer ones that do not see the face of the mourner are obligated.