%%%%%%%%%%%%%%%%%%%%%%%%%%% 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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

