summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/hvarabic/doc/hvarabic.tex
blob: 741f73f4f25ec05a1cb804b6413823c8ddbde646 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
%% $Id: hvarabic.tex 104 2021-06-01 06:01:56Z herbert $
%
\listfiles\setcounter{errorcontextlines}{100}
\documentclass[paper=a4,fontsize=11pt,DIV=13,parskip=half-,
               captions=tableabove,twoside=on]{scrartcl}
\usepackage{fontspec}
\setmainfont{AccanthisADFStdNo3}[
  UprightFont   =*-Regular,
  BoldFont      =*-Bold,
  ItalicFont    =*-Italic,
  BoldItalicFont=*-BoldItalic,
  RawFeature    = -rlig,
]
\setsansfont{GilliusADF}[
  UprightFont   =*-Regular,
  BoldFont      =*-Bold,
  ItalicFont    =*-Italic,
  BoldItalicFont=*-BoldItalic,
  RawFeature    = -rlig,
]
\setmonofont{Anonymous Pro}[Scale=MatchLowercase,FakeStretch=0.9]

\usepackage[english]{babel}
\usepackage{scrlayer-scrpage}
\usepackage{showexpl}
\usepackage{dtk-extern,xcolor}
\lstset{basicstyle=\hvALM\small,language=[LaTeX]TeX,rframe=}

\setkeys{dtk}{cleanup,force=false}

\def\Lfile#1{\texttt{#1}\index{#1 file@\texttt{#1} file}}
\def\Lext#1{\texttt{.#1}\index{#1 file extension@\texttt{.#1} file extension}}
\def\Lcs#1{\texttt{\textbackslash#1}\index{#1@\texttt{\textbackslash#1}}}
\def\Lenv#1{\texttt{#1}\index{#1 environment@\texttt{#1} environment}}
\def\Lpack#1{\texttt{#1}\index{#1 package@\texttt{#1} package}}
\def\Lprog#1{\texttt{#1}\index{#1 program@\texttt{#1} program}}
\def\Loption#1{\texttt{#1}\index{#1@\texttt{#1} package option}}
\let\Ldim\Lcs

%\usepackage[bibstyle=dtk]{biblatex}
%\addbibresource{\jobname.bib}


\makeatletter% from: doc.sty
\newcommand*\GetFileInfo[1]{%
  \def\filename{#1}%
  \def\@tempb##1 ##2 ##3\relax##4\relax{%
    \def\filedate{##1}%
    \def\fileversion{##2}%
    \def\fileinfo{##3}}%
  \edef\@tempa{\csname ver@#1\endcsname}%
  \expandafter\@tempb\@tempa\relax? ? \relax\relax}
\makeatother

%\GetFileInfo{xltabular.sty}
\usepackage{xspace}
\usepackage{hvarabic}
\def\setVersion#1{\setVVersion#1!!}
\def\setVVersion#1=#2!!{\def\hvarabicVersion{#2}} 

\usepackage[imakeidx]{xindex}
\makeindex

\usepackage{url}
\usepackage[colorlinks,linktocpage]{hyperref}


\setVersion{version = 0.01a}%

\title{Package \texttt{hvarabic} \\--\\ Provide macros for RTL typesetting. \\ \normalsize \hvarabicVersion\ (\today)}
\author{Herbert Voß\thanks{\url{hvoss@tug.org}}}
\begin{document}
\maketitle
%\tableofcontents

\section{Package option}

By default a footnoterule is set from left to right, with left-to-right (LTR) and also with right-to-left (RTL) text.
Using the optional package argument \Loption{RTLfootnoterule} forces \LaTeX\ to draw the footnoterule also von right to left:

\let\myFont\hvALM

\begin{Verbatim}[fontfamily=myFont,frame=single,label=Source]
[...]
\usepackage{hvarabic}% the default
[...]
\begin{RTL}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \nLTR{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\RTLfootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.
\end{RTL}
\end{Verbatim}




\begin{externalDocument}[
%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
  pages={1},
  frame,
  compiler=lualatex,
  crop,
  force,
  xindex,
  runs=2,code=false,docType=latex,
  align=\centering,
  lstOptions={columns=fixed}]{hvarabic}
\documentclass[paper=a6,paper=landscape,DIV=13]{scrartcl}
\textheight=0.6\textheight %% Only for demo
%StartVisiblePreamble
\usepackage{hvarabic}
%StopVisiblePreamble
\pagestyle{empty}
\begin{document}
\begin{RTL}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \nLTR{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\RTLfootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.
\end{RTL}
\end{document}
\end{externalDocument}

\begin{Verbatim}[fontfamily=myFont,frame=single,label=Source]
[...]
\usepackage[RTLfootnoterule]{hvarabic}% draw footnoterule also RTL!
[...]
\begin{RTL}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \nLTR{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\RTLfootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.
\end{RTL}
\end{Verbatim}




\begin{externalDocument}[
%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
  pages={1},
  frame,
  compiler=lualatex,
  crop,
  force,
  xindex,
  runs=2,code=false,docType=latex,
  align=\centering,
  lstOptions={columns=fixed}]{hvarabic}
\documentclass[paper=a6,paper=landscape,DIV=13]{scrartcl}
\textheight=0.6\textheight %% Only for demo
%StartVisiblePreamble
\usepackage[RTLfootnoterule]{hvarabic}
%StopVisiblePreamble
\pagestyle{empty}
\begin{document}
\begin{RTL}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \nLTR{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\RTLfootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.
\end{RTL}
\end{document}
\end{externalDocument}


\section{Small RTL text sequences}

\begin{verbatim}
\textRTL{RTL text sequence}
\end{verbatim}

\begin{Verbatim}[fontfamily=myFont,frame=single,label=Source]
English text ``\textRTL{جملة عربية وسط جملة إنجليزية}'' with Arabic in between. 
To protect the people of Massachusetts from the COVID-19 pandemic you left your 
classes and, in [...]
\end{Verbatim}




\begin{externalDocument}[
%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
  pages={1},
  frame,
  compiler=lualatex,
  crop,
  force,
  xindex,
  runs=2,code=false,docType=latex,
  align=\centering,
  lstOptions={columns=fixed}]{hvarabic}
\documentclass[paper=a6,paper=landscape,DIV=13]{scrartcl}
%StartVisiblePreamble
\usepackage[RTLfootnoterule]{hvarabic}
%StopVisiblePreamble
\pagestyle{empty}
\begin{document}
English text ``\textRTL{جملة عربية وسط جملة إنجليزية}'' with Arabic in between. 
To protect the people of Massachusetts from the COVID-19 pandemic you left your 
classes and, in [...]
\end{document}
\end{externalDocument}


\section{Long RTL text sequences}
The macro \Lcs{footnote} is still available but prints the footnote with footnoterule
left justified. With \Lcs{RTLfootnote} the footnotetext can be printed right justified.
It depends to current state if the footnoterule should be left or right justified.
It can be changed by two commands or for the whole document with the package option.


\begin{verbatim}
\begin{RTL}
...
\end{RTL}
\nLTR{digits}% for digits inside Arabic text
\RTLfootnote{RTL footnote inside RTL environment}
\setLTRfootnoterule
\setRTLfootnoterule
\end{verbatim}

\begin{Verbatim}[fontfamily=myFont,frame=single,label=Source]
English text ``\textRTL{جملة عربية وسط جملة إنجليزية}'' with Arabic in between. 
To protect the people of Massachusetts from the COVID-19 pandemic you left your 
classes and, in many cases, your home at Harvard to move to a virtual mode of education. 

\begin{RTL}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \nLTR{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\RTLfootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.

لحماية سكان ماساتشوستس من جائحة \nLTR{COVID-19} تركت دروسك ، وفي
في كثير من الحالات ، منزلك في هارفارد للانتقال إلى وضع التعليم الافتراضي. في نفس الوقت أنت
صعد لخدمة مجتمعاتك في جميع أنحاء العالم. انتقل بعضكم مباشرة إلى الأمام
خطوط الوباء ، مثل طلاب كلية الطب بجامعة هارفارد لعام \nLTR{2020} الذين اختاروا التخرج
في وقت مبكر حتى يتمكنوا من الانضمام إلى القتال وأولئك من T.H. مدرسة تشان للصحة العامة
تطوع لتوفير نظام تتبع الاتصال لماساتشوستس.
\end{RTL}
\end{Verbatim}




\begin{externalDocument}[
%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
  pages={1},
  frame,
  compiler=lualatex,
  crop,
  force,
  xindex,
  runs=2,code=false,docType=latex,
  align=\centering,
  lstOptions={columns=fixed}]{hvarabic}
\documentclass[paper=a5,paper=landscape,DIV=13]{scrartcl}
\textheight=0.6\textheight % Only for demo
%StartVisiblePreamble
\usepackage[RTLfootnoterule]{hvarabic}
%StopVisiblePreamble
\pagestyle{empty}
\begin{document}
English text ``\textRTL{جملة عربية وسط جملة إنجليزية}'' with Arabic in between. 
To protect the people of Massachusetts from the COVID-19 pandemic you left your 
classes and, in many cases, your home at Harvard to move to a virtual mode of education. 

\begin{RTL}
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين \nLTR{١٢٣٤٥} فقرة عربية
محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين
فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين فقرة عربية محاذاة إلى اليمين فقرة عربية محاذاة إلى
اليمين\RTLfootnote{حاشية عربية.} فقرة عربية محاذاة إلى اليمين.

لحماية سكان ماساتشوستس من جائحة \nLTR{COVID-19} تركت دروسك ، وفي
في كثير من الحالات ، منزلك في هارفارد للانتقال إلى وضع التعليم الافتراضي. في نفس الوقت أنت
صعد لخدمة مجتمعاتك في جميع أنحاء العالم. انتقل بعضكم مباشرة إلى الأمام
خطوط الوباء ، مثل طلاب كلية الطب بجامعة هارفارد لعام \nLTR{2020} الذين اختاروا التخرج
في وقت مبكر حتى يتمكنوا من الانضمام إلى القتال وأولئك من T.H. مدرسة تشان للصحة العامة
تطوع لتوفير نظام تتبع الاتصال لماساتشوستس.
\end{RTL}
\end{document}
\end{externalDocument}


\section{Arabic font}
The package uses by default the predefined fontface \Lcs{RTLfont}, which defines as
arabic font Scheherazade and for verbatim text the only possible arabic font with 
monospace, the ALM (Arabic Latin Modern). It is available by using the macro \Lcs{hvALM}
and is scaled down to 85\%.:

\begin{verbatim}
\providefontfamily\RTLfont
    [Script=Arabic,        % to get correct arabic shaping
     Scale=1.2]{Scheherazade}         % whatever Arabic font you like
\newfontfamily\hvALM{ALM Fixed}[Scale=0.9]
\end{verbatim}

\section{Global change of the text direction}

The two macros start a new paragraph and then changes the text direction to TRT
or TLT.

\begin{verbatim}
\setRTL
\setLTR
\end{verbatim}

\begin{Verbatim}[fontfamily=myFont,frame=single,label=Source]
\setRTL\RTLfont
لحماية سكان ماساتشوستس من جائحة \nLTR{COVID-19} تركت دروسك ، وفي
في كثير من الحالات ، منزلك في هارفارد للانتقال إلى وضع التعليم الافتراضي. في نفس الوقت أنت
صعد لخدمة مجتمعاتك في جميع أنحاء العالم. انتقل بعضكم مباشرة إلى الأمام
خطوط الوباء ، مثل طلاب كلية الطب بجامعة هارفارد لعام \nLTR{2020} الذين اختاروا التخرج
في وقت مبكر حتى يتمكنوا من الانضمام إلى القتال وأولئك من T.H. مدرسة تشان للصحة العامة
تطوع لتوفير نظام تتبع الاتصال لماساتشوستس.
\setLTR
لحماية سكان ماساتشوستس من جائحة \nLTR{COVID-19} تركت دروسك ، وفي
في كثير من الحالات ، منزلك في هارفارد للانتقال إلى وضع التعليم الافتراضي. في نفس الوقت أنت
صعد لخدمة مجتمعاتك في جميع أنحاء العالم. انتقل بعضكم مباشرة إلى الأمام
خطوط الوباء ، مثل طلاب كلية الطب بجامعة هارفارد لعام \nLTR{2020} الذين اختاروا التخرج
في وقت مبكر حتى يتمكنوا من الانضمام إلى القتال وأولئك من T.H. مدرسة تشان للصحة العامة
تطوع لتوفير نظام تتبع الاتصال لماساتشوستس.
\end{Verbatim}




\begin{externalDocument}[
%  grfOptions={width=\dimexpr\linewidth-2\fboxsep-2\fboxrule},
  pages={1},
  frame,
  compiler=lualatex,
  crop,
  xindex,
  force,
  runs=2,code=false,docType=latex,
  align=\centering,
  lstOptions={columns=fixed}]{hvarabic}
\documentclass{scrartcl}
%StartVisiblePreamble
\usepackage[RTLfootnoterule]{hvarabic}
%StopVisiblePreamble
\pagestyle{empty}
\begin{document}
\setRTL\RTLfont
لحماية سكان ماساتشوستس من جائحة \nLTR{COVID-19} تركت دروسك ، وفي
في كثير من الحالات ، منزلك في هارفارد للانتقال إلى وضع التعليم الافتراضي. في نفس الوقت أنت
صعد لخدمة مجتمعاتك في جميع أنحاء العالم. انتقل بعضكم مباشرة إلى الأمام
خطوط الوباء ، مثل طلاب كلية الطب بجامعة هارفارد لعام \nLTR{2020} الذين اختاروا التخرج
في وقت مبكر حتى يتمكنوا من الانضمام إلى القتال وأولئك من T.H. مدرسة تشان للصحة العامة
تطوع لتوفير نظام تتبع الاتصال لماساتشوستس.

\setLTR\bigskip
لحماية سكان ماساتشوستس من جائحة \nLTR{COVID-19} تركت دروسك ، وفي
في كثير من الحالات ، منزلك في هارفارد للانتقال إلى وضع التعليم الافتراضي. في نفس الوقت أنت
صعد لخدمة مجتمعاتك في جميع أنحاء العالم. انتقل بعضكم مباشرة إلى الأمام
خطوط الوباء ، مثل طلاب كلية الطب بجامعة هارفارد لعام \nLTR{2020} الذين اختاروا التخرج
في وقت مبكر حتى يتمكنوا من الانضمام إلى القتال وأولئك من T.H. مدرسة تشان للصحة العامة
تطوع لتوفير نظام تتبع الاتصال لماساتشوستس.
\end{document}
\end{externalDocument}

%\printindex

\end{document}