1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% acmd.sty
% ArabTeX command processing
% 05.04.2000
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
% Institut fuer Informatik
% Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\a@ident {acmd.sty} {3.10 Arabic command processing } {05.04.2000}
\def \a@command #1{% process an internal command
\iftest@command \tracingmacros 1 \fi
\def@@cmd #1\xpa
\ifx \the\a@@cmd \relax % no special handling?
\if\is@in@set #1\a@@listreg
% \def \next {\xpa \test@token #1}\else
\def \next {\xpa \arab@tail #1}\else
\if\is@in@set #1\a@@listzero
\unarab@codes \def \next {#1\arab@tail }\else
\if\is@in@set #1\a@@listone
\unarab@codes \def \next ##1{#1{##1}\arab@tail }\else
\if\is@in@set #1\a@@listtwo
\unarab@codes \def \next ##1##2{#1{##1}{##2}\arab@tail }\else
\def \next {\a@cmderr #1}% disallowed
\fi\fi\fi\fi
\else \def \next {\the\a@@cmd }% local routine
\fi \next }
\def \a@cmderr #1{% complain and substitute a dummy command
\errhelp {Your command will be echoed in the output}%
\ifx #1\undefined \def \next {\a@puttt #1\test@token }%
\errmessage {Unknown arabic command: \nxp #1}%
\else \errmessage {Illegal arabic command: \nxp #1}%
\a@@cmd = {{\a@puttt #1\arab@tail }}
\immediate\openout \a@@err = \jobname.err
\immediate\write \a@@err {\string \gdef \string \next \space
\xpa \a@@pat \meaning #1:->\pat@end \the\a@@cmd }% substitution
\immediate\closeout \a@@err
{\catcode `\@=11 \input \jobname.err }%
\fi \next }
\def \def@@cmd #1{% define \a@@cmd as \a@c@#1
\ifcat \nxp #1\nxp ~%
\global\a@@cmd = \xpa {\csname a@c@\string #1\endcsname }\else
\global\a@@cmd = \xpa {\csname a@c@\xpa \@gobble \string #1\endcsname }\fi }
\def \arab@tail {\arab@codes \set@arabfont \test@token }
\def \a@@pat #1:#2->#3\pat@end {#2}
\def \a@puttt #1{\putwordb@x {\tt \string #1}}
%%%%%%%%%%%%%%%%%%%%%% enable internal commands %%%%%%%%%%%%%%%%%%%%%%%%%%%
\newtoks \a@@listzero \newtoks \a@@listone
\newtoks \a@@listtwo \newtoks \a@@listreg
\long\def \a@@addcmd #1#2{% #1 cmd, #2 list
\global #2 = \xpa {\the #2#1}}
\long\def \all@wcmd #1{% enable parameterless command in arabic environment
\a@@addcmd #1\a@@listzero }
\long\def \all@w@ne #1{% enable command with 1 param in arabic environment
\a@@addcmd #1\a@@listone }
\long\def \all@wtw@ #1{% enable command with 2 params in arabic environment
\a@@addcmd #1\a@@listtwo }
\long\def \all@wif #1{% enable \#1true, \#1false
%\a@@name = \xpa \xpa \xpa {\xpa \a@@strip \string #1>}%
\a@@name = \xpa \xpa \xpa {\xpa \@gobble \string #1}%
\xpa \all@wcmd \csname \the\a@@name true\endcsname
\xpa \all@wcmd \csname \the\a@@name false\endcsname }
\long\def \all@whcmd #1{% enable command for horizontal mode
\def@@cmd #1\all@wcmd #1%
\xpa \def \the\a@@cmd {\putwordb@x {\leavevmode #1}\test@token }}
\long\def \all@wvcmd #1{% enable command for vertical mode
\def@@cmd #1\all@wcmd #1%
\xpa \def \the\a@@cmd {\a@@par #1\test@token }}
%%%%%%%%%%%%%%%%%%%%%% enable command definitions %%%%%%%%%%%%%%%%%%%%%%%%
\long\def \allowarab #1{% enable new command in arabic environment
\a@@addcmd #1\a@@listreg }
\def \a@@def #1#2#3#4{% define command in RL mode
\allowarab #2#1#2#3{#4}\test@token }
\def \a@c@def #1#2#{\a@@def \def {#1}{#2}}
\def \a@c@edef #1#2#{\a@@def \edef {#1}{#2}}
\def \a@c@gdef #1#2#{\a@@def \gdef {#1}{#2}}
\def \a@c@xdef #1#2#{\a@@def \xdef {#1}{#2}}
%%%%%%%%%%%%%%%%%%%%%% enable ArabTeX commands %%%%%%%%%%%%%%%%%%%%%%%%%%%
\all@wcmd \novocalize \all@wcmd \vocalize \all@wcmd \fullvocalize
\all@wcmd \setnash \all@wcmd \setnashbf \all@wcmd \setnastaliq
\all@wcmd \setarab \all@wcmd \setmaghribi \all@wcmd \setfarsi
\all@wcmd \setturk \all@wcmd \setkurdish
\all@wcmd \seturdu \all@wcmd \setpashto \all@wcmd \setverb
\all@wcmd \yahdots \all@wcmd \yahnodots \all@wcmd \oldtanwin
\all@wcmd \newtanwin \all@wcmd \accentshigh \all@wcmd \accentslow
\all@w@ne \setcode \all@wcmd \endsetcode \all@w@ne \input
\all@wcmd \oldhamza \all@wcmd \newhamza \all@w@ne \end
\all@wcmd \relax \all@wcmd \indent \all@wcmd \noindent
\all@w@ne \emphasize \all@wtw@ \footnote \all@w@ne \marginpar
\all@w@ne \docommand \all@wtw@ \doassign \all@w@ne \mbox
\all@w@ne \centerline \all@w@ne \spreadline \all@wtw@ \spreadbox
\all@wcmd \nospace \all@w@ne \hspace \all@w@ne \setarabfont
\all@w@ne \tracingmacros
\all@wif \arab \all@wif \trans \all@wif \show
\all@wif \spread \all@wif \ligs \all@wif \RL
\all@whcmd \bigskip \all@whcmd \medskip \all@whcmd \smallskip
\all@whcmd \hfill \all@whcmd \hfil \all@whcmd \space
\all@whcmd \hss
\ifx \LaTeX \undefined
\all@wvcmd \bigskip \all@wvcmd \medskip \all@wvcmd \smallskip
\fi
\all@wvcmd \newpage \all@wvcmd \clearpage
\all@wvcmd \vfil \all@wvcmd \vfill
%%%%%%%%%%%%%%%%%%% special characters %%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \a@spec@def #1#2{% define routine for special character
\def@@cmd #1\xpa \gdef \the\a@@cmd {#2}}
\def \a@@chardef #1{\begingroup \lccode `\0 #1\lowercase
{\endgroup \ifarab \putwordb@x {\a@rabwrite {0}}\fi
\a@showinput {0}}\obey@space }
\a@spec@def \#{\a@@chardef {`\#}} \a@spec@def \${\a@@chardef {`\$}}
\a@spec@def \%{\a@@chardef {`\%}} \a@spec@def \&{\a@@chardef {`\&}}
\a@spec@def \^{\a@@chardef {`\^}} \a@spec@def \_{\a@@chardef {`\_}}
\a@spec@def \ {\a@spacefalse \putwordb@x {\arab@space }\test@token }
\def \a@c@arabchar #1{% single character in the font
\ifarab \putwordb@x {\char #1}\fi \a@showinput {\arabchar #1}\obey@space }
\def \a@c@char {% read char number
\begingroup \afterassignment \a@@char \count0=}
\def \a@@char {% deposit character
\edef \a@ch@r {\noexpand\a@c@arabchar {\the\count0}}%
\xpa\endgroup \a@ch@r }
%%%%%%%%%%%%%%%%%%% miscellaneous commands %%%%%%%%%%%%%%%%%%%%%%%%
\def \a@c@end {\end } \def \a@c@relax {\test@token }
\def \a@c@par {\a@@par \test@token }
\def \a@c@indent {\arab@indent \test@token }
\def \a@c@noindent {\arab@noindent \test@token }
\def \a@c@input {% \input inside arabic environment, Plain version
\xpa \test@token \input }
\def \a@c@doassign #1#2{% execute assignment
#1#2\relax \test@token }
\def \a@c@docommand #1{% expand and process user command
\xpa \test@token \xpa {#1} }
\def \a@c@bf {\setnashbf \arab@tail }
\def \a@c@rm {\setnash \arab@tail }
\def \a@c@today {\xpa \a@c@mbox \xpa {\a@@today }}
\edef \a@@today {\number\day \space \ifcase\month\or
yanAyir \or febrAyir \or mAris \or 'abrIl \or
mAyU \or yUniyU \or yUliyU \or 'a.gus.tus \or
sibtambar \or 'uktUbar \or nUfambar \or disambar \fi ,
\number\year}
%%%%%%%%%%%%%% \begin ... \end {romantext} %%%%%%%%%%%%%%%%%%%%%%%%
\def \a@c@romantext {% end Arabic mode and switch down (!) to Roman
\endgroup \endarabtext \endgroup
\def \@currenvir {romantext}\let \end \a@r@end \ignorespaces }
\def \endromantext {% switch up (!) to Arabic mode
\endgraf
\def \@currenvir {document}\begingroup
\def \@currenvir {arabtext}\arabtext }
\let \a@l@end \end % save current meaning of \end
\def \a@r@end #1{% new \end for the base level
\def \@romantext {romantext}\def \@tempa {#1}%
\ifx \@tempa \@romantext \let \@tempa \endromantext
\else \def \@tempa {\a@l@end {#1}}%
\fi \@tempa }
%%%%%%%%%%%%%%%%%%%%%%%%%% boxes %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \a@c@centerline #1{% new line, centered
\a@@par
%\initlineb@x
\centerline {\a@showinput {#1}}%
\ifarab \putwordb@x {\hss \a@sequence {#1}\hss }\a@put@line
\fi \test@token }
\def \a@c@spreadline #1{% new line, spread out
\a@@par \initlineb@x \centerline {\a@showinput {#1}}%
\ifarab \putwordb@x
{\spreadtrue \a@sequence {#1}\setbox0 \lastbox \unhbox0 }\a@put@line
\fi \test@token }
\def \a@c@mbox #1{% put the argument into a box
\ifarab \putwordb@x {\a@sequence {#1}}\fi
\a@spacefalse \a@showinput {#1}\test@token }
\def \a@c@spreadbox {% {width}{text} put the text into a box
\unarab@codes \a@@spreadbox }
\def \a@@spreadbox #1{% {width}{text} get the width
\def \a@bwidth {#1}\arab@codes \a@spreadbox }
\def \a@spreadbox #1{% {width}{text} get the text
\ifarab \putwordb@x {\spreadtrue
\setspace {3pt plus .3fil}%
\a@sequence {#1}%
\setbox0 \lastbox \hbox to \a@bwidth {\unhbox0 }}\fi
\a@spacefalse \a@showinput {#1}\test@token }
%%%%%%%%%%%%%%%%%%%%%%%%%% spacing %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \a@c@nospace {% concatenate neighboring items
\a@spacefalse \test@token }
\let \nospace \relax
\def \a@c@hspace {% horizontal space
\unarab@codes \a@@hspace }
\def \a@@hspace #1{% get argument
\a@spacefalse \ifarab \putwordb@x {\hskip #1\relax }\fi
\arab@codes \test@token }
\def \a@c@pagebreak
{\a@@par \@ifnextchar [{\a@@pagebreak }{\a@@pagebreak [4]}}
\def \a@@pagebreak [#1]{\pagebreak [#1]\test@token }
\def \a@c@hskip {\afterassignment \a@hskip \dimen0=}
\def \a@hskip {\putwordb@x {\hskip \dimen0 }\test@token }
\def \a@c@vskip {\afterassignment \a@vskip \dimen0=}
\def \a@vskip {\a@@par \vskip \dimen0 \test@token }
\def \a@c@vspace {% vertical space
\unarab@codes \a@@vspace }
\def \a@@vspace #1{% get argument
\ifarab \a@@par \vskip #1\relax \fi
\arab@codes \test@token }
\def \a@c@break {\a@put@line \test@token }
%%%%%%%%%%%%%%%%%%%%%%%%%% emphasis %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def \a@c@emphasize {% get next token
\def \next@command {\arab@em}%
\futurelet \next@token \test@space }
\def \arab@em #1 {% overstrike group
\def \next@command {\test@special}%
\ifarab \setbox0 \hbox {\a@sequence {#1}}%
\putwordb@x {\vbox {\hrule \kern 1pt \box0}}%
\fi
\ifshow {\tt \string \emphasize \ }%
\if \bgroup \nxp \next@token \a@@verb {{#1}}\else \a@@verb {#1}%
\fi\fi
\iftrans \underbar {{\set@transfont \trans@text #1 \end }}%
\fi \test@token }
%%%%%%%%%%%%%%%%%%% \footnote in an arabic environment %%%%%%%%%%%%%%%
\def \a@c@footnote #1{% Plain TeX arabic footnote
\rm \parindent \a@parindent \unarab@codes \def \@foot
{\unskip \strut \egroup \arab@codes \set@arabfont \test@token }%
\putwordb@x {#1}\a@spacetrue \vfootnote {#1}}
%%%%%%%%%%%%%%%%%% \marginpar in an arabic environment %%%%%%%%%%%%%%%
\def \a@c@marginpar {% for Arabic environments only
\bgroup \unarab@codes \a@@marginpar }
\long \def \a@@marginpar #1{% get text of note
\egroup \setbox0 \vtop
{\hsize \marginparwidth \parskip 0pt \raggedright
\noindent \rm \strut #1\vss }\dp0 \z@
\setbox\lineb@x \hbox {\unhbox\lineb@x
\rlap {\hskip \marginparsep \box0 \hss }}\test@token }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\all@w@ne \settrans
\def \a@c@tracingmacros {\afterassignment \test@token \tracingmacros=}
%\def \a@c@test #1 {\csname test#1\endcsname \test@token }
\def \a@c@test #1{\csname test@#1true\endcsname \test@token }
\a@spec@def \<{\a@get@ins }
\def \a@get@ins #1>{\test@token #1 }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|