summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/arabi/arabipoetry.sty
blob: 8cf78f10c3a6a2055e6965e8a856591d4729045b (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
% \iffalse meta-comment
%
% Copyright 2006      Youssef Jabri
% 
% 
% This file is part of the `Arabi' system.
% -------------------------------------------
% 
% It may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3b
% of this license or (at your option) any later version.
% The latest version of this license is in
%    http://www.latex-project.org/lppl.txt
% and version 1.3b or later is part of all distributions of LaTeX 
% version 2005/12/01 or later.
% 
% This file has the LPPL maintenance status "maintained".
% 
% 
% \fi
%
% Filename: poetry.sty
%%%%%%%%%%%%%%%%%%%%%%%% poetry %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% \def \setversedim #1#2  % set length of half-verse, separation
% \def \halfverses #1#2   % first half-verse, second half-verse (boyh are in arabic)
% \def \connverses #1#2#3 % first half-verse, connection, second half-verse
% 
% 04.10.2005
%
% avoids loading twice
\expandafter \ifx \csname ar@poetry\endcsname \relax \else
  \expandafter \endinput \fi

\def\ar@poetry{\relax}


\ProvidesFile{poetry.sty}    
        [2005/10/04 v0.1 Arabic poetry]



%%%%%%%%%%%%%% A slight modification of the halfverses Macro %%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%% from the ArabTeX package by K. Lagally. %%%%%%%%%%%%%

%%%%%%%%%%%%%%%%%%%%%%%%%%% verses.sty %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% verses.sty
% utility for ArabTeX
% macros for typesetting Arabic verses in two columns
% usage: load as a package or after loading ArabTeX
% provides:
% \def \setversedim #1#2{% set length of half-verse, separation
% \def \halfverses #1#2{% first half-verse, second half-verse
% \def \connverses #1#2#3{% first half-verse, connection, second half-verse
% use within an Arabic environment
% 28.03.1998
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
%     Institut fuer Informatik
%     Universitaet Stuttgart
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% Macro "borrowed" from the Midnight bundle. 
%% From the Macro \border ...
%%
%%%%%%% exactly fitting border with overlaps
% \border makes a border of the specified dimensions, by overlapping some
% of the elements when necessary.
% \hborder takes four arguments, the width, and the indices of the left
% element, the middle element, and the right element. It makes an horizontal
% border of the form  \hbox to wd{ l m+ r }, where there is at least one m.
% If wd is large enough to set at least {l m r}, all overlap is between
% elements of type m. In the unusual case where wd is too small, the overlap
% is necessarily with the corner elements.
%
%\def\hborder#1#2#3#4% wd, l, m, r
%   {\hbox to#1
%	{\setbox0=\hbox{\borderelm#3}%
%	 \borderelm#2%
%	 \hskip0pt minus1fil %
%	 \copy0\kern-.5\wd0 %
%	 \cleaders\copy0\hskip0pt plus1fil %
%	 \kern-.5\wd0\copy0 %
%	 \hskip0pt minus1fil %
%	 \borderelm#4%
%	}%
%   }
%
\DeclareRobustCommand{\Spreadbox}[2]{\bgroup%
\setbox0=\hbox{{\if@farsi\fontencoding{LFE}\else\fontencoding{LAE}\fi\selectfont\keshchar}}
\renewcommand{\tatweel}{%
\noboundary\nobreak%
\hskip0pt% minus1fil %
\copy0\kern-.5\wd0 %
\cleaders\copy0\hskip0pt plus1fil %
\kern-.5\wd0\copy0 %
\hskip0pt% minus1fil %
\nobreak\noboundary}
%
\parbox{#1}{\hbox to #1{\if@farsi\FR{#2}\else\AR{#2}\fi}}\egroup}  



%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\newdimen \a@hvlen
\newdimen \a@hvsep
\newdimen \a@hvind

% define some verse dimensions, verses will be centered
\def \setversedim #1#2{% set length of half-verse, separation
\a@hvlen #1\relax \a@hvsep #2\relax 
\a@hvind \hsize \advance \a@hvind -\a@hvsep
\divide \a@hvind 2 \advance \a@hvind -\a@hvlen }


%strut for the Arabic font Traditional Arabic if vowels are used!
%\def\astrut{\rule[-.3cm]{0cm}{8.5mm}} 
\def\astrut{\hbox{\ArabiStrut}} 
%%
%% better to use instead of \hfil --> \hspace*{\stretch{1}}? 
%%


% macro for a verse with a connection
\def \Connverses #1#2#3{% first half-verse + strut, connection, second half-verse
\noindent \hspace \a@hvind \astrut
\Spreadbox \a@hvlen {#1}% first block
%\Spreadbox \a@hvsep {\hfill #2\hfill}% separator
\Spreadbox \a@hvsep {\hspace*{\stretch{1}} #2\hspace*{\stretch{1}}}% separator
\Spreadbox \a@hvlen {#3}% second block
\par }


% macro for two half verses
\def \Halfverses #1#2{% normal case
%\Connverses {#1}{\hfill}{#2}}
\Connverses {#1}{\hspace*{\stretch{1}}}{#2}}




\endinput