Debian Codegraph @

texmf-dist/source/latex/ledmac/ledarab.dtx

raw
1 % \iffalse meta-comment
2 %
3 % ledarab.dtx
4 % Author: Peter Wilson (Herries Press) herries dot press at earthlink dot net
5 % Maintainer:Maïeul Rouquette maieul at maieul dot net
6 %
7 % This work may be distributed and/or modified under the
8 % conditions of the LaTeX Project Public License, either
9 % version 1.3 of this license or (at your option) any
10 % later version.
11 % The latest version of the license is in
12 % http://www.latex-project.org/lppl.txt
13 % and version 1.3 or later is part of all distributions of
14 % LaTeX version 2003/06/01 or later.
15 %
16 % This work has the LPPL maintenance status "unmaintained".
17 %
18 % This work consists of the files listed in the README file.
19 %
20 %
21 %<*driver>
22 \documentclass[twoside]{ltxdoc}
23 \usepackage{url}
24 \usepackage[draft=false,
25 plainpages=false,
26 pdfpagelabels,
27 bookmarksnumbered,
28 % hyperindex=true
29 hyperindex=false
30 ]{hyperref}
31 \providecommand{\phantomsection}{} % just in case hyperref is not used
32 \usepackage{graphicx}
33 % a simpler version of chngpage.sty's adjustwidth environment
34 \newenvironment{addtomargins}[2]{%
35 \begin{list}{}{%
36 \topsep 0pt
37 \addtolength{\leftmargin}{#1}%
38 \addtolength{\rightmargin}{#2}%
39 \listparindent \parindent
40 \itemindent \parindent
41 \parsep \parskip
42 }%
43 \item[]}{\end{list}}
44 \makeatletter
45 \@mparswitchfalse
46 \makeatother
47 \EnableCrossrefs
48 \CodelineIndex
49 \RecordChanges
50 %%\OnlyDescription
51 \renewcommand{\MakeUppercase}[1]{#1}
52 \pagestyle{headings}
53 \setcounter{StandardModuleDepth}{1}
54 \setcounter{IndexColumns}{2}
55 \begin{document}
56 \raggedbottom
57 \DocInput{ledarab.dtx}
58 \end{document}
59 %</driver>
60 %
61 % \fi
62 %
63 % \CheckSum{821}
64 %
65 % \makeatletter
66 % \newcommand*{\DescribeIt}{\leavevmode\@bsphack\begingroup\MakePrivateLetters
67 % \Describe@It}
68 % \newcommand*{\Describe@It}[1]{\endgroup
69 % \marginpar{\raggedleft\PrintDescribeEnv{#1}}%
70 % \SpecialItIndex{#1}\@esphack\ignorespaces}
71 % \newcommand*{\SpecialItIndex}[1]{\@bsphack
72 % \index{#1\actualchar{\protect\ttfamily#1}\encapchar usage}\@esphack}
73 %
74 % \DoNotIndex{\@,\@@par,\@beginparpenalty,\@empty}
75 % \DoNotIndex{\@flushglue,\@input}
76 % \DoNotIndex{\@makefnmark,\@makeother,\@maketitle}
77 % \DoNotIndex{\@namedef,\@ne,\@spaces,\@tempa}
78 % \DoNotIndex{\@tempb,\@tempswafalse,\@tempswatrue}
79 % \DoNotIndex{\@thanks,\@thefnmark,\@topnum}
80 % \DoNotIndex{\@@,\@elt,\@forloop,\@fortmp,\@gtempa,\@totalleftmargin}
81 % \DoNotIndex{\",\/,\@ifundefined,\@nil,\@verbatim,\@vobeyspaces}
82 % \DoNotIndex{\|,\~,\ ,\active,\advance,\aftergroup,\begingroup,\bgroup}
83 % \DoNotIndex{\mathcal,\csname,\def,\documentstyle,\dospecials,\edef}
84 % \DoNotIndex{\egroup}
85 % \DoNotIndex{\else,\endcsname,\endgroup,\endinput,\endtrivlist}
86 % \DoNotIndex{\expandafter,\fi,\fnsymbol,\futurelet,\gdef,\global}
87 % \DoNotIndex{\hbox,\hss,\if,\if@inlabel,\if@tempswa,\if@twocolumn}
88 % \DoNotIndex{\ifcase}
89 % \DoNotIndex{\ifcat,\iffalse,\ifx,\ignorespaces,\index,\input,\item}
90 % \DoNotIndex{\jobname,\kern,\leavevmode,\leftskip,\let,\llap,\lower}
91 % \DoNotIndex{\m@ne,\next,\newpage,\nobreak,\noexpand,\nonfrenchspacing}
92 % \DoNotIndex{\obeylines,\or,\protect,\raggedleft,\rightskip,\rm,\sc}
93 % \DoNotIndex{\setbox,\setcounter,\small,\space,\string,\strut}
94 % \DoNotIndex{\strutbox}
95 % \DoNotIndex{\thefootnote,\thispagestyle,\topmargin,\trivlist,\tt}
96 % \DoNotIndex{\twocolumn,\typeout,\vss,\vtop,\xdef,\z@}
97 % \DoNotIndex{\,,\@bsphack,\@esphack,\@noligs,\@vobeyspaces,\@xverbatim}
98 % \DoNotIndex{\`,\catcode,\end,\escapechar,\frenchspacing,\glossary}
99 % \DoNotIndex{\hangindent,\hfil,\hfill,\hskip,\hspace,\ht,\it,\langle}
100 % \DoNotIndex{\leaders,\long,\makelabel,\marginpar,\markboth,\mathcode}
101 % \DoNotIndex{\mathsurround,\mbox,\newcount,\newdimen,\newskip}
102 % \DoNotIndex{\nopagebreak}
103 % \DoNotIndex{\parfillskip,\parindent,\parskip,\penalty,\raise,\rangle}
104 % \DoNotIndex{\section,\setlength,\TeX,\topsep,\underline,\unskip,\verb}
105 % \DoNotIndex{\vskip,\vspace,\widetilde,\\,\%,\@date,\@defpar}
106 % \DoNotIndex{\[,\{,\},\]}
107 % \DoNotIndex{\count@,\ifnum,\loop,\today,\uppercase,\uccode}
108 % \DoNotIndex{\baselineskip,\begin,\tw@}
109 % \DoNotIndex{\a,\b,\c,\d,\e,\f,\g,\h,\i,\j,\k,\l,\m,\n,\o,\p,\q}
110 % \DoNotIndex{\r,\s,\t,\u,\v,\w,\x,\y,\z,\A,\B,\C,\D,\E,\F,\G,\H}
111 % \DoNotIndex{\I,\J,\K,\L,\M,\N,\O,\P,\Q,\R,\S,\T,\U,\V,\W,\X,\Y,\Z}
112 % \DoNotIndex{\1,\2,\3,\4,\5,\6,\7,\8,\9,\0}
113 % \DoNotIndex{\!,\#,\$,\&,\',\(,\),\+,\.,\:,\;,\<,\=,\>,\?,\_}
114 % \DoNotIndex{\discretionary,\immediate,\makeatletter,\makeatother}
115 % \DoNotIndex{\meaning,\newenvironment,\par,\relax,\renewenvironment}
116 % \DoNotIndex{\repeat,\scriptsize,\selectfont,\the,\undefined}
117 % \DoNotIndex{\arabic,\do,\makeindex,\null,\number,\show,\write,\@ehc}
118 % \DoNotIndex{\@author,\@ehc,\@ifstar,\@sanitize,\@title,\everypar}
119 % \DoNotIndex{\if@minipage,\if@restonecol,\ifeof,\ifmmode}
120 % \DoNotIndex{\lccode,\newtoks,\onecolumn,\openin,\p@,\SelfDocumenting}
121 % \DoNotIndex{\settowidth,\@resetonecoltrue,\@resetonecolfalse,\bf}
122 % \DoNotIndex{\clearpage,\closein,\lowercase,\@inlabelfalse}
123 % \DoNotIndex{\selectfont,\mathcode,\newmathalphabet,\rmdefault}
124 % \DoNotIndex{\bfdefault}
125 % \DoNotIndex{\newcommand}
126 %
127 % \newcommand{\dtxfilename}{\texttt{ledarab.dtx}}
128 % \def\fileversion{v0.1} \def\filedate{2005/03/24}
129 %
130 % \changes{v0.1}{2005/03/24}{First public release}
131 % \changes{v0.1}{2011/17/06}{Ma\"ieul Rouquette new maintainer}
132 % \hyphenation{man-u-script man-u-scripts}
133 %
134 % \newcommand{\Lpack}[1]{\textsf{#1}}
135 % \newcommand{\Lclass}[1]{\textsf{#1}}
136 % \newcommand{\file}[1]{\texttt{#1}}
137 % \newcommand{\env}[1]{\texttt{#1}} ^^A for environment names
138 % \newcommand{\ledpar}{ledpar}
139 % \newcommand{\ledmac}{ledmac}
140 % \newcommand{\Ledmac}{\Lpack{\ledmac}}
141 % \newcommand{\Ledpar}{\Lpack{\ledpar}}
142 % \newcommand{\edmac}{\texttt{EDMAC}}
143 % \newcommand{\tabmac}{\texttt{TABMAC}}
144 % \newcommand{\edstanza}{\texttt{EDSTANZA}}
145 % \newcommand{\ArabTeX}{\texttt{ArabTeX}}
146 % \newcommand{\Larabtex}{\Lpack{arabtex}}
147 % \newcommand{\Lafoot}{\Lpack{afoot}}
148 % \newcommand{\Lledarab}{\Lpack{ledarab}}
149 % \newcommand{\PWcomment}[1]{}
150 % \newenvironment{PW}{\itshape}{}
151 % \renewenvironment{PW}{\sffamily}{}
152 % \newcommand{\texbook}{\textit{TeXbook}}
153 % \newcommand{\thetexbook}{\textit{The TeXbook}}
154 %
155 % ^^A PW added following as the definitions are at some unknown elsewhere
156 % \newcommand{\egstart}{}
157 % \newcommand{\egmid}{}
158 % \newcommand{\egend}{}
159 %
160 % \renewcommand{\egstart}{%
161 % \par
162 % \begingroup
163 % \centering
164 % \begin{minipage}{0.45\textwidth}}
165 % \renewcommand{\egmid}{%
166 % \end{minipage}\hfill\begin{minipage}{0.45\textwidth}}
167 % \renewcommand{\egend}{%
168 % \end{minipage}\par\endgroup}
169 %
170 % \title{Critical editions and arabic typesetting: \\
171 % the \Lpack{ledarab} and \Lpack{afoot} packages\thanks{This file (\dtxfilename)
172 % has version number \fileversion, last revised \filedate.}}
173 % \author{%
174 % Peter Wilson \\
175 % Herries Press\thanks{\texttt{herries dot press at earthlink dot net}}\\
176 % Ma\"ieul Rouquette\thanks{\texttt{maieul at maieul dot net}}
177 %}
178 %
179 % \date{}
180 %
181 %
182 % \maketitle
183 %
184 %
185 % \begin{abstract}
186 % The \Ledmac{} package, which is based on the \PlainTeX\ set of
187 % \edmac\ macros, has been used for some time for typesetting critical
188 % editions, and the \ArabTeX{} system enables the typesetting of arabic
189 % texts.
190 %
191 % The \Lafoot{} package is an extension to the \Larabtex{} package
192 % to enable footnotes in arabic texts and the \Lledarab{} package
193 % provides an interface between \Larabtex{} and \Ledmac{} (also \Ledpar)
194 % for arabic text
195 % in critical editions.
196 %
197 % Please, for all bug's report, open a ticket on \url{https://github.com/maieul/ledmac/issues/}
198 % \end{abstract}
199 %
200 % \tableofcontents
201 % \listoffigures
202 %
203 %
204 % \section{Introduction}
205 %
206 % The \edmac{} macros \cite{EDMACTUG} for typesetting critical editions
207 % of texts
208 % have been available for use with TeX for some years, and the
209 % \Larabtex{} package \cite{ARABTEX} provides for arabic typesetting.
210 % These two
211 % works are interfaced by the \Lpack{aedpatch} package provided as
212 % part of the \ArabTeX{} distribution.
213 %
214 % Following the introduction of \edmac{}
215 % there had been a small but constant demand for a
216 % version that could be used with LaTeX. The \Ledmac{}
217 % package \cite{LEDMAC} was introduced in 2003 in an attempt to satisfy
218 % that request. This was extended in 2004 by the \Ledpar{} package
219 % \cite{LEDPAR} to allow the typesetting of parallel critical texts.
220 % The \Lledarab{} package provides an interface between the \Larabtex{}
221 % and the \Ledmac{} (and \Ledpar) packages.
222 % The package has to try and coerce \TeX{} into paths it was not designed
223 % for. Use of the package, therefore, may produce some surprising results.
224 %
225 % I initially used version 3.10 (2001/09/16) of the \Larabtex{} package
226 % but when I moved to version 3.11 (2003/08/22) I found that the code
227 % for footnotes (in \file{afoot.sty}) no longer worked. The \Lafoot{} package
228 % provided here is based on the obsolete 3.10 version, until a working
229 % version\footnote{I made queries about this on the \texttt{comp.text.tex}
230 % newsgoup on 2005/01/06 but got no responses.}
231 % of \file{afoot.sty} is provided in the \ArabTeX{} distribution.
232 %
233 % \section{The \Lpack{afoot} package}\label{howto}
234 %
235 % The \Larabtex{} package automatically calls the \Lafoot{} package. If you
236 % want to use my version of \Lafoot{} just make sure that it is found by
237 % LaTeX before the \ArabTeX's version, for example by having a copy in
238 % your working directory.
239 %
240 % \DescribeMacro{\footnote}
241 % The \cs{footnote}\marg{text} produces a numbered footnote. Unlike
242 % the usual LaTeX \cs{footnote} macro there is no optional argument
243 % for specifying the number.
244 %
245 % \DescribeMacro{\LRfootnotes}
246 % Inside an \env{arabtext} environment the \cs{LRfootnotes} declaration
247 % causes following footnotes to be in normal left to right (LtoR) roman text,
248 % left adjusted and with the number at the left.
249 %
250 % \DescribeMacro{\RLfootnotes}
251 % \DescribeMacro{\arabfootnotes}
252 % Inside an \env{arabtext} environment the \cs{RLfootnotes} or
253 % \cs{arabfootnotes} declaration
254 % causes any following footnotes to be in right to left (RtoL) arabic script,
255 % right adjusted and with the number at the right.
256 % In normal text the footnotes are normal.
257 %
258 % To get an arabic footnote in normal text try: \\
259 % \verb?...roman\footnote{\RL{arabic}}...? \\
260 % The footnote will be left adjusted but the note's text will be arabic.
261 %
262 %
263 % \section{The \Lpack{ledarab} package}
264 %
265 % The \Lledarab{} package\footnote{I offered an earlier version to Prof.
266 % Lagally towards the end of 2003 for possible addition to his
267 % \Larabtex{} package but got no response to my messages.}
268 % is partially based on Klaus Lagally's \file{aedpatch.sty}
269 % and lets the \Ledmac{} package's critical apparatus be applied
270 % to arabic texts. The packages must be used in the following order:
271 % \begin{verbatim}
272 % \usepackage{ledmac}
273 % \usepackage{ledpar} % if you need parallel texts.
274 % \usepackage{arabtex}
275 % \usepackage{ledarab}
276 % \end{verbatim}
277 %
278 % The package is very limited --- only the basic numbering and
279 % critical footnotes are supported. Even then, all critical notes
280 % are left adjusted with the lemma and note in left to right order, although
281 % the lemma and/or note may be in RtoL arabic script. Items like familiar
282 % footnotes, endnotes, tabulars and so on are left to you the user.
283 %
284 % In normal numbered text you can use the \cs{RL} macro within the critical
285 % aparatus for short pieces of arabic.
286 % \begin{verbatim}
287 % \beginnumbering
288 % \pstart
289 % Normal \edtext{latin}{\Cfootnote{roman}} text.
290 % Normal \edtext{\RL{latin}}{\Cfootnote{\RL{roman}}} text.
291 % ...
292 % \end{verbatim}
293 % In the first line above the lemma and footnote will both be in latin
294 % script while in the second line they will both be in arabic script; in
295 % each case, though, the lemma is at the left and the note follows on the
296 % right.
297 %
298 % \begin{verbatim}
299 % \beginnumbering
300 % \pstart
301 % \begin{arabtext}
302 % Arabic \edtext{script}{\Afootnote{roman}} text.
303 % Arabic \edtext{script}{\Afootnote{\LR{roman}}} text.
304 % Arabic \edtext{script}{\Afootnote{\RL{arabic}}} text.
305 % Arabic \edtext{\LR{error}}{\Afootnote{roman}} text.
306 % \end{arabtext}
307 % \pend
308 % ...
309 % \end{verbatim}
310 % In the first and second lines above the lemma is in arabic script and
311 % the note in
312 % latin script, while in the third line both the lemma and the note
313 % are in arabic script. Using \cs{LR} as part of the lemma, as in the last
314 % line causes errors.
315 %
316 % \begin{verbatim}
317 % \beginnumbering
318 % \begin{arabtext}
319 % \pstart
320 % Arabic \edtext{script}{\Afootnote{messy}} text.
321 % Arabic \edtext{script}{\Afootnote{\LR{messy}}} text.
322 % Arabic \edtext{script}{\Afootnote{\RL{arabic}}} text.
323 % \pend
324 % \end{arabtext}
325 % ...
326 % \end{verbatim}
327 % In the first two lines above the lemma is in arabic and the note
328 % is in what looks like (to me at least) arabic, but it is all messed up.
329 % In the last line both the lemma and the note are
330 % in arabic.
331 %
332 % \DescribeMacro{\arablnumrep}
333 % \DescribeMacro{\restorelnumrep}
334 % Line numbers are normally typeset in latin script arabic numerals and LtoR.
335 % Following the \cs{arablnumrep} declaration they will be typeset in
336 % arabic script numerals and RtoL. The \cs{restorelnumrep} ensures the
337 % regular line numbers. Use the declarations like:
338 % \begin{verbatim}
339 % \arablnumrep
340 % \begin{arabtex} ... \end{arabtex}
341 % \restorelnumrep
342 % \end{verbatim}
343 %
344 % \DescribeMacro{\latinarabic}
345 % \DescribeMacro{\arabiclatin}
346 % Arabic script naturally has a greater height or leading
347 % (larger \cs{baselineskip})
348 % than latin text. Parallel normal texts and parallel arabic texts align
349 % naturally, as do parallel columns of latin/arabic or arabic/latin texts.
350 % However, left to their own devices pages of parallel arabic and
351 % normal text will not align.
352 %
353 % If you are setting normal text on the left pages and arabic script
354 % on the right using the \cs{latinarabic} declaration should align them.
355 % Similarly when you have arabic script on the left and latin script
356 % on the right use the \cs{arabiclatin} declaration.
357 %
358 % \DescribeMacro{\ledarabstrut}
359 % \DescribeMacro{\savestruts}
360 % \DescribeMacro{\restorestruts}
361 % The \cs{ledarabstrut} strut is the height of a line of arabic script
362 % and is used to increase the height of latin text lines to match
363 % arabic script lines. The definition is: \\
364 % \verb?\newcommand*{\ledarabstrut}{\rule[-1ex]{0pt}{4ex}}? \\
365 % If it does not quit match the arabic script in your case then change the
366 % \verb?4ex? appropriately.
367 %
368 % The macro \cs{savestruts} saves the current definitions of the struts
369 % used in the left and right texts (\cs{latinarabic} and \cs{arabiclatin}
370 % change these). The macro \cs{restorestruts} set the definitions of the
371 % left and right struts to match those stored by the last \cs{savestruts}.
372 % The package calls \cs{savestruts} itself to store the default struts.
373 %
374 % For example, with regular text on the left and arabic on the right
375 % then the general scheme is:
376 % \begin{verbatim}
377 % \savestruts
378 % \begin{pages}
379 % \begin{Leftside}
380 % \beginnumbering
381 % \pstart
382 % normal text
383 % ...
384 % \end{Leftside}
385 % \begin{Rightside}
386 % \begin{arabtext}
387 % \beginnumbering
388 % \pstart
389 % arabic text
390 % ...
391 % \end{Rightside}
392 % \latinarabic
393 % \Pages
394 % \restorestruts
395 % \end{pages}
396 % \end{verbatim}
397 %
398 % In the above, if it had been: \\
399 % \verb?\begin{arabtext}?\\
400 % \verb? \Pages?\\
401 % \verb?\end{arabtext}?\\
402 % Then a redefinition of \cs{ledarabstrut} as: \\
403 % \verb?\renewcommand*{\ledarabstrut}{\rule[-1ex]{0pt}{3.75ex}}? \\
404 % might provide better alignment of the latin text with the arabic.
405 %
406 % Life gets complicated regarding lemmas and notes when there are
407 % parallel latin and arabic texts.
408 % Consider that there are the following left (latin) and right (arabic) texts
409 % \begin{verbatim}
410 % \begin{Leftside}
411 % ...
412 % 1) \edtext{latin}{\Afootnote{roman}}...
413 % 2) \edtext{\RL{latin}}{\Afootnote{\RL{roman}}}...
414 % 3) \edtext{\LR{latin}}{\Afootnote{\LR{roman}}}...
415 % ...
416 % \end{Leftside}
417 % \begin{Rightside}
418 % \begin{arabtext}
419 % ...
420 % A) \edtext{script}{\Bfootnote{arabic}}...
421 % B) \edtext{script}{\Bfootnote{\RL{arabic}}}...
422 % C) \edtext{script}{\Bfootnote{\LR{arabic}}}...
423 % ...
424 % \end{Rightside}
425 % \end{verbatim}
426 % and they are to be output as matching pages. If they are output simply as: \\
427 % \verb?\Pages? \\
428 % then the lemmas and notes for the marked lines are: \\
429 % 1) latin lemma, latin note \\
430 % 2) arabic lemma, arabic note \\
431 % 3) latin lemma, latin note \\
432 % A) arabic lemma, latin note \\
433 % B) arabic lemma, arabic note \\
434 % C) arabic lemma, latin note
435 %
436 % On the otherhand, if they are output via: \\
437 % \verb?\begin{arabtext} \Pages \end{arabtext}? \\
438 % then the lemmas and notes for the marked lines are: \\
439 % 1) latin lemma, messed arabic note \\
440 % 2) arabic lemma, arabic note \\
441 % 3) latin lemma, messed arabic note \\
442 % A) arabic lemma, messed arabic note \\
443 % B) arabic lemma, arabic note \\
444 % C) arabic lemma, messed arabic note
445 %
446 %
447 % \StopEventually{}
448 %
449 % \section{The \Lpack{afoot} implementation}
450 % \label{afootimpl}
451 %
452 % The \Lafoot{} package is effectively an extraction from
453 % the \Lpack{alatex} package of \ArabTeX, v3.10, 2000/05/08.
454 %
455 % Announce the name and version of the package, which is
456 % targetted for LaTeX2e.
457 %
458 % \begin{macrocode}
459 %<*afoot>
460 \NeedsTeXFormat{LaTeX2e}
461 \ProvidesPackage{afoot}[2005/03/24 v0.1 PW's version of ArabTeX's afoot.sty]
462
463 % \end{macrocode}
464 %
465 % The package redefines the internals of the LaTeX \cs{footnote} macro
466 % along the lines of the \cs{vfootnote} macro in \PlainTeX. It also
467 % does some things a bit differently if the \Lpack{fnpara} package
468 % has been used.
469 %
470 % \begin{macro}{\@makefntext}
471 % I don't know why this is here as it is also defined as part of the
472 % \cs{@footnotetext} macro below.
473 % \begin{macrocode}
474 \ifx \footglue \undefined % normal case
475 \else % fnpara.sty is present
476 \long\def\@makefntext#1{{$^{\@thefnmark}$}#1\nobreak }
477 \fi
478
479 % \end{macrocode}
480 % \end{macro}
481 %
482 % \begin{macro}{\@footnotetext}
483 % \begin{macrocode}
484 %%% Make the LaTeX \cs{footnote} catcode-safe, like in Plain TeX.
485
486 \def \@footnotetext {% new, do not yet read footnote text
487 \insert \footins \bgroup
488 \ifx \footglue \undefined % prepare normal footnote
489 \interlinepenalty \interfootnotelinepenalty \floatingpenalty \@MM
490 \splittopskip \footnotesep \splitmaxdepth \dp \strutbox
491 \else
492 \global\long\def \@makefntext ##1{{$^{\@thefnmark }$}##1\nobreak }%
493 \setbox0=\hbox \bgroup % fnpara.sty is present
494 \floatingpenalty=20000 \footnotesize
495 \fi
496 \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
497 \a@fntext }
498
499 % \end{macrocode}
500 % \end{macro}
501 %
502 % \begin{macro}{\@mpfootnotetext}
503 % The version for \env{minpage}s.
504 % \begin{macrocode}
505 \def \@mpfootnotetext {%
506 \global \setbox \@mpfootins \vbox \bgroup
507 \edef \@currentlabel {\csname p@mpfootnote\endcsname \@thefnmark }%
508 \unvbox \@mpfootins \reset@font \a@fntext }
509
510 % \end{macrocode}
511 % \end{macro}
512 %
513 % \begin{macro}{\a@fntext}
514 % A common portion of the code for the footnote text in both normal and
515 % \env{minipage} environments.
516 % \begin{macrocode}
517 \def \a@fntext {% common part for footnote text
518 \footnotesize \hsize \columnwidth \@parboxrestore \clubpenalty 5000
519 \@makefntext {\rule {\z@ }{\footnotesep }}\futurelet \next \fo@t }
520
521 % \end{macrocode}
522 % \end{macro}
523 %
524 % The next set of macros are from the \cs{vfootnote} macro
525 % (\textit{The TeXbook}, Appendix B)
526 % \begin{macro}{\fo@t}
527 % Copy from \textit{TeXbook}.
528 % \begin{macrocode}
529 %%%%%%%%%%%%%%%%%%%%%%%% \footnote, parts from Plain %%%%%%%%%%%%%%%%%
530
531 \def\fo@t{%
532 \ifcat
533 \bgroup \noexpand\next
534 \let\next\f@@t
535 \else
536 \let\next\f@t
537 \fi
538 \next }
539 % \end{macrocode}
540 % \end{macro}
541 %
542 % \begin{macro}{\f@@t}
543 % Copy from \textit{TeXbook}.
544 % \begin{macrocode}
545 \def\f@@t{\bgroup\aftergroup\@foot\let\next}
546 % \end{macrocode}
547 % \end{macro}
548 %
549 % \begin{macro}{\f@t}
550 % Copy from \textit{TeXbook}.
551 % \begin{macrocode}
552 \def\f@t#1{#1\@foot}
553 % \end{macrocode}
554 % \end{macro}
555 %
556 % \begin{macro}{\@foot}
557 % This has a bit more to it than the \textit{TeXbook} macro.
558 % \begin{macrocode}
559 \def\@foot{\unskip \strut \lineskiplimit -20pt \endgraf \egroup }
560
561 % \end{macrocode}
562 % \end{macro}
563 %
564 % \begin{macro}{\a@footnote}
565 % \begin{macro}{\@foot}
566 % \begin{macro}{\@footnotemark}
567 % These macros are for normal footnotes from within an arabic environment.
568 % \begin{macrocode}
569 %%%%%%%%% footnote inside an Arabic environment, Roman document style
570
571 \def\a@footnote{%
572 \def\@foot{% ArabTeX-LaTeX version
573 \ifx \footglue \undefined % normal case
574 \unskip \strut
575 \else % fnpara.sty is present
576 \penalty-10 \hskip\footglue \egroup % box 0
577 \dp0=0pt \ht0=\fudgefactor\wd0 \box0
578 \fi
579 \egroup \arab@codes \set@arabfont \test@token }%
580 \def\@footnotemark{\af@fnmarkb@x \a@spacetrue}%
581 \rmfamily \parindent \a@parindent \unarab@codes \footnote }
582
583 % \end{macrocode}
584 % \end{macro}
585 % \end{macro}
586 % \end{macro}
587 %
588 % \begin{macro}{\af@fnmarkb@x}
589 % This saves some tokens as the code is used in several places.
590 % \begin{macrocode}
591 \def\af@fnmarkb@x{%
592 \a@spacefalse \putword@box \@makefnmark}
593
594 % \end{macrocode}
595 % \end{macro}
596 %
597 % \begin{macro}{\a@footnotemark}
598 % \begin{macro}{\@footnotemark}
599 % These are also for normal footnotes from within an arabic environment.
600 % \begin{macrocode}
601 \def\a@footnotemark{%
602 \def\@footnotemark{\af@fnmarkb@x \a@spacefalse \arab@codes \test@token}%
603 \unarab@codes \footnotemark }
604
605 % \end{macrocode}
606 % \end{macro}
607 %
608 % \begin{macro}{\a@@footnote}
609 % \begin{macro}{\@footnotemark}
610 % \begin{macro}{\a@fntext}
611 % These macros are for arabic footnotes from within an arabic environment.
612 % \begin{macrocode}
613 %%%%%%%%% footnote inside an Arabic environment, Arabic document style
614
615 \def\a@@footnote{% ArabTeX-LaTeX version
616 \def\@footnotemark{\af@fnmarkb@x \a@spacetrue}%
617 \def\a@fntext{\a@@fntext }%
618 \footnote }
619
620 % \end{macrocode}
621 % \end{macro}
622 % \end{macro}
623 % \end{macro}
624 %
625 % \begin{macro}{\a@@fntext}
626 % This is also for arabic footnotes, being the common portion of the code
627 % for footnote text in both normal and \env{minipage} texts.
628 % \begin{macrocode}
629 \def\a@@fntext#1{% some common code for footnote text
630 \def\end{%
631 \a@par \egroup \test@token }%
632 \hsize \columnwidth \@parboxrestore
633 \initlineb@x \@footnotemark \test@token #1 \end }
634
635 % \end{macrocode}
636 % \end{macro}
637 %
638 % \begin{macro}{\a@@footnotemark}
639 % \begin{macro}{\@footnotemark}
640 % As are these.
641 % \begin{macrocode}
642 \def\a@@footnotemark{%
643 \def\@footnotemark{\af@fnmarkb@x \a@spacetrue \test@token}%
644 \footnotemark }
645
646 % \end{macrocode}
647 % \end{macro}
648 % \end{macro}
649 %
650 % \begin{macro}{\LRfootnotes}
651 % Inside an \env{arabtext} environment the \cs{LRfootnotes} declaration
652 % results in normal footnotes, left adjusted.
653 % \begin{macrocode}
654 \def \LRfootnotes {% left to right, Arabic document
655 \let \a@c@footnote \a@footnote
656 \let \a@c@footnotemark \a@footnotemark }
657 \all@wcmd \LRfootnotes
658
659 % \end{macrocode}
660 % \end{macro}
661 %
662 % \begin{macro}{\RLfootnotes}
663 % Inside an \env{arabtext} environment the \cs{RLfootnotes} declaration
664 % results in arabic footnotes, right adjusted. In normal text the footnotes
665 % are normal.
666 % \begin{macrocode}
667 \def \RLfootnotes {% right to left, Arabic document
668 \let \a@c@footnote \a@@footnote
669 \let \a@c@footnotemark \a@@footnotemark }
670 \all@wcmd \RLfootnotes
671 % \end{macrocode}
672 % \end{macro}
673 %
674 % \begin{macro}{\arabfootnotes}
675 % \cs{arabfootnotes} is an alias for \cs{RLfootnotes}.
676 % \begin{macrocode}
677 \let \arabfootnotes \RLfootnotes
678 \all@wcmd \arabfootnotes
679
680 % \end{macrocode}
681 % \end{macro}
682 %
683 % Make \cs{LRfootnotes} the default.
684 % \begin{macrocode}
685 \LRfootnotes
686
687 % \end{macrocode}
688 %
689 % The end of the package
690 %
691 % \begin{macrocode}
692 %</afoot>
693 % \end{macrocode}
694 %
695 %
696 % \section{The \Lpack{ledarab} implementation}
697 % \label{ledarabimpl}
698 %
699 % The \Lledarab{} package is based on the original \Lpack{aedpatch}
700 % from the \ArabTeX{} distribution.
701 %
702 % Announce the name and version of the package, which is for LaTeX2e.
703 %
704 % \begin{macrocode}
705 %<*ledarab>
706 \NeedsTeXFormat{LaTeX2e}
707 \ProvidesPackage{ledarab}[2005/03/24 v0.1 Cooperation between arabtex and ledmac]
708
709 % \end{macrocode}
710 %
711 % \begin{macro}{\tr@ce@n}
712 % \begin{macro}{\tr@ce@ff}
713 % I think, but don't know, that by appropriate (re)definitions of these
714 % you can get \Larabtex{}
715 % to produce some tracing of what is going on, perhaps by setting
716 % \cs{tracingmacros} to 1 instead of 0.
717 % \begin{macrocode}
718 \providecommand*{\tr@ce@n}{\tracingmacros 0}
719 \providecommand*{\tr@ce@ff}{\edef \tr@ce@n
720 {\nxp\tracingmacros \the\tracingmacros }\tracingmacros 0}
721 \let \tr@ce@n \relax
722
723 % \end{macrocode}
724 % \end{macro}
725 % \end{macro}
726 %
727 % \begin{macro}{\if@l@dparpack}
728 % \begin{macro}{\@l@dparpacktrue}
729 % \begin{macro}{\@l@dparpackfalse}
730 % We need a flag for knowing if \Ledpar{} is being used.
731 % \begin{macrocode}
732 \newif\if@l@dparpack
733 \@l@dparpackfalse
734 \@ifpackageloaded{ledpar}{\@l@dparpacktrue}{\@l@dparpackfalse}
735
736 % \end{macrocode}
737 % \end{macro}
738 % \end{macro}
739 % \end{macro}
740 %
741 % \subsection{Adjusting the baselines}
742 %
743 % \begin{macro}{\do@linehook}
744 % Arabic lines are taller than roman lines, so add some height to
745 % numbered lines.
746 % \begin{macrocode}
747 \renewcommand*{\do@linehook}{%
748 \advance\baselineskip 1ex}
749
750 % \end{macrocode}
751 % \end{macro}
752 %
753 %
754 % \begin{macro}{arabledparfixi}
755 % If the \Ledpar{} package is loaded we have to change several of its
756 % macros. We can't do this simply within an \cs{if@l@dparpack} because
757 % of the internal \cs{if}s. Hence, we define a macro whose expansion
758 % is the necessary changes.
759 %
760 % \begin{macrocode}
761 %%%%%%%%%%%%%%%%%%%%% ledpar fix %%%%%%%%%%%%%%%%%%%%%%%%%%%%
762 \newcommand{\arabledparfixi}{%
763 % \end{macrocode}
764 % \begin{macro}{\do@lineLhook}
765 % \begin{macro}{\do@lineRhook}
766 % Increase the height of numbered lines.
767 % \begin{macrocode}
768 \renewcommand*{\do@lineLhook}{%
769 \advance\baselineskip 1ex}
770 \renewcommand*{\do@lineRhook}{%
771 \advance\baselineskip 1ex}
772 % \end{macrocode}
773 % \end{macro}
774 % \end{macro}
775 %
776 % \begin{macro}{\a@l@dparparamsL}
777 % \begin{macro}{\a@l@dparparamsR}
778 % Variations on \cs{a@parparams} from \ArabTeX's \file{aoutput.sty}.
779 % These are required to take account of the differing widths, by setting
780 % \cs{a@hsize} appropriately.
781 % \begin{macrocode}
782 \newcommand*{\a@l@dparparamsL}{%
783 \ifnum \parshape = \z@
784 \a@hsize \Lcolwidth
785 \a@leftmargin \z@
786 \else
787 \a@hsize \Lcolwidth \a@leftmargin \@totalleftmargin
788 \fi
789 \a@leftmargin \z@
790 \a@prevgraf \z@ \spreadfalse }
791 \newcommand*{\a@l@dparparamsR}{%
792 \ifnum \parshape = \z@
793 \a@hsize \Rcolwidth
794 \a@leftmargin \z@
795 \else
796 \a@hsize \Rcolwidth \a@leftmargin \@totalleftmargin
797 \fi
798 \a@leftmargin \z@
799 \a@prevgraf \z@ \spreadfalse }
800 % \end{macrocode}
801 % \end{macro}
802 % \end{macro}
803 %
804 % \begin{macro}{\Leftsidehook}
805 % \begin{macro}{\Rightsidehook}
806 %
807 % \begin{macrocode}
808 \renewcommand*{\Leftsidehook}{%
809 \let\a@parparams\a@l@dparparamsL}
810 \renewcommand*{\Rightsidehook}{%
811 \let\a@parparams\a@l@dparparamsR}
812 % \end{macrocode}
813 % \end{macro}
814 % \end{macro}
815 %
816 % \begin{macro}{\ledarabstrut}
817 % \begin{macro}{\ledstrutL}
818 % \begin{macro}{\ledstrutR}
819 % \begin{macro}{\savestruts}
820 % \begin{macro}{\restorestruts}
821 % \begin{macro}{\latinarabic}
822 % \begin{macro}{\arabiclatin}
823 % In order to get parallel arabic and normal texts to line up
824 % a strut has to be added to each latin line to hide their different heights;
825 % this is \cs{ledarabstrut}. The commands \cs{savestruts} and
826 % \cs{restorestruts} save and restore the original left/right strut
827 % definitions. The declaration \cs{latinarabic} is for left and right texts
828 % being latin and arabic, and for left arabic and right latin use
829 % \cs{arabiclatin}.
830 % \begin{macrocode}
831 \newcommand*{\ledarabstrut}{%
832 \rule[-1ex]{0pt}{4ex}}
833 \newcommand*{\savestruts}{%
834 \let\oldl@dstr@tL\ledstrutL
835 \let\oldl@dstr@tR\ledstrutR}
836 \newcommand*{\restorestruts}{%
837 \let\ledstrutL\oldl@dstr@tL
838 \let\ledstrutR\oldl@dstr@tR}
839 \newcommand*{\latinarabic}{%
840 \def\ledstrutL{\ledarabstrut}%
841 \def\ledstrutR{}}
842 \newcommand*{\arabiclatin}{%
843 \def\ledstrutL{}%
844 \def\ledstrutR{\ledarabstrut}}
845
846 % \end{macrocode}
847 % \end{macro}
848 % \end{macro}
849 % \end{macro}
850 % \end{macro}
851 % \end{macro}
852 % \end{macro}
853 % \end{macro}
854 % At last, the end of \cs{arabledparfixi}.
855 % \begin{macrocode}
856 }% end of \newcommand{\arabledparfixi}{...
857
858 % \end{macrocode}
859 % \end{macro}
860 %
861 % Perform the fix for \Ledpar{} if necessary.
862 % \begin{macrocode}
863 \if@l@dparpack
864 \arabledparfixi
865 \savestruts
866 \fi
867 %%%%%%%%%%%%%%%%%%%%% end major ledpar fix %%%%%%%%%%%%%%%%%%%%%%%%%%%%
868
869 % \end{macrocode}
870 % \end{macro}
871 %
872 % \subsection{Lemmas}
873 %
874 % \begin{macro}{\a@c@edtext}
875 % This is the internal version of \cs{edtext}. The parameters
876 % have their original catcodes.
877 % \begin{macrocode}
878 \newcommand*{\a@c@edtext}{%
879 \tr@ce@n \leavea@vmode \unarab@codes
880 \begingroup
881 \tr@ce@ff \rmfamily \tr@ce@n \a@@edtext}
882
883 % \end{macrocode}
884 % \end{macro}
885 %
886 % \begin{macro}{\a@@edtext}
887 % An auxiliary routine to kill leading blanks and remove spurious braces
888 % from \cs{edtext}'s second argument.
889 % \begin{macrocode}
890 \newcommand*{\a@@edtext}[1]{%
891 %%% \def\next@command{\a@@@edtext {\RL{#1}}}% causes errors
892 \def\next@command{\a@@@edtext {#1}}%
893 \futurelet \next@token \test@space }
894
895 % \end{macrocode}
896 % \end{macro}
897 %
898 % \begin{macro}{\a@edget@text}
899 % Get flags and lemma.
900 % \begin{macrocode}
901 \def\a@edget@text #1\@@{%
902 \a@edappend{\flag@start}\a@@Linsert{#1}}
903
904 % \end{macrocode}
905 % \end{macro}
906 %
907 % \begin{macro}{\a@edend@lemma}
908 % Another utility routine.
909 % \begin{macrocode}
910 \newcommand*{\a@edend@lemma}{%
911 \ifx\end@lemmas\empty \else
912 \gl@p\end@lemmas\to\x@lemma
913 \x@lemma
914 \global\let\x@lemma=\relax
915 \fi}
916
917 % \end{macrocode}
918 % \end{macro}
919 %
920 % \begin{macro}{\a@edput@text}
921 % Unpack \cs{Linsertb@x}.
922 % \begin{macrocode}
923 \newcommand*{\a@edput@text}{%
924 \a@Lunpack \putwordb@x {\ins@skip }}
925
926 % \end{macrocode}
927 % \end{macro}
928 %
929 % \begin{macro}{\a@edappend}
930 % \cs{a@edappend}\marg{arg} adds its argument to the \cs{lineb@x}.
931 % \begin{macrocode}
932 \newcommand*{\a@edappend}[1]{%
933 \setbox \lineb@x \hbox {\unhbox \lineb@x #1}}
934
935 % \end{macrocode}
936 % \end{macro}
937 %
938 % \begin{macro}{\a@@@edtext}
939 % The meat of it all
940 % \begin{macrocode}
941 \newcommand{\a@@@edtext}[2]{
942 \no@expands
943 \def\next@command{\test@special}%
944 %%% \xdef \@tag{#1}\set@line % the original produces roman in notes
945 %%% \def\@@@tag{\RL{#1}} \xdef\@tag{\@@@tag}\set@line % produces errors
946 \xdef \@tag{{\RL{#1}}}\set@line% produces arabic in notes GOOD ONE!!
947 \global\insert@count=0
948 \aftergroup \a@edget@text
949 \ignorespaces #2\relax
950 \endgroup
951 %%% #1\a@edend@lemma \@@ %% gives roman in arabic text
952 \showlemma{#1}\a@edend@lemma \@@% GOOD ONE
953 \a@edput@text \a@edappend {\flag@end }%
954 \arab@codes
955 \a@spacetrue
956 \tr@ce@ff \test@token}
957
958 % \end{macrocode}
959 % \end{macro}
960 %
961 % \begin{macro}{\showlemma}
962 % Modify \cs{showlemma}\marg{lemma} so that its argument is set RtoL in
963 % arabic text, otherwise as normal. The setting of the \meta{lemma} in
964 % the notes is controlled independently.
965 % \begin{macrocode}
966 \renewcommand{\showlemma}[1]{%
967 \ifin@arab\RL{#1}\else #1\fi} % arabic in text, but roman in notes
968
969 % \end{macrocode}
970 % \end{macro}
971 %
972 % \subsection{Line numbering}
973 %
974 % \begin{macro}{\beginnumbering}
975 % \begin{macro}{\endnumbering}
976 % Enable \cs{beginnumbering} and \cs{endnumbering} to be used directly in
977 % arabic text, though I don't know if this is useful.
978 % \begin{macrocode}
979 \all@wcmd{\beginnumbering}
980 \all@wcmd{\endnumbering}
981
982 % \end{macrocode}
983 % \end{macro}
984 % \end{macro}
985 %
986 %
987 % \begin{macro}{\beginnumberingR}
988 % \begin{macro}{\endnumberingR}
989 % Similarly, if \Ledpar{} is used, for numbering in parallel Right texts.
990 % \begin{macrocode}
991 \if@l@dparpack
992 \all@wcmd{\beginnumberingR}
993 \all@wcmd{\endnumberingR}
994 \fi
995
996 % \end{macrocode}
997 % \end{macro}
998 % \end{macro}
999 %
1000 % \begin{macro}{\a@par}
1001 % \begin{macro}{\a@@par}
1002 % \begin{macrocode}
1003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1004
1005 \let\a@par=\a@@par % save for \a@@everypar in \a@c@autopar
1006
1007 % \end{macrocode}
1008 % \end{macro}
1009 % \end{macro}
1010 %
1011 % \begin{macro}{\pstart}
1012 % \begin{macro}{\pend}
1013 % Arabic(?) forms for \cs{pstart} and \cs{pend}.
1014 % \begin{macrocode}
1015 \def\a@c@pstart{\pstart \test@token}
1016 \def\a@c@pend{\a@par \pend \a@par \test@token}
1017
1018 % \end{macrocode}
1019 % \end{macro}
1020 % \end{macro}
1021 %
1022 % \begin{macro}{\a@c@autopar}
1023 % Arabic(?) form of \cs{autopar} (but the original \cs{autopar} has some
1024 % limitations and can cause unexpected problems).
1025 % \begin{macrocode}
1026 \def\a@c@autopar{% use inside Arabic environment
1027 \ifnumbering \else \errmessage
1028 {\string\autopar\space must be used within a numbered section}%
1029 \beginnumbering
1030 \fi
1031 \a@@everypar= {\setbox0 = \box \lineb@x \let \next \test@token
1032 \a@par \pstart % starts a group
1033 \def \a@@par {\a@par \pend \a@par }%
1034 \def \end {\a@par \pend \test@token \end }%
1035 \a@@everypar= {}\arab@indent }%
1036 \a@spacefalse \test@token}
1037
1038 % \end{macrocode}
1039 % \end{macro}
1040 %
1041 %
1042 %
1043 % \begin{macro}{\@arabic}
1044 % \begin{macro}{\arablinenumr@p}
1045 % Provide \cs{@arabic} (for setting numbers to be typeset as arabic
1046 % numerals in the latin script)
1047 % as an arabic macro. \cs{arablinenumr@p}\marg{num} typesets \marg{num}
1048 % as arabic numerals in the arabic script (and RtoL).
1049 % \begin{macrocode}
1050 \all@w@ne{\@arabic}
1051 \newcommand*{\arablinenumr@p}[1]{\RL{\@arabic{#1}}}
1052
1053 % \end{macrocode}
1054 % \end{macro}
1055 % \end{macro}
1056 %
1057 % \begin{macro}{\linenumrep}
1058 % \begin{macro}{\sublinenumrep}
1059 % \begin{macro}{\arablnumrep}
1060 % \begin{macro}{\restorelnumrep}
1061 % Ensure that \cs{linenumrep} and \cs{sublinenumrep} typeset (sub)line numbers
1062 % as normal LtoR arabic in latin script. The declaration \cs{arablnumrep}
1063 % causes line numbers to be typeset RtoL in arabic script and
1064 % \cs{restorelnumrep} puts them back to LtoR in latin script.
1065 % \begin{macrocode}
1066 \def\linenumrep#1{\LR{\@arabic{#1}}}
1067 \let\oldlinenumrep\linenumrep
1068 \def\sublinenumrep#1{\LR{\@arabic{#1}}}
1069 \let\oldsublinenumrep\sublinenumrep
1070 \newcommand*{\arablnumrep}{\global\let\linenumrep\arablinenumr@p
1071 \global\let\sublinenumrep\arablinenumr@p}
1072 \newcommand*{\restorelnumrep}{\global\let\linenumrep\oldlinenumrep
1073 \global\let\sublinenumrep\oldsublinenumrep}
1074 \all@wcmd{\arablnumrep}
1075 \all@wcmd{\restorelnumrep}
1076
1077 % \end{macrocode}
1078 % \end{macro}
1079 % \end{macro}
1080 % \end{macro}
1081 % \end{macro}
1082 %
1083 % \begin{macro}{\linenumrepR}
1084 % \begin{macro}{\sublinenumrepR}
1085 % \begin{macro}{\arablnumrepR}
1086 % \begin{macro}{\restorelnumrepR}
1087 % If \Ledpar{} is used, similarly for Right texts.
1088 % \begin{macrocode}
1089 \if@l@dparpack
1090 \def\linenumrepR#1{\LR{\@arabic{#1}}}
1091 \let\oldlinenumrepR\linenumrepR
1092 \def\sublinenumrepR#1{\LR{\@arabic{#1}}}
1093 \let\oldsublinenumrepR\sublinenumrepR
1094 \newcommand*{\arablnumrepR}{\global\let\linenumrepR\arablinenumr@p
1095 \global\let\sublinenumrepR\arablinenumr@p}
1096 \newcommand*{\restorelnumrepR}{\global\let\linenumrepR\oldlinenumrepR
1097 \global\let\sublinenumrepR\oldsublinenumrepR}
1098 \all@wcmd{\arablnumrepR}
1099 \all@wcmd{\restorelnumrepR}
1100 \fi
1101
1102 % \end{macrocode}
1103 % \end{macro}
1104 % \end{macro}
1105 % \end{macro}
1106 % \end{macro}
1107 %
1108 % \subsection{More critical commands in arabic text}
1109 %
1110 % \begin{macro}{\edlabel}
1111 % \begin{macro}{\edpageref}
1112 % \begin{macro}{\xpageref}
1113 % \begin{macro}{\lineref}
1114 % \begin{macro}{\xlineref}
1115 % \begin{macro}{\sublineref}
1116 % \begin{macro}{\xsublineref}
1117 % Allow more ledmac commands in Arabic text. These take no parameters.
1118 % \begin{macrocode}
1119 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
1120 \all@w@ne{\edlabel}
1121 \all@w@ne{\edpageref}
1122 \all@w@ne{\xpageref}
1123 \all@w@ne{\lineref}
1124 \all@w@ne{\xlineref}
1125 \all@w@ne{\sublineref}
1126 \all@w@ne{\xsublineref}
1127 % \end{macrocode}
1128 % \end{macro}
1129 % \end{macro}
1130 % \end{macro}
1131 % \end{macro}
1132 % \end{macro}
1133 % \end{macro}
1134 % \end{macro}
1135 %
1136 % \begin{macro}{\edindex}
1137 % \begin{macro}{\typeout}
1138 % And more, taking one parameter.
1139 % \begin{macrocode}
1140 \all@w@ne{\edindex}
1141 \all@w@ne{\typeout}
1142 % \end{macrocode}
1143 % \end{macro}
1144 % \end{macro}
1145 %
1146 % \begin{macro}{\edmakelabel}
1147 % \begin{macro}{\xxref}
1148 % And more, taking two parameters.
1149 % \begin{macrocode}
1150 \all@wtw@{\edmakelabel}
1151 \all@wtw@{\xxref}
1152
1153 % \end{macrocode}
1154 % \end{macro}
1155 % \end{macro}
1156 %
1157 % \begin{macro}{\Columns}
1158 % \begin{macro}{\Pages}
1159 % Also enable \cs{Columns} and \cs{Pages} as arabic text commands.
1160 % \begin{macrocode}
1161 \if@l@dparpack
1162 \all@wcmd{\Columns}
1163 \all@wcmd{\Pages}
1164 \fi
1165
1166 % \end{macrocode}
1167 % \end{macro}
1168 % \end{macro}
1169 %
1170 % \section{The End}\label{end}
1171 %
1172 % This is the end of the package code, but first use \file{ledarabpatch.sty}
1173 % if it exists.
1174 %
1175 % \begin{macrocode}
1176 \InputIfFileExists{ledarabpatch.sty}
1177
1178 %</ledarab>
1179 % \end{macrocode}
1180 %
1181 % \appendix
1182 % \section{Examples}
1183 %
1184 % This section presents some sample documents.
1185 %
1186 % The figures are from processed versions of the files. Having latexed
1187 % a file I used \texttt{dvips} to get Encapsulated PostScript, then
1188 % the \texttt{epstopdf} script to get a PDF version as well. For example:
1189 % \begin{verbatim}
1190 % > latex egarab
1191 % > latex egarab
1192 % > latex egarab
1193 % > dvips -E -o egarab.eps egarab % produces egarab.eps
1194 % > epstopdf egarab.eps % produces egarab.pdf
1195 % \end{verbatim}
1196 %
1197 % For those who aren't fascinated by LaTeX code I show the typeset
1198 % results first, then the code that produced them. I know nothing
1199 % about arabic so these are not part of any publishable work and are
1200 % unlikely to have any connection with the arabic language.
1201 %
1202 % \clearpage
1203 %
1204 % \begin{figure}
1205 % \begin{addtomargins}{-2cm}{-2cm}
1206 % \centering
1207 % \includegraphics{egarab}
1208 % \caption{Output from \texttt{egarab.tex}} \label{egarab-out}
1209 % \end{addtomargins}
1210 % \end{figure}
1211 %
1212 % \begin{figure}
1213 % \begin{addtomargins}{-2cm}{-2cm}
1214 % \centering
1215 % \includegraphics{egarabpar}
1216 % \caption{Output from \texttt{egarabpar.tex}} \label{egarabpar-out}
1217 % \end{addtomargins}
1218 % \end{figure}
1219 %
1220 % \clearpage
1221 %
1222 % \subsection{General example}
1223 %
1224 % The result of the following code is shown in Figure~\ref{egarab-out}.
1225 % The arabic script is nonsensical to anyone who can read Arabic
1226 % as it is just the English text represented using the arabic script.
1227 %
1228 % The example illustrates a variety of critical notes, including one
1229 % that is all messed up just to show that some things do not work.
1230 %
1231 % \medskip
1232 % \hrule
1233 % \medskip
1234 %
1235 % \begin{macrocode}
1236 %<*egarab>
1237 %%% egarab.tex
1238 \documentclass[12pt]{article}
1239 \addtolength{\textheight}{-10\baselineskip}
1240 \usepackage{ledmac}
1241 \setcounter{firstlinenum}{1} \setcounter{linenumincrement}{1}
1242 \linenummargin{right}
1243
1244 \usepackage{arabtex}
1245 \usepackage{ledarab}
1246
1247 \begin{document}
1248
1249 Can we have non-arabic text in \verb?\edtext?
1250
1251 \beginnumbering
1252 \pstart
1253 \noindent
1254 In \edtext{roman}{\Afootnote{not arabic}} text you
1255 can have critical notes. \\
1256 In \edtext{\RL{Arabic text}}{\Afootnote{not roman}} you
1257 can have critical notes. \\
1258 In \edtext{latin}{\Afootnote{\RL{Arabic text --- footnote}}} you
1259 can have critical notes. \\
1260 In \edtext{\RL{Arabic text}}{\Afootnote{\RL{Arabic text --- footnote}}} you
1261 can have critical notes.
1262 \pend
1263 \endnumbering
1264
1265 Here the order is \verb?\beginnumbering \pstart \begin{arabtext} ...?
1266
1267 \beginnumbering
1268 \pstart
1269 \begin{arabtext}
1270 ledmac is wonderful and so
1271 %%% arabic lemma, latin note
1272 \edtext{Arabic text}{\Bfootnote{Arabic text --- footnote}} is arabtex\\
1273 %%% arabic lemma, arabic note
1274 and \edtext{Arabic text}{\Bfootnote{\RL{Arabic text --- footnote}}} you
1275 can do critical notes here.
1276 \end{arabtext}
1277 \pend
1278 \endnumbering
1279
1280 Here the order is \verb?\beginnumbering \begin{arabtext} \pstart...?
1281
1282 \arablnumrep
1283 \beginnumbering
1284 \begin{arabtext}
1285 \pstart
1286 ledmac is wonderful and so
1287 %%% arabic lemma, screwed up arabic note
1288 \edtext{Arabic text}{\Cfootnote{Arabic text --- footnote}} is arabtex\\
1289 %%% arabic lemma, arabic note
1290 and \edtext{Arabic text}{\Cfootnote{\RL{Arabic text --- footnote}}} you
1291 can do critical notes here.
1292 \pend
1293 \end{arabtext}
1294 \endnumbering
1295 \restorelnumrep
1296
1297 \end{document}
1298 %</egarab>
1299 % \end{macrocode}
1300 %
1301 % \subsection{Parallel example}
1302 %
1303 % The result of the following code for parallel typesetting is shown
1304 % in Figure~\ref{egarabpar-out}.
1305 % The left and right inputs are the same. In this case the arabic script
1306 % should make sense to an Arabic reader while the English text is the
1307 % input that would produceds the arabic if it were inside the \texttt{arabtex}
1308 % environment. The text for the example is from \file{omar.tex} in the
1309 % \ArabTeX{} distribution; I do not know what it means.
1310 %
1311 % The two examples are virtually the same except that in the second the
1312 % numbering is in arabic script instead of latin script. Note that
1313 % the usual variety of footnotes can be used for arabic texts as well
1314 % as western texts.
1315 %
1316 % \medskip
1317 % \hrule
1318 % \medskip
1319 %
1320 % \begin{macrocode}
1321 %<*egarabpar>
1322 %%% egarabpar.tex ledmac & parallel arabic text
1323 \documentclass[12pt]{article}
1324 \addtolength{\textheight}{-4\baselineskip}
1325 \usepackage{ledmac}
1326 \usepackage{ledpar}
1327 \setcounter{firstlinenum}{1} \setcounter{linenumincrement}{1}
1328 \usepackage{arabtex}
1329 \usepackage{ledarab}
1330 %%
1331 % simple right text arabic script numbering version of \printlines
1332 \makeatletter
1333 \def\printlinesAR#1|#2|#3|#4|#5|#6|#7|{\begingroup
1334 \setprintlines{#1}{#2}{#3}{#4}{#5}{#6}%
1335 \ifl@d@pnum #1\fullstop\fi
1336 \ifledplinenum \RL{#2}\Rlineflag\else \symplinenum\fi
1337 \endgroup}
1338 \makeatother
1339
1340 %%% We will use the Bfootnote series for the arabic right texts,
1341 %%% in paragraph style
1342 \footparagraph{B}
1343
1344 %%% right text numbering
1345 \let\oldBfootfmt\Bfootfmt
1346 \renewcommand{\Bfootfmt}[3]{%
1347 \let\printlines\printlinesR
1348 \oldBfootfmt{#1}{#2}{#3}}
1349
1350 \begin{document}
1351
1352 Here is an example pair of texts. The arabic version is on the right.
1353
1354 \vspace{\baselineskip}
1355
1356 \begin{pairs}
1357
1358 \begin{Leftside}
1359 \beginnumbering
1360 \pstart
1361 \noindent
1362 gUyand kasAn behe \edtext{st}{\Afootnote{Western side}} bA .hUr hOs ast \\
1363 man mIgUyam keh 'Ab-i angUr hOs ast \\
1364 In naqd begIr wa-dast az 'An nesiyeh bedAr \\
1365 k-'AwAz-i dohol sanIdan az dUr hOs ast.
1366 \pend
1367 \end{Leftside}
1368
1369 \renewcommand{\Rlineflag}{r} % writes r in latin
1370 \begin{Rightside}
1371 \firstlinenum{2} \linenumincrement{2}
1372 \begin{arabtext}
1373 \beginnumbering
1374 \pstart
1375 \noindent
1376 gUyand kasAn behe \edtext{st}{\Bfootnote{Eastern side}} bA .hUr hOs ast \\
1377 man mIgUyam keh 'Ab-i angUr hOs ast \\
1378 In naqd begIr wa-dast az 'An nesiyeh bedAr \\
1379 k-'AwAz-i dohol sanIdan az dUr hOs ast.
1380 \pend
1381 \end{arabtext}
1382 \end{Rightside}
1383
1384 \Columns
1385
1386 \end{pairs}
1387
1388 \vspace{\baselineskip}
1389
1390 The same texts but more oriented towards arabic.
1391
1392 \vspace{\baselineskip}
1393
1394 \begin{pairs}
1395
1396 \begin{Leftside}
1397 \pstart
1398 \noindent
1399 gUyand kasAn behe st bA .hUr hOs ast \\
1400 man mIgUyam \edtext{keh}{\Afootnote{\RL{Western side}}} 'Ab-i angUr hOs ast \\
1401 In naqd begIr wa-dast az 'An nesiyeh bedAr \\
1402 k-'AwAz-i dohol sanIdan az dUr hOs ast.
1403 \pend
1404 \endnumbering
1405 \end{Leftside}
1406
1407 %%% right full arabic note numbering
1408 \renewcommand{\Bfootfmt}[3]{%
1409 \let\printlines\printlinesAR
1410 \oldBfootfmt{#1}{#2}{#3}}
1411 \renewcommand{\Rlineflag}{\RL{r}} % writes r in arabic
1412
1413 \begin{Rightside}
1414 \firstlinenum{1} \linenumincrement{1}
1415 \arablnumrepR % changes the number to arabic
1416 \begin{arabtext}
1417 \pstart
1418 \noindent
1419 gUyand kasAn behe st bA .hUr hOs ast \\
1420 man mIgUyam \edtext{keh}{\Bfootnote{\RL{Eastern side}}} 'Ab-i angUr hOs ast \\
1421 In naqd begIr wa-dast az 'An nesiyeh bedAr \\
1422 k-'AwAz-i dohol sanIdan az dUr hOs ast.
1423 \pend
1424 \endnumbering
1425 \end{arabtext}
1426 \end{Rightside}
1427
1428 \begin{arabtext}
1429 \Columns
1430 \end{arabtext}
1431
1432 \end{pairs}
1433
1434 \end{document}
1435 %</egarabpar>
1436 % \end{macrocode}
1437 %
1438 %
1439 %
1440 % \bibliographystyle{alpha}
1441 % \begin{thebibliography}{WWW99}
1442 % \raggedright
1443 %
1444 % \bibitem[Lag99]{ARABTEX}
1445 % Klaus Lagally.
1446 % \newblock \emph{ArabTeX: A system for typesetting arabic: Draft User Manual},
1447 % \newblock July 1999.
1448 % \newblock (Available from CTAN in
1449 % \texttt{macros/latex/contrib/arabtex})
1450 %
1451 %
1452 % \bibitem[LW90]{EDMACTUG}
1453 % John Lavagnino and Dominik Wujastyk.
1454 % \newblock `An overview of \edmac: a \textsc{Plain} TeX format for
1455 % critical editions'.
1456 % \newblock \emph{TUGboat}, \textbf{11}, 4, pp. 623--643, November 1990.
1457 % \newblock (Code available from CTAN in
1458 % \texttt{macros/plain/contrib/edmac})
1459 %
1460 %
1461 % \bibitem[Wil04a]{LEDMAC}
1462 % Peter Wilson.
1463 % \newblock \emph{\Lpack{ledmac}: A presumptuous attempt to port \Lpack{EDMAC},
1464 % \Lpack{TABMAC} and \Lpack{EDSTANZA} to LaTeX}.
1465 % \newblock May 2004.
1466 % \newblock (Available from CTAN in
1467 % \texttt{macros/latex/contrib/ledmac})
1468 %
1469 % \bibitem[Wil04b]{LEDPAR}
1470 % Peter Wilson.
1471 % \newblock \emph{Parallel typesetting for critical editions:
1472 % the \Lpack{ledpar} package}.
1473 % \newblock December 2004.
1474 % \newblock (Available from CTAN in
1475 % \texttt{macros/latex/contrib/ledmac})
1476 %
1477 % \end{thebibliography}
1478 %
1479 % \Finale
1480 % \section*{}
1481 % \addcontentsline{toc}{section}{Index}
1482 % \PrintIndex
1483 %
1484 % \section*{}
1485 % \addcontentsline{toc}{section}{Change History}
1486 % \PrintChanges
1487 % \endinput
1488 \endinput
1489
1490 %% \CharacterTable
1491 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
1492 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
1493 %% Digits \0\1\2\3\4\5\6\7\8\9
1494 %% Exclamation \! Double quote \" Hash (number) \#
1495 %% Dollar \$ Percent \% Ampersand \&
1496 %% Acute accent \' Left paren \( Right paren \)
1497 %% Asterisk \* Plus \+ Comma \,
1498 %% Minus \- Point \. Solidus \/
1499 %% Colon \: Semicolon \; Less than \<
1500 %% Equals \= Greater than \> Question mark \?
1501 %% Commercial at \@ Left bracket \[ Backslash \\
1502 %% Right bracket \] Circumflex \^ Underscore \_
1503 %% Grave accent \` Left brace \{ Vertical bar \|
1504 %% Right brace \} Tilde \~}
1505 %%