diff options
author | Karl Berry <karl@freefriends.org> | 2008-09-20 00:32:46 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-09-20 00:32:46 +0000 |
commit | 89d1e010eb673d8f40f47b75386c3027bb328dfa (patch) | |
tree | 60621e9aabc36f12a2a04035f9e72ccda3c8c6e2 /Master/texmf-dist/tex/xelatex/xepersian | |
parent | eb648c633a632c6e4555894f3ca0ce6230e6410a (diff) |
xepersian 0.161111111 (17sep08)
git-svn-id: svn://tug.org/texlive/trunk@10646 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/xepersian')
-rw-r--r-- | Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty | 223 |
1 files changed, 193 insertions, 30 deletions
diff --git a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty index 959b6f1e9e1..f3651751538 100644 --- a/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty +++ b/Master/texmf-dist/tex/xelatex/xepersian/xepersian.sty @@ -1,5 +1,5 @@ \NeedsTeXFormat{LaTeX2e} -\ProvidesPackage{xepersian}[2008/07/17 v0.16111111 +\ProvidesPackage{xepersian}[2008/09/17 v0.161111111 Typesetting Persian with XeTeX] \RequirePackage{graphicx} \RequirePackage{amssymb} @@ -12,21 +12,25 @@ \RequirePackage{etoolbox} \RequirePackage{persianpoem,fmultico} \AtBeginDocument{\ifdefined\farsifont\relax\else% -\PackageWarning{XePersian}{\string\farsifont\ is not defined! XePersian will try to load Nazli}% -\newfontfamily\farsifont[Script=Arabic,Scale=1.2,Mapping=farsidigits]{Nazli}\fi +\PackageWarning{XePersian}{\string\farsifont\ is not defined! XePersian will try to load ``XB Zar''}% +\newfontfamily\farsifont[Script=Arabic,Scale=1.2,Mapping=parsidigits]{XB Zar}\fi }% -\renewcommand{\thepage}{\rl{\the\c@page}} +\def\ps@plain{\ps@empty + \def\@oddfoot{\hfil\farsifont\thepage\hfil}% + \let\@evenfoot\@oddfoot + \let\@oddhead\@empty\let\@evenhead\@empty +} %to make the digits in math formula persian -\font\tenrgm="Nazli" at 12pt -\font\sevrgm="Nazli" at 10pt -\font\fivrgm="Nazli" at 7pt +\def\setparsimathsdigitsfont#1{ +\font\tenrgm="#1" at 12pt +\font\sevrgm="#1" at 10pt +\font\fivrgm="#1" at 7pt \newfam\fardig \textfont\fardig=\tenrgm \scriptfont\fardig=\sevrgm \scriptscriptfont\fardig=\fivrgm -\def\maths{ \XeTeXmathcode`0="7 \fardig "06F0% \XeTeXmathcode`1="7 \fardig "06F1% \XeTeXmathcode`2="7 \fardig "06F2% @@ -38,20 +42,20 @@ \XeTeXmathcode`8="7 \fardig "06F8% \XeTeXmathcode`9="7 \fardig "06F9% \XeTeXmathcode`.="7 \fardig "066B%decimal point -} -\XeTeXmathcode`٫="7 \fardig "066B%decimal point -\XeTeXmathcode`۰="7 \fardig "06F0% -\XeTeXmathcode`۱="7 \fardig "06F1% -\XeTeXmathcode`۲="7 \fardig "06F2% -\XeTeXmathcode`۳="7 \fardig "06F3% -\XeTeXmathcode`۴="7 \fardig "06F4% -\XeTeXmathcode`۵="7 \fardig "06F5% -\XeTeXmathcode`۶="7 \fardig "06F6% -\XeTeXmathcode`۷="7 \fardig "06F7% -\XeTeXmathcode`۸="7 \fardig "06F8% -\XeTeXmathcode`۹="7 \fardig "06F9% -\AtBeginDocument{\maths\setRL\farsifont} + \XeTeXmathcode`٫="7 \fardig "066B%decimal point + \XeTeXmathcode`۰="7 \fardig "06F0% + \XeTeXmathcode`۱="7 \fardig "06F1% + \XeTeXmathcode`۲="7 \fardig "06F2% + \XeTeXmathcode`۳="7 \fardig "06F3% + \XeTeXmathcode`۴="7 \fardig "06F4% + \XeTeXmathcode`۵="7 \fardig "06F5% + \XeTeXmathcode`۶="7 \fardig "06F6% + \XeTeXmathcode`۷="7 \fardig "06F7% + \XeTeXmathcode`۸="7 \fardig "06F8% + \XeTeXmathcode`۹="7 \fardig "06F9% +} +\AtBeginDocument{\setRL\farsifont\addfontfeature{Mapping=parsidigits}} %To convert the MILADI date to SHAMSI date, taken from farsitex @@ -277,23 +281,110 @@ \@ifclassloaded{article}{% + \def\ps@plain{\ps@empty + \def\@oddfoot{\hfil\rl\thepage\hfil}% + \let\@evenfoot\@oddfoot +} + +\if@twoside + \def\ps@headings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\rl\leftmark\hfil\rl\thepage}% + \def\@oddhead{\rl\thepage\hfil\rl\rightmark}% + \let\@mkboth\markboth + \def\sectionmark##1{% + \markboth {\MakeUppercase{% + \ifnum \c@secnumdepth >\z@ + \thesection\quad + \fi + \rl{##1}}}{}}% + \def\subsectionmark##1{% + \markright {% + \ifnum \c@secnumdepth >\@ne + \rl{\thesubsection\quad} + \fi + \rl{##1}}}} +\else + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{\rl\thepage\hfil\rl\rightmark}% + \let\@mkboth\markboth + \def\sectionmark##1{% + \markright {\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \rl{\thesection\quad} + \fi + \rl{##1}}}}} +\fi +\def\ps@myheadings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\rl\thepage\hfil\rl\leftmark}% + \def\@oddhead{\rl\rightmark\hfil\rl\thepage}% + \let\@mkboth\@gobbletwo + \let\sectionmark\@gobble + \let\subsectionmark\@gobble + } +\pagestyle{plain} \renewcommand{\refname}{مراجع} \renewcommand{\abstractname}{چکیده} \renewcommand\appendix{\par \setcounter{section}{0}% \setcounter{subsection}{0}% - \gdef\thesection{\@farsi\c@section}} + \gdef\thesection{\@harfi\c@section}} }{} \@ifclassloaded{amsart}{% +\def\l@section{\@tocline{1}{0pt}{.5pc}{2.7pc}{}} +\def\l@subsection{\@tocline{2}{0pt}{.5pc}{2.7pc}{}} +\renewcommand{\datename}{\rl{تاریخ:}} \renewcommand{\refname}{مراجع} \renewcommand{\abstractname}{چکیده} \renewcommand\appendix{\par \setcounter{section}{0}% \setcounter{subsection}{0}% - \gdef\thesection{\@farsi\c@section}} + \gdef\thesection{\@harfi\c@section}} }{} \@ifclassloaded{report}{% -\renewcommand{\bibname}{کتابنامه} + +\if@twoside + \def\ps@headings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\rl\thepage\hfil\rl\leftmark}% + \def\@oddhead{\rl\rightmark\hfil\rl\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markboth {\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \rl{\@chapapp\ \thechapter. \ }% + \fi + \rl{##1}}}{}}% + \def\sectionmark##1{% + \markright {\MakeUppercase{% + \ifnum \c@secnumdepth >\z@ + \rl{\thesection. \ }% + \fi + \rl{##1}}}}} +\else + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{\rl\rightmark\hfil\rl\thepage}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markright {\MakeUppercase{% + \ifnum \c@secnumdepth >\m@ne + \rl{\@chapapp\ \thechapter. \ }% + \fi + \rl{##1}}}}} +\fi +\def\ps@myheadings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\rl\thepage\hfil\rl\leftmark}% + \def\@oddhead{rl\rightmark\hfil\rl\thepage}% + \let\@mkboth\@gobbletwo + \let\chaptermark\@gobble + \let\sectionmark\@gobble + } +\pagestyle{plain} +\renewcommand{\bibname}{مراجع} \renewcommand{\abstractname}{چکیده} \renewcommand{\chaptername}{فصل} \renewcommand{\partname}{بخش} @@ -302,10 +393,12 @@ \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% - \gdef\thechapter{\@farsi\c@chapter} + \gdef\thechapter{\@harfi\c@chapter} }%end appendix }{} \@ifclassloaded{amsbook}{% +\def\l@section{\@tocline{1}{0pt}{.5pc}{2.7pc}{}} +\def\frontmatter{\cleardoublepage\pagenumbering{harfi}} \renewcommand{\bibname}{کتابنامه} \renewcommand{\chaptername}{فصل} \renewcommand{\partname}{بخش} @@ -314,7 +407,7 @@ \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% - \gdef\thechapter{\@farsi\c@chapter} + \gdef\thechapter{\@harfi\c@chapter} }%end appendix }{} \@ifclassloaded{bookest}{% @@ -327,10 +420,70 @@ \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% - \gdef\thechapter{\@farsi\c@chapter} + \gdef\thechapter{\@harfi\c@chapter} }%end appendix }{} \@ifclassloaded{book}{% +\renewcommand\frontmatter{% + \cleardoublepage + \@mainmatterfalse + \pagenumbering{harfi}} +\renewcommand\mainmatter{% + \cleardoublepage + \@mainmattertrue + \pagenumbering{farsi}} +\renewcommand\backmatter{% + \if@openright + \cleardoublepage + \else + \clearpage + \fi + \@mainmatterfalse} + +\if@twoside + \def\ps@headings{% + \let\@oddfoot\@empty\let\@evenfoot\@empty + \def\@evenhead{\rl\rightmark\hfil\rl\thepage}% + \def\@oddhead{\rl\thepage\hfil\rl\leftmark}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markboth {\MakeUppercase{% + \rl{\@chapapp\ \thechapter.\,\,}% + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \rl{##1} + \fi + \fi + }}{}}% + \def\ps@plain{\ps@empty + \def\@oddfoot{\hfil\rl\thepage\hfil}% + \let\@evenfoot\@oddfoot +} + \def\sectionmark##1{% + \markright {\MakeUppercase{% + \rl{\thesection}\, + \ifnum \c@secnumdepth >\z@ + \rl{##1} \ % + \fi + }}}} +\else + \def\ps@headings{% + \let\@oddfoot\@empty + \def\@oddhead{\rl\thepage\hfil\rl\rightmark}% + \let\@mkboth\markboth + \def\chaptermark##1{% + \markright {\MakeUppercase{% + \rl{\@chapapp\ \thechapter. } % + \ifnum \c@secnumdepth >\m@ne + \if@mainmatter + \rl{##1} + \fi + \fi + }}}} + +\fi +\pagestyle{headings} + \renewcommand{\bibname}{کتابنامه} \renewcommand{\chaptername}{فصل} \renewcommand{\partname}{بخش} @@ -339,7 +492,7 @@ \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% - \gdef\thechapter{\@farsi\c@chapter} + \gdef\thechapter{\@harfi\c@chapter} }%end appendix }{} \@ifclassloaded{refrep}{% @@ -351,7 +504,7 @@ \setcounter{chapter}{0}% \setcounter{section}{0}% \gdef\@chapapp{\appendixname}% - \gdef\thechapter{\@farsi\c@chapter} + \gdef\thechapter{\@harfi\c@chapter} }%end appendix }{} @@ -378,8 +531,10 @@ \x} \def\@character#1{\ifcase#1\or الف\or ب\or پ\or ت\or ث\or ج\or چ\or ح\or خ\or د\or ذ\or ر\or ز\or س\or ش\or ص\or ض\or ع\or غ\or ف\or ق\or ک\or گ\or ل\or م\or ن\or ه\or و\or ی\fi} -\def\@farsi#1{\farsifont\@character{\@@arabic#1}} +\def\@harfi#1{\farsifont\@character{\@@arabic#1}} +\def\@numeric#1{\ifcase#1 \or یک\or دو\or سه\or چهار\or پنج\or شش\or هفت\or هشت\or نه\or ده\or یازده\or دوازده\or سیزده\or چهارده\or پانزده\or شانزده\or هفده\or هجده\or نوزده\or بیست\fi} +\def\@adadi#1{\farsifont\@numeric{\@@arabic#1}} %The figure or table caption \newsavebox\@Arabitempboxa @@ -415,6 +570,7 @@ } + %For Right-to-Left two column command, I guess taken from rlbabel \makeatletter \let\@old@outputdblcol\@outputdblcol @@ -576,4 +732,11 @@ \AtBeginDocument{\farsi@numbers} +\newcommand\twocolumnstableofcontents{% + \begin{multicols}{2}[\section*{\contentsname}]% + \small + \@starttoc{toc}% + \end{multicols}} + + \endinput |