diff options
author | Karl Berry <karl@freefriends.org> | 2007-05-12 22:28:50 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2007-05-12 22:28:50 +0000 |
commit | 93ea72b1e370ead6127c322de9056d1a9da9286a (patch) | |
tree | 36568678c8626a28d78ffa2f3be14d975841fcfc /Master/texmf-dist | |
parent | d64b1266aa8e76eed5e75a45d71c2a56ad3af048 (diff) |
bidi update (10may07)
git-svn-id: svn://tug.org/texlive/trunk@4276 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist')
-rw-r--r-- | Master/texmf-dist/doc/xelatex/bidi/README.txt | 3 | ||||
-rw-r--r-- | Master/texmf-dist/doc/xelatex/bidi/bidi.pdf | bin | 120923 -> 153780 bytes | |||
-rw-r--r-- | Master/texmf-dist/source/xelatex/bidi/bidi.dtx | 759 | ||||
-rw-r--r-- | Master/texmf-dist/tex/xelatex/bidi/bidi.sty | 48 | ||||
-rw-r--r-- | Master/texmf-dist/tpm/bidi.tpm | 9 |
5 files changed, 803 insertions, 16 deletions
diff --git a/Master/texmf-dist/doc/xelatex/bidi/README.txt b/Master/texmf-dist/doc/xelatex/bidi/README.txt index 00690391897..a02c01de222 100644 --- a/Master/texmf-dist/doc/xelatex/bidi/README.txt +++ b/Master/texmf-dist/doc/xelatex/bidi/README.txt @@ -1,5 +1,5 @@ ------------------------ -THE BIDI PACKAGE v0.2 +THE BIDI PACKAGE v0.2.2 This package provides a convenient interface for typesetting bidirectional texts with XeLaTeX. @@ -10,3 +10,4 @@ be installed on your system. -------------- François Charette 2007 +%% \section{Implementation} diff --git a/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf b/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf Binary files differindex 7b03e99148b..3723ddf5965 100644 --- a/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf +++ b/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf diff --git a/Master/texmf-dist/source/xelatex/bidi/bidi.dtx b/Master/texmf-dist/source/xelatex/bidi/bidi.dtx new file mode 100644 index 00000000000..8d7c3f0ad11 --- /dev/null +++ b/Master/texmf-dist/source/xelatex/bidi/bidi.dtx @@ -0,0 +1,759 @@ +% \iffalse +% +%!TEX encoding = UTF-8 Unicode +% +% Copyright (C) 2007 by François Charette <firmicus at gmx dot net> +% +% Distributable under the LaTeX Project Public License, +% version 1.3c or higher (your choice). The latest version of +% this license is at: http://www.latex-project.org/lppl.txt +% +% This work is "maintained" (as per LPPL maintenance status) +% by François Charette. +% +% This work consists of the file bidi.dtx +% and the derived files bidi.sty and bidi.pdf. +% +% +%<*batchfile> +\begingroup +\input docstrip.tex +\keepsilent +\preamble + + ____________________________ + The bidi package + (C) 2007 François Charette + License information appended + + +\endpreamble +\postamble + +Copyright (C) 2007 by François Charette <firmicus at gmx dot net> + +Distributable under the LaTeX Project Public License, +version 1.3c or higher (your choice). The latest version of +this license is at: http://www.latex-project.org/lppl.txt + +This work is "maintained" (as per LPPL maintenance status) +by François Charette. + +This work consists of the file \jobname.dtx + and the derived files \jobname.sty and \jobname.pdf. + +\endpostamble +\askforoverwritefalse +\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}} +\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}} +\nopreamble\nopostamble +\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}} +\generate{\file{dtx-style.sty}{\from{\jobname.dtx}{dtx-style}}} +\endgroup +%</batchfile> +% +%<*driver> +\documentclass[12pt]{ltxdoc} +\usepackage{dtx-style} +\EnableCrossrefs +\CodelineIndex +\RecordChanges +%\OnlyDescription +\begin{document} + \DocInput{\jobname.dtx} +\end{document} +%</driver> +% +%<*readme> +------------------------ +THE BIDI PACKAGE v0.2.2 + +This package provides a convenient interface for typesetting +bidirectional texts with XeLaTeX. + +NB: To regenerate the pdf documentation from the dtx file you must +use xelatex. The fonts Junicode, Scheherazade and Ezra SIL must also +be installed on your system. +-------------- +François Charette +2007 +%</readme> +% +% \fi +% +% \errorcontextlines=999 +% \makeatletter +% +% \GetFileInfo{\jobname.sty} +% +% \title{The \pkg{bidi} package} +% \author{François Charette} +% \date{\filedate \qquad \fileversion} +% +% \maketitle +% \tableofcontents +% +% \section{Basic direction switching commands} +% +% The \pkg{bidi} package provides a useful interface for typesetting bidirectional +% texts with \XeLaTeX.\footnote{ % +% Actually, \pkg{bidi} can also be used with any \eTeX-based +% engine, notably pdf\LaTeX, but at this time I do not see how it +% could be useful outside of the \XeTeX\ world.} +% ^^A\eTeX-based typesetting engines and the \LaTeX\ format, +% Most of its macros are directly copied or adapted from +% the Babel bidirectional module for Hebrew.\footnote{ See +% ^^A\url{ftp://dante.ctan.org/tex-archive/macros/latex/required/babel/hebrew.dtx} +% section 60.4 of the \href{ftp://dante.ctan.org/tex-archive/macros/latex/required/babel/babel.pdf}{Babel user documentation.}} +% +% For short right-to-left ^^A(|\RL{R 2 L}| $\rightarrow$ \RL{R\,2\,L}) +% insertions in left-to-right environments, \DescribeMacro{\RL}\cmd\RL|{…}| does the job, +% as does \DescribeMacro{\LR}\cmd\LR|{…}| in the opposite case. +% To typeset a full paragraph right-to-left, use the switch +% \DescribeMacro{\setRL}\cmd\setRL, and to revert to left-to-right, use +% \DescribeMacro{\setLR}\cmd\setLR\ (or equivalently \cmd\unsetRL). +% +% \begin{Verbatim}[gobble=2] +% \setRL +% This is a right-to-left paragraph. +% \setLR +% \end{Verbatim} +% +% \setRL\setfootnoteLR^^A\fontspec[ExternalLocation]{cmr12} +% This is a right-to-left paragraph.\footnote{ % +% Note that when processing fonts that are not TFM-based, +% \XeTeX, contrary to \TeX, uses (roughly speaking) one box per word, +% instead of one per character. The command \cmd\RL\ is thus usually +% superfluous when inserting a single Arabic or Hebrew word.} +% \setLR +% +% +% \subsection{Direction of plain footnotes} +% \setfootnoteRL +% With \DescribeMacro{\setfootnoteRL}\cmd\setfootnoteRL, one can insert RL +% footnotes in LR mode,\footnote{ % +% ^^A\textarab[novoc]{mulA.hi.zaT min al-yamIn 'ilY al-ya.sAr} +% \arabicfont ملاحظات من اليمين إلى اليصار} +% and conversely with +% \DescribeMacro{\setfootnoteLR}\cmd\setfootnoteLR\ +% (or equivalently \cmd\unsetfootnoteRL). +% \unsetfootnoteRL +% +% \textbf{Important note:} Currently, \XeTeX's (version 0.996) placement of the +% footnote mark at the beginning of plain footnotes in RL context is incorrect +% (as you can see yourself below).\footnote{ % +% More precisely, this is a bug in \XeTeX's handling of glue in +% right-to-left context.} +% This will likely be fixed in the next version. +% +% With the package \pkg{manyfoot}, it is possible to have several layers +% of footnotes, each of which can be set in a different direction. +% See the documentation to Arab\XeTeX\ for more details. This should also be +% possible with \pkg{bigfoot}, but I have not tested it yet. +% +% Some other \LaTeX\ macros are redefined internally to ensure their correct +% behaviour in bidirectional display. Contrary to the Babel approach, we leave +% the commands defined in standard \LaTeX\ classes untouched, as we think this +% should be done by class authors themselves (who are of course encouraged to +% make them \pkg{bidi}-compatible :-). +% +% +% \section{Colored text} \label{bidicolor} +% +% Because of the way bidirectionality is implemented in \eTeX, no information on +% directionality is included in the dvi (or xdv) output. Consequently, if a color +% \cmd\special\ is inserted in the middle of a paragraph, the color change will +% be effected as though the text would run from left to right. For \cmd\textcolor, +% the output will be correct only if the textual argument falls on a single line. +% A better approach is to set the color of text by means of \XeTeX's font features, +% as in this example: +% \begin{Verbatim}[gobble=2] +% \newcommand{\textblue}[1]{{\addfontfeature{Color=0000FF}#1}} +% \setRL\fontspec[Script=Arabic]{Scheherazade} +% اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود +% اسود \textblue{ازرق ازرق ازرق ازرق ازرق ازرق ازرق } اسود اسود +% اسود اسود اسود اسود +% \end{Verbatim} +% \newcommand{\textblue}[1]{{\addfontfeature{Color=0000FF}#1}} +% \setRL\fontspec[Script=Arabic]{Scheherazade} +% اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود +% \textblue{ازرق ازرق ازرق ازرق ازرق ازرق ازرق} اسود اسود +% اسود اسود اسود اسود\setLR +% +% \section{Alphabetic numerals in Arabic, Hebrew and Syriac} +% +% For convenience the following macros are provided for generating numbers +% in alphanumerical notation in Arabic (in both Eastern and Western styles) +% and Hebrew. The interested reader can find information on these systems +% in the following two Wikipedia articles: +% \url{http://en.wikipedia.org/wiki/Abjad_numerals} and +% \url{http://en.wikipedia.org/wiki/Hebrew_numerals}. +% Note that the Hebrew implementation in \pkg{bidi} is less sophisticated than +% the one in Babel, where various special cases are taken into account. +% +% \subsection{Examples} +% \parindentoff +% The Arabic \textit{abjad} numbers can be generated with the command \cmd\abjad. +% \DescribeMacro{\abjad} +% Example: |\abjad{1863}| yields {\arabicfont\abjad{1863}}. +% +% In the Maghrib the conventions are somewhat different, and the maghribi forms +% of the \textit{abjad} numerals are obtained with the \cmd\abjadmaghribi\ command. +% \DescribeMacro{\abjadmaghribi} +% Example: |\abjadmaghribi{1863}| yields {\arabicfont\abjadmaghribi{1863}}. +% +% Hebrew numerals are generated with the command \cmd\hebrewnumeral. +% \DescribeMacro{\hebrewnumeral} Example: +% |\hebrewnumeral{1863}| yields {\hebrewfont\hebrewnumeral{1863}}. +% +% Experimental support is also provided for Syriac abjad numerals, which can be generated +% with \cmd\abjadsyriac. \DescribeMacro{\abjadsyriac} +% Example: |\abjadsyriac{463}| yields {\syriacfont\abjadsyriac{463}}. +% +% Note that the above macros only outputs the Unicode characters: +% the active font must thus contain the necessary glyphs. +% +% \section{Scripts written from right-to-left} +% +% The Arabic and Hebrew scripts are of course not the only ones to be written from right-to-left. +% The following is a list of historical\footnote{ % +% The historical right-to-left scripts that are part of Unicode 5.0 are: +% Cypriot, Old Italic (i.e., Etruscan), Kharosthi and Phoenician.} +% and contemporary scripts that are written +% primarily or exclusively from right-to-left.\footnote{ % +% See \url{http://www.omniglot.com/writing/direction.htm\#rtl}, +% \url{http://www.unicode.org/iso15924/}, and +% \url{http://www.ancientscripts.com/ws.html}.} +% Those still in use today are marked with an asterisk. +% +% \begin{center} +% \small +% \begin{tabular}{ll}\hline +% Aramaic and Sogdian ~~~~~~~~~~~~~~~ & Nabatean \\ +% Arabic$^*$ & N'Ko$^*$ \\ +% Avestan & Old Hungarian \\ +% Berber (ancient) & Orkhon (Turkic runes) \\ +% Cypriot Syllabary & Pahlavi and Parthian \\ +% Etruscan and Oscan & Phoenician \\ +% Hebrew$^*$ & Proto-Sinaitic \\ +% Iberian (Northern) & Samaritan \\ +% Kharosthi & South Arabian and Thamudic \\ +% Lydian & Syriac$^*$ \\ +% Mandaean & Thâna$^*$ \\ +% Meroitic (cursive) & \\ +% \hline +% \end{tabular} +% \end{center} +% +% Some examples (random glyphs for Kharosthi and Cypriot): +% \begin{compactitem}[\textbf{·}] +% \item Old Italic (Etruscan):\footnote{ % +% The Unicode standard 5.0 specifies left-to-right directionality for the +% Old Italic script, contrary to historical evidence but in accordance to +% conventional scholarly usage. To display from right to left the Unicode +% \textsc{right-to-left override} character \textsf{U+202E} +% ^^A \textsc{\addfontfeature{Numbers=Lowercase}u+202e} +% must be inserted before each +% word. This could be easily automated by means of a TECkit font mapping. +% Etruscanists interested in this can contact me directly.} +% \hfill \RL{\damase\addfontfeature{Mapping=etruscan}auleśi meteliś} ^^A𐌀𐌖𐌋𐌄𐌑𐌉 𐌌𐌄𐌕𐌄𐌋𐌉𐌑 ^^A(Aules'i Metelis) +% \item N'ko:\footnote{ % +% As can be seen in this example, the ICU rendering engine does not yet +% support contextual substitutions for N'Ko.} +% \hfill \RL{\fontspec[Script=N'ko]{Code2000} ߌ ߣߌ ߛߐߡߊ߫} ^^A i ni somâ = good morning < http://www.fakoli.net/nko/tutorial/samples.html +% \item Thâna: \hfill {\fontspec[Script=Thaana]{MPH 2B Damase} ކައްޓަލަ} ^^A kattala = sweet potato < http://www.maldivesculture.com/thaana03.html +% \item Phoenician: \hfill {\fontspec[Script=Phoenician]{MPH 2B Damase} 𐤊𐤁𐤂𐤃} ^^A abgd +% \item Kharosthi: \hfill {\fontspec[Script=Kharosthi]{MPH 2B Damase} 𐨗𐨁𐨙𐨪} ^^A random gibberish +% \item Cypriot: \hfill {\fontspec[Script=Cypriot Syllabary]{MPH 2B Damase} 𐠌𐠥𐠯} ^^A random gibberish +% \end{compactitem} +% +%% \section{Implementation} +%\iffalse +%<*package> +%\fi +% \begin{macrocode} +\NeedsTeXFormat{LaTeX2e} +\ProvidesPackage{bidi} + [2007/04/30 v0.2.2 Bidirectional typesetting in XeLaTeX] +% this is not used for now: +%\newif\if@rlmain +%\@rlmainfalse +%\DeclareOption{rldocument}{\@rlmaintrue} +%\ExecuteOptions{rldocument} +%\ProcessOptions +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\ifx\TeXXeTstate\undefined\else% + \TeXXeTstate=1 +\fi +\ifx\beginL\@undefined% + \newlinechar`\^^J + \typeout{^^JTo avoid this error message,^^J% + run TeX--XeT or e-TeX engine instead of regular TeX.^^J} + \errmessage{Right-to-Left Support Error: use TeX--XeT or e-TeX + engine}% +\fi +\newif\if@rl +%\AtBeginDocument{% Here we set the main document direction +% \if@rl\@rlmaintrue% +% \else\@rlmainfalse% +% \fi% +%} +% \end{macrocode} +% \subsection{Basic bidi macros} +% This defines the macros for RL insertion in LR context and conversely. +% Most of it is taken from the file \texttt{rlbabel.def} in the Babel distribution, +% with minor changes. +% +% \begin{macrocode} +\let\n@xt=\ +\def\LR{\protect\pLR}% +\def\pLR{\protect\afterassignment\moreLR \let\n@xt= } +\def\moreLR{\bracetext \aftergroup\endL \beginL\@rlfalse} +\def\RL{\protect\pRL} +\def\pRL{\protect\afterassignment\moreRL \let\n@xt= } +\def\moreRL{\bracetext \aftergroup\endR \beginR\@rltrue} +\def\bracetext{\ifcat\n@xt{\else\ifcat\n@xt}\fi + \errmessage{Missing left brace has been substituted}\fi \bgroup} +\everydisplay{\if@rl\aftergroup\beginR\fi } +% \end{macrocode} +% +% For global right-to-left typesetting, the directional primitive must be +% included within an \cmd\everypar\ construct. The traditional approach was to +% redefine \cmd\everypar\ as a one-argument macro, but since some packages (such +% as \pkg{ledmac}) also play tricks with \cmd\everypar, this can become +% problematic. Hence we have adopted Youssef Jabri's clever approach in his +% \pkg{Arabi} package. +% \begin{macrocode} +\def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi} +\let\o@everypar=\everypar +% The following, surely, will not play well with all packages, e.g. ledmac +%\def\everypar#1{\o@everypar{\rl@everypar#1}} +% But we now use this instead, taken from Arabicore.sty in the Arabi package. +% Thanks to Youssef Jabri! Shukran jazilan! +\newtoks\n@everypar +\n@everypar\expandafter{\the\o@everypar} +\o@everypar{\rl@everypar\the\n@everypar} +\let\everypar=\n@everypar +% \end{macrocode} +% +% This is not used at the moment: +% \begin{macrocode} +\def\@ensure@RL#1{\if@rl#1\else\RL{#1}\fi} +\def\@ensure@LR#1{\if@rl\LR{#1}\else#1\fi} +% \end{macrocode} +% +% \subsection{Logos} +% The following redefinitions ensure proper typesetting of the various logos. +% \begin{macrocode} +%preserve logos +\let\@@TeX\TeX +\def\TeX{\LR{\@@TeX}} +\let\@@LaTeX\LaTeX +\def\LaTeX{\LR{\@@LaTeX}} +\let\@@LaTeXe\LaTeXe +\def\LaTeXe{\LR{\@@LaTeXe}} +\@ifpackageloaded{xltxtra}{ +\let\@@XeTeX\XeTeX +\def\XeTeX{\LR{\@@XeTeX}} +}{} +% \end{macrocode} +% \subsection{Redefinition of internal \LaTeX\ macros} +% \begin{macrocode} +%VARIOUS LATEX MACROS +\def\list#1#2{% + \ifnum \@listdepth >5\relax + \@toodeep + \else + \global\advance\@listdepth\@ne + \fi + \rightmargin\z@ + \listparindent\z@ + \itemindent\z@ + \csname @list\romannumeral\the\@listdepth\endcsname + \def\@itemlabel{#1}% + \let\makelabel\@mklab + \@nmbrlistfalse + #2\relax + \@trivlist + \parskip\parsep + \parindent\listparindent + \advance\linewidth -\rightmargin + \advance\linewidth -\leftmargin + \if@rl + \advance\@totalleftmargin \rightmargin + \else + \advance\@totalleftmargin \leftmargin + \fi + \parshape \@ne \@totalleftmargin \linewidth + \ignorespaces} +%% +\def\@dottedtocline#1#2#3#4#5{% + \ifnum #1>\c@tocdepth \else + \vskip \z@ \@plus.2\p@ + {\if@rl\rightskip\else\leftskip\fi #2\relax + \if@rl\leftskip\else\rightskip\fi \@tocrmarg \parfillskip + -\if@rl\leftskip\else\rightskip\fi + \parindent #2\relax\@afterindenttrue + \interlinepenalty\@M + \leavevmode + \@tempdima #3\relax + \advance\if@rl\rightskip\else\leftskip\fi \@tempdima + \null\nobreak\hskip -\if@rl\rightskip\else\leftskip\fi + {#4}\nobreak + \leaders\hbox{$\m@th + \mkern \@dotsep mu\hbox{.}\mkern \@dotsep + mu$}\hfill + \nobreak + \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor \beginL#5\endL}% + \par}% + \fi} +%% +\def\raggedright{% + \let\\\@centercr + \leftskip\z@skip\rightskip\@flushglue + \parindent\z@\parfillskip\z@skip} +\let\@@raggedleft=\raggedleft +\let\@@raggedright=\raggedright +\renewcommand\raggedleft{\if@rl\@@raggedright% + \else\@@raggedleft\fi} +\renewcommand\raggedright{\if@rl\@@raggedleft% + \else\@@raggedright\fi} +\let\@@@underline=\underline +\def\underline#1{\@@@underline{\if@rl\RL{#1}\else #1\fi}} +\if@compatibility + \let\undertext=\underline +\fi +% \end{macrocode} +% \subsection{Footnotes} +% This implements the bidirectionality of plain \LaTeX\ footnotes. +% \begin{macrocode} +\newif\if@rl@footnote +\if@rl\@rl@footnotetrue\else\@rl@footnotefalse\fi +\let\@@footnoterule=\footnoterule +\def\LRfootnoterule{\@@footnoterule} +%bug?-->this causes new par to be set, hence hack with vskip :-{ +\def\RLfootnoterule{\vskip -\baselineskip\hb@xt@\hsize{\hss\vbox{\@@footnoterule}}} +% +\def\setfootnoteRL{\@rl@footnotetrue} +\def\unsetfootnoteRL{\@rl@footnotefalse} +\def\setfootnoteLR{\unsetfootnoteRL} +% +\def\footnoterule{\if@rl@footnote\RLfootnoterule\else\LRfootnoterule\fi} +% \end{macrocode} +% \subsection{Bidi switching commands} +% Commands for switching between LR and RL global contexts. +% \begin{macrocode} +\def\setRL{\@rltrue\@rl@footnotetrue} +\def\unsetRL{\@rlfalse\@rl@footnotefalse} +\def\setLR{\unsetRL} +% \end{macrocode} +% \subsection{Footnotes (cont.)} +% This redefines \LaTeX's internal footnote macros. +% \begin{macrocode} +\long\def\@footnotetext#1{\insert\footins{% + \if@rl@footnote\@rltrue\else\@rlfalse\fi + \reset@font\footnotesize + \interlinepenalty\interfootnotelinepenalty + \splittopskip\footnotesep + \splitmaxdepth \dp\strutbox \floatingpenalty \@MM + \hsize\columnwidth \@parboxrestore + \protected@edef\@currentlabel{% + \csname p@footnote\endcsname\@thefnmark + }% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup}}% +%... also in minipages +\long\def\@mpfootnotetext#1{% + \global\setbox\@mpfootins\vbox{% + \if@rl@footnote\@rltrue\else\@rlfalse\fi + \unvbox\@mpfootins + \reset@font\footnotesize + \hsize\columnwidth + \@parboxrestore + \protected@edef\@currentlabel + {\csname p@mpfootnote\endcsname\@thefnmark}% + \color@begingroup + \@makefntext{% + \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}% + \color@endgroup + }} +% \end{macrocode} +% \subsection{\cmd{\textcolor}} +% \cmd\textcolor\ needs to be redefined so that the color-switching +% commands in the output will affect the correct portion of text also +% in RL context, but this only works if the textual argument does not overlap +% more than one line, which is why we issue a warning. See §~\ref{bidicolor} +% above for an alternative approach to colored text using \XeTeX\ font features. +% The following code (less the warning) is again taken from \texttt{rlbabel.def}. +% \begin{macrocode} +\ifx\@textcolor\@undefined\else% +\AtBeginDocument{% + \def\@textcolor#1#2#3{% + \if@rl\PackageWarning{bidi}{% + \textcolor will not work in RL mode if the textual argument spans more than one line.^^J% + With XeTeX you should set color as a font feature instead.}% + \beginL\protect\leavevmode{\color#1{#2}\beginR#3\endR}\endL% + \else% + \protect\leavevmode{\color#1{#2}#3}% + \fi% + }% +}% +\fi +%%% +% \end{macrocode} +% \subsection{Alphanumerical numbers} +% The code that follows is a straightforward adaptation of the corresponding +% code in the \pkg{Arabi} package. The code for Hebrew numerals is a simplified version +% of the implementation in Babel. +% \begin{macrocode} +\def\abjad#1{% +\ifnum#1>1999 \PackageWarning{bidi}{Illegal value (#1) for abjad numeral} {#1} +\else + \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for abjad numeral}% + \else + \ifnum#1<10\expandafter\abj@num@i\number#1% + \else + \ifnum#1<100\expandafter\abj@num@ii\number#1% + \else + \ifnum#1<\@m\expandafter\abj@num@iii\number#1% + \else + \ifnum#1<\@M\expandafter\abj@num@iv\number#1%since #1<2000, we must have 1000 + \fi + \fi + \fi + \fi + \fi +\fi +} + +\def\abjadmaghribi#1{% +\ifnum#1>1999 \PackageWarning{bidi}{Illegal value (#1) for abjad numeral} {#1} +\else + \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for abjad numeral}% + \else + \ifnum#1<10\expandafter\abj@num@i\number#1% + \else + \ifnum#1<100\expandafter\abj@maghribi@num@ii\number#1% + \else + \ifnum#1<\@m\expandafter\abj@maghribi@num@iii\number#1% + \else + \ifnum#1<\@M\expandafter\abj@maghribi@num@iv\number#1% + \fi + \fi + \fi + \fi + \fi +\fi +} + +\def\hebrewnumeral#1{% +\ifnum#1>9999 \PackageWarning{bidi}{Illegal value (#1) for Hebrew numeral} {#1} +\else + \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for Hebrew numeral}% + \else + \ifnum#1<10\expandafter\heb@num@i\number#1% + \else + \ifnum#1<100\expandafter\heb@num@ii\number#1% + \else + \ifnum#1<\@m\expandafter\heb@num@iii\number#1% + \else + \ifnum#1<\@M\expandafter\heb@num@iv\number#1% + \fi + \fi + \fi + \fi + \fi +\fi +} + +\def\abjadsyriac#1{% +\ifnum#1>499 \PackageWarning{bidi}{Illegal value (#1) for Syriac abjad numeral} {#1} +\else + \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for Syriac abjad numeral}% + \else + \ifnum#1<10\expandafter\abj@syr@num@i\number#1% + \else + \ifnum#1<100\expandafter\abj@syr@num@ii\number#1% + \else + \expandafter\abj@syr@num@iii\number#1% + \fi + \fi + \fi +\fi +} +% +% \end{macrocode} +% \subsubsection{Symbol for zero} +% By default the \textit{abjad} symbol for zero is not defined, +% but if a package writer or user owns or develops a font containing +% appropriate glyphs (e.g. as found in medieval manuscripts), it can be +% easily redefined. +% \begin{macrocode} +\def\abjad@zero{} +\def\hebnum@zero{} +\def\syriac@zero{} +% \end{macrocode} +% \subsubsection{Definitions of alphanumeric characters} +% \begin{macrocode} +\def\abj@num@i#1{% + \ifcase#1\or\char"0627 \or\char"0628 \or\char"062C \char"200D\or\char"062F % + \or\char"0647 \or\char"0648 \or\char"0632 \or\char"062D \or\char"0637 \fi + \ifnum#1=\z@\abjad@zero\fi} +\def\abj@num@ii#1{% + \ifcase#1\or\char"064A \or\char"0643 \or\char"0644 \or\char"0645 \or\char"0646 % + \or\char"0633 \or\char"0639 \or\char"0641 \or\char"0635 \fi + \ifnum#1=\z@\fi\abj@num@i} +\def\abj@num@iii#1{% + \ifcase#1\or\char"0642 \or\char"0631 \or\char"0634 \or\char"062A \or\char"062B % + \or\char"062E \or\char"0630 \or\char"0636 \or\char"0638 \fi + \ifnum#1=\z@\fi\abj@num@ii} +\def\abj@num@iv#1{% + \ifcase#1\or\char"063A \fi + \ifnum#1=\z@\fi\abj@num@iii} + +%maghribi س -> ص ص -> ض ش -> س ض -> ظ ظ -> غ غ -> ش +\def\abj@maghribi@num@ii#1{% + \ifcase#1\or\char"064A \or\char"0643 \or\char"0644 \or\char"0645 \or\char"0646 % + \or\char"0635 \or\char"0639 \or\char"0641 \or\char"0636 \fi + \ifnum#1=\z@\abjad@zero\fi\abj@num@i} +\def\abj@maghribi@num@iii#1{% + \ifcase#1\or\char"0642 \or\char"0631 \or\char"0633 \or\char"062A \or\char"062B % + \or\char"062E \or\char"0630 \or\char"0638 \or\char"063A \fi + \ifnum#1=\z@\fi\abj@maghribi@num@ii} +\def\abj@maghribi@num@iv#1{% + \ifcase#1\or\char"0634 \fi + \ifnum#1=\z@\fi\abj@maghribi@num@iii} + +%Hebrew alphabetic numerals (primitive implementation -- the code in Babel is more complex): +\def\heb@num@i#1{% + \ifcase#1\or\char"05D0 \or\char"05D1 \or\char"05D2 \or\char"05D3 \or\char"05D4 % + \or\char"05D5 \or\char"05D6 \or\char"05D7 \or\char"05D8 \fi + \ifnum#1=\z@\hebnum@zero\fi} +\def\heb@num@ii#1{% + \ifcase#1\or\char"05D9 \or\char"05DB \or\char"05DC \or\char"05DE \or\char"05E0 % + \or\char"05E1 \or\char"05E2 \or\char"05E4 \or\char"05E6 \fi + \ifnum#1=\z@\fi\heb@num@i} +\def\heb@num@iii#1{% + \ifcase#1\or\char"05E7 \or\char"05E8 \or\char"05E9 \or\char"05EA \or\char"05DA % + \or\char"05DD \or\char"05DF \or\char"05E3 \or\char"05E5 \fi + \ifnum#1=\z@\fi\heb@num@ii} +\def\heb@num@iv#1{% + \ifcase#1\or\char"05D0\char"05F3 \or\char"05D1\char"05F3 \or\char"05D2\char"05F3 % + \or\char"05D3\char"05F3 \or\char"05D4\char"05F3 \or\char"05D5\char"05F3 % + \or\char"05D6\char"05F3 \or\char"05D7\char"05F3 \or\char"05D8\char"05F3 \fi + \ifnum#1=\z@\fi\heb@num@iii} +%TODO [optionally] +% -insert gereshayim (\char"05F4) before last letter of a sequence of two letters or more +% -insert geresh (\char"05F3) after letter if it is alone + +\def\abj@syr@num@i#1{% + \ifcase#1\or\char"0710 \or\char"0712 \or\char"0713 \or\char"0715 % + \or\char"0717 \or\char"0718 \or\char"0719 \or\char"071A \or\char"071B\fi + \ifnum#1=\z@\syriac@zero\fi} +\def\abj@syr@num@ii#1{% + \ifcase#1\or\char"071D \or\char"071F \or\char"0720 \or\char"0721 \or\char"0722 % + \or\char"0723 \or\char"0725 \or\char"0726 \or\char"0728 \fi + \ifnum#1=\z@\fi\abj@syr@num@i} +\def\abj@syr@num@iii#1{% + \ifcase#1\or\char"0729 \or\char"072A \or\char"072B \or\char"072C \fi + \ifnum#1=\z@\fi\abj@syr@num@ii} +% \end{macrocode} +% +%\iffalse +%</package> +%\fi +% +% ^^A\clearpage +% ^^A\PrintChanges +% +% ^^A\clearpage +% ^^A\PrintIndex +% +% \Finale +% +%\iffalse +%<*dtx-style> +% \begin{macrocode} +\ProvidesPackage{dtx-style} +\usepackage{fontspec,xltxtra} +\usepackage{bidi} +\usepackage{xspace,fancyvrb,paralist} +\usepackage[xetex]{color} +\definecolor{myblue}{rgb}{0.02,0.04,0.48} +\definecolor{myred}{rgb}{0.65,0.04,0.07} +\definecolor{darkgray}{gray}{0.3} +\definecolor{lightgray}{gray}{0.6} +\definecolor{IslamicGreen}{rgb}{0,.43,0} +\usepackage[dvipdfm, + bookmarks=true, + colorlinks=true, + linkcolor=myblue, + urlcolor=myblue, + citecolor=myblue, + hyperindex=false, + hyperfootnotes=false, + pdftitle={The bidi package}, + pdfauthor={F Charette <firmicus@gmx.net>}, + pdfsubject={An interface for typesetting bidirectional texts with XeLaTeX}, + pdfkeywords={XeTeX, XeLaTeX, Right-to-Left, Bidi, Arabic, Hebrew} + ]{hyperref} +% NB some of this preamble is taken or adapted from fontspec-doc-style.sty +\newcommand*\pkg[1]{\textsf{#1}} +\def\eg{\textit{e.g.,}\xspace} +\def\ie{\textit{i.e.,}\xspace} +\def\ca{\textit{ca.}\@\xspace} +\def\Eg{\textit{E.g.,}\xspace} +\def\Ie{\textit{I.e.,}\xspace} +\def\etc{\@ifnextchar.{\textit{etc}}{\textit{etc.}\@\xspace}} +\def\arabxetex{Arab\XeTeX} + +\newlength{\oldparindent} +\newcommand{\parindentoff}{\setlength{\oldparindent}{\parindent} \setlength{\parindent}{0pt}} +\newcommand{\parindenton}{\setlength{\parindent}{\oldparindent}} + +%% LOGOS, tuned for Palatino (seems also OK with Junicode): +\makeatletter +\TeX@logo@spacing{-0.12em}{-0.12em}% + {0.5ex}{-0.3em}{-0.12em}{-0.1em} +\makeatother +%% fontspec declarations: +\setromanfont[Mapping=tex-text]{Junicode}%{FPL Neu} +\defaultfontfeatures{Scale=MatchLowercase} +\setmonofont{DejaVu Sans Mono}%{Inconsolata}%{Latin Modern Typewriter Proportional}%{Luxi Mono}%{Courier New} +\setsansfont{DejaVu Sans} +\newfontfamily\arabicfont[Script=Arabic,Scale=1.5]{Scheherazade} +\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL} +\newfontfamily\syriacfont[Script=Syriac]{Estrangelo Talada} +\newfontfamily\damase{MPH 2B Damase} +\linespread{1.05} +\frenchspacing +\renewcommand{\footnoterule}{} +\skip\footins=2\bigskipamount +%% ToC +\def\@dotsep{1000} +\setcounter{tocdepth}{2} +\setlength\columnseprule{0.4pt} +\makeatletter +\renewcommand\tableofcontents{% + \begin{multicols}{2}[\section*{\contentsname}]% + \small + \@starttoc{toc}% + \end{multicols}} +\makeatother +% \end{macrocode} +%</dtx-style> +%\fi +% +% +% \typeout{*************************************************************} +% \typeout{*} +% \typeout{* To finish the installation you have to move the following} +% \typeout{* file into a directory searched by XeTeX:} +% \typeout{*} +% \typeout{* \space\space\space bidi.sty} +% \typeout{*} +% \typeout{*************************************************************} +% +\endinput diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidi.sty b/Master/texmf-dist/tex/xelatex/bidi/bidi.sty index 9d4fe981f0d..7ac709c9eaf 100644 --- a/Master/texmf-dist/tex/xelatex/bidi/bidi.sty +++ b/Master/texmf-dist/tex/xelatex/bidi/bidi.sty @@ -12,11 +12,11 @@ %% License information appended %% %% +%% \section{Implementation} \NeedsTeXFormat{LaTeX2e} \ProvidesPackage{bidi} - [2007/03/06 v0.2 Bidirectional typesetting in XeLaTeX] -%% this is not used for now: -%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + [2007/04/30 v0.2.2 Bidirectional typesetting in XeLaTeX] +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \ifx\TeXXeTstate\undefined\else% \TeXXeTstate=1 \fi @@ -40,16 +40,12 @@ \everydisplay{\if@rl\aftergroup\beginR\fi } \def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi} \let\o@everypar=\everypar -%% The following, surely, will not play well with all packages, e.g. ledmac -%% But we now use this instead, taken from Arabicore.sty in the Arabi package. -%% Thanks to Youssef Jabri! Shukran jazilan! \newtoks\n@everypar \n@everypar\expandafter{\the\o@everypar} \o@everypar{\rl@everypar\the\n@everypar} \let\everypar=\n@everypar \def\@ensure@RL#1{\if@rl#1\else\RL{#1}\fi} \def\@ensure@LR#1{\if@rl\LR{#1}\else#1\fi} -%%%preserve logos \let\@@TeX\TeX \def\TeX{\LR{\@@TeX}} \let\@@LaTeX\LaTeX @@ -60,7 +56,6 @@ \let\@@XeTeX\XeTeX \def\XeTeX{\LR{\@@XeTeX}} }{} -%%VARIOUS LATEX MACROS \def\list#1#2{% \ifnum \@listdepth >5\relax \@toodeep @@ -87,7 +82,7 @@ \fi \parshape \@ne \@totalleftmargin \linewidth \ignorespaces} -%%% +%% \def\@dottedtocline#1#2#3#4#5{% \ifnum #1>\c@tocdepth \else \vskip \z@ \@plus.2\p@ @@ -108,7 +103,7 @@ \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor \beginL#5\endL}% \par}% \fi} -%%% +%% \def\raggedright{% \let\\\@centercr \leftskip\z@skip\rightskip\@flushglue @@ -167,7 +162,9 @@ \ifx\@textcolor\@undefined\else% \AtBeginDocument{% \def\@textcolor#1#2#3{% - \if@rl% + \if@rl\PackageWarning{bidi}{% + \textcolor will not work in RL mode if the textual argument spans more than one line.^^J% + With XeTeX you should set color as a font feature instead.}% \beginL\protect\leavevmode{\color#1{#2}\beginR#3\endR}\endL% \else% \protect\leavevmode{\color#1{#2}#3}% @@ -235,8 +232,25 @@ \fi \fi } + +\def\abjadsyriac#1{% +\ifnum#1>499 \PackageWarning{bidi}{Illegal value (#1) for Syriac abjad numeral} {#1} +\else + \ifnum#1<\z@\space\PackageWarning{bidi}{Illegal value (#1) for Syriac abjad numeral}% + \else + \ifnum#1<10\expandafter\abj@syr@num@i\number#1% + \else + \ifnum#1<100\expandafter\abj@syr@num@ii\number#1% + \else + \expandafter\abj@syr@num@iii\number#1% + \fi + \fi + \fi +\fi +} \def\abjad@zero{} \def\hebnum@zero{} +\def\syriac@zero{} \def\abj@num@i#1{% \ifcase#1\or\char"0627 \or\char"0628 \or\char"062C \char"200D\or\char"062F % \or\char"0647 \or\char"0648 \or\char"0632 \or\char"062D \or\char"0637 \fi @@ -282,6 +296,18 @@ \or\char"05D3\char"05F3 \or\char"05D4\char"05F3 \or\char"05D5\char"05F3 % \or\char"05D6\char"05F3 \or\char"05D7\char"05F3 \or\char"05D8\char"05F3 \fi \ifnum#1=\z@\fi\heb@num@iii} + +\def\abj@syr@num@i#1{% + \ifcase#1\or\char"0710 \or\char"0712 \or\char"0713 \or\char"0715 % + \or\char"0717 \or\char"0718 \or\char"0719 \or\char"071A \or\char"071B\fi + \ifnum#1=\z@\syriac@zero\fi} +\def\abj@syr@num@ii#1{% + \ifcase#1\or\char"071D \or\char"071F \or\char"0720 \or\char"0721 \or\char"0722 % + \or\char"0723 \or\char"0725 \or\char"0726 \or\char"0728 \fi + \ifnum#1=\z@\fi\abj@syr@num@i} +\def\abj@syr@num@iii#1{% + \ifcase#1\or\char"0729 \or\char"072A \or\char"072B \or\char"072C \fi + \ifnum#1=\z@\fi\abj@syr@num@ii} %% %% Copyright (C) 2007 by François Charette <firmicus at gmx dot net> %% diff --git a/Master/texmf-dist/tpm/bidi.tpm b/Master/texmf-dist/tpm/bidi.tpm index d89fad261b3..d18beac9ac5 100644 --- a/Master/texmf-dist/tpm/bidi.tpm +++ b/Master/texmf-dist/tpm/bidi.tpm @@ -3,23 +3,24 @@ <rdf:Description about="http://texlive.dante.de/texlive/Package/bidi.zip"> <TPM:Name>bidi</TPM:Name> <TPM:Type>Package</TPM:Type> - <TPM:Date>2007/04/14 11:35:00</TPM:Date> + <TPM:Date>2007/05/10 17:38:00</TPM:Date> <TPM:Version></TPM:Version> <TPM:Creator>karl</TPM:Creator> <TPM:Title>The bidi package.</TPM:Title> <TPM:Description></TPM:Description> <TPM:Author></TPM:Author> - <TPM:Size>130986</TPM:Size> + <TPM:Size>131875</TPM:Size> <TPM:License></TPM:License> <TPM:Build/> - <TPM:RunFiles size="10604"> + <TPM:RunFiles size="11539"> texmf-dist/tex/xelatex/bidi/bidi.sty texmf-dist/tpm/bidi.tpm </TPM:RunFiles> - <TPM:DocFiles size="121271"> + <TPM:DocFiles size="154158"> texmf-dist/doc/xelatex/bidi/README.txt texmf-dist/doc/xelatex/bidi/bidi.pdf </TPM:DocFiles> + <TPM:SourceFiles size="27562">texmf-dist/source/xelatex/bidi/bidi.dtx</TPM:SourceFiles> <TPM:Provides>Package/bidi</TPM:Provides> </rdf:Description> </rdf:RDF> |