summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/bidi/bidipoem.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/bidi/bidipoem.sty')
-rw-r--r--Master/texmf-dist/tex/latex/bidi/bidipoem.sty110
1 files changed, 92 insertions, 18 deletions
diff --git a/Master/texmf-dist/tex/latex/bidi/bidipoem.sty b/Master/texmf-dist/tex/latex/bidi/bidipoem.sty
index 2a5be924c9b..9c3ba9306ea 100644
--- a/Master/texmf-dist/tex/latex/bidi/bidipoem.sty
+++ b/Master/texmf-dist/tex/latex/bidi/bidipoem.sty
@@ -14,12 +14,17 @@
%%
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{bidipoem}%
-[2010/07/25 Environments for typesetting Persian traditional and modern poems]
+[2012/12/12 v0.4 Environments for typesetting Persian traditional and modern poems]
\def\poemcolsepskip{.1\versewidth plus .1\versewidth minus .05\versewidth}
\def\poemmarginskip{1em plus 1fil minus 1em}
\def\poemextrabaselineskip{0\baselineskip}
\def\poemskip{\medskip}
-\def\poemblocksep{\quad$\Box$}
+\newcommand{\bidipoem@openbox}{\leavevmode
+ \hbox to.77778em{%
+ \hfil\vrule
+ \vbox to.675em{\hrule width.6em\vfil\hrule}%
+ \vrule\hfil}}
+\def\poemblocksep{\quad\hbox{\bidipoem@openbox}}
\newdimen\versewidth
\newtoks\bidipoem@p@ftn
\def\poem@verse#1{%
@@ -31,6 +36,7 @@
\fi
\fi
\hbox to\poem@width{\unhbox#1}%
+\global\bidipoem@p@ftn\expandafter{\expandafter}\the\bidipoem@p@ftn%
}
\def\poem@linebegin{\vadjust{}\hskip\@flushglue\hskip\poemmarginskip\relax}
\def\poem@lineend{\nobreak\hskip\poemmarginskip\hskip\@flushglue\vadjust{}}
@@ -46,8 +52,28 @@
}
\def\poem@lineparsebegin{%
\halign\bgroup
-\global\setbox\verse@i=\hbox{\ignorespaces##\unskip}&&
-\global\setbox\verse@ii=\hbox{\ignorespaces##\unskip}
+\global\setbox\verse@i=\hbox{%
+\let\@footnotetext\bidipoem@p@ftntext%
+\let\@LTRfootnotetext\bidipoem@p@LTRftntext%
+\let\@RTLfootnotetext\bidipoem@p@RTLftntext%
+\let\@xfootnotenext\bidipoem@p@xftntext%
+\let\@xfootnote\bidipoem@p@xfootnote%
+\let\@xLTRfootnotenext\bidipoem@p@xLTRftntext%
+\let\@xLTRfootnote\bidipoem@p@xLTRfootnote%
+\let\@xRTLfootnotenext\bidipoem@p@xRTLftntext%
+\let\@xRTLfootnote\bidipoem@p@xRTLfootnote%
+\ignorespaces##\unskip}&&
+\global\setbox\verse@ii=\hbox{%
+\let\@footnotetext\bidipoem@p@ftntext%
+\let\@LTRfootnotetext\bidipoem@p@LTRftntext%
+\let\@RTLfootnotetext\bidipoem@p@RTLftntext%
+\let\@xfootnotenext\bidipoem@p@xftntext%
+\let\@xfootnote\bidipoem@p@xfootnote%
+\let\@xLTRfootnotenext\bidipoem@p@xLTRftntext%
+\let\@xLTRfootnote\bidipoem@p@xLTRfootnote%
+\let\@xRTLfootnotenext\bidipoem@p@xRTLftntext%
+\let\@xRTLfootnote\bidipoem@p@xRTLfootnote%
+\ignorespaces##\unskip}
\cr
}
\def\poem@lineparseend{%
@@ -94,9 +120,6 @@
\global\versewidth=\poem@width
\poemskip\leavevmode\par
\begingroup
- \let\@footnotetext\bidipoem@p@ftntext
- \let\@LTRfootnotetext\bidipoem@p@LTRftntext
- \let\@RTLfootnotetext\bidipoem@p@RTLftntext
\tabskip=\z@
\parskip=\z@
\parindent=\z@
@@ -124,8 +147,6 @@
\fi\fi
\poem@lineparseend
\endgroup
- \the\bidipoem@p@ftn
- \global\bidipoem@p@ftn{}%
\par
\vskip\baselineskip
\poemskip
@@ -135,15 +156,47 @@
\poem@write@aux{poem@width@\romannumeral\c@poem@no}{\new@poem@width}%
\ifx\AtEndDocument\undefined\poem@finish\fi
}
+
\long\def\bidipoem@p@ftntext#1{%
- \edef\@tempx{\the\bidipoem@p@ftn\noexpand\footnotetext[\the\c@footnote]}%
+ \edef\@tempx{\the\bidipoem@p@ftn\noexpand\footnotetext[\the\csname c@\@mpfn\endcsname]}%
\global\bidipoem@p@ftn\expandafter{\@tempx{#1}}}%
\long\def\bidipoem@p@LTRftntext#1{%
- \edef\@tempxi{\the\bidipoem@p@ftn\noexpand\LTRfootnotetext[\the\c@footnote]}%
+ \edef\@tempxi{\the\bidipoem@p@ftn\noexpand\LTRfootnotetext[\the\csname c@\@mpfn\endcsname]}%
\global\bidipoem@p@ftn\expandafter{\@tempxi{#1}}}%
\long\def\bidipoem@p@RTLftntext#1{%
- \edef\@tempxii{\the\bidipoem@p@ftn\noexpand\RTLfootnotetext[\the\c@footnote]}%
+ \edef\@tempxii{\the\bidipoem@p@ftn\noexpand\RTLfootnotetext[\the\csname c@\@mpfn\endcsname]}%
\global\bidipoem@p@ftn\expandafter{\@tempxii{#1}}}%
+
+\long\def\bidipoem@p@xftntext[#1]#2{%
+ \global\bidipoem@p@ftn\expandafter{\the\bidipoem@p@ftn\footnotetext[#1]{#2}}}
+
+\long\def\bidipoem@p@xLTRftntext[#1]#2{%
+ \global\bidipoem@p@ftn\expandafter{\the\bidipoem@p@ftn\LTRfootnotetext[#1]{#2}}}
+
+\long\def\bidipoem@p@xRTLftntext[#1]#2{%
+ \global\bidipoem@p@ftn\expandafter{\the\bidipoem@p@ftn\RTLfootnotetext[#1]{#2}}}
+
+\def\bidipoem@p@xfootnote[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotemark\bidipoem@p@xftntext[#1]}
+
+\def\bidipoem@p@xLTRfootnote[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotemark\bidipoem@p@xLTRftntext[#1]}
+
+\def\bidipoem@p@xRTLfootnote[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotemark\bidipoem@p@xRTLftntext[#1]}
+
\newenvironment{traditionalpoem}{\@traditionalpoem}{\@endtraditionalpoem}
\expandafter\def\csname traditionalpoem*\endcsname{\let\poem@obeylines=\obeylines\traditionalpoem}
\expandafter\def\csname endtraditionalpoem*\endcsname{\endtraditionalpoem}
@@ -167,9 +220,6 @@
\def\@modernpoem{%
\par
\begingroup
- \let\@footnotetext\bidipoem@p@ftntext
- \let\@LTRfootnotetext\bidipoem@p@LTRftntext
- \let\@RTLfootnotetext\bidipoem@p@RTLftntext
\parskip=\z@
\parindent=\z@
\def\[{\@settab\@tabplus\ignorespaces}%
@@ -201,15 +251,39 @@
\ifpoem@started\else\let\@stopline\@stopfield\fi
\end{tabbing}%
\endgroup
- \the\bidipoem@p@ftn
- \global\bidipoem@p@ftn{}%
\par
}
\newenvironment{modernpoem}{\@modernpoem}{\@endmodernpoem}
\expandafter\def\csname modernpoem*\endcsname{\let\poem@obeylines=\obeylines\modernpoem}
\expandafter\def\csname endmodernpoem*\endcsname{\endmodernpoem}
+\gdef\@startfield{%
+\global\setbox\@curfield\hbox\bgroup%
+\let\@footnotetext\bidipoem@p@ftntext%
+\let\@LTRfootnotetext\bidipoem@p@LTRftntext%
+\let\@RTLfootnotetext\bidipoem@p@RTLftntext%
+\let\@xfootnotenext\bidipoem@p@xftntext%
+\let\@xfootnote\bidipoem@p@xfootnote%
+\let\@xLTRfootnotenext\bidipoem@p@xLTRftntext%
+\let\@xLTRfootnote\bidipoem@p@xLTRfootnote%
+\let\@xRTLfootnotenext\bidipoem@p@xRTLftntext%
+\let\@xRTLfootnote\bidipoem@p@xRTLfootnote%
+\color@begingroup}
+\gdef\@stopfield{%
+ \color@endgroup\egroup\global\bidipoem@p@ftn\expandafter{\expandafter}\the\bidipoem@p@ftn}
+\gdef\@contfield{%
+\global\setbox\@curfield\hbox\bgroup%
+\let\@footnotetext\bidipoem@p@ftntext%
+\let\@LTRfootnotetext\bidipoem@p@LTRftntext%
+\let\@RTLfootnotetext\bidipoem@p@RTLftntext%
+\let\@xfootnotenext\bidipoem@p@xftntext%
+\let\@xfootnote\bidipoem@p@xfootnote%
+\let\@xLTRfootnotenext\bidipoem@p@xLTRftntext%
+\let\@xLTRfootnote\bidipoem@p@xLTRfootnote%
+\let\@xRTLfootnotenext\bidipoem@p@xRTLftntext%
+\let\@xRTLfootnote\bidipoem@p@xRTLfootnote%
+\color@begingroup\unhbox\@curfield}
%%
-%% Copyright © 2009–2012 Vafa Khalighi <vafakhlg@gmail.com>
+%% Copyright © 2009–2012 Vafa Khalighi <vafak12@gmail.com>
%%
%% It may be distributed and/or modified under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of