1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 2% aoutput.sty 3% ArabTeX 4% Version 04.06.2000 5%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 6% (c) Klaus Lagally 7% Institut fuer Informatik 8% Universitaet Stuttgart 9%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 10 11\a@ident {aoutput.sty} {3.10 build output lines} {04.06.2000} 12 13%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 14 15\newdimen \a@hsize \newdimen \a@limit \newdimen \a@leftmargin 16\newcount \a@prevgraf \newcount \a@@prevgraf \newbox \a@tempb@x 17 18\def \setspace #1{\def \arab@space {\hskip #1\relax }}% redefine ? 19 20\def \arab@space {\space \hskip 0pt plus 0.001fil \relax } 21 22\def \def@arabstrut {\def \arab@strut {\if@vocals 23%\vrule height2.5ex depth2.0ex width\z@ \relax \else 24\vrule height2ex depth1.5ex width\z@ \relax \else 25%\vrule height3ex depth1.5ex width\z@ \relax \else 26\vrule height2ex depth1.0ex width\z@ \relax \fi }} 27 28\def \a@parparams {% get paragraph dimensions 29\ifnum \parshape = \z@ \a@hsize \hsize 30\a@leftmargin \z@ 31\else \a@hsize \linewidth \a@leftmargin \@totalleftmargin 32\fi 33\a@leftmargin \z@ 34\a@prevgraf \z@ \spreadfalse } 35 36\def \a@resetpar {% called by \a@par 37\a@prevgraf \z@ } 38 39%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 40% control variables for the "arabtext" environment: 41% 42% \the\arabtext@hook: executed when entering the environment 43% 44% \ifa@vmode: Arabic paragraph closed? 45% 46% \ifa@space: deposit a space? 47% 48% \ifspread: fill line by spreading the words? 49% 50% \ifarab: ignore Arabic script output? 51% 52% \a@parindent: skip at beginning of first line of paragraph 53% \a@parindent: saved value from Roman mode 54% 55% \a@parskip: saved value from Roman mode 56% 57% \the\a@@everypar: token list, executed when starting a paragraph 58% 59% \a@oldhmode: saved value from outside 60% 61% \a@short@line: finish last line, close paragraph 62% 63% \a@put@line: deposit current line buffer, continue paragraph 64% 65%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 66% TeX/LaTeX parameters influencing the shape of a paragraph: 67% 68% \hsize, \leftskip, \rightskip, \parindent, \parskip 69% \parshape, \hangindent, \hangafter, \linewidth, \@totalleftmargin 70% 71%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 72% internal control: 73% 74% \a@hsize = length of line buffer including \leftskip, \rightskip 75% \a@limit = maximal Arabic text length 76% 77% \a@vmodetrue : linebuffer undefined, \a@hsize valid 78% \a@vmodefalse: linebuffer valid, \a@limit valid, \a@@everypar used 79% 80%%%%%%%%%%%%%%%%%%%%%%% output routines %%%%%%%%%%%%%%%%%%%%%%%%% 81 82\def \putwordb@x #1{% deposit a word 83\ifa@vmode \arab@indent \fi 84\setbox \wordb@x \hbox {#1}\put@word } 85 86\def \arab@indent {% like \indent for Arabic 87\ifa@vmode \putlineb@x {\hskip \a@parindent }\the\a@@everypar 88\else \setbox \wordb@x \hbox {\hskip \a@parindent }\add@word \fi } 89 90\def \arab@noindent {% like \noindent for Arabic 91\ifa@vmode \initlineb@x \the\a@@everypar \fi } 92 93\def \leavea@vmode {% like \leavevmode for Arabic 94\ifa@vmode \arab@indent \fi } 95 96%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 97 98\def \initlineb@x {% make an empty Arabic line 99\putlineb@x {\arab@strut }\a@spacefalse } 100 101\def \putlineb@x #1{% open the line box 102\a@vmodefalse \a@limit \a@hsize 103\advance \a@limit -\leftskip \advance \a@limit -\rightskip 104\setbox \lineb@x \hbox {#1}\a@spacefalse } 105 106\def \add@word {% add word to line without space 107\putlineb@x {\unhbox \wordb@x \unhbox \lineb@x }} 108 109\def \addt@line {% add word to line unconditionally, spacing ? 110\ifa@space \putlineb@x 111 {\unhcopy \wordb@x \arab@space \unhcopy \lineb@x }% 112\else \add@word \fi } 113 114\def \put@word {% add word to line, spacing, break line if necessary 115\setbox \a@tempb@x \hbox 116{\unhcopy \wordb@x \ifa@space \arab@space \fi \unhcopy \lineb@x }% 117\ifdim \a@limit < \wd\lineb@x \put@line \add@word \else 118\ifdim \a@limit < \wd\a@tempb@x \put@line \add@word \else 119\setbox \lineb@x \box \a@tempb@x 120\fi\fi } 121 122%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 123 124\def \put@line {% output the line, adjusted 125\ifarab \setbox\a@tempb@x \hbox to \a@hsize 126 {\hskip \rightskip \arab@strut 127 \charsubdefmax \m@ne \unhbox \lineb@x \hskip \leftskip }% 128 \put@ab@x 129\fi \ifnum \tracingarab > 1 \message {|}\fi } 130 131\def \short@line{% put line without adjustment, close line 132\ifarab \ifdim \wd\lineb@x = \z@ \else 133\ifspread \dimen0 \a@limit \divide \dimen0 8 134 \dimen2 \a@limit \advance \dimen2 -\wd\lineb@x 135 \setbox\a@tempb@x \hbox to \a@hsize 136 {\hskip \rightskip 137 \loop \hskip \parfillskip \advance \dimen2 -\dimen0 138 \ifdim \dimen2 > \z@ \repeat 139 \arab@strut \charsubdefmax \m@ne 140 \unhbox \lineb@x \hskip \leftskip }% 141\else \setbox\a@tempb@x \hbox to \a@hsize 142 {\hskip \rightskip \hskip \parfillskip 143 \arab@strut \charsubdefmax \m@ne 144 \unhbox \lineb@x \hskip \leftskip }% 145\fi \put@ab@x 146\fi\fi 147\ifnum \tracingarab > 1 \message {/}\fi } 148 149\def \put@ab@x {% deposit line 150\ifhmode \unskip {\endgraf }\penalty \clubpenalty 151\parindent \z@ \parskip \z@ \else 152\ifnum \a@prevgraf = \z@ \else \penalty \widowpenalty 153\fi\fi 154\begingroup \parfillskip 0pt plus 1fill 155 \leftskip \z@ \rightskip \z@ \noindent 156 \ifdim \a@leftmargin = \z@ \else \hskip \a@leftmargin \fi 157 \box\a@tempb@x \endgraf 158\endgroup \parindent \z@ \parskip \z@ \initlineb@x 159\advance \a@prevgraf \@ne \a@@prevgraf \prevgraf 160\advance \a@@prevgraf \@ne \prevgraf \a@@prevgraf } 161 162%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 163 164\let \a@par@hook \relax % reserved 165 166\def \testoutput {% show output box 167\showboxbreadth = \maxdimen \showboxdepth = 6 168\message {"testoutput" activated.} 169\tracingoutput = 1 } 170 171%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 172\endinput 173%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 174