aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Alessi <alessi@robertalessi.net>2016-12-11 19:44:32 +0100
committerRobert Alessi <alessi@robertalessi.net>2016-12-11 19:44:32 +0100
commit5cb80b16444930b670871aeefe21749c26b4162d (patch)
tree129c51bf625723d1653d25d674147808c94943b3
parentd4299f53e1abe77ba50210f2345ccfcb33abf79c (diff)
downloadarabluatex-5cb80b16444930b670871aeefe21749c26b4162d.tar.gz
new environment arabverse and new command \bayt. both still need work
-rw-r--r--arabluatex.dtx76
1 files changed, 66 insertions, 10 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx
index c1633da..cc4aa16 100644
--- a/arabluatex.dtx
+++ b/arabluatex.dtx
@@ -2965,10 +2965,11 @@ wa-ya.sIru ta.hta 'l-jild-i
2965 \else \fi\fi\fi\fi}[\par] 2965 \else \fi\fi\fi\fi}[\par]
2966% \end{macrocode} 2966% \end{macrocode}
2967% \end{environment} 2967% \end{environment}
2968% \begin{environment}{arbverse} 2968% \begin{environment}{arabverse}
2969% \changes{v1.6}{2016/11/30}{New environment \texttt{arbverse} for 2969% \changes{v1.6}{2016/11/30}{New environment \texttt{arabverse} for
2970% typesetting Arabic poetry} The environment |arbverse| shall 2970% typesetting Arabic poetry} The environment |arabverse| may receive
2971% receive different options. Let us define them first. 2971% different options: |width|, |metre|, |utf| and |mode|; all of them
2972% are defined here just before the environment |arabverse|:
2972% \begin{macrocode} 2973% \begin{macrocode}
2973\newlength{\al@bayt@width} 2974\newlength{\al@bayt@width}
2974\setlength{\al@bayt@width}{.3\textwidth} 2975\setlength{\al@bayt@width}{.3\textwidth}
@@ -2978,16 +2979,71 @@ wa-ya.sIru ta.hta 'l-jild-i
2978\define@choicekey[al]{verse}{mode}{fullvoc, voc, novoc, 2979\define@choicekey[al]{verse}{mode}{fullvoc, voc, novoc,
2979 trans}{\def\al@mode{#1}} 2980 trans}{\def\al@mode{#1}}
2980\presetkeys[al]{verse}{utf=false}{} 2981\presetkeys[al]{verse}{utf=false}{}
2981\NewDocumentEnvironment{arbverse}{O{} O{}}% 2982% \end{macrocode}
2982{\bgroup\setkeys[al]{verse}[metre]{#1}% 2983% Then follows the environment itself:
2984% \begin{macrocode}
2985\NewDocumentEnvironment{arabverse}{O{}}%
2986{\noindent\bgroup\setkeys[al]{verse}[metre]{#1}%
2983 \ifx\al@mode\al@mode@trans% 2987 \ifx\al@mode\al@mode@trans%
2984 \ifal@verse@utf\setRL\else\setLR\fi% 2988 \ifal@verse@utf\setRL\else\setLR\fi%
2985 \else\setRL\fi% 2989 \else\setRL\fi%
2986 \begin{center} 2990 \ifx\al@mode\al@mode@trans\else%
2987}% 2991 \begin{center}\fi}%
2988{\end{center}% 2992{\ifx\al@mode\al@mode@trans\else\end{center}\fi%
2989\hfill\setkeys[al]{verse}[width,utf,mode]{#1}\egroup\par} 2993\hfill\setkeys[al]{verse}[width,utf,mode]{#1}\egroup}
2994% \end{macrocode}
2995% \begin{macro}{\bayt}
2996% \changes{v1.6}{2016/11/30}{New macro \cs{bayt} for typesetting
2997% each verse inside the \texttt{arabverse} environment} Each verse
2998% consists of two hemistichs; therefore the command \cs{bayt} takes
2999% two arguments, the first receives the \arb[trans]{.sadr} and the
3000% second the \arb[trans]{`ajuz}. That two subsequent hemistishs
3001% should be connected with one another is technically named
3002% \arb[trans]{tadwIr}. In some of these cases, the hemistishs may be
3003% connected by a prominent horizontal flexible stroke which is drawn
3004% by the command \cs{al@verse@stroke}.
3005% \begin{macro}{\SetHemistichDelim}
3006% \changes{v1.6}{2016/11/30}{New command \cs{SetHemistichDelim} for
3007% changing the default delimiter between hemistichs} A hemistich
3008% delimiter also must be defined for there is no gutter between
3009% hemistichs in |trans| mode. By default, it is set to the
3010% \enquote*{star} character: |*|. The command
3011% \cs{SetHemistichDelim}\marg{delimiter} may be used at any point of
3012% the document to change this default setting.
3013% \end{macro}
3014% \begin{macrocode}
3015\def\al@hemistich@delim{*}
3016\NewDocumentCommand{\SetHemistichDelim}{m}{\def\al@hemistich@delim{#1}}
3017\def\al@verse@stroke{\leavevmode\xleaders\hbox{\arb{--}}\hfill\kern0pt}
3018\NewDocumentCommand{\bayt}{m o m}{%
3019 \edef\al@tatweel{--}%
3020 \ifx\al@mode\al@mode@trans\arb{#1}\else%
3021 \makebox[\al@bayt@width][s]{\arb{#1}}\fi%
3022 \IfNoValueTF{#2}{%
3023 \ifx\al@mode\al@mode@trans\hskip .5em
3024 \al@hemistich@delim\hskip .5em%
3025 \else
3026 \hspace{.25\al@bayt@width}%
3027 \fi}{%
3028 \edef\@tempa{#2}%
3029 \ifx\@tempa\al@tatweel%
3030 \ifx\al@mode\al@mode@trans\hskip .5em
3031 \al@hemistich@delim\hskip .5em%
3032 \else
3033 \makebox[.25\al@bayt@width][s]{\al@verse@stroke}%
3034 \fi%
3035 \else%
3036 \ifx\al@mode\al@mode@trans%
3037 \hskip 1em\arb{#2}\hskip 1em%
3038 \else%
3039 \makebox[.25\al@bayt@width][c]{\arb{#2}}%
3040 \fi\fi}%
3041 \ifx\al@mode\al@mode@trans\arb{#3}\else%
3042 \makebox[\al@bayt@width][s]{\arb{#3}}%
3043 \fi}
2990% \end{macrocode} 3044% \end{macrocode}
3045%
3046% \end{macro}
2991% \end{environment} 3047% \end{environment}
2992% \begin{macro}{\abjad} \cs{abjad}\marg{number} expresses its argument 3048% \begin{macro}{\abjad} \cs{abjad}\marg{number} expresses its argument
2993% in Arabic letters in accordance with the \arb[trans]{'abjad} 3049% in Arabic letters in accordance with the \arb[trans]{'abjad}