diff options
author | Robert Alessi <alessi@robertalessi.net> | 2019-11-24 21:22:20 +0100 |
---|---|---|
committer | Robert Alessi <alessi@robertalessi.net> | 2019-11-24 21:22:20 +0100 |
commit | 350aaae632c485af3b136301b0763ce61c5c8b66 (patch) | |
tree | a3bfcab47a986b08110533bec85758f3390b75f9 | |
parent | be2daca9e4a80145927bd1f9c4e597530b643cdf (diff) | |
download | arabluatex-350aaae632c485af3b136301b0763ce61c5c8b66.tar.gz |
new command \arind{} specialized in the construction of indexes
-rw-r--r-- | arabluatex.dtx | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/arabluatex.dtx b/arabluatex.dtx index 423583f..efc5d70 100644 --- a/arabluatex.dtx +++ b/arabluatex.dtx | |||
@@ -4847,6 +4847,58 @@ | |||
4847 | % \end{macrocode} | 4847 | % \end{macrocode} |
4848 | % \end{macro} | 4848 | % \end{macro} |
4849 | % \end{environment} | 4849 | % \end{environment} |
4850 | % \begin{macro}{\arind} | ||
4851 | % \changes{v1.18}{2019/11/24}{New command \cs{arind} for building | ||
4852 | % indexes} | ||
4853 | % \cs{arind}\marg{root} is a command specialized in the contruction of | ||
4854 | % indexes. As a mandadory argument, it takes the Arabic root under | ||
4855 | % which a given word is to be indexed. Additionally, it may receive | ||
4856 | % three optional \enquote*{named} arguments: |index|, |root| and | ||
4857 | % |form|. | ||
4858 | % \begin{macrocode} | ||
4859 | \NewDocumentCommand{\SetDefaultIndex}{m}{ | ||
4860 | \edef\@tempa{#1} | ||
4861 | \ifx\@tempa\empty | ||
4862 | \def\al@default@index{\jobname} | ||
4863 | \else | ||
4864 | \def\al@default@index{#1} | ||
4865 | \fi | ||
4866 | } | ||
4867 | % \end{macrocode} | ||
4868 | % \begin{macrocode} | ||
4869 | \def\al@index@mode{\al@mode} | ||
4870 | \NewDocumentCommand{\SetIndexMode}{m}{ | ||
4871 | \def\al@index@mode{#1} | ||
4872 | } | ||
4873 | % \end{macrocode} | ||
4874 | % \begin{macrocode} | ||
4875 | \define@cmdkeys[al]{index}[alind@]{index,root,form} | ||
4876 | \NewDocumentCommand{\arind}{o m}{% | ||
4877 | \IfNoValueTF{#1}{% | ||
4878 | \ifdefined\al@default@index% | ||
4879 | \csname index\endcsname[\al@default@index]{#2}% | ||
4880 | \else% | ||
4881 | \csname index\endcsname{#2}% | ||
4882 | \fi% | ||
4883 | }{% | ||
4884 | \bgroup | ||
4885 | \setkeys[al]{index}{#1}% | ||
4886 | \def\al@one{% | ||
4887 | \ifdefined\alind@root!\LR{\alind@root}\else!\LR{1}\fi}% | ||
4888 | \def\al@two{% | ||
4889 | \ifdefined\alind@form @\arb[\al@index@mode]{\alind@form}\else\fi}% | ||
4890 | \ifdefined\alind@index% | ||
4891 | \csname index\endcsname[\alind@index]{#2\al@one\al@two}% | ||
4892 | \else% | ||
4893 | \ifdefined\al@default@index% | ||
4894 | \csname index\endcsname[\al@default@index]{#2\al@one\al@two}% | ||
4895 | \else% | ||
4896 | \csname index\endcsname{#2\al@one\al@two}% | ||
4897 | \fi% | ||
4898 | \fi% | ||
4899 | \egroup}} | ||
4900 | % \end{macrocode} | ||
4901 | % \end{macro} | ||
4850 | % \begin{macro}{\abjad} \cs{abjad}\marg{number} expresses its argument | 4902 | % \begin{macro}{\abjad} \cs{abjad}\marg{number} expresses its argument |
4851 | % in Arabic letters in accordance with the \arb[trans]{'abjad} | 4903 | % in Arabic letters in accordance with the \arb[trans]{'abjad} |
4852 | % arrangement of the alphabet. \meta{number} must be between 1 and | 4904 | % arrangement of the alphabet. \meta{number} must be between 1 and |