The Shulchan Aruch · Orach Chayim
אורח חיים תקע״חOrach Chayim 578
Siman 578 of 697 in Orach Chayim — 1 se'if
הלכות תעניתLaws of Fast Days· siman 578
Se’if 1א׳
כְּשֵׁם שֶׁהַצִּבּוּר מִתְעַנִּים וּמִתְפַּלְּלִים עַל צָרָתָם, כָּךְ כָּל יָחִיד מִתְעַנֶּה וּמִתְפַּלֵּל עַל צָרָתוֹ. כֵּיצַד, הָיָה לוֹ חוֹלֶה אוֹ תּוֹעֶה בַּמִּדְבָּר, אוֹ חָבוּשׁ בְּבֵית הָאֲסוּרִים, יֵשׁ לוֹ לְהִתְעַנּוֹת וּלְבַקֵּשׁ רַחֲמִים בְּתַעֲנִיתוֹ; וְלֹא יִתְעַנֶּה בְּשַׁבָּת וּמוֹעֵד, חֲנֻכָּה וּפוּרִים וְרֹאשׁ חֹדֶשׁ.
"That every individual should fast and pray for their distress. In one section: Just as the community fasts and prays for their troubles, so too, each individual should fast and pray for their own distress. For example, if one is sick, lost in the wilderness, or imprisoned in a prohibited place, they should engage in fasting and seek mercy during their fast. However, one should not fast on Shabbat, Festivals, Chanukah, Purim, and Rosh Chodesh.
Shulchan Aruch, Orach Chayim — Torat Emet 363 edition, via Sefaria — public domain
English: Sefaria Community Translation — CC0