What you are trying to do can be achieved but it will be difficult and frustrating. Questions tagged grid-typesetting
contain many details on the matter. Long story short, (Xe)LaTeX
is the wrong tool for grid typesetting: you would have to eliminate any glue and set every dimension to a multiple of the grid step. You can only do this manually, and every single package you use could undo your work or sprout further complications. This means that unless your document is very simple you're in for quite a headache.
I once did tame memoir
extbook
(+ XeLaTeX
+ polyglossia
+ some table packages) into a two-column grid layout. That wasn't particularly fun but the result was acceptable. If you want to scavenge the code here is the preamble. If (and only if UPDATE: I did it anyway) you are completely determined I'll try to clean it up a bit for you. I'm not doing it now beacuse I'm not sure it would be worth the effort: too much depends on your document's content and precise endowment of packages. Also, take a look at these questions and at the grid
package then decide if you want to persevere.
ConTeXt solution
Since this is your first project (= better if funnier) I strongly recommend you to be less stubborn than me and switch tool. Use ConTeXt
: it completely trivializes the problem of grid typesetting and also does a wealth of other cool things. You will save a lot of time and have a flawless grid snapping.
Let me show you the code:
% first you instruct ConTeXt to build a typeface
% (this is the only confusing part)
% if you want fine control on font features, you can
%\definefontfeature
% [arabic]
% [mode=node,language=dflt,script=arab,
% init=yes,medi=yes,fina=yes,isol=yes,
% liga=yes,dlig=yes,rlig=yes,clig=yes,
% mark=yes,mkmk=yes,kern=yes,curs=yes]
\starttypescript [serif] [arabic]
% the font is just a nice one I had lying around
\definefontsynonym [Arabic-Regular] [file:Scheherazade-Regular.ttf] [features=arabic]
\definefontsynonym [Arabic-Bold] [file:Scheherazade-Bold.ttf] [features=arabic]
\stoptypescript
\starttypescript [serif] [arabic] [name]
\usetypescript[serif][fallback]
\definefontsynonym [Serif] [Arabic-Regular] [features=arabic]
\definefontsynonym [SerifBold] [Arabic-Bold] [features=arabic]
\stoptypescript
\starttypescript [Arabic]
\definetypeface [Arabic] [rm] [serif] [arabic] [default]
\stoptypescript
% now you localize the document and set RTL flow
\mainlanguage[arabic]
\pagedir TRT
\bodydir TRT
\pardir TRT
\textdir TRT
% then you set up the layout
% double sided document
\setuppagenumbering[alternative=doublesided]
% standard paper size
\setuppapersize[A4]
% I tried to do what you were doing with the golden ratio
\setuplayout[
grid=min, % <- this is where magic happens
backspace=50mm, width=130mm,
topspace=33mm, height=210mm,
header=0mm, footer=0mm,
]
% show the baseline grid
\showgrid
% set the font size and interline space
\setupbodyfont[Arabic,24pt]
\setupinterlinespace[line=42pt]
% decorate the headings a bit and make them snap to grid nicely
\setupheads[number=no]
\setuphead[chapter][style=\bfd,before=,after=\blank,alternative=middle,grid=both]
\setuphead[section][style=\bfc,before=\blank,after=,grid=both]
% MAIN DOCUMENT ================================================================
\starttext
\chapter{كِتَاب الطَّهَارَةِ}
اَلْمِيَاهُ ثَلَاثَةٌ\\
اَلْأَوَّلُ: طَهُورٌ وَهُوَ اَلْبَاقِي عَلَى خِلْقَتِهِ وَمِنْهُ مَكْرُوهٌ كَمُتَغَيِّرٍ بِغَيْرِ مُمَازِجٍ وَمُحَرَّمٌ لَا يَرْفَعُ اَلْحَدَثَ وَيُزِيلُ اَلْخَبَثَ وَهُوَ اَلْمَغْصُوب وَغَيْرُ بِئْرِ النَّاقَةِ مِنْ ثَمُودَ .\\
اَلثَّانِي: طَاهِرٌ لَا يَرْفَعُ اَلْحَدَثَ وَلَا يُزِيلُ اَلْخَبَثَ وَهُوَ اَلْمُتَغَيِّرُ بِمُمَازِجٍ طَاهِر وَمِنْهُ يَسِيرٌ مُسْتَعْمَلٌ فِي رَفْعِ حَدَثٍ .\\
اَلثَّالِثُ: نَجِسٌ يَحْرُمُ اِسْتِعْمَالُهُ مُطْلَقًا وَهُوَ مَا تَغَيَّرَ بِنَجَاسَةٍ فِي غَيْرِ مَحِلِّ تَطْهِيرٍ أَوْ لَاقَاهَا فِي غَيْرِهِ وَهُوَ يَسِيرٌ وَالْجَارِي كَالرَّاكِدِ وَالْكَثِيرُ قُلَّتَانِ وَهُمَا مِائَةُ رِطْلٍ وَسَبْعَةُ أَرْطَالٍ وَسُبْعُ رِطْلٍ بِالدِّمَشْقِيِّ وَالْيَسِيرُ مَا دُونَهُمَ .
\section{طَهَارَةُ اَلْآنِيَةِ}
كُلُّ إِنَاءٍ طَاهِرٍ يُبَاحُ اِتِّخَاذُهُ وَاسْتِعْمَالُهُ إِلَّا أَنْ يَكُونَ ذَهَبًا أَوْ فِضَّةً أَوْ مُضَبَّبًا بِأَحَدِهِمَا لَكِنْ تُبَاحُ ضَبَّةٌ يَسِيرَةٌ مِنْ فِضَّةٍ لِحَاجَةٍ وَمَا لَمْ تُعْلَمْ نَجَاسَتُهُ مِنْ آنِيَةِ كُفَّارٍ وَثِيَابُهُمْ طَاهِرَةٌ وَلَا يَطْهُرُ جِلْدُ مَيِّتَةٍ بِدِبَاغٍ وَكُلُّ أَجْزَائِهَا نَجِسَةٌ إِلَّا شَعْرًا وَنَحْوَهُ وَالْمُنْفَصِلُ مِنْ حَيٍّ كَمَيْتَتِهِ .
\section{اَلِاسْتِنْجَاءُ وَالِاسْتِجْمَارُ}
اَلِاسْتِنْجَاءُ وَاجِبٌ مِنْ كُلِّ خَارِجٍ إِلَّا اَلرِّيحَ وَالطَّاهِرَ وَغَيْرَ اَلْمُلَوَّث وَسُنَّ عِنْدَ دُخُولِ خَلَاءٍ قَوْلُ : بِسْمِ اَللَّهِ اَللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ اَلْخُبُثِ وَالْخَبَائِثِ وَبَعْدَ خُرُوجٍ مِنْهُ : غُفْرَانَكَ، اَلْحَمْدُ لِلَّهِ اَلَّذِي أَذْهَبَ عَنِّي اَلْأَذَى وَعَافَانِي.\\
وَتَغْطِيَةُ رَأْسٍ وَانْتِعَالٌ وَتَقْدِيمُ رِجْلِهِ اَلْيُسْرَى دُخُولًا وَاعْتِمَادُهُ عَلَيْهَا جُلُوسًا وَالْيُمْنَى خُرُوجًا عَكْسُ مَسْجِدٍ وَنَعْلٍ وَنَحْوِهِمَا وَبُعْد فِي فَضَاءٍ وَطَلَبُ مَكَانٍ رَخْوٍ لِبَوْلٍ وَمَسْحُ اَلذِّكْرِ بِالْيَدِ اَلْيُسْرَى إِذَا اِنْقَطَعَ اَلْبَوْلُ مِنْ أَصْلِهِ إِلَى رَأْسِهِ ثَلَاثًا وَنَتْرُهُ ثَلَاثًا .\\
وَكُرِهَ دُخُولُ خَلَاءٍ بِمَا فِيهِ ذَكَرُ اَللَّهِ -تَعَالَى - وَكَلَامٌ فِيهِ بِلَا حَاجَةٍ وَرَفْعُ ثَوْبٍ قَبْلَ دُنُوٍّ مِنَ اَلْأَرْضِ وَبَوْلٌ فِي شَقٍّ وَنَحْوِهِ وَمَسُّ فَرْجٍ بِيَمِينٍ بِلَا حَاجَةٍ وَاسْتِقْبَالُ اَلنَّيِّرَيْنِ وَحَرُمَ اِسْتِقْبَالُ قِبْلَةٍ وَاسْتِدْبَارُهَا فِي غَيْرِ بُنْيَانٍ وَلُبْثٌ فَوْقَ اَلْحَاجَةِ وَبَوْلٌ فِي طَرِيقٍ مَسْلُوكٍ وَنَحْوِهِ وَتَحْتَ شَجَرَةٍ مُثْمِرَةٍ ثَمَرًا مَقْصُودًا.\\
\section{اَلسِّوَاكُ وَتَوَابِعُهُ}
يَسُنُّ اَلسِّوَاكُ بِالْعُودِ كُلَّ وَقْتٍ إِلَّا لِصَائِمٍ بَعْدَ اَلزَّوَالِ فَيُكْرَه . وَيَتَأَكَّدُ عِنْدَ صَلَاةٍ وَنَحْوِهَا وَتَغَيُّرِ فَمٍ وَنَحْوِهِ .
وَسُنَّ بُدَاءَةٌ بِالْأَيْمَنِ فِيهِ وَفِي طُهْرٍ وَشَأْنِهِ كُلِّهِ وَادِّهَانٌ غِبًّا وَاكْتِحَالٌ فِي كُلِّ عَيْنٍ ثَلَاثًا وَنَظَرٌ فِي مِرْآةٍ وَتَطَيُّبٌ وَاِسْتِحْدَاد وَحَفُّ شَارِبٍ وَتَقْلِيمُ ظُفُرٍ وَنَتْفُ إِبِط وَكُرِهَ قَزَع وَنَتْفُ شَيْبٍ وَثَقْبُ أُذُنِ صَبِيٍّ وَيَجِبُ خِتَانُ ذَكَرٍ وَأُنْثَى "بُعَيْدَ بُلُوغٍ مَعَ أَمِنِ اَلضَّرَرِ وَيُسَنُّ قَبْلَهُ وَيُكْرَهُ سَابِعَ وِلَادَتِهِ وَمِنْهَا إِلَيْهِ".
\stoptext
And now for the result:

It's all pretty much effortless. You'll see the degree of control ConTeXt
offers is amazing. (Again, if you really care about XeLaTeX
leave a comment and I'll try to update the answer cleaning up the preamble I mentioned.)
XeLaTeX version
Ok, I cleaned up my old code and produced a bare minimal XeLaTeX
solution. I wrongly remembered using memoir
, but it makes no difference if you use it instead as a document class. However, keep in mind I set up the layout with geometry
and the headings with titlesec
, so you'll have to translate the code if you want to use memoir
's facilities.
I expunged all the code for snapping to grid columns floats, table, captions and lists to grid to keep this minimal.
\documentclass{extbook}
\usepackage{geometry}
\usepackage[explicit]{titlesec}
\usepackage{polyglossia}
\usepackage{fontspec}
% ======================================================= LAYOUT (geometry) ====
% THE fundamental length
\newlength \lead
\setlength \lead {30pt}
\geometry
{ textwidth = 13\lead
, textheight = 21\lead
, hmarginratio = 89:144
, vmarginratio = 89:144
, twoside
}
\setlength \topskip \lead
\setlength \parskip {0pt}
%\raggedbottom
% ============================================================== FONT SIZES ====
\def\normalsize{\fontsize{0.618\lead}{1\lead}\selectfont}
\def\large {\fontsize{1.000\lead}{2\lead}\selectfont}
\def\Large {\fontsize{1.618\lead}{3\lead}\selectfont}
% =========================================================== BASELINE GRID ====
\usepackage{eso-pic}
\usepackage{tikzpagenodes}
% Command to draw a baseline grid
\newcommand\drawbaselinegrid{%
\begin{tikzpicture}[overlay,remember picture]
\draw [red!30!white, ultra thin, dashed]
(0,0) grid [ ystep = \baselineskip, xstep = \textwidth
, shift = (current page text area.north west)
, yshift = 0-\dp\strutbox
] ++(\textwidth,-\textheight);
\draw [red!30!white, thin]
(0,0) grid [ step = \baselineskip, xstep = \textwidth
, shift=(current page text area.north)
] ++(0.5\textwidth,-\textheight)
(0,0) grid [ step = \baselineskip, xstep = \textwidth
, shift=(current page text area.north)
] ++(-0.5\textwidth,-\textheight);
\draw[black!10!white]
(current page text area.north west)
rectangle (current page text area.south east);
\end{tikzpicture}}
% Draw a baseline grid on every page
\AddToShipoutPicture{\drawbaselinegrid}
% ================================ LANGUAGE & FONTS (polyglossia, fontspec) ====
\setmainlanguage{arabic}
\setmainfont{Scheherazade}
% ===================================================== HEADINGS (titlesec) ====
\setlength \beforetitleunit \lead
\setlength \aftertitleunit \lead
\titlespacing*{\chapter} {0em}{*0}{*2} % Remember there's a \topskip!
\titlespacing*{\section} {0em}{*0}{*1}
\newcommand\ghostdrop[2]{%
\raisebox{-#1\lead}[0pt][0pt]{#2}}
\titleformat {\chapter} {\bfseries} {} {0pt}
{\ghostdrop{1.0}{\parbox[t]{\columnwidth}{\centering\Large#1}}}
\titleformat {\section} {\bfseries} {} {0pt}
{\ghostdrop{1.0}{\parbox[t]{\columnwidth}{\large#1}}}
% manual spacers in case long headings break line
%\def\longchapterskip{\vspace{2\lead}}
%\def\longsectionskip{\vspace{2\lead}}
% =========================================================== MAIN DOCUMENT ====
\begin{document}
\chapter{كِتَاب الطَّهَارَةِ}
اَلْمِيَاهُ ثَلَاثَةٌ\\
اَلْأَوَّلُ: طَهُورٌ وَهُوَ اَلْبَاقِي عَلَى خِلْقَتِهِ وَمِنْهُ مَكْرُوهٌ كَمُتَغَيِّرٍ بِغَيْرِ مُمَازِجٍ وَمُحَرَّمٌ لَا يَرْفَعُ اَلْحَدَثَ وَيُزِيلُ اَلْخَبَثَ وَهُوَ اَلْمَغْصُوب وَغَيْرُ بِئْرِ النَّاقَةِ مِنْ ثَمُودَ .\\
اَلثَّانِي: طَاهِرٌ لَا يَرْفَعُ اَلْحَدَثَ وَلَا يُزِيلُ اَلْخَبَثَ وَهُوَ اَلْمُتَغَيِّرُ بِمُمَازِجٍ طَاهِر وَمِنْهُ يَسِيرٌ مُسْتَعْمَلٌ فِي رَفْعِ حَدَثٍ .\\
اَلثَّالِثُ: نَجِسٌ يَحْرُمُ اِسْتِعْمَالُهُ مُطْلَقًا وَهُوَ مَا تَغَيَّرَ بِنَجَاسَةٍ فِي غَيْرِ مَحِلِّ تَطْهِيرٍ أَوْ لَاقَاهَا فِي غَيْرِهِ وَهُوَ يَسِيرٌ وَالْجَارِي كَالرَّاكِدِ وَالْكَثِيرُ قُلَّتَانِ وَهُمَا مِائَةُ رِطْلٍ وَسَبْعَةُ أَرْطَالٍ وَسُبْعُ رِطْلٍ بِالدِّمَشْقِيِّ وَالْيَسِيرُ مَا دُونَهُمَ .
\section{طَهَارَةُ اَلْآنِيَةِ}
كُلُّ إِنَاءٍ طَاهِرٍ يُبَاحُ اِتِّخَاذُهُ وَاسْتِعْمَالُهُ إِلَّا أَنْ يَكُونَ ذَهَبًا أَوْ فِضَّةً أَوْ مُضَبَّبًا بِأَحَدِهِمَا لَكِنْ تُبَاحُ ضَبَّةٌ يَسِيرَةٌ مِنْ فِضَّةٍ لِحَاجَةٍ وَمَا لَمْ تُعْلَمْ نَجَاسَتُهُ مِنْ آنِيَةِ كُفَّارٍ وَثِيَابُهُمْ طَاهِرَةٌ وَلَا يَطْهُرُ جِلْدُ مَيِّتَةٍ بِدِبَاغٍ وَكُلُّ أَجْزَائِهَا نَجِسَةٌ إِلَّا شَعْرًا وَنَحْوَهُ وَالْمُنْفَصِلُ مِنْ حَيٍّ كَمَيْتَتِهِ .
\section{اَلِاسْتِنْجَاءُ وَالِاسْتِجْمَارُ}
اَلِاسْتِنْجَاءُ وَاجِبٌ مِنْ كُلِّ خَارِجٍ إِلَّا اَلرِّيحَ وَالطَّاهِرَ وَغَيْرَ اَلْمُلَوَّث وَسُنَّ عِنْدَ دُخُولِ خَلَاءٍ قَوْلُ : بِسْمِ اَللَّهِ اَللَّهُمَّ إِنِّي أَعُوذُ بِكَ مِنْ اَلْخُبُثِ وَالْخَبَائِثِ وَبَعْدَ خُرُوجٍ مِنْهُ : غُفْرَانَكَ، اَلْحَمْدُ لِلَّهِ اَلَّذِي أَذْهَبَ عَنِّي اَلْأَذَى وَعَافَانِي.\\
وَتَغْطِيَةُ رَأْسٍ وَانْتِعَالٌ وَتَقْدِيمُ رِجْلِهِ اَلْيُسْرَى دُخُولًا وَاعْتِمَادُهُ عَلَيْهَا جُلُوسًا وَالْيُمْنَى خُرُوجًا عَكْسُ مَسْجِدٍ وَنَعْلٍ وَنَحْوِهِمَا وَبُعْد فِي فَضَاءٍ وَطَلَبُ مَكَانٍ رَخْوٍ لِبَوْلٍ وَمَسْحُ اَلذِّكْرِ بِالْيَدِ اَلْيُسْرَى إِذَا اِنْقَطَعَ اَلْبَوْلُ مِنْ أَصْلِهِ إِلَى رَأْسِهِ ثَلَاثًا وَنَتْرُهُ ثَلَاثًا .\\
وَكُرِهَ دُخُولُ خَلَاءٍ بِمَا فِيهِ ذَكَرُ اَللَّهِ -تَعَالَى - وَكَلَامٌ فِيهِ بِلَا حَاجَةٍ وَرَفْعُ ثَوْبٍ قَبْلَ دُنُوٍّ مِنَ اَلْأَرْضِ وَبَوْلٌ فِي شَقٍّ وَنَحْوِهِ وَمَسُّ فَرْجٍ بِيَمِينٍ بِلَا حَاجَةٍ وَاسْتِقْبَالُ اَلنَّيِّرَيْنِ وَحَرُمَ اِسْتِقْبَالُ قِبْلَةٍ وَاسْتِدْبَارُهَا فِي غَيْرِ بُنْيَانٍ وَلُبْثٌ فَوْقَ اَلْحَاجَةِ وَبَوْلٌ فِي طَرِيقٍ مَسْلُوكٍ وَنَحْوِهِ وَتَحْتَ شَجَرَةٍ مُثْمِرَةٍ ثَمَرًا مَقْصُودًا.\\
\section{اَلسِّوَاكُ وَتَوَابِعُهُ}
يَسُنُّ اَلسِّوَاكُ بِالْعُودِ كُلَّ وَقْتٍ إِلَّا لِصَائِمٍ بَعْدَ اَلزَّوَالِ فَيُكْرَه . وَيَتَأَكَّدُ عِنْدَ صَلَاةٍ وَنَحْوِهَا وَتَغَيُّرِ فَمٍ وَنَحْوِهِ .
وَسُنَّ بُدَاءَةٌ بِالْأَيْمَنِ فِيهِ وَفِي طُهْرٍ وَشَأْنِهِ كُلِّهِ وَادِّهَانٌ غِبًّا وَاكْتِحَالٌ فِي كُلِّ عَيْنٍ ثَلَاثًا وَنَظَرٌ فِي مِرْآةٍ وَتَطَيُّبٌ وَاِسْتِحْدَاد وَحَفُّ شَارِبٍ وَتَقْلِيمُ ظُفُرٍ وَنَتْفُ إِبِط وَكُرِهَ قَزَع وَنَتْفُ شَيْبٍ وَثَقْبُ أُذُنِ صَبِيٍّ وَيَجِبُ خِتَانُ ذَكَرٍ وَأُنْثَى "بُعَيْدَ بُلُوغٍ مَعَ أَمِنِ اَلضَّرَرِ وَيُسَنُّ قَبْلَهُ وَيُكْرَهُ سَابِعَ وِلَادَتِهِ وَمِنْهَا إِلَيْهِ".
\end{document}
The result is better than I remembered:

Note I'm still not using your font: I noticed Traditional Arabic
's baseline is off, so lines don't really sit on the grid. On the contrary, Scheherazade
gives perfect visual alignment.
\chapter*{\centerline{كِتَاب الطَّهَارَةِ}}
with\section*{\centerline{كِتَاب الطَّهَارَةِ}}
and 2) not related. there is better way to center chapter heading.\chapter*{\centerline{كِتَاب الطَّهَارَةِ}}
horizontal rules do not match to text lines.