summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/arabtex/verses.sty
blob: 629257bce6fb0aa95efcdac4f5e1925237754f63 (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
%%%%%%%%%%%%%%%%%%%%%%%%%%% 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
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\ifx \verseatcode \undefined \else \expandafter \endinput
\fi % load only once

\chardef \verseatcode = \catcode`\@  \catcode`\@ = 11

\a@ident {verses.sty} {3.00 verses in two columns} {28.03.1998}

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

\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 }

% macro for a verse with a connection
\def \connverses #1#2#3{% first half-verse, connection, second half-verse
\noindent \hspace \a@hvind
\spreadbox \a@hvlen {#1}% first block
\spreadbox \a@hvsep {#2}% separator
\spreadbox \a@hvlen {#3}% second block
\par }

% macro for two half verses
\def \halfverses #1#2{% normal case
\connverses {#1}{\hfill}{#2}}

% make macros known to ArabTeX
\allowarab \halfverses
\allowarab \connverses
\all@wtw@ \setversedim
\all@w@ne \setspace

% define formatting of poetry, defaults
% do this within a group!

%\setversedim {2.0in}{0.3in}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% the following are patches for ArabTeX 3.06, otherwise harmless

\def \a@spreadbox #1{% {width}{text} get the text
\ifarab \putwordb@x {\spreadtrue \setspace {.3em plus .3fil}%
\a@sequence {#1}\setbox0 \lastbox \hbox to \a@bwidth {\unhbox0 }}%
\fi \a@spacefalse \a@showinput {#1}\test@token }

\def \a@fntext {% common part for footnote text
\footnotesize \hsize \columnwidth \@parboxrestore \clubpenalty 5000
\@makefntext {\rule {\z@ }{\footnotesep }}\futurelet \next \fo@t }

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode `\@ = \verseatcode
\endinput
%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%