summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/arabtex/verses.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/arabtex/verses.sty')
-rw-r--r--Master/texmf-dist/tex/latex/arabtex/verses.sty108
1 files changed, 69 insertions, 39 deletions
diff --git a/Master/texmf-dist/tex/latex/arabtex/verses.sty b/Master/texmf-dist/tex/latex/arabtex/verses.sty
index 629257bce6f..0849864662e 100644
--- a/Master/texmf-dist/tex/latex/arabtex/verses.sty
+++ b/Master/texmf-dist/tex/latex/arabtex/verses.sty
@@ -2,17 +2,42 @@
% 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
+% usage: load as a package, or after loading ArabTeX
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% (c) Klaus Lagally
-% Institut fuer Informatik
+% Institut fuer Formale Methoden der Informatik
% Universitaet Stuttgart
+% 08.02.2006
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% Usage:
+% (use within an Arabic environment)
+%
+% \setversedim #1#2 % define the layout (within a group):
+% #1 = length of both half-verses
+% #2 = separation distance = length of a connection, if present
+% Variant:
+% \setversedim #1[#2]#3 % for half-verses of unequal length
+% #1 = length of first (=right) half-verse
+% #2 = length of second (=left) half-verse
+% #3 = separation distance = length of a connection, if present
+%
+% \halfverses #1#2 % typeset two separated half-verses
+% #1 = text of first (=right) half-verse
+% #2 = text of second (=left) half-verse
+% Variant:
+% \halfverses #1[#2]#3 % typeset two connected half-verses
+% #1 = text of first (=right) half-verse
+% #2 = text of connection
+% #3 = text of second (=left) half-verse
+%
+% Alternative (if preferred):
+%
+% \connverses #1#2#3 % = \halfverses #1[#2]#3
+%
+% Note: use keshide to attach the connection, if required
+% Note: if the verses do not fit on the line, they will be put on
+% two lines, flush to the margins.
+%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifx \verseatcode \undefined \else \expandafter \endinput
@@ -20,57 +45,62 @@
\chardef \verseatcode = \catcode`\@ \catcode`\@ = 11
-\a@ident {verses.sty} {3.00 verses in two columns} {28.03.1998}
+\a@ident {verses.sty} {3.12 verses in two columns} {08.02.2006}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% define the layout, verses will be centered
+
+\newdimen \a@hvlen \newdimen \a@hvsep
+\newdimen \a@hvind \newdimen \a@@hvlen
-\newdimen \a@hvlen
-\newdimen \a@hvsep
-\newdimen \a@hvind
+\def \setversedim #1#2{% set lengths of half-verse, [separation]
+\ifx \LaTeX \undefined \a@hvind \hsize
+\else \a@hvind \textwidth \fi
+\a@hvlen #1\relax \advance \a@hvind -\a@hvlen
+\ifx [#2\def \next {\set@verseI [}\else
+\a@@hvlen \a@hvlen \def \next {\set@@verse {#2}}\fi \next }
-% 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 }
+\def \set@verseI [#1]{% optional parameter
+\a@@hvlen #1\relax \set@@verse }
+
+\def \set@@verse #1{% separation
+\advance \a@hvind -\a@@hvlen \a@hvsep #1\relax
+\advance \a@hvind -\a@hvsep \divide \a@hvind 2 }
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-% 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
+\cond{\ifdim 0pt > \a@hvind }%
+{\spreadbox \a@hvlen {#1}\\ \hfill }% first block
+{\noindent \hskip \a@hvind \relax \spreadbox \a@hvlen {#1}}\fi
\spreadbox \a@hvsep {#2}% separator
-\spreadbox \a@hvlen {#3}% second block
+\spreadbox \a@@hvlen {#3}% second block
+\tracingmacros 0
\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
+\def \a@c@halfverses #1#2{% optional parameter?
+%\tracingmacros 1
+\cond{\ifx [#2}{\half@verses {#1}[}%
+{\half@verses {#1}[\hfill]{#2}}\fi }
-% define formatting of poetry, defaults
+\def \half@verses #1[#2]#3{% first[mid]second
+\test@token \connverses {#1}{#2}{#3}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% define a default layout
% 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 }
+% make macros known to ArabTeX
+\allowarab \connverses \all@wtw@ \setversedim
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\catcode `\@ = \verseatcode
\endinput
%%%%%%%%%%%%%%%%%%%%%%%% EOF %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-