summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty')
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty35
1 files changed, 33 insertions, 2 deletions
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty b/Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty
index 55370db5242..423fb044fd4 100644
--- a/Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidipoem.sty
@@ -17,7 +17,7 @@
%% by Vafa Khalighi.
%%
%%
-%% \CheckSum{44160}
+%% \CheckSum{44308}
%% \CharacterTable
%% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
%% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
@@ -36,7 +36,38 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bidipoem}%
-[2014/02/05 v0.7 Environments for typesetting Persian traditional and modern poems]
+[2014/04/25 v0.8 Environments for typesetting Persian traditional and modern poems]
+\newcommand*{\bidipoem@spreadbox}[2]{\hbox to #1{#2}}
+
+
+\newdimen \bidipoem@hvlen \newdimen \bidipoem@hvsep
+\newdimen \bidipoem@hvind \newdimen \bidipoem@@hvlen
+
+\newcommand*{\Setversedim}[2]{% set lengths of half-verse, [separation]
+\bidipoem@hvind \textwidth
+\bidipoem@hvlen #1\relax \advance \bidipoem@hvind -\bidipoem@hvlen
+\ifx [#2\def \bidipoem@next {\bidipoem@set@verseI [}\else
+\bidipoem@@hvlen \bidipoem@hvlen \def \bidipoem@next {\bidipoem@set@@verse {#2}}\fi \bidipoem@next }
+
+\def \bidipoem@set@verseI [#1]{% optional parameter
+\bidipoem@@hvlen #1\relax \bidipoem@set@@verse }
+
+\newcommand*{\bidipoem@set@@verse}[1]{% separation
+\advance \bidipoem@hvind -\bidipoem@@hvlen \bidipoem@hvsep #1\relax
+\advance \bidipoem@hvind -\bidipoem@hvsep \divide \bidipoem@hvind 2 }
+
+\newcommand*{\traditionalconnverses}[3]{% first half-verse, connection, second half-verse
+\ifdim 0pt > \bidipoem@hvind %
+\bidipoem@spreadbox \bidipoem@hvlen {#1}\\ \hfill % first block
+\else
+\noindent \hskip \bidipoem@hvind \relax \bidipoem@spreadbox \bidipoem@hvlen {#1}\fi
+\bidipoem@spreadbox \bidipoem@hvsep {#2}% separator
+\bidipoem@spreadbox \bidipoem@@hvlen {#3}% second block
+\par }
+
+\newcommand*{\traditionalhalfverses}[2]{% normal case
+\traditionalconnverses {#1}{\hfill}{#2}}
+
{\catcode`\^^M=\active % these lines must end with %
\gdef\traditionalpoem@obeylines{\catcode`\^^M\active \let^^M\traditionalpoem@par}%
\global\let^^M\traditionalpoem@par} % this is in case ^^M appears in a \write