Changes

Jump to navigation Jump to search
2,913 bytes added ,  18:36, 28 June 2008
== Arabic ==
This is an example style file for typesetting Arabic documents. Save it as "ara-sty.tex" and "\include ara-sty" in your document.
<texcode>
\mainlanguage[arabic]
% Fontsetup 
\definefontfeature
[arabic]
\def\LatinTextDir {\textdir TLT}
\def\LatinGlobalDir {\pagedir TLT\bodydir TLT\pardir TLT\textdir TLT}
 
\define\setarabic
{\ArabicGlobalDir%
\usetypescript[Arabic]%
\setupbodyfont[Arabic,20pt]}
\definestartstop
{{\Arabic\ArabicTextDir#1}}
\define\setArabicsetlatin {\LatinGlobalDir% \usetypescript[lm]% \setupbodyfont[lm,20pt]} \definestartstop [latinpar] [commands=\Arabic\LatinParDir] \define[1]\LT {{\LatinTextDir#1}} \setcharactermirroring[1]</texcode> Here is some discription. <texcode>% engine=luatex</texcode> This tells ConTeXt to use [[luatex]] as TeX engine, this mandatory for this example to work. <texcode>\mainlanguage[arabic]</texcode> Sets the main language to Arabic, so that translatable titles are translated to Arabic. <texcode>\definefontfeature [arabic] [mode=node,language=dflt,script=arab, init=yes,medi=yes,fina=yes,isol=yes, liga=yes,dlig=yes,rlig=yes,clig=yes, mark=yes,mkmk=yes,kern=yes,curs=yes]</texcode> Here we define OpenType font features needed to render Arabic properly. <texcode>\starttypescript [serif] [arabic] \definefontsynonym [Arabic-Light] [name:arabtype] [features=arabic] \definefontsynonym [Arabic-Bold] [name:arabtype] [features=arabic] \definefontsynonym [Arabic-Italic] [name:arabtype] [features=arabic] \definefontsynonym [Arabic-Bold-Italic] [name:arabtype] [features=arabic] \stoptypescript \starttypescript [serif] [arabic] [name] \usetypescript[serif][fallback] \definefontsynonym [Serif] [Arabic-Light] [features=arabic] \definefontsynonym [SerifItalic] [Arabic-Italic] [features=arabic] \definefontsynonym [SerifBold] [Arabic-Bold] [features=arabic] \definefontsynonym [SerifBoldItalic] [Arabic-Bold-Italic] [features=arabic]\stoptypescript \starttypescript [Arabic] \definetypeface [Arabic] [rm] [serif] [arabic] [default] \stoptypescript </texcode> Then, we define "Arabic" typescript, here we used a font named "arabtype". Since this font has only regular weight, we set bold and italic to use the same font. <texcode>\def\ArabicGlobalDir {\pagedir TRT\bodydir TRT\pardir TRT\textdir TRT}\def\ArabicParDir {\textdir TRT\pardir TRT}\def\ArabicTextDir {\textdir TRT}\def\LatinParDir {\textdir TLT\pardir TLT}\def\LatinTextDir {\textdir TLT}\def\LatinGlobalDir {\pagedir TLT\bodydir TLT\pardir TLT\textdir TLT}</texcode> Here we define some directional commands to use it in the next parts. <texcode>\define\setarabic
{\ArabicGlobalDir%
\usetypescript[Arabic]%
\setupbodyfont[Arabic,20pt]}
 
\definestartstop
[arabicpar]
[commands=\Arabic\ArabicParDir]
 
\define[1]\AR
{{\Arabic\ArabicTextDir#1}}
 
</texcode>
 
Here we define "arabicpar" environment for Arabic paragraphs in Latin context, and "\AR" for short Arabic sentences and "\setarabic" command to set the main document direction and font to Arabic.
 
<texcode>
\define\setlatin
{\LatinGlobalDir%
\usetypescript[lm]%
\setupbodyfont[lm,20pt]}
\definestartstop
\define[1]\LT
{{\LatinTextDir#1}}
</texcode>
The counter Latine commands, "latinpar", "\define\setLatin {\LatinGlobalDir% LT" and "\usetypescript[lm]% \setupbodyfont[lm,20pt]}setlatin".
<texcode>
\setcharactermirroring[1]
</texcode>
 
To enable mirroring of BiDi mirrored characters, like () and [].
68

edits

Navigation menu