Parshat B'haalotcha: The Seven Books of the Torah
(א) חָ֭כְמוֹת בָּנְתָ֣ה בֵיתָ֑הּ חָצְבָ֖ה עַמּוּדֶ֣יהָ שִׁבְעָֽה׃

Wisdom has built her house, She has constructed her seven pillars.

(ב) חצבה עמודיה שבעה. שבעת ימי בראשית, ד"א ז' ספרים שיש בתורה ויהי בנסוע הארון ספר לעצמו במסכת שבת:

[These are] the seven days of Creation; alternatively, they are the 7 books of the Torah. "When the Ark ws sent out..." - this is its own book...

(לה) וַיְהִ֛י בִּנְסֹ֥עַ הָאָרֹ֖ן וַיֹּ֣אמֶר מֹשֶׁ֑ה קוּמָ֣ה ׀ יְהוָ֗ה וְיָפֻ֙צוּ֙ אֹֽיְבֶ֔יךָ וְיָנֻ֥סוּ מְשַׂנְאֶ֖יךָ מִפָּנֶֽיךָ׃ (לו) וּבְנֻחֹ֖ה יֹאמַ֑ר שׁוּבָ֣ה יְהוָ֔ה רִֽבְב֖וֹת אַלְפֵ֥י יִשְׂרָאֵֽל׃ (׆) (ס)
(35) When the Ark was to set out, Moses would say: Advance, O LORD! May Your enemies be scattered, And may Your foes flee before You! (36) And when it halted, he would say: Return, O LORD, You who are Israel’s myriads of thousands!
ת"ר (במדבר י, לה) ויהי בנסוע הארון ויאמר משה פרשה זו עשה לה הקב"ה סימניות מלמעלה ולמטה לומר
Apropos the portion: “And when the Ark traveled,” the Gemara cites that which the Sages taught in a baraita. It is stated: “And when the Ark traveled and Moses proclaimed: Rise up, God, and Your enemies will scatter and those who hate You will flee from before You.” And The Holy One, Blessed be He, made signs in the Torah for this portion, above and below, i.e., before and after it, in order to say
שאין זה מקומה ר' אומר לא מן השם הוא זה אלא מפני שספר חשוב הוא בפני עצמו כמאן אזלא הא דא"ר שמואל בר נחמן א"ר יונתן (משלי ט, א) חצבה עמודיה שבעה אלו שבעה ספרי תורה כמאן כר' מאן תנא דפליג עליה דר' רשב"ג הוא דתניא רשב"ג אומר עתידה פרשה זו שתיעקר מכאן ותכתב במקומה ולמה כתבה כאן כדי להפסיק בין פורענות ראשונה לפורענות שנייה פורענות שנייה מאי היא (במדבר יא, א) ויהי העם כמתאוננים פורענות ראשונה (במדבר י, לג) ויסעו מהר ה' וא"ר חמא בר' חנינא שסרו מאחרי ה' והיכן מקומה אמר רב אשי בדגלים

that this is not its place, as the previous portion does not discuss the nation’s travels. Rabbi Yehuda HaNasi says: It is not for that reason that signs were inserted. Rather, the signs are there because this portion is considered a book unto itself. ... it was taught in a baraita that Rabban Shimon ben Gamliel says: In the future, this portion will be uprooted from here, where it appears, and will be written in its proper place. And why was it written here, even though it discusses the travels of the children of Israel, and the portion before it does not? It is in order to demarcate between the first punishment and the second punishment. What is the second punishment that appears immediately afterward? It is the verse: “And the people complained wickedly in God’s ears, and God heard and became angry, and the fire of God burned in them and it consumed the edge of the camp” (Numbers 11:1). What is the first punishment? It is the verse: “And they traveled from the mountain of God [mehar Hashem] for three days” (Numbers 10:33), and Rabbi Ḥama, son of Rabbi Ḥanina, said: That they turned from after God [me’aḥarei Hashem] and hurriedly fled Mount Sinai. The Gemara asks: And if so, where is the proper place for this paragraph? Rav Ashi said: In the portion of the flags, where there is a description of the manner in which the Jewish people traveled through the desert.