summaryrefslogtreecommitdiff
path: root/Master
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2009-07-17 00:57:54 +0000
committerKarl Berry <karl@freefriends.org>2009-07-17 00:57:54 +0000
commit50e41b53ae966ed159cdb3fde4b26e0f6ce317fe (patch)
tree73d13d3ccb3cadc7dda9385875bf44b4e89b7915 /Master
parent6daa627c7cb7dfd9e78504d4641c87a0d4248724 (diff)
bidi 1.0.1 (14jul09)
git-svn-id: svn://tug.org/texlive/trunk@14288 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master')
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/README15
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/README.txt15
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/bidi.pdfbin148638 -> 0 bytes
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/beamer-sample.tex94
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/bidicasual-samplecv.tex71
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/bidiclassic-samplecv.tex71
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/bidisample2e.tex199
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/bidismall2e.tex33
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/gull.jpgbin0 -> 761651 bytes
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/picture.jpgbin0 -> 1693 bytes
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/presentation-sample.tex53
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test-bidi.tex43
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test-supertabular.tex116
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test-tabular.tex63
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test-tabularx.tex40
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test-tabulary.tex30
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test1-wrapfig.tex40
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test2-wrapfig.tex28
-rw-r--r--Master/texmf-dist/doc/xelatex/bidi/examples/test3-wrapfig.tex77
-rw-r--r--Master/texmf-dist/source/xelatex/bidi/bidi.dtx18806
-rw-r--r--Master/texmf-dist/source/xelatex/bidi/bidi.ins30
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/amsart-bidi.def67
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/amsbook-bidi.def77
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/amsthm-bidi.def30
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/array-bidi.def111
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/article-bidi.def130
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/beamerthemebidiJLTree.sty133
-rwxr-xr-xMaster/texmf-dist/tex/xelatex/bidi/bibitem.pdfbin0 -> 2936 bytes
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidi.sty617
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidi2in1.sty86
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidibeamer-bidi.def395
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidibeamer.cls370
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidibeamerbaseauxtemplates.sty693
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidibeamerbasetemplates.sty139
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidicode.sty166
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidimemoir.cls11674
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidimoderncv.cls275
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bidipresentation.cls102
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/book-bidi.def149
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/bookest-bidi.def93
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/cvthemebidicasual.sty118
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/cvthemebidiclassic.sty130
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/draftwatermark-bidi.def31
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/extbook-bidi.def148
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/fancyhdr-bidi.def39
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/footnote-bidi.def230
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def43
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/listings-bidi.def37
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/longtable-bidi.def138
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/minitoc-bidi.def66
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/pdfpages-bidi.def76
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/pstricks-bidi.def30
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/ragged2e-bidi.def114
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/rapport3-bidi.def119
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/refrep-bidi.def54
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/report-bidi.def134
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/scrartcl-bidi.def102
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/scrbook-bidi.def158
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/scrreprt-bidi.def115
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/stabular-bidi.def55
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/tabls-bidi.def63
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/tikz-bidi.def33
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/tocloft-bidi.def335
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/tocstyle-bidi.def274
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/wrapfig-bidi.def104
-rw-r--r--Master/texmf-dist/tex/xelatex/bidi/xltxtra-bidi.def33
66 files changed, 36841 insertions, 1069 deletions
diff --git a/Master/texmf-dist/doc/xelatex/bidi/README b/Master/texmf-dist/doc/xelatex/bidi/README
deleted file mode 100644
index 10be4bc9dfd..00000000000
--- a/Master/texmf-dist/doc/xelatex/bidi/README
+++ /dev/null
@@ -1,15 +0,0 @@
-------------------------
-THE BIDI PACKAGE v0.3
-
-This package provides a convenient interface for typesetting
-bidirectional texts with XeLaTeX.
-
-This version adds support for tabular environments and captions
-and brings several other improvements and bugfixes.
-
-The code for alphabetic numerals has been moved to the relevant
-"language definition files" of the new polyglossia package.
-
---------------
-François Charette
-July 2008
diff --git a/Master/texmf-dist/doc/xelatex/bidi/README.txt b/Master/texmf-dist/doc/xelatex/bidi/README.txt
new file mode 100644
index 00000000000..0f0f19314f5
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/README.txt
@@ -0,0 +1,15 @@
+_________________
+The bidi package
+v1.0.1
+
+This package provides a convenient interface for typesetting
+bidirectional texts with XeLaTeX.
+
+This version fixes all known bugs and adds heaps of new things.
+
+______________
+Vafa Khalighi
+vafa@users.berlios.de
+
+Copyright 2007-2009
+Distributed under the LaTeX Project Public License
diff --git a/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf b/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf
deleted file mode 100644
index 38634faca84..00000000000
--- a/Master/texmf-dist/doc/xelatex/bidi/bidi.pdf
+++ /dev/null
Binary files differ
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/beamer-sample.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/beamer-sample.tex
new file mode 100644
index 00000000000..481e2c8770b
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/beamer-sample.tex
@@ -0,0 +1,94 @@
+\documentclass{beamer}
+\usetheme{Warsaw}
+\usepackage{fontspec}
+\setmainfont[Script=Arabic,Mapping=farsidigits]{XB Niloofar}
+\def\familydefault{\rmdefault}
+\newfontfamily\rmfamily[Mapping=tex-text]{Linux Libertine}
+\usepackage{bidi}
+\newenvironment{latin}{\begin{LTR}\rmfamily}{\end{LTR}}
+\def\biditheoremname{قضیه}
+\def\bidicorollaryname{نتیجه}
+\def\bidifactname{حقیقت}
+\def\bidilemmaname{لم}
+\def\bidiproblemname{مسئله}
+\def\bidisolutionname{پاسخ}
+\def\bididefinitionname{تعریف}
+\def\bididefinitionsname{تعریف‌ها}
+\def\bidiexamplename{مثال}
+\def\bidiexamplesname{مثال‌ها}
+\def\bidiproofname{اثبات}
+\title{عنوان اسلاید}
+\subtitle{این یک زیرعنوان است}
+\author{وفا خلیقی}
+\institute{دانشگاه تهران}
+\begin{document}
+\begin{frame}
+\titlepage
+\end{frame}
+
+\begin{frame}{این یک عنوان است}
+\framesubtitle{این زیرعنوان است}
+\begin{bidiexample}
+در این مثال به برسی توابعی خواهیم پرداخت که برای ما قابل استفاده هستند:
+\begin{equation}
+(x-y)^2=x^2-2xy+y^2
+\end{equation}
+\end{bidiexample}
+\begin{bidisolution}
+این یک پاسخ است
+\end{bidisolution}
+\begin{bidiproblem}
+این یک مسئله است.
+\end{bidiproblem}
+\end{frame}
+\begin{frame}{ادامهٔ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+\begin{biditheorem}
+این یک قضیه است.
+\end{biditheorem}
+\begin{bidiproof}
+این یک اثبات است
+\end{bidiproof}
+\begin{bidicorollary}
+این یک نتیجه است
+\end{bidicorollary}
+\begin{bidifact}
+این یک حقیقت است
+\end{bidifact}
+\end{frame}
+\begin{frame}{ادامهّ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+\begin{bidilemma}
+این یک لم است
+\end{bidilemma}
+\begin{bididefinition}
+این یک تعریف است
+\end{bididefinition}
+\begin{bididefinitions}
+این محیط مخصوص بیشتر از یک تعریف است
+\end{bididefinitions}
+\begin{bidiexamples}
+این محیط مخصوص بیشتر از یک مثال است.
+\end{bidiexamples}
+\end{frame}
+\begin{frame}{ادامهّ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+\begin{bidiblock}{محیط بلوک}
+این محیط بلوک است
+\end{bidiblock}
+\begin{bidiexampleblock}{محیط بلوک مثال}
+این محیط بلوک مثال است
+\end{bidiexampleblock}
+\begin{bidialertblock}{محیط بلوک هشدار}
+این محیط بلوک هشدار است.
+\end{bidialertblock}
+\end{frame}
+\begin{frame}{ادامهّ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+این هم مقداری متن معمولی می‌نویسم تا بتوانم به خط بعدی بروم و ببینم که آیا واقعاً \lr{beamer} دست از لجاجت برمی‌دارد یا نه
+\begin{latin}
+This is an English paragraph that I am writing here to see what happens after this, will I get a new bug or I am lucky enough?
+\end{latin}
+این دوباره متنی است فارسی که من آن را می‌نویسم و هنوز در حال آزمایش هستم تا بتوانم به خط بعدی بروم و نتیجه را مشاهده کنم.
+\end{frame}
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/bidicasual-samplecv.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/bidicasual-samplecv.tex
new file mode 100644
index 00000000000..0b5e36c0b70
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/bidicasual-samplecv.tex
@@ -0,0 +1,71 @@
+\documentclass[11pt,a4paper]{bidimoderncv}
+\cvtheme[red]{bidicasual} % you can use orange, red, green and blue as options
+\usepackage[scale=0.8]{geometry}
+\usepackage{fontspec}
+\usepackage[RTLdocument]{bidi}
+\def\refname{تألیفات}
+\setmainfont[Script=Arabic,Mapping=parsidigits]{XB Niloofar}
+\newfontfamily\rmfamily[Mapping=tex-text]{Linux Libertine}
+\AtBeginDocument{\recomputelengths}
+\resumename{رزومه}
+\firstname{سید محمد}
+\familyname{یزدی اصفهانی}
+\title{رزومهٔ من}
+\address{تهران، خیابان آزادی پلاک ۹}
+\mobile{۰۹۱۸۹۶۹۴۹۶}
+\phone{۹۸۹۰۸۳۴۱}
+\fax{۹۸۹۰۸۳۴۲}
+\email{vafa@users.berlios.de}
+\extrainfo{اطلاعات اضافی}
+\photo[64pt]{picture}
+\quote{نقل قول}
+\begin{document}
+\maketitle
+\section{تحصیلات}
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+
+\section{پایان‌نامهٔ کارشناسی ارشد}
+\cvline{عنوان}{\emph{عنوان}}
+\cvline{استاد راهنما}{استاد راهنما}
+\cvline{توضیح}{\small چکیده کوچک پایان‌نامه}
+
+\section{تجربیات}
+\subsection{عنوان}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\subsection{متفرقه}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح خط ۱\newline{}توضیح خط ۲}% arguments 3 to 6 are optional
+
+\section{زبانها}
+\cvlanguage{زبان ۱}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۲}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۳}{درجه مهارت}{نظر}
+
+\section{مهارتهای رایانه‌ای}
+\cvcomputer{طبقه ۱}{یک، دو، سه}{طبقه ۴}{یک، دو، سه}
+\cvcomputer{طبقه ۲}{یک، دو، سه}{طبقه ۵}{یک، دو، سه}
+\cvcomputer{طبقه ۳}{یک، دو، سه}{طبقه ۶}{یک، دو، سه}
+
+\section{علاقه‌ها}
+\cvline{علاقه ۱}{\small توضیح}
+\cvline{علاقه ۲}{\small توضیح}
+\cvline{علاقه ۳}{\small توضیح}
+
+\renewcommand{\listitemsymbol}{-} % change the symbol for lists
+
+\section{بعدی ۱}
+\cvlistitem{شماره ۱}
+\cvlistitem{شماره ۲}
+\cvlistitem[+]{شماره ۳} % optional other symbol
+
+\section{بعدی ۲}
+\cvlistdoubleitem[\Neutral]{شماره ۱}{شماره ۴}
+\cvlistdoubleitem[\Neutral]{شماره ۲}{شماره ۵}
+\cvlistdoubleitem[\Neutral]{شماره ۳}{}
+
+\nocite{*}
+\bibliographystyle{plain}
+\bibliography{publications} % 'publications' is the name of a BibTeX file
+
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/bidiclassic-samplecv.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/bidiclassic-samplecv.tex
new file mode 100644
index 00000000000..f32b59bad1a
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/bidiclassic-samplecv.tex
@@ -0,0 +1,71 @@
+\documentclass[11pt,a4paper]{bidimoderncv}
+\cvtheme[orange]{bidiclassic} % you can use orange, red, green, grey and blue as options
+\usepackage[scale=0.8]{geometry}
+\usepackage{fontspec}
+\setmainfont[Script=Arabic,Mapping=parsidigits]{XB Zar}
+\newfontfamily\rmfamily[Mapping=tex-text]{Linux Libertine}
+\def\refname{تألیفات}
+\usepackage[RTLdocument]{bidi}
+\AtBeginDocument{\recomputelengths}
+\resumename{رزومه}
+\firstname{وفا}
+\familyname{خلیقی}
+\title{رزومهٔ من}
+\address{تهران، خیابان آزادی پلاک ۹}
+\mobile{۰۹۱۸۹۶۹۴۹۶}
+\phone{۹۸۹۰۸۳۴۱}
+\fax{۹۸۹۰۸۳۴۲}
+\email{me@you.com}
+\extrainfo{اطلاعات اضافی}
+\photo[64pt]{picture}
+\quote{نقل قول}
+\begin{document}
+\maketitle
+\section{تحصیلات}
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+
+\section{پایان‌نامهٔ کارشناسی ارشد}
+\cvline{عنوان}{\emph{عنوان}}
+\cvline{استاد راهنما}{استاد راهنما}
+\cvline{توضیح}{\small چکیده کوچک پایان‌نامه}
+
+\section{تجربیات}
+\subsection{عنوان}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\subsection{متفرقه}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح خط ۱\newline{}توضیح خط ۲}% arguments 3 to 6 are optional
+
+\section{زبانها}
+\cvlanguage{زبان ۱}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۲}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۳}{درجه مهارت}{نظر}
+
+\section{مهارتهای رایانه‌ای}
+\cvcomputer{طبقه ۱}{یک، دو، سه}{طبقه ۴}{یک، دو، سه}
+\cvcomputer{طبقه ۲}{یک، دو، سه}{طبقه ۵}{یک، دو، سه}
+\cvcomputer{طبقه ۳}{یک، دو، سه}{طبقه ۶}{یک، دو، سه}
+
+\section{علاقه‌ها}
+\cvline{علاقه ۱}{\small توضیح}
+\cvline{علاقه ۲}{\small توضیح}
+\cvline{علاقه ۳}{\small توضیح}
+
+\renewcommand{\listitemsymbol}{-} % change the symbol for lists
+
+\section{بعدی ۱}
+\cvlistitem{شماره ۱}
+\cvlistitem{شماره ۲}
+\cvlistitem[+]{شماره ۳} % optional other symbol
+
+\section{بعدی ۲}
+\cvlistdoubleitem[\Neutral]{شماره ۱}{شماره ۴}
+\cvlistdoubleitem[\Neutral]{شماره ۲}{شماره ۵}
+\cvlistdoubleitem[\Neutral]{شماره ۳}{}
+
+\nocite{*}
+\bibliographystyle{plain}
+\bibliography{publications} % 'publications' is the name of a BibTeX file
+
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/bidisample2e.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/bidisample2e.tex
new file mode 100644
index 00000000000..4f791ead282
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/bidisample2e.tex
@@ -0,0 +1,199 @@
+
+\documentclass{article} % Specifies the document class
+\usepackage[RTLdocument]{bidi}
+ % The preamble begins here.
+\title{An Example Document} % Declares the document's title.
+\author{Leslie Lamport} % Declares the author's name.
+\date{January 21, 1994} % Deleting this command produces today's date.
+
+\newcommand{\ip}[2]{(#1, #2)}
+ % Defines \ip{arg1}{arg2} to mean
+ % (arg1, arg2).
+
+ % This is an alternative definition of
+ % \ip that is commented out.
+
+\begin{document} % End of preamble and beginning of text.
+
+\maketitle % Produces the title.
+
+This is an example input file. Comparing it with
+the output it generates can show you how to
+produce a simple document of your own.
+
+\section{Ordinary Text} % Produces section heading. Lower-level
+ % sections are begun with similar
+ % \subsection and \subsubsection commands.
+
+The ends of words and sentences are marked
+ by spaces. It doesn't matter how many
+spaces you type; one is as good as 100. The
+end of a line counts as a space.
+
+One or more blank lines denote the end
+of a paragraph.
+
+Since any number of consecutive spaces are treated
+like a single one, the formatting of the input
+file makes no difference to
+ \LaTeX, % The \LaTeX command generates the LaTeX logo.
+but it makes a difference to you. When you use
+\LaTeX, making your input file as easy to read
+as possible will be a great help as you write
+your document and when you change it. This sample
+file shows how you can add comments to your own input
+file.
+
+Because printing is different from typewriting,
+there are a number of things that you have to do
+differently when preparing an input file than if
+you were just typing the document directly.
+Quotation marks like
+ ``this''
+have to be handled specially, as do quotes within
+quotes:
+ ``\,`this' % \, separates the double and single quote.
+ is what I just
+ wrote, not `that'\,''.
+
+Dashes come in three sizes: an
+ intra-word
+dash, a medium dash for number ranges like
+ 1--2,
+and a punctuation
+ dash---like
+this.
+
+A sentence-ending space should be larger than the
+space between words within a sentence. You
+sometimes have to type special commands in
+conjunction with punctuation characters to get
+this right, as in the following sentence.
+ Gnats, gnus, etc.\ all % `\ ' makes an inter-word space.
+ begin with G\@. % \@ marks end-of-sentence punctuation.
+You should check the spaces after periods when
+reading your output to make sure you haven't
+forgotten any special cases. Generating an
+ellipsis
+ \ldots\ % `\ ' is needed after `\ldots' because TeX
+ % ignores spaces after command names like \ldots
+ % made from \ + letters.
+ %
+ % Note how a `%' character causes TeX to ignore
+ % the end of the input line, so these blank lines
+ % do not start a new paragraph.
+ %
+with the right spacing around the periods requires
+a special command.
+
+\LaTeX\ interprets some common characters as
+commands, so you must type special commands to
+generate them. These characters include the
+following:
+ \$ \& \% \# \{ and \}.
+
+In printing, text is usually emphasized with an
+ \emph{italic}
+type style.
+
+\begin{em}
+ A long segment of text can also be emphasized
+ in this way. Text within such a segment can be
+ given \emph{additional} emphasis.
+\end{em}
+
+It is sometimes necessary to prevent \LaTeX\ from
+breaking a line where it might otherwise do so.
+This may be at a space, as between the ``Mr.''\ and
+``Jones'' in
+ ``Mr.~Jones'', % ~ produces an unbreakable interword space.
+or within a word---especially when the word is a
+symbol like
+ \mbox{\emph{itemnum}}
+that makes little sense when hyphenated across
+lines.
+
+Footnotes\footnote{This is an example of a footnote.}
+pose no problem.
+
+\LaTeX\ is good at typesetting mathematical formulas
+like
+ \( x-3y + z = 7 \)
+or
+ \( a_{1} > x^{2n} + y^{2n} > x' \)
+or
+ \( \ip{A}{B} = \sum_{i} a_{i} b_{i} \).
+The spaces you type in a formula are
+ignored. Remember that a letter like
+ $x$ % $ ... $ and \( ... \) are equivalent
+is a formula when it denotes a mathematical
+symbol, and it should be typed as one.
+
+\section{Displayed Text}
+
+Text is displayed by indenting it from the left
+margin. Quotations are commonly displayed. There
+are short quotations
+\begin{quote}
+ This is a short quotation. It consists of a
+ single paragraph of text. See how it is formatted.
+\end{quote}
+and longer ones.
+\begin{quotation}
+ This is a longer quotation. It consists of two
+ paragraphs of text, neither of which are
+ particularly interesting.
+
+ This is the second paragraph of the quotation. It
+ is just as dull as the first paragraph.
+\end{quotation}
+Another frequently-displayed structure is a list.
+The following is an example of an \emph{itemized}
+list.
+\begin{itemize}
+ \item This is the first item of an itemized list.
+ Each item in the list is marked with a ``tick''.
+ You don't have to worry about what kind of tick
+ mark is used.
+
+ \item This is the second item of the list. It
+ contains another list nested inside it. The inner
+ list is an \emph{enumerated} list.
+ \begin{enumerate}
+ \item This is the first item of an enumerated
+ list that is nested within the itemized list.
+
+ \item This is the second item of the inner list.
+ \LaTeX\ allows you to nest lists deeper than
+ you really should.
+ \end{enumerate}
+ This is the rest of the second item of the outer
+ list. It is no more interesting than any other
+ part of the item.
+ \item This is the third item of the list.
+\end{itemize}
+You can even display poetry.
+\begin{verse}
+ There is an environment
+ for verse \\ % The \\ command separates lines
+ Whose features some poets % within a stanza.
+ will curse.
+
+ % One or more blank lines separate stanzas.
+
+ For instead of making\\
+ Them do \emph{all} line breaking, \\
+ It allows them to put too many words on a line when they'd rather be
+ forced to be terse.
+\end{verse}
+
+Mathematical formulas may also be displayed. A
+displayed formula
+is
+one-line long; multiline
+formulas require special formatting instructions.
+ \[ \ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\]
+Don't start a paragraph with a displayed equation,
+nor make one a paragraph by itself.
+
+\end{document} % End of document.
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/bidismall2e.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/bidismall2e.tex
new file mode 100644
index 00000000000..16a02e49240
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/bidismall2e.tex
@@ -0,0 +1,33 @@
+
+
+
+\documentclass{article} % Your input file must contain these two lines
+\usepackage[RTLdocument]{bidi}
+\begin{document} % plus the \end{document} command at the end.
+
+\section{Simple Text} % This command makes a section title.
+
+Words are separated by one or more spaces. Paragraphs are separated by
+one or more blank lines. The output is not affected by adding extra
+spaces or extra blank lines to the input file.
+
+Double quotes are typed like this: ``quoted text''.
+Single quotes are typed like this: `single-quoted text'.
+
+Long dashes are typed as three dash characters---like this.
+
+Emphasized text is typed like this: \emph{this is emphasized}.
+Bold text is typed like this: \textbf{this is bold}.
+
+\subsection{A Warning or Two} % This command makes a subsection title.
+
+If you get too much space after a mid-sentence period---abbreviations
+like etc.\ are the common culprits)---then type a backslash followed by
+a space after the period, as in this sentence.
+
+Remember, don't type the 10 special characters (such as dollar sign and
+backslash) except as directed! The following seven are printed by
+typing a backslash in front of them: \$ \& \# \% \_ \{ and \}.
+The manual tells how to make other symbols.
+
+\end{document} % The input file ends with this command.
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/gull.jpg b/Master/texmf-dist/doc/xelatex/bidi/examples/gull.jpg
new file mode 100644
index 00000000000..a77d1bd3421
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/gull.jpg
Binary files differ
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/picture.jpg b/Master/texmf-dist/doc/xelatex/bidi/examples/picture.jpg
new file mode 100644
index 00000000000..ef48e69ce85
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/picture.jpg
Binary files differ
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/presentation-sample.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/presentation-sample.tex
new file mode 100644
index 00000000000..d95b3c41131
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/presentation-sample.tex
@@ -0,0 +1,53 @@
+\documentclass[12pt,twoside]{bidipresentation}
+\usepackage{eso-pic}
+\usepackage{graphicx}
+\usepackage{fontspec}
+\setmainfont[Script=Arabic,Mapping=farsidigits]{XB Niloofar}
+\newfontfamily\rmfamily[Mapping=tex-text]{XB Niloofar}
+\usepackage[RTLdocument]{bidi}
+\pagestyle{pres}
+\AddToShipoutPicture{
+\includegraphics{gradient.png}
+}
+
+\begin{document}
+\begin{titlepage}
+\distance{1}
+\centering \LARGE
+ \bfseries عنوان اسلاید
+
+\distance{1}
+\large
+وفا خلیقی\\[1ex]نام دانشگاه
+\distance{2}
+\end{titlepage}
+
+\begin{plainslide}[این عنوان یک صفحه است.]
+این اولین صفحه اسلاید ما است که من در حال نوشتن آن هستم و کمی بیشتر می‌نویسم تا به خط بعدی بروم
+\footnote{این یک زیرنویس فارسی است.}\LTRfootnote{This is an English footnote.}
+\begin{equation}
+(a+b)^2=a^2+2ab+b^2
+\end{equation}
+\begin{itemize}
+ \item یک
+ \item دو
+\end{itemize}
+
+\begin{enumerate}
+ \item یک
+ \item دو
+\end{enumerate}
+
+\begin{description}
+ \item [یک:] اولین عدد
+ \item [دو:] دومین عدد
+\end{description}
+
+\end{plainslide}
+\begin{rawslide}
+دومین صفحه
+
+\end{rawslide}
+
+\end{document}
+
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test-bidi.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test-bidi.tex
new file mode 100644
index 00000000000..e81a1dc599b
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test-bidi.tex
@@ -0,0 +1,43 @@
+\documentclass{article}
+\usepackage{bidi}
+\title{Testing Basic Bidi Direction Change}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+In this document we test bidi direction change in \textsf{RTL} and \textsf{LTR}. These tests includes \texttt{flushleft}, \texttt{flushright} environments and \verb|\centerline{...}|, \verb|\leftline{...}|,\verb|\rightline{...}|,\verb|\raggedleft| and \verb|\raggedright| macros.
+\section{RTL Test}
+\setRTL
+\begin{flushleft}
+This is left in RTL
+\end{flushleft}
+\begin{flushright}
+This is right in RTL
+\end{flushright}
+\centerline{This is center in RTL}
+
+\leftline{This is left in RTL}
+
+\rightline{This is right in RTL}
+
+\raggedleft This is raggedleft in RTL
+
+\raggedright This is raggedright in RTL
+
+\setLTR
+\section{LTR Test}
+\begin{flushleft}
+This is left in LTR
+\end{flushleft}
+\begin{flushright}
+This is right in LTR
+\end{flushright}
+\centerline{This is center in LTR}
+
+\leftline{This is left in LTR}
+
+\rightline{This is right in LTR}
+
+\raggedleft This is raggedleft in LTR
+
+\raggedright This is raggedright in LTR
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test-supertabular.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test-supertabular.tex
new file mode 100644
index 00000000000..5e43860b849
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test-supertabular.tex
@@ -0,0 +1,116 @@
+\documentclass{article}
+\usepackage{supertabular}
+\usepackage{bidi}
+\title{Testing \textsf{supertabular} package in RTL and LTR}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+\section{LTR}
+\tablecaption{The ISOGRK3 entity set}
+\tablehead
+ {\bfseries Entity&\bfseries Unicode Name&\bfseries Unicode\\ \hline}
+\tabletail
+ {\hline \multicolumn{3}{r}{\emph{Continued on next page}}\\}
+\tablelasttail{\hline}
+\begin{supertabular}{lll}
+alpha & GREEK SMALL LETTER ALPHA & 03B1\\
+beta & GREEK SMALL LETTER BETA & 03B2\\
+chi & GREEK SMALL LETTER CHI & 03C7\\
+Delta & GREEK CAPITAL LETTER DELTA & 0394\\
+delta & GREEK SMALL LETTER DELTA & 03B4\\
+epsi & GREEK SMALL LETTER EPSILON & 03B5\\
+epsis & GREEK LUNATE EPSILON SYMBOL & 03F5\\
+\empty
+epsiv & GREEK SMALL LETTER EPSILON & 03B5\\
+eta & GREEK SMALL LETTER ETA & 03B7\\
+Gamma & GREEK CAPITAL LETTER GAMMA & 0393\\
+gamma & GREEK SMALL LETTER GAMMA & 03B3\\
+gammad & GREEK SMALL LETTER DIGAMMA & 03DD\\
+iota & GREEK SMALL LETTER IOTA & 03B9\\
+kappa & GREEK SMALL LETTER KAPPA & 03BA\\
+kappav & GREEK KAPPA SYMBOL & 03F0\\
+Lambda & GREEK CAPITAL LETTER LAMDA & 039B\\
+lambda & GREEK SMALL LETTER LAMDA & 03BB\\
+mu & GREEK SMALL LETTER MU & 03BC\\
+nu & GREEK SMALL LETTER NU & 03BD\\
+Omega & GREEK CAPITAL LETTER OMEGA & 03A9\\
+omega & GREEK SMALL LETTER OMEGA & 03C9\\
+Phi & GREEK CAPITAL LETTER PHI & 03A6\\
+phis & GREEK PHI SYMBOL & 03D5\\
+phiv & GREEK SMALL LETTER PHI & 03C6\\
+Pi & GREEK CAPITAL LETTER PI & 03A0\\
+pi & GREEK SMALL LETTER PI & 03C0\\
+piv & GREEK PI SYMBOL & 03D6\\
+Psi & GREEK CAPITAL LETTER PSI & 03A8\\
+psi & GREEK SMALL LETTER PSI & 03C8\\
+rho & GREEK SMALL LETTER RHO & 03C1\\
+rhov & GREEK RHO SYMBOL & 03F1\\
+Sigma & GREEK CAPITAL LETTER SIGMA & 03A3\\
+sigma & GREEK SMALL LETTER SIGMA & 03C3\\
+sigmav & GREEK SMALL LETTER FINAL SIGMA & 03C2\\
+tau & GREEK SMALL LETTER TAU & 03C4\\
+Theta & GREEK CAPITAL LETTER THETA & 0398\\
+thetas & GREEK SMALL LETTER THETA & 03B8\\
+thetav & GREEK THETA SYMBOL & 03D1\\
+Upsi & GREEK UPSILON WITH HOOK SYMBOL & 03D2\\
+upsi & GREEK SMALL LETTER UPSILON & 03C5\\
+Xi & GREEK CAPITAL LETTER XI & 039E\\
+xi & GREEK SMALL LETTER XI & 03BE\\
+zeta & GREEK SMALL LETTER ZETA & 03B6\\
+\end{supertabular}
+\section{RTL}
+
+\setRTL
+\tablecaption{The ISOGRK3 entity set}
+\tablehead
+ {\bfseries Entity&\bfseries Unicode Name&\bfseries Unicode\\ \hline}
+\tabletail
+ {\hline \multicolumn{3}{r}{\emph{Continued on next page}}\\}
+\tablelasttail{\hline}
+\begin{supertabular}{lll}
+alpha & GREEK SMALL LETTER ALPHA & 03B1\\
+beta & GREEK SMALL LETTER BETA & 03B2\\
+chi & GREEK SMALL LETTER CHI & 03C7\\
+Delta & GREEK CAPITAL LETTER DELTA & 0394\\
+delta & GREEK SMALL LETTER DELTA & 03B4\\
+epsi & GREEK SMALL LETTER EPSILON & 03B5\\
+epsis & GREEK LUNATE EPSILON SYMBOL & 03F5\\
+\empty
+epsiv & GREEK SMALL LETTER EPSILON & 03B5\\
+eta & GREEK SMALL LETTER ETA & 03B7\\
+Gamma & GREEK CAPITAL LETTER GAMMA & 0393\\
+gamma & GREEK SMALL LETTER GAMMA & 03B3\\
+gammad & GREEK SMALL LETTER DIGAMMA & 03DD\\
+iota & GREEK SMALL LETTER IOTA & 03B9\\
+kappa & GREEK SMALL LETTER KAPPA & 03BA\\
+kappav & GREEK KAPPA SYMBOL & 03F0\\
+Lambda & GREEK CAPITAL LETTER LAMDA & 039B\\
+lambda & GREEK SMALL LETTER LAMDA & 03BB\\
+mu & GREEK SMALL LETTER MU & 03BC\\
+nu & GREEK SMALL LETTER NU & 03BD\\
+Omega & GREEK CAPITAL LETTER OMEGA & 03A9\\
+omega & GREEK SMALL LETTER OMEGA & 03C9\\
+Phi & GREEK CAPITAL LETTER PHI & 03A6\\
+phis & GREEK PHI SYMBOL & 03D5\\
+phiv & GREEK SMALL LETTER PHI & 03C6\\
+Pi & GREEK CAPITAL LETTER PI & 03A0\\
+pi & GREEK SMALL LETTER PI & 03C0\\
+piv & GREEK PI SYMBOL & 03D6\\
+Psi & GREEK CAPITAL LETTER PSI & 03A8\\
+psi & GREEK SMALL LETTER PSI & 03C8\\
+rho & GREEK SMALL LETTER RHO & 03C1\\
+rhov & GREEK RHO SYMBOL & 03F1\\
+Sigma & GREEK CAPITAL LETTER SIGMA & 03A3\\
+sigma & GREEK SMALL LETTER SIGMA & 03C3\\
+sigmav & GREEK SMALL LETTER FINAL SIGMA & 03C2\\
+tau & GREEK SMALL LETTER TAU & 03C4\\
+Theta & GREEK CAPITAL LETTER THETA & 0398\\
+thetas & GREEK SMALL LETTER THETA & 03B8\\
+thetav & GREEK THETA SYMBOL & 03D1\\
+Upsi & GREEK UPSILON WITH HOOK SYMBOL & 03D2\\
+upsi & GREEK SMALL LETTER UPSILON & 03C5\\
+Xi & GREEK CAPITAL LETTER XI & 039E\\
+xi & GREEK SMALL LETTER XI & 03BE\\
+zeta & GREEK SMALL LETTER ZETA & 03B6\\
+\end{supertabular}
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabular.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabular.tex
new file mode 100644
index 00000000000..ffc08ac933a
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabular.tex
@@ -0,0 +1,63 @@
+\documentclass{article}
+\usepackage{bidi}
+\title{Testing \LaTeX's Default Tabular in \textsf{RTL} and \textsf{LTR}}
+\author{Vafa Khalighi}
+\newcommand{\rb}[1]{\raisebox{1.5ex}[0mm]{#1}}
+\begin{document}
+\maketitle
+In this document we test \LaTeX's default tabular in \textsf{RTL} and \textsf{LTR}.
+\section{LTR}
+\begin{center}\small
+\begin{tabular}{|l||c|l|c|l|c|l|}
+\hline
+& \multicolumn{2}{c|}{6.15--7.15 pm} & \multicolumn{2}{c|}{7.20--8.20 pm}
+& \multicolumn{2}{c|}{8.30--9.30 pm} \\ \cline{2-7}
+&& Teacher && Teacher && Teacher \\ \cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Day} & \rb{Subj.} & Room & \rb{Subj.} & Room & \rb{Subj.} & Room\\
+ \hline\hline
+&& Dr.~Smith && Ms.~Clark && Mr.~Mills\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Mon.} & \rb{UNIX} & Comp. Ctr & \rb{Fortran} & Hall A
+ & \rb{Math.} & Hall A \\ \hline
+&& Miss Baker && Ms.~Clark && Mr.~Mill\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Tues.} & \rb{\LaTeX} & Conf.~Room & \rb{Fortran} & Conf~Room
+ & \rb{Math.} & Hall A \\ \hline
+&& Dr.~Smith && Dr.~Jones && Dr.~Jones \\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Wed.} & \rb{UNIX} & Comp. Ctr & \rb{C} & Hall A
+ & \rb{ComSci.} & Hall A \\ \hline
+&& Miss Baker && Ms. Clark & \multicolumn{2}{c|}{} \\
+\cline{3-3}\cline{5-5}
+\rb{Fri.} & \rb{\LaTeX} & Conf.~Room & \rb{C++} & Conf.~Room
+& \multicolumn{2}{c|}{\rb{canceled}}\\ \hline
+\end{tabular}\end{center}
+\section{RTL}
+
+\setRTL
+\begin{center}\small
+\begin{tabular}{|l||c|l|c|l|c|l|}
+\hline
+& \multicolumn{2}{c|}{6.15--7.15 pm} & \multicolumn{2}{c|}{7.20--8.20 pm}
+& \multicolumn{2}{c|}{8.30--9.30 pm} \\ \cline{2-7}
+&& Teacher && Teacher && Teacher \\ \cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Day} & \rb{Subj.} & Room & \rb{Subj.} & Room & \rb{Subj.} & Room\\
+ \hline\hline
+&& Dr.~Smith && Ms.~Clark && Mr.~Mills\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Mon.} & \rb{UNIX} & Comp. Ctr & \rb{Fortran} & Hall A
+ & \rb{Math.} & Hall A \\ \hline
+&& Miss Baker && Ms.~Clark && Mr.~Mill\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Tues.} & \rb{\LaTeX} & Conf.~Room & \rb{Fortran} & Conf~Room
+ & \rb{Math.} & Hall A \\ \hline
+&& Dr.~Smith && Dr.~Jones && Dr.~Jones \\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Wed.} & \rb{UNIX} & Comp. Ctr & \rb{C} & Hall A
+ & \rb{ComSci.} & Hall A \\ \hline
+&& Miss Baker && Ms. Clark & \multicolumn{2}{c|}{} \\
+\cline{3-3}\cline{5-5}
+\rb{Fri.} & \rb{\LaTeX} & Conf.~Room & \rb{C++} & Conf.~Room
+& \multicolumn{2}{c|}{\rb{canceled}}\\ \hline
+\end{tabular}\end{center}
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabularx.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabularx.tex
new file mode 100644
index 00000000000..2867c7cd17a
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabularx.tex
@@ -0,0 +1,40 @@
+\documentclass{article}
+\usepackage{tabularx}
+\usepackage{bidi}
+\title{Testing \textsf{tabularx} Package in RTL and LTR}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+\section{LTR}
+\begin{tabularx}{\linewidth}{|l|p{1.25cm}|p{1.5cm}|X|}\hline
+\multicolumn{1}{|c|}{\textbf{Animal}}
+ & \textbf{Hair Colour}
+ & \multicolumn{2}{c|}{\textbf{Favourite foods}} \\\hline\hline
+Elephant & Gray & Peanuts
+ & Unshelled, prepared in Sea Salt, and warmed over hot stone grill \\\cline{3-4}
+ & & Cabbage and Greens
+ & Sun dried until lightly browned (2-3 days minimum);
+ seasoned with Hyperchem super feed \\\cline{4-4}
+ & & & Boiled to British standard \\\hline\hline
+Lion & Yellow & Elephants & Tartare \\\cline{4-4}
+& & & Must be served warm, with no trace of
+ buckshot. Gaiminess considered desireable. \\\hline
+\end{tabularx}
+\section{RTL}
+
+\setRTL
+\begin{tabularx}{\linewidth}{|l|p{1.25cm}|p{1.5cm}|X|}\hline
+\multicolumn{1}{|c|}{\textbf{Animal}}
+ & \textbf{Hair Colour}
+ & \multicolumn{2}{c|}{\textbf{Favourite foods}} \\\hline\hline
+Elephant & Gray & Peanuts
+ & Unshelled, prepared in Sea Salt, and warmed over hot stone grill \\\cline{3-4}
+ & & Cabbage and Greens
+ & Sun dried until lightly browned (2-3 days minimum);
+ seasoned with Hyperchem super feed \\\cline{4-4}
+ & & & Boiled to British standard \\\hline\hline
+Lion & Yellow & Elephants & Tartare \\\cline{4-4}
+& & & Must be served warm, with no trace of
+ buckshot. Gaiminess considered desireable. \\\hline
+\end{tabularx}
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabulary.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabulary.tex
new file mode 100644
index 00000000000..81067943c49
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test-tabulary.tex
@@ -0,0 +1,30 @@
+\documentclass{article}
+\usepackage{tabulary}
+\setlength\tymin{10pt}
+\setlength\tymax{\maxdimen}
+\usepackage{bidi}
+\title{Testing \textsf{tabulary} package in RTL and LTR}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+\section{LTR}
+\begin{tabulary}{200pt}{|C|C|C|C|}
+ a & b b b b &
+ c c c c c c c c c c c c c c c c c c &
+ d d d d d d d d d d d d d d d d d d
+\empty
+ d d d d d d d d d d d d d d
+ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d
+ \end{tabulary}
+\section{RTL}
+
+\setRTL
+\begin{tabulary}{200pt}{|C|C|C|C|}
+ a & b b b b &
+ c c c c c c c c c c c c c c c c c c &
+ d d d d d d d d d d d d d d d d d d
+\empty
+ d d d d d d d d d d d d d d
+ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d
+ \end{tabulary}
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test1-wrapfig.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test1-wrapfig.tex
new file mode 100644
index 00000000000..a0fd4b7f8e5
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test1-wrapfig.tex
@@ -0,0 +1,40 @@
+\documentclass{article}
+\usepackage{wrapfig}
+\usepackage{bidi}
+\newcommand\sample{Some text for our page
+ that might get reused over and over again. }
+\begin{document}
+\section{LTR}
+The starting place for the wrapfigure
+environment was manually determined in
+the current ex-
+
+\begin{wrapfigure}[7]{r}[0.2\width]{0pt}
+ \centering
+ \fbox{This is ``wrapfigure''.}
+ \caption{An example of the
+ \texttt{wrapfigure} environment}
+\end{wrapfigure}
+sample by first setting the text without
+the figure to find the linebreaks.
+
+\sample \sample \sample\sample \sample \sample\sample
+
+\section{RTL}
+
+\setRTL
+The starting place for the wrapfigure
+environment was manually determined in
+the current ex-
+
+\begin{wrapfigure}[7]{l}[0.2\width]{0pt}
+ \centering
+ \fbox{This is ``wrapfigure''.}
+ \caption{An example of the
+ \texttt{wrapfigure} environment}
+\end{wrapfigure}
+sample by first setting the text without
+the figure to find the linebreaks.
+
+\sample \sample \sample\sample \sample \sample\sample
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test2-wrapfig.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test2-wrapfig.tex
new file mode 100644
index 00000000000..ab655dac412
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test2-wrapfig.tex
@@ -0,0 +1,28 @@
+\documentclass{article}
+\usepackage{wrapfig}
+\usepackage{bidi}
+\newcommand\sample{Some text for our page
+ that might get reused over and over again. }
+\begin{document}
+\section{LTR}
+\begin{wraptable}[4]{l}{4cm}
+ \centering
+\fbox{This is ``wraptable''.}
+ \caption{The Caption}\label{T1}
+\end{wraptable}
+
+\sample \sample Reference to Table~\ref{T1}.
+\sample
+
+\section{RTL}
+\setRTL
+
+\begin{wraptable}[4]{r}{4cm}
+ \centering
+\fbox{This is ``wraptable''.}
+ \caption{The Caption}\label{T2}
+\end{wraptable}
+
+\sample \sample Reference to Table~\ref{T2}.
+\sample
+\end{document}
diff --git a/Master/texmf-dist/doc/xelatex/bidi/examples/test3-wrapfig.tex b/Master/texmf-dist/doc/xelatex/bidi/examples/test3-wrapfig.tex
new file mode 100644
index 00000000000..4a61ff65f76
--- /dev/null
+++ b/Master/texmf-dist/doc/xelatex/bidi/examples/test3-wrapfig.tex
@@ -0,0 +1,77 @@
+\documentclass[a4paper,12pt]{article}
+
+\usepackage{graphicx}
+\usepackage{wrapfig}
+\usepackage{bidi}
+\begin{document}
+\section{LTR}
+\subsection*{Wrapfig test}
+
+
+Gulls are birds in the family Laridae. They are most closely
+ related to the terns (family Sternidae), auks and skimmers,
+and more distantly to the waders. Most gulls belong to the
+large genus Larus.
+
+\begin{wrapfigure}{r}{0.5\textwidth}
+ \begin{center}
+ \includegraphics[width=0.48\textwidth]{gull}
+ \end{center}
+ \caption{A gull}
+\end{wrapfigure}
+
+They are in general medium to large birds, typically grey or white,
+often with black markings on the head or wings. They have stout,
+longish bills and webbed feet.
+
+Most gulls, particularly Larus species, are ground nesting carnivores,
+which will take live food or scavenge opportunistically. The live food
+often includes crabs and small fish. Apart from the kittiwakes, gulls
+are typically coastal or inland species, rarely venturing far out to sea.
+The large species take up to four years to attain full adult plumage,
+but two years is typical for small gulls.
+
+Gulls---the larger species in particular---are resourceful and
+highly intelligent birds, demonstrating complex methods of communication
+and a highly developed social structure. Certain species (e.g. the
+Herring Gull) have exhibited tool use behaviour. Many species of gull have
+learned to co-exist successfully with man and have thrived in human habitats.
+Others rely on kleptoparasitism to get their food.
+
+\newpage
+\section{RTL}
+
+\setRTL
+\subsection*{Wrapfig test}
+
+
+Gulls are birds in the family Laridae. They are most closely
+ related to the terns (family Sternidae), auks and skimmers,
+and more distantly to the waders. Most gulls belong to the
+large genus Larus.
+
+\begin{wrapfigure}{l}{0.5\textwidth}
+ \begin{center}
+ \includegraphics[width=0.48\textwidth]{gull}
+ \end{center}
+ \caption{A gull}
+\end{wrapfigure}
+
+They are in general medium to large birds, typically grey or white,
+often with black markings on the head or wings. They have stout,
+longish bills and webbed feet.
+
+Most gulls, particularly Larus species, are ground nesting carnivores,
+which will take live food or scavenge opportunistically. The live food
+often includes crabs and small fish. Apart from the kittiwakes, gulls
+are typically coastal or inland species, rarely venturing far out to sea.
+The large species take up to four years to attain full adult plumage,
+but two years is typical for small gulls.
+
+Gulls---the larger species in particular---are resourceful and
+highly intelligent birds, demonstrating complex methods of communication
+and a highly developed social structure. Certain species (e.g. the
+Herring Gull) have exhibited tool use behaviour. Many species of gull have
+learned to co-exist successfully with man and have thrived in human habitats.
+Others rely on kleptoparasitism to get their food.
+\end{document}
diff --git a/Master/texmf-dist/source/xelatex/bidi/bidi.dtx b/Master/texmf-dist/source/xelatex/bidi/bidi.dtx
index 969c256e503..92994856162 100644
--- a/Master/texmf-dist/source/xelatex/bidi/bidi.dtx
+++ b/Master/texmf-dist/source/xelatex/bidi/bidi.dtx
@@ -1,69 +1,27 @@
-% \iffalse
+% \iffalse
%<*internal>
\iffalse
%</internal>
%<*readme>
-------------------------
-THE BIDI PACKAGE v0.3
+_________________
+The bidi package
+v1.0.1
-This package provides a convenient interface for typesetting
-bidirectional texts with XeLaTeX.
+This package provides a convenient interface for typesetting
+bidirectional texts with XeLaTeX.
-This version adds support for tabular environments and captions
-and brings several other improvements and bugfixes.
+This version fixes all known bugs and adds heaps of new things.
-The code for alphabetic numerals has been moved to the relevant
-"language definition files" of the new polyglossia package.
+______________
+Vafa Khalighi
+vafa@users.berlios.de
---------------
-François Charette
-July 2008
+Copyright 2007-2009
+Distributed under the LaTeX Project Public License
%</readme>
-%<*example>
-\documentclass{article}
-\usepackage[no-math]{fontspec}
-\usepackage{bidi}
-\newfontfamily\arab[Script=Arabic, Scale=1.5]{Scheherazade}
-\begin{document}
-
-This is some text in English with Arabic insertion (\RL{\arab بعض الكلمات العربية}).\footnote{ 1 2 3}
-
-\setRL\arab
-وهذه فقرةٌ بالعربي مع كلمات انكليزية (\LR{\rmfamily Some English words}).\footnote{ 1 2 3}
-\setLR\rmfamily
-
-Back to left-to-right mode…\footnote{ 1 2 3}
-
-\begin{table}[h]
-\centering
-\begin{tabular}{cc}
-1 & 2\\
-3 & 4
-\end{tabular}
-\caption{This is a caption}
-\end{table}
-
-\begin{equation}
-x^2 + y^2 = z^2
-\end{equation}
-
-\setRL
-\begin{table}[h]
-\centering
-\begin{tabular}{cc}
-1 & 2\\
-3 & 4
-\end{tabular}
-\caption{This is a caption}
-\end{table}
-
-\begin{equation}
-x^2 + y^2 = z^2
-\end{equation}
-\end{document}
-%</example>
%<*internal>
\fi
+%
%</internal>
%
%<*internal>
@@ -74,394 +32,246 @@ x^2 + y^2 = z^2
\keepsilent
\preamble
- ____________________________
+ __________________________________
+ Copyright © 2009 Vafa Khalighi
- The bidi package
- (C) 2007-2008 François Charette
- License information appended
+ License information appended.
\endpreamble
\postamble
-Copyright (C) 2007-2008 by François Charette <firmicus at gmx dot net>
+Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
Distributable under the LaTeX Project Public License,
version 1.3c or higher (your choice). The latest version of
this license is at: http://www.latex-project.org/lppl.txt
This work is "maintained" (as per LPPL maintenance status)
-by François Charette.
+by Vafa Khalighi.
+
-This work consists of the file \jobname.dtx
- and the derived files \jobname.sty and \jobname.pdf.
+
\endpostamble
\askforoverwritefalse
-\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
-\nopreamble\nopostamble
+\generate{\file{amsart-bidi.def}{\from{bidi.dtx}{amsart-bidi.def}}}
+\generate{\file{amsbook-bidi.def}{\from{bidi.dtx}{amsbook-bidi.def}}}
+\generate{\file{amsthm-bidi.def}{\from{bidi.dtx}{amsthm-bidi.def}}}
+\generate{\file{array-bidi.def}{\from{bidi.dtx}{array-bidi.def}}}
+\generate{\file{article-bidi.def}{\from{bidi.dtx}{article-bidi.def}}}
+\generate{\file{bidibeamer-bidi.def}{\from{bidi.dtx}{bidibeamer-bidi.def}}}
+\generate{\file{bidibeamer.cls}{\from{bidi.dtx}{bidibeamer.cls}}}
+\generate{\file{bidibeamerbasetemplates.sty}{\from{bidi.dtx}{bidibeamerbasetemplates.sty}}}
+\generate{\file{bidibeamerbaseauxtemplates.sty}{\from{bidi.dtx}{bidibeamerbaseauxtemplates.sty}}}
+\generate{\file{beamerthemebidiJLTree.sty}{\from{bidi.dtx}{beamerthemebidiJLTree.sty}}}
+\generate{\file{bidi.sty}{\from{bidi.dtx}{bidi.sty}}}
+\generate{\file{bidi2in1.sty}{\from{bidi.dtx}{bidi2in1.sty}}}
+\generate{\file{bidicode.sty}{\from{bidi.dtx}{bidicode.sty}}}
+\generate{\file{bidimoderncv.cls}{\from{bidi.dtx}{bidimoderncv.cls}}}
+\generate{\file{bidipresentation.cls}{\from{bidi.dtx}{bidipresentation.cls}}}
+\generate{\file{book-bidi.def}{\from{bidi.dtx}{book-bidi.def}}}
+\generate{\file{bookest-bidi.def}{\from{bidi.dtx}{bookest-bidi.def}}}
+\generate{\file{cvthemebidicasual.sty}{\from{bidi.dtx}{cvthemebidicasual.sty}}}
+\generate{\file{cvthemebidiclassic.sty}{\from{bidi.dtx}{cvthemebidiclassic.sty}}}
+\generate{\file{draftwatermark-bidi.def}{\from{bidi.dtx}{draftwatermark-bidi.def}}}
+\generate{\file{extbook-bidi.def}{\from{bidi.dtx}{extbook-bidi.def}}}
+\generate{\file{fancyhdr-bidi.def}{\from{bidi.dtx}{fancyhdr-bidi.def}}}
+\generate{\file{footnote-bidi.def}{\from{bidi.dtx}{footnote-bidi.def}}}
+\generate{\file{graphicx-bidi.def}{\from{bidi.dtx}{graphicx-bidi.def}}}
+\generate{\file{listings-bidi.def}{\from{bidi.dtx}{listings-bidi.def}}}
+\generate{\file{longtable-bidi.def}{\from{bidi.dtx}{longtable-bidi.def}}}
+\generate{\file{minitoc-bidi.def}{\from{bidi.dtx}{minitoc-bidi.def}}}
+\generate{\file{bidimemoir.cls}{\from{bidi.dtx}{bidimemoir.cls}}}
+\generate{\file{pdfpages-bidi.def}{\from{bidi.dtx}{pdfpages-bidi.def}}}
+\generate{\file{pstricks-bidi.def}{\from{bidi.dtx}{pstricks-bidi.def}}}
+\generate{\file{ragged2e-bidi.def}{\from{bidi.dtx}{ragged2e-bidi.def}}}
+\generate{\file{refrep-bidi.def}{\from{bidi.dtx}{refrep-bidi.def}}}
+\generate{\file{report-bidi.def}{\from{bidi.dtx}{report-bidi.def}}}
+\generate{\file{rapport3-bidi.def}{\from{bidi.dtx}{rapport3-bidi.def}}}
+\generate{\file{scrartcl-bidi.def}{\from{bidi.dtx}{scrartcl-bidi.def}}}
+\generate{\file{scrbook-bidi.def}{\from{bidi.dtx}{scrbook-bidi.def}}}
+\generate{\file{scrreprt-bidi.def}{\from{bidi.dtx}{scrreprt-bidi.def}}}
+\generate{\file{stabular-bidi.def}{\from{bidi.dtx}{stabular-bidi.def}}}
+\generate{\file{tabls-bidi.def}{\from{bidi.dtx}{tabls-bidi.def}}}
+\generate{\file{tikz-bidi.def}{\from{bidi.dtx}{tikz-bidi.def}}}
+\generate{\file{tocloft-bidi.def}{\from{bidi.dtx}{tocloft-bidi.def}}}
+\generate{\file{tocstyle-bidi.def}{\from{bidi.dtx}{tocstyle-bidi.def}}}
+\generate{\file{xltxtra-bidi.def}{\from{bidi.dtx}{xltxtra-bidi.def}}}
+\generate{\file{wrapfig-bidi.def}{\from{bidi.dtx}{wrapfig-bidi.def}}}
%</batchfile>
%<batchfile>\endbatchfile
%<*internal>
-\generate{\file{\jobname.ins}{\from{\jobname.dtx}{batchfile}}}
-\generate{\file{bidi-example.tex}{\from{\jobname.dtx}{example}}}
-\generate{\file{README.txt}{\from{\jobname.dtx}{readme}}}
+\generate{\file{bidi.ins}{\from{bidi.dtx}{batchfile}}}
+\nopreamble\nopostamble
+\generate{\file{README.txt}{\from{bidi.dtx}{readme}}}
+\generate{\file{beamer-sample.tex}{\from{bidi.dtx}{beamer-sample.tex}}}
+\generate{\file{bidicasual-samplecv.tex}{\from{bidi.dtx}{bidicasual-samplecv.tex}}}
+\generate{\file{bidiclassic-samplecv.tex}{\from{bidi.dtx}{bidiclassic-samplecv.tex}}}
+\generate{\file{bidisample2e.tex}{\from{bidi.dtx}{bidisample2e.tex}}}
+\generate{\file{bidismall2e.tex}{\from{bidi.dtx}{bidismall2e.tex}}}
+\generate{\file{presentation-sample.tex}{\from{bidi.dtx}{presentation-sample.tex}}}
+\generate{\file{test-bidi.tex}{\from{bidi.dtx}{test-bidi.tex}}}
+\generate{\file{test-supertabular.tex}{\from{bidi.dtx}{test-supertabular.tex}}}
+\generate{\file{test-tabular.tex}{\from{bidi.dtx}{test-tabular.tex}}}
+\generate{\file{test-tabularx.tex}{\from{bidi.dtx}{test-tabularx.tex}}}
+\generate{\file{test-tabulary.tex}{\from{bidi.dtx}{test-tabulary.tex}}}
+\generate{\file{test1-wrapfig.tex}{\from{bidi.dtx}{test1-wrapfig.tex}}}
+\generate{\file{test2-wrapfig.tex}{\from{bidi.dtx}{test2-wrapfig.tex}}}
+\generate{\file{test3-wrapfig.tex}{\from{bidi.dtx}{test3-wrapfig.tex}}}
\endgroup
%</internal>
%
%<*driver>
-\documentclass[12pt]{ltxdoc}
-\usepackage{fontspec,xltxtra}
-\usepackage{bidi}
-\usepackage{xspace,fancyvrb,paralist}
-\usepackage[xetex]{color}
-\definecolor{myblue}{rgb}{0.02,0.04,0.48}
-\definecolor{myred}{rgb}{0.65,0.04,0.07}
-\definecolor{darkgray}{gray}{0.3}
-\definecolor{lightgray}{gray}{0.6}
-\definecolor{mygreen}{rgb}{0,.43,0}
-\usepackage[dvipdfm,
- bookmarks=true,
- colorlinks=true,
- linkcolor=myblue,
- urlcolor=myblue,
- citecolor=myblue,
- hyperindex=false,
- hyperfootnotes=false,
- pdftitle={The bidi package},
- pdfauthor={F Charette <firmicus@gmx.net>},
- pdfsubject={An interface for typesetting bidirectional texts with XeLaTeX},
- pdfkeywords={XeTeX, XeLaTeX, Right-to-Left, Bidi, Arabic, Hebrew}
- ]{hyperref}
-% NB some of this preamble is taken or adapted from fontspec-doc-style.sty
-\newcommand*\pkg[1]{\textsf{#1}}
-\def\eg{\textit{e.g.,}\xspace}
-\def\ie{\textit{i.e.,}\xspace}
-\def\ca{\textit{ca.}\@\xspace}
-\def\Eg{\textit{E.g.,}\xspace}
-\def\Ie{\textit{I.e.,}\xspace}
-\def\etc{\@ifnextchar.{\textit{etc}}{\textit{etc.}\@\xspace}}
-\def\arabxetex{Arab\XeTeX}
-
-\newlength{\oldparindent}
-\newcommand{\parindentoff}{\setlength{\oldparindent}{\parindent} \setlength{\parindent}{0pt}}
-\newcommand{\parindenton}{\setlength{\parindent}{\oldparindent}}
-
-%% LOGOS, tuned for Palatino (seems also OK with Junicode):
-\makeatletter
-\TeX@logo@spacing{-0.12em}{-0.12em}%
- {0.5ex}{-0.3em}{-0.12em}{-0.1em}
-\makeatother
-%% fontspec declarations:
-\setromanfont[Mapping=tex-text]{Junicode}%{FPL Neu}
-\defaultfontfeatures{Scale=MatchLowercase}
-\setmonofont{DejaVu Sans Mono}%{Inconsolata}%{Latin Modern Typewriter Proportional}%{Luxi Mono}%{Courier New}
-\setsansfont{DejaVu Sans}
-\newfontfamily\arabicfont[Script=Arabic,Scale=1.5]{Scheherazade}
-\newfontfamily\hebrewfont[Script=Hebrew]{Ezra SIL}
-%\newfontfamily\syriacfont[Script=Syriac]{Estrangelo Talada}
-\newfontfamily\damase{MPH 2B Damase}
-\linespread{1.05}
-\frenchspacing
-\renewcommand{\footnoterule}{}
-\skip\footins=2\bigskipamount
-%% ToC
-\def\@dotsep{1000}
-\setcounter{tocdepth}{2}
-\setlength\columnseprule{0.4pt}
-\makeatletter
-\renewcommand\tableofcontents{%
- \begin{multicols}{2}[\section*{\contentsname}]%
- \small
- \@starttoc{toc}%
- \end{multicols}}
-\makeatother
+\documentclass{ltxdoc}
+\usepackage[sc,osf]{mathpazo}
+\usepackage{fvrb-ex}
\EnableCrossrefs
\CodelineIndex
\RecordChanges
-%\OnlyDescription
+\OnlyDescription
+
\begin{document}
- \DocInput{\jobname.dtx}
+ \DocInput{bidi.dtx}
\end{document}
%</driver>
%
+%
% \fi
-% \makeatletter ^^A% To document @-cmds
-% \errorcontextlines=999 ^^A% Show up all my mistakes
%
-% \GetFileInfo{\jobname.sty}
-%
-% \title{The \pkg{bidi} package}
-% ^^A \author{\textcolor{myblue}{François Charette}\\
-% \author{François Charette\\
-% \footnotesize\texttt{<fιrmιcus@gmχ.νετ>}}
-% \date{\filedate \qquad \fileversion}
-%
-% \maketitle
-% \tableofcontents
-%
-% \section{Basic direction switching commands}
-%
-% The \pkg{bidi} package provides a useful interface for typesetting bidirectional
-% texts with \XeLaTeX.\footnote{ %
-% Actually, \pkg{bidi} can also be used with any \eTeX-based
-% engine, notably pdf\LaTeX, but at this time I do not see how it
-% could be useful outside of the \XeTeX\ world.}
-% ^^A\eTeX-based typesetting engines and the \LaTeX\ format,
-% Most of its macros are directly copied or adapted from
-% the Babel bidirectional module for Hebrew (by Boris Lavva).\footnote{ See
-% ^^A\url{ftp://dante.ctan.org/tex-archive/macros/latex/required/babel/hebrew.dtx}
-% section 60.4 of the \href{ftp://dante.ctan.org/tex-archive/macros/latex/required/babel/babel.pdf}{Babel user documentation.}}
-%
-% For short right-to-left ^^A(|\RL{R 2 L}| $\rightarrow$ \RL{R\,2\,L})
-% insertions in left-to-right environments, \DescribeMacro{\RL}\cmd\RL|{…}| does the job,
-% as does \DescribeMacro{\LR}\cmd\LR|{…}| in the opposite case.
-% To typeset a full paragraph right-to-left, use the switch
-% \DescribeMacro{\setRL}\cmd\setRL, and to revert to left-to-right, use
-% \DescribeMacro{\setLR}\cmd\setLR\ (or equivalently \cmd\unsetRL).
-%
-% \begin{Verbatim}[gobble=2]
-% \setRL
-% This is a right-to-left paragraph.
-% \setLR
-% \end{Verbatim}
-%
-% \setRL\setfootnoteLR
-% This is a right-to-left paragraph.\footnote{ %
-% Note that when processing fonts that are not TFM-based,
-% \XeTeX, contrary to \TeX, uses (roughly speaking) one box per word,
-% instead of one per character. The command \cmd\RL\ is thus usually
-% superfluous when inserting a single word.}
-% \setLR
-%
-%
-% \subsection{Direction of plain footnotes}
-% \setfootnoteRL
-% With \DescribeMacro{\setfootnoteRL}\cmd\setfootnoteRL, one can insert RL
-% footnotes in LR mode,\footnote{ %
-% ^^A\textarab[novoc]{mulA.hi.zaT min al-yamIn 'ilY al-ya.sAr}
-% \arabicfont ملاحظات من اليمين إلى اليصار}
-% and conversely with
-% \DescribeMacro{\setfootnoteLR}\cmd\setfootnoteLR\
-% (or equivalently \cmd\unsetfootnoteRL).
-% \unsetfootnoteRL
-%
-% With the package \pkg{manyfoot}, it is possible to have several layers
-% of footnotes, each of which can be set in a different direction.
-% See the documentation to Arab\XeTeX\ for more details. This should also be
-% possible with \pkg{bigfoot}.
-%
-% Some other \LaTeX\ macros are redefined internally to ensure their correct
-% behaviour in bidirectional display. Contrary to the Babel approach, we leave
-% the commands defined in standard \LaTeX\ classes untouched, as we think this
-% should be done by class authors themselves (who are of course encouraged to
-% make them \pkg{bidi}-compatible :-).
+% \GetFileInfo{bidi.sty}
+% \makeatletter
%
-%
-% \section{Colored text} \label{bidicolor}
-%
-% Because of the way bidirectionality is implemented in \eTeX, no information on
-% directionality is included in the dvi (or xdv) output. Consequently, if a color
-% \cmd\special\ is inserted in the middle of a paragraph, the color change will
-% be in effect as though the text would run from left to right. For \cmd\textcolor,
-% the output will be correct only if the textual argument falls on a single line.
-% A better approach is to set the color of text by means of \XeTeX's font features,
-% as in this example:
-% \begin{Verbatim}[gobble=2]
-% \newcommand{\textblue}[1]{{\addfontfeature{Color=0000FF}#1}}
-% \setRL
-% {\arabicfont
-% اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود
-% اسود \textblue{ازرق ازرق ازرق ازرق ازرق ازرق ازرق } اسود اسود
-% اسود اسود اسود اسود
-% }
-% \end{Verbatim}
-% \newcommand{\textblue}[1]{{\addfontfeature{Color=0000FF}#1}}
-% \setRL
-% {\arabicfont
-% اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود اسود
-% \textblue{ازرق ازرق ازرق ازرق ازرق ازرق ازرق} اسود اسود
-% اسود اسود اسود اسود}
-% \setLR
-%
-% \section{Scripts written from right-to-left}
-%
-% The Arabic and Hebrew scripts are of course not the only ones to be written from right-to-left.
-% The following is a list of historical\footnote{ %
-% The historical right-to-left scripts that are part of Unicode 5.0 are:
-% Cypriot, Old Italic (i.e., Etruscan), Kharosthi and Phoenician.}
-% and contemporary scripts that are written
-% primarily or exclusively from right-to-left.\footnote{ %
-% See \url{http://www.omniglot.com/writing/direction.htm\#rtl},
-% \url{http://www.unicode.org/iso15924/}, and
-% \url{http://www.ancientscripts.com/ws.html}.}
-% Those still in use today are marked with an asterisk.
-%
-% \begin{center}
-% \small
-% \begin{tabular}{ll}\hline
-% Aramaic and Sogdian ~~~~~~~~~~~~~~~ & Nabatean \\
-% Arabic$^*$ & N'Ko$^*$ \\
-% Avestan & Old Hungarian \\
-% Berber (ancient) & Orkhon (Turkic runes) \\
-% Cypriot Syllabary & Pahlavi and Parthian \\
-% Etruscan and Oscan & Phoenician \\
-% Hebrew$^*$ & Proto-Sinaitic \\
-% Iberian (Northern) & Samaritan \\
-% Kharosthi & South Arabian and Thamudic \\
-% Lydian & Syriac$^*$ \\
-% Mandaean & Thâna$^*$ \\
-% Meroitic (cursive) & \\
-% \hline
-% \end{tabular}
-% \end{center}
-%
-% Some examples (random glyphs for Kharosthi and Cypriot):
-% \begin{compactitem}[\textbf{·}]
-% \item Old Italic (Etruscan):\footnote{ %
-% The Unicode standard 5.0 specifies left-to-right directionality for the
-% Old Italic script, contrary to historical evidence but in accordance to
-% conventional scholarly usage. To display from right to left the Unicode
-% \textsc{right-to-left override} character \textsf{U+202E}
-% ^^A \textsc{\addfontfeature{Numbers=Lowercase}u+202e}
-% must be inserted before each
-% word. This could be easily automated by means of a TECkit font mapping.
-% Etruscanists interested in this can contact me directly.}
-% \hfill \RL{\damase 𐌀𐌖𐌋𐌄𐌑𐌉 𐌌𐌄𐌕𐌄𐌋𐌉𐌑} ^^A\addfontfeature{Mapping=etruscan}auleśi meteliś}
-% \item N'ko:\footnote{ %
-% As can be seen in this example, the ICU rendering engine does not yet
-% support contextual substitutions for N'Ko.}
-% \hfill \RL{\fontspec[Script=N'ko]{Code2000} ߌ ߣߌ ߛߐߡߊ߫} ^^A i ni somâ = good morning < http://www.fakoli.net/nko/tutorial/samples.html
-% \item Thâna: \hfill {\fontspec[Script=Thaana]{MPH 2B Damase} ކައްޓަލަ} ^^A kattala = sweet potato < http://www.maldivesculture.com/thaana03.html
-% \item Phoenician: \hfill {\fontspec[Script=Phoenician]{MPH 2B Damase} 𐤊𐤁𐤂𐤃} ^^A abgd
-% \item Kharosthi: \hfill {\fontspec[Script=Kharosthi]{MPH 2B Damase} 𐨗𐨁𐨙𐨪} ^^A random gibberish
-% \item Cypriot: \hfill {\fontspec[Script=Cypriot Syllabary]{MPH 2B Damase} 𐠌𐠥𐠯} ^^A random gibberish
-% \end{compactitem}
-%
-% \section{Acknowledgements}
-%
-% Thanks to Boris Lavva (author of \pkg{rlbabel.def}),
-% the authors of Farsi\TeX,
-% Youssef Jabri [\RL{\arabicfont يوسف جبري}] (author of \pkg{Arabi}),
-% and Vafa Khalighi [\RL{\arabicfont وفا خليقي}] (author of \pkg{xepersian}).
+%\title{The \textsf{bidi} Package}
+%\author{Vafa Khalighi\\
+%\footnotesize\texttt{<vafa@users.berlios.de>}}
%
% \StopEventually{}
-%
% \section{Implementation}
-% \iffalse
-%<*package>
+% \part{bidi.sty}
+%\iffalse
+%<*bidi.sty>
% \fi
+%
+%
% \begin{macrocode}
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bidi}
- [2008/07/07 v0.3 Bidirectional typesetting in XeLaTeX]
-\newif\if@rlmain
-\@rlmainfalse
-\DeclareOption{rldocument}{\@rlmaintrue}
-\ProcessOptions
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\bididate{2009/08/01}
+\def\bidiversion{v1.0.1}
+\def\bidirevision{revision 68}
+\ProvidesPackage{bidi}[\bididate\space \bidiversion\space <\bidirevision>
+ Bidirectional typesetting in XeLaTeX]
+\AtBeginDocument{\special{pdf: docinfo <<
+/Creator (Bidi \bidiversion\space <\bidirevision> Copyright © 2009 Vafa Khalighi)
+ >>}}
+\newif\if@RTLmain
+\newif\if@RTL
+\newif\if@RTLtab
+\newif\if@sentdir
+\newif\if@RTL@footnote
+\let\if@rlmain=\if@RTLmain
+\let\@rlmaintrue=\@RTLmaintrue
+\let\@rlmainfalse=\@RTLmainfalse
+\let\if@rl=\if@RTL
+\let\@rltrue=\@RTLtrue
+\let\@rlfalse=\@RTLfalse
+\let\if@rl@footnote=\if@RTL@footnote
+\let\@rl@footnotetrue=\@RTL@footnotetrue
+\let\@rl@footnotefalse=\@RTL@footnotefalse
+\let\if@tab@rl=\if@RTLtab
+\let\@tab@rltrue=\@RTLtabtrue
+\let\@tab@rlfalse=\@RTLtabfalse
+\@RTLmainfalse
+\RequirePackage{amsmath}
+\newcommand\bidi@isloaded[2][]{
+ \expandafter\ifx\csname if@bidi@#2loaded@\endcsname\relax
+ \expandafter\newif\csname if@bidi@#2loaded@\endcsname
+ \fi
+ \@ifpackageloaded{#2}
+ {\csname @bidi@#2loaded@true\endcsname #1}
+ {\csname @bidi@#2loaded@false\endcsname}}
+\bidi@isloaded{xunicode}
+\AtBeginDocument{
+ \if@bidi@xunicodeloaded@
+ \bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package xunicode before bidi package. Please load package xunicode after bidi package, and then try to run xelatex on your document again}{}]{xunicode}
+ \fi%
+}
\ifx\TeXXeTstate\undefined\else%
\TeXXeTstate=1
\fi
-\ifx\beginL\@undefined%
+\ifx\beginR\@undefined%
\newlinechar`\^^J
\typeout{^^JTo avoid this error message,^^J%
run TeX--XeT or e-TeX engine instead of regular TeX.^^J}
\errmessage{Right-to-Left Support Error: use TeX--XeT or e-TeX
engine}%
\fi
-\newif\if@rl
-\AtBeginDocument{% Here we set the main document direction
- \if@rlmain\else
- \if@rl\@rlmaintrue%
- \else\@rlmainfalse%
+\AtBeginDocument{%
+ \if@RTLmain\else
+ \if@RTL\@RTLmaintrue%
+ \else\@RTLmainfalse%
\fi%
\fi%
}
-% \end{macrocode}
-% \subsection{Basic bidi macros}
-% This defines the macros for RL insertion in LR context and conversely.
-% Most of it is taken from the file \texttt{rlbabel.def} in the Babel distribution,
-% with minor changes.
-%
-% \begin{macrocode}
+\def\Bidi@RTL@everypar{\if@RTL{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
+ \let\o@everypar=\everypar
+ \newtoks\n@everypar
+ \n@everypar\expandafter{\the\o@everypar}
+ \o@everypar{\Bidi@RTL@everypar\the\n@everypar}
+ \let\everypar=\n@everypar
\let\n@xt=\
-\def\LR{\protect\pLR}%
-\def\pLR{\protect\afterassignment\moreLR \let\n@xt= }
-\def\moreLR{\bracetext \aftergroup\endL \beginL\@rlfalse}
-\def\RL{\protect\pRL}
-\def\pRL{\protect\afterassignment\moreRL \let\n@xt= }
-\def\moreRL{\bracetext \aftergroup\endR \beginR\@rltrue}
+\def\LRE{\protect\pLRE}%
+\def\pLRE{\protect\afterassignment\moreLRE \let\n@xt= }
+\def\moreLRE{\bracetext \aftergroup\endL \beginL\@RTLfalse}
+\def\RLE{\protect\pRLE}
+\def\pRLE{\protect\afterassignment\moreRLE \let\n@xt= }
+\def\moreRLE{\bracetext \aftergroup\endR \beginR\@RTLtrue}
\def\bracetext{\ifcat\n@xt{\else\ifcat\n@xt}\fi
\errmessage{Missing left brace has been substituted}\fi \bgroup}
-\everydisplay{\if@rl\aftergroup\beginR\fi }
-% \end{macrocode}
-%
-% For global right-to-left typesetting, the directional primitive must be
-% included within an \cmd\everypar\ construct. The traditional approach was to
-% redefine \cmd\everypar\ as a one-argument macro, but since some packages such
-% as \pkg{ledmac} also play tricks with \cmd\everypar, this can become
-% problematic. Hence we have adopted Youssef Jabri's approach in his
-% \pkg{Arabi} package (\,\RL{\arabicfont شكراً جزيلاً}).
-% \begin{macrocode}
-\def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
-\let\o@everypar=\everypar
-%The following, surely, will not play well with all packages, e.g. ledmac
-%\def\everypar#1{\o@everypar{\rl@everypar#1}}
-% But we now use this instead, taken from Arabicore.sty
-\newtoks\n@everypar
-\n@everypar\expandafter{\the\o@everypar}
-\o@everypar{\rl@everypar\the\n@everypar}
-\let\everypar=\n@everypar
-% \end{macrocode}
-%
-% This is similar to |\ensuremath| in \LaTeX:
-% \begin{macrocode}
-\def\@ensure@RL#1{\if@rl#1\else\RL{#1}\fi}
-\def\@ensure@LR#1{\if@rl\LR{#1}\else#1\fi}
-% \end{macrocode}
-%
-% This does the opposite (which is useful for ensuring correct directionality
-% in boxes or tabular environments, for instance):
-% \begin{macrocode}
-\def\@ensure@dir#1{\if@rl\RL{#1}\else{#1}\fi}
-\def\@ensure@maindir#1{\if@rlmain\RL{#1}\else{#1}\fi}
-% \end{macrocode}
-% These are not yet used…
-% \begin{macrocode}
-\def\@@RL{RL}
-\def\@@LR{LR}
-\def\save@dir{\if@rl\gdef\saved@@dir{RL}\else\gdef\saved@@dir{LR}\fi}
-\def\reset@dir{\ifx\saved@@dir\@@RL\setRL\else\ifx\saved@@dir\@@LR\setLR\else\relax\fi\fi}
-% \end{macrocode}
-%
-% \subsection{Logos}
-% The following redefinitions ensure proper typesetting of the various logos.
-% \begin{macrocode}
-%preserve logos
+\def\lr#1{\begingroup\beginL\rmfamily#1\endL\endgroup}
+\def\LTR{\bgroup\par\@RTLfalse\@RTL@footnotefalse}
+\def\endLTR{\par\egroup}
+\def\RTL{\bgroup\par\@RTLtrue\@RTL@footnotetrue}
+\def\endRTL{\par\egroup}
+\def\ltr{\if@RTL\par\@RTLfalse\@RTL@footnotefalse\fi}
+\def\rtl{\if@RTL\relax\else\par\@RTLtrue\@RTL@footnotetrue\fi}
+\def\setRTL{\@RTLtrue\@RTL@footnotetrue}
+\def\setLTR{\@RTLfalse\@RTL@footnotefalse}
+\let\unsetRTL=\setLTR
+\let\unsetLTR=\setRTL
+\let\LR=\LRE
+\let\RL=\RLE
+\def\@ensure@RTL#1{\if@RTL#1\else\RLE{#1}\fi}
+\def\@ensure@LTR#1{\if@RTL\LRE{#1}\else#1\fi}
+\let\@ensure@RL=\@ensure@RTL
+\let\@ensure@LR=\@ensure@LTR
+\def\@ensure@dir#1{\if@RTL\RLE{#1}\else{#1}\fi}
+\let\@ensure@maindir=\@ensure@dir
+\def\@@RTL{RTL}
+\def\@@LTR{LTR}
+\def\save@dir{\if@RTL\gdef\saved@@dir{RTL}\else\gdef\saved@@dir{LTR}\fi}
+\def\reset@dir{\ifx\saved@@dir\@@RTL\setRTL\else\ifx\saved@@dir\@@LTR\setLTR\else\relax\fi\fi}
\let\@@TeX\TeX
-\def\TeX{\@ensure@LR{\@@TeX}}
+\def\TeX{\@ensure@LTR{\@@TeX}}
\let\@@LaTeX\LaTeX
-\def\LaTeX{\@ensure@LR{\@@LaTeX}}
+\def\LaTeX{\@ensure@LTR{\@@LaTeX}}
\let\@@LaTeXe\LaTeXe
-\def\LaTeXe{\@ensure@LR{\@@LaTeXe}}
-\@ifpackageloaded{xltxtra}{
-\let\@@XeTeX\XeTeX
-\def\XeTeX{\@ensure@LR{\@@XeTeX}}
-\let\@@XeLaTeX\XeLaTeX
-\def\XeLaTeX{\@ensure@LR{\@@XeLaTeX}}
-}{}
-% \end{macrocode}
-% \subsection{Redefinition of various internal \LaTeX\ macros}
-% \subsubsection{\cmd{\text}}
-% \cmd{\text} is defined in \pkg{amstext.sty}.
-% \begin{macrocode}
-\@ifundefined{text}{}{%
-\let\t@xt=\text
-\def\text#1{\t@xt{\@ensure@dir{#1}}}}
-% \end{macrocode}
-% \subsubsection{\cmd{\list}}
-% \begin{macrocode}
+\def\LaTeXe{\@ensure@LTR{\@@LaTeXe}}
+\def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
+ \special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}
+\def\XeTeX{\LR{\leavevmode$\smash{\hbox{X\lower.5ex
+ \hbox{\kern-.125em\reflect{E}}\kern-.1667em \TeX}}$}}
+\def\XeLaTeX{\LR{\leavevmode$\smash{\hbox{X\lower.5ex
+ \hbox{\kern-.125em\reflect{E}}\kern-.1667em \LaTeX}}$}}
+\let\setRL=\setRTL
+\let\setLR=\setLTR
+\let\unsetRL=\setLTR
+\DeclareOption{RTLdocument}{\@RTLtrue\@RTL@footnotetrue\RTLdblcol\autofootnoterule}
+\DeclareOption{rldocument}{\@RTLtrue\@RTL@footnotetrue\RTLdblcol\autofootnoterule}
+\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
+ \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\,\right\}}
+\def\SepMark#1{\gdef\@SepMark{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+\SepMark{.}
\def\list#1#2{%
\ifnum \@listdepth >5\relax
\@toodeep
@@ -481,163 +291,9819 @@ This work consists of the file \jobname.dtx
\parindent\listparindent
\advance\linewidth -\rightmargin
\advance\linewidth -\leftmargin
- \if@rl
+ \if@RTL
\advance\@totalleftmargin \rightmargin
\else
\advance\@totalleftmargin \leftmargin
\fi
\parshape \@ne \@totalleftmargin \linewidth
\ignorespaces}
-% \end{macrocode}
-% \subsubsection{Dotted line in table of contents}
-% \begin{macrocode}
+\def\raggedright{%
+ \let\\\@centercr
+ \leftskip\z@skip\rightskip\@flushglue
+ \parindent\z@\parfillskip\z@skip}
+\let\@@raggedleft=\raggedleft
+\let\@@raggedright=\raggedright
+\renewcommand\raggedleft{\if@RTL\@@raggedright%
+ \else\@@raggedleft\fi}
+\renewcommand\raggedright{\if@RTL\@@raggedleft%
+ \else\@@raggedright\fi}
+\def\raggedright{%
+ \let\\\@centercr
+ \rightskip\z@skip\rightskip\@flushglue
+ \parindent\z@\parfillskip\z@skip}
+\renewcommand\raggedleft{\@@raggedleft}
+\renewcommand\raggedright{\@@raggedright}
+\def\centerline#1{%
+\if@RTL\@@line{\hss\beginR#1\endR\hss}
+\else\@@line{\hss#1\hss}\fi}
+\def\leftline#1{%
+\if@RTL\@@line{\beginR#1\endR\hss}
+\else\@@line{#1\hss}\fi}
+\def\rightline#1{%
+\if@RTL\@@line{\hss\beginR#1\endR}
+\else\@@line{\hss#1}\fi}
+\def\narrower{%
+ \advance\if@RTL\rightskip\else\leftskip\fi\parindent
+ \advance\if@RTL\leftskip\else\rightskip\fi\parindent}
+\def\leftmark{\beginR\expandafter\@leftmark\botmark\@empty\@empty\endR}
+\def\rightmark{\beginR\expandafter\@rightmark\firstmark\@empty\@empty\endR}
+\def\underline#1{%
+ \relax
+ \ifmmode\@@underline{#1}%
+ \else
+\if@RTL $\@@underline{\hbox{\beginR#1\endR}}\m@th$\relax
+\else
+$\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
+\if@compatibility
+ \let\undertext=\underline
+\fi
+\global\@RTLtabfalse
+\def\@tabular{\if@RTL\global\@RTLtabtrue\fi
+ \leavevmode \hbox \bgroup \if@RTLtab\beginR \fi
+ $\let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
+\def\endtabular{\crcr\egroup\if@RTLtab\egroup\endR\egroup\fi
+ \egroup $\if@RTLtab\endR\fi\egroup
+ \global\@RTLtabfalse}
+\expandafter \let \csname endtabular*\endcsname = \endtabular
+\def\@array[#1]#2{%
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
+ \bgroup
+ \setbox\@arstrutbox\hbox{%
+ \vrule \@height\arraystretch\ht\strutbox
+ \@depth\arraystretch \dp\strutbox
+ \@width\z@}%
+ \@mkpream{#2}%
+ \edef\@preamble{%
+ \ialign \noexpand\@halignto
+ \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \let\tabularnewline\\%
+ \let\par\@empty
+ \let\@sharp##%
+ \set@typeset@protect
+ \lineskip\z@skip\baselineskip\z@skip
+ \ifhmode \@preamerr\z@ \@@par\fi
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble}
+\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4 \else
+ \ifnum \@lastchclass=3 5 \else
+ \z@ \if #1c\@chnum \z@ \else
+ \if \if@RTLtab#1r\else#1l\fi\@chnum \@ne \else
+ \if \if@RTLtab#1l\else#1r\fi\@chnum \tw@ \else
+ \@chclass \if #1|\@ne \else
+ \if #1@\tw@ \else
+ \if #1p3 \else \z@ \@preamerr 0\fi
+ \fi \fi \fi \fi \fi \fi
+\fi}
\def\@dottedtocline#1#2#3#4#5{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
- {\if@rl\rightskip\else\leftskip\fi #2\relax
- \if@rl\leftskip\else\rightskip\fi \@tocrmarg \parfillskip
- -\if@rl\leftskip\else\rightskip\fi
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
- \advance\if@rl\rightskip\else\leftskip\fi \@tempdima
- \null\nobreak\hskip -\if@rl\rightskip\else\leftskip\fi
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
{#4}\nobreak
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak
- \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor \beginL#5\endL}%
+ \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
\par}%
\fi}
+\def\RTL@outputdblcol{\if@firstcolumn
+\global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\box\@outputbox
+ \else \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{%
+ \hbox to\textwidth{%
+ \hbox to\columnwidth{\box\@outputbox \hss}%
+ \hfil \vrule width\columnseprule\hfil
+ \hbox to\columnwidth{\box\@leftcolumn \hss}%
+ }}\@combinedblfloats
+\@outputpage \begingroup \@dblfloatplacement
+\@startdblcolumn
+\@whilesw\if@fcolmade \fi
+{\@outputpage\@startdblcolumn}\endgroup
+ \fi}
+\def\LTR@outputdblcol{\if@firstcolumn
+\global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\box\@outputbox
+ \else \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{\hbox to\textwidth{%
+ \hbox to\columnwidth
+ {\box\@leftcolumn \hss}\hfil
+ \vrule width\columnseprule\hfil
+ \hbox to\columnwidth{\box\@outputbox \hss}}}%
+ \@combinedblfloats
+ \@outputpage \begingroup \@dblfloatplacement
+ \@startdblcolumn
+ \@whilesw\if@fcolmade \fi
+ {\@outputpage\@startdblcolumn}\endgroup
+ \fi}
+\newcommand{\RTLdblcol}{\renewcommand{\@outputdblcol}{\RTL@outputdblcol}}
+\newcommand{\LTRdblcol}{\renewcommand{\@outputdblcol}{\LTR@outputdblcol}}
+\long\def\@makecaption#1#2{%
+ \vskip 10pt%
+ \setbox\@tempboxa\hbox{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize \if@RTL\beginR\fi#1: #2\par%
+ \else \hbox
+to\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil%
+\if@RTL\endR\fi}%
+ \fi}
+\renewenvironment{equation}{%
+ \incr@eqnum
+ \mathdisplay@push
+ \st@rredfalse \global\@eqnswtrue
+ \beginL\mathdisplay{equation}%
+}{%
+ \endmathdisplay{equation}\endL%
+ \mathdisplay@pop
+ \ignorespacesafterend
+}
+\renewcommand{\numberwithin}[3][\arabic]{%
+ \@ifundefined{c@#2}{\@nocounterr{#2}}{%
+ \@ifundefined{c@#3}{\@nocnterr{#3}}{%
+ \@addtoreset{#2}{#3}%
+ \@xp\xdef\csname the#2\endcsname{%
+ \@xp\@nx\csname the#3\endcsname \@SepMark\@nx#1{#2}}}}%
+}
+\def\tagform@#1{\maketag@@@{)\ignorespaces\text{#1}\unskip\@@italiccorr(}}
+\renewcommand{\eqref}[1]{\beginL\textup{\tagform@{\ref{#1}}}\endL}
+\let\@@text=\text
+\def\text#1{\@@text{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+\@ifpackageloaded{amsthm}{\input{amsthm-bidi.def}}{}
+\@ifpackageloaded{xltxtra}{\input{xltxtra-bidi.def}}{}
+\@ifpackageloaded{wrapfig}{\input{wrapfig-bidi.def}}{}
+\@ifpackageloaded{graphicx}{\input{graphicx-bidi.def}}{}
+\@ifpackageloaded{fancyhdr}{\input{fancyhdr-bidi.def}}{}
+\@ifpackageloaded{draftwatermark}{\input{draftwatermark-bidi.def}}{}
+\@ifpackageloaded{pdfpages}{\input{pdfpages-bidi.def}}{}
+\@ifpackageloaded{listings}{\input{listings-bidi.def}}{}
+\@ifpackageloaded{pstricks}{\input{pstricks-bidi.def}}{}
+\@ifpackageloaded{tikz}{\input{tikz-bidi.def}}{}
+\@ifpackageloaded{array}{\input{array-bidi.def}}{}
+\@ifpackageloaded{stabular}{\input{stabular-bidi.def}}{}
+\@ifpackageloaded{longtable}{\input{longtable-bidi.def}}{}
+\@ifpackageloaded{minitoc}{\input{minitoc-bidi.def}}{}
+\@ifpackageloaded{ragged2e}{\input{ragged2e-bidi.def}}{}
+\@ifpackageloaded{tabls}{\input{tabls-bidi.def}}{}
+\@ifpackageloaded{tocloft}{\input{tocloft-bidi.def}}{}
+\@ifpackageloaded{tocstyle}{\input{tocstyle-bidi.def}}{}
+\@ifclassloaded{article}{\input{article-bidi.def}}{}
+\@ifclassloaded{amsart}{\input{amsart-bidi.def}}{}
+\@ifclassloaded{refrep}{\input{refrep-bidi.def}}{}
+\@ifclassloaded{report}{\input{report-bidi.def}}{}
+\@ifclassloaded{rapport3}{\input{rapport3-bidi.def}}{}
+\@ifclassloaded{scrartcl}{\input{scrartcl-bidi.def}}{}
+\@ifclassloaded{scrbook}{\input{scrbook-bidi.def}}{}
+\@ifclassloaded{scrreprt}{\input{scrreprt-bidi.def}}{}
+\@ifclassloaded{amsbook}{\input{amsbook-bidi.def}}{}
+\@ifclassloaded{bookest}{\input{bookest-bidi.def}}{}
+\@ifclassloaded{extbook}{\input{extbook-bidi.def}}{}
+\@ifclassloaded{book}{\input{book-bidi.def}}{}
+\@ifclassloaded{bidibeamer}{\input{bidibeamer-bidi.def}}{}
+\input{footnote-bidi.def}
+\ProcessOptions
+
% \end{macrocode}
-% \subsubsection{\cmd{\raggedright} and \cmd{\raggedleft}}
+% \iffalse
+%</bidi.sty>
+%<*amsart-bidi.def>
+% \fi
+% \part{amsart-bidi.def}
% \begin{macrocode}
-\def\raggedright{%
- \let\\\@centercr
- \leftskip\z@skip\rightskip\@flushglue
- \parindent\z@\parfillskip\z@skip}
-\let\@@raggedleft=\raggedleft
-\let\@@raggedright=\raggedright
-\renewcommand\raggedleft{\if@rl\@@raggedright%
- \else\@@raggedleft\fi}
-\renewcommand\raggedright{\if@rl\@@raggedleft%
- \else\@@raggedright\fi}
+\def\@tocline#1#2#3#4#5#6#7{\relax
+ \ifnum #1>\c@tocdepth % then omit
+ \else
+ \par \addpenalty\@secpenalty\addvspace{#2}%
+ \begingroup \hyphenpenalty\@M
+ \@ifempty{#4}{%
+ \@tempdima\csname r@tocindent\number#1\endcsname\relax
+ }{%
+ \@tempdima#4\relax
+ }%
+ \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
+ \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
+ #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
+ \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
+ \nobreak
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\arabic{subsection}}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\arabic{paragraph}}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\arabic{subparagraph}}
+\def\part{\@startsection{part}{0}%
+ \z@{\linespacing\@plus\linespacing}{.5\linespacing}%
+ {\normalfont\bfseries\raggedleft}}
+\renewenvironment{thebibliography}[1]{%
+ \@bibtitlestyle
+ \normalfont\bibliofont\labelsep .5em\relax
+ \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
+ \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \usecounter{enumiv}}%
+ \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
+ \sfcode`\.=\@m
+}{%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist
+}
% \end{macrocode}
-% \subsubsection{\cmd{\underline}}
+% \iffalse
+%</amsart-bidi.def>
+%<*amsbook-bidi.def>
+% \fi
+% \part{amsbook-bidi.def}
% \begin{macrocode}
-\let\@@@underline=\underline
-\def\underline#1{\@@@underline{\if@rl\RL{#1}\else #1\fi}}
-\if@compatibility
- \let\undertext=\underline
+\def\@tocline#1#2#3#4#5#6#7{\relax
+ \ifnum #1>\c@tocdepth % then omit
+ \else
+ \par \addpenalty\@secpenalty\addvspace{#2}%
+ \begingroup \hyphenpenalty\@M
+ \@ifempty{#4}{%
+ \@tempdima\csname r@tocindent\number#1\endcsname\relax
+ }{%
+ \@tempdima#4\relax
+ }%
+ \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
+ \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
+ #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
+ \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
+ \nobreak
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\arabic{subsection}}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\arabic{paragraph}}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\arabic{subparagraph}}
+\renewenvironment{thebibliography}[1]{%
+ \@bibtitlestyle
+ \normalfont\bibliofont\labelsep .5em\relax
+ \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
+ \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \usecounter{enumiv}}%
+ \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
+ \sfcode`\.=\@m
+}{%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist
+}
+\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
+\columnseprule\z@ \columnsep 35\p@
+\@indextitlestyle
+\thispagestyle{plain}%
+\let\item\@idxitem
+\parindent\z@ \parskip\z@\@plus.3\p@\relax
+\raggedleft
+\hyphenpenalty\@M
+\footnotesize}
+
+\def\@idxitem{\par\hangindent -2em}
+\def\subitem{\par\hangindent -2em\hspace*{1em}}
+\def\subsubitem{\par\hangindent -3em\hspace*{2em}}
+% \end{macrocode}
+% \iffalse
+%</amsbook-bidi.def>
+%<*amsthm-bidi.def>
+% \fi
+% \part{amsthm-bidi.def}
+% \begin{macrocode}
+\def\@thmcountersep{\@SepMark}
+% \end{macrocode}
+% \iffalse
+%</amsthm-bidi.def>
+%<*array-bidi.def>
+% \fi
+% \part{array-bidi.def}
+% \begin{macrocode}
+\def\@testpach{\@chclass
+ \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
+ \ifnum \@lastchclass=7 5 \else
+ \ifnum \@lastchclass=8 \tw@ \else
+ \ifnum \@lastchclass=9 \thr@@
+ \else \z@
+ \ifnum \@lastchclass = 10 \else
+ \edef\@nextchar{\expandafter\string\@nextchar}%
+ \@chnum
+ \if \@nextchar c\z@ \else
+ \if \@nextchar \if@RTLtab r\else l\fi\@ne \else
+ \if \@nextchar \if@RTLtab l\else r\fi\tw@ \else
+ \z@ \@chclass
+ \if\@nextchar |\@ne \else
+ \if \@nextchar !6 \else
+ \if \@nextchar @7 \else
+ \if \@nextchar <8 \else
+ \if \@nextchar >9 \else
+ 10
+ \@chnum
+ \if \@nextchar m\thr@@\else
+ \if \@nextchar p4 \else
+ \if \@nextchar b5 \else
+ \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
+ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
+\def\tabular{\gdef\@halignto{}\@tabular}
+\def\@tabular{\if@RTL\global\@RTLtabtrue\fi%
+ \leavevmode
+ \hbox\bgroup \if@RTLtab\beginR \fi
+ $%
+ \@tabularinit
+ \@array
+}
+\renewcommand\@array[2][c]{%
+ \@tempdima \ht \strutbox
+ \advance \@tempdima by\extrarowheight
+ \setbox \@arstrutbox \hbox{%
+ \vrule \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@
+ }%
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\@preamble{%
+ \noexpand \ialign \@halignto
+ \bgroup \@arstrut \@preamble
+ \tabskip \z@ \cr
+ }%
+ \endgroup
+ \@arrayleft
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
+ \bgroup
+ \@arrayinit
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble
+ % indent
+}
+%% environment body goes here
+\def\endtabular{%
+ \crcr
+ \egroup % \bgroup from \@preamble
+ \if@RTLtab\egroup\endR\egroup\fi % \vbox\hbox
+ \egroup
+ \gdef\@preamble{}%
+ $\if@RTLtab\endR\fi%
+ \egroup % original \hbox
+\global\@RTLtabfalse}
+\def\@tabularinit{%
+ \col@sep\tabcolsep
+ \let \d@llarbegin \begingroup
+ \let \d@llarend \endgroup
+}
+\def\@arrayinit{%
+ \let \@sharp ##
+ \let \protect \relax
+ \lineskip \z@
+ \baselineskip \z@
+ \m@th
+ \let \\ \@arraycr
+ \let \tabularnewline \\%
+ \let \par \@empty
+}
+% \end{macrocode}
+% \iffalse
+%</array-bidi.def>
+%<*article-bidi.def>
+% \fi
+% \part{article-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty\@secpenalty
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \fi
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@part[#1]#2{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \fi
+ {\parindent \z@ \raggedleft
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \Large\bfseries \partname\nobreakspace\thepart
+ \par\nobreak
+ \fi
+ \huge \bfseries #2%
+ \markboth{}{}\par}%
+ \nobreak
+ \vskip 3ex
+ \@afterheading}
+ \def\ps@plain{\ps@empty
+ \def\@oddfoot{\hfil\thepage\hfil}%
+ \let\@evenfoot\@oddfoot
+}
+\renewenvironment{thebibliography}[1]
+ {\section*{\refname}%
+ \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\beginR\leftmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markboth {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@
+ \thesection\quad
+ \fi
+ \beginR##1\endR}}{}}%
+ \def\subsectionmark##1{%
+ \markright {%
+ \ifnum \c@secnumdepth >\@ne
+ \beginR\thesubsection\quad\endR
+ \fi
+ \beginR##1\endR}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \beginR\thesection\quad\endR
+ \fi
+ \beginR##1\endR}}}}
\fi
+\def\ps@myheadings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\@gobbletwo
+ \let\sectionmark\@gobble
+ \let\subsectionmark\@gobble
+ }
+\pagestyle{plain}
% \end{macrocode}
-% \subsubsection{\cmd\@outputdblcol}
+% \iffalse
+%</article-bidi.def>
+%<*bidibeamer-bidi.def>
+% \fi
+% \part{beamer-bidi.def}
% \begin{macrocode}
-\let\lr@outputdblcol\@outputdblcol
-\renewcommand{\@outputdblcol}{%
- \if@rlmain%
- \rl@outputdblcol%
+\raggedleft
+\def\LTR{\bgroup\par\raggedright\@RTLfalse}
+\def\endLTR{\par\egroup}
+\def\RTL{\bgroup\par\raggedleft\@RTLtrue}
+\def\endRTL{\par\egroup}
+\long\def\beamer@@frametitle[#1]#2{%
+ \beamer@ifempty{#2}{}{%
+ \gdef\insertframetitle{\raggedleft\rightskip=2em{\beginR#2\endR\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
+ \gdef\beamer@frametitle{\beginR#2\endR}%
+ \gdef\beamer@shortframetitle{\beginR#1\endR}%
+}%
+}
+\def\@thm#1#2#3{%
+ \ifhmode\unskip\unskip\par\fi
+ \normalfont
+ \let\thmheadnl\relax
+ \let\thm@swap\@gobble
+ \thm@headpunct{.}% add period after heading
+ \thm@space@setup
+ #1% style overrides
+ \def\inserttheoremname{#3}
+ \def\inserttheorempunctuation{\the\thm@headpunct}
+ \def\@tempa{#2}%
+ \ifx\@empty\@tempa
+ \def\inserttheoremnumber{}
+ \else
+ \refstepcounter{#2}%
+ \expandafter\def\expandafter\inserttheoremnumber\expandafter{ \csname the#2\endcsname}
+ \fi
+ \beamer@begintheorem%
+\raggedleft\@RTLtrue
+}
+ \ifbeamer@countsect
+ \newtheorem{biditheorem}{\raggedleft \biditheoremname}[section]
+ \else
+ \newtheorem{biditheorem}{\raggedleft \biditheoremname}
+ \fi
+ \newtheorem{bidicorollary}[theorem]{\raggedleft \bidicorollaryname}
+ \newtheorem{bidifact}[theorem]{\raggedleft \bidifactname}
+ \newtheorem{bidilemma}[theorem]{\raggedleft \bidilemmaname}
+ \newtheorem{bidiproblem}[theorem]{\raggedleft \bidiproblemname}
+ \newtheorem{bidisolution}[theorem]{\raggedleft \bidisolutionname}
+\theoremstyle{definition}
+ \newtheorem{bididefinition}[theorem]{\raggedleft \bididefinitionname}
+ \newtheorem{bididefinitions}[theorem]{\raggedleft \bididefinitionsname}
+\theoremstyle{example}
+ \newtheorem{bidiexample}[theorem]{\raggedleft \bidiexamplename}
+ \newtheorem{bidiexamples}[theorem]{\raggedleft \bidiexamplesname}
+\newenvironment<>{bidiproof}[1][\raggedleft \bidiproofname]{%
+ \par
+ \def\insertproofname{#1\@addpunct{}}%
+ \pushQED{\qed}
+ \usebeamertemplate{proof begin}\@RTLtrue#2}
+{\popQED\usebeamertemplate{proof end}}
+ \newenvironment<>{bidiblock}[1]{%
+ \begin{actionenv}#2%
+ \def\insertblocktitle{\raggedleft#1}%
+ \par%
+ \usebeamertemplate{block begin}\raggedleft\@RTLtrue}
+ {\par%
+ \usebeamertemplate{block end}%
+ \end{actionenv}}
+ \newenvironment<>{bidialertblock}[1]{%
+ \begin{actionenv}#2%
+ \def\insertblocktitle{\raggedleft#1}%
+ \par%
+ \mode<presentation>{%\usebeamerfont{block}%
+ \setbeamercolor{local structure}{parent=alerted text}}%
+ \usebeamertemplate{block alerted begin}\raggedleft\@RTLtrue}
+ {\par%
+ \usebeamertemplate{block alerted end}%
+ \end{actionenv}}
+ \newenvironment<>{bidiexampleblock}[1]{%
+ \begin{actionenv}#2%
+ \def\insertblocktitle{\raggedleft#1}%
+ \par%
+ \mode<presentation>{%\usebeamerfont{block}%
+ \setbeamercolor{local structure}{parent=example text}}%
+ \usebeamertemplate{block example begin}\raggedleft\@RTLtrue}
+ {\par%
+ \usebeamertemplate{block example end}%
+ \end{actionenv}}
+\def\@listi{\if@RTL\rightmargin\leftmargini\else\leftmargin\leftmargini\fi
+ \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
+ \parsep 0\p@
+ \itemsep3\p@ \@plus2\p@ \@minus3\p@}
+\let\@listI\@listi
+\def\@listii{\if@RTL\rightmargin\leftmarginii\else\leftmargin\leftmarginii\fi
+ \topsep 2\p@ \@plus1\p@ \@minus2\p@
+ \parsep 0\p@ \@plus\p@
+ \itemsep \parsep}
+\def\@listiii{\if@RTL\rightmargin\leftmarginiii\else\leftmargin\leftmarginiii\fi
+ \topsep 2\p@ \@plus1\p@ \@minus2\p@
+ \parsep 0\p@ \@plus\p@
+ \itemsep \parsep}
+\def\beamer@enum@{%
+ \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
+ \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
+ \expandafter
+ \list
+ {\usebeamertemplate{\beamer@enumtempl}}
+ {\usecounter\@enumctr%
+ \def\makelabel##1{{\hss\llap{{%
+ \usebeamerfont*{enumerate \beameritemnestingprefix item}%
+ \usebeamercolor[fg]{enumerate \beameritemnestingprefix item}##1}}}}}%
+ \beamer@cramped%
+ \raggedleft%
+ \beamer@firstlineitemizeunskip%
+}
+\renewcommand{\itemize}[1][]{%
+ \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
+ \ifnum \@itemdepth >2\relax\@toodeep\else
+ \advance\@itemdepth\@ne
+ \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
+ \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
+ \list
+ {\usebeamertemplate{itemize \beameritemnestingprefix item}}
+ {\def\makelabel##1{%
+ {%
+ \hss\llap{{%
+ \usebeamerfont*{itemize \beameritemnestingprefix item}%
+ \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
+ }%
+ }%
+ }
+ \fi%
+ \beamer@cramped%
+ \raggedleft%
+ \beamer@firstlineitemizeunskip%
+}
+\def\@@description{%
+ \advance\beamer@descdefault by \labelsep%
+ \list
+ {}
+ {\labelwidth\beamer@descdefault\leftmargin\beamer@descdefault\let\makelabel\beamer@descriptionitem}%
+ \beamer@cramped%
+ \raggedleft\rightskip=6em
+ \beamer@firstlineitemizeunskip%
+}
+\AtBeginDocument{\@RTLfalse}
+\renewenvironment{beamer@frameslide}{%
+ \ifbeamer@autobreak\else%
+ \ifx\beamer@againname\@empty%
+ {\let\@elt\beamer@restorecounter\beamer@overlaycounterresets}%
+ \else%
+ {\let\@elt\beamer@labelrestorecounter\beamer@overlaycounterresets}%
+ \fi%
+ \fi%
+ \global\c@beamerpauses=1\relax%
+ \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{%
+ \refstepcounter{subsectionslide}%
+ \xdef\beamer@framestartpage{\the\c@page}% only first time
+ }{\clearpage\beamer@notesactions}% cleanup from previous slide
+ \hypersetup{pdfpagetransition=R}%
+ \hypersetup{pdfpageduration=}%
+ \xdef\beamer@frameendpage{\the\c@page}% every time
+ \beamer@setuplinks%
+ \beamer@displaybreak%
+ \global\setbox\beamer@zoombox=\box\voidb@x%
+ \def\beamer@zoomer{}%
+ \beamer@slidehaszoomfalse%
+ \gdef\insertframetitle{}%
+ \gdef\insertframesubtitle{}%
+ \gdef\beamer@frametitle{}%
+ \gdef\beamer@shortframetitle{}%
+ \gdef\beamer@framesubtitle{}%
+ \let\beamer@startcomment=\beamer@startcommentinframe%
+ % Start slide:
+ \beamer@framenotesbegin\@RTLtrue%
+ \global\setbox\beamer@framebox=\vbox\bgroup%
+ \beamer@inframetrue%
+ \let\frame=\framelatex% inside frames, use LaTeX's \frame command
+ \begin{beamer@framepauses}%
+ \ifbeamer@shrink%
+ \hsize=\beamer@shrinkfactorinv\hsize%
+ \textwidth=\beamer@shrinkfactorinv\textwidth%
+ \linewidth=\beamer@shrinkfactorinv\linewidth%
+ \fi%
+ % Insert labels if necessary:
+ \ifx\beamer@againname\@empty\else%
+ \nointerlineskip\vbox to0pt{\vss%
+ \label<\the\beamer@slideinframe>{\beamer@againname<\the\beamer@slideinframe>}%
+ \ifnum\beamer@slideinframe=1\relax%
+ \label<1>{\beamer@againname}%
+ \fi%
+ }\nointerlineskip%
+ \fi%
+ \ifx\beamer@framehypertargets\@empty\else%
+ \nointerlineskip\vbox to0pt{\vss%
+ \beamer@framehypertargets%
+ \global\let\beamer@framehypertargets\@empty%
+ }\nointerlineskip%
+ \fi%
+ \vskip-\parskip\vbox{}%
+ \beamer@initfirstlineunskip%
+ \ifbeamer@plainframe\nointerlineskip\fi%
+ \beamer@checkframetitle}%
+ {\end{beamer@framepauses}%
+ \egroup%
+ \ifx\beamer@frametitle\@empty%
+ \setbox\beamer@frametitlebox=\box\voidb@x%
+ \else%
+ \setbox\beamer@frametitlebox=\vbox{%
+ \vbox{}%
+ {\parskip0pt\usebeamertemplate***{frametitle}\vskip0.25em}%
+ }%
+ \fi%
+ \ifbeamer@plainframe%
+ \beamer@frametextheight=\paperheight%
+ \else%
+ \beamer@frametextheight=\textheight%
+ \fi%
+ \advance\beamer@frametextheight by-\ht\beamer@frametitlebox%
+ \advance\beamer@frametextheight by-\dp\beamer@frametitlebox%
+ \advance\beamer@frametextheight by-\beamer@frametopskip%
+ \ifbeamer@shrink%
+ \beamer@shrinkframebox%
+ \fi%
+ \ifx\beamer@zoomer\@empty
+ \setbox\beamer@framebox=\vbox{%
+ \nobreak\vbox{}\nobreak\par\nobreak\beamer@entrycode\nobreak%
+ \nointerlineskip\unvbox\beamer@frametitlebox%
+ \nobreak%
+ \ifbeamer@autobreak%
+ \vskip\beamer@frametopskipautobreak%
+ \else%
+ \vskip\beamer@frametopskip%
+ \fi%
+ \nobreak%
+ \nointerlineskip\box\beamer@zoombox\nointerlineskip%
+ \nobreak%
+ \ifbeamer@slidehaszoom\box\beamer@framebox\else\unvbox\beamer@framebox\fi%
+ % bottom skip is added in autobreakframebox
+ }%
+ \beamer@autobreakframebox%
\else%
- \lr@outputdblcol%
+ \beamer@zoomer%
+ \fi%
+ \beamer@undolabels%
+ \beamer@framenotesend%
+ \box\beamer@framebox}
+\long\def\beamer@title[#1]#2{%
+ \def\inserttitle{\beginR#2\endR}%
+ \def\beamer@shorttitle{\beginR#1\endR}%
+ }
+\long\def\beamer@subtitle[#1]#2{%
+ \def\insertsubtitle{\beginR#2\endR}%
+ \def\beamer@shortsubtitle{\beginR#1\endR}%
+ }
+\long\def\beamer@date[#1]#2{%
+ \def\insertdate{\beginR#2\endR}%
+ \def\beamer@shortdate{\beginR#1\endR}%
+ }
+\long\def\beamer@author[#1]#2{%
+ \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}\beginR#2\endR}%
+ \def\beamer@shortauthor{\beginR#1\endR}%
+ \ifbeamer@autopdfinfo%
+ \def\beamer@andstripped{}%
+ \beamer@stripands#2 \and\relax
+ {\let\inst=\@gobble\let\thanks=\@gobble\def\and{, }\hypersetup{pdfauthor={\beamer@andstripped}}}
\fi%
}
-\newcommand{\rl@outputdblcol}{%
- \if@firstcolumn
- \global \@firstcolumnfalse
- \global \setbox\@leftcolumn \box\@outputbox
- \else
- \global \@firstcolumntrue
- \setbox\@outputbox \vbox {\hb@xt@\textwidth {%
- \hskip\columnwidth%
- \hfil\vrule\@width\columnseprule\hfil
- \hb@xt@\columnwidth {%
- \box\@leftcolumn \hss}%
- \hb@xt@\columnwidth {%
- \hskip-\textwidth%
- \box\@outputbox \hss}%
- \hskip\columnsep%
- \hskip\columnwidth}}%
- \@combinedblfloats
- \@outputpage
- \begingroup
- \@dblfloatplacement
- \@startdblcolumn
- \@whilesw\if@fcolmade \fi
- {\@outputpage
- \@startdblcolumn}%
- \endgroup
- \fi}
+\long\def\beamer@institute[#1]#2{%
+ \def\beamer@temp{\beginR#2\endR}%
+ \ifx\beamer@temp\@empty
+ \def\insertinstitute{}
+ \else
+ \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}\beginR#2\endR}%
+ \fi
+ \def\beamer@shortinstitute{\beginR#1\endR}}
+\renewenvironment{thebibliography}[1]
+{%\leavevmode\unskip%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\beamer@biblabeltemplate{\@biblabel{#1}}}%
+ \leftmargin\labelwidth
+ \advance\leftmargin\labelsep
+ \itemsep=0pt%
+ \partopsep=0pt%
+ \topsep=0pt%
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}
+ \let\makelabel\beamer@biblabeltemplate}%
+ \sloppy\raggedleft
+ \clubpenalty10000
+ \@clubpenalty \clubpenalty
+ \widowpenalty10000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \ifhmode\unskip\fi\endlist}
+\long\def\beamer@@@section#1{\beamer@section[\beginR#1\endR]{#1}}
+\def\beamer@@@subsection#1{\beamer@subsection[\beginR#1\endR]{#1}}
+\def\beamer@@@subsubsection#1{\beamer@subsubsection[\beginR#1\endR]{#1}}
+\long\def\beamer@subsectionintoc#1#2#3#4#5#6{%
+ \ifnum\c@tocdepth>1%
+ \ifnum#5=\beamer@showpartnumber%
+ {
+ \beamer@saveanother%
+ \gdef\beamer@todo{}%
+ \beamer@slideinframe=#1\relax%
+ \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
+ \ifbeamer@pausesubsections\pause\fi%
+ \beamer@tempcount=#6%
+ \advance\beamer@tempcount by\beamer@sectionadjust%
+ \edef\inserttocsectionnumber{\the\beamer@tempcount}%
+ \def\inserttocsubsectionnumber{#2}%
+ \def\inserttocsubsection{\rightskip=1.5em\hyperlink{Navigation#4}{\beginR#3\endR\hfill}}%
+ \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@oss\else\beamer@toc@ooss\fi}%
+ {%
+ \def\beamer@breakhere{\\}%
+ \beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
+ {subsection in toc}%
+ }%
+ }}%
+ \beamer@restoreanother%
+ }
+ \beamer@todo%
+ \fi\fi%
+}
+\long\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{%
+ \ifnum\c@tocdepth>2%
+ \ifnum#1=\beamer@showpartnumber%
+ {
+ \beamer@saveanother%
+ \gdef\beamer@todo{}%
+ \beamer@slideinframe=#2\relax%
+ \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
+ \ifbeamer@pausesubsections\pause\fi%
+ \beamer@tempcount=#6%
+ \advance\beamer@tempcount by\beamer@sectionadjust%
+ \edef\inserttocsectionnumber{\the\beamer@tempcount}%
+ \def\inserttocsubsectionnumber{#3}%
+ \def\inserttocsubsubsectionnumber{#4}%
+ \def\inserttocsubsubsection{\rightskip=3em\hyperlink{Navigation#5}{\beginR#7\endR\hfill}}%
+ \beamer@tocifnothide{\ifnum\c@section=#2\beamer@toc@oss\else\beamer@toc@ooss\fi}%
+ {%
+ \def\beamer@breakhere{\\}%
+ \beamer@tocact{\ifnum\c@section=#2\ifnum\c@subsection=#3\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
+ {subsubsection in toc}%
+ }%
+ }}%
+ \beamer@restoreanother%
+ }
+ \beamer@todo%
+ \fi\fi%
+}
+\long\def\beamer@makecaption#1#2{%
+ \def\insertcaptionname{\csname#1name\endcsname}%
+ \def\insertcaptionnumber{\csname the#1\endcsname}%
+ \def\insertcaption{#2}%
+ \nobreak\vskip\abovecaptionskip\nobreak
+ \sbox\@tempboxa{\usebeamertemplate**{caption}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \usebeamertemplate**{caption}\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil\if@RTL\endR\fi}%
+ \fi
+ \nobreak\vskip\belowcaptionskip\nobreak}
+\let\origin@alert=\alert
+\def\alert#1{\ifmmode\origin@alert{#1}\else\if@RTL\beginL\origin@alert{\beginR#1\endR}\endL\else\origin@alert{#1}\fi\fi}
+% \end{macrocode}
+% \iffalse
+%</bidibeamer-bidi.def>
+%<*bidibeamer.cls>
+% \fi
+% \part{bidibeamer.cls}
+% \begin{macrocode}
+% Copyright 2007 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/licenses/LICENSE for more details.
+
+\RequirePackage{beamerbasercs}
+\def\beamer@version{3.07}
+
+
+
+
+\RequirePackage{beamerbasemodes}
+% Setup modes and check for article option
-% \subsection{Footnotes}
-% This implements the bidirectionality of plain \LaTeX\ footnotes.
+\beamer@transferifnecessary
+
+%
+% Ensure that \pdfoutput is defined. Might be removed at some point.
+%
+\ifx\pdfoutput\@undefined \newcount\pdfoutput \fi
+\ifx\pdfoutput\relax \newcount\pdfoutput \fi
+
+%
+%
+% Declarations used by beamer
+%
+%
+
+% Public
+\newdimen\headheight % Total height of the headline (including depth)
+\newdimen\headdp % Depth of the headline
+\newdimen\footheight % Height of the footline
+\newdimen\sidebarheight % Height of the sidebars
+
+% Private
+\newdimen\beamer@tempdim
+\newdimen\beamer@finalheight
+\newdimen\beamer@animht
+\newdimen\beamer@animdp
+\newdimen\beamer@animwd
+\newdimen\beamer@leftmargin
+\newdimen\beamer@rightmargin
+\newdimen\beamer@leftsidebar
+\newdimen\beamer@rightsidebar
+\newdimen\beamer@boxsize
+\newdimen\beamer@vboxoffset
+\newdimen\beamer@descdefault
+\newdimen\beamer@descriptionwidth
+
+\newskip\beamer@lastskip
+
+\newbox\beamer@areabox
+\newbox\beamer@animcurrent
+\newbox\beamer@animshowbox
+\newbox\beamer@sectionbox
+\newbox\beamer@logobox
+\newbox\beamer@linebox
+
+\newcount\beamer@sectioncount
+\newcount\beamer@subsubsectionmax
+\newcount\beamer@subsectionmax
+\newcount\beamer@sectionmax
+\newcount\beamer@totalheads
+\newcount\beamer@headcounter
+\newcount\beamer@partstartpage
+\newcount\beamer@sectionstartpage
+\newcount\beamer@subsectionstartpage
+\newcount\beamer@animationtempa
+\newcount\beamer@animationtempb
+\newcount\beamer@xpos
+\newcount\beamer@ypos
+\newcount\beamer@showpartnumber
+\newcount\beamer@currentsubsection
+\newcount\beamer@coveringdepth
+\newcount\beamer@sectionadjust
+\newcount\beamer@tocsectionnumber
+
+
+\newif\ifbeamer@sansmath
+\newif\ifbeamer@altmode
+\newif\ifbeamer@notes
+\newif\ifbeamer@notesnormals
+\newif\ifbeamer@compress
+\newif\ifbeamer@centered
+\newif\ifbeamer@draftmode
+\newif\ifbeamer@suppressreplacements % decides whether fonts should be substituted
+\newif\ifbeamer@frameswithnotesonly
+\newif\ifbeamer@ignorenonframe
+\newif\ifbeamer@autopdfinfo
+
+\RequirePackage{beamerbaseoptions}
+% For option management
+
+
+
+%
+%
+% Document options
+%
+%
+
+\beamer@suppressreplacementsfalse
+\beamer@altmodefalse
+\beamer@notesfalse
+\beamer@notesnormalstrue
+\beamer@compressfalse
+\beamer@draftmodefalse
+\beamer@frameswithnotesonlyfalse
+\beamer@ignorenonframefalse
+\beamer@autopdfinfotrue
+
+\DeclareOptionBeamer{usepdftitle}[true]{\csname beamer@autopdfinfo#1\endcsname}
+\DeclareOptionBeamer{envcountsect}{\beamer@countsecttrue}
+\DeclareOptionBeamer{notheorems}{\beamer@blocksfalse}
+\DeclareOptionBeamer{noamsthm}{\beamer@blocksfalse\beamer@amsfalse}
+
+\DeclareOptionBeamer{compress}{\beamer@compresstrue}
+
+\DeclareOptionBeamer{t}{\beamer@centeredfalse}
+\DeclareOptionBeamer{c}{\beamer@centeredtrue}
+
+
+\DeclareOptionBeamer{leqno}{\input{leqno.clo}}
+\DeclareOptionBeamer{fleqn}{\input{fleqn.clo}}
+
+\def\beamer@currentmode{beamer}
+\DeclareOptionBeamer{handout}{\gdef\beamer@currentmode{handout}}
+\DeclareOptionBeamer{trans}{\gdef\beamer@currentmode{trans}}
+
+\DeclareOptionBeamer{pdftex}{}% Used by hyperref
+\DeclareOptionBeamer{nativepdf}{}% Used by hyperref
+\DeclareOptionBeamer{pdfmark}{}% Used by hyperref
+\DeclareOptionBeamer{dvips}{}% Used by hyperref
+\DeclareOptionBeamer{dviwindo}{}% Used by hyperref
+\DeclareOptionBeamer{dvipsone}{}% Used by hyperref
+\DeclareOptionBeamer{vtex}{}% Used by hyperref
+\DeclareOptionBeamer{ps2pdf}{}% Used by hyperref
+
+\DeclareOptionBeamer{ignorenonframetext}{\beamer@ignorenonframetrue}
+
+\def\beamer@size{{size11.clo}}
+\DeclareOptionBeamer{bigger}{\def\beamer@size{{size12.clo}}}
+\DeclareOptionBeamer{smaller}{\def\beamer@size{{size10.clo}}}
+
+\DeclareOptionBeamer{8pt}{\def\beamer@size{{size8.clo}}}
+\DeclareOptionBeamer{9pt}{\def\beamer@size{{size9.clo}}}
+\DeclareOptionBeamer{10pt}{\def\beamer@size{{size10.clo}}}
+\DeclareOptionBeamer{11pt}{\def\beamer@size{{size11.clo}}}
+\DeclareOptionBeamer{12pt}{\def\beamer@size{{size12.clo}}}
+\DeclareOptionBeamer{14pt}{\def\beamer@size{{size14.clo}}}
+\DeclareOptionBeamer{17pt}{\def\beamer@size{{size17.clo}}}
+\DeclareOptionBeamer{20pt}{\def\beamer@size{{size20.clo}}}
+
+\DeclareOptionBeamer{draft}{\beamer@draftmodetrue}
+\def\insertpagenumber{\thepage}
+
+\def\beamer@activecjk{}
+\def\beamer@hypercjk{}
+
+\DeclareOptionBeamer{CJK}{\ExecuteOptionsBeamer{cjk}}
+\DeclareOptionBeamer{cjk}{
+ \def\beamer@hypercjk{\hypersetup{CJKbookmarks=true}}
+
+ \def\beamer@activecjk{
+ % Activate all >=128 characters.
+ \count@=127
+ \@whilenum\count@<254 \do{%
+ \advance\count@ by 1
+ \lccode`\~=\count@
+ \catcode\count@=\active
+ \lowercase{\def~{\kern1ex}}
+ }
+ }
+}
+
+
+
+% obsolete options
+\DeclareOptionBeamer{notes}[show]{\csname beamer@notesaction@#1\endcsname}
+\def\beamer@notesaction@hide{%
+ \ClassWarning{beamer}{This option is obsolete. Use beamer option
+ ``hide notes'' instead.}%
+ \beamer@notesfalse}
+\def\beamer@notesaction@show{%
+ \ClassWarning{beamer}{This option is obsolete. Use beamer option
+ ``show notes'' instead.}%
+ \beamer@notestrue}
+\def\beamer@notesaction@only{%
+ \ClassWarning{beamer}{This option is obsolete. Use beamer option
+ ``show only notes'' instead.}%
+ \beamer@notestrue
+ \beamer@notesnormalsfalse
+ \nofiles
+}
+\def\beamer@notesaction@onlyslideswithnotes{%
+ \beamer@notestrue%
+ \beamer@frameswithnotesonlytrue%
+ \nofiles
+}
+\DeclareOptionBeamer{inrow}{
+ \ClassError{beamer}{``inrow'' no longer supported. Use ``compress'' instead.}{}}
+\DeclareOptionBeamer{compressnotes}{%
+ \ClassWarning{beamer}{``compressnotes'' is obsolete. Use
+ \noexpand\setbeamertemplate{note page}[compressed] instead}
+ \AtBeginDocument{\beamertemplatenotecompress}}
+\DeclareOptionBeamer{notesonly}{
+ \ClassWarning{beamer}{``notesonly'' is obsolete. Use beamer option
+ ``show only notes'' instead.}
+ \beamer@notesaction@only}
+\DeclareOptionBeamer{blue}{
+ \ClassWarning{beamer}{``blue'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.2,0.2,0.7}]{structure}}}
+\DeclareOptionBeamer{red}{
+ \ClassWarning{beamer}{``red'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.7,0.2,0.2}]{structure}}}
+\DeclareOptionBeamer{blackandwhite}{
+ \ClassWarning{beamer}{``blackandwhite'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.2,0.2,0.2}]{structure}}}
+\DeclareOptionBeamer{brown}{
+ \ClassWarning{beamer}{``brown'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.66,0.4,0.166}]{structure}}}
+\DeclareOptionBeamer{slidescentered}{
+ \ClassWarning{beamer}{``slidescentered'' is obsolete. Use ``c'' instead}
+ \beamer@centeredtrue}
+\DeclareOptionBeamer{slidestop}{
+ \ClassWarning{beamer}{``slidestop'' is obsolete. Use ``t'' instead}
+ \beamer@centeredfalse}
+\DeclareOptionBeamer{sans}{%
+ \ClassWarning{beamer}{``sans'' is obsolete. Just remove this option}
+ \def\familydefault{\sfdefault}
+ \def\mathfamilydefault{\sfdefault}
+ \beamer@sansmathtrue
+}
+\DeclareOptionBeamer{serif}{%
+ \ClassWarning{beamer}{``serif'' is obsolete. Use font theme ``serif'' instead}
+ \def\familydefault{\rmdefault}
+ \def\mathfamilydefault{\rmdefault}
+ \beamer@sansmathfalse
+}
+\DeclareOptionBeamer{mathsans}{
+ \ClassWarning{beamer}{``mathsans'' is obsolete. Use font theme ``serif'' with option ``butsansserifmath''}
+ \def\mathfamilydefault{\sfdefault}\beamer@sansmathtrue}
+\DeclareOptionBeamer{mathserif}{
+ \ClassWarning{beamer}{``mathserif'' is obsolete. Use font theme ``serif'' with option ``onlymath''}
+ \def\mathfamilydefault{\rmdefault}\beamer@sansmathfalse}
+\DeclareOptionBeamer{professionalfont}{
+ \ClassWarning{beamer}{``professionalfont'' is obsolete. Use font theme ``professionalfonts'' instead}
+ \beamer@suppressreplacementstrue}
+
+% has to be done here for compatibility
+\def\familydefault{\rmdefault}
+\def\mathfamilydefault{\sfdefault}
+\beamer@sansmathtrue
+
+
+
+\PassOptionsToPackage{bookmarks=true,%
+ bookmarksopen=true,%
+ pdfborder={0 0 0},%
+ pdfhighlight={/N},%
+ linkbordercolor={.5 .5 .5}}{hyperref}
+
+\DeclareOptionBeamer{pgf}{\PassOptionsToPackage{#1}{pgf}}
+\DeclareOptionBeamer{hyperref}{\PassOptionsToPackage{#1}{hyperref}}
+\DeclareOptionBeamer{color}{\PassOptionsToPackage{#1}{color}}
+\DeclareOptionBeamer{xcolor}{\PassOptionsToPackage{#1}{xcolor}}
+
+\def\beamer@loaducs{}
+
+\DeclareOptionBeamer{ucs}{%
+ \ifcase\pdfoutput
+ \def\beamer@loaducs{
+ \RequirePackage{ucs}%
+ \AtBeginDocument{\PreloadUnicodePage{0}}%
+ \AtBeginDocument{\PreloadUnicodePage{1}}%
+ }
+ \or
+ \PassOptionsToPackage{pdftex,unicode}{hyperref}
+ \def\beamer@loaducs{
+ \RequirePackage[hyperref]{ucs}%
+ \AtBeginDocument{\PreloadUnicodePage{0}}%
+ \AtBeginDocument{\PreloadUnicodePage{1}}%
+ }
+ \fi
+}
+\DeclareOptionBeamer{utf8}{\ExecuteOptionsBeamer{ucs}%
+ \g@addto@macro\beamer@loaducs{\RequirePackage[utf8]{inputenc}}%
+}
+
+%
+% Process Options
+%
+
+\ExecuteOptionsBeamer{c}
+\ProcessOptionsBeamer
+
+% Filter class option list
+\beamer@filterclassoptions
+
+
+\RequirePackage{pgfcore,pgfbaseimage}
+% We need only the core and some image stuff for icons.
+
+\RequirePackage{xxcolor}
+% For color management.
+
+\RequirePackage{amssymb}
+% For \blacktriangleright
+
+\RequirePackage[%
+ papersize={12.80cm,9.60cm},
+ hmargin=1cm,%
+ vmargin=0cm,%
+ head=0.5cm,% will be changed later
+ headsep=0pt,%
+ foot=0.5cm% will be changed later
+ ]{geometry}
+% For the page layout
+
+\RequirePackage[implicit=false]{hyperref}
+% For hyperlinks
+
+\hypersetup{pdfcreator={LaTeX with beamer class version \beamer@version}}
+
+% Coding stuff
+\beamer@loaducs
+\beamer@hypercjk
+
+\expandafter\input\beamer@size
+\geometry{headsep=0pt}
+
+
+\RequirePackage{beamerbasecompatibility}
+% Fixes other packages
+
+\RequirePackage{beamerbasefont}
+% Font stuff
+
+% Defaults
+\normalfont
+\raggedleft
+
+\AtBeginDocument
+{
+ \addtocontents{toc}{\protect\beamer@endinputifotherversion{\beamer@version pt}}
+ \addtocontents{nav}{\protect\beamer@endinputifotherversion{\beamer@version pt}}
+}
+
+\RequirePackage{beamerbasemisc}
+% Miscellaneous commands
+
+\RequirePackage{beamerbasetwoscreens}
+% Stuff for using two screens
+
+\RequirePackage{beamerbaseoverlay}
+% Overlay stuff
+
+\RequirePackage{beamerbasetitle}
+% Commands for constructing the title page
+
+\RequirePackage{beamerbasesection}
+% Parts, sections, subsections, appendix
+
+\RequirePackage{beamerbaseframe}
+% Commands for constructing frames
+
+\RequirePackage{beamerbaseverbatim}
+% Commands for constructing frames
+
+\RequirePackage{beamerbaseframesize}
+% Commands for constructing frames
+
+\RequirePackage{beamerbaseframecomponents}
+% Headlines, sidebars, columns
+
+\RequirePackage{beamerbasecolor}
+% Color management
+
+\RequirePackage{beamerbasenotes}
+% Commands for adding notes
+
+\RequirePackage{beamerbasetoc}
+% Table of Contents Format
+
+\RequirePackage{bidibeamerbasetemplates}
+% For default templates
+
+\RequirePackage{beamerbaselocalstructure}
+% Commands for local structure like alert, itemize, etc.
+
+\RequirePackage{beamerbasenavigation}
+% Navigation buttons
+
+\RequirePackage{beamerbasetheorems}
+% Theorems
+
+\RequirePackage{beamerbasethemes}
+% Commands for including and building themes
+
+\usetheme{default}
+
+% Compatibility stuff:
+\csname beamer@loadlater\endcsname
+
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "~/texmf/tex/latex/beamer/examples/beamerexample1.tex"
+%%% End:
+% \end{macrocode}
+% \iffalse
+%</bidibeamer.cls>
+%<*bidibeamerbaseauxtemplates.sty>
+% \fi
+% \part{bidibeamerbaseauxtemplates.sty}
% \begin{macrocode}
-\newif\if@rl@footnote
-\if@rlmain\@rl@footnotetrue\else\@rl@footnotefalse\fi
-\let\@@footnoterule=\footnoterule
-\def\LRfootnoterule{\@@footnoterule}
-%%bug?-->this causes new par to be set, hence hack with vskip :-{
-\def\RLfootnoterule{\vskip -\baselineskip\hb@xt@\hsize{\hss\vbox{\@@footnoterule}}}
+% Copyright 2007 by Till Tantau
%
-\def\setfootnoteRL{\@rl@footnotetrue}
-\def\unsetfootnoteRL{\@rl@footnotefalse}
-\def\setfootnoteLR{\unsetfootnoteRL}
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
%
-\def\footnoterule{\if@rlmain\RLfootnoterule\else\LRfootnoterule\fi}
+% See the file doc/licenses/LICENSE for more details.
+
+
+
+\mode<presentation>
+
+
+\RequirePackage{beamerbaseboxes}
+
+
+
+%
+% declare some balls
+%
+
+\normalsize
+\pgfdeclareradialshading[bg,parent.bg]{tocsphere}{\pgfpoint{-0.5ex}{0.6ex}}%
+{%
+ color(0cm)=(bg!35!white);
+ color(0.44ex)=(bg!75!white);
+ color(0.88ex)=(bg!70!black!90!parent.bg);
+ color(1.2ex)=(bg!50!black!90!parent.bg);
+ color(1.3ex)=(parent.bg)}
+
+\pgfdeclareradialshading[bg,parent.bg]{bigsphere}{\pgfpoint{-0.1849315ex}{.2260273ex}}%
+{%
+ color(0cm)=(bg!15);
+ color(0.1643835ex)=(bg!75);
+ color(0.3287671ex)=(bg!70!black);
+ color(0.4520547ex)=(bg!50!black);
+ color(0.53ex)=(parent.bg)}
+
+\pgfdeclareradialshading[bg,parent.bg]{smallsphere}{\pgfpoint{-0.1479452ex}{0.18287671ex}}%
+{%
+ color(0cm)=(bg!15);
+ color(0.1315068ex)=(bg!75);
+ color(0.2630136ex)=(bg!70!black);
+ color(0.36164383ex)=(bg!50!black);
+ color(0.427ex)=(parent.bg)}
+
+\def\beamer@usesphere#1#2{%
+ \hbox{\usebeamercolor{#1}\normalsize\pgfuseshading{#2}}}
+
+
+
+
+
+
+
+
+
+
+
+%
+% Background templates
+%
+
+\define@key{beamer@backgroundgrid}{step}{\def\beamer@bggw{#1}}
+\define@key{beamer@backgroundgrid}{color}{\def\beamer@bggc{\color{#1}}}
+
+\defbeamertemplate{background}{grid}[1][]
+{%
+ \setkeys{beamer@backgroundgrid}{step=0.5cm,color=fg!10!bg}%
+ \setkeys{beamer@backgroundgrid}{#1}%
+ \begin{pgfpicture}{0cm}{0cm}{\the\paperwidth}{\the\paperheight}
+ \beamer@bggc
+ \pgfpathgrid[stepx=\beamer@bggw,stepy=\beamer@bggw]{\pgfpointorigin}{\pgfpoint{\the\paperwidth}{\the\paperheight}}
+ \pgfusepath{stroke}
+ \end{pgfpicture}%
+}
+
+
+\define@key{beamer@backgroundshade}{top}{\def\beamer@bgst{#1}}
+\define@key{beamer@backgroundshade}{bottom}{\def\beamer@bgsb{#1}}
+\define@key{beamer@backgroundshade}{right}{\def\beamer@bgst{#1}}
+\define@key{beamer@backgroundshade}{left}{\def\beamer@bgsb{#1}}
+\define@key{beamer@backgroundshade}{middle}{\def\beamer@bgsm{#1}}
+\define@key{beamer@backgroundshade}{midpoint}{\def\beamer@bgsmp{#1}}
+
+\def\beamer@calcvertshading#1#2#3{%
+ {\usebeamercolor{palette primary}}
+ \usebeamercolor{normal text}
+ \setkeys{beamer@backgroundshade}{top=palette primary.bg!25!bg,bottom=bg,middle={},midpoint=0.5}%
+ \setkeys{beamer@backgroundshade}{#3}
+ \ifx\beamer@bgsm\@empty
+ \pgfdeclareverticalshading{#1}{#2}%
+ {color(0cm)=(\beamer@bgsb); color(\the\paperheight)=(\beamer@bgst)}
+ \colorlet{beamer@backgroundshadestart}{\beamer@bgsb}%
+ \colorlet{beamer@backgroundshadeend}{\beamer@bgst}%
+ \colorlet{beamer@average}{beamer@backgroundshadestart!50!beamer@backgroundshadeend}%
+ \else
+ \pgfdeclareverticalshading{#1}{#2}%
+ {color(0cm)=(\beamer@bgsb); color(\beamer@bgsmp\paperheight)=(\beamer@bgsm); color(\the\paperheight)=(\beamer@bgst)}
+ \colorlet{beamer@average}{\beamer@bgsm}
+ \fi%
+}
+
+\def\beamer@calchorishading#1#2#3{%
+ {\usebeamercolor{palette primary}}
+ \usebeamercolor{normal text}
+ \setkeys{beamer@backgroundshade}{left=palette primary.bg!25!bg,right=bg,middle={},midpoint=0.5}%
+ \setkeys{beamer@backgroundshade}{#3}
+ \ifx\beamer@bgsm\@empty
+ \pgfdeclarehorizontalshading{#1}{\the\paperheight}%
+ {color(0cm)=(\beamer@bgsb); color(#2)=(\beamer@bgst)}
+ \colorlet{beamer@backgroundshadestart}{\beamer@bgsb}%
+ \colorlet{beamer@backgroundshadeend}{\beamer@bgst}%
+ \colorlet{beamer@average}{beamer@backgroundshadestart!50!beamer@backgroundshadeend}%
+ \else
+ \pgfdeclarehorizontalshading{#1}{\the\paperheight}%
+ {color(0cm)=(\beamer@bgsb); color(\beamer@bgsmp#2)=(\beamer@bgsm); color(#2)=(\beamer@bgst)}
+ \colorlet{beamer@average}{\beamer@bgsm}
+ \fi%
+}
+
+
+
+\defbeamertemplate{background canvas}{vertical shading}[1][]
+{%
+ \pgfuseshading{beamer@backgroundshading}%
+}
+[action]
+{
+ \beamer@calcvertshading{beamer@backgroundshading}{\the\paperwidth}{#1}
+ \colorlet{beamer@@average}{beamer@average}
+ \setbeamercolor{normal text}{bg=beamer@@average}
+}
+
+
+
+
+%
+% Side bars
+%
+
+\defbeamertemplate{sidebar canvas left}{vertical shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasleftshading}%
+}
+[action]
+{
+ \beamer@calcvertshading{beamer@sidebarcanvasleftshading}{\the\beamer@leftsidebar}{#1}
+}
+
+\defbeamertemplate{sidebar canvas right}{vertical shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasrightshading}%
+}
+[action]
+{
+ \beamer@calcvertshading{beamer@sidebarcanvasrightshading}{\the\beamer@rightsidebar}{#1}
+}
+
+\defbeamertemplate{sidebar canvas left}{horizontal shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasleftshading}%
+}
+[action]
+{
+ \beamer@calchorishading{beamer@sidebarcanvasleftshading}{\beamer@leftsidebar}{#1}
+}
+
+\defbeamertemplate{sidebar canvas right}{horizontal shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasrightshading}%
+}
+[action]
+{
+ \beamer@calchorishading{beamer@sidebarcanvasrightshading}{\beamer@rightsidebar}{#1}
+}
+
+
+
+
+
+
+% (sub-)section in toc: sections numbered
+
+\defbeamertemplate{section in toc}{sections numbered}
+{\leavevmode\inserttocsectionnumber\@SepMark \inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{sections numbered}
+{\leavevmode\if@RTL\rightskip=2.5em\else\leftskip=2.5em\fi\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{sections numbered}
+{\leavevmode\normalsize\usebeamerfont{subsection in toc}\if@RTL\rightskip=3.5em\else\leftskip=3.5em\fi\usebeamerfont{subsubsection in toc}%
+ \inserttocsubsubsection\par}
+
+
+
+
+
+% (sub-)section in toc: subsections numbered
+
+\defbeamertemplate{section in toc}{subsections numbered}
+{\leavevmode\if@RTL\rightskip=2em\else\leftskip=2em\fi\inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{subsections numbered}
+{\leavevmode\if@RTL\rightskip=2em\else\leftskip=2em\fi\rlap{\hskip-2em\inserttocsectionnumber\@SepMark\inserttocsubsectionnumber}\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{subsections numbered}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=3em\else\leftskip=3em\fi\usebeamerfont{subsubsection in toc}%
+ \inserttocsubsubsection\par}
+
+
+
+
+
+% (sub-)section in toc: circle
+
+\defbeamertemplate{section in toc}{circle}
+{\leavevmode\if@RTL\rightskip=2ex\else\leftskip=2ex\fi%
+ \llap{%
+ \usebeamerfont*{section number projected}%
+ \usebeamercolor{section number projected}%
+ \beginL\begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \color{bg}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\inserttocsectionnumber}
+ \end{pgfpicture}\endL\kern1.25ex%
+ }%
+ \inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{circle}
+{\leavevmode\if@RTL\rightskip=2em\else\leftskip=2em\fi\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{circle}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=3em\else\leftskip=3em\fi\usebeamerfont{subsubsection in toc}%
+ \inserttocsubsubsection\par}
+
+
+
+
+% (sub-)section in toc: square
+
+\defbeamertemplate{section in toc}{square}
+{\leavevmode\if@RTL\rightskip=1.75ex\else\leftskip=1.75ex\fi%
+ \llap{%
+ \usebeamerfont*{section number projected}%
+ \usebeamercolor[bg]{section number projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{\hfil\color{fg}\inserttocsectionnumber\hfil}}%
+ \kern1.25ex\inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{square}
+{\leavevmode\if@RTL\rightskip=5ex\else\leftskip=5ex\fi\llap{%
+ \usebeamercolor[bg]{subsection number projected}%
+ \vrule width1ex height1ex\kern1ex}\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{square}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=7ex\else\leftskip=7ex\fi\usebeamerfont{subsubsection in toc}%
+ \llap{%
+ \usebeamercolor[bg]{subsubsection number projected}%
+ \vrule width0.75ex height0.75ex\kern1ex}\inserttocsubsubsection\par}
+
+
+
+
+% (sub-)section in toc: ball
+
+\defbeamertemplate{section in toc}{ball unnumbered}
+{\leavevmode\raise0.1ex\beamer@usesphere{section number projected}{bigsphere}\kern1.25ex\inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{ball unnumbered}
+{\leavevmode\if@RTL\rightskip=1.5em\else\leftskip=1.5em\fi\raise0.2ex\beamer@usesphere{subsection number projected}{smallsphere}%
+ \kern1ex\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{ball unnumbered}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=3em\else\leftskip=3em\fi\usebeamerfont{subsubsection in toc}%
+ \beamer@usesphere{subsubsection number projected}{smallsphere}%
+ \kern0.75ex\inserttocsubsubsection\par}
+
+
+
+
+% (sub-)section in toc: ball numbered
+
+\defbeamertemplate{section in toc}{ball}
+{\leavevmode\if@RTL\rightskip=2.75ex\else\leftskip=2.75ex\fi%
+ \llap{%
+ \normalsize%
+ \beginL\begin{pgfpicture}{-1ex}{-0.7ex}{1ex}{1ex}
+ \pgftext{\beamer@usesphere{section number projected}{tocsphere}}
+ \pgftext{%
+ \usebeamerfont*{section number projected}%
+ \usebeamercolor{section number projected}%
+ \color{fg!90!bg}%
+ \inserttocsectionnumber}
+ \end{pgfpicture}\endL%
+ \kern1.25ex}%
+ \inserttocsection\par
+}
+[action]
+{\setbeamerfont{section number projected}{size=\scriptsize}}
+
+\defbeamertemplate{subsection in toc}{ball}
+{\leavevmode\if@RTL\rightskip=5ex\else\leftskip=5ex\fi%
+ \llap{\raise0.1ex\beamer@usesphere{subsection number projected}{bigsphere}\kern1ex}%
+ \inserttocsubsection\par%
+}
+
+\defbeamertemplate{subsubsection in toc}{ball}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=7ex\else\leftskip=7ex\fi\usebeamerfont{subsubsection in toc}%
+ \llap{\beamer@usesphere{subsubsection number projected}{bigsphere}\kern0.75ex}%
+ \inserttocsubsubsection\par%
+}
+
+
+
+% Itemize items, circle
+
+\defbeamertemplatealias{itemize item}{triangle}{default}
+\defbeamertemplatealias{itemize subitem}{triangle}{default}
+\defbeamertemplatealias{itemize subsubitem}{triangle}{default}
+
+
+
+% Itemize items, circle
+
+\defbeamertemplate{itemize item}{circle}{\small\raise0.5pt\hbox{\textbullet}}
+\defbeamertemplate{itemize subitem}{circle}{\footnotesize\raise0.5pt\hbox{\textbullet}}
+\defbeamertemplate{itemize subsubitem}{circle}{\footnotesize\raise0.5pt\hbox{\textbullet}}
+
+
+
+
+% Itemize items, square
+
+\defbeamertemplate{itemize item}{square}{\hbox{\vrule width 1ex height 1ex}}
+\defbeamertemplate{itemize subitem}{square}{\small\hbox{\vrule width 1ex height 1ex}}
+\defbeamertemplate{itemize subsubitem}{square}{\small\hbox{\vrule width 1ex height 1ex}}
+
+
+
+
+% Itemize items, ball
+
+\defbeamertemplate{itemize item}{ball}{\raise0.2pt\beamer@usesphere{item projected}{bigsphere}}
+\defbeamertemplate{itemize subitem}{ball}{\raise0.2pt\beamer@usesphere{subitem projected}{smallsphere}}
+\defbeamertemplate{itemize subsubitem}{ball}{\raise0.2pt\beamer@usesphere{subsubitem projected}{smallsphere}}
+
+
+
+% Enumerate items, ball
+
+\defbeamertemplate{enumerate item}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
+ \usebeamercolor[fg]{item projected}
+ {\pgftransformscale{1.75}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
+ \pgftext{\usebeamerfont*{item projected}\insertenumlabel}}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate subitem}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.55ex}{1ex}{1ex}
+ \usebeamercolor[fg]{subitem projected}
+ {\pgftransformscale{1.4}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ \pgftext{%
+ \usebeamerfont*{subitem projected}%
+ \insertsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate subsubitem}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.55ex}{1ex}{1ex}
+ \usebeamercolor[fg]{subsubitem projected}
+ {\pgftransformscale{1.4}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ \pgftext{%
+ \usebeamerfont*{subitem projected}%
+ \insertsubsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate mini template}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
+ \usebeamercolor[fg]{\beameritemnestingprefix item projected}
+ {\pgftransformscale{1.75}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}%
+ \usebeamerfont*{\beameritemnestingprefix item projected}%
+ \pgftext{\insertenumlabel}}
+ \end{pgfpicture}
+\endL}
+
+
+
+% Enumerate items, square
+
+\defbeamertemplate{enumerate item}{square}
+{
+ \hbox{%
+ \usebeamerfont*{item projected}%
+ \usebeamercolor[bg]{item projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertenumlabel%
+ \hfil}%
+ }%
+}
+[action]
+{\setbeamerfont{item projected}{size=\scriptsize}}
+
+\defbeamertemplate{enumerate subitem}{square}
+{
+ \hbox{%
+ \usebeamerfont*{subitem projected}%
+ \usebeamercolor[bg]{subitem projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertsubenumlabel%
+ \hfil}%
+ }%
+}
+
+\defbeamertemplate{enumerate subsubitem}{square}
+{
+ \hbox{%
+ \usebeamerfont*{subitem projected}%
+ \usebeamercolor[bg]{subsubitem projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertsubsubenumlabel%
+ \hfil}%
+ }%
+}
+
+\defbeamertemplate{enumerate mini template}{square}
+{
+ \hbox{%
+ \usebeamerfont*{\beameritemnestingprefix item projected}%
+ \usebeamercolor[bg]{\beameritemnestingprefix item projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertenumlabel%
+ \hfil}%
+ }%
+}
+
+
+
+
+% Enumerate items, circle
+
+\defbeamertemplate{enumerate item}{circle}
+{\beginL
+ \usebeamerfont*{item projected}%
+ \usebeamercolor[bg]{item projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertenumlabel}
+ \end{pgfpicture}%
+\endL}
+[action]
+{\setbeamerfont{item projected}{size=\scriptsize}}
+
+\defbeamertemplate{enumerate subitem}{circle}
+{\beginL
+ \usebeamerfont*{subitem projected}%
+ \usebeamercolor[bg]{subitem projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate subsubitem}{circle}
+{\beginL
+ \usebeamerfont*{subsubitem projected}%
+ \usebeamercolor[bg]{subsubitem projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertsubsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate mini template}{circle}
+{\beginL
+ \usebeamerfont*{\beameritemnestingprefix item projected}%
+ \usebeamercolor[bg]{\beameritemnestingprefix item projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+
+
+%
+% Frame title continutations
+%
+
+\defbeamertemplatealias{frametitle continuation}{roman}{default}
+
+\defbeamertemplate{frametitle continuation}{from second}[1][\insertcontinuationtext]
+{\expandafter\ifnum\insertcontinuationcount>1\relax#1\fi}
+
+
+
+
+
+% Bibliography items
+
+\defbeamertemplatealias{bibliography item}{article}{default}
+
+\defbeamertemplate{bibliography item}{book}
+{\lower2pt\hbox{\pgfuseimage{beamericonbook}}}
+
+\defbeamertemplate{bibliography item}{text}
+{\insertbiblabel}
+
+\defbeamertemplate{bibliography item}{triangle}
+{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\if@RTL\blacktriangleleft\else\blacktriangleright\fi$}}
+
+
+
+% Headline
+
+\defbeamertemplate{headline}{text line}[1]
+{\hskip\Gm@lmargin\hbox to\@tempdima{\textwidth=\@tempdima\hsize=\textwidth\relax#1\hfil}\hskip\Gm@rmargin}
+
+
+% Footline
+
+\defbeamertemplate{footline}{text line}[1]
+{\hskip\Gm@lmargin\hbox to\@tempdima{\textwidth=\@tempdima\hsize=\textwidth\relax#1\hfil}\hskip\Gm@rmargin}
+
+\defbeamertemplate{footline}{page number}
+{%
+ \hfill%
+ \usebeamercolor[fg]{page number in head/foot}%
+ \usebeamerfont{page number in head/foot}%
+ \insertpagenumber\,/\,\insertpresentationendpage\kern1em\vskip2pt%
+}
+
+\defbeamertemplate{footline}{frame number}
+{
+ \hfill%
+ \usebeamercolor[fg]{page number in head/foot}%
+ \usebeamerfont{page number in head/foot}%
+ \insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
+}
+
+
+
+
+% Mini frames
+
+\defbeamertemplate{mini frame}{box}
+{%
+ \begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}{\the\beamer@boxsize}}
+ \pgfusepath{fill,stroke}
+ \end{pgfpicture}%
+}
+[action]
+{
+ \setbeamersize{mini frame size=.1cm,mini frame offset=.05cm}
+}
+
+\defbeamertemplate{mini frame in current subsection}{box}
+{%
+ \begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}{\the\beamer@boxsize}}
+ \pgfusepath{stroke}
+ \end{pgfpicture}%
+}
+
+\defbeamertemplate{mini frame}{tick}
+{%
+ \hskip-0.4pt\vrule height\beamer@boxsize width1.2pt%
+}
+[action]
+{
+ \setbeamersize{mini frame size=.1cm,mini frame offset=.05cm}
+}
+
+\defbeamertemplate{mini frame in current subsection}{tick}
+{%
+ \vrule height\beamer@boxsize width0.4pt%
+}
+
+
+
+
+
+%
+% Captions
+%
+
+\defbeamertemplate{caption}{numbered}
+{%
+ \raggedright
+ {%
+ \usebeamercolor[fg]{caption name}%
+ \usebeamerfont*{caption name}%
+ \insertcaptionname~\insertcaptionnumber:%
+ }
+ \insertcaption\par
+}
+
+\defbeamertemplate{caption}{caption name own line}
+{%
+ \begin{minipage}{\textwidth}
+ \raggedright
+ {%
+ \usebeamercolor[fg]{caption name}%
+ \usebeamerfont*{caption name}%
+ \insertcaptionname%
+ }\\
+ \insertcaption
+ \end{minipage}
+}
+
+
+
+
+
+%
+% Buttons
+%
+
+\newdimen\beamer@blockheadheight%
+
+
+\defbeamertemplate{navigation symbols}{only frame symbol}
+{\insertframenavigationsymbol}
+
+\defbeamertemplate{navigation symbols}{vertical}
+{%
+ \vbox{%
+ \hbox{\insertslidenavigationsymbol}
+ \hbox{\insertframenavigationsymbol}
+ \hbox{\insertsubsectionnavigationsymbol}
+ \hbox{\insertsectionnavigationsymbol}
+ \hbox{\insertdocnavigationsymbol}
+ \hbox{\insertbackfindforwardnavigationsymbol}}%
+}
+
+\defbeamertemplatealias{navigation symbols}{horizontal}{default}
+
+
+
+%
+% Blocks
+%
+
+\defbeamertemplateparent{blocks}[rounded]{block begin,block end,%
+ block alerted begin,block alerted end,%
+ block example begin,block example end}[1][]
+{[#1]}
+
+\defbeamertemplate{block begin}{rounded}[1][shadow=false]
+{
+ \par\vskip\medskipamount%
+ \begin{beamerboxesrounded}[upper=block title,lower=block body,#1]%
+ {\raggedright\usebeamerfont*{block title}\insertblocktitle}%
+ \raggedright%
+ \usebeamerfont{block body}%
+}
+\defbeamertemplate{block end}{rounded}[1][]
+{\end{beamerboxesrounded}\vskip\smallskipamount}
+
+\defbeamertemplate{block alerted begin}{rounded}[1][shadow=false]
+{
+ \par\vskip\medskipamount%
+ \begin{beamerboxesrounded}[upper=block title alerted,lower=block body alerted,#1]%
+ {\raggedright\usebeamerfont*{block title alerted}\insertblocktitle}%
+ \raggedright%
+ \usebeamerfont{block body alerted}%
+}%
+\defbeamertemplate{block alerted end}{rounded}[1][]
+{\end{beamerboxesrounded}\vskip\smallskipamount}
+
+\defbeamertemplate{block example begin}{rounded}[1][shadow=false]
+{
+ \par\vskip\medskipamount%
+ \begin{beamerboxesrounded}[upper=block title example,lower=block body example,#1]
+ {\raggedright\usebeamerfont*{block title example}\insertblocktitle}%
+ \raggedright%
+ \usebeamerfont{block body alerted}%
+}%
+\defbeamertemplate{block example end}{rounded}[1][]
+{\end{beamerboxesrounded}\vskip\smallskipamount}
+
+
+
+%
+% Note templates
+%
+
+\defbeamertemplate{note page}{plain}
+{\insertnote}
+
+\defbeamertemplate{note page}{compressed}
+{%
+ {%
+ \tiny
+ \let\\=\relax%
+ \insertvrule{0.125\paperheight}{white!90!black}%
+ \vskip-0.125\paperheight
+ \nointerlineskip
+ \vbox{\hfill\insertslideintonotes{0.125}\hskip-\Gm@rmargin\hskip0pt%
+ \vskip-0.125\paperheight\nointerlineskip}%
+ \nointerlineskip
+ \vbox to .125\paperheight{
+ \setbox\beamer@tempbox=\hbox{\hbox{\insertsection}}%
+ \ht\beamer@tempbox=1em
+ \box\beamer@tempbox
+ \nointerlineskip
+ \setbox\beamer@tempbox=\hbox{\hbox{\quad\insertsubsection}}%
+ \ht\beamer@tempbox=1em
+ \box\beamer@tempbox
+ \nointerlineskip
+ \setbox\beamer@tempbox=\hbox{\hbox{\quad\quad\insertshortframetitle}}%
+ \ht\beamer@tempbox=1em
+ \box\beamer@tempbox
+ \vfil
+ }\vskip0.5em
+ }
+ \nointerlineskip
+ \insertnote
+}
+
+
+
+%
+% Theorem templates
+%
+
+\defbeamertemplate{theorem begin}{ams style}
+{%
+ \begin{\inserttheoremblockenv}
+ {%
+ \inserttheoremheadfont
+ \inserttheoremname
+ \inserttheoremnumber
+ \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+ \inserttheorempunctuation
+ }%
+}
+
+\defbeamertemplate{theorem end}{ams style}
+{\end{\inserttheoremblockenv}}
+
+
+\defbeamertemplate{theorem begin}{numbered}
+{%
+ \begin{\inserttheoremblockenv}
+ {%
+ \inserttheoremname
+ \inserttheoremnumber
+ \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+ }%
+}
+
+\defbeamertemplate{theorem end}{numbered}
+{\end{\inserttheoremblockenv}}
+
+
+\defbeamertemplate{theorem begin}{normal font}
+{
+ \normalfont
+ \begin{\inserttheoremblockenv}
+ {%
+ \inserttheoremname
+ \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+ }%
+}
+
+\defbeamertemplate{theorem end}{normal font}
+{\end{\inserttheoremblockenv}}
+
+
+
+\mode
+<all>
+
+% \end{macrocode}
+% \iffalse
+%</bidibeamerbaseauxtemplates.sty>
+%<*bidibeamerbasetemplates.sty>
+% \fi
+% \part{bidibeamerbasetemplates.sty}
+% \begin{macrocode}
+% Copyright 2007 by Till Tantau
+%
+% This file may be distributed and/or modified
+%
+% 1. under the LaTeX Project Public License and/or
+% 2. under the GNU Public License.
+%
+% See the file doc/licenses/LICENSE for more details.
+
+
+%
+% Template Installation Commands
+%
+
+\def\usebeamertemplate{\@ifstar{\beamer@usebeamertemplates}{\beamer@usebeamertemplatedo}}
+\def\beamer@usebeamertemplates{\@ifstar{\beamer@usebeamertemplatess}{\beamer@usebeamertemplatedos}}
+\def\beamer@usebeamertemplatess{\@ifstar{\beamer@usebeamertemplatedosss}{\beamer@usebeamertemplatedoss}}
+\def\beamer@usebeamertemplatedo#1{\csname beamer@@tmpl@#1\endcsname}
+\def\beamer@usebeamertemplatedos#1{{{\usebeamerfont{#1}\usebeamercolor[fg]{#1}\csname beamer@@tmpl@#1\endcsname}}}
+\def\beamer@usebeamertemplatedoss#1{{{\usebeamerfont*{#1}\usebeamercolor[fg]{#1}\csname beamer@@tmpl@#1\endcsname}}}
+\def\beamer@usebeamertemplatedosss#1{{{\usebeamerfont*{#1}\usebeamercolor*[fg]{#1}\csname beamer@@tmpl@#1\endcsname}}}
+
+\long\def\beamer@@empty{}
+\def\expandbeamertemplate#1{\csname beamer@@tmpl@#1\endcsname}
+\def\ifbeamertemplateempty#1#2#3{%
+ \def\beamer@ifdo{#3}%
+ \expandafter\ifx\csname beamer@@tmpl@#1\endcsname\relax\def\beamer@ifdo{#2}\fi%
+ \expandafter\ifx\csname beamer@@tmpl@#1\endcsname\beamer@@empty\def\beamer@ifdo{#2}\fi%
+ \beamer@ifdo}
+
+
+\mode<article>
+{
+ % the following do the same in article mode:
+ \let\beamer@usebeamertemplatedosss=\beamer@usebeamertemplatedo
+ \let\beamer@usebeamertemplatedoss=\beamer@usebeamertemplatedo
+ \let\beamer@usebeamertemplatedos=\beamer@usebeamertemplatedo
+}
+
+
+\newif\ifbeamer@sbt
+\newtoks\beamer@sbttoks
+
+\newcommand<>\defbeamertemplate{
+ \beamer@ifempty{#1}
+ {\def\beamer@@oar{<presentation>}}
+ {\def\beamer@@oar{#1}}\beamer@defbeamertemplate}
+\def\beamer@defbeamertemplate{\@ifstar{\beamer@sbttrue\beamer@sbtoo}{\beamer@sbtfalse\beamer@sbtoo}}
+\def\beamer@sbtoo#1#2{\@ifnextchar[{\beamer@sbto{#1}{#2}}{\beamer@sbto{#1}{#2}[0]}}
+\def\beamer@sbto#1#2[#3]{\@ifnextchar[{\beamer@@sbto{#1}{#2}[#3]}{\def\beamer@sbtotemp{}\beamer@@@sbto{#1}{#2}[#3]}}
+\long\def\beamer@@sbto#1#2[#3][#4]{\long\def\beamer@sbtotemp{[#4]}\beamer@@@sbto{#1}{#2}[#3]}
+\long\def\beamer@@@sbto#1#2[#3]#4{%
+ \beamer@sbttoks={\beamer@@@@sbto{#1}{#2}[#3]{#4}}%
+ \@ifnextchar[{\the\beamer@sbttoks}{\the\beamer@sbttoks[action]{}}%
+}
+\long\def\beamer@@@@sbto#1#2[#3]#4[#5]#6{%
+ \edef\beamer@@sbtoarg{\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname[#3]}%
+ \expandafter\expandafter\expandafter\newcommand\expandafter\beamer@@sbtoarg\beamer@sbtotemp{%
+ \expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname{#4}#6}%
+ \let\beamer@@next=\beamer@resetsbtoarg%
+ \expandafter\mode\beamer@@oar{\let\beamer@@next=\relax}%
+ \beamer@@next%
+ \ifbeamer@sbt\setbeamertemplate{#1}[#2]\relax\relax\relax\relax\relax\relax\relax\relax\relax\fi%
+}
+\def\beamer@resetsbtoarg{%
+ \expandafter\expandafter\expandafter\renewcommand\expandafter\beamer@@sbtoarg\beamer@sbtotemp{}
+}
+
+\def\defbeamertemplatealias#1#2#3{%
+ \edef\beamer@@temp{\def\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname{\expandafter\noexpand\csname beamer@@tmpop@#1@#3\endcsname}}%
+ \beamer@@temp}
+
+
+\def\defbeamertemplateparent#1{\@ifnextchar[{\beamer@sbtoparo{#1}}{\beamer@sbtoparo{#1}[*]}}
+\def\beamer@sbtoparo#1[#2]#3{\@ifnextchar[{\beamer@sbtopar{#1}[#2]{#3}}{\beamer@sbtopar{#1}[#2]{#3}[0]}}
+\def\beamer@sbtopar#1[#2]#3[#4]{\@ifnextchar[
+ {\beamer@@sbtopar{#1}[#2]{#3}[#4]}
+ {\def\beamer@sbtotemp{}\beamer@@@sbtopar{#1}[#2]{#3}[#4]}}
+\long\def\beamer@@sbtopar#1[#2]#3[#4][#5]{\long\def\beamer@sbtotemp{[#5]}\beamer@@@sbtopar{#1}[#2]{#3}[#4]}
+\long\def\beamer@@@sbtopar#1[#2]#3[#4]#5{%
+ \expandafter\def\csname beamer@@tmpgrp@#1\endcsname{#3}%
+ \edef\beamer@@sbtoarg{\noexpand\newcommand\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname[#4]}%
+ \expandafter\beamer@@sbtoarg\beamer@sbtotemp{%
+ \def\beamer@sbtlist{#3}%
+ \@for\beamer@templ:=\beamer@sbtlist\do
+ {\expandafter\expandafter\expandafter\setbeamertemplate
+ \expandafter\expandafter\expandafter{\expandafter\beamer@templ\expandafter}\expandafter[\beamer@@sbt@option]#5}}}
+
+
+\def\setbeamertemplate#1{%
+ \@ifnextchar[{\beamer@sbtchoose{#1}}{\beamer@sbtexec{#1}}}
+\long\def\beamer@sbtexec#1#2{%
+ \expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname{#2}%
+ \expandafter\ifx\csname beamer@@tmpgrp@#1\endcsname\relax%
+ \else%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\beamer@sbt@group
+ \expandafter\expandafter\expandafter{\csname beamer@@tmpgrp@#1\endcsname}%
+ \@for\beamer@templ:=\beamer@sbt@group\do{\expandafter\setbeamertemplate\expandafter{\beamer@templ}{#2}}%
+ \fi%
+}
+\long\def\beamer@sbtchoose#1[#2]{\def\beamer@@sbt@option{#2}%
+ \expandafter\ifx\csname beamer@@tmpop@#1@#2\endcsname\relax%
+ \expandafter\let\expandafter\beamer@@next\csname beamer@@tmpop@#1@*\endcsname%
+ \else%
+ \expandafter\let\expandafter\beamer@@next\csname beamer@@tmpop@#1@#2\endcsname%
+ \fi%
+ \beamer@@next%
+}
+
+\newcommand\addtobeamertemplate[3]{%
+ \long\def\beamer@temp{#2}%
+ \expandafter\def\expandafter\beamer@@temp\expandafter{\expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname}%
+ \expandafter\expandafter\expandafter\long%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\beamer@@addtemplate%
+ \expandafter\expandafter\expandafter{\csname beamer@@tmpl@#1\endcsname}%
+ \expandafter\expandafter\expandafter\beamer@@temp%
+ \expandafter\expandafter\expandafter{\expandafter\beamer@temp\beamer@@addtemplate#3}%
+}
+
+
+
+\RequirePackage{bidibeamerbaseauxtemplates}
+
+
+\mode
+<all>
+
+% \end{macrocode}
+% \iffalse
+%</bidibeamerbasetemplates.sty>
+%<*beamerthemebidiJLTree.sty>
+% \fi
+% \part{beamerthemebidiJLTree.sty}
+% \begin{macrocode}
+\ProvidesPackage{beamerthemebidiJLTree}
+
+\newif\ifbeamer@tree@showhooks
+\beamer@tree@showhookstrue
+
+\DeclareOptionBeamer{hooks}[true]{\csname beamer@tree@showhooks#1\endcsname}
+
+\ProcessOptionsBeamer
+\mode
+<presentation>
+
+\setbeamertemplate{navigation symbols}{}
+\usecolortheme{rose}
+\useinnertheme[shadow=true]{rounded}% les block
+
+
+\defbeamertemplate*{footline}{bidiJLTree theme}
+{
+ \begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
+ \end{beamercolorbox}
+ \hbox{%
+ \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{date in head/foot}%
+ \usebeamerfont{date in head/foot}
+ \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{title in head/foot}%
+ \usebeamerfont{title in head/foot}\beginR\hspace*{2ex}\insertauthor \hspace*{1ex} (\insertshortinstitute) \hspace*{2ex} \insertdate\endR
+ \end{beamercolorbox}}%
+}
+
+
+\defbeamertemplate*{sidebar right}{bidiJLTree theme}{}
+
+\usesectionheadtemplate
+{\hfil\insertsectionhead}
+{\hfill\color{fg!50!bg}\insertsectionhead}
+
+
+\usesubsectionheadtemplate
+{\hfil\insertsubsectionhead}
+{\hfill\color{fg!50!bg}\insertsubsectionhead}
+
+
+
+\defbeamertemplate*{headline}{bidiJLTree theme}
+{%
+ \leavevmode%
+ \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{upper separation line head}
+ \end{beamercolorbox}
+ \@tempdimb=3.625ex% 2.4375ex%
+ \multiply\@tempdimb by\beamer@sectionmax%
+%% \advance\@tempdimb by 1.125ex%
+ \advance\@tempdimb by -1.125ex%
+ \ifdim\@tempdimb<10.9ex% 3*(2.5+1.125)
+ \@tempdimb=10.9ex%
+ \fi
+ \begin{beamercolorbox}[wd=.45\paperwidth, ht=\@tempdimb]{left block}%
+ \usebeamerfont{section in head/foot}%
+ \vbox to\@tempdimb{\vfill\insertsectionnavigation{.45\paperwidth}\vfill}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=1.125ex,ht=\@tempdimb,dp=1.125ex]{middle separation line head}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=.44\paperwidth]{middle block}%
+ \vbox to\@tempdimb{\vfill%
+ \begin{beamercolorbox}[wd=.44\paperwidth,ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
+ \usebeamerfont{title in head/foot}\insertshorttitle
+ \end{beamercolorbox}
+ \begin{beamercolorbox}[wd=.44\paperwidth,ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
+ \usebeamerfont{section in head/foot}%
+ \ifbeamer@tree@showhooks
+ \setbox\beamer@tempbox=\hbox{\insertsectionhead}%
+ \ifdim\wd\beamer@tempbox>1pt%
+ \hskip2pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
+ \hskip1pt%
+ \fi%
+ \else%
+ \hskip6pt%
+ \fi%
+ \insertsectionhead
+ \end{beamercolorbox}
+ \begin{beamercolorbox}[wd=.44\paperwidth,ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
+ \usebeamerfont{subsection in head/foot}%
+ \ifbeamer@tree@showhooks
+ \setbox\beamer@tempbox=\hbox{\insertsubsectionhead}%
+ \ifdim\wd\beamer@tempbox>1pt%
+ \hskip9.4pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
+ \hskip1pt%
+ \fi%
+ \else%
+ \hskip12pt%
+ \fi%
+ \insertsubsectionhead
+ \end{beamercolorbox}%
+ \vfill}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=.1\paperwidth,ht=\@tempdimb,right]{right block}%
+ \vbox to\@tempdimb{\vfill\insertlogo\vfill}
+ \end{beamercolorbox}
+ \vfill
+ \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{lower separation line head}
+ \end{beamercolorbox}
+}
+\setbeamercolor{separation line}{use=structure,bg=structure.fg!50!bg}
+
+
+\mode
+<all>
% \end{macrocode}
-% \subsection{Bidi switching commands}
-% Commands for switching between LR and RL global contexts.
+% \iffalse
+%</beamerthemebidiJLTree.sty>
+%<*bidi2in1.sty>
+% \fi
+% \part{bidi2in1.sty}
% \begin{macrocode}
-\def\setRL{\@rltrue\@rl@footnotetrue}
-\def\unsetRL{\@rlfalse\@rl@footnotefalse}
-\def\setLR{\unsetRL}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidi2in1}
+\pagestyle{plain}
+\newcount\evenpage
+\newcount\oddpage
+\twocolumn
+\def\@oddfoot{\evenpage=\thepage%
+\multiply\evenpage by 2%
+\oddpage=\the\evenpage%
+\advance\oddpage by -1%
+\hfil\the\evenpage\hfil\hfil\the\oddpage\hfil}%
+\def\@evenfoot{\evenpage=\thepage%
+\multiply\evenpage by 2%
+\oddpage=\the\evenpage%
+\advance\oddpage by -1%
+\hfil\the\oddpage\hfil\hfil\the\evenpage\hfil}%
+\textwidth 9.49in
+\textheight 6.7in
+\columnsep 0.9in
+\columnseprule 0.125pt
+\headheight 0cm
+\topmargin 0in
+\marginparwidth 0in
+\marginparsep 0in
+%\hoffset 0.1in %pageoffset is 1.0in by default
+\hoffset 0.05in % Corrected
+\voffset -0.5in %top margin space is 1.0in by default
+\oddsidemargin 0in
+\evensidemargin 0in
+\headsep 0cm
+\topskip 0cm
+%\parskip 0pt %
+\parskip 0.15in %
+\headsep 0pt
+\special{papersize=11.69in,8.26in}
+\renewcommand\maketitle{\par
+\begingroup
+\renewcommand\thefootnote{\@fnsymbol\c@footnote}%
+\def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
+\long\def\@makefntext##1{\parindent 1em\noindent
+\hb@xt@1.8em{%
+\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
+\@maketitle
+\@thanks
+\endgroup
+\setcounter{footnote}{0}%
+\global\let\thanks\relax
+\global\let\maketitle\relax
+\global\let\@maketitle\relax
+\global\let\@thanks\@empty
+\global\let\@author\@empty
+\global\let\@date\@empty
+\global\let\@title\@empty
+\global\let\title\relax
+\global\let\author\relax
+\global\let\date\relax
+\global\let\and\relax
+}
+
% \end{macrocode}
-% \subsection{Footnotes (cont.)}
-% This redefines \LaTeX's internal footnote macros.
+% \iffalse
+%</bidi2in1.sty>
+%<*bidicode.sty>
+% \fi
+% \part{bidicode.sty}
% \begin{macrocode}
-\long\def\@footnotetext#1{\insert\footins{%
- \if@rl@footnote\@rltrue\else\@rlfalse\fi
- \reset@font\footnotesize
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidicode}
+\RequirePackage{pstricks}
+\RequirePackage{fvrb-ex}
+\RequirePackage{showexpl}
+\definecolor{Orange}{rgb}{1,.4,.2}
+\definecolor{myblue}{rgb}{0.02,0.04,0.48}
+\definecolor{lightblue}{rgb}{0.61,.8,.8}
+\definecolor{myred}{rgb}{0.65,0.04,0.07}
+\definecolor{mygreen}{rgb}{0,.43,0}
+\definecolor{blendedred}{rgb}{0.9,0.1,0.1}
+\definecolor{blendedgreen}{rgb}{0.2,0.7,0.2}
+\definecolor{darkgray}{gray}{0.3}
+\definecolor{mygray}{gray}{0.6}
+\definecolor{skugga}{gray}{0.7}
+\definecolor{mybackground}{rgb}{1,0.8,0.5}
+\lstset{%
+ language=[LaTeX]TEX,%
+ float=hbp,%
+ basicstyle=\ttfamily\small, %
+ identifierstyle=\color{black}, %
+ keywordstyle=\color{myred}, %
+ stringstyle=\color{blue}, %
+ commentstyle=\color{blue}, %
+ columns=flexible, %
+ tabsize=4, %
+ frame=single, %
+ extendedchars=true, %
+ showspaces=false, %
+ showstringspaces=false, %
+ numbers=left,
+ numbersep=12pt,
+ numberstyle=\tiny, %
+ breaklines=true, %
+ breakautoindent=true,
+ captionpos=b,
+ xleftmargin=1em,
+ breaklines=true,
+ backgroundcolor=\color{mybackground},
+ breakautoindent=true,
+ rframe={},
+ explpreset={numbers=left,numberstyle=\tiny,numbersep=12pt,
+ xleftmargin=1em,columns=flexible,language=[LaTeX]TEX},
+ morekeywords={setLTR,setLR,setRTL,setRL,LRE,LR,RLE,RL,lr}
+}
+\lstdefinestyle{syntax}{backgroundcolor=\color{blue!20},numbers=none,xleftmargin=0pt,xrightmargin=0pt,
+ frame=single}
+\lstdefinestyle{code}{backgroundcolor=\color{red!20},numbers=left,xleftmargin=0pt,xrightmargin=0pt,
+ frame=single}
+
+
+\newcommand\Larg [1]{{\normalfont\itshape#1\/}}
+\newcommand\Larga[1]{$\langle$\Larg{#1}$\rangle$}
+\newcommand\Largb[1]{\lcb\Larg{#1}\rcb}
+\newcommand\Largs[1]{\lsb\Larg{#1}\rsb}
+\newcommand\Largr[1]{\lrb\Larg{#1}\rrb}
+\newcommand\LBEG[1]{{\normalfont\ttfamily\bs{}begin\lcb#1\rcb}}
+\newcommand\LEND[1]{{\normalfont\ttfamily\bs{}end\lcb#1\rcb}}
+
+
+\DeclareRobustCommand\bs{{\normalfont\ttfamily\textbackslash}}
+\DeclareRobustCommand\lcb{{\normalfont\ttfamily\textbraceleft}}
+\DeclareRobustCommand\rcb{{\normalfont\ttfamily\textbraceright}}
+\DeclareRobustCommand\lsb{{\normalfont\ttfamily[}}
+\DeclareRobustCommand\rsb{{\normalfont\ttfamily]}}
+\DeclareRobustCommand\lrb{{\normalfont\ttfamily(}}
+\DeclareRobustCommand\rrb{{\normalfont\ttfamily)}}
+
+
+
+
+
+\def\Lcs#1{\nxLcs{#1}}
+\def\LcsStar#1{\nxLcs{#1}\OptArg*{*}}
+\def\nxLcs#1{\texttt{\textbackslash#1}}
+
+\def\Coordx#1{$x_{#1}$}
+\def\Coordy#1{$y_{#1}$}
+\def\Coordz#1{$z_{#1}$}
+\def\Coord#1{\Coordx{#1},\kern 1pt\Coordy{#1}}
+\def\Coordn{\Coordx{n},\kern 1pt\Coordy{n}}
+\def\CoordIII#1{\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordz{#1}}
+\def\CAny{\Coordx{},\kern 1pt\Coordy{}}
+\def\CIIIAny{\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{}}
+\def\coord#1{(\Coordx{#1},\kern 1pt\Coordy{#1})}
+\def\coordn{(\Coordx{n},\kern 1pt\Coordy{n})}
+\def\coordiii#1{(\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordz{#1})}
+\def\coordx#1{($x_{#1}$)}
+\def\coordy#1{($y_{#1}$)}
+\def\coordz#1{($z_{#1}$)}
+\def\cAny{(\Coordx{},\kern 1pt\Coordy{})}
+\def\ciiiAny{(\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{})}
+
+\newsavebox{\boxdef}
+\newenvironment{BDef}
+ {\begin{lrbox}\boxdef
+ \def\arraystretch{1.0}
+ \begin{tabular}{@{}l@{}l@{}l@{}}
+ }
+ {\end{tabular}\end{lrbox}
+
+
+ {\BCmd\fbox{\usebox\boxdef}\endBCmd}
+ \aftergroup\@afterindentfalse\aftergroup\@afterheading
+ }
+
+\newenvironment{BDef*}
+ {\begin{lrbox}\boxdef
+ \def\arraystretch{1.0}
+ \begin{tabular}{@{}l@{}l@{}l@{}}
+ }
+ {\end{tabular}\end{lrbox}
+ {\begin{BCmd*}\fbox{\usebox\boxdef}\end{BCmd*}}
+ \aftergroup\@afterindentfalse\aftergroup\@afterheading
+ }
+\newenvironment{BCmd}{
+ \@beginparpenalty-\@lowpenalty
+ \topsep\BDefaboveskip
+ \fboxsep3pt
+ \flushleft}
+ {\@endparpenalty\@M
+ \@topsepadd\BDefbelowskip
+ \endflushleft}
+
+\newenvironment{BCmd*}{
+ \@beginparpenalty\@M
+ \topsep\BDefinlineskip
+ \fboxsep3pt
+ \flushleft}
+ {\@endparpenalty5000
+ \endflushleft}
+
+\newskip\BDefaboveskip
+\newskip\BDefbelowskip
+\newskip\BDefinlineskip
+\setlength\BDefaboveskip{10pt plus 4pt}
+\setlength\BDefbelowskip{6pt}
+\setlength\BDefinlineskip{6pt}
+
+\def\OptArgs{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{[Options]}}\kern1pt}
+\def\OptArg{\@ifnextchar*\OptArg@i{\OptArg@ii*}}
+\def\OptArg@i*#1{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{#1}}\kern1pt}
+\def\OptArg@ii*#1{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{[#1]}}\kern1pt}
+
+
+% \end{macrocode}
+% \iffalse
+%</bidicode.sty>
+%<*bidimoderncv.cls>
+% \fi
+% \part{bidimoderncv.cls}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{bidimoderncv}
+\newif\if@DEBUG\@DEBUGfalse
+\DeclareOption{a4paper}{
+ \setlength\paperheight{297mm}
+ \setlength\paperwidth{210mm}}
+\DeclareOption{a5paper}{
+ \setlength\paperheight{210mm}
+ \setlength\paperwidth{148mm}}
+\DeclareOption{b5paper}{
+ \setlength\paperheight{250mm}
+ \setlength\paperwidth{176mm}}
+\DeclareOption{letterpaper}{
+ \setlength\paperheight{11in}
+ \setlength\paperwidth{8.5in}}
+\DeclareOption{legalpaper}{
+ \setlength\paperheight{14in}
+ \setlength\paperwidth{8.5in}}
+\DeclareOption{executivepaper}{
+ \setlength\paperheight{10.5in}
+ \setlength\paperwidth{7.25in}}
+\DeclareOption{landscape}{
+ \setlength\@tempdima{\paperheight}
+ \setlength\paperheight{\paperwidth}
+ \setlength\paperwidth{\@tempdima}}
+\newcommand\@ptsize{}
+\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
+\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
+\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
+\DeclareOption{draft}{\setlength\overfullrule{5pt}}
+\DeclareOption{final}{\setlength\overfullrule{0pt}}
+\newif\if@colour\@colourtrue
+\DeclareOption{nocolour}{\@colourfalse}
+\ExecuteOptions{a4paper,11pt,colour,final}
+\ProcessOptions\relax
+\input{size1\@ptsize.clo}
+\RequirePackage{graphicx}
+\RequirePackage{pstricks}
+\RequirePackage{ifthen}
+\RequirePackage{marvosym}
+\addtolength{\oddsidemargin}{-54pt}
+\addtolength{\textwidth}{109pt}
+\addtolength{\topmargin}{-70pt}
+\addtolength{\textheight}{122pt}
+\addtolength{\marginparsep}{-5pt}
+\addtolength{\marginparwidth}{-10pt}
+\RequirePackage{url}
+\RequirePackage{hyperref}
+\hypersetup{%
+ breaklinks,
+ baseurl = http://,%
+ pdfborder = 0 0 0,%
+ pdfpagemode = UseNone,%
+ pdfstartpage = 1}
+\AtEndOfClass{%
+ \AtBeginDocument{%
+ \hypersetup{%
+ pdfauthor = \@firstname~\@familyname,%
+ pdftitle = \@title,%
+ pdfsubject = \@firstname~\@familyname,%
+ pdfkeywords = \@resumename~\@firstname~\@familyname}}}
+\urlstyle{tt}
+\RequirePackage{fancyhdr}
+\fancypagestyle{plain}{%
+ \renewcommand{\headrulewidth}{0pt}
+ \renewcommand{\footrulewidth}{0pt}
+ \fancyhf{}}
+\pagestyle{plain}
+\setlength\lineskip{1\p@}
+\setlength\normallineskip{1\p@}
+\renewcommand\baselinestretch{}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{0pt}
+\setlength\columnsep{10\p@}
+\setlength\columnseprule{0\p@}
+\pagestyle{empty}
+\pagenumbering{arabic}
+\raggedbottom
+\onecolumn
+\providecommand*{\listitemsymbol}{\textbullet}
+\providecommand*{\addresssymbol}{}
+\providecommand*{\mobilesymbol}{\Mobilefone}
+\providecommand*{\phonesymbol}{\Telefon}
+\providecommand*{\faxsymbol}{\FAX}
+\providecommand*{\emailsymbol}{\Letter}
+\def\firstnamecolour#1{\gdef\@firstnamecolour{\addfontfeature{Color=#1}}}
+\def\familynamecolour#1{\gdef\@familynamecolour{\addfontfeature{Color=#1}}}
+\def\titlecolour#1{\gdef\@titlecolour{\addfontfeature{Color=#1}}}
+\def\addresscolour#1{\gdef\@addresscolour{\addfontfeature{Color=#1}}}
+\def\quotecolour#1{\gdef\@quotecolour{\addfontfeature{Color=#1}}}
+\def\sectiontitlecolour#1{\gdef\@sectiontitlecolour{\addfontfeature{Color=#1}}}
+\def\subsectioncolour#1{\gdef\@subsectioncolour{\addfontfeature{Color=#1}}}
+\def\hintcolour#1{\gdef\@hintcolour{\addfontfeature{Color=#1}}}
+\providecommand*{\firstnamefont}{}
+\providecommand*{\familynamefont}{}
+\providecommand*{\titlefont}{}
+\providecommand*{\addressfont}{}
+\providecommand*{\quotefont}{}
+\providecommand*{\sectionfont}{}
+\providecommand*{\subsectionfont}{}
+\providecommand*{\hintfont}{\small}
+\providecommand*{\firstnamestyle}[1]{{\firstnamefont\@firstnamecolour#1}}
+\providecommand*{\familynamestyle}[1]{{\familynamefont\@familynamecolour#1}}
+\providecommand*{\titlestyle}[1]{{\titlefont\@titlecolour#1}}
+\providecommand*{\addresstyle}[1]{{\addressfont\@addresscolour#1}}
+\providecommand*{\quotestyle}[1]{{\quotefont\@quotecolour#1}}
+\providecommand*{\sectionstyle}[1]{{\sectionfont\@sectiontitlecolour#1}}
+\providecommand*{\subsectionstyle}[1]{{\subsectionfont\@subsectioncolour#1}}
+\providecommand*{\hintstyle}[1]{{\hintfont\@hintcolour#1}}
+\newcommand*{\cvtheme}[2][]{
+ \def\@cvtheme{#2}
+ \def\@cvthemeoptions{#1}}
+\cvtheme{bidi-casual}
+\AtBeginDocument{\RequirePackage[\@cvthemeoptions]{cvtheme\@cvtheme}}
+\newcommand*{\resumename}[1]{\def\@resumename{#1}}
+\newcommand*{\firstname}[1]{\def\@firstname{#1}}
+\newcommand*{\familyname}[1]{\def\@familyname{#1}}
+\renewcommand*{\title}[1]{\def\@title{#1}}
+\newcommand*{\address}[1]{\def\@address{#1}}
+\newcommand*{\mobile}[1]{\def\@mobile{#1}}
+\newcommand*{\phone}[1]{\def\@phone{#1}}
+\renewcommand*{\fax}[1]{\def\@fax{#1}}
+\newcommand*{\email}[1]{\def\@email{#1}}
+\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
+\def\@photowidth{0pt}
+\newcommand*{\photo}[2][64pt]{\def\@photowidth{#1}\def\@photo{#2}}
+\newcommand*{\quote}[1]{\def\@quote{#1}}
+\newlength{\quotewidth}
+\newlength{\hintscolumnwidth}
+\newlength{\separatorcolumnwidth}
+\setlength{\separatorcolumnwidth}{0.025\textwidth}
+\newlength{\maincolumnwidth}
+\newlength{\doubleitemmaincolumnwidth}
+\newlength{\listitemsymbolwidth}
+\settowidth{\listitemsymbolwidth}{\listitemsymbol{}~}
+\newlength{\listitemmaincolumnwidth}
+\newlength{\listdoubleitemmaincolumnwidth}
+\newcommand*{\recomputethemelengths}{}
+\newcommand*{\recomputelengths}{%
+\setlength{\quotewidth}{0.65\textwidth}%
+\setlength{\maincolumnwidth}{\textwidth}%
+\addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
+\addtolength{\maincolumnwidth}{-\hintscolumnwidth}%
+\setlength{\listitemmaincolumnwidth}{\maincolumnwidth}%
+\addtolength{\listitemmaincolumnwidth}{-\listitemsymbolwidth}%
+\setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}%
+\addtolength{\doubleitemmaincolumnwidth}{-\hintscolumnwidth}%
+\addtolength{\doubleitemmaincolumnwidth}{-\separatorcolumnwidth}%
+\setlength{\doubleitemmaincolumnwidth}{0.5\doubleitemmaincolumnwidth}%
+\setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth}%
+\addtolength{\listdoubleitemmaincolumnwidth}{-\listitemsymbolwidth}%
+\setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}%
+\renewcommand{\headwidth}{\textwidth}%
+\recomputethemelengths}
+\setlength{\hintscolumnwidth}{0.15\textwidth}
+\recomputelengths
+\title{}
+\renewcommand*{\maketitle}{}
+\newcommand*{\section}[1]{%
+ \vspace*{2.5ex \@plus 1ex \@minus .2ex}%
+ \phantomsection{}%
+ \addcontentsline{toc}{part}{#1}%
+ \parbox[m]{\hintscolumnwidth}{\raggedleft\hintfont{\beginL\psline[linecolor=sectionrectanglecolour,linewidth=4pt](-2.5,0)(0,0)\endL}}%
+ \hspace{\separatorcolumnwidth}%
+ \parbox[m]{\maincolumnwidth}{\sectionstyle{#1}}\\[1ex]}
+\newcommand*{\subsection}[1]{%
+ \cvline[0.45em]{}{\subsectionstyle{#1}}}
+\newcommand*{\cvline}[3][.25em]{%
+ \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
+ \raggedleft\hintfont{#2} &{#3}%
+ \end{tabular}\\[#1]}
+\newcommand*{\cvdoubleitem}[4]{%
+ \cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}%
+ \hfill%
+ \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}}
+\newcommand*{\cvlistitem}[2][\listitemsymbol{}]{%
+ \cvline[0pt]{}{#1~\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}}}
+\newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{%
+ \cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
+ \hfill%
+ \ifthenelse{\equal{#3}{}}%
+ {}%
+ {#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}
+\newcommand*{\cventry}[6]{%
+ \cvline{#1}{%
+ {\bfseries#2}%
+ \ifx#3\else{, {\slshape#3}}\fi%
+ \ifx#4\else{, #4}\fi%
+ \ifx#5\else{, #5}\fi%
+ .%
+ \ifx#6\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi
+ }}%
+\newcommand*{\cvlanguage}[3]{%
+ \cvline{#1}{\begin{minipage}[t]{.225\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.725\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}
+\newcommand*{\cvcomputer}[4]{%
+ \cvdoubleitem{#1}{\small#2}{#3}{\small#4}}
+\newcommand*{\link}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {\beginL\href{#2}{\beginR#2\endR}\endL}%
+ {\beginL\href{#2}{\beginR#1\endR}\endL}}
+\newcommand*{\httplink}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {\beginL\href{http://#2}{\beginR#2\endR}\endL}%
+ {\beginL\href{http://#2}{\beginR#1\endR}\endL}}
+\newcommand*{\emaillink}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {\beginL\href{mailto:#2}{\beginR#2\endR}\endL}%
+ {\beginL\href{mailto:#2}{\beginR#1\endR}\endL}}
+\newif\if@displaypagenumbers\@displaypagenumberstrue
+\newcommand*{\nopagenumbers}{\@displaypagenumbersfalse}
+\AtBeginDocument{%
+ \if@displaypagenumbers%
+ \@ifundefined{r@lastpage}{}{%
+ \ifthenelse{\pageref{lastpage} > 1}{%
+ \fancypagestyle{plain}{%
+ \fancyfoot[r]{\beginL\addressfont\@quotecolour\footnotesize\thepage\beginL/\endL\pageref{lastpage}\endL}}%
+ \pagestyle{plain}}{}}%
+ \AtEndDocument{\label{lastpage}}%
+ \fi}
+\newlength{\bibindent}
+\setlength{\bibindent}{1.5em}
+\newcommand*{\bibliographyitemlabel}{\includegraphics{bibitem.pdf}}
+\newenvironment{thebibliography}[1]%
+ {%
+ \section{\refname}%
+%
+ \small%
+ \begin{list}{\bibliographyitemlabel}%
+ {%
+ \setlength{\topsep}{0pt}%
+ \setlength{\labelwidth}{\hintscolumnwidth}%
+ \setlength{\labelsep}{\separatorcolumnwidth}%
+ \leftmargin\labelwidth%
+ \advance\leftmargin\labelsep%
+ \@openbib@code%
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty%
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy\clubpenalty4000\widowpenalty4000%
+%
+%
+ }%
+ {%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \end{list}%
+ }
+\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
+\let\@openbib@code\@empty
+
+% \end{macrocode}
+% \iffalse
+%</bidimoderncv.cls>
+%<*bidipresentation.cls>
+% \fi
+% \part{bidipresentation.cls}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{bidipresentation}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+\ProcessOptions\relax
+\LoadClass{article}
+
+\RequirePackage[foot=10.2pt,head=0pt,paperwidth=128mm,paperheight=96mm,left=5mm,top=5mm,right=7mm,bottom=8mm]{geometry}
+
+\RequirePackage{fancyhdr}
+\renewcommand{\headrulewidth}{0mm}
+
+
+\renewcommand{\maketitle}%
+ {\ClassError{bidipresentation}{Caution: ``maketitle'' command not supported}%
+ {Please use ``titlepage'' environment instead}%
+}
+
+\fancypagestyle{pres}{%
+\fancyhf{}%
+\fancyfoot[RO,LE]{\footnotesize \thepage}%
+}
+
+\pagestyle{pres}
+
+\newcommand{\distance}[1]{\vspace*{\stretch{#1}}}
+\newcommand{\abstand}[1]{\vspace*{\stretch{#1}}}
+
+\setlength{\parskip}{0.6ex}
+\setlength{\parindent}{0mm}
+
+\newenvironment{plainslide}[1][]%
+ {{\raggedleft \large\bfseries #1\par}\par\vspace*{\stretch{1}}}%
+ {\par\vspace*{\stretch{1}}\newpage}
+
+
+\newenvironment{rawslide}{}{\newpage}%
+
+
+\def\itemize{%
+ \ifnum \@itemdepth >\thr@@\@toodeep\else
+ \advance\@itemdepth\@ne
+ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
+ \expandafter
+ \list
+ \csname\@itemitem\endcsname
+ {\def\makelabel##1{\hss\llap{##1}}}%
+ \fi
+ \setlength{\itemsep}{0ex}%
+ \setlength{\parskip}{0.1ex}%
+ \setlength{\parsep}{0ex}%
+ }%
+\let\enditemize =\endlist
+
+
+\def\enumerate{%
+ \ifnum \@enumdepth >\thr@@\@toodeep\else
+ \advance\@enumdepth\@ne
+ \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
+ \expandafter
+ \list
+ \csname label\@enumctr\endcsname
+ {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
+ \fi
+ \setlength{\itemsep}{0ex}%
+ \setlength{\parskip}{0.1ex}%
+ \setlength{\parsep}{0ex}%
+ }%
+\let\endenumerate =\endlist
+
+
+\renewenvironment{description}
+ {\list{}{\labelwidth\z@ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}
+ \setlength{\itemsep}{0ex}%
+ \setlength{\parskip}{0.1ex}%
+ \setlength{\parsep}{0ex}}
+ {\endlist}
+
+
+% \end{macrocode}
+% \iffalse
+%</bidipresentation.cls>
+%<*book-bidi.def>
+% \fi
+% \part{book-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\renewcommand\backmatter{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \@mainmatterfalse}
+
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter.\,\,\endR%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}{}}%
+ \def\ps@plain{\ps@empty
+ \def\@oddfoot{\hfil\thepage\hfil}%
+ \let\@evenfoot\@oddfoot
+}
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \beginR\thesection\endR\,
+ \ifnum \c@secnumdepth >\z@
+ \beginR##1\endR \ %
+ \fi
+ }}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter. \endR %
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}}}
+
+\fi
+\pagestyle{headings}
+\def\@idxitem{\par\hangindent -40\p@}
+% \end{macrocode}
+% \iffalse
+%</book-bidi.def>
+%<*bookest-bidi.def>
+% \fi
+% \part{bookest-bidi.def}
+% \begin{macrocode}
+\AtBeginDocument{
+\def\@makechapterhead#1{%
+ \vspace*{20\p@}
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ {\colorA\huge\scshape \@chapapp\space \thechapter}
+ \par\nobreak
+ \vskip 10\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ {\colorB\hrule}
+ \vskip 15\p@
+ \begin{flushleft}
+ {\colorA\Huge \bfseries #1}\par\nobreak
+ \end{flushleft}
+ \vskip 5\p@
+ {\colorB\hrule}
+ \vskip 30\p@
+ }}
+\def\@makeschapterhead#1{%
+ \vspace*{20\p@}
+ {\parindent \z@ \raggedright \normalfont
+ {\colorB\hrule}
+ \vskip 15\p@
+ \begin{center}
+ {\colorA\Huge \bfseries #1}\par\nobreak
+ \end{center}
+ \vskip 5\p@
+ {\colorB\hrule}
+ \vskip 30\p@
+ }}
+\renewcommand{\setevenhead}[1]{\def\@evenhead{#1}}
+\renewcommand{\setoddhead}[1]{\def\@oddhead{#1}}
+\renewcommand{\setevenfoot}[1]{\def\@evenfoot{#1}}
+\renewcommand{\setoddfoot}[1]{\def\@oddfoot{#1}}
+\renewcommand{\oddheadtext}{{\colorA{\slshape\rightmark}\hfill\thepage}}
+\renewcommand{\setoddheadtext}[1]{\renewcommand{\oddheadtext}{#1}}
+\renewcommand{\evenheadtext}{\oddheadtext}
+\renewcommand{\setevenheadtext}[1]{\renewcommand{\evenheadtext}{#1}}
+\renewcommand{\evenfoottext}{}
+\renewcommand{\setevenfoottext}[1]{\renewcommand{\evenfoottext}{#1}}
+\renewcommand{\oddfoottext}{}
+\renewcommand{\setoddfoottext}[1]{\renewcommand{\oddfoottext}{#1}}
+\renewcommand{\setleftmark}[1]{\renewcommand{\leftmark}{#1}}
+\renewcommand{\setrightmark}[1]{\renewcommand{\rightmark}{#1}}
+\renewcommand{\makeheadrule}{{\colorB\hrule\@width\textwidth \@height 0.4pt \vskip-0.4pt}}
+\renewcommand{\makefootrule}{\makeheadrule}
+\if@twoside
+ \setevenheadtext{{\colorA\thepage\hfill\slshape\leftmark}}
+\fi
+\setevenhead{\vbox{\evenheadtext \vskip 5\p@ \makeheadrule}}
+\setoddhead{\vbox{\oddheadtext \vskip 5\p@ \makeheadrule}}
+\let\UCase\MakeUppercase
+\renewcommand{\MakeUppercase}{}
+\def\ps@plain{%
+ \def\@oddfoot{{\hfil\colorA\thepage\hfil}}
+ \def\@evenfoot{{\hfil\colorA\thepage\hfil}}
+ \let\@oddhead\@empty
+ \let\@evenhead\@empty
+}
+}
+\NoHyper
+% \end{macrocode}
+% \iffalse
+%</bookest-bidi.def>
+%<*cvthemebidicasual.sty>
+% \fi
+% \part{cvthemebidicasual.sty}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cvthemebidicasual}
+\DeclareOption{blue}{}
+\newif\if@colourorange\@colourorangefalse
+\DeclareOption{orange}{\@colourorangetrue}
+\newif\if@colourgreen\@colourgreenfalse
+\DeclareOption{green}{\@colourgreentrue}
+\newif\if@colourred\@colourredfalse
+\DeclareOption{red}{\@colourredtrue}
+\newif\if@colourgrey\@colourgreyfalse
+\DeclareOption{grey}{\@colourgreytrue}
+\DeclareOption*{
+ \PackageWarning{cvthemebidicasual}{Unknown option ‘\CurrentOption’}}
+\ExecuteOptions{colour}
+\ProcessOptions\relax
+\renewcommand*{\listitemsymbol}{\textbullet}
+\familynamecolour{808080}
+\firstnamecolour{A9A9A9}
+\quotecolour{696969}
+\addresscolour{696969}
+\definecolor{sectionrectanglecolour}{rgb}{0.25,0.50,0.75}
+\sectiontitlecolour{1E90FF}
+\subsectioncolour{4682B4}
+\definecolor{rulecolour}{gray}{0.6}
+\definecolor{footersymbolcolour}{rgb}{0.25,0.50,0.75}
+\if@colourorange
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.65,0.20}
+ \sectiontitlecolour{FF8C00}
+ \subsectioncolour{FF8C00}
+ \definecolor{footersymbolcolour}{rgb}{0.95,0.55,0.15}\fi
+\if@colourgreen
+ \definecolor{sectionrectanglecolour}{rgb}{0.55,0.85,0.35}
+ \sectiontitlecolour{008000}
+ \subsectioncolour{008000}
+ \definecolor{footersymbolcolour}{rgb}{0.30,0.65,0.15}\fi
+\if@colourred
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.30,0.30}
+ \sectiontitlecolour{FF0000}
+ \subsectioncolour{FF0000}
+ \definecolor{footersymbolcolour}{rgb}{0.95,0.20,0.20}\fi
+\if@colourgrey
+ \definecolor{sectionrectanglecolour}{rgb}{0.75,0.75,0.75}
+ \sectiontitlecolour{808080}
+ \subsectioncolour{808080}
+ \definecolor{footersymbolcolour}{rgb}{0.35,0.35,0.35}\fi
+\renewcommand*{\ttdefault}{pcr}
+\renewcommand*{\firstnamefont}{\fontsize{38}{40}\mdseries\upshape}
+\renewcommand*{\familynamefont}{\firstnamefont}
+\renewcommand*{\addressfont}{\normalsize\mdseries\slshape}
+\renewcommand*{\quotefont}{\large\slshape}
+\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
+\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
+\renewcommand*{\maketitle}{%
+ {\beginL%
+ \ifthenelse{\isundefined{\@photo}}%
+ {}%
+ {{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
+ \hfill%
+%
+ \raggedleft{\beginR\firstnamestyle{\@firstname}~\familynamestyle{\@familyname}\endR}\endL\\[-.35em]}%
+ {\beginL\psline[linewidth=2pt,linecolor=rulecolour](-11.2,-0.2)(5.6,-0.2)\endL\\[2.5em]}%
+% optional quote
+ \ifthenelse{\isundefined{\@quote}}%
+ {}%
+ {\centering{\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}}\\[2.5em]}%
+ }%
+\newif\if@firstfooterelement\@firstfooterelementtrue
+\providecommand*{\footersymbol}{}
+\renewcommand*{\footersymbol}{%
+ \if@firstfooterelement%
+ \else%
+ { ~~\beginL\psdot[linecolor=footersymbolcolour](0,0.1)\endL~~~}\fi}
+\providecommand*{\makefooter}{}
+\renewcommand*{\makefooter}{%
+ \fancypagestyle{plain}{%
+ \fancyfoot[c]{%
+ \parbox{0.8\textwidth}{%
+ \centering%
+ \addressfont\@addresscolour%
+ \ifthenelse{\isundefined{\@address}}{}{%
+ \beginR\addresssymbol~\@address\endR\\%
+ \@firstfooterelementfalse}%
+ \beginR\ifthenelse{\isundefined{\@mobile}}{}{\beginR\mobilesymbol~\@mobile\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@phone}}{}{\footersymbol\beginR\phonesymbol~\@phone\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@fax}}{}{\footersymbol\beginR\faxsymbol~\@fax\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@email}}{}{\footersymbol\beginR\emailsymbol~\emaillink{\@email}\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@extrainfo}}{}{\beginR\footersymbol\@extrainfo\endR\@firstfooterelementfalse}\endR}}%
+ }%
+ \pagestyle{plain}}
+\AtBeginDocument{\makefooter}
+
+% \end{macrocode}
+% \iffalse
+%</cvthemebidicasual.sty>
+%<*cvthemebidiclassic.sty>
+% \fi
+% \part{cvthemebidiclassic.sty}
+% \begin{macrocode}
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cvthemebidiclassic}
+\DeclareOption{blue}{}
+\newif\if@colourorange\@colourorangefalse
+\DeclareOption{orange}{\@colourorangetrue}
+\newif\if@colourgreen\@colourgreenfalse
+\DeclareOption{green}{\@colourgreentrue}
+\newif\if@colourred\@colourredfalse
+\DeclareOption{red}{\@colourredtrue}
+\newif\if@colourgrey\@colourgreyfalse
+\DeclareOption{grey}{\@colourgreytrue}
+\DeclareOption*{
+ \PackageWarning{cvthemebidiclassic}{Unknown option ‘\CurrentOption’}}
+\ExecuteOptions{colour}
+\ProcessOptions\relax
+\renewcommand*{\listitemsymbol}{\textbullet}
+\firstnamecolour{}
+\familynamecolour{}
+\titlecolour{808080}
+\quotecolour{696969}
+\addresscolour{696969}
+\definecolor{sectionrectanglecolour}{rgb}{0.25,0.50,0.75}
+\sectiontitlecolour{1E90FF}
+\subsectioncolour{4682B4}
+\if@colourorange
+ \addresscolour{FF8C00}
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.65,0.20}
+ \sectiontitlecolour{FF8C00}
+ \subsectioncolour{FF8C00}\fi
+\if@colourgreen
+ \addresscolour{008000}
+ \definecolor{sectionrectanglecolour}{rgb}{0.55,0.85,0.35}
+ \sectiontitlecolour{008000}
+ \subsectioncolour{008000}\fi
+\if@colourred
+ \addresscolour{FF0000}
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.30,0.30}
+ \sectiontitlecolour{FF0000}
+ \subsectioncolour{FF0000}\fi
+\if@colourgrey
+ \addresscolour{808080}
+ \definecolor{sectionrectanglecolour}{rgb}{0.75,0.75,0.75}
+ \sectiontitlecolour{808080}
+ \subsectioncolour{808080}\fi
+\renewcommand*{\ttdefault}{pcr}
+\renewcommand*{\firstnamefont}{\fontsize{34}{36}\mdseries\upshape}
+\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
+\renewcommand*{\addressfont}{\normalsize\mdseries\slshape}
+\renewcommand*{\familynamefont}{\firstnamefont}
+\renewcommand*{\quotefont}{\large\slshape}
+\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
+\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
+\newlength{\maketitlenamemaxwidth}
+\setlength{\maketitlenamemaxwidth}{.525\textwidth}
+\newlength{\maketitlenamefullwidth}
+\settowidth{\maketitlenamefullwidth}{\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}}
+\newlength{\maketitlenamewidth}
+\ifnum\maketitlenamemaxwidth<\maketitlenamefullwidth\setlength{\maketitlenamewidth}{\maketitlenamemaxwidth}\else\setlength{\maketitlenamewidth}{\maketitlenamefullwidth}\fi
+% other lengths
+\newlength{\maketitlepicturewidth}
+\setlength{\maketitlepicturewidth}{\@photowidth}
+\newlength{\maketitledetailswidth}
+% recompute theme-specific lengths, called by class to recompute all lengths
+\renewcommand*{\recomputethemelengths}{%
+ \setlength{\maketitledetailswidth}{\textwidth}%
+ \addtolength{\maketitledetailswidth}{-\maketitlenamewidth}%
+ \addtolength{\maketitledetailswidth}{-\separatorcolumnwidth}%
+ \addtolength{\maketitledetailswidth}{-\maketitlepicturewidth}}
+\recomputethemelengths
+\newif\if@firstdetailselement\@firstdetailselementtrue
+\newcommand*{\maketitledetailsnewline}{
+ \if@firstdetailselement%
+ \@firstdetailselementfalse%
+ \else%
+ \\[.2em]\fi}
+\renewcommand*{\maketitle}{%
+ % name and title
+ \begin{minipage}[b]{\maketitlenamewidth}%
+ \firstnamestyle{\@firstname~}\familynamestyle{\@familyname}%
+ \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
+ \end{minipage}%
+ % optional data
+ \begin{minipage}[b]{\maketitledetailswidth}%
+ \raggedleft\addressfont\@addresscolour%
+ \ifthenelse{\isundefined{\@address}}{}{%
+ \maketitledetailsnewline%
+ \addresssymbol~\\\@address}%
+ \ifthenelse{\isundefined{\@mobile}}{}{\maketitledetailsnewline\mobilesymbol~\@mobile}%
+ \ifthenelse{\isundefined{\@phone}}{}{\maketitledetailsnewline\phonesymbol~\@phone}%
+ \ifthenelse{\isundefined{\@fax}}{}{\maketitledetailsnewline\faxsymbol~\@fax}%
+ \ifthenelse{\isundefined{\@email}}{}{\maketitledetailsnewline\emailsymbol~\emaillink{\@email}}%
+ \ifthenelse{\isundefined{\@extrainfo}}{}{\maketitledetailsnewline\@extrainfo}%
+ \end{minipage}%
+ % optional photo
+ \ifthenelse{\isundefined{\@photo}}%
+ {}%
+ {\hspace*{\separatorcolumnwidth}\framebox{\includegraphics[width=\maketitlepicturewidth]{\@photo}}}\\[3em]%
+ % optional quote
+ \ifthenelse{\isundefined{\@quote}}%
+ {}%
+ {\centering{\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}}\\[2.5em]}%
+ }
+
+% \end{macrocode}
+% \iffalse
+%</cvthemebidiclassic.sty>
+%<*draftwatermark-bidi.def>
+% \fi
+% \part{draftwatermark-bidi.def}
+% \begin{macrocode}
+\renewcommand\SetWatermarkText[1]{%
+ \def\sc@wm@text{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+% \end{macrocode}
+% \iffalse
+%</draftwatermark-bidi.def>
+%<*extbook-bidi.def>
+% \fi
+% \part{extbook-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+
+
+\def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\renewcommand\backmatter{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \@mainmatterfalse}
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter.\,\,\endR%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}{}}%
+ \def\ps@plain{\ps@empty
+ \def\@oddfoot{\hfil\thepage\hfil}%
+ \let\@evenfoot\@oddfoot
+}
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \beginR\thesection\endR\,
+ \ifnum \c@secnumdepth >\z@
+ \beginR##1\endR \ %
+ \fi
+ }}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter. \endR %
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}}}
+
+\fi
+\pagestyle{headings}
+\def\@idxitem{\par\hangindent -40\p@}
+% \end{macrocode}
+% \iffalse
+%</extbook-bidi.def>
+%<*fancyhdr-bidi.def>
+% \fi
+% \part{fancyhdr-bidi.def}
+% \begin{macrocode}
+\def\@fancyhead#1#2#3#4#5{\beginR#1\endR\hbox to\headwidth{\fancy@reset
+ \@fancyvbox\headheight{\hbox
+ {\rlap{\parbox[b]{\headwidth}{\raggedright\beginR#2\endR}}\hfill
+ \parbox[b]{\headwidth}{\centering\beginR#3\endR}\hfill
+ \llap{\parbox[b]{\headwidth}{\raggedleft\beginR#4\endR}}}\headrule}}\beginR#5\endR}
+\def\@fancyfoot#1#2#3#4#5{\beginR#1\endR\hbox to\headwidth{\fancy@reset
+ \@fancyvbox\footskip{\footrule
+ \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright\beginR#2\endR}}\hfill
+ \parbox[t]{\headwidth}{\centering\beginR#3\endR}\hfill
+ \llap{\parbox[t]{\headwidth}{\raggedleft\beginR#4\endR}}}}}\beginR#5\endR}
+% \end{macrocode}
+% \iffalse
+%</fancyhdr-bidi.def>
+%<*footnote-bidi.def>
+% \fi
+% \part{footnote-bidi.def}
+% \begin{macrocode}
+\if@RTLmain\@RTL@footnotetrue\else\@RTL@footnotefalse\fi
+\def\bidi@footnote@output{{%
+ \dimen0=\ht\footins
+ \advance\dimen0 by\dp\footins
+ \def\@elt##1##2{%
+ \ifx\bidi@footnoterule\relax\global\let\bidi@footnoterule##2\fi
+ \advance\dimen0 by -##1\relax
+ \ifdim\dimen0<\z@
+ {%
+ \let\@elt\relax\let\right@footnote\relax\let\left@footnote\relax
+ \dimen0=-\dimen0%
+ \xdef\new@bidi@footnote@list{\new@bidi@footnote@list\noexpand\@elt{\the\dimen0}{##2}}%
+ }%
+ \fi
+ \ifdim\dimen0>\z@\else
+ \let\right@footnote\relax\let\left@footnote\relax
+ \def\@elt####1####2{%
+ {\let\@elt\relax
+ \xdef\new@bidi@footnote@list{\new@bidi@footnote@list\noexpand\@elt{####1}{####2}}}%
+ }%
+ \fi
+ }%
+ \def\new@bidi@footnote@list{}%
+ \bidi@footnote@list
+ \global\let\bidi@footnote@list\new@bidi@footnote@list
+ }}
+\def\right@footnote{%
+ \hbox to \columnwidth
+ {\beginR \vbox{\kern -3\p@
+ \hrule width .4\columnwidth \kern2.6\p@}\hfil\endR}}
+\def\left@footnote{%
+ \hrule width .4\columnwidth\kern 2.6\p@}
+\def\textwidth@footnote{\kern-3\p@
+ \hrule \@width \textwidth \kern 2.6\p@}
+\def\right@footnoterule{\bidi@footnote@output\right@footnote\global\let\bidi@footnoterule\relax}
+\def\left@footnoterule{\bidi@footnote@output\left@footnote\global\let\bidi@footnoterule\relax}
+\def\textwidth@footnoterule{\bidi@footnote@output\textwidth@footnote\global\let\bidi@footnoterule\relax}
+\def\auto@footnoterule{\bidi@footnote@output
+ \ifx\bidi@footnoterule\relax\if@RTL\right@footnote\else\left@footnote\fi\else\bidi@footnoterule\fi
+ \global\let\bidi@footnoterule\relax}
+\def\leftfootnoterule{\def\footnoterule{\left@footnoterule}}
+\let\LRfootnoterule=\leftfootnoterule
+\def\rightfootnoterule{\def\footnoterule{\right@footnoterule}}
+\def\textwidthfootnoterule{\def\footnoterule{\textwidth@footnoterule}}
+\def\autofootnoterule{\def\footnoterule{\auto@footnoterule}}
+\def\@makefnmark{\hbox{$^{\hbox{\scriptsize\@thefnmark}}\m@th$}}
+\def\bidi@footnote@list{}
+\let\bidi@footnoterule\relax
+\def\RTLfootnote{\@ifnextchar[\@xRTLfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}
+ \@footnotemark\@RTLfootnotetext}}
+\def\@xRTLfootnote[#1]{
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}
+ \endgroup
+ \@footnotemark\@RTLfootnotetext}
+\def\LTRfootnote{\@ifnextchar[\@xLTRfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}
+ \@footnotemark\@LTRfootnotetext}}
+\def\@xLTRfootnote[#1]{
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}
+ \endgroup
+ \@footnotemark\@LTRfootnotetext}
+\def\insertRTL{\bgroup\beginR\@RTLtrue}
+\def\endinsertRTL{\endR\egroup}
+\def\insertLTR{\bgroup\beginL\@RTLfalse}
+\def\endinsertLTR{\endL\egroup}
+\DeclareRobustCommand\InLTR{\insertLTR}
+\DeclareRobustCommand\EInLTR{\endinsertLTR}
+\DeclareRobustCommand\InRTL{\insertRTL}
+\DeclareRobustCommand\EInRTL{\endinsertRTL}
+\def\parse@lsent#1#2\EInLTR#3#4#5\parse@end{\@sentdirfalse
+ \def\@tempa{\InLTR}\def\@tempb{\EInLTR}\def\@tempc{#1}\def\@tempd{#4}%
+ \ifx\@tempa\@tempc\ifx\@tempb\@tempd\@sentdirtrue\fi\fi}
+\def\parse@rsent#1#2\EInRTL#3#4#5\parse@end{\@sentdirfalse
+ \def\@tempa{\InRTL}\def\@tempb{\EInRTL}\def\@tempc{#1}\def\@tempd{#4}%
+ \ifx\@tempa\@tempc\ifx\@tempb\@tempd\@sentdirtrue\fi\fi}
+\def\iflsentence#1{\parse@lsent#1\EInLTR123\parse@end\if@sentdir}
+\def\ifrsentence#1{\parse@rsent#1\EInRTL123\parse@end\if@sentdir}
+\def\bidi@footnotetext@dir#1{%
+ \@tempswatrue
+ \ifrsentence{#1}\rtl\@tempswafalse\fi
+ \iflsentence{#1}\ltr\@tempswafalse\fi
+ \if@tempswa\if@RTL\rtl\else\ltr\fi\fi
+ \xdef\bidi@this@footnote{\if@RTL\noexpand\right@footnote\else\noexpand\left@footnote\fi}%
+}
+\def\bidi@footnotetext@after{%
+ {%
+ \let\@elt\relax\let\right@footnote\relax\let\left@footnote\relax
+ \dimen0=\ht\footins
+ \advance\dimen0 by\dp\footins
+ \xdef\bidi@footnote@list{\bidi@footnote@list\@elt{\the\dimen0}{\bidi@this@footnote}}%
+ }%
+}
+\def\setfootnoteRL{\@RTL@footnotetrue}
+\def\unsetfootnoteRL{\@RTL@footnotefalse}
+\def\setfootnoteLR{\unsetfootnoteRL}
+\long\def\@footnotetext#1{%
+ \begingroup
+ \setbox\footins
+ \vbox{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi\reset@font\footnotesize
\interlinepenalty\interfootnotelinepenalty
\splittopskip\footnotesep
\splitmaxdepth \dp\strutbox \floatingpenalty \@MM
\hsize\columnwidth \@parboxrestore
- \protected@edef\@currentlabel{%
- \csname p@footnote\endcsname\@thefnmark
- }%
+ \bidi@footnotetext@dir{#1}%
+ \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
+ {\rule{\z@}{\footnotesep}\ignorespaces\if@RTL@footnote#1\else\rmfamily#1\fi\strut}}%
+ \bidi@footnotetext@after
+ \insert\footins{\unvbox\footins}%
+ \endgroup}
+\long\def\@RTLfootnotetext#1{%
+ \begingroup
+ \setbox\footins
+ \vbox{\@RTLtrue\reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \bidi@footnotetext@dir{#1}%
+ \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
+ {\rule{\z@}{\footnotesep}\ignorespaces #1\strut}}%
+ \bidi@footnotetext@after
+ \insert\footins{\unvbox\footins}%
+ \endgroup}
+\long\def\@LTRfootnotetext#1{%
+ \begingroup
+ \setbox\footins
+ \vbox{\@RTLfalse\reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \bidi@footnotetext@dir{#1}%
+ \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
+ {\rule{\z@}{\footnotesep}\ignorespaces\rmfamily #1\strut}}%
+ \bidi@footnotetext@after
+ \insert\footins{\unvbox\footins}%
+ \endgroup}
+\long\def\@mpRTLfootnotetext#1{
+ \global\setbox\@mpfootins\vbox{\@RTLtrue
+ \unvbox\@mpfootins
+ \reset@font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel
+ {\csname p@mpfootnote\endcsname\@thefnmark}
\color@begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
- \color@endgroup}}%
-%%... also in minipages
-\long\def\@mpfootnotetext#1{%
- \global\setbox\@mpfootins\vbox{%
- \if@rl@footnote\@rltrue\else\@rlfalse\fi
+ \bidi@footnotetext@dir{#1}
+ \if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi
+ \@makefntext{
+ \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}
+ \color@endgroup}}
+\long\def\@mpLTRfootnotetext#1{
+ \global\setbox\@mpfootins\vbox{\@RTLfalse
\unvbox\@mpfootins
\reset@font\footnotesize
\hsize\columnwidth
\@parboxrestore
\protected@edef\@currentlabel
- {\csname p@mpfootnote\endcsname\@thefnmark}%
+ {\csname p@mpfootnote\endcsname\@thefnmark}
\color@begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
- \color@endgroup
- }}
+ \bidi@footnotetext@dir{#1}
+ \if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi
+ \@makefntext{
+ \rule\z@\footnotesep\ignorespaces\rmfamily#1\@finalstrut\strutbox}
+ \color@endgroup}}
+\long\def\@mpfootnotetext#1{
+ \global\setbox\@mpfootins\vbox{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
+ \unvbox\@mpfootins
+ \reset@font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel
+ {\csname p@mpfootnote\endcsname\@thefnmark}
+ \color@begingroup
+ \bidi@footnotetext@dir{#1}
+ \if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi
+ \@makefntext{
+ \rule\z@\footnotesep\ignorespaces\if@RTL@footnote#1\else\rmfamily#1\fi\@finalstrut\strutbox}
+ \color@endgroup}}
+\def\@iiiminipage#1#2[#3]#4{%
+ \leavevmode
+ \@pboxswfalse
+ \setlength\@tempdima{#4}%
+ \def\@mpargs{{#1}{#2}[#3]{#4}}%
+ \setbox\@tempboxa\vbox\bgroup
+ \color@begingroup
+ \hsize\@tempdima
+ \textwidth\hsize \columnwidth\hsize
+ \@parboxrestore
+ \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
+ \let\@footnotetext\@mpfootnotetext
+ \let\@LTRfootnotetext\@mpLTRfootnotetext
+ \let\@RTLfootnotetext\@mpRTLfootnotetext
+ \let\@listdepth\@mplistdepth \@mplistdepth\z@
+ \@minipagerestore
+ \@setminipage}
+% \end{macrocode}
+% \iffalse
+%</footnote-bidi.def>
+%<*graphicx-bidi.def>
+% \fi
+% \part{graphicx-bidi.def}
+% \begin{macrocode}
+\def\Gin@ii[#1]#2{%
+ \def\@tempa{[}\def\@tempb{#2}%
+ \ifx\@tempa\@tempb
+ \def\@tempa{\Gin@iii[#1][}%
+ \expandafter\@tempa
+ \else
+ \begingroup
+ \@tempswafalse
+ \toks@{\beginL\Ginclude@graphics{#2}\endL}%
+ \setkeys{Gin}{#1}%
+ \Gin@esetsize
+ \the\toks@
+ \endgroup
+ \fi}%
+% \end{macrocode}
+% \iffalse
+%</graphicx-bidi.def>
+%<*listings-bidi.def>
+% \fi
+% \part{listings-bidi.def}
+% \begin{macrocode}
+\long\def\@makecaption#1#2{%
+ \vskip 10pt%
+ \setbox\@tempboxa\hbox{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize \beginR#1: #2\par%
+ \else \hbox
+to\hsize{\beginR\hfil\box\@tempboxa\hfil%
+\endR}%
+ \fi}
+% \end{macrocode}
+% \iffalse
+%</listings-bidi.def>
+%<*longtable-bidi.def>
+% \fi
+% \part{longtable-bidi.def}
+% \begin{macrocode}
+\def\LT@makecaption#1#2#3{%
+ \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+ \sbox\@tempboxa{\if@RTL\beginR\fi#1{#2: }#3\if@RTL\endR\fi}%
+ \ifdim\wd\@tempboxa>\hsize
+ #1{#2: }#3%
+ \else
+ \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \endgraf\vskip\baselineskip}%
+ \hss}}}
+
+\def\longtable{\if@RTL\global\@RTLtabtrue\fi%
+ \par
+ \ifx\multicols\@undefined
+ \else
+ \ifnum\col@number>\@ne
+ \@twocolumntrue
+ \fi
+ \fi
+ \if@twocolumn
+ \LT@err{longtable not in 1-column mode}\@ehc
+ \fi
+ \begingroup \if@RTLtab\beginR \fi
+ \@ifnextchar[\LT@array{\LT@array[x]}}
+
+\def\LT@array[#1]#2{%
+ \refstepcounter{table}\stepcounter{LT@tables}%
+ \if l#1%
+ \LTleft\z@ \LTright\fill
+ \else\if r#1%
+ \LTleft\fill \LTright\z@
+ \else\if c#1%
+ \LTleft\fill \LTright\fill
+ \fi\fi\fi
+ \let\LT@mcol\multicolumn
+ \let\LT@@tabarray\@tabarray
+ \let\LT@@hl\hline
+ \def\@tabarray{%
+ \let\hline\LT@@hl
+ \LT@@tabarray}%
+ \let\\\LT@tabularcr\let\tabularnewline\\%
+ \def\newpage{\noalign{\break}}%
+ \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}%
+ \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}%
+ \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
+ \@tempdima\ht\strutbox
+ \let\@endpbox\LT@endpbox
+ \ifx\extrarowheight\@undefined
+ \let\@acol\@tabacol
+ \let\@classz\@tabclassz \let\@classiv\@tabclassiv
+ \def\@startpbox{\vtop\LT@startpbox}%
+ \let\@@startpbox\@startpbox
+ \let\@@endpbox\@endpbox
+ \let\LT@LL@FM@cr\@tabularcr
+ \else
+ \advance\@tempdima\extrarowheight
+ \col@sep\tabcolsep
+ \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr
+ \fi
+ \setbox\@arstrutbox\hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@}%
+ \let\@sharp##\let\protect\relax
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\LT@bchunk{%
+ \global\advance\c@LT@chunks\@ne
+ \global\LT@rows\z@\setbox\z@\vbox\bgroup
+ \LT@setprevdepth
+ \tabskip\LTleft \noexpand\halign to\hsize\bgroup
+ \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}%
+ \endgroup
+ \expandafter\LT@nofcols\LT@bchunk&\LT@nofcols
+ \LT@make@row
+ \m@th\let\par\@empty
+ \everycr{}\lineskip\z@\baselineskip\z@
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \LT@bchunk}
+
+
+\def\endlongtable{%
+ \crcr
+ \noalign{%
+ \let\LT@entry\LT@entry@chop
+ \xdef\LT@save@row{\LT@save@row}}%
+ \LT@echunk
+ \LT@start
+ \unvbox\z@
+ \LT@get@widths
+ \if@filesw
+ {\let\LT@entry\LT@entry@write\immediate\write\@auxout{%
+ \gdef\expandafter\noexpand
+ \csname LT@\romannumeral\c@LT@tables\endcsname
+ {\LT@save@row}}}%
+ \fi
+ \ifx\LT@save@row\LT@@save@row
+ \else
+ \LT@warn{Column \@width s have changed\MessageBreak
+ in table \thetable}%
+ \LT@final@warn
+ \fi
+ \endgraf\penalty -\LT@end@pen
+ \if@RTLtab\egroup\endR\egroup\fi
+ \if@RTLtab\endR\fi \endgroup
+ \global\@mparbottom\z@
+ \pagegoal\vsize
+ \endgraf\penalty\z@\addvspace\LTpost
+ \ifvoid\footins\else\insert\footins{}\fi
+ \global\@RTLtabfalse}
+% \end{macrocode}
+% \iffalse
+%</longtable-bidi.def>
+%<*minitoc-bidi.def>
+% \fi
+% \part{minitoc-bidi.def}
+% \begin{macrocode}
+\def\@undottedtocline#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth\relax \else
+ \vskip \z@ plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \hbox{}%
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ #4\nobreak\hfill \nobreak
+ \null\par}%
+ \fi}
+\def\@Undottedtocline#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth\relax \else
+ \vskip \z@ \@plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\coffeefont #4}\nobreak \nobreak\null
+ \par}%
+ \fi}
+\def\@Undottedtoclinep#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth\relax \else
+ \vskip \z@ \@plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {#4}\nobreak \hfill \nobreak\null
+ \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
+ \par}%
+ \fi}
% \end{macrocode}
-% \subsection{Captions}
-% This redefines the macros responsible for captions in various popular classes
-% (article, book, report, scrartcl, scrbook, scrreprt, and memoir).
+% \iffalse
+%</minitoc-bidi.def>
+%<*bidimemoir.cls>
+% \fi
+% \part{bidimemoir.cls}
% \begin{macrocode}
-\@ifundefined{KOMAClassName}{%
-\@ifclassloaded{memoir}{%
+%%
+%% This is file `bidimemoir.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidimemoir.dtx (with options: `class')
+%%
+%% Author: Peter Wilson (herries dot press at earthlink dot net)
+%% Herries Press
+%% Copyright 2001--2008 Peter R. Wilson
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any
+%% later version.
+%% The latest version of the license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2003/06/01 or later.
+%%
+%% This work has the LPPL maintenance status "author-maintained".
+%%
+%% This work consists of the files listed in the README file.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{bidimemoir}%
+ [2009/06/10 modified memoir document class for bidi typesetting in XeLaTeX]
+\newcommand*{\@ptsize}{}
+\newcommand*{\@memptsize}{}
+\newlength{\onelineskip}
+\newlength{\lxvchars}
+\newlength{\xlvchars}
+\newcount\@memcnta
+\newcounter{@memmarkcntra}
+\newif\if@restonecol
+\newif\if@openright
+ \@openrighttrue
+
+\newif\if@openleft
+ \@openleftfalse
+
+\newif\if@mainmatter
+ \@mainmattertrue
+
+\newif\if@memoldfont
+ \@memoldfontfalse
+
+\newif\ifextrafontsizes
+ \extrafontsizesfalse
+
+\newcommand*{\@memerror}{\ClassError{bidimemoir}}
+\newcommand*{\@memwarn}{\ClassWarning{bidimemoir}}
+
+\newif\ifsamename
+\newcommand{\nametest}[2]{%
+ \samenamefalse
+ \begingroup
+ \def\@memtempa{#1} \def\@memtempb{#2}
+ \ifx \@memtempa\@memtempb
+ \endgroup
+ \samenametrue
+ \else
+ \endgroup
+ \fi}
+
+\newif\ifm@m@And
+\newif\ifm@m@Or
+\newif\ifm@m@Xor
+
+\newcommand{\kill@lastcounter}[1]{%
+ \count\count10 \z@
+ \advance\count10 \m@ne
+ \expandafter\let\csname c@#1\endcsname\relax}
+
+\newcommand{\@name@p@xdef}[1]{%
+ \expandafter\protected@xdef\csname #1\endcsname}
+\newcommand{\@name@unresp@xdef}[1]{%
+ \expandafter\unrestored@protected@xdef\csname #1\endcsname}
+\newcommand{\@namelet}[1]{%
+ \expandafter\let\csname #1\endcsname}
+\newcommand{\@namelongdef}[1]{%
+ \long\expandafter\def\csname #1\endcsname}
+\newcommand{\@nameedef}[1]{%
+ \expandafter\protected@edef\csname #1\endcsname}
+
+\newcommand{\memjustarg}[1]{#1}
+\newcommand{\memgobble}[1]{}
+
+\newcommand*{\@memfakeusepackage}[1]{%
+ \@namelet{ver@#1.sty}\@empty}
+
+\providecommand*{\EmulatedPackage}{}
+\renewcommand*{\EmulatedPackage}[1]{%
+ \@ifnextchar[{\@emulated@package{#1}}%
+ {\@emulated@package{#1}[\@empty]}%]
+}
+\providecommand*{\EmulatedPackageWithOptions}{}
+\renewcommand*{\EmulatedPackageWithOptions}[2]{%
+ \PassOptionsToPackage{#1}{#2}%
+ \EmulatedPackage{#2}%
+}
+\def\@emulated@package#1[#2]{%
+ \expandafter\xdef\csname ver@#1.\@pkgextension\endcsname{#2}%
+ \@ifundefined{opt@#1.\@pkgextension}%
+ {\@namedef{opt@#1.\@pkgextension}{}}{}%
+ \wlog{Package #1 \ifx\@empty#2\else[#2] \fi
+ \if,\csname opt@#1.\@pkgextension\endcsname,\else
+ (with options \csname opt@#1.\@pkgextension\endcsname) \fi
+ emulated by \@currname.}%
+}
+\@onlypreamble\EmulatedPackage
+\@onlypreamble\EmulatedPackageWithOptions
+\@onlypreamble\@emulated@package
+
+\newcommand*{\DisemulatePackage}[1]{%
+ \@namelet{ver@#1.\@pkgextension}\relax}
+\@onlypreamble\DisemulatePackage
+
+\renewcommand{\InputIfFileExists}[2]{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}\m@matbeginf{#1}%
+ \@@input \@filef@und
+ \m@matendf{#1}%
+ \killm@matf{#1}}}
+
+\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}%
+ {\@nameuse{#1-m@mfb}}}
+\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}%
+ {\@nameuse{#1-m@mfe}}}
+
+\newcommand*{\killm@matf}[1]{%
+ \@namelet{#1-m@mfb}\relax
+ \@namelet{#1-m@mfe}\relax}
+
+\newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}%
+ {\@namedef{#1-m@mfb}{#2}}%
+ {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}}
+\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}%
+ {\@namedef{#1-m@mfe}{#2}}%
+ {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}}
+
+\newcommand{\AtBeginPackage}[2]{%
+ \AtBeginFile{#1.\@pkgextension}{#2}}
+\newcommand{\AtEndPackage}[2]{%
+ \AtEndFile{#1.\@pkgextension}{#2}}
+\newcommand{\RequireAtEndPackage}[2]{%
+ \@ifpackageloaded{#1}{#2}%
+ {\AtEndFile{#1.\@pkgextension}{#2}}}
+
+\newcommand{\AtBeginClass}[2]{%
+ \AtBeginFile{#1.\@clsextension}{#2}}
+\newcommand{\AtEndClass}[2]{%
+ \AtEndFile{#1.\@clsextension}{#2}}
+\newcommand{\RequireAtEndClass}[2]{%
+ \@ifclassloaded{#1}{#2}%
+ {\AtEndFile{#1.\@clsextension}{#2}}}
+
+\newcommand{\phantomsection}{}
+
+ \renewcommand*{\nofiles}{%
+ \@fileswfalse% flag for suppressing \immediate \writes
+ \typeout{No auxiliary output files.^^J}%
+ \long\def\protected@write##1##2##3%
+ {\write\m@ne{}\if@nobreak\ifvmode\nobreak\fi\fi}%
+ }
+
+\newcommand*{\memsetcounter}[2]{\setcounter{#1}{#2}}
+\AtBeginDocument{\immediate\write\@mainaux{%
+ \string\providecommand*{\string\memsetcounter}[2]{}}}
+
+\def\bs{\texttt{\char`\\}}
+\ifx\l@nohyphenation\undefined
+ \newlanguage\l@nohyphenation
+\fi
+\DeclareRobustCommand{\meta}[1]{%
+ \ensuremath\langle
+ \ifmmode \expandafter \nfss@text \fi
+ {%
+ \meta@font@select
+ \edef\meta@hyphen@restore
+ {\hyphenchar\the\font\the\hyphenchar\font}%
+ \hyphenchar\font\m@ne
+ \language\l@nohyphenation
+ #1\/%
+ \meta@hyphen@restore
+ }\ensuremath\rangle
+}
+\def\meta@font@select{\itshape}
+
+\DeclareRobustCommand{\marg}[1]{%
+ {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
+\DeclareRobustCommand{\oarg}[1]{%
+ {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}}
+\DeclareRobustCommand{\parg}[1]{%
+ {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}}
+\DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}}
+\newcommand{\cmdprint}[1]{\texttt{\string#1}}
+\newcommand{\cmd}[1]{\cmdprint{#1}%
+ \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}}
+
+\newif\ifm@mifpdf
+ \m@mifpdffalse
+\IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}\relax}{%
+ \ClassWarningNoLine{bidimemoir}{%
+ Package `ifpdf' is not installed.\MessageBreak
+ The package is being emulated}%
+\m@mifpdftrue
+\newif\ifpdf
+ \pdffalse
+\ifx\pdfoutput\undefined
+\else
+ \ifx\pdfoutput\@undefined
+ \else
+ \ifx\pdfoutput\relax
+ \else
+ \ifnum\pdfoutput>0\relax
+ \pdftrue
+ \fi
+ \fi
+ \fi
+\fi
+%%\EmulatedPackage{ifpdf}[2008/07/23]
+}
+
+\newif\ifm@mifetex
+ \m@mifetexfalse
+\IfFileExists{ifetex.sty}{\RequirePackage{ifetex}\relax}{%
+ \ClassInfo{bidimemoir}{%
+ An `ifetex' package is being emulated}%
+\m@mifetextrue
+\newif\ifetex
+ \etexfalse
+\ifx\eTeXversion\undefined
+\else
+ \ifx\eTeXversion\@undefined
+ \else
+ \ifx\eTeXversion\relax
+ \else
+ \ifnum\eTeXversion>0\relax
+ \etextrue
+ \fi
+ \fi
+ \fi
+\fi
+%%\EmulatedPackage{ifetex}[2008/07/23]
+}
+
+\newif\ifm@mifxetex
+ \m@mifxetexfalse
+\IfFileExists{ifxetex.sty}{\RequirePackage{ifxetex}\relax}{%
+ \ClassWarningNoLine{bidimemoir}{%
+ The `ifxetex' package is not installed.\MessageBreak
+ The package is being emulated}%
+\newif\ifxetex
+\@ifundefined{XeTeXrevision}{\xetexfalse}{\xetextrue}
+%%\EmulatedPackage{ifxetex}[2008/07/23]
+}
+\ifm@mifxetex
+\def\RequireXeTeX{%
+ \ifxetex\else
+ \@memerror{XeTeX is required to process this document}%
+ {Try again with xelatex, not (pdf)latex.\MessageBreak
+ Or try removing any XeTeX package(s).}
+ \fi}
+\fi
+
+\newif\ifm@mifluatex
+ \m@mifluatexfalse
+\IfFileExists{ifluatex.sty}{\RequirePackage{ifluatex}\relax}{%
+ \ClassWarningNoLine{bidimemoir}{%
+ The `ifluatex' package is not installed.\MessageBreak
+ The package is being emulated}%
+\m@mifluatextrue
+\newif\ifluatex
+ \luatexfalse
+\ifx\luatexversion\@undefined
+\else
+ \ifx\luatexversion\undefined
+ \else
+ \ifx\luatexversion\relax
+ \else
+ \luatextrue
+ \fi
+ \fi
+\fi
+%%\EmulatedPackage{ifluatex}[2008/07/23]
+}
+
+\edef\wo@dmacro{%
+ \string m\string a\string c\string r\string o\string :%
+}
+
+\def\wo@difmacro@begingroup#1{%
+ \begingroup
+ \edef\x{%
+ \noexpand\wo@dparsemacro\meaning#1\wo@dmacro\string -%
+ }%
+ \x\@nil{#1}%
+}
+
+\begingroup
+ \edef\x{\endgroup
+ \def\noexpand\wo@dparsemacro##1\wo@dmacro##2\string -}%
+\x#3\@nil#4{%
+ \ifx\\#3\\%
+ \endgroup
+ \@memwarn{\string `\string #4\string ' is not a macro}%
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+}
+
+\def\addtodef{\@star@or@long\wo@daddtodef}
+\long\def\wo@daddtodef#1#2#3{%
+ \wo@difmacro@begingroup{#1}{%
+ \@temptokena{#2}%
+ \toks@\expandafter{#1#3}%
+ \edef\x{\endgroup
+ \l@ngrel@x\def\noexpand#1{\the\@temptokena \the\toks@}}%
+ \x
+ }%
+}
+
+\def\addtoiargdef{\@star@or@long\wo@daddtoiargdef}
+\long\def\wo@daddtoiargdef#1#2#3{%
+ \wo@difmacro@begingroup{#1}{%
+ \@temptokena{#2}%
+ \toks@\expandafter{#1{##1}#3}%
+ \edef\x{\endgroup
+ \l@ngrel@x\def\noexpand#1####1{\the\@temptokena \the\toks@}}%
+ \x
+ }%
+}
+
+%%%%%%%%%%%%%%%% Michael Downes' patchcmd 2000/07/31 v1.03 %%%%%%%%
+\newcommand{\patchcommand}[1]{%
+ \expandafter\patchcmd@a\meaning#1??->@\@nil#1%
+}
+\long\def\patchcmd@a#1#2#3->#4#5\@nil#6{%
+ \ifx @#4\relax \patchcmdError#6#1%
+ \expandafter\@gobbletwo % discard the other two arguments
+ \else
+ \if l#2\toks@{\patchcmd@e{}#6}% l in this position means \long
+ \else \toks@{\patchcmd@e*#6}% not \long
+ \fi
+ \patchcmd@b #3@#4#5 ? ? ? \@nil#6%
+ \expandafter\the\expandafter\toks@
+ \fi}
+\def\patchcmd@b#1:#2@#3#4 #5#6 #7 #8\@nil#9{%
+ \if \ifx @#7@\expandafter
+ \ifx\csname #6\endcsname#9T\else F\fi\else F\fi T%
+ \toks@\expandafter{\expandafter\patchcommand\csname #6 \endcsname}%
+ \else
+ \ifx @#2@% No arguments
+ \toks@\expandafter{\the\toks@ 0}%
+ \else
+ \patchcmd@c 0#2{\string##}0%
+ \fi
+ \fi}
+\def\patchcmd@c#1#2#3{%
+ \if\string###2% % yes it's a # token
+ \ifodd 0#31 % and it's followed by a number
+ \if 0#3\patchcmd@d#1\fi % number=0? then we're done
+ \else \patchcmd@d D% # not a number: must be a delimited arg
+ \fi
+ \else \patchcmd@d D% not a # token: must be a delmited arg
+ \fi
+ \patchcmd@c#3}
+\def\patchcmd@d#1{%
+ \if D#1%
+%%% \PackageError{patchcmd}{Cannot change a macro that has
+%%% delimited arguments}\@ehd
+ \@memerror{%
+ Cannot change a macro that has delimited arguments}{\@ehd}
+ \else
+ \toks@\expandafter{\the\toks@ #1}%
+ \fi
+ \begingroup
+ \aftergroup\@gobble
+ \let\patchcmd@c\endgroup}
+\def\patchcmd@e#1#2#3#4#5{%
+ \begingroup
+ \edef\@##1{%
+ \@temptokena\noexpand\expandafter{%
+ \noexpand#2%
+ \ifnum#3>0 {####1}\ifnum#3>1 {####2}\ifnum#3>2 {####3}%
+ \ifnum#3>3 {####4}\ifnum#3>4 {####5}\ifnum#3>5 {####6}%
+ \ifnum#3>6 {####7}\ifnum#3>7 {####8}\ifnum#3>8 {####9}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi
+ ##1%
+ }%
+ }
+ \@{#5}%
+ \edef\@##1{\endgroup
+ \noexpand\renewcommand#1\noexpand#2\ifcase#3 \else [#3]\fi
+ {##1\the\@temptokena}}%
+ \@{#4}%
+}
+\long\def\patchcmdError#1#2{%
+ \begingroup
+ \toks@{Not redefinable}%
+ \ifcat\relax\noexpand#1% Is it a control sequence?
+ \begingroup
+ \let#1=?\ifx ?\relax % Is it "\relax"?
+ \endgroup % accept current value of \toks@
+ \else \endgroup
+ \if\ifx\relax#1u\else #2\fi u%
+ \toks@{Not defined}%
+ \fi
+ \fi
+ \fi
+ \edef\@{\endgroup
+%%% \noexpand\PackageError{patchcmd}{%
+%%% \the\toks@: \string#1}\noexpand\@ehd}%
+ \noexpand\@memerror{%
+ \the\toks@: \string#1}\noexpand\@ehd}%
+ \@}
+
+%%%%%%%%%%%%%%%%%%%%% end of patchcmd code %%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%\@memfakeusepackage{patchcmd}
+
+\newlength{\stockheight}
+\newlength{\stockwidth}
+\newlength{\trimtop}
+\newlength{\trimedge}
+
+\newcommand*{\stockdbill} {\stockheight=7in \stockwidth=3in}
+\newcommand*{\stockstatement} {\stockheight=8.5in \stockwidth=5.5in}
+\newcommand*{\stockexecutive} {\stockheight=10.5in \stockwidth=7.25in}
+\newcommand*{\stockletter} {\stockheight=11in \stockwidth=8.5in}
+\newcommand*{\stockold} {\stockheight=12in \stockwidth=9in}
+\newcommand*{\stocklegal} {\stockheight=14in \stockwidth=8.5in}
+\newcommand*{\stockledger} {\stockheight=17in \stockwidth=11in}
+\newcommand*{\stockbroadsheet}{\stockheight=22in \stockwidth=17in}
+
+\newcommand*{\stockpottvo} {\stockheight=6.25in \stockwidth=4in}
+\newcommand*{\stockfoolscapvo} {\stockheight=6.75in \stockwidth=4.25in}
+\newcommand*{\stockcrownvo} {\stockheight=7.5in \stockwidth=5in}
+\newcommand*{\stockpostvo} {\stockheight=8in \stockwidth=5in}
+\newcommand*{\stocklargecrownvo}{\stockheight=8in \stockwidth=5.25in}
+\newcommand*{\stocklargepostvo} {\stockheight=8.25in \stockwidth=5.25in}
+\newcommand*{\stocksmalldemyvo} {\stockheight=8.5in \stockwidth=5.675in}
+\newcommand*{\stockdemyvo} {\stockheight=8.75in \stockwidth=5.675in}
+\newcommand*{\stockmediumvo} {\stockheight=9in \stockwidth=5.75in}
+\newcommand*{\stocksmallroyalvo}{\stockheight=9.25in \stockwidth=6.175in}
+\newcommand*{\stockroyalvo} {\stockheight=10in \stockwidth=6.25in}
+\newcommand*{\stocksuperroyalvo}{\stockheight=10.25in \stockwidth=6.75in}
+\newcommand*{\stockimperialvo} {\stockheight=11in \stockwidth=7.5in}
+
+\newcommand*{\stockmcrownvo} {\stockheight=186mm \stockwidth=123mm}
+\newcommand*{\stockmlargecrownvo} {\stockheight=198mm \stockwidth=129mm}
+\newcommand*{\stockmdemyvo} {\stockheight=216mm \stockwidth=138mm}
+\newcommand*{\stockmsmallroyalvo} {\stockheight=234mm \stockwidth=156mm}
+
+\newcommand*{\stockao} {\stockheight=1189mm \stockwidth=841mm}
+\newcommand*{\stockai} {\stockheight=841mm \stockwidth=594mm}
+\newcommand*{\stockaii} {\stockheight=594mm \stockwidth=420mm}
+\newcommand*{\stockaiii}{\stockheight=420mm \stockwidth=297mm}
+\newcommand*{\stockaiv} {\stockheight=297mm \stockwidth=210mm}
+\newcommand*{\stockav} {\stockheight=210mm \stockwidth=148mm}
+\newcommand*{\stockavi} {\stockheight=148mm \stockwidth=105mm}
+
+\newcommand*{\stockbo} {\stockheight=1414mm \stockwidth=1000mm}
+\newcommand*{\stockbi} {\stockheight=1000mm \stockwidth=707mm}
+\newcommand*{\stockbii} {\stockheight=707mm \stockwidth=500mm}
+\newcommand*{\stockbiii}{\stockheight=500mm \stockwidth=353mm}
+\newcommand*{\stockbiv} {\stockheight=353mm \stockwidth=250mm}
+\newcommand*{\stockbv} {\stockheight=250mm \stockwidth=176mm}
+\newcommand*{\stockbvi} {\stockheight=176mm \stockwidth=125mm}
+
+\newcommand*{\pagedbill} {\paperheight=7in \paperwidth=3in}
+\newcommand*{\pagestatement} {\paperheight=8.5in \paperwidth=5.5in}
+\newcommand*{\pageexecutive} {\paperheight=10.5in \paperwidth=7.25in}
+\newcommand*{\pageletter} {\paperheight=11in \paperwidth=8.5in}
+\newcommand*{\pageold} {\paperheight=12in \paperwidth=9in}
+\newcommand*{\pagelegal} {\paperheight=14in \paperwidth=8.5in}
+\newcommand*{\pageledger} {\paperheight=17in \paperwidth=11in}
+\newcommand*{\pagebroadsheet}{\paperheight=22in \paperwidth=17in}
+
+\newcommand*{\pagepottvo} {\paperheight=6.25in \paperwidth=4in}
+\newcommand*{\pagefoolscapvo} {\paperheight=6.75in \paperwidth=4.25in}
+\newcommand*{\pagecrownvo} {\paperheight=7.5in \paperwidth=5in}
+\newcommand*{\pagepostvo} {\paperheight=8in \paperwidth=5in}
+\newcommand*{\pagelargecrownvo}{\paperheight=8in \paperwidth=5.25in}
+\newcommand*{\pagelargepostvo} {\paperheight=8.25in \paperwidth=5.25in}
+\newcommand*{\pagesmalldemyvo} {\paperheight=8.5in \paperwidth=5.675in}
+\newcommand*{\pagedemyvo} {\paperheight=8.75in \paperwidth=5.675in}
+\newcommand*{\pagemediumvo} {\paperheight=9in \paperwidth=5.75in}
+\newcommand*{\pagesmallroyalvo}{\paperheight=9.25in \paperwidth=6.175in}
+\newcommand*{\pageroyalvo} {\paperheight=10in \paperwidth=6.25in}
+\newcommand*{\pagesuperroyalvo}{\paperheight=10.25in \paperwidth=6.75in}
+\newcommand*{\pageimperialvo} {\paperheight=11in \paperwidth=7.5in}
+
+\newcommand*{\pagemcrownvo} {\paperheight=186mm \paperwidth=123mm}
+\newcommand*{\pagemlargecrownvo} {\paperheight=198mm \paperwidth=129mm}
+\newcommand*{\pagemdemyvo} {\paperheight=216mm \paperwidth=138mm}
+\newcommand*{\pagemsmallroyalvo} {\paperheight=234mm \paperwidth=156mm}
+
+\newcommand*{\pageao} {\paperheight=1189mm \paperwidth=841mm}
+\newcommand*{\pageai} {\paperheight=841mm \paperwidth=594mm}
+\newcommand*{\pageaii} {\paperheight=594mm \paperwidth=420mm}
+\newcommand*{\pageaiii}{\paperheight=420mm \paperwidth=297mm}
+\newcommand*{\pageaiv} {\paperheight=297mm \paperwidth=210mm}
+\newcommand*{\pageav} {\paperheight=210mm \paperwidth=148mm}
+\newcommand*{\pageavi} {\paperheight=148mm \paperwidth=105mm}
+
+\newcommand*{\pagebo} {\paperheight=1414mm \paperwidth=1000mm}
+\newcommand*{\pagebi} {\paperheight=1000mm \paperwidth=707mm}
+\newcommand*{\pagebii} {\paperheight=707mm \paperwidth=500mm}
+\newcommand*{\pagebiii}{\paperheight=500mm \paperwidth=353mm}
+\newcommand*{\pagebiv} {\paperheight=353mm \paperwidth=250mm}
+\newcommand*{\pagebv} {\paperheight=250mm \paperwidth=176mm}
+\newcommand*{\pagebvi} {\paperheight=176mm \paperwidth=125mm}
+
+\DeclareOption{a0paper}{\stockao}
+\DeclareOption{a1paper}{\stockai}
+\DeclareOption{a2paper}{\stockaii}
+\DeclareOption{a3paper}{\stockaiii}
+\DeclareOption{a4paper}{\stockaiv}
+\DeclareOption{a5paper}{\stockav}
+\DeclareOption{a6paper}{\stockavi}
+\DeclareOption{b0paper}{\stockbo}
+\DeclareOption{b1paper}{\stockbi}
+\DeclareOption{b2paper}{\stockbii}
+\DeclareOption{b3paper}{\stockbiii}
+\DeclareOption{b4paper}{\stockbiv}
+\DeclareOption{b5paper}{\stockbv}
+\DeclareOption{b6paper}{\stockbvi}
+\DeclareOption{mcrownvopaper}{\stockmcrownvo}
+\DeclareOption{mlargecrownvopaper}{\stockmlargecrownvo}
+\DeclareOption{mdemyvopaper}{\stockmdemyvo}
+\DeclareOption{msmallroyalvopaper}{\stockmsmallroyalvo}
+
+\DeclareOption{dbillpaper}{\stockdbill}
+\DeclareOption{statementpaper}{\stockstatement}
+\DeclareOption{executivepaper}{\stockexecutive}
+\DeclareOption{letterpaper}{\stockletter}
+\DeclareOption{oldpaper}{\stockold}
+\DeclareOption{legalpaper}{\stocklegal}
+\DeclareOption{ledgerpaper}{\stockledger}
+\DeclareOption{broadsheetpaper}{\stockbroadsheet}
+
+\DeclareOption{pottvopaper}{\stockpottvo}
+\DeclareOption{foolscapvopaper}{\stockfoolscapvo}
+\DeclareOption{crownvopaper}{\stockcrownvo}
+\DeclareOption{postvopaper}{\stockpostvo}
+\DeclareOption{largecrownvopaper}{\stocklargecrownvo}
+\DeclareOption{largepostvopaper}{\stocklargepostvo}
+\DeclareOption{smalldemyvopaper}{\stocksmalldemyvo}
+\DeclareOption{demyvopaper}{\stockdemyvo}
+\DeclareOption{mediumvopaper}{\stockmediumvo}
+\DeclareOption{smallroyalvopaper}{\stocksmallroyalvo}
+\DeclareOption{royalvopaper}{\stockroyalvo}
+\DeclareOption{superroyalvopaper}{\stocksuperroyalvo}
+\DeclareOption{imperialvopaper}{\stockimperialvo}
+
+\DeclareOption{ebook}
+ {\setlength\stockheight {9in}%
+ \setlength\stockwidth {6in}}
+
+\newif\ifmemlandscape
+ \memlandscapefalse
+\DeclareOption{landscape}{\memlandscapetrue}
+\DeclareOption{portrait}{\memlandscapefalse}
+
+\renewcommand*{\@ptsize}{0}
+\renewcommand*{\@memptsize}{10}
+\DeclareOption{9pt}{\renewcommand*{\@ptsize}{9}\renewcommand*{\@memptsize}{9}}
+\DeclareOption{10pt}{\renewcommand*{\@ptsize}{0}\renewcommand*{\@memptsize}{10}}
+\DeclareOption{11pt}{\renewcommand*{\@ptsize}{1}\renewcommand*{\@memptsize}{11}}
+\DeclareOption{12pt}{\renewcommand*{\@ptsize}{2}\renewcommand*{\@memptsize}{12}}
+\DeclareOption{14pt}{\renewcommand*{\@ptsize}{4}\renewcommand*{\@memptsize}{14}}
+\DeclareOption{17pt}{\renewcommand*{\@ptsize}{7}\renewcommand*{\@memptsize}{17}}
+\DeclareOption{20pt}{\renewcommand*{\@ptsize}{20}\renewcommand*{\@memptsize}{20}}
+\DeclareOption{25pt}{\renewcommand*{\@ptsize}{25}\renewcommand*{\@memptsize}{25}}
+\DeclareOption{30pt}{\renewcommand*{\@ptsize}{30}\renewcommand*{\@memptsize}{30}}
+\DeclareOption{36pt}{\renewcommand*{\@ptsize}{36}\renewcommand*{\@memptsize}{36}}
+\DeclareOption{48pt}{\renewcommand*{\@ptsize}{48}\renewcommand*{\@memptsize}{48}}
+\DeclareOption{60pt}{\renewcommand*{\@ptsize}{60}\renewcommand*{\@memptsize}{60}}
+
+\newif\if@nyptsizeopt
+ \@nyptsizeoptfalse
+\providecommand*{\anyptfilebase}{mem}
+\providecommand*{\anyptsize}{10}
+\DeclareOption{*pt}{\@nyptsizeopttrue}
+
+\DeclareOption{twoside}{\@twosidetrue \@mparswitchtrue}
+\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
+\DeclareOption{onecolumn}{\@twocolumnfalse}
+\DeclareOption{twocolumn}{\@twocolumntrue}
+\newif\ifdraftdoc\draftdocfalse
+\setlength{\overfullrule}{\z@}
+\DeclareOption{final}{\setlength{\overfullrule}{\z@}
+ \draftdocfalse
+ \msdocfalse}
+\DeclareOption{draft}{\setlength\overfullrule{5pt}%
+ \draftdoctrue
+ \msdocfalse}
+\newif\ifmsdoc
+ \msdocfalse
+\DeclareOption{ms}{%
+ \msdoctrue
+ \draftdocfalse
+ \setlength\overfullrule{\z@}
+}
+
+\newif\ifshowtrims
+ \showtrimsfalse
+\DeclareOption{showtrims}{\showtrimstrue}
+
+\newif\ifartopt
+ \artoptfalse
+\DeclareOption{article}{\artopttrue}
+
+\DeclareOption{openright}{\@openrighttrue}
+\DeclareOption{openany}{\@openrightfalse}
+\DeclareOption{openleft}{\@openlefttrue}
+\newcommand{\openright}{\@openrighttrue\@openleftfalse%
+ \gdef\clearforchapter{\cleartorecto}}
+\newcommand{\openany}{\@openrightfalse\@openleftfalse%
+ \gdef\clearforchapter{\clearpage}}
+\newcommand{\openleft}{\@openlefttrue
+ \gdef\clearforchapter{\cleartoverso}}
+
+\DeclareOption{leqno}{\input{leqno.clo}}
+\DeclareOption{fleqn}{\input{fleqn.clo}}
+\DeclareOption{openbib}{%
+ \AtEndOfClass{%
+ \renewcommand\@openbib@code{%
+ \advance\leftmargin\bibindent
+ \itemindent -\bibindent
+ \listparindent \itemindent
+ \parsep \z@
+ }%
+ \renewcommand\newblock{\par}}}
+
+\DeclareOption{oldfontcommands}{\@memoldfonttrue}
+\DeclareOption{extrafontsizes}{\extrafontsizestrue}
+
+\ExecuteOptions{final,letterpaper,10pt,onecolumn,openright,twoside,
+ portrait}
+\ProcessOptions*
+ \ifmemlandscape
+ \setlength\@tempdima {\stockheight}
+ \setlength\stockheight{\stockwidth}
+ \setlength\stockwidth {\@tempdima}
+ \fi
+
+\providecommand*{\bidimemoirpostopthook}{}
+ \bidimemoirpostopthook
+
+\def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else
+ \hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+\def\cleartoverso{\clearpage\if@twoside
+ \ifodd\c@page\hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+
+\if@openleft
+ \openleft
+\else
+ \if@openright
+ \openright
+ \else
+ \openany
+ \fi
+\fi
+
+\newcommand*{\@ivpt}{4}
+\newcommand*{\@xxxpt}{30}
+\newcommand*{\@xxxvipt}{36}
+\newcommand*{\@xlviiipt}{48}
+\newcommand*{\@lxpt}{60}
+\newcommand*{\@lxxiipt}{72}
+\newcommand*{\@lxxxivpt}{84}
+\newcommand*{\@xcvipt}{96}
+\newcommand*{\@cviiipt}{108}
+\newcommand*{\@cxxpt}{120}
+\newcommand*{\@cxxxiipt}{132}
+
+\providecommand*{\memfontfamily}{lmr}
+\providecommand*{\memfontenc}{T1}
+\providecommand*{\memfontpack}{lmodern}
+
+\if@nyptsizeopt
+ \newcommand*{\@nyptclofile}{\anyptfilebase\anyptsize.clo}
+ \IfFileExists{\@nyptclofile}{\def\@memptsize{\anyptsize}}{%
+ \@memerror{You have used the `*pt' option but \MessageBreak
+ file \@nyptclofile\space can't be found}%
+ {I'll use mem10.clo instead}
+ \renewcommand*{\@nyptclofile}{mem10.clo}%
+ \def\@memptsize{10}%
+ }
+ \renewcommand*{\@ptsize}{\@memptsize}
+ \usefont{\memfontenc}{\memfontfamily}{m}{n}
+ \input{\@nyptclofile}
+ \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc}
+\else
+ \ifextrafontsizes
+ \usefont{\memfontenc}{\memfontfamily}{m}{n}
+ \input{mem\@memptsize.clo}
+ \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc}
+ \else
+ \ifnum\@memptsize > 17\relax
+ \@memerror{The `extrafontsizes' option is required to use \MessageBreak
+ the `\@memptsize pt' option}%
+ {The 17pt option will be used instead}
+ \input{mem17.clo}
+ \else
+ \ifnum\@ptsize = 9\relax
+ \input{mem\@ptsize.clo}
+ \else
+ \input{mem1\@ptsize.clo}
+ \fi
+ \fi
+ \fi
+\fi
+
+\newcommand{\captionsize}{\normalsize}
+\setlength\lineskip{1\p@}
+\setlength\normallineskip{1\p@}
+\renewcommand{\baselinestretch}{}
+\setlength\parskip{0\p@ \@plus \p@}
+\@lowpenalty 51
+\@medpenalty 151
+\@highpenalty 301
+\clubpenalty 1000
+\widowpenalty 1000
+\newcommand*{\setlxvchars}[1][\normalfont]{\begingroup
+ #1
+ \settowidth{\lxvchars}{abcdefghijklmnopqrstuvwxyz}%
+ \setlength{\lxvchars}{2.042\lxvchars}%
+ \addtolength{\lxvchars}{33.41pt}%
+ \global\lxvchars=\lxvchars
+ \endgroup}
+\newcommand*{\setxlvchars}[1][\normalfont]{\begingroup
+ #1
+ \settowidth{\xlvchars}{abcdefghijklmnopqrstuvwxyz}%
+ \setlength{\xlvchars}{1.415\xlvchars}%
+ \addtolength{\xlvchars}{23.03pt}%
+ \global\xlvchars=\xlvchars
+ \endgroup}
+
+\newcommand*{\setrectanglesize}[3]{%
+ \nametest{#1}{*}%
+ \ifsamename % H = *
+ \nametest{#2}{*}%
+ \ifsamename % W = *
+ \@memerror{%
+ The combination of argument values is ambiguous.\MessageBreak
+ The lengths will be set to zero}{\@ehd}%
+ \setlength{\@tempdima}{0pt}%
+ \setlength{\@tempdimb}{0pt}%
+ \else % W
+ \nametest{#3}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdimb}{#2}%
+ \setlength{\@tempdima}{\@tempdimb}%
+ \else % r
+ \setlength{\@tempdimb}{#2}%
+ \setlength{\@tempdima}{#3\@tempdimb}%
+ \fi
+ \fi
+ \else % H
+ \nametest{#2}{*}%
+ \ifsamename % W = *
+ \nametest{#3}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{\@tempdima}%
+ \else % r
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#3\@tempdima}%
+ \fi
+ \else % W
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#2}%
+ \fi
+ \fi}
+
+\newcommand*{\setfillsize}[5]{%
+ \nametest{#2}{*}%
+ \ifsamename % C = *
+ \nametest{#3}{*}%
+ \ifsamename % L = *
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \@memerror{%
+ The combination of argument values is ambiguous.\MessageBreak
+ The lengths will be set to zero}{\@ehd}
+ \setlength{\@tempdima}{0pt}%
+ \setlength{\@tempdimb}{0pt}%
+ \setlength{\@tempdimc}{0pt}%
+ \else % R
+ \nametest{#5}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdima}{\@tempdimb}%
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \else % r
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdima}{#5\@tempdimb}%
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \fi
+ \fi
+ \else % L
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \nametest{#5}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{\@tempdima}
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \else % r
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#5\@tempdima}
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \fi
+ \else % R
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \fi
+ \fi
+ \else % C is valued
+ \nametest{#3}{*}%
+ \ifsamename % L = *
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \nametest{#5}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdimc}{#2}%
+ \setlength{\@tempdima}{#1}%
+ \advance\@tempdima -\@tempdimc
+ \@tempdima = 0.5\@tempdima
+ \@tempdimb = \@tempdima
+ \else % r (CODE PERHAPS FIXED)
+ \setlength{\@tempdimc}{#2} % C
+ \setlength{\@tempdimb}{#1} % T
+ \advance\@tempdimb -\@tempdimc % T - C
+ \@tempdima = 1000sp
+ \setlength{\@tempdima}{#5\@tempdima} % 1000r sp
+ \advance\@tempdima by 1000sp % 1000(1+r)sp
+ \@tempcnta = \@tempdima % 1000(1+r)
+ \@tempdima = \@tempdimb % T - C
+ \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts
+ \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L
+ \advance\@tempdimb by -\@tempdima % = R
+ \fi
+ \else % R
+ \setlength{\@tempdimc}{#2}%
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdima}{#1}%
+ \advance\@tempdima -\@tempdimc
+ \advance\@tempdima -\@tempdimb
+ \fi
+ \else % L
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \setlength{\@tempdimc}{#2}%
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#1}%
+ \advance\@tempdimb -\@tempdimc
+ \advance\@tempdimb -\@tempdima
+ \else % R
+ \@memerror{%
+ The combination of argument values is ambiguous.\MessageBreak
+ The lengths will be set to zero}{\@ehd}%
+ \setlength{\@tempdima}{0pt}%
+ \setlength{\@tempdimb}{0pt}%
+ \setlength{\@tempdimc}{#2}%
+ \fi
+ \fi
+ \fi}
+
+\newcommand{\setstocksize}[2]{%
+ \setlength{\stockheight}{#1}%
+ \setlength{\stockwidth}{#2}}
+\newcommand{\settrims}[2]{%
+ \setlength{\trimtop}{#1}%
+ \setlength{\trimedge}{#2}}
+\newcommand{\settrimmedsize}[3]{%
+ \setrectanglesize{#1}{#2}{#3}%
+ \setlength{\paperheight}{\@tempdima}%
+ \setlength{\paperwidth}{\@tempdimb}}
+
+\newcommand{\settypeblocksize}[3]{%
+ \setrectanglesize{#1}{#2}{#3}%
+ \setlength{\textheight}{\@tempdima}%
+ \setlength{\textwidth}{\@tempdimb}}
+
+\newlength{\binding}
+\newcommand*{\setbinding}[1]{\setlength{\binding}{#1}}
+ \setbinding{0pt}
+
+\newlength{\spinemargin}
+\newlength{\foremargin}
+\newcommand{\setlrmargins}[3]{%
+ \advance\paperwidth -\binding
+ \setfillsize{\paperwidth}{\textwidth}{#1}{#2}{#3}%
+ \setlength{\textwidth}{\@tempdimc}%
+ \setlength{\spinemargin}{\@tempdima}%
+ \setlength{\foremargin}{\@tempdimb}%
+ \advance\paperwidth \binding
+ \advance\spinemargin \binding}
+
+\newcommand{\setlrmarginsandblock}[3]{%
+ \advance\paperwidth -\binding
+ \setfillsize{\paperwidth}{*}{#1}{#2}{#3}%
+ \setlength{\textwidth}{\@tempdimc}%
+ \setlength{\spinemargin}{\@tempdima}%
+ \setlength{\foremargin}{\@tempdimb}%
+ \advance\paperwidth \binding
+ \advance\spinemargin \binding}
+
+\newlength{\uppermargin}
+\newlength{\lowermargin}
+\newcommand{\setulmargins}[3]{%
+ \setfillsize{\paperheight}{\textheight}{#1}{#2}{#3}%
+ \setlength{\textheight}{\@tempdimc}%
+ \setlength{\uppermargin}{\@tempdima}%
+ \setlength{\lowermargin}{\@tempdimb}}
+
+\newcommand{\setulmarginsandblock}[3]{%
+ \setfillsize{\paperheight}{*}{#1}{#2}{#3}%
+ \setlength{\textheight}{\@tempdimc}%
+ \setlength{\uppermargin}{\@tempdima}%
+ \setlength{\lowermargin}{\@tempdimb}}
+
+\newlength{\headdrop}
+\newcommand{\setheaderspaces}[3]{%
+ \setfillsize{\uppermargin}{\headheight}{#1}{#2}{#3}%
+ \setlength{\headheight}{\@tempdimc}%
+ \setlength{\headdrop}{\@tempdima}%
+ \setlength{\headsep}{\@tempdimb}}
+
+\newcommand{\setheadfoot}[2]{%
+ \setlength{\headheight}{#1}%
+ \setlength{\footskip}{#2}}
+
+\newcommand{\setcolsepandrule}[2]{%
+ \setlength{\columnsep}{#1}%
+ \setlength{\columnseprule}{#2}}
+
+\newcommand{\setmarginnotes}[3]{%
+ \setlength{\marginparsep}{#1}%
+ \setlength{\marginparwidth}{#2}%
+ \setlength{\marginparpush}{#3}}
+
+\settrimmedsize{\stockheight}{\stockwidth}{*}
+\settrims{\z@}{\z@}
+
+\setlength{\@tempdimb}{1.14\lxvchars}
+\setlength\@tempdima{\paperwidth}
+ \addtolength\@tempdima{-2in}
+\if@twocolumn
+ \ifdim\@tempdima>2\@tempdimb\relax
+ \setlength\textwidth{2\@tempdimb}
+ \else
+ \setlength\textwidth{\@tempdima}
+ \fi
+\else
+ \ifdim\@tempdima>\@tempdimb\relax
+ \setlength\textwidth{\@tempdimb}
+ \else
+ \setlength\textwidth{\@tempdima}
+ \fi
+\fi
+\@settopoint\textwidth
+
+\setlength\@tempdima{\paperheight}
+ \addtolength\@tempdima{-3.5in}
+ \divide\@tempdima\baselineskip
+\@tempcnta=\@tempdima
+\setlength\textheight{\@tempcnta\baselineskip}
+ \addtolength\textheight{\topskip}
+
+\if@twoside
+ \setlength\@tempdima {\paperwidth}
+ \addtolength\@tempdima {-\textwidth}
+ \setlength\oddsidemargin {.4\@tempdima}
+ \addtolength\oddsidemargin {-1in}
+ \setlength\marginparwidth {.6\@tempdima}
+ \addtolength\marginparwidth{-\marginparsep}
+ \addtolength\marginparwidth{-0.4in}
+\else
+ \setlength\@tempdima {\paperwidth}
+ \addtolength\@tempdima {-\textwidth}
+ \setlength\oddsidemargin {.5\@tempdima}
+ \addtolength\oddsidemargin {-1in}
+ \setlength\marginparwidth {.5\@tempdima}
+ \addtolength\marginparwidth{-\marginparsep}
+ \addtolength\marginparwidth{-0.8in} % don't know why this isn't .4
+\fi
+\ifdim\marginparwidth>2in
+ \setlength\marginparwidth{2in}%
+\fi
+\@settopoint\oddsidemargin
+\@settopoint\marginparwidth
+\ifdim\marginparwidth<1pt \setlength\marginparwidth{1pt}\fi
+
+\setlength\evensidemargin {\paperwidth}
+\addtolength\evensidemargin{-2in}
+\addtolength\evensidemargin{-\textwidth}
+\addtolength\evensidemargin{-\oddsidemargin}
+\@settopoint\evensidemargin
+\setlength\topmargin {\paperheight}
+\addtolength\topmargin{-2in}
+\addtolength\topmargin{-\headheight}
+\addtolength\topmargin{-\headsep}
+\addtolength\topmargin{-\textheight}
+\addtolength\topmargin{-\footskip}
+\addtolength\topmargin{-.5\topmargin}
+\@settopoint\topmargin
+
+\setlength{\spinemargin}{\oddsidemargin}
+\addtolength{\spinemargin}{1in}
+\setlrmargins{\spinemargin}{*}{*}
+
+\setlength{\uppermargin}{\topmargin}
+\addtolength{\uppermargin}{1in}
+\addtolength{\uppermargin}{\headheight}
+\addtolength{\uppermargin}{\headsep}
+\setulmargins{\uppermargin}{*}{*}
+
+\newcommand*{\@memznegtest}[1]{%
+ \ifdim#1>\z@\else
+ %%%% \@memerror{\protect#1\space is zero or negative}{\@ehd}%
+ \@memwarn{\protect#1\space is zero or negative}%
+ \fi}
+\newcommand*{\@memnegtest}[1]{%
+ \ifdim#1<\z@
+%%%% \@memerror{\protect#1\space is negative}{\@ehd}%
+ \@memwarn{\protect#1\space is negative}%
+ \fi}
+
+\newcommand*{\m@mclassicht}{%
+ \setlength{\@tempdima}{\textheight}%
+ \divide\@tempdima \baselineskip
+ \@tempcnta=\@tempdima
+ \setlength{\textheight}{\@tempcnta\baselineskip}%
+ \addtolength{\textheight}{\topskip}}
+
+\newcommand*{\m@mlinesht}{%
+ \setlength{\@tempdima}{\textheight}%
+ \advance\@tempdima -\baselineskip
+ \divide\@tempdima \baselineskip
+ \@tempcnta=\@tempdima
+ \setlength{\textheight}{\@tempcnta\baselineskip}%
+ \addtolength{\textheight}{\topskip}}
+
+\newcommand*{\m@mnearestht}{%
+ \setlength{\@tempdima}{\textheight}%
+ \advance\@tempdima -\topskip
+ \advance\@tempdima 0.5\baselineskip
+ \divide\@tempdima \baselineskip
+ \@tempcnta=\@tempdima
+ \setlength{\textheight}{\@tempcnta\baselineskip}%
+ \addtolength{\textheight}{\topskip}}
+
+\newcommand*{\checkthelayout}[1][classic]{%
+ \@memnegtest{\trimedge}
+ \@memnegtest{\trimtop}
+ \@memznegtest{\stockwidth}
+ \@memznegtest{\paperwidth}
+ \@memznegtest{\textwidth}
+%%% \@memznegtest{\spinemargin}
+ \@memnegtest{\spinemargin}
+%%% \@memznegtest{\foremargin}
+ \@memnegtest{\foremargin}
+ \@memznegtest{\marginparsep}
+ \@memznegtest{\marginparwidth}
+ \@memznegtest{\stockheight}
+ \@memznegtest{\paperheight}
+ \@memznegtest{\textheight}
+%%% \@memznegtest{\uppermargin}
+ \@memnegtest{\uppermargin}
+%%% \@memznegtest{\lowermargin}
+ \@memnegtest{\lowermargin}
+%%% \@memznegtest{\headheight}
+ \@memnegtest{\headheight}
+%%% \@memznegtest{\headsep}
+ \@memnegtest{\headsep}
+%%% \@memznegtest{\footskip}
+ \@memnegtest{\footskip}
+ \nametest{#1}{classic}%
+ \ifsamename
+ \m@mclassicht
+ \else
+ \nametest{#1}{lines}%
+ \ifsamename
+ \m@mlinesht
+ \else
+ \nametest{#1}{nearest}%
+ \ifsamename
+ \m@mnearestht
+ \else
+ \nametest{#1}{fixed}
+ \ifsamename
+ \else% not classic, lines, nearest, or fixed
+ \@memerror{Optional argument is not one of:\MessageBreak
+ classic, fixed, lines, or nearest. \MessageBreak
+ I will assume the default}%
+ {\@ehc}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \setulmargins{\uppermargin}{*}{*}
+ \@tempdimb = -1pt
+ \@tempdima=\stockwidth
+ \advance\@tempdima -\trimedge
+ \advance\@tempdima -\paperwidth
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\paperwidth\space (\the\paperwidth) and/or
+ \protect\trimedge\space (\the\trimedge)
+ are too large for \protect\stockwidth\space (\the\stockwidth)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \paperwidth
+ \advance\@tempdima -\foremargin
+ \advance\@tempdima -\textwidth
+ \advance\@tempdima -\spinemargin
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\spinemargin\space (\the\spinemargin) and/or
+ \protect\textwidth\space (\the\textwidth) and/or
+ \protect\foremargin\space (\the\foremargin)
+ are too large for \protect\paperwidth\space (\the\paperwidth)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \stockheight
+ \advance\@tempdima -\trimtop
+ \advance\@tempdima -\paperheight
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\paperheight\space (\the\paperheight) and/or
+ \protect\trimtop\space (\the\trimtop)
+ are too large for \protect\stockheight\space (\the\stockheight)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \paperheight
+ \advance\@tempdima -\uppermargin
+ \advance\@tempdima -\textheight
+ \advance\@tempdima -\lowermargin
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\uppermargin\space (\the\uppermargin) and/or
+ \protect\textheight\space (\the\textheight) and/or
+ \protect\lowermargin\space (\the\lowermargin)
+ are too large for \protect\paperheight\space (\the\paperheight)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \uppermargin
+ \advance\@tempdima -\headheight
+ \advance\@tempdima -\headsep
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\headheight\space (\the\headheight) and/or
+ \protect\headsep\space (\the\headsep)
+ are too large for \protect\uppermargin\space (\the\uppermargin)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \lowermargin
+ \advance\@tempdima -\footskip
+ \ifdim\@tempdima<\z@
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\footskip\space (\the\footskip)
+ is too large for \protect\lowermargin\space (\the\lowermargin)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi}
+
+\newcommand*{\fixthelayout}{%
+ \topmargin = \trimtop
+ \advance\topmargin \uppermargin
+ \advance\topmargin -\headsep
+ \advance\topmargin -\headheight
+ \advance\topmargin -1in\relax
+ \oddsidemargin = \stockwidth
+ \advance\oddsidemargin -\trimedge
+ \advance\oddsidemargin -\paperwidth
+ \advance\oddsidemargin \spinemargin
+ \advance\oddsidemargin -1in\relax
+ \evensidemargin = \trimedge
+ \advance\evensidemargin \foremargin
+ \advance\evensidemargin -1in\relax
+ \@settopoint\textwidth
+ \@settopoint\oddsidemargin
+ \@settopoint\evensidemargin}
+
+\newcommand*{\typeoutlayout}{%
+ \typeout{}
+ \typeout{******************************************************}
+ \typeout{Stock height and width:
+ \the\stockheight\space by \the\stockwidth}
+ \typeout{Top and edge trims:
+ \the\trimtop\space and \the\trimedge}
+ \typeout{Page height and width:
+ \the\paperheight\space by \the\paperwidth}
+ \typeout{Text height and width:
+ \the\textheight\space by \the\textwidth}
+ \typeout{Spine and edge margins:
+ \the\spinemargin\space and \the\foremargin}
+ \typeout{Upper and lower margins:
+ \the\uppermargin\space and \the\lowermargin}
+ \typeout{Headheight and headsep:
+ \the\headheight\space and \the\headsep}
+ \typeout{Footskip:
+ \the\footskip}
+ \typeout{Columnsep and columnseprule:
+ \the\columnsep\space and \the\columnseprule}
+ \typeout{Marginparsep and marginparwidth:
+ \the\marginparsep\space and \the\marginparwidth}
+ \typeout{Sidecapsep and sidecapwidth:
+ \the\sidecapsep\space and \the\sidecapwidth}
+ \typeout{Sidebarhsep and sidebarwidth:
+ \the\sidebarhsep\space and \the\sidebarwidth}
+ \typeout{Sidebarvsep and sidebartopsep:
+ \the\sidebarvsep\space and \the\sidebartopsep}
+ \typeout{Sidebarheight:
+ \the\dimen\sideins}
+ \typeout{******************************************************}
+ \typeout{}}
+
+\newcommand*{\checkandfixthelayout}[1][classic]{%
+ \checkthelayout[#1]%
+ \fixthelayout
+ \typeoutlayout}
+
+\newcommand*{\fixpdflayout}{%
+ \pdfpageheight=\the\stockheight
+ \pdfpagewidth=\the\stockwidth
+ \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi
+ \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi}
+\newcommand*{\fixdvipslayout}{%
+ \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}}
+
+\AtBeginDocument{%
+ \ifpdf
+ \ifnum\pdfoutput<\@ne
+ \fixdvipslayout
+ \else
+ \fixpdflayout
+ \fi
+ \else
+ \fixdvipslayout
+ \fi}
+
+\newcommand{\typeoutstandardlayout}{%
+ \typeout{}
+ \typeout{******************************************************}
+ \typeout{Page height and width:
+ \the\paperheight\space by \the\paperwidth}
+ \typeout{Text height and width:
+ \the\textheight\space by \the\textwidth}
+ \typeout{Oddside and evenside margins:
+ \the\oddsidemargin\space and \the\evensidemargin}
+ \typeout{Topmargin and footskip:
+ \the\topmargin\space and \the\footskip}
+ \typeout{Headheight and headsep:
+ \the\headheight\space and \the\headsep}
+ \typeout{Columnsep and columnseprule:
+ \the\columnsep\space and \the\columnseprule}
+ \typeout{Marginparsep and marginparwidth:
+ \the\marginparsep\space and \the\marginparwidth}
+ \typeout{******************************************************}
+ \typeout{}
+}
+
+%%%% s = w/#1, t = 1.5s, e = 2s, f = 3s
+\newcommand*{\medievalpage}[1][9]{%
+ \spinemargin=\paperwidth
+ \divide\spinemargin #1\relax
+ \uppermargin = 1.5\spinemargin
+ \setlrmarginsandblock{\spinemargin}{*}{2}
+ \setulmarginsandblock{\uppermargin}{*}{2}}
+
+\newcommand*{\isopage}[1][9]{%
+ \spinemargin=\paperwidth
+ \divide\spinemargin #1\relax
+ \uppermargin=\paperheight
+ \divide\uppermargin #1\relax
+ \setlrmarginsandblock{\spinemargin}{*}{2}
+ \setulmarginsandblock{\uppermargin}{*}{2}}
+
+%%% s = w/#1, t = s, e = 2s, f = e
+\newcommand*{\semiisopage}[1][9]{%
+ \spinemargin=\paperwidth
+ \divide\spinemargin #1\relax
+ \uppermargin=\spinemargin
+ \setlrmarginsandblock{\spinemargin}{*}{2}
+ \setulmarginsandblock{\uppermargin}{*}{2}}
+
+\newcommand*{\setpagebl}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth}
+\newcommand*{\setpageml}[3]{%
+ \settrimmedsize{#1}{#2}{#3}
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \advance\trimtop -0.5\trimtop
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth}
+\newcommand*{\setpagetl}[3]{%
+ \settrimmedsize{#1}{#2}{#3}
+ \trimtop=0pt
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth}
+\newcommand*{\setpagetm}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=0pt
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth
+ \advance\trimedge -0.5\trimedge}
+
+\newcommand*{\setpagetr}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=0pt
+ \trimedge=0pt}
+\newcommand*{\setpagemr}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \advance\trimtop -0.5\trimtop
+ \trimedge=0pt}
+\newcommand*{\setpagebr}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \trimedge=0pt}
+\newcommand*{\setpagebm}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth
+ \advance\trimedge -0.5\trimedge}
+\newcommand*{\setpagecc}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \advance\trimtop -0.5\trimtop
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth
+ \advance\trimedge -0.5\trimedge}
+
+\setcounter{topnumber}{3}
+\renewcommand{\topfraction}{.85}
+\setcounter{bottomnumber}{2}
+\renewcommand{\bottomfraction}{.5}
+\setcounter{totalnumber}{4}
+\renewcommand{\textfraction}{.1}
+\renewcommand{\floatpagefraction}{.7}
+\setcounter{dbltopnumber}{3}
+\renewcommand{\dbltopfraction}{.85}
+\renewcommand{\dblfloatpagefraction}{.7}
+\newcommand{\makeevenhead}[4]{%
+ \@namedef{#1eheadl}{#2}
+ \@namedef{#1eheadc}{#3}
+ \@namedef{#1eheadr}{#4}
+}
+\newcommand{\makeoddhead}[4]{%
+ \@namedef{#1oheadl}{#2}
+ \@namedef{#1oheadc}{#3}
+ \@namedef{#1oheadr}{#4}
+}
+\newcommand{\makeevenfoot}[4]{%
+ \@namedef{#1efootl}{#2}
+ \@namedef{#1efootc}{#3}
+ \@namedef{#1efootr}{#4}
+}
+\newcommand{\makeoddfoot}[4]{%
+ \@namedef{#1ofootl}{#2}
+ \@namedef{#1ofootc}{#3}
+ \@namedef{#1ofootr}{#4}
+}
+
+\newcommand*{\makerunningwidth}[1]{%
+ \def\m@mhfstyle{#1}%
+ \m@mopthfwidth}
+\newcommand*{\m@mopthfwidth}[2][\@mpty]{%
+ \@namedef{\m@mhfstyle headrunwidth}{#2}%
+ \ifx\@mpty #1
+ \@namedef{\m@mhfstyle footrunwidth}{#2}%
+ \else
+ \@namedef{\m@mhfstyle footrunwidth}{#1}%
+ \fi}
+\newcommand*{\makerunningheadwidth}[2]{%
+ \@namedef{#1headrunwidth}{#2}%
+}
+\newcommand*{\makerunningfootwidth}[2]{%
+ \@namedef{#1footrunwidth}{#2}%
+}
+
+\newlength{\normalrulethickness}
+ \setlength{\normalrulethickness}{0.4pt}
+\newcommand{\footruleheight}{0pt}
+\newcommand{\footruleskip}{0.3\normalbaselineskip}
+\newcommand{\makeheadrule}[3]{%
+ \@namedef{#1headrule}{%
+ \hrule\@width #2\@height #3 \vskip-#3}}
+\newcommand{\makefootrule}[4]{%
+ \@namedef{#1footrule}{%
+ \vskip-#4\vskip-#3
+ \hrule\@width #2\@height #3 \vskip #4}}
+
+\newcommand{\makeheadposition}[5]{%
+ \nametest{flushleft}{#2}
+ \ifsamename
+ \@namedef{#1evenhpl}{\relax} \@namedef{#1evenhpr}{\hss}
+ \else
+ \nametest{flushright}{#2}
+ \ifsamename
+ \@namedef{#1evenhpl}{\hss} \@namedef{#1evenhpr}{\relax}
+ \else
+ \@namedef{#1evenhpl}{\hss} \@namedef{#1evenhpr}{\hss}
+ \fi
+ \fi
+ \nametest{flushleft}{#3}
+ \ifsamename
+ \@namedef{#1oddhpl}{\relax} \@namedef{#1oddhpr}{\hss}
+ \else
+ \nametest{flushright}{#3}
+ \ifsamename
+ \@namedef{#1oddhpl}{\hss} \@namedef{#1oddhpr}{\relax}
+ \else
+ \@namedef{#1oddhpl}{\hss} \@namedef{#1oddhpr}{\hss}
+ \fi
+ \fi
+ \nametest{flushleft}{#4}
+ \ifsamename
+ \@namedef{#1evenfpl}{\relax} \@namedef{#1evenfpr}{\hss}
+ \else
+ \nametest{flushright}{#4}
+ \ifsamename
+ \@namedef{#1evenfpl}{\hss} \@namedef{#1evenfpr}{\relax}
+ \else
+ \@namedef{#1evenfpl}{\hss} \@namedef{#1evenfpr}{\hss}
+ \fi
+ \fi
+ \nametest{flushleft}{#5}
+ \ifsamename
+ \@namedef{#1oddfpl}{\relax} \@namedef{#1oddfpr}{\hss}
+ \else
+ \nametest{flushright}{#5}
+ \ifsamename
+ \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\relax}
+ \else
+ \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\hss}
+ \fi
+ \fi}
+
+\newcommand{\makepsmarks}[2]{\@namedef{#1pshook}{#2}}
+
+\newcommand*{\m@mhe@dreset}{\def\baselinestretch{1}\normalsize}
+
+\newcommand*\makeheadfootvposition[3]{%
+ \@namedef{#1headvplacement}{#2}\@namedef{#1footvplacement}{#3}}
+
+\newcommand{\makepagestyle}[1]{%
+ \@namedef{ps@#1}{%
+ \@namedef{#1@evenhead}{%
+ \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
+ \vbox{\hbox{%
+ \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedright\@nameuse{#1eheadl}\strut}}\hfill
+ \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \centering\@nameuse{#1eheadc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedleft\@nameuse{#1eheadr}\strut}}}%
+ \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}%
+ \@namedef{#1@oddhead}{%
+ \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
+ \vbox{\hbox{%
+ \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedright\@nameuse{#1oheadl}\strut}}\hfill
+ \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \centering\@nameuse{#1oheadc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedleft\@nameuse{#1oheadr}\strut}}}%
+ \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}%
+ \@namedef{#1@evenfoot}{%
+ \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
+ \vbox{\@nameuse{#1footrule}\hbox{%
+ \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedright\@nameuse{#1efootl}\strut}}\hfill
+ \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \centering\@nameuse{#1efootc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedleft\@nameuse{#1efootr}\strut}}}%
+ }}\@nameuse{#1evenfpr}}%
+ \@namedef{#1@oddfoot}{%
+ \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
+ \vbox{\@nameuse{#1footrule}\hbox{%
+ \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedright\@nameuse{#1ofootl}\strut}}\hfill
+ \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \centering\@nameuse{#1ofootc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedleft\@nameuse{#1ofootr}\strut}}}%
+ }}\@nameuse{#1oddfpr}}%
+ \def\@evenhead{\@nameuse{#1@evenhead}}%
+ \def\@oddhead{\@nameuse{#1@oddhead}}%
+ \def\@evenfoot{\@nameuse{#1@evenfoot}}%
+ \def\@oddfoot{\@nameuse{#1@oddfoot}}%
+ \@nameuse{#1pshook}}%
+ \makeevenhead{#1}{}{}{}%
+ \makeoddhead{#1}{}{}{}%
+ \makeevenfoot{#1}{}{}{}%
+ \makeoddfoot{#1}{}{}{}%
+ \makerunningwidth{#1}{\textwidth}%
+ \makeheadposition{#1}{}{}{}{}%
+ \makeheadrule{#1}{\textwidth}{0pt}%
+ \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}%
+ \makeheadfootvposition{#1}{b}{b}%
+ \makepsmarks{#1}{}}
+
+\newcommand{\aliaspagestyle}[2]{%
+ \@namedef{ps@#1}{\@nameuse{ps@#2}}}
+
+\newcommand{\copypagestyle}[2]{%
+ \makepagestyle{#1}%
+ \makeevenhead{#1}{\@nameuse{#2eheadl}}%
+ {\@nameuse{#2eheadc}}{\@nameuse{#2eheadr}}%
+ \makeoddhead{#1}{\@nameuse{#2oheadl}}%
+ {\@nameuse{#2oheadc}}{\@nameuse{#2oheadr}}%
+ \makeevenfoot{#1}{\@nameuse{#2efootl}}%
+ {\@nameuse{#2efootc}}{\@nameuse{#2efootr}}%
+ \makeoddfoot{#1}{\@nameuse{#2ofootl}}%
+ {\@nameuse{#2ofootc}}{\@nameuse{#2ofootr}}%
+ \makerunningwidth{#1}[\@nameuse{#2footrunwidth}]{\@nameuse{#2headrunwidth}}%
+ \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}%
+ \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}%
+ \@namedef{#1evenhpr}{\@nameuse{#2evenhpr}}%
+ \@namedef{#1oddhpr}{\@nameuse{#2oddhpr}}%
+ \makeheadfootvposition{#1}{\@nameuse{#2headvplacement}}{\@nameuse{#2footvplacement}}%
+ \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}%
+ \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}%
+ \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}%
+ \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}%
+ \@namedef{#1headrule}{\@nameuse{#2headrule}}%
+ \@namedef{#1footrule}{\@nameuse{#2footrule}}%
+ \makepsmarks{#1}{\@nameuse{#2pshook}}}
+
+\newcommand{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi}
+
+\newcommand{\mergepagefloatstyle}[3]{%
+ \@nameuse{ps@#3}\@nameuse{ps@#2}%
+ \@namedef{ps@#1}{%
+ \def\@evenhead{\ifonlyfloats{\@nameuse{#3@evenhead}}%
+ {\@nameuse{#2@evenhead}}}%
+ \def\@oddhead{\ifonlyfloats{\@nameuse{#3@oddhead}}%
+ {\@nameuse{#2@oddhead}}}%
+ \def\@evenfoot{\ifonlyfloats{\@nameuse{#3@evenfoot}}%
+ {\@nameuse{#2@evenfoot}}}%
+ \def\@oddfoot{\ifonlyfloats{\@nameuse{#3@oddfoot}}%
+ {\@nameuse{#2@oddfoot}}}%
+ \@namedef{#1pshook}{\@nameuse{#2pshook}}%
+}}
+
+\makepagestyle{empty}
+
+\makepagestyle{plain}
+ \makeevenfoot{plain}{}{\thepage}{}
+ \makeoddfoot{plain}{}{\thepage}{}
+
+\newcommand*{\nouppercaseheads}{\let\memUChead\relax}
+\newcommand*{\uppercaseheads}{\let\memUChead\MakeUppercase}
+\uppercaseheads
+
+\newcommand*{\createplainmark}[3]{%
+ \nametest{#2}{left}%
+ \ifsamename
+ \@namedef{#1mark}{\markboth{\memUChead{#3}}{}}%
+ \else
+ \nametest{#2}{right}%
+ \ifsamename
+ \@namedef{#1mark}{\markright{\memUChead{#3}}}%
+ \else
+ \nametest{#2}{both}%
+ \ifsamename\else
+ \@memerror{%
+ Unknown mark setting type `#2' for #1mark}{%
+ I expected `left', `both' or `right'. \MessageBreak
+ I will assume you meant `both'}%
+ \fi
+ \@namedef{#1mark}{\markboth{\memUChead{#3}}{\memUChead{#3}}}%
+ \fi
+ \fi}
+
+\newcommand\createmark[5]{%
+ \def\@tempa{00}
+ \nametest{#3}{nonumber}%
+ \ifsamename
+ \def\@tempa{01}%
+ \else
+ \nametest{#3}{shownumber}
+ \ifsamename\else
+ \@memerror{Unknown numbering value `#3' for #1mark}%
+ {I expected `shownumber' or `nonumber'.\MessageBreak
+ I will assume you meant `shownumber'}%
+ \fi
+ \fi
+ \expandafter\if\@tempa% compares the two \@tempa digits
+ \@namedef{#1marksn}##1{##1}%
+ \else
+ \@namedef{#1marksn}{\@gobble}%
+ \fi
+ \nametest{#2}{left}%
+ \ifsamename
+ \@namedef{#1mark}##1{%
+ \@setclcnt{#1}{@memmarkcntra}%
+ \advance\c@@memmarkcntra\m@ne
+ \markboth{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi
+ \fi
+ ##1}}{}}%
+ \else
+ \nametest{#2}{right}
+ \ifsamename
+ \@namedef{#1mark}##1{%
+ \@setclcnt{#1}{@memmarkcntra}
+ \advance\c@@memmarkcntra\m@ne
+ \markright{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter%
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi%
+ \fi%
+ ##1}}}%
+ \else
+ \nametest{#2}{both}%
+ \ifsamename\else
+ \@memerror{%
+ Unknown mark setting type `#2' for #1mark}{%
+ I expected `left', `both' or `right'. \MessageBreak
+ I will assume you meant `both'}%
+ \fi
+ \@namedef{#1mark}##1{%
+ \@setclcnt{#1}{@memmarkcntra}
+ \advance\c@@memmarkcntra\m@ne
+ \markboth{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi
+ \fi
+ ##1}}{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi
+ \fi
+ ##1}}}%
+ \fi
+ \fi}
+
+\newcommand\addtopsmarks[3]{%
+ \expandafter\addtodef\expandafter{\csname #1pshook\endcsname}{#2}{#3}}
+\if@twoside
+ \makepagestyle{headings}
+ \makepsmarks{headings}{%
+ \def\chaptermark##1{%
+ \markboth{\memUChead{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \@chapapp\ \thechapter. \ %
+ \fi
+ \fi
+ ##1}}{}}%
+ \def\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}%
+ \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}%
+ \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}%
+ \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}%
+ \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}%
+ \def\sectionmark##1{%
+ \markright{\memUChead{%
+ \ifnum \c@secnumdepth > \z@
+ \thesection. \ %
+ \fi
+ ##1}}}}
+ \makepsmarks{headings}{%
+ \createmark{chapter}{left}{shownumber}{\@chapapp\ }{. \ }
+ \createmark{section}{right}{shownumber}{}{. \ }
+ \createplainmark{toc}{both}{\contentsname}
+ \createplainmark{lof}{both}{\listfigurename}
+ \createplainmark{lot}{both}{\listtablename}
+ \createplainmark{bib}{both}{\bibname}
+ \createplainmark{index}{both}{\indexname}
+ \createplainmark{glossary}{both}{\glossaryname}
+ }
+ \makeevenhead{headings}{\thepage}{}{\slshape\leftmark}
+ \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
+\else
+ \makepagestyle{headings}
+ \makepsmarks{headings}{%
+ \def\chaptermark##1{%
+ \markright{\memUChead{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \@chapapp\ \thechapter. \ %
+ \fi
+ \fi
+ ##1}}}%
+ \def\tocmark{\markright{\memUChead{\contentsname}}}%
+ \def\lofmark{\markright{\memUChead{\listfigurename}}}%
+ \def\lotmark{\markright{\memUChead{\listtablename}}}%
+ \def\bibmark{\markright{\memUChead{\bibname}}}%
+ \def\indexmark{\markright{\memUChead{\indexname}}}}
+ \makepsmarks{headings}{%
+ \createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ }
+ \createplainmark{toc}{right}{\contentsname}
+ \createplainmark{lof}{right}{\listfigurename}
+ \createplainmark{lot}{right}{\listtablename}
+ \createplainmark{bib}{right}{\bibname}
+ \createplainmark{index}{right}{\indexname}
+ \createplainmark{glossary}{right}{\glossaryname}
+ }
+ \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
+\fi
+
+\makepagestyle{myheadings}
+ \makepsmarks{myheadings}{%
+ \let\chaptermark\@gobble
+ \let\sectionmark\@gobble
+ \def\tocmark{}%
+ \def\lofmark{}%
+ \def\lotmark{}%
+ \def\bibmark{}%
+ \def\indexmark{}%
+ \def\glossarymark{}}
+ \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark}
+ \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage}
+
+\aliaspagestyle{chapter}{plain}
+\aliaspagestyle{part}{plain}
+\aliaspagestyle{cleared}{empty}
+
+\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
+ \hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+\makepagestyle{ruled}
+\makeevenfoot{ruled}{\thepage}{}{}
+\makeoddfoot{ruled}{}{}{\thepage}
+\makeheadrule{ruled}{\textwidth}{\normalrulethickness}
+\newcommand{\@ruledmarks}{%
+ \def\chaptermark##1{%
+ \markboth{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \thechapter. \ %
+ \fi
+ \fi
+ ##1}{}}
+ \def\sectionmark##1{\markright{##1}}
+ \def\tocmark{\markboth{\contentsname}{}}
+ \def\lofmark{\markboth{\listfigurename}{}}
+ \def\lotmark{\markboth{\listtablename}{}}
+ \def\bibmark{\markboth{\bibname}{}}
+ \def\indexmark{\markboth{\indexname}{}}
+ \def\glossarymark{\markboth{\glossaryname}{}}
+}
+\renewcommand*{\@ruledmarks}{%
+ \nouppercaseheads
+ \createmark{chapter}{left}{shownumber}{}{. \space}
+ \createmark{section}{right}{shownumber}{}{. \space}
+ \createplainmark{toc}{both}{\contentsname}
+ \createplainmark{lof}{both}{\listfigurename}
+ \createplainmark{lot}{both}{\listtablename}
+ \createplainmark{bib}{both}{\bibname}
+ \createplainmark{index}{both}{\indexname}
+ \createplainmark{glossary}{both}{\glossaryname}}
+\makepsmarks{ruled}{\@ruledmarks}
+\makeevenhead{ruled}{\scshape\leftmark}{}{}
+\makeoddhead{ruled}{}{}{\rightmark}
+
+\makepagestyle{Ruled}
+\makerunningwidth{Ruled}{1.1\textwidth}
+\makeheadposition{Ruled}{flushright}{flushleft}{flushright}{flushleft}
+\makeevenfoot{Ruled}{\thepage}{}{}
+\makeoddfoot{Ruled}{}{}{\thepage}
+\makeheadrule{Ruled}{1.1\textwidth}{\normalrulethickness}
+\makepsmarks{Ruled}{\@ruledmarks}
+\makeevenhead{Ruled}{\scshape\leftmark}{}{}
+\makeoddhead{Ruled}{}{}{\rightmark}
+
+\newlength{\headwidth}
+
+\makepagestyle{companion}
+\setlength{\headwidth}{\textwidth}
+ \addtolength{\headwidth}{\marginparsep}
+ \addtolength{\headwidth}{\marginparwidth}
+\makerunningwidth{companion}{\headwidth}
+\makeheadrule{companion}{\headwidth}{\normalrulethickness}
+\makeheadposition{companion}{flushright}{flushleft}{}{}
+\makepsmarks{companion}{%
+ \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks
+ \def\sectionmark##1{\markright{%
+ \ifnum \c@secnumdepth>\z@
+ \thesection. \ %
+ \fi
+ ##1}}
+ \def\tocmark{\markboth{\contentsname}{\contentsname}}
+ \def\lofmark{\markboth{\listfigurename}{\listfigurename}}
+ \def\lotmark{\markboth{\listtablename}{\listtablename}}
+ \def\bibmark{\markboth{\bibname}{\bibname}}
+ \def\indexmark{\markboth{\indexname}{\indexname}}}
+\makepsmarks{companion}{%
+ \nouppercaseheads
+ \createmark{chapter}{both}{nonumber}{}{}
+ \createmark{section}{right}{shownumber}{}{. \space}
+ \createplainmark{toc}{both}{\contentsname}
+ \createplainmark{lof}{both}{\listfigurename}
+ \createplainmark{lot}{both}{\listtablename}
+ \createplainmark{bib}{both}{\bibname}
+ \createplainmark{index}{both}{\indexname}
+ \createplainmark{glossary}{both}{\glossaryname}}
+\makeevenhead{companion}{\normalfont\bfseries\thepage}{}%
+ {\normalfont\bfseries\leftmark}
+\makeoddhead{companion}{\normalfont\bfseries\rightmark}{}%
+ {\normalfont\bfseries\thepage}
+
+\newif\ifshowheadfootloc
+ \showheadfootloctrue
+\newcommand*{\showheadfootlocon}{\showheadfootloctrue}
+\newcommand*{\showheadfootlocoff}{\showheadfootlocfalse}
+\newif\ifshowtextblockloc
+ \showtextblockloctrue
+\newcommand*{\showtextblocklocon}{\showtextblockloctrue}
+\newcommand*{\showtextblocklocoff}{\showtextblocklocfalse}
+
+\newcommand*{\framepichead}{%
+\ifshowheadfootloc
+ \begin{picture}(0,0)
+ \unitlength 1pt
+ \put(0,0){\line(1,0){\strip@pt\textwidth}}
+ \end{picture}%
+\fi}
+
+\newcommand*{\framepictextfoot}{%
+ \begin{picture}(0,0)
+ \unitlength 1pt
+ \ifshowheadfootloc
+ \put(0,0){\line(1,0){\strip@pt\textwidth}}
+ \fi
+ \ifshowtextblockloc
+ \put(0,\strip@pt\footskip)%
+ {\framebox(\strip@pt\textwidth,\strip@pt\textheight){}}
+ \fi
+ \end{picture}}
+
+\makepagestyle{showlocs}
+\makeevenhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage}
+\makeoddhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage}
+\makeevenfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage}
+\makeoddfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage}
+
+\renewcommand{\pagenumbering}{%
+ \@ifstar{\@smempnum}{\@mempnum}}
+\newcommand{\@smempnum}[1]{%
+ \gdef\thepage{\csname @#1\endcsname \c@page}}
+\newcommand{\@mempnum}[1]{%
+ \@smempnum{#1}\global\c@page \@ne}
+
+\newcounter{storedpagenumber}
+ \setcounter{storedpagenumber}{1}
+\newcommand{\savepagenumber}{\global\c@storedpagenumber \c@page}
+\newcommand{\restorepagenumber}{\global\c@page \c@storedpagenumber}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand*{\setSpacing}[1]{%
+ \def\baselinestretch{#1}%
+ \@currsize}
+
+\newcommand*{\setSingleSpace}[1]{%
+ \def\m@m@singlespace{#1}}
+\setSingleSpace{1}
+
+\newcommand*{\SingleSpacing}{%
+ \setSpacing{\m@m@singlespace}%
+ \vskip\baselineskip% correction for coming into single spacing
+}
+\SingleSpacing
+
+\newcommand*{\OnehalfSpacing}{
+ \setSpacing{1.25}% default (10pt)
+ \ifcase \@ptsize \relax % 10pt
+ \setSpacing{1.25}%
+ \or% 11pt
+ \setSpacing{1.213}%
+ \or% 12pt
+ \setSpacing{1.241}%
+ \or\or% 14pt
+ \setSpacing{1.20}%
+ \or\or\or% 17pt
+ \setSpacing{1.16}%
+ \or\or% 9pt
+ \setSpacing{1.35}%
+ \else% the extended sizes
+ \setSpacing{1.16}%
+ \fi}
+
+\newcommand*{\DoubleSpacing}{
+ \setSpacing{1.667}% default (10pt)
+ \ifcase \@ptsize \relax % 10pt
+ \setSpacing{1.667}%
+ \or% 11pt
+ \setSpacing{1.618}%
+ \or% 12pt
+ \setSpacing{1.655}%
+ \or\or% 14pt
+ \setSpacing{1.60}%
+ \or\or\or% 17pt
+ \setSpacing{1.545}%
+ \or\or% 9pt
+ \setSpacing{1.8}%
+ \else% larger sizes
+ \setSpacing{1.5}%
+ \fi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check what this does!!!!!!!!
+\renewcommand*{\@setsize}[4]{%
+ \@nomath#1%
+ \let\@currsize#1%
+ \baselineskip #2%
+ \baselineskip \baselinestretch\baselineskip
+ \parskip \baselinestretch\parskip
+ \setbox\strutbox \hbox{%
+ \vrule height.7\baselineskip
+ depth .3\baselineskip
+ width \z@}%
+ \skip\footins \baselinestretch\skip\footins
+ \normalbaselineskip\baselineskip#3#4}
+
+\newenvironment{SingleSpace}{%
+ \vskip\baselineskip
+ \setSpacing{\m@m@singlespace}%
+ \vskip -\baselineskip
+}{\par}
+
+\newenvironment{SingleSpace*}{%
+%% \vskip\baselineskip
+ \setSpacing{\m@m@singlespace}%
+ \vskip 0.5\baselineskip
+}{\vskip -0.5\baselineskip}
+
+\newcommand*{\m@mrestore@spacing}{%
+ \par
+ \vskip \parskip
+ \vskip \baselineskip
+ \endgroup
+ \vskip -\parskip
+ \vskip -\baselineskip}
+
+\newenvironment{Spacing}[1]{%
+ \par
+ \begingroup
+ \setSpacing{#1}}{\m@mrestore@spacing}
+
+\newenvironment{OnehalfSpace}{%
+ \begingroup
+ \OnehalfSpacing}{\m@mrestore@spacing}
+
+\newenvironment{DoubleSpace}{%
+ \begingroup
+ \DoubleSpacing}{\m@mrestore@spacing}
+
+\newcommand*{\memdskipstretch}{0.0}
+\newcommand*{\setDisplayskipStretch}[1]{%
+ \renewcommand*{\memdskipstretch}{#1}}
+\newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}}
+
+\newcommand*{\memdskips}{%
+ \advance\abovedisplayskip \memdskipstretch\abovedisplayskip
+ \advance\belowdisplayskip \memdskipstretch\belowdisplayskip
+ \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip
+ \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip}
+\everydisplay\expandafter{%
+ \the\everydisplay
+ \memdskips}
+
+\let\m@m@xfloat\@xfloat
+\def\@xfloat #1[#2]{%
+ \m@m@xfloat #1[#2]%
+ \def\baselinestretch{\m@m@singlespace}%
+ \normalsize}
+
+\newdimen\memPD
+\newenvironment{vminipage}{%
+ \par
+ \@ifnextchar[%]
+ \@ivminipage
+ {\@iiiminipage t\relax[s]}
+}{%
+ \par\global\memPD=\prevdepth
+ \endminipage
+ \par
+ \kern-\memPD% no pagebreak allowed here
+ \hbox{\vrule depth \memPD width \z@}}
+
+ \def\@ivminipage[#1]{%
+ \@ifnextchar[%]
+ {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}}
+\newif\ifm@mnzpskip
+\newcommand*{\traditionalparskip}{%
+ \parskip \z@
+ \m@mnzpskipfalse}
+\newskip\m@mabparskip
+\newcommand*{\abnormalparskip}[1]{%
+ \setlength{\parskip}{#1}\m@mabparskip=#1\relax
+ \m@mnzpskiptrue}
+\newcommand*{\nonzeroparskip}{\abnormalparskip{%
+ 0.5\baselineskip
+ \@plus .1\baselineskip \@minus .1\baselineskip% NTG
+%% 0.5/baselineskip \@plus 2pt% RF
+}}
+\traditionalparskip
+
+\newcommand{\pretitle}[1]{\def\@bspretitle{#1}}
+\newcommand{\posttitle}[1]{\def\@bsposttitle{#1}}
+\newcommand{\preauthor}[1]{\def\@bspreauthor{#1}}
+\newcommand{\postauthor}[1]{\def\@bspostauthor{#1}}
+\newcommand{\predate}[1]{\def\@bspredate{#1}}
+\newcommand{\postdate}[1]{\def\@bspostdate{#1}}
+
+ \pretitle{\begin{center}\LARGE}
+ \posttitle{\par\end{center}\vskip 0.5em}
+ \preauthor{\begin{center}
+ \large \lineskip .5em%
+ \begin{tabular}[t]{c}}
+ \postauthor{\end{tabular}\par\end{center}}
+ \predate{\begin{center}\large}
+ \postdate{\par\end{center}}
+
+\newcommand{\maketitlehooka}{}
+\newcommand{\maketitlehookb}{}
+\newcommand{\maketitlehookc}{}
+\newcommand{\maketitlehookd}{}
+
+\newcommand{\thanksmarkseries}[1]{%
+ \def\@bsmarkseries{\renewcommand{\thefootnote}%
+ {\@nameuse{#1}{footnote}}}}
+\newcommand{\symbolthanksmark}{\thanksmarkseries{\fnsymbol}}
+\newcommand{\@bscontmark}{\setcounter{footnote}{0}}
+\newcommand{\continuousmarks}{\def\@bscontmark{}}
+\newcommand{\thanksheadextra}[2]{%
+ \def\@bsthanksheadpre{#1}%
+ \def\@bsthanksheadpost{#2}}
+\DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]}
+\newcommand{\thanksgap}[1]{\hspace{#1}}
+\newcommand{\tamark}{\@thefnmark}
+
+\newlength{\thanksmarkwidth}
+\newlength{\thanksmarksep}
+\newcommand{\thanksmarkstyle}[1]{\def\thanksscript##1{#1}}
+\thanksmarkstyle{\textsuperscript{#1}}
+\newcommand{\makethanksmarkhook}{}
+
+\newcommand{\thanksfootmark}{%
+ \ifdim\thanksmarkwidth < \z@
+ \llap{\hb@xt@ -\thanksmarkwidth{%
+ \hss\normalfont\thanksscript{\tamark}}%
+ \hspace*{-\thanksmarkwidth}}%
+ \else
+ \ifdim\thanksmarkwidth = \z@
+ {\normalfont\thanksscript{\tamark}}%
+ \else
+ \hb@xt@\thanksmarkwidth{\hss\normalfont\thanksscript{\tamark}}%
+ \fi
+ \fi}
+
+\newcommand{\makethanksmark}{%
+ \leavevmode%
+ \parindent 1em\noindent
+ \if@RTL\rightskip\else\leftskip\fi\thanksmarksep\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi\thanksmarkwidth \null\nobreak\hskip-\if@RTL\rightskip\else\leftskip\fi\relax
+ \makethanksmarkhook\relax
+ \thanksfootmark}
+
+\newcommand{\usethanksrule}{\let\footnoterule\thanksrule}
+\newcommand{\cancelthanksrule}{\let\footnoterule\@bsfootnoterule}
+
+\thanksmarkseries{fnsymbol} % symbols
+\thanksheadextra{}{}
+\setlength{\thanksmarkwidth}{1.8em}
+\setlength{\thanksmarksep}{-\thanksmarkwidth}
+
+\AtBeginDocument{%
+ \let\thanksrule\footnoterule
+ \let\@bsfootnoterule\footnoterule
+}
+
+\newlength{\droptitle}
+\setlength{\droptitle}{0pt}
+
+\newcommand{\maketitle}{\par
+ \begingroup
+ \@bsmarkseries
+ \def\@makefnmark{\@textsuperscript{%
+ \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}%
+ \long\def\@makefntext##1{\makethanksmark ##1}
+ \if@twocolumn
+ \ifnum \col@number=\@ne
+ \@maketitle
+ \else
+ \twocolumn[\@maketitle]%
+ \fi
+ \else
+ \ifdim\pagetotal>\z@
+ \newpage
+ \fi
+ \global\@topnum\z@
+ \@maketitle
+ \fi
+ \thispagestyle{title}\@thanks
+ \endgroup
+ \@bscontmark % \setcounter{footnote}{0}%
+ }
+\aliaspagestyle{title}{plain}
+
+\newcommand*{\@mem@titlefootkill}[1]{%
+ \@memwarn{Do not use \string\footnote\space in
+ \string\maketitle.\MessageBreak
+ Use \protect\thanks\space instead}}
+
+\newcommand{\@maketitle}{%
+ \let\footnote\@mem@titlefootkill
+ \ifdim\pagetotal>\z@
+ \newpage
+ \fi
+ \null
+ \vskip 2em%
+ \vspace*{\droptitle}
+ \maketitlehooka
+ {\@bspretitle \@title \@bsposttitle}
+ \maketitlehookb
+ {\@bspreauthor \@author \@bspostauthor}
+ \maketitlehookc
+ {\@bspredate \@date \@bspostdate}
+ \maketitlehookd
+ \par
+ \vskip 1.5em}
+
+\newenvironment{titlingpage}%
+ {\let\footnoterule\relax
+ \let\footnotesize\small
+ \if@twocolumn
+ \@restonecoltrue\onecolumn
+ \else
+ \@restonecolfalse
+ \fi
+ \thispagestyle{titlingpage}%
+ \setcounter{page}{\@ne}%
+ }{%
+ \thispagestyle{titlingpage}%
+ \if@restonecol \twocolumn \fi
+ \if@twoside \cleardoublepage \else \clearpage \fi
+ \setcounter{page}{\@ne}}
+\aliaspagestyle{titlingpage}{empty}
+
+\newcommand{\emptythanks}{\global\let\@thanks\@empty}
+
+\newcommand*{\andnext}{%
+ \end{tabular}\\ \begin{tabular}[t]{c}}
+
+\newcommand{\@bsmtitlempty}{%
+ \global\let\maketitle\relax
+ \global\let\@maketitle\relax
+ \global\let\title\relax
+ \global\let\author\relax
+ \global\let\date\relax
+ \global\let\thanksmarkseries\relax
+ \global\let\thanksheadextra\relax
+ \global\let\thanksfootextra\relax
+ \global\let\thanksmark\relax
+ \global\let\thanksgap\relax}
+
+\newcommand{\keepthetitle}{%
+ \@bsmtitlempty
+ \global\let\thanks\relax
+ \global\let\and\relax
+ \global\let\andnext\relax
+ \global\let\@thanks\@empty
+ \global\let\@title\@empty
+ \global\let\@author\@empty
+ \global\let\@date\@empty}
+
+\newcommand{\killtitle}{%
+ \keepthetitle
+ \global\let\thetitle\relax
+ \global\let\theauthor\relax
+ \global\let\thedate\relax}
+
+\addtoiargdef{\title}{%
+ \begingroup\let\footnote\@gobble}{%
+ \begingroup
+ \renewcommand{\thanks}[1]{}
+ \renewcommand{\thanksmark}[1]{}
+ \renewcommand{\thanksgap}[1]{}
+ \protected@xdef\thetitle{#1}
+ \endgroup\endgroup}
+\addtoiargdef{\author}{%
+ \begingroup\let\footnote\@gobble}{%
+ \begingroup
+ \renewcommand{\thanks}[1]{}
+ \renewcommand{\and}{\unskip, }
+ \renewcommand{\andnext}{\unskip, }
+ \renewcommand{\thanksmark}[1]{}
+ \renewcommand{\thanksgap}[1]{}
+ \protected@xdef\theauthor{#1}
+ \endgroup\endgroup}
+\addtoiargdef{\date}{%
+ \begingroup\let\footnote\@gobble}{%
+ \begingroup
+ \renewcommand{\thanks}[1]{}
+ \renewcommand{\thanksmark}[1]{}
+ \renewcommand{\thanksgap}[1]{}
+ \protected@xdef\thedate{#1}
+ \endgroup\endgroup}
+
+\newcommand*{\bookpagemark}[1]{}
+\newcommand*{\partmark}[1]{}
+\newcommand*{\chaptermark}[1]{}
+
+\newcommand*{\bibmark}{}
+\newcommand*{\indexmark}{}
+\newcommand*{\glossarymark}{}
+
+\setcounter{secnumdepth}{2}
+\newcounter{book} \setcounter{book}{0}
+\newcounter{part} \setcounter{part}{0}
+\newcounter{chapter} \setcounter{chapter}{0}
+\newcounter{section}[chapter]
+\newcounter{subsection}[section]
+\newcounter{subsubsection}[subsection]
+\newcounter{paragraph}[subsubsection]
+\newcounter{subparagraph}[paragraph]
+\renewcommand*{\thebook}{\@Roman\c@book}
+\renewcommand*{\thepart}{\@Roman\c@part}
+\renewcommand*{\thechapter}{\@arabic\c@chapter}
+\renewcommand*{\thesection}{\thechapter\@SepMark\@arabic\c@section}
+\renewcommand*{\thesubsection}{%
+ \thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand*{\theparagraph}{%
+ \thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph}
+\newcommand{\@chapapp}{\chaptername}
+
+\newcommand{\frontmatter}{%
+ \@ifstar{\@smemfront}{\@memfront}}
+\newcommand{\@smemfront}{%
+ \cleardoublepage
+ \@mainmatterfalse
+ \setcounter{secnumdepth}{-10}
+ \counterwithout{figure}{chapter}
+ \counterwithout{table}{chapter}
+}
+\newcommand{\@memfront}{%
+ \@smemfront\pagenumbering{roman}}
+
+\newcommand{\mainmatter}{%
+ \@ifstar{\@smemmain}{\@memmain}}
+\newcommand*{\@smemmain}{%
+ \@mainmattertrue
+ \setcounter{secnumdepth}{\value{maxsecnumdepth}}
+ \ifartopt
+ \if@twoside
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \else
+ \cleardoublepage
+ \counterwithin{figure}{chapter}
+ \counterwithin{table}{chapter}
+ \fi}
+\newcommand{\@memmain}{%
+ \@smemmain\pagenumbering{arabic}}
+
+\newcommand{\backmatter}{%
+ \ifartopt
+ \clearpage
+ \else
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \fi
+ \@mainmatterfalse
+ \setcounter{secnumdepth}{-10}
+ \ifartopt\else
+ \counterwithout{figure}{chapter}
+ \counterwithout{table}{chapter}
+ \setcounter{figure}{0}
+ \setcounter{table}{0}
+ \fi}
+
+\newcommand*{\theHbook}{\arabic{book}}
+\newcommand*{\toclevel@book}{-2}
+
+\newcommand*{\book}{%
+ \@setupbook
+ \secdef\@book\@sbook}
+\newcommand*{\beforebookskip}{\null\vfil}
+\newcommand*{\midbookskip}{\par\vskip 2\onelineskip}
+\newcommand*{\afterbookskip}{\vfil\newpage}
+
+\newcommand{\@setupbook}{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{book}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \beforebookskip}
+
+\newcommand*{\booknamefont}{\normalfont\huge\bfseries}
+\newcommand*{\booknumfont}{\normalfont\huge\bfseries}
+\newcommand*{\booktitlefont}{\normalfont\Huge\bfseries}
+
+\newcommand*{\printbookname}{\booknamefont \bookname}
+\newcommand*{\booknamenum}{\space}
+\newcommand*{\printbooknum}{\booknumfont \thebook}
+\newcommand*{\printbooktitle}[1]{\booktitlefont #1}
+
+\newcommand{\membookinfo}[3]{}
+\newcommand{\membookstarinfo}[1]{}
+
+\long\def\@book[#1]#2{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \ifnum \c@secnumdepth >-3\relax
+ \refstepcounter{book}%
+ \addcontentsline{toc}{book}%
+ {\protect\booknumberline{\thebook}#1}%
+ \membookinfo{\thebook}{#1}{#2}%
+ \else
+ \addcontentsline{toc}{book}{#1}%
+ \membookinfo{}{#1}{#2}%
+ \fi
+ \bookpagemark{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >-3\relax
+ \printbookname \booknamenum \printbooknum
+ \midbookskip
+ \fi
+ \printbooktitle{#2}\par}%
+ \@endbook}
+
+\long\def\@sbook#1{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \membookstarinfo{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printbooktitle{#1}\par}%
+ \@endbook}
+
+\newif\ifm@mnobooknewpage
+ \m@mnobooknewpagefalse
+\newcommand*{\bookblankpage}{\m@mnobooknewpagefalse}
+\newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue}
+
+\def\@endbook{\afterbookskip
+ \ifm@mnobooknewpage
+ \else
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{afterbook}%
+ \newpage
+ \fi
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+
+\aliaspagestyle{book}{empty}
+\aliaspagestyle{afterbook}{empty}
+
+\newcommand{\part}{%
+ \@setuppart
+ \secdef\@part\@spart}
+\newcommand{\beforepartskip}{\null\vfil}
+\newcommand{\midpartskip}{\par\vskip 2\onelineskip}
+\newcommand{\afterpartskip}{\vfil\newpage}
+
+\newcommand{\@setuppart}{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{part}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \beforepartskip}
+
+\newcommand{\partnamefont}{\normalfont\huge\bfseries}
+\newcommand{\partnumfont}{\normalfont\huge\bfseries}
+\newcommand{\parttitlefont}{\normalfont\Huge\bfseries}
+
+\newcommand{\printpartname}{\partnamefont \partname}
+\newcommand{\partnamenum}{\space}
+\newcommand{\printpartnum}{\partnumfont \thepart}
+\newcommand{\printparttitle}[1]{\parttitlefont #1}
+
+\newcommand{\mempartinfo}[3]{}
+\newcommand{\mempartstarinfo}[1]{}
+
+\long\def\@part[#1]#2{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \ifnum \c@secnumdepth >-2\relax
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}%
+ {\protect\partnumberline{\thepart}#1}%
+ \mempartinfo{\thepart}{#1}{#2}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \mempartinfo{}{#1}{#2}%
+ \fi
+ \partmark{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >-2\relax
+ \printpartname \partnamenum \printpartnum
+ \midpartskip
+ \fi
+ \printparttitle{#2}\par}%
+ \@endpart}
+
+\long\def\@spart#1{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \mempartstarinfo{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{#1}\par}%
+ \@endpart}
+
+\newif\ifm@mnopartnewpage
+ \m@mnopartnewpagefalse
+\newcommand*{\partblankpage}{\m@mnopartnewpagefalse}
+\newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue}
+
+\def\@endpart{\afterpartskip
+ \ifm@mnopartnewpage
+ \else
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{afterpart}%
+ \newpage
+ \fi
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+
+\aliaspagestyle{afterpart}{empty}
+
+\newcommand\chapter{%
+ \ifartopt\par\else
+ \clearforchapter
+ \thispagestyle{chapter}
+ \global\@topnum\z@
+ \fi
+ \@afterindentfalse
+ \@ifstar{\@m@mschapter}{\@m@mchapter}}
+
+\newcommand{\@m@mchapter}[1][]{%
+ \def\ch@pt@c{#1}% capture first optional arg
+ \@ifnextchar[{\@chapter}{\@chapter[]}%
+}
+\def\m@m@empty{\@empty}
+
+\newcommand{\memchapinfo}[4]{}
+\newcommand{\memchapstarinfo}[2]{}
+\newcommand{\memappchapinfo}[4]{}
+\newcommand{\memappchapstarinfo}[2]{}
+
+\newif\ifm@mpn@new@chap
+ \m@mpn@new@chapfalse
+\newif\ifm@mpn@new@schap
+ \m@mpn@new@schapfalse
+
+\def\@chapter[#1]#2{%
+ \m@mpn@new@chaptrue
+ \def\f@rbdy{#2}%
+ \ifx\ch@pt@c\@empty % no optional args
+ \def\f@rtoc{#2}%
+ \def\f@rhdr{#2}%
+ \else % at least one opt arg
+ \let\f@rtoc\ch@pt@c
+ \ifx\@empty#1\@empty
+ \let\f@rhdr\ch@pt@c
+ \else
+ \def\f@rhdr{#1}%
+ \fi
+ \fi
+ \m@m@Andfalse
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \m@m@Andtrue
+ \fi
+ \fi
+ \ifm@m@And
+ \refstepcounter{chapter}%
+ \fi
+ \ifartopt
+ \@makechapterhead{#2}%
+ \@afterheading
+ \chaptermark{\f@rhdr}%
+ \else
+ \chaptermark{\f@rhdr}
+ \insertchapterspace
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{#2}]%
+ \else
+ \@makechapterhead{#2}%
+ \fi
+ \@afterheading
+ \fi
+ \ifm@m@And
+ \ifanappendix
+ \addcontentsline{toc}{appendix}{%
+ \protect\chapternumberline{\thechapter}\f@rtoc}%
+ \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}%
+ \else
+ \addcontentsline{toc}{chapter}{%
+ \protect\chapternumberline{\thechapter}\f@rtoc}%
+ \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{\f@rtoc}%
+ \ifanappendix
+ \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}%
+ \else
+ \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}%
+ \fi
+ \fi
+ \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi}
+
+\def\@makechapterhead#1{%
+ \chapterheadstart% \vspace*{50\p@}%
+ {\parindent \z@ \if@RTL\raggedleft\else\raggedright\fi \normalfont
+ \ifm@m@And
+ \printchaptername \chapternamenum \printchapternum
+ \afterchapternum % \par\nobreak \vskip 20\p@
+ \else
+ \printchapternonum
+ \fi
+ \interlinepenalty\@M
+ \printchaptertitle{#1} % \Huge \bfseries #1
+ \afterchaptertitle % \par\nobreak \vskip 40\p@
+ }}
+
+\newcommand*{\insertchapterspace}{%
+ \addtocontents{lof}{\protect\addvspace{10pt}}%
+ \addtocontents{lot}{\protect\addvspace{10pt}}}
+
+\newlength{\beforechapskip}\setlength{\beforechapskip}{50pt}
+\newlength{\midchapskip}\setlength{\midchapskip}{20pt}
+\newlength{\afterchapskip}\setlength{\afterchapskip}{40pt}
+
+\newcommand{\@chs@def@ult}{%
+ \def\chapterheadstart{\vspace*{\beforechapskip}}%
+ \def\printchaptername{\chapnamefont \@chapapp}%
+ \def\chapternamenum{\space}%
+ \def\printchapternum{\chapnumfont \thechapter}%
+ \def\afterchapternum{\par\nobreak\vskip \midchapskip}%
+ \def\printchapternonum{}%
+ \def\printchaptertitle##1{\chaptitlefont ##1}%
+ \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}%
+ \def\chapnamefont{\normalfont\huge\bfseries}%
+ \def\chapnumfont{\normalfont\huge\bfseries}%
+ \def\chaptitlefont{\normalfont\Huge\bfseries}%
+ \setlength{\beforechapskip}{50pt}%
+ \setlength{\midchapskip}{20pt}%
+ \setlength{\afterchapskip}{40pt}}
+
+\newcommand{\@m@mschapter}[2][\@empty]{%
+ \@schapter{#2}%
+ \ifx \@empty#1
+ \def\f@rhdr{#2}%
+ \else% opt arg
+ \def\f@rhdr{#1}%
+ \setcounter{secnumdepth}{-10}%
+ \chaptermark{#1}%
+ \setcounter{secnumdepth}{\value{maxsecnumdepth}}%
+ \fi
+ \ifanappendix
+ \memappchapstarinfo{\f@rhdr}{#2}%
+ \else
+ \memchapstarinfo{\f@rhdr}{#2}%
+ \fi
+ \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi}
+
+\newcommand{\@schapter}[1]{%
+ \m@mpn@new@schaptrue
+ \def\f@rbdy{#1}%
+ \ifartopt
+ \@makeschapterhead{#1}%
+ \else
+ \if@twocolumn
+ \@topnewpage[\@makeschapterhead{#1}]%
+ \else
+ \@makeschapterhead{#1}%
+ \fi
+ \fi
+ \@afterheading}
+
+\def\@makeschapterhead#1{%
+ \chapterheadstart
+ {\parindent \z@ \if@RTL\raggedleft\else\raggedright\fi \normalfont
+ \printchapternonum
+ \interlinepenalty\@M
+ \printchaptertitle{#1}%
+ \afterchaptertitle}%
+}
+
+\newcommand{\makechapterstyle}[2]{\@namedef{chs@#1}{\@chs@def@ult #2}}
+\newcommand{\chapterstyle}[1]{\@nameuse{chs@#1}}
+
+\makechapterstyle{default}{}%
+%% \setlength{\beforechapskip}{50pt}
+%% \def\chapterheadstart{\vspace*{\beforechapskip}}
+%% \def\chapnamefont{\normalfont\huge\bfseries}
+%% \def\printchaptername{\chapnamefont \@chapapp}
+%% \def\chapternamenum{\space}
+%% \def\chapnumfont{\normalfont\huge\bfseries}
+%% \def\printchapternum{\chapnumfont \thechapter}
+%% \setlength{\midchapskip}{20pt}
+%% \def\afterchapternum{\par\nobreak\vskip \midchapskip}
+%% \def\printchapternonum{}
+%% \def\chaptitlefont{\normalfont\Huge\bfseries}
+%% \def\printchaptertitle##1{\chaptitlefont ##1}
+%% \setlength{\afterchapskip}{40pt}
+%% \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}}
+\chapterstyle{default}
+
+\makechapterstyle{section}{%
+ \chapterstyle{default}
+ \renewcommand{\printchaptername}{}
+ \renewcommand{\chapternamenum}{}
+ \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries}
+ \renewcommand{\printchapternum}{\chapnumfont \thechapter\space}
+ \renewcommand{\afterchapternum}{}}
+
+\makechapterstyle{article}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
+ \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}
+ \setlength{\afterchapskip}{2.3ex \@plus .2ex}
+ \renewcommand{\printchaptername}{}
+ \renewcommand{\chapternamenum}{}
+ \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries}
+ \renewcommand{\chapnumfont}{\chaptitlefont}
+ \renewcommand{\printchapternum}{\chapnumfont \thechapter\quad}
+ \renewcommand{\afterchapternum}{}}
+
+\makechapterstyle{reparticle}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
+ \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}
+ \setlength{\afterchapskip}{2.3ex \@plus .2ex}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}%
+ \renewcommand*{\afterchapternum}{}}
+
+\newcommand*{\reparticle}{%
+ \chapterstyle{reparticle}
+ \setsecheadstyle{\normalfont\large\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+ \setsubsecheadstyle{\normalfont\bfseries\if@RTL\raggedleft\else\raggedright\fi}}
+
+\makechapterstyle{hangnum}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \settowidth{\chapindent}{\chapnumfont 999}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \noindent\llap{\makebox[\chapindent][l]{\chapnumfont \thechapter}}}
+ \renewcommand*{\afterchapternum}{}}
+
+\newlength{\chapindent}
+
+\makechapterstyle{companion}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\scshape}
+ \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp}
+ \renewcommand*{\chapnumfont}{\normalfont\Huge}
+ \setlength{\chapindent}{\marginparsep}
+ \addtolength{\chapindent}{\marginparwidth}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \begin{adjustwidth}{}{-\chapindent}
+ \raggedleft \chaptitlefont ##1\par\nobreak
+ \end{adjustwidth}}}
+
+\makechapterstyle{demo}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}%
+ {\vskip\onelineskip \hrule\vskip \afterchapskip}}
+
+\makechapterstyle{bianchi}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape}
+ \renewcommand*{\chapnumfont}{\normalfont\huge}
+ \renewcommand*{\printchaptername}{%
+ \chapnamefont\centering\@chapapp}
+ \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par}
+ \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip
+ \afterchapskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont \textit{9}}\afterchapternum}}
+
+\makechapterstyle{bringhurst}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapterheadstart}{}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \if@RTL\raggedleft\else\raggedright\fi\Large\scshape\MakeLowercase{##1}}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip\onelineskip}}
+
+\makechapterstyle{brotherton}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}}
+
+\makechapterstyle{chappell}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{0pt}
+ \renewcommand*{\chapnamefont}{\large\centering}
+ \renewcommand*{\chapnumfont}{\large}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\printchaptername \chapnumfont 1}
+ \afterchapternum
+ \vskip \onelineskip \vskip -\topskip}
+ \renewcommand*{\chaptitlefont}{\Large\itshape}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \centering\chaptitlefont ##1}}
+
+\makechapterstyle{culver}{%
+ \chapterstyle{default}
+ \chapterstyle{article}%
+ \renewcommand*{\thechapter}{\Roman{chapter}}
+ \renewcommand*{\printchapternum}{% center number/title
+ \centering\chapnumfont \thechapter\space\space}%
+ \renewcommand*{\printchapternonum}{\centering}
+ \renewcommand*{\clearforchapter}{}% no new page
+ \aliaspagestyle{chapter}{headings}}% no special pagestyle
+
+\makechapterstyle{dash}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{5\onelineskip}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\large}
+ \settoheight{\midchapskip}{\chapnumfont 1}
+ \renewcommand*{\printchapternum}{\centering \chapnumfont
+ \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\
+ \rule[0.5\midchapskip]{1em}{0.4pt}}
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip}
+ \renewcommand*{\printchapternonum}{\centering
+ \vphantom{\chapnumfont 1}\afterchapternum}
+ \renewcommand*{\chaptitlefont}{\normalfont\Large}
+ \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1}
+ \setlength{\afterchapskip}{2.5\onelineskip}}
+
+\makechapterstyle{demo2}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip \afterchapskip}
+ \setlength{\beforechapskip}{3\baselineskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont One}
+ \afterchapternum%
+ \vskip\topskip}
+ \setlength{\beforechapskip}{2\onelineskip}}
+
+\makechapterstyle{demo3}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip \afterchapskip}
+ \setlength{\beforechapskip}{0pt}
+ \setlength{\midchapskip}{2\onelineskip}
+ \setlength{\afterchapskip}{2\onelineskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont One}
+ \afterchapternum%
+ \vskip\topskip}}
+
+\makechapterstyle{ell}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
+ \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}
+ \settowidth{\chapindent}{\chapnumfont 111}
+ \renewcommand*{\chapterheadstart}{\begingroup
+ \vspace*{\beforechapskip}%
+ \begin{adjustwidth}{}{-\chapindent}%
+ \hrulefill
+ \smash{\rule{0.4pt}{15mm}}
+ \end{adjustwidth}\endgroup}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \begin{adjustwidth}{}{-\chapindent}
+ \hfill
+ \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
+ \hspace*{1em}
+ \end{adjustwidth}\vspace*{-3.0\onelineskip}}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \vskip\onelineskip
+ \raggedleft {\chaptitlefont ##1}\par\nobreak}}
+
+\makechapterstyle{ger}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip}
+ \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par}
+ \setlength{\midchapskip}{20pt}
+ \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1
+ \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}}
+
+\makechapterstyle{lyhne}{% needs graphicx package
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{1.5cm}
+ \setlength{\afterchapskip}{1cm}
+ \setlength{\midchapskip}{2cm}
+ \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft}
+ \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}%
+ \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}}
+ \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}}
+ \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum}
+ \renewcommand*{\afterchaptertitle}{\vskip 0.2cm
+ \hrule\vskip\afterchapskip}}
+
+\makechapterstyle{madsen}{% requires graphicx package
+ \chapterstyle{default}
+ \renewcommand*{\chapnamefont}{%
+ \normalfont\Large\scshape\raggedleft}
+ \renewcommand*{\chaptitlefont}{%
+ \normalfont\Huge\bfseries\sffamily\raggedleft}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \makebox[0pt][l]{\hspace{0.4em}
+ \resizebox{!}{4ex}{%
+ \chapnamefont\bfseries\sffamily\thechapter}
+ }%
+ }%
+ \renewcommand*{\afterchapternum}{%
+ \par\hspace{1.5cm}\hrule\vskip\midchapskip}}
+
+\newcommand*{\colorchapnum}{}
+\newcommand*{\colorchaptitle}{}
+\makechapterstyle{pedersen}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{-20pt}
+ \setlength{\afterchapskip}{10pt}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum}
+ \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchaptername}{}
+ \setlength{\midchapskip}{20mm}% was \numberheight
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{%
+ \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}}
+ \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}}
+
+%% Thomas Dye's southall chapter style
+\makechapterstyle{southall}{%
+ \chapterstyle{default}
+ \setlength{\afterchapskip}{5\baselineskip}
+ \setlength{\beforechapskip}{36pt}% \headindent
+ \setlength{\midchapskip}{\textwidth}% \rightblock
+ \addtolength{\midchapskip}{-\beforechapskip}
+ \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
+ \renewcommand*{\chaptitlefont}{\huge\rmfamily\if@RTL\raggedleft\else\raggedright\fi}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchapternum}{%
+ \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
+ {\vspace{0pt}\chapnumfont%%%\figureversion{lining}
+ \thechapter}
+ \end{minipage}}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hfill\begin{minipage}[t]{\midchapskip}
+ {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
+ \renewcommand*{\afterchaptertitle}{%
+ \par\vspace{\baselineskip}%
+ \hrulefill \par\nobreak\noindent \vskip \afterchapskip}}
+
+\makechapterstyle{thatcher}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapterheadstart}{}
+ \renewcommand*{\printchaptername}{%
+ \centerline{\chapnumfont{\@chapapp\ \thechapter}}}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase}
+ \renewcommand*{\printchapternum}{}
+ \renewcommand*{\afterchapternum}{%
+ \par\centerline{\parbox{0.5in}{\hrulefill}}\par}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont \@chapapp 1}\par
+ \parbox{0.5in}{}\par}
+ \renewcommand*{\chaptitlefont}{\normalfont\large}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \centering \chaptitlefont\MakeUppercase{##1}}}
+
+\makechapterstyle{veelo}{%
+ \setlength{\afterchapskip}{40pt}
+ \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE}
+ \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
+ \renewcommand*{\printchaptername}{%
+ \chapnamefont\MakeUppercase{\@chapapp}}
+ \renewcommand*{\chapternamenum}{}
+ \setlength{\beforechapskip}{18mm}% \numberheight
+ \setlength{\midchapskip}{\paperwidth}% \barlength
+ \addtolength{\midchapskip}{-\textwidth}
+ \addtolength{\midchapskip}{-\spinemargin}
+ \renewcommand*{\printchapternum}{%
+ \makebox[0pt][l]{%
+ \hspace{.8em}%
+ \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
+ \hspace{.8em}%
+ \rule{\midchapskip}{\beforechapskip}%
+ }%
+ }%
+ \makeoddfoot{plain}{}{}{\thepage}}
+
+\makechapterstyle{verville}{%
+ % \chapterstyle{default}
+ \setlength{\beforechapskip}{0pt}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\printchapternum}{%
+ \hrule \vskip 0.5\onelineskip
+ \Huge \centering \thechapter.\ }
+ \renewcommand*{\printchapternonum}{%
+ \hrule \vskip 0.5\onelineskip
+ \Huge \centering}
+ \renewcommand*{\afterchapternum}{}
+ \setlength{\midchapskip}{0pt}
+ \renewcommand*{\printchaptertitle}[1]{%
+ ##1 \par
+ \vskip 0.5\onelineskip
+ \hrule}}
+
+\makechapterstyle{crosshead}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}%
+ \setlength{\afterchapskip}{2\onelineskip \@plus .2\onelineskip
+ \@minus 0.2\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\LARGE\bfseries}%
+ \renewcommand*{\chaptitlefont}{\chapnumfont}%
+ \renewcommand*{\printchapternum}{%
+ \centering\chapnumfont \thechapter\quad}%
+ \renewcommand{\afterchapternum}{}%
+ \renewcommand*{\printchapternonum}{\centering}}
+
+\makechapterstyle{dowding}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\chapnamefont}{\normalfont}%
+ \renewcommand*{\chapnumfont}{\chapnamefont}%
+ \renewcommand*{\printchapternum}{\centering\chapnumfont \ifanappendix \thechapter
+ \else \numtoName{\c@chapter}\fi}%
+ \renewcommand*{\chaptitlefont}{\normalfont\itshape\huge\centering}%
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\printchaptername}\vskip\midchapskip}}
+
+\makechapterstyle{komalike}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\LARGE\sffamily\bfseries}%
+ \renewcommand*{\printchapternum}{\chapnumfont \thechapter\space}%
+ \renewcommand*{\afterchapternum}{}%
+ \renewcommand*{\chaptitlefont}{\normalfont\LARGE\sffamily\bfseries}}
+
+\makechapterstyle{ntglike}{%
+ \setlength{\beforechapskip}{50pt \@plus 20pt}%
+ \renewcommand*{\chapnamefont}{\normalfont\Large\bfseries}%
+ \renewcommand*{\chapnumfont}{\normalfont\Large\bfseries}%
+ \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}}
+
+\makechapterstyle{tandh}{%
+ \setlength{\beforechapskip}{1\onelineskip}%
+ \setlength{\afterchapskip}{2\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\printchapternum}{\chapnumfont \thechapter\quad}%
+ \renewcommand*{\afterchapternum}{}%
+ \renewcommand*{\chaptitlefont}{\chapnumfont\if@RTL\raggedleft\else\raggedright\fi}}
+
+\makechapterstyle{wilsondob}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \setlength{\afterchapskip}{4\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\Huge\itshape}%
+ \renewcommand*{\printchapternum}{\raggedleft\chapnumfont \thechapter\quad}%
+ \renewcommand*{\afterchapternum}{}%
+ \renewcommand*{\chaptitlefont}{\chapnumfont}%
+ \renewcommand*{\printchapternonum}{\raggedleft}}
+
+\newif\ifraggedbottomsection
+ \raggedbottomsectionfalse
+\newcommand*{\raggedbottomsection}{\raggedbottomsectiontrue}
+\newcommand*{\normalbottomsection}{\raggedbottomsectionfalse}
+
+\newlength{\bottomsectionskip}
+ \setlength{\bottomsectionskip}{10mm}
+
+\newcommand{\@trplargomm}[1]{%
+ \@ifnextchar[{\@xtrplargomm{#1}}%
+ {\@xxtrplarg{#1}}}
+\long\def\@xtrplargomm#1[#2]{\@dblarg{#1[#2]}}
+\newcommand{\@xxtrplarg}[2]{#1[{#2}][{#2}]{#2}}
+\newcommand{\@trplargoom}[1]{%
+ \@ifnextchar[{\@xtrplargoom{#1}}%
+ {\@xxtrplarg{#1}}}
+\long\def\@xtrplargoom#1[#2]{%
+ \@ifnextchar[{#1[{#2}]}%
+ {#1[{#2}][{#2}]}}
+
+\newcommand{\memsecinfo}[5]{}
+\newcommand{\memsecstarinfo}[2]{}
+
+\renewcommand{\@startsection}[6]{%
+ \ifraggedbottomsection\if@nobreak\else
+ \vskip\z@\@plus\bottomsectionskip
+ \penalty\z@
+ \vskip\z@\@plus -\bottomsectionskip
+ \fi\fi
+ \def\m@msecn@me{#1}%
+ \if@noskipsec \leavevmode \fi
+ \par
+ \@tempskipa #4\relax
+ \@afterindenttrue
+ \ifdim \@tempskipa <\z@
+ \@tempskipa -\@tempskipa \@afterindentfalse
+ \fi
+ \if@nobreak
+ \everypar{}%
+ \else
+ \addpenalty\@secpenalty\addvspace\@tempskipa
+ \fi
+ \@ifstar
+ {\@ssect{#3}{#4}{#5}{#6}}%
+ {\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
+
+\def\M@sect#1#2#3#4#5#6[#7][#8]#9{%
+ \ifheadnameref\M@gettitle{#8}\else\M@gettitle{#7}\fi
+ \ifnum #2>\c@secnumdepth
+ \let\@svsec\@empty
+ \memsecinfo{#1}{}{#7}{#8}{#9}%
+ \else
+ \refstepcounter{#1}%
+ \protected@edef\@svsec{\@seccntformat{#1}\relax}%
+ \memsecinfo{#1}{\@nameuse{the#1}}{#7}{#8}{#9}%
+ \fi
+ \@tempskipa #5\relax
+ \ifdim \@tempskipa>\z@
+ \begingroup
+ #6{%
+ \@hangfrom{\hskip #3\relax\@svsec}%
+ \interlinepenalty \@M #9\@@par}%
+ \endgroup
+ \csname #1mark\endcsname{#8}%
+ \addcontentsline{toc}{#1}{%
+ \ifnum #2>\c@secnumdepth \else
+ \protect\numberline{\csname the#1\endcsname}%
+ \fi
+ #7}%
+ \else
+ \def\@svsechd{%
+ #6{\hskip #3\relax
+ \@svsec #9}%
+ \csname #1mark\endcsname{#8}%
+ \addcontentsline{toc}{#1}{%
+ \ifnum #2>\c@secnumdepth \else
+ \protect\numberline{\csname the#1\endcsname}%
+ \fi
+ #7}}%
+ \fi
+ \@xsect{#5}}
+
+\let\@mem@old@ssect\@ssect
+\def\@ssect#1#2#3#4#5{%
+ \M@gettitle{#5}%
+ \memsecstarinfo{\m@msecn@me}{#5}%
+ \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}}
+
+\newcommand{\section}{%
+ \sechook%
+ \@startsection{section}{1}% level 1
+ {\secindent}% heading indent
+ {\beforesecskip}% skip before the heading
+ {\aftersecskip}% skip after the heading
+ {\normalfont\secheadstyle}} % font
+\newcommand{\sechook}{}
+\newcommand{\setsechook}[1]{\renewcommand{\sechook}{#1}}
+\newlength{\secindent}
+\newcommand{\setsecindent}[1]{\setlength{\secindent}{#1}}
+ \setsecindent{\z@}
+\newskip\beforesecskip
+\newcommand{\setbeforesecskip}[1]{\setlength{\beforesecskip}{#1}}
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}
+\newskip\aftersecskip
+\newcommand{\setaftersecskip}[1]{\setlength{\aftersecskip}{#1}}
+ \setaftersecskip{2.3ex \@plus .2ex}
+\newcommand{\secheadstyle}{}
+\newcommand{\setsecheadstyle}[1]{\renewcommand{\secheadstyle}{#1}}
+ \setsecheadstyle{\Large\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+
+\newcommand{\subsection}{%
+ \subsechook%
+ \@startsection{subsection}{2}% level 2
+ {\subsecindent}% heading indent
+ {\beforesubsecskip}% skip before the heading
+ {\aftersubsecskip}% skip after the heading
+ {\normalfont\subsecheadstyle}} % font
+\newcommand{\subsechook}{}
+\newcommand{\setsubsechook}[1]{\renewcommand{\subsechook}{#1}}
+\newlength{\subsecindent}
+\newcommand{\setsubsecindent}[1]{\setlength{\subsecindent}{#1}}
+ \setsubsecindent{\z@}
+\newskip\beforesubsecskip
+\newcommand{\setbeforesubsecskip}[1]{\setlength{\beforesubsecskip}{#1}}
+ \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}
+\newskip\aftersubsecskip
+\newcommand{\setaftersubsecskip}[1]{\setlength{\aftersubsecskip}{#1}}
+ \setaftersubsecskip{1.5ex \@plus .2ex}
+\newcommand{\subsecheadstyle}{}
+\newcommand{\setsubsecheadstyle}[1]{\renewcommand{\subsecheadstyle}{#1}}
+ \setsubsecheadstyle{\large\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+
+\newcommand{\subsubsection}{%
+ \subsubsechook%
+ \@startsection{subsubsection}{3}% level 3
+ {\subsubsecindent}% heading indent
+ {\beforesubsubsecskip}% skip before the heading
+ {\aftersubsubsecskip}% skip after the heading
+ {\normalfont\subsubsecheadstyle}} % font
+\newcommand{\subsubsechook}{}
+\newcommand{\setsubsubsechook}[1]{\renewcommand{\subsubsechook}{#1}}
+\newlength{\subsubsecindent}
+\newcommand{\setsubsubsecindent}[1]{%
+ \setlength{\subsubsecindent}{#1}}
+ \setsubsubsecindent{\z@}
+\newskip\beforesubsubsecskip
+\newcommand{\setbeforesubsubsecskip}[1]{%
+ \setlength{\beforesubsubsecskip}{#1}}
+ \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}
+\newskip\aftersubsubsecskip
+\newcommand{\setaftersubsubsecskip}[1]{%
+ \setlength{\aftersubsubsecskip}{#1}}
+ \setaftersubsubsecskip{1.5ex \@plus .2ex}
+\newcommand{\subsubsecheadstyle}{}
+\newcommand{\setsubsubsecheadstyle}[1]{%
+ \renewcommand{\subsubsecheadstyle}{#1}}
+ \setsubsubsecheadstyle{\normalsize\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+
+\newcommand{\paragraph}{%
+ \parahook%
+ \@startsection{paragraph}{4}% level 4
+ {\paraindent}% heading indent
+ {\beforeparaskip}% skip before the heading
+ {\afterparaskip}% skip after the heading
+ {\normalfont\paraheadstyle}} % font
+\newcommand{\parahook}{}
+\newcommand{\setparahook}[1]{\renewcommand{\parahook}{#1}}
+\newlength{\paraindent}
+\newcommand{\setparaindent}[1]{\setlength{\paraindent}{#1}}
+ \setparaindent{\z@}
+\newskip\beforeparaskip
+\newcommand{\setbeforeparaskip}[1]{\setlength{\beforeparaskip}{#1}}
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}
+\newskip\afterparaskip
+\newcommand{\setafterparaskip}[1]{\setlength{\afterparaskip}{#1}}
+ \setafterparaskip{-1em}
+\newcommand{\paraheadstyle}{}
+\newcommand{\setparaheadstyle}[1]{\renewcommand{\paraheadstyle}{#1}}
+ \setparaheadstyle{\normalsize\bfseries}
+
+\newcommand{\subparagraph}{%
+ \subparahook%
+ \@startsection{subparagraph}{5}% level 5
+ {\subparaindent}% heading indent
+ {\beforesubparaskip}% skip before the heading
+ {\aftersubparaskip}% skip after the heading
+ {\normalfont\subparaheadstyle}} % font
+\newcommand{\subparahook}{}
+\newcommand{\setsubparahook}[1]{\renewcommand{\subparahook}{#1}}
+\newlength{\subparaindent}
+\newcommand{\setsubparaindent}[1]{%
+ \setlength{\subparaindent}{#1}}
+ \setsubparaindent{\parindent}
+\newskip\beforesubparaskip
+\newcommand{\setbeforesubparaskip}[1]{%
+ \setlength{\beforesubparaskip}{#1}}
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}
+\newskip\aftersubparaskip
+\newcommand{\setaftersubparaskip}[1]{%
+ \setlength{\aftersubparaskip}{#1}}
+ \setaftersubparaskip{-1em}
+\newcommand{\subparaheadstyle}{}
+\newcommand{\setsubparaheadstyle}[1]{%
+ \renewcommand{\subparaheadstyle}{#1}}
+ \setsubparaheadstyle{\normalsize\bfseries}
+
+\newcommand{\sethangfrom}[1]{\renewcommand{\@hangfrom}[1]{#1}}
+\newcommand{\setsecnumformat}[1]{\renewcommand{\@seccntformat}[1]{#1}}
+\newcommand{\hangsecnum}{%
+ \def\@seccntformat##1{\llap{\csname the##1\endcsname\quad}}}
+\newcommand{\defaultsecnum}{%
+ \def\@seccntformat##1{\csname the##1\endcsname\quad}}
+
+\newcommand{\plainbreak}{\@ifstar{\@spbreak}{\@pbreak}}
+\newcommand*{\@pbreak}[1]{\par
+ \penalty -100
+ \vskip #1\onelineskip \@plus 2\onelineskip
+ \penalty -20
+ \vskip \z@ \@plus -2\onelineskip
+ \@afterindentfalse
+ \@afterheading}
+\newcommand*{\@spbreak}[1]{\par
+ \penalty -100
+ \vskip #1\onelineskip \@plus 2\onelineskip
+ \penalty -20
+ \vskip \z@ \@plus -2\onelineskip
+ \@afterindenttrue
+ \@afterheading}
+
+\newcommand{\fancybreak}{\@ifstar{\@sfbreak}{\@fbreak}}
+\newcommand{\@fbreak}[1]{\par
+ \penalty -100
+ \noindent\parbox{\linewidth}{\centering #1}%%\null
+ \par
+%% \penalty -20
+%% \vskip -\onelineskip
+ \@afterindentfalse
+ \@afterheading}
+\newcommand{\@sfbreak}[1]{\par
+ \penalty -100
+ \noindent\parbox{\linewidth}{\centering #1}%%\null
+ \par
+%% \penalty -20
+%% \vskip -\onelineskip
+ \@afterindenttrue
+ \@afterheading}
+
+\newcommand{\plainfancybreak}{\@ifstar{\@spfbreak}{\@pfbreak}}
+\newcommand{\@pfbreak}[3]{\par
+ \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal
+ \ifdim #1>\@tempdimc \@fbreak{#3}\else \@pbreak{#2}\fi}
+\newcommand{\@spfbreak}[3]{\par
+ \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal
+ \ifdim #1>\@tempdimc \@sfbreak{#3}\else \@spbreak{#2}\fi}
+
+\newcommand*{\pen@ltyabovepfbreak}{2}
+\newcommand*{\pen@ltybelowpfbreak}{-4}
+
+\newlength{\pfbreakskip}
+ \setlength{\pfbreakskip}{2\baselineskip}
+\newcommand{\pfbreakdisplay}{*\quad*\quad*}
+
+\def\pfbre@kdispl@y{\vbox to 1\pfbreakskip{\vss
+ \hb@xt@ \columnwidth{\hss \pfbreakdisplay \hss}%
+ \vss}}
+
+\edef\nopfbreakOutput{\the\output}
+\def\pfbreakOutput{%
+ \ifnum\outputpenalty=\pen@ltyabovepfbreak
+ \nopfbreakOutput
+ \pfbre@kdispl@y
+ \nobreak
+ \vskip-\pfbreakskip
+ \else\ifnum\outputpenalty=\pen@ltybelowpfbreak
+ \unvbox 255\relax
+ \nobreak
+ \vskip-\pfbreakskip
+ \pfbre@kdispl@y
+ \break
+ \else
+ \nopfbreakOutput
+ \fi
+ \fi}
+\output={\pfbreakOutput}
+
+\newcommand{\pfbreak}{\@ifstar{\@spfbreakgap}{\@pfbreakgap}}
+\newcommand{\@pfbreakgap}{%
+ \par {%
+ \skip@\lastskip
+ \nobreak
+ \vskip -\ifdim\prevdepth>\maxdepth \maxdepth
+ \else\ifdim\prevdepth>-1000pt\prevdepth
+ \else\ifinner 0pt
+ \else \pagedepth
+ \fi \fi \fi
+ \vskip -\skip@
+ \ifdim\skip@<\pfbreakskip
+ \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip
+ \fi
+ \penalty\pen@ltyabovepfbreak
+ \vskip\skip@
+ \penalty\pen@ltybelowpfbreak
+ }
+ \@afterindentfalse
+ \@afterheading
+}
+\newcommand{\@spfbreakgap}{%
+ \par {%
+ \skip@\lastskip
+ \nobreak
+ \vskip -\ifdim\prevdepth>\maxdepth \maxdepth
+ \else\ifdim\prevdepth>-1000pt\prevdepth
+ \else\ifinner 0pt
+ \else \pagedepth
+ \fi \fi \fi
+ \vskip -\skip@
+ \ifdim\skip@<\pfbreakskip
+ \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip
+ \fi
+ \penalty\pen@ltyabovepfbreak
+ \vskip\skip@
+ \penalty\pen@ltybelowpfbreak
+ }
+ \@afterindenttrue
+ \@afterheading
+}
+
+\newcommand*{\noprelistbreak}{\@nobreaktrue\nopagebreak}
+
+\newcommand{\makeheadstyles}[2]{%
+ \@namedef{hds@#1}{\@hds@def@ult #2}}
+\newcommand*{\headstyles}[1]{\@nameuse{hds@#1}}
+\newcommand*{\@hds@def@ult}{%
+ \renewcommand*{\beforebookskip}{\null\vfil}%
+ \renewcommand*{\midbookskip}{\par\vskip 20pt}%
+ \renewcommand*{\afterbookskip}{\vfil\newpage}%
+ \renewcommand*{\booknamefont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\booknumfont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\booktitlefont}{\normalfont\Huge\bfseries}%
+ \renewcommand*{\printbookname}{\booknamefont \bookname}%
+ \renewcommand*{\booknamenum}{\space}%
+ \renewcommand*{\printbooknum}{\booknumfont \thebook}%
+ \renewcommand*{\printbooktitle}[1]{\booktitlefont{##1}}%
+ \renewcommand*{\beforepartskip}{\null\vfil}%
+ \renewcommand*{\midpartskip}{\par\vskip 20pt}%
+ \renewcommand*{\afterpartskip}{\vfil\newpage}%
+ \renewcommand*{\partnamefont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\partnumfont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\parttitlefont}{\normalfont\Huge\bfseries}%
+ \renewcommand*{\printpartname}{\partnamefont \partname}%
+ \renewcommand*{\partnamenum}{\space}%
+ \renewcommand*{\printpartnum}{\partnumfont \thepart}%
+ \renewcommand*{\printparttitle}[1]{\parttitlefont{##1}}%
+ \@chs@def@ult% default chapterstyle
+ \setsechook{}
+ \setsecindent{\z@}%
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}%
+ \setaftersecskip{2.3ex \@plus .2ex}%
+ \setsecheadstyle{\Large\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setsubsechook{}%
+ \setsubsecindent{\z@}%
+ \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsecskip{1.5ex \@plus .2ex}%
+ \setsubsecheadstyle{\large\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setsubsubsechook{}%
+ \setsubsubsecindent{\z@}%
+ \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsubsecskip{1.5ex \@plus .2ex}%
+ \setsubsubsecheadstyle{\normalsize\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setparahook{}%
+ \setparaindent{\z@}%
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalsize\bfseries}%
+ \setsubparahook{}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalsize\bfseries}}
+
+\makeheadstyles{default}{}
+\headstyles{default}
+
+\newcommand*{\addperiod}[1]{#1.}
+
+\makeheadstyles{memman}{%
+ \renewcommand*{\booknamefont}{\normalfont\huge\sffamily}
+ \renewcommand*{\booknumfont}{\normalfont\huge\sffamily}
+ \renewcommand*{\booktitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\midbookskip}{\par\vskip 2\onelineskip}%
+ \renewcommand*{\partnamefont}{\normalfont\huge\sffamily}
+ \renewcommand*{\partnumfont}{\normalfont\huge\sffamily}
+ \renewcommand*{\parttitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\midpartskip}{\par\vskip 2\onelineskip}%
+ \chapterstyle{demo3}
+ \setbeforesecskip{-1.333\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\scshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{bringhurst}{%
+\chapterstyle{bringhurst}
+ \setbeforesecskip{-1\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\if@RTL\raggedleft\else\raggedright\fi\scshape\MakeLowercase}%
+ \setbeforesubsecskip{-1.0\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{1.0\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\sethangfrom{\noindent ####1}\normalfont\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubsubsecskip{-1em}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\scshape\MakeLowercase}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{crosshead}{%
+ \chapterstyle{crosshead}
+ \setbeforesecskip{-1.25\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.75\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\centering\MakeUppercase}%
+ \setbeforesubsecskip{-1.25\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.75\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\centering\bfseries}%
+ \setbeforesubsubsecskip{-.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\centering\scshape\MakeLowercase}%
+ \setbeforeparaskip{-.667\onelineskip
+ \@plus -02.5\onelineskip \@minus -0.25\onelineskip}%
+ \setafterparaskip{.333\onelineskip \@plus 0.1\onelineskip}%
+ \setparaheadstyle{\normalfont\normalsize\centering\itshape}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\scshape\MakeLowercase}}
+
+\makeheadstyles{dowding}{%
+ \chapterstyle{dowding}
+ \setbeforesecskip{-2\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\centering\MakeUppercase}%
+ \setbeforesubsecskip{-1.2\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\scshape\centering\MakeLowercase}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\centering\itshape}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{komalike}{%
+ \renewcommand*{\partnamefont}{\huge\sffamily\bfseries}%
+ \renewcommand*{\partnumfont}{\huge\sffamily\bfseries}%
+ \renewcommand*{\parttitlefont}{\huge\sffamily\bfseries}%
+ \chapterstyle{komalike}
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}%
+ \setaftersecskip{2.3ex \@plus .2ex}%
+ \setsecheadstyle{\normalfont\Large\sffamily\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsecskip{1.5ex \@plus .2ex}%
+ \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsubsecskip{1.5ex \@plus .2ex}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\sffamily\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\sffamily\bfseries}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\sffamily\bfseries}}
+
+\makeheadstyles{ntglike}{%
+ \renewcommand*{\partnamefont}{\Large\bfseries\MakeUppercase}%
+ \renewcommand*{\partnumfont}{\Large\bfseries}%
+ \renewcommand*{\parttitlefont}{\Large\MakeUppercase}%
+ \chapterstyle{ntglike}
+ \setbeforesecskip{-2\onelineskip
+ \@plus -1\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.5\onelineskip}%
+ \setsecheadstyle{\normalfont\large\bfseries}%
+ \setbeforesubsecskip{-1\onelineskip
+ \@plus -.5\onelineskip \@minus -.25\onelineskip}%
+ \setaftersubsecskip{0.01\onelineskip}%
+ \setsubsecheadstyle{\normalfont\normalsize\bfseries}%
+ \setbeforesubsubsecskip{-1\onelineskip
+ \@plus -.5\onelineskip \@minus -.25\onelineskip}%
+ \setaftersubsubsecskip{0.01\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\slshape}%
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\slshape}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\slshape}}
+
+\makeheadstyles{tandh}{%
+ \chapterstyle{tandh}
+ \setbeforesecskip{-2\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\if@RTL\raggedleft\else\raggedright\fi\MakeUppercase}%
+ \setbeforesubsecskip{-1.2\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\Large\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{wilsondob}{%
+ \chapterstyle{wilsondob}
+ \setbeforesecskip{-1.333\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\if@RTL\raggedleft\else\raggedright\fi\MakeUppercase}%
+ \setbeforesubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\Large\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\if@RTL\raggedleft\else\raggedright\fi\scshape\MakeLowercase}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\newif\ifanappendix
+ \anappendixfalse
+\newcommand{\appendix}{\par
+ \setcounter{chapter}{0}%
+ \setcounter{section}{0}%
+ \gdef\@chapapp{\appendixname}%
+ \gdef\thechapter{\@Alph\c@chapter}%
+ \anappendixtrue}
+
+\newcommand{\appendixpage}{%
+ \@ifstar{\@sapppage}{\@apppage}}
+\newcommand{\memapppageinfo}[1]{}
+\newcommand{\memapppagestarinfo}[1]{}
+
+\def\@apppage{%
+ \@setuppart
+ \addappheadtotoc
+ \partmark{\appendixpagename}%
+ \memapppageinfo{\appendixpagename}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{\appendixpagename}\par}%
+ \@endpart}
+\def\@sapppage{%
+ \@setuppart
+ \partmark{\appendixpagename}%
+ \memapppagestarinfo{\appendixpagename}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{\appendixpagename}\par}%
+ \@endpart}
+
+\def\addappheadtotoc{%
+ \phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}}
+\newcounter{@ppsavesec}
+\newcounter{@ppsaveapp}
+\setcounter{@ppsaveapp}{0}
+\newcommand{\@ppsavesec}{%
+ \setcounter{@ppsavesec}{\value{chapter}}}
+\newcommand{\@pprestoresec}{%
+ \setcounter{chapter}{\value{@ppsavesec}}}
+\newcommand{\@ppsaveapp}{%
+ \setcounter{@ppsaveapp}{\value{chapter}}}
+\newcommand{\restoreapp}{%
+ \setcounter{chapter}{\value{@ppsaveapp}}}
+
+\newcommand{\@resets@pp}{%
+ \par
+ \@ppsavesec
+ \setcounter{section}{0}%
+ \setcounter{chapter}{0}%
+ \renewcommand\@chapapp{\appendixname}%
+ \renewcommand\thechapter{\@Alph\c@chapter}%
+ \restoreapp
+}
+
+\newenvironment{appendices}%
+ {\@resets@pp\anappendixtrue}%
+ {\@ppsaveapp\@pprestoresec\anappendixfalse}
+
+\newcommand{\setthesection}{\thechapter\@SepMark\Alph{section}}
+
+\newcommand{\@resets@ppsub}{
+ \par
+ \setcounter{section}{0}
+ \renewcommand{\thesection}{\setthesection}
+}
+
+\newif\ifnamesubappendix
+ \namesubappendixfalse
+\newcommand*{\namedsubappendices}{\namesubappendixtrue}
+\newcommand*{\unnamedsubappendices}{\namesubappendixfalse}
+
+\newenvironment{subappendices}{%
+ \@resets@ppsub
+ \def\addappheadtotoc{\phantomsection
+ \addcontentsline{toc}{section}{\appendixtocname}}
+ \ifnamesubappendix
+ \def\sectionname{\appendixname}
+ \def\@seccntformat##1{\@ifundefined{##1name}%
+ {}{\csname ##1name\endcsname\ }%
+ \csname the##1\endcsname\quad}
+ \fi
+ }{}
+
+\newcommand{\@formatsecmark@pp}[1]{%
+ \MakeUppercase{\appendixname\space
+ \ifnum \c@secnumdepth >\z@
+ \thesection\quad
+ \fi
+ #1}}
+\newcommand*{\leadpagetoclevel}{chapter}
+\newcommand*{\newleadpage}[3][empty]{%
+ \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}%
+ {\dlfm@mapppage{#1}{#2}{#3}}}}
+\newcommand*{\renewleadpage}[3][empty]{%
+ \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}%
+ {\dlfm@mapppage{#1}{#2}{#3}}}}
+
+\newcommand{\memleadpageinfo}[3]{}
+\newcommand{\memleadpagestarinfo}[3]{}
+
+\newcommand*{\dlfm@msapppage}[3]{%
+ \@setuppart
+ \partmark{#3}%
+ \memleadpagestarinfo{#1}{#2}{#3}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{#3}\par
+ \thispagestyle{#1}}%
+ \dlfm@m@endpart{#1}}
+\newcommand*{\dlfm@mapppage}[3]{%
+ \@setuppart
+ \phantomsection
+ \addcontentsline{toc}{\leadpagetoclevel}{#3}%
+ \partmark{#3}%
+ \memleadpageinfo{#1}{#2}{#3}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{#3}\par
+ \thispagestyle{#1}}%
+ \dlfm@m@endpart{#1}}
+
+\newcommand*{\dlfm@m@endpart}[1]{%
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{#1}%
+ \newpage
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+
+\let\memorigdbs\\
+\let\memorigpar\par
+\let\atcentercr\@centercr
+
+\newcommand*{\flushleftright}{%
+ \let\\\memorigdbs
+ \if@RTL\rightskip\else\leftskip\fi\z@skip
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip\@flushglue
+ \everypar{}}
+
+\newcommand*{\linenottooshort}[1][4em]{%
+ \@tempdima=\hsize
+ \advance\@tempdima -#1
+ \if@RTL\rightskip\else\leftskip\fi\z@skip
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip=\@tempdima \@minus \@tempdima}
+
+\newcommand*{\russianpar}{\ifhmode\unskip
+ \strut\vadjust{}\nobreak
+ \discretionary{}%
+ {\hbox{\hskip2\parindent
+ \vrule depth 273sp width 0sp height \ht\strutbox}}%
+ {\hbox{\hskip\parindent}}%
+ \hskip-2\parindent \@minus 2\parindent
+ \hskip\hsize \@minus \hsize
+ \kern\z@ \parfillskip\z@
+ \memorigpar
+ \ifdim\prevdepth=273sp
+ \nobreak
+ \vskip-2\baselineskip
+ \hbox{\strut}%
+ \fi\fi}
+
+\newcommand*{\lastlineparrule}{%
+ \hrule height 0.5ex depth \@tempdimb\relax}
+\newcommand*{\lastlinerulefill}{%
+ \let\\\@centercr
+ \@tempdimb=-0.5ex \advance\@tempdimb 0.4pt
+ \unskip\nobreak\space
+ \leaders\lastlineparrule\hskip\@flushglue
+ \vadjust{}{\parfillskip\z@\memorigpar}}
+
+\newcommand*{\centerlastline}{%
+ \if@RTL\rightskip\else\leftskip\fi\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi=\z@ plus -1fil
+ \parfillskip=\z@ plus 2fil}
+
+\newcommand*{\leftcenterright}{%;
+ \let\\\break
+ \parindent\z@
+ \if@RTL\rightskip\else\leftskip\fi\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip \z@ \@plus -1fil
+ \everypar={\hskip \z@ \@plus -1fil}}
+
+\newcommand*{\centerfloat}{%
+ \parindent \z@
+ \if@RTL\rightskip\else\leftskip\fi \z@ \@plus 1fil \@minus \textwidth
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip \z@skip}
+
+\newdimen\ragrparindent
+ \setlength{\ragrparindent}{\parindent}
+\newcommand{\raggedyright}[1][2em]{%
+ \let\\\@centercr\@rightskip \z@ \@plus #1\relax \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \if@RTL\rightskip\else\leftskip\fi\z@skip
+ \parindent\ragrparindent}
+
+\newcommand*{\justlastraggedleft}{%
+ \if@RTL\rightskip\else\leftskip\fi\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi-\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip\if@RTL\rightskip\else\leftskip\fi
+ \parindent \z@}
+
+\newcommand*{\raggedrightthenleft}{%
+ \parindent \z@
+ \if@RTL\rightskip\else\leftskip\fi \z@ \@plus 1fill
+ \if@RTL\leftskip\else\rightskip\fi\@flushglue
+ \parfillskip \z@
+ \everypar{\hskip \z@ \@plus -1fill}}
+
+\newcommand{\hangfrom}[1]{%
+ \setbox\@tempboxa\hbox{{#1}}%
+ \hangindent \wd\@tempboxa\noindent\box\@tempboxa}
+
+\newcommand{\hangpara}[2]{\hangindent#1\hangafter#2\noindent}
+\newenvironment{hangparas}[2]{\setlength{\parindent}{\z@}
+ \everypar={\hangpara{#1}{#2}}}{\par}
+
+\newcommand{\leftspringright}[4]{%
+ \@tempdimb=\hsize
+ \par\noindent\hbox to\@tempdimb{%
+ \vtop{\hsize=#1\@tempdimb \flushleft#3\par}\hss
+ \vtop{\hsize=#2\@tempdimb \flushright#4\par}}}
+
+\newcommand*{\sourceatright}[2][2em]{{%
+ \unskip\nobreak\hfil\penalty50
+ \hskip#1\hbox{}\nobreak\hfil{#2}
+ \parfillskip\z@\finalhyphendemerits=0\par}}
+
+\if@twocolumn
+ \setlength{\leftmargini}{2em}
+\else
+ \setlength{\leftmargini}{2.5em}
+\fi
+\leftmargin \leftmargini
+\setlength{\leftmarginii}{2.2em}
+\setlength{\leftmarginiii}{1.87em}
+\setlength{\leftmarginiv}{1.7em}
+\if@twocolumn
+ \setlength{\leftmarginv}{.5em}
+ \setlength{\leftmarginvi}{.5em}
+\else
+ \setlength{\leftmarginv}{1em}
+ \setlength{\leftmarginvi}{1em}
+\fi
+\setlength{\itemindent}{\z@}
+\setlength{\labelsep}{0.5em}
+\setlength{\labelwidth}{\leftmargini}
+ \addtolength{\labelwidth}{-\labelsep}
+\@beginparpenalty -\@lowpenalty
+\@endparpenalty -\@lowpenalty
+\@itempenalty -\@lowpenalty
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newdimen\everylistparindent
+ \everylistparindent \z@
+\renewcommand*{\list}[2]{%
+ \ifnum \@listdepth >5\relax
+ \@toodeep
+ \else
+ \global\advance\@listdepth\@ne
+ \fi
+ \rightmargin\z@
+ \listparindent\everylistparindent
+ \itemindent\z@
+ \csname @list\romannumeral\the\@listdepth\endcsname
+ \def\@itemlabel{#1}%
+ \let\makelabel\@mklab
+ \@nmbrlistfalse
+ #2\relax
+ \@trivlist
+ \parskip\parsep
+ \parindent\listparindent
+ \advance\linewidth -\rightmargin
+ \advance\linewidth -\leftmargin
+ \advance\@totalleftmargin \leftmargin
+ \parshape \@ne \@totalleftmargin \linewidth
+ \ignorespaces}
+
+\newlength{\parsepi}
+\newlength{\topsepi}
+\newlength{\itemsepi}
+\newlength{\parsepii}
+\newlength{\topsepii}
+\newlength{\topsepiii}
+
+\newlength{\itemsepii}
+\newlength{\itemsepiii}
+\newlength{\partopsepii}
+\newlength{\partopsepiii}
+\newcommand*{\setnzplist}{%
+ \partopsep \p@ \@plus\z@ \@minus\p@
+ \topsepi\z@
+ \parsepi\parskip
+ \itemsepi\z@
+ \topsepii\z@
+ \parsepii\parskip
+ \itemsepii\z@
+ \topsepiii\z@
+%% \parsepiii\parskip
+ \itemsepiii\z@}
+
+\newcommand*{\defaultlists}{%
+ \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip
+ \@minus 0.1\onelineskip}%
+ \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip
+ \@minus 0.2\onelineskip
+ \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent \listparindent
+ \itemsepii\parsepii
+ \itemsepiii\topsepiii
+ \partopsepiii \p@ \@plus\z@ \@minus\p@
+ \ifm@mnzpskip
+ \setnzplist
+ \fi}
+\defaultlists
+
+\newcommand*{\firmlists}{%
+ \@ifstar{\m@msfirmlists}{\m@mfirmlists}}
+
+\newcommand*{\m@msfirmlists}{
+ \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}%
+ \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \parsepi
+ \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\listparindent}
+
+\newcommand*{\m@mfirmlists}{
+ \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip
+ \@minus 0.05\onelineskip}%
+ \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \parsepi
+ \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\listparindent}
+
+\newcommand*{\tightlists}{%
+ \@ifstar{\m@mstightlists}{\m@mtightlists}}
+
+\newcommand*{\m@mstightlists}{%
+ \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}%
+ \parsepi = \z@ \@plus \p@ \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \z@ \@plus \p@ \@minus \p@
+ \parsepii = \z@ \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\parindent
+ \ifm@mnzpskip
+ \setnzplist
+ \partopsepiii\partopsep
+ \fi}
+
+\newcommand*{\m@mtightlists}{%
+ \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}%
+ \parsepi = \z@ \@plus \p@ \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \z@ \@plus \p@ \@minus \p@
+ \parsepii = \z@ \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\parindent
+ \ifm@mnzpskip
+ \setnzplist
+ \partopsepiii\partopsep
+ \fi}
+
+\newcommand{\firmlist}{%
+ \setlength{\itemsep}{0.5\itemsep}\setlength{\parskip}{0.5\parskip}}
+\newcommand{\tightlist}{%
+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
+
+\newskip\m@msavetopsep
+\newskip\m@msavepartopsep
+\newcommand*{\savetrivseps}{%
+ \m@msavetopsep\topsep
+ \m@msavepartopsep\partopsep}
+\newcommand*{\restoretrivseps}{%
+ \topsep\m@msavetopsep
+ \partopsep\m@msavepartopsep}
+\savetrivseps
+
+\newcommand*{\zerotrivseps}{%
+ \topsep\z@
+ \partopsep\z@}
+
+\def\@listi{\leftmargin\leftmargini
+ \parsep\parsepi
+ \topsep\topsepi
+ \itemsep\itemsepi}
+\let\@listI\@listi
+\defaultlists
+\@listi
+
+\def\@listii{\leftmargin\leftmarginii
+ \labelwidth\leftmarginii
+ \advance\labelwidth-\labelsep
+ \topsep\topsepii
+ \parsep\parsepii
+ \itemsep\parsepii}
+
+\def\@listiii{\leftmargin\leftmarginiii
+ \labelwidth\leftmarginiii
+ \advance\labelwidth-\labelsep
+ \topsep\topsepiii
+ \parsep\z@
+%%% \itemsep\topsep
+%%% \partopsep \p@ \@plus\z@ \@minus\p@
+ \itemsep\itemsepiii
+ \partopsep\partopsepiii}
+
+\def\@listiv{\leftmargin\leftmarginiv
+ \labelwidth\leftmarginiv
+ \advance\labelwidth-\labelsep}
+
+\def\@listv{\leftmargin\leftmarginv
+ \labelwidth\leftmarginv
+ \advance\labelwidth-\labelsep}
+
+\def\@listvi{\leftmargin\leftmarginvi
+ \labelwidth\leftmarginvi
+ \advance\labelwidth-\labelsep}
+
+\renewcommand{\theenumi}{\@arabic\c@enumi}
+\renewcommand{\theenumii}{\@alph\c@enumii}
+\renewcommand{\theenumiii}{\@roman\c@enumiii}
+\renewcommand{\theenumiv}{\@Alph\c@enumiv}
+\newcommand{\labelenumi}{\theenumi.}
+\newcommand{\labelenumii}{\theenumii)}
+\newcommand{\labelenumiii}{\theenumiii.}
+\newcommand{\labelenumiv}{\theenumiv.}
+\renewcommand{\p@enumii}{\theenumi}
+\renewcommand{\p@enumiii}{\theenumi(\theenumii)}
+\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
+\newtoks\@enLab
+\def\@enQmark{?}
+\def\@enLabel#1#2{%
+ \edef\@enThe{\noexpand#1{\@enumctr}}%
+ \@enLab\expandafter{\the\@enLab\csname the\@enumctr\endcsname}%
+ \@enloop}
+\def\@enSpace{\afterassignment\@enSp@ce\let\@memtempa= }
+\def\@enSp@ce{\@enLab\expandafter{\the\@enLab\space}\@enloop}
+\def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop}
+\def\@enOther#1{\@enLab\expandafter{\the\@enLab#1}\@enloop}
+\def\@enloop{\futurelet\@entemp\@enloop@}
+\def\@enloop@{%
+ \ifx A\@entemp \def\@memtempa{\@enLabel\Alph }\else
+ \ifx a\@entemp \def\@memtempa{\@enLabel\alph }\else
+ \ifx i\@entemp \def\@memtempa{\@enLabel\roman }\else
+ \ifx I\@entemp \def\@memtempa{\@enLabel\Roman }\else
+ \ifx 1\@entemp \def\@memtempa{\@enLabel\arabic}\else
+ \ifx \@sptoken\@entemp \let\@memtempa\@enSpace \else
+ \ifx \bgroup\@entemp \let\@memtempa\@enGroup \else
+ \ifx \@enum@\@entemp \let\@memtempa\@gobble \else
+ \let\@memtempa\@enOther
+ \@enhook
+ \fi\fi\fi\fi\fi\fi\fi\fi
+ \@memtempa}
+%% \providecommand\@enhook{}
+ \newcommand\@enhook{}
+\def\enumerate{%
+ \ifnum \@enumdepth >3 \@toodeep\else
+ \advance\@enumdepth \@ne
+ \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi
+ \@ifnextchar[{\@@enum@}{\@enum@}}
+\def\@@enum@[#1]{%
+ \@enLab{}\let\@enThe\@enQmark
+ \@enloop#1\@enum@
+ \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
+ ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
+ \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}%
+ \expandafter\let\csname the\@enumctr\endcsname\@enThe
+ \csname c@\@enumctr\endcsname7
+ \expandafter\settowidth
+ \csname leftmargin\romannumeral\@enumdepth\endcsname
+ {\the\@enLab\hspace{\labelsep}}%
+ \@enum@}
+\def\@enum@{\list{\csname label\@enumctr\endcsname}%
+ {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}}
+
+\newcommand{\labelitemi}{\textbullet}
+\newcommand{\labelitemii}{\normalfont\bfseries \textendash}
+\newcommand{\labelitemiii}{\textasteriskcentered}
+\newcommand{\labelitemiv}{\textperiodcentered}
+\renewcommand{\itemize}[1][\@empty]{%
+ \ifnum \@itemdepth >\thr@@\@toodeep\else
+ \advance\@itemdepth\@ne
+ \ifx \@empty #1\else % optional argument
+ \@namedef{labelitem\romannumeral\the\@itemdepth}{#1}%
+ \fi
+ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
+ \expandafter
+ \list
+ \csname\@itemitem\endcsname
+ {\def\makelabel##1{\hss\llap{##1}}}%
+ \fi}
+\let\enditemize =\endlist
+
+\newenvironment{description}%
+ {\list{}{\labelwidth\z@ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}}%
+ {\endlist}
+\newcommand*{\descriptionlabel}[1]{\hspace\labelsep
+ \normalfont\bfseries #1}
+\newenvironment{blockdescription}%
+ {\list{}{\labelwidth\z@ \itemindent 0.5em \labelsep 0.5em
+ \let\makelabel\blockdescriptionlabel}}%
+ {\endlist}
+\newcommand*{\blockdescriptionlabel}[1]{%%% \hspace\labelsep
+ \normalfont\bfseries #1}
+\newenvironment{quotation}%
+ {\list{}{\listparindent 1.5em%
+ \itemindent \listparindent
+ \rightmargin \leftmargin
+ \parsep \z@ \@plus\p@}%
+ \item[]}%
+ {\endlist}
+\newenvironment{quote}%
+ {\list{}{\rightmargin\leftmargin}%
+ \item[]}%
+ {\endlist}
+\newcommand{\symbollabel}[1]{{#1 \hfill}}
+\newenvironment{symbols}{\list{}%
+ {\itemindent 0em \leftmargin 8em
+ \labelsep 1em \labelwidth 5em
+ \let\makelabel\symbollabel}}%
+ {\endlist}
+\newcommand{\symboldef}[2]{\item[#1] #2}
+\newif\if@bsonecol
+ \@bsonecoltrue
+\newif\ifadd@bstotoc
+ \add@bstotocfalse
+\newif\ifnumber@bs
+ \number@bsfalse
+\newif\if@bsrunin
+ \@bsruninfalse
+
+\newcommand{\abstractcol}{\@bsonecolfalse}
+\newcommand{\abstractintoc}{\add@bstotoctrue}
+\newcommand{\abstractnum}{\number@bstrue\@bsruninfalse}
+\newcommand{\abstractrunin}{\@bsrunintrue\number@bsfalse}
+
+\newcommand{\abstractnamefont}{\normalfont\small\bfseries}
+\newcommand{\abstracttextfont}{\normalfont\small}
+\newcommand{\abscolnamefont}{\normalfont\Large\bfseries}
+\newcommand{\abscoltextfont}{\normalfont}
+
+\newcommand{\absnamepos}{center}
+\newlength{\abstitleskip} \setlength{\abstitleskip}{-0.5em}
+\newlength{\absleftindent}
+ \absleftindent=\leftmargin
+\newdimen\abs@leftindent
+ \abs@leftindent=\leftmargin
+\newlength{\absrightindent}
+ \absrightindent=\leftmargin
+\newlength{\absparindent}
+\newlength{\absparsep}
+
+\newcommand{\abslabeldelim}[1]{\def\@bslabeldelim{#1}}
+\abslabeldelim{}
+\newcommand{\@bsrunintitle}{%
+ \hspace*{\abstitleskip}{\abstractnamefont\abstractname\@bslabeldelim}}
+
+\newcommand{\setup@bstract}{%
+ \abs@leftindent=\absleftindent
+ \if@twocolumn
+ \if@bsonecol
+ \else
+ \abs@leftindent=\z@
+ \absrightindent=\z@
+ \renewcommand*{\abstractnamefont}{\abscolnamefont}
+ \renewcommand*{\abstracttextfont}{\abscoltextfont}
+ \renewcommand*{\absnamepos}{flushleft}
+ \setlength{\abstitleskip}{-2ex}
+ \fi
+ \fi}
+
+\AtBeginDocument{\setlength{\absparindent}{\parindent}
+ \setlength{\absparsep}{\parskip}}
+
+\newenvironment{@bstr@ctlist}{%
+ \list{}{%
+ %%\topsep \z@
+ \partopsep \z@
+ \listparindent \absparindent
+ \itemindent \listparindent
+ \leftmargin \abs@leftindent
+ \rightmargin \absrightindent
+ \parsep \absparsep}%
+ \item\relax}
+ {\endlist}
+
+\newcommand{\put@bsintoc}{%
+ \ifadd@bstotoc
+ \ifnumber@bs\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\abstractname}
+ \fi
+ \fi}
+
+\newcommand{\num@bs}{\chapter{\abstractname}}
+
+\newenvironment{abstract}{%
+ \setup@bstract
+ \if@bsrunin\else
+ \ifnumber@bs \num@bs \else
+ \begin{\absnamepos}\abstractnamefont\abstractname\end\absnamepos%
+ \vspace{\abstitleskip}%
+ \fi
+ \fi
+ \put@bsintoc%
+ \begin{@bstr@ctlist}\if@bsrunin\@bsrunintitle\fi\abstracttextfont}%
+ {\par\end{@bstr@ctlist}}
+
+\newenvironment{onecolabstract}{%
+ \begin{@twocolumnfalse}\begin{abstract}}{%
+ \end{abstract}\end{@twocolumnfalse}}
+
+\addtoiargdef{\thanks}{}{%
+ \protected@xdef\@bs@thanks{\@bs@thanks
+ \protect\footnotetext[\the\c@footnote]{#1}}%
+}
+\let\@bs@thanks\@empty
+
+\newcommand{\saythanks}{\begingroup
+ \renewcommand{\thefootnote}{\fnsymbol{footnote}}\@bs@thanks
+ \endgroup\global\let\@bs@thanks\@empty}
+
+\newcounter{vslineno}
+\newcounter{poemline}
+\newcounter{modulo@vs}
+\newcounter{memfvsline}
+
+%%%\newcommand{\poemlines}[1]{\linenumberfrequency{#1}%
+%%% \@memwarn{Use \string\linenumberfrequency\space
+%%% instead of \string\poemlines}}
+
+\newcommand{\linenumberfont}[1]{\def\vlvnumfont{#1}}
+%%% \linenumberfont{\small\rmfamily}
+
+\newif\ifbvcountlines% TRUE to print line numbers of (boxed) verbatim lines
+ \bvcountlinesfalse
+
+\newcommand{\linenumberfrequency}[1]{%
+ \ifnum #1< \@ne
+ \def\linemodnum{0\relax}
+ \bvcountlinesfalse
+ \else
+ \def\linemodnum{#1\relax}
+ \bvcountlinestrue
+ \fi}
+
+%%%%\linenumberfrequency{0}
+
+\newcommand*{\setverselinenums}[2]{%
+ \c@poemline #1\relax \advance\c@poemline \m@ne
+ \refstepcounter{poemline}%
+ \ifnum\z@<\linemodnum% we are printing line numbers
+ \@tempcnta #2\relax
+ \divide\@tempcnta\linemodnum
+ \multiply\@tempcnta\linemodnum
+ \c@memfvsline #2\relax
+ \advance\c@memfvsline-\@tempcnta
+ \fi}
+
+\newcommand{\getthelinenumber}[2]{%
+ \ifnum\@ne>\linemodnum% no line numbers
+ \else
+ \ifnum\@ne=\linemodnum% every line numbered
+ \@nameuse{the#1}%
+ \else
+ \@tempcnta=\@nameuse{c@#1}%
+ \advance\@tempcnta -\@nameuse{c@#2}%
+ \divide\@tempcnta \linemodnum
+ \multiply\@tempcnta \linemodnum
+ \advance\@tempcnta \@nameuse{c@#2}%
+ \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi
+ \fi
+ \fi}
+
+\newif\ifaltindent
+ \altindentfalse
+\newif\ifpattern
+ \patternfalse
+\newif\ifstarpattern
+ \starpatternfalse
+
+\newlength{\vleftskip}
+ \setlength{\vleftskip}{3em}
+\newlength{\vrightskip}
+ \setlength{\vrightskip}{1em}
+
+\newlength{\stanzaskip}
+ \setlength{\stanzaskip}{\onelineskip}
+
+\newcommand{\flagverse}[1]{%
+ \hskip-\if@RTL\vrightskip\else\vleftskip\fi\llap{#1}\hskip\if@RTL\vrightskip\else\vleftskip\fi\ignorespaces}
+
+\newlength{\versewidth}
+\newlength{\vgap} \setlength{\vgap}{1.5em}
+\newcommand{\vin}{\hspace*{\vgap}}
+\newlength{\vindent} \setlength{\vindent}{2\vgap}
+\newcommand{\vinphantom}[1]{\leavevmode\phantom{#1}}
+\newcommand*{\vleftofline}[1]{\leavevmode\llap{#1}}
+\newdimen\vleftmargin
+ \vleftmargin=\leftmargini
+
+\newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces}
+
+\newcommand{\incr@vsline}{%
+ \refstepcounter{poemline}%
+ \stepcounter{vslineno}}
+
+\newcommand{\@vsifbang}[1]{\@ifnextchar !{\@firstoftwo{#1}}}
+\newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}}
+
+\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}}
+\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}}
+\verselinenumbersright
+
+\newcommand*{\@vslnumright}{%
+ \hfill\rlap{\kern\if@RTL\vleftskip\else\vrightskip\fi\kern\rightmargin%
+ \vlvnumfont\getthelinenumber{poemline}{memfvsline}}}
+\newcommand*{\@vslnumleft}{%
+ \hfill\rlap{\kern-\textwidth\kern-\if@RTL\vleftskip\else\vrightskip\fi%
+ \vlvnumfont\getthelinenumber{poemline}{memfvsline}}}
+\newcommand{\@vscentercr}{%
+ \ifhmode \unskip\else \@nolnerr\fi
+ \@vstypelinenum%
+ \@vsifgt{\verselinebreak}{%
+ \incr@vsline
+ \par\@ifstar{\nobreak\@vsxcentercr}{%
+ \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}}
+\newcommand{\@vsxcentercr}{\addvspace{-\parskip}%
+ \@ifnextchar[ {\@vsicentercr}{\start@vsline}}
+\def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline}
+\newcommand{\start@vsline}{%
+ \ifaltindent\ifodd\c@vslineno\else\vin\fi\fi%
+ \ifpattern\get@vsindent\fi%
+ \ifstarpattern\getstar@vsindent\fi}
+
+\newcounter{verse}
+\setcounter{verse}{0}
+\newcommand{\theHpoemline}{\theverse.\thepoemline}
+
+\newenvironment{verse}[1][\linewidth]{%
+ \refstepcounter{verse}%
+ \setcounter{poemline}{0}\refstepcounter{poemline}%
+ \setcounter{vslineno}{1}%
+ \let\\=\@vscentercr
+ \list{}{\itemsep \z@
+ \itemindent -\vindent
+ \listparindent\itemindent
+ \leftmargin \vleftmargin
+ \parsep \stanzaskip
+ \ifdim #1<\linewidth% %% short line
+ \rightmargin \z@
+ \leftmargin \linewidth
+ \advance\leftmargin -#1\relax
+ \advance\leftmargin -0.5\leftmargin
+ \advance\leftmargin \vindent
+ \else
+ \ifdim #1>\linewidth% %% long line
+ \rightmargin \z@
+ \leftmargin \vindent
+ \else% %% default
+ \rightmargin \leftmargin
+ \advance\leftmargin \vindent
+ \fi
+ \fi}
+ \item[]}{\endlist}
+
+\newenvironment{altverse}%
+ {\starpatternfalse\patternfalse\altindenttrue
+ \setcounter{vslineno}{1}}%
+ {\altindentfalse}
+
+\newif\ifbounderror
+ \bounderrorfalse
+\newif\ifinteger
+
+\newcounter{chrsinstr} % CHARactersINSTRing
+
+\newcommand{\newarray}[3]{%
+ \@nameedef{#1-low}{#2}%
+ \@nameedef{#1-high}{#3}%
+ \ifnum #3<#2
+ \@memerror{Limits for array #1 are in reverse order}{\@ehc}%
+ \fi}
+
+\newcommand{\stringtoarray}[2]{%
+ \def\@vsarrayname{#1}%
+ \protected@edef\the@vsstring{#2}%
+ \newarray{\@vsarrayname}{1}{1}%
+ \@ifmtarg{#2}{%
+ \c@chrsinstr \z@
+ \@namedef{\@vsarrayname-1}{}
+ }{%
+ \c@chrsinstr \@ne
+ \expandafter\@vsstringtoarray \the@vsstring\@vsend
+ }}
+
+\def\@vsstringtoarray #1#2\@vsend{%
+ \@namedef{\@vsarrayname-\the\c@chrsinstr}{#1}
+ \@nameedef{\@vsarrayname-high}{\the\c@chrsinstr}
+ \@ifmtarg{#2}{%
+ \def\@vsinext{}%
+ }{%
+ \advance\c@chrsinstr \@ne
+ \def\@vsinext{%
+ \@vsstringtoarray #2\@vsend%
+ }%
+ }
+ \@vsinext}
+
+\newcommand{\setarrayelement}[3]{%
+ \checkarrayindex{#1}{#2}%
+ \@nameedef{#1-#2}{#3}}
+\newcommand{\getarrayelement}[3]{%
+ \checkarrayindex{#1}{#2}%
+ \protected@edef#3{\@nameuse{#1-#2}}}
+
+\newcommand{\checkarrayindex}[2]{%
+ \bounderrorfalse
+ \expandafter\ifx\csname #1-low\endcsname\relax%
+ \ifpattern\else
+ \@memerror{No array called #1}{\@ehc}%
+ \fi
+ \bounderrortrue
+ \fi
+ \ifnum #2<\@nameuse{#1-low}\relax%
+ \ifpattern\else
+ \@memerror{Index #2 outside limits for array #1}{\@ehc}%
+ \fi
+ \bounderrortrue
+ \fi
+ \ifnum #2>\@nameuse{#1-high}\relax%
+ \ifpattern\else
+ \@memerror{Index #2 outside limits for array #1}{\@ehc}%
+ \fi
+ \bounderrortrue
+ \fi}
+
+\newcommand{\arraytostring}[2]{%
+ \def#2{}%
+ \c@chrsinstr = \@nameuse{#1-low}%
+ \@vsarraytostring{#1}{#2}}
+
+\newcommand{\@vsarraytostring}[2]{%
+ \ifnum\c@chrsinstr>\@nameuse{#1-high}\else
+ \protected@edef#2{#2\@nameuse{#1-\thechrsinstr}}%
+ \advance\c@chrsinstr\@ne%
+ \@vsarraytostring{#1}{#2}%
+ \fi}
+
+\newcommand{\checkifinteger}[1]{%
+ \protected@edef\@vsa{#1}%
+ \ifcat _\ifnum9<1\gobm{#1} _\else A\fi
+ \integertrue%
+ \else
+ \integerfalse%
+ \fi}
+\newcommand{\gobm}[1]{#1}
+
+\newcommand{\indentpattern}[1]{%
+ \stringtoarray{Array@vs}{#1}}
+\newcommand{\get@vsindent}{%
+ \getarrayelement{Array@vs}{\number\value{vslineno}}{\@vspat}%
+ \ifbounderror
+ \arraytostring{Array@vs}{\@vsp@t}%
+ \@memwarn{%
+ Index `\thevslineno' for pattern `\@vsp@t' is out of bounds}%
+ \def\@vspat{0}%
+ \else
+ \checkifinteger{\@vspat}%
+ \ifinteger\else
+ \arraytostring{Array@vs}{\@vsp@t}%
+ \@memwarn{%
+ `\@vspat' at index `\thevslineno' in pattern `\@vsp@t'
+ is not a digit}%
+ \def\@vspat{0}%
+ \fi
+ \fi
+ \ifcase\@vspat\else\hspace*{\@vspat\vgap}\fi}
+\newcommand{\getstar@vsindent}{%
+ \expandafter\ifx\csname Array@vs-high\endcsname\relax
+ \@memerror{A pattern has not been specified}{\@ehc}
+ \else
+ \ifnum\c@vslineno>\@nameuse{Array@vs-high}%
+ \setcounter{vslineno}{1}%
+ \fi
+ \get@vsindent
+ \fi}
+
+\newenvironment{patverse}%
+ {\starpatternfalse\patterntrue\altindentfalse
+ \setcounter{vslineno}{1}}%
+ {\patternfalse}
+
+\newenvironment{patverse*}%
+ {\starpatterntrue\patternfalse\altindentfalse
+ \setcounter{vslineno}{1}}%
+ {\starpatternfalse}
+
+\newcommand{\poemtitle}{\par%
+ \secdef\@vsptitle\@vssptitle}
+\newcommand{\poemtoc}{section}
+
+\newcommand{\mempoeminfo}[1]{}
+\newcommand{\mempoemstarinfo}[1]{}
+
+\long\def\@vsptitle[#1]#2{%
+ \phantomsection
+ \addcontentsline{toc}{\poemtoc}{#1}%
+ \M@gettitle{#1}%
+ \mempoeminfo{#1}%
+ \poemtitlemark{#1}%
+ \@vstypeptitle{#2}%
+ \@afterheading}
+
+\long\def\@vssptitle#1{%
+ \M@gettitle{#1}%
+ \mempoemstarinfo{#1}%
+ \@vstypeptitle{#1}%
+ \@afterheading}
+
+\newcommand{\@vstypeptitle}[1]{%
+ \vspace{\beforepoemtitleskip}%
+ {\poemtitlefont #1\par}%
+ \vspace{\afterpoemtitleskip}%
+}
+
+\newcommand{\poemtitlefont}{\normalfont\large\bfseries\centering}
+\newcommand{\poemtitlemark}[1]{}
+
+\newlength{\beforepoemtitleskip}
+ \setlength{\beforepoemtitleskip}{3.5ex \@plus 1ex \@minus .2ex}
+\newlength{\afterpoemtitleskip}
+ \setlength{\afterpoemtitleskip}{2.3ex \@plus.2ex}
+
+\newif\if@numptitle
+\newcommand*{\NumberPoemTitle}{\@numptitletrue}
+\newcommand*{\PlainPoemTitle}{\@numptitlefalse}
+\NumberPoemTitle
+
+\newcounter{poem}\setcounter{poem}{0}
+ \renewcommand*{\thepoem}{\@arabic\c@poem}
+\newcommand*{\theHpoem}{\arabic{poem}}
+
+\newcommand*{\poemtitlestarmark}[1]{}
+\newcommand*{\poemtitlepstyle}{}
+\newcommand*{\poemtitlestarpstyle}{}
+
+\newcommand\PoemTitle{%
+ \par
+ \@afterindentfalse
+ \@ifstar{\@m@msPoemTitle}{\@m@mPoemTitle}}
+
+\newcommand{\@m@mPoemTitle}[1][]{%
+ \def\poemt@c{#1}% capture first optional arg
+ \@ifnextchar[{\@PoemTitle}{\@PoemTitle[]}%
+}
+
+\newcommand{\memPoemTitleinfo}[4]{}
+\newcommand{\memPoemTitlestarinfo}[2]{}
+
+\def\@PoemTitle[#1]#2{%
+ \phantomsection
+ \ifx\poemt@c\@empty % no optional args
+ \def\poemf@rtoc{#2}%
+ \def\poemf@rhdr{#2}%
+ \else % at least one opt arg
+ \let\poemf@rtoc\poemt@c
+ \ifx\@empty#1\@empty
+ \let\poemf@rhdr\poemt@c
+ \else
+ \def\poemf@rhdr{#1}%
+ \fi
+ \fi
+ \m@m@Andfalse
+ \if@numptitle
+ \if@mainmatter
+ \m@m@Andtrue
+ \fi
+ \fi
+ \ifm@m@And
+ \refstepcounter{poem}%
+ \fi
+ \@makePoemTitlehead{#2}%
+ \@afterheading
+ \poemtitlemark{\poemf@rhdr}%
+ \poemtitlepstyle
+ \ifm@m@And
+ \addcontentsline{toc}{\poemtoc}{%
+ \protect\numberline{\thepoem}\poemf@rtoc}%
+ \memPoemTitleinfo{\thepoem}{\poemf@rtoc}{\poemf@rhdr}{#2}%
+ \else
+ \addcontentsline{toc}{\poemtoc}{\poemf@rtoc}%
+ \memPoemTitleinfo{}{\poemf@rtoc}{\poemf@rhdr}{#2}%
+ \fi
+ \ifheadnameref\M@gettitle{\poemf@rhdr}\else\M@gettitle{\poemf@rtoc}\fi}
+
+\def\@makePoemTitlehead#1{{%
+ \PoemTitleheadstart
+ \parindent \z@ \normalfont
+ \ifm@m@And
+ \printPoemTitlenum
+ \afterPoemTitlenum
+ \else
+ \printPoemTitlenonum
+ \fi
+ \interlinepenalty\@M
+ \printPoemTitletitle{#1}%
+ \afterPoemTitle}}
+
+\newcommand{\@PTchs@def@ult}{%
+ \def\PoemTitleheadstart{\vspace{\beforePoemTitleskip}}
+ \def\printPoemTitlenum{\PoemTitlenumfont \thepoem}
+ \def\afterPoemTitlenum{\par\nobreak\vskip \midPoemTitleskip}
+ \def\printPoemTitlenonum{}
+ \def\printPoemTitletitle##1{\PoemTitlefont ##1}
+ \def\afterPoemTitle{\par\nobreak\vskip \afterPoemTitleskip}}
+\@PTchs@def@ult
+
+\newcommand*{\PoemTitlenumfont}{\normalfont\large\centering}
+\newcommand*{\PoemTitlefont}{\normalfont\large\centering}
+\newlength{\beforePoemTitleskip}
+ \setlength{\beforePoemTitleskip}{1\onelineskip}
+\newlength{\midPoemTitleskip}
+ \setlength{\midPoemTitleskip}{0pt}
+\newlength{\afterPoemTitleskip}
+ \setlength{\afterPoemTitleskip}{1\onelineskip}
+
+\newcommand{\@m@msPoemTitle}[2][\@empty]{%
+ \@sPoemTitle{#2}%
+ \ifx \@empty#1
+ \def\poemf@rhdr{#2}%
+ \else % opt arg
+ \def\poemf@rhdr{#1}%
+ \fi
+ \poemtitlestarmark{\poemf@rhdr}%
+ \poemtitlestarpstyle
+ \memPoemTitlestarinfo{\poemf@rhdr}{#2}}
+
+\newcommand{\@sPoemTitle}[1]{%
+ \@makesPoemTitlehead{#1}%
+ \@afterheading
+ \M@gettitle{#1}}
+
+\def\@makesPoemTitlehead#1{{%
+ \PoemTitleheadstart
+ \parindent \z@ \normalfont
+ \printPoemTitlenonum
+ \interlinepenalty\@M
+ \printPoemTitletitle{#1}
+ \afterPoemTitle}}
+
+\setlength\arraycolsep{5\p@}
+\setlength\tabcolsep{6\p@}
+\setlength\arrayrulewidth{.4\p@}
+\setlength\doublerulesep{2\p@}
+\setlength\tabbingsep{\labelsep}
+
+\newcommand{\@minipagerestore}{%
+ \let\@verbfootnotetext\@verbmpfootnotetext
+ \m@mdoextrafeetmini
+ \ifm@mnzpskip \parskip=\m@mabparskip\fi}
+
+\skip\@mpfootins = \skip\footins
+
+\setlength\fboxsep{3\p@}
+\setlength\fboxrule{.4\p@}
+
+\@addtoreset{equation}{chapter}
+\renewcommand{\theequation}{%
+ \ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+
+
+%%%%%%%%%% Array package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% Frank Mittelbach & David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}}
+\def\@testpach{\@chclass
+ \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
+ \ifnum \@lastchclass=7 5 \else
+ \ifnum \@lastchclass=8 \tw@ \else
+ \ifnum \@lastchclass=9 \thr@@
+ \else \z@
+ \ifnum \@lastchclass = 10 \else
+ \edef\@nextchar{\expandafter\string\@nextchar}%
+ \@chnum
+ \if \@nextchar c\z@ \else
+ \if \@nextchar l\@ne \else
+ \if \@nextchar r\tw@ \else
+ \z@ \@chclass
+ \if\@nextchar |\@ne \else
+ \if \@nextchar !6 \else
+ \if \@nextchar @7 \else
+ \if \@nextchar <8 \else
+ \if \@nextchar >9 \else
+ 10
+ \@chnum
+ \if \@nextchar m\thr@@\else
+ \if \@nextchar p4 \else
+ \if \@nextchar b5 \else
+ \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
+ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
+\def\prepnext@tok{\advance \count@ \@ne
+ \toks\count@{}}
+
+\def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter
+ {\expandafter\@nextchar\the\toks\count@}}
+
+\def\insert@column{%
+ \the@toks \the \@tempcnta
+ \ignorespaces \@sharp \unskip
+ \the@toks \the \count@ \relax}
+\let\m@mold@addamp\@addamp
+\newcommand*{\m@m@addamp}{%
+ \if@firstamp
+ \@firstampfalse
+ \global\@curtab\@ne
+ \else
+ \@addtopreamble{&}
+ \global\advance\@curtab\@ne
+ \fi}
+\let\@addamp\m@m@addamp
+
+\newdimen\col@sep
+\def\@acol{\@addtopreamble{\hskip\col@sep}}
+\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
+ \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
+ \@temptokena{#1}\@tempswatrue
+ \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
+ \count@\m@ne
+ \let\the@toks\relax
+ \prepnext@tok
+ \expandafter \@tfor \expandafter \@nextchar
+ \expandafter :\expandafter =\the\@temptokena \do
+ {\@testpach
+ \ifcase \@chclass \@classz \or \@classi \or \@classii
+ \or \save@decl \or \or \@classv \or \@classvi
+ \or \@classvii \or \@classviii
+ \or \@classx
+ \or \@classx \fi
+ \@lastchclass\@chclass}%
+ \ifcase\@lastchclass
+ \@acol \or
+ \or
+ \@acol \or
+ \@preamerr \thr@@ \or
+ \@preamerr \tw@ \@addtopreamble\@sharp \or
+ \or
+ \else \@preamerr \@ne \fi
+ \def\the@toks{\the\toks}}
+\def\@classx{%
+ \ifcase \@lastchclass
+ \@acolampacol \or
+ \@addamp \@acol \or
+ \@acolampacol \or
+ \or
+ \@acol \@firstampfalse \or
+ \@addamp
+ \fi}
+\def\@classz{\@classx
+ \@tempcnta \count@
+ \prepnext@tok
+ \@addtopreamble{\ifcase \@chnum
+ \hfil
+ \d@llarbegin
+ \insert@column
+ \d@llarend \hfil \or
+ \hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or
+ \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \or
+ $\vcenter%$
+ \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$
+ \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
+ \vbox \@startpbox{\@nextchar}\insert@column \@endpbox
+ \fi}\prepnext@tok}
+
+\let\@classix\relax
+
+\def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else
+ \@preamerr 4\@chclass 6 \@classvi \fi\fi}
+
+\def\@arrayrule{\@addtopreamble \vline}
+
+\def\@classvii{\ifnum \@lastchclass = \thr@@
+ \@preamerr \thr@@ \fi}
+
+\def\@classvi{\ifcase \@lastchclass
+ \@acol \or
+ \@addtopreamble{\hskip \doublerulesep}\or
+ \@acol \or
+ \@classvii
+ \fi}
+
+\def\@classii{\advance \count@ \m@ne
+ \save@decl\prepnext@tok}
+
+\def\@classv{\save@decl
+ \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
+ \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
+ \prepnext@tok}
+\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}%
+ \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}
+
+\def\@classi{\@classvi
+ \ifcase \@chnum \@arrayrule \or
+ \@classv \fi}
+
+\def\@startpbox#1{\bgroup
+ \setlength\hsize{#1}\@arrayparboxrestore
+ \everypar{%
+ \vrule \@height \ht\@arstrutbox \@width \z@
+ \everypar{}}%
+ }
+\def\@endpbox{\@finalstrut\@arstrutbox \egroup\hfil}
+\def\@array[#1]#2{%
+ \@tempdima \ht \strutbox
+ \advance \@tempdima by\extrarowheight
+ \setbox \@arstrutbox \hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@}%
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\@preamble{\noexpand \ialign \@halignto
+ \bgroup \@arstrut \@preamble
+ \tabskip \z@ \cr}%
+ \endgroup
+ \@arrayleft
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
+ \bgroup
+ \let \@sharp ##\let \protect \relax
+ \lineskip \z@
+ \baselineskip \z@
+ \m@th
+ \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble}
+\newdimen \extrarowheight
+\extrarowheight=0pt
+\def\@arstrut{\unhcopy\@arstrutbox}
+\def\@arraycr{\relax\iffalse{\fi\ifnum 0=`}\fi
+ \@ifstar \@xarraycr \@xarraycr}
+\def\@xarraycr{\@ifnextchar [%
+ \@argarraycr {\ifnum 0=`{}\fi\cr}}
+\def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim #1>\z@
+ \expandafter\@xargarraycr\else
+ \expandafter\@yargarraycr\fi{#1}}
+\def\@xargarraycr#1{\unskip
+ \@tempdima #1\advance\@tempdima \dp\@arstrutbox
+ \vrule \@depth\@tempdima \@width\z@ \cr}
+\def\@yargarraycr#1{\cr\noalign{\vskip #1}}
+\long\def\multicolumn#1#2#3{%
+ \multispan{#1}\begingroup
+ \def\@addamp{\if@firstamp \@firstampfalse \else
+ \@preamerr 5\fi}%
+ \@mkpream{#2}\@addtopreamble\@empty
+ \endgroup
+ \def\@sharp{#3}%
+ \@arstrut \@preamble
+ \null
+ \ignorespaces}
+\let\d@llarbegin\begingroup
+\let\d@llarend\endgroup
+\def\array{\col@sep\arraycolsep
+ \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\gdef\@halignto{}%$
+ \@tabarray}
+\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}
+\let\@@array\@array
+\def\tabular{\gdef\@halignto{}\@tabular}
+\expandafter\def\csname tabular*\endcsname#1{%
+ \setlength\dimen@{#1}%
+ \xdef\@halignto{to\the\dimen@}\@tabular}
+\def\@tabular{%
+ \leavevmode
+ \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup%$
+ \let\d@llarend\endgroup
+ \@tabarray}
+\def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}}
+\let\@arrayleft\@empty
+\let\@arrayright\@empty
+\def\endtabular{\endarray $\egroup}%$
+\expandafter\let\csname endtabular*\endcsname=\endtabular
+\let\@ampacol=\relax \let\@expast=\relax
+\let\@arrayclassiv=\relax \let\@arrayclassz=\relax
+\let\@tabclassiv=\relax \let\@tabclassz=\relax
+\let\@arrayacol=\relax \let\@tabacol=\relax
+\let\@tabularcr=\relax \let\@@endpbox=\relax
+\let\@argtabularcr=\relax \let\@xtabularcr=\relax
+\def\@preamerr#1{\def\@tempd{{..} at wrong position: }%
+ \ClassError{bidimemoir}{%
+ \ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0
+ Missing arg: token ignored\or %1
+ Empty preamble: `l' used\or %2
+ >\@tempd token ignored\or %3
+ <\@tempd changed to !{..}\or %4
+ Only one column-spec. allowed.\fi}\@ehc} %5
+
+\def\newcolumntype#1{%
+ \edef\NC@char{\string#1}%
+ \@ifundefined{NC@find@\NC@char}%
+ {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@char
+ \@memwarn{Redefining primitive column \NC@char}\fi}%
+ \NC@list\expandafter{\the\NC@list\NC@do#1}}%
+ {\@memwarn{Column \NC@char\space is already defined}}%
+ \@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}%
+ \@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}
+\def\newcol@#1[#2]#3{\expandafter\@reargdef
+ \csname NC@rewrite@#1\endcsname[#2]{\NC@find#3}}
+\def\NC@#1{%
+ \@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend}
+\def\NC@ifend{%
+ \ifx\next\relax
+ \else\@tempswatrue\expandafter\NC@rewrite\fi}
+\def\NC@do#1{%
+ \expandafter\let\expandafter\NC@rewrite
+ \csname NC@rewrite@\string#1\endcsname
+ \expandafter\let\expandafter\NC@find
+ \csname NC@find@\string#1\endcsname
+ \expandafter\@temptokena\expandafter{\expandafter}%
+ \expandafter\NC@find\the\@temptokena#1\relax}
+\def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}
+\def\NC@show#1{%
+ \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip
+ \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}}
+\def\NC@strip#1:#2->#3 #4\@@{#2 -> #4}
+\newtoks\NC@list
+\newcolumntype{*}[2]{}
+\long\@namedef{NC@rewrite@*}#1#2{%
+ \count@#1\relax
+ \loop
+ \ifnum\count@>\z@
+ \advance\count@\m@ne
+ \@temptokena\expandafter{\the\@temptokena#2}%
+ \repeat
+ \NC@find}
+
+\newlength{\extratabsurround}
+\setlength{\extratabsurround}{2pt}
+\newlength{\backup@length}
+\newcommand{\firsthline}{%
+ \multicolumn1c{%
+ \global\backup@length\ht\@arstrutbox
+ \global\advance\backup@length\dp\@arstrutbox
+ \global\advance\backup@length\arrayrulewidth
+ \raise\extratabsurround\copy\@arstrutbox
+ }\\[-\backup@length]\hline
+}
+\newcommand{\lasthline}{\hline\multicolumn1c{%
+ \global\backup@length2\ht\@arstrutbox
+ \global\advance\backup@length2\dp\@arstrutbox
+ \global\advance\backup@length\arrayrulewidth
+ }\\[-\backup@length]%
+ \multicolumn1c{%
+ \lower\extratabsurround\copy\@arstrutbox
+ }%
+}
+\CheckCommand*\@xhline{\ifx\reserved@a\hline
+ \vskip\doublerulesep
+ \vskip-\arrayrulewidth
+ \fi
+ \ifnum0=`{\fi}}
+\renewcommand*\@xhline{\ifx\reserved@a\hline
+ \vskip\doublerulesep
+ \fi
+ \ifnum0=`{\fi}}
+
+%%%%%%%%%%% end Array package code %%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%% Dcolumn package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\def\DC@#1#2#3{%
+ \uccode`\~=`#1\relax
+ \m@th
+ \afterassignment\DC@x\count@#3\relax{#1}{#2}}
+\def\DC@x#1\relax#2#3{%
+ \ifnum\z@>\count@
+ \expandafter\DC@centre
+ \else
+ \expandafter\DC@right
+ \fi
+ {#2}{#3}{#1}}
+\def\DC@centre#1#2#3{%
+ \let\DC@end\DC@endcentre
+ \uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}%$
+ \setbox\tw@=\hbox{${\phantom{{#2}}}$}%
+ \setbox\z@=\hbox\bgroup$\mathcode`#1="8000 }%$
+\def\DC@endcentre{$\egroup%$
+ \ifdim \wd\z@>\wd\tw@
+ \setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}%
+ \else
+ \setbox\z@=\hbox to\wd\tw@{\hfill\unhbox\z@}\fi
+ \box\z@\box\tw@}
+\def\DC@right#1#2#3{%
+ \ifx\relax#3\relax
+ \hfill
+ \let\DC@rl\bgroup
+ \else
+ \edef\DC@rl{to\the\count@\dimen@ii\bgroup\hss\hfill}%
+ \count@\@gobble#3\relax
+ \fi
+ \let\DC@end\DC@endright
+ \uppercase{\def~}{$\egroup\setbox\tw@\hbox to\dimen@\bgroup${#2}}%
+ \setbox\z@\hbox{$1$}\dimen@ii\wd\z@
+ \dimen@\count@\dimen@ii
+ \setbox\z@\hbox{${#2}$}\advance\dimen@\wd\z@
+ \setbox\tw@\hbox to\dimen@{}%
+ \setbox\z@\hbox\DC@rl$\mathcode`#1="8000 }%$
+\def\DC@endright{$\hfil\egroup\box\z@\box\tw@}%$
+\newcolumntype{D}[3]{>{\DC@{#1}{#2}{#3}}c<{\DC@end}}
+
+%%%%%%%%%% end Dcolumn package code %%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%% Delarray package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\def\@@array[#1]{\@ifnextchar\bgroup
+ {\let\@arrayleft\relax\let\@arrayright\relax\@array[#1]}%
+ {\@del@array[#1]}}
+\def\@del@array[#1]#2#3#4{%
+ \setbox\z@\hbox{$\left#2\right#4$}%
+ \if#1c\def\@arrayleft{\left#2}\def\@arrayright{\right#4}%
+ \else\def\@arrayleft{\setbox\z@}%
+ \def\@arrayright{%
+ \dimen@=\dp\z@
+ \advance\dimen@-\ht\z@
+ \divide \dimen@ by \tw@
+ \advance\dimen@ by\fontdimen22 \textfont\tw@
+ \lower\dimen@\hbox{$\left#2\vcenter{\unvbox\z@}\right#4$}}%
+ \fi
+ \@array[#1]{#3}}
+%%%%%%%%%% end Delarray package code %%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%% Tabularx package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\newdimen\TX@col@width
+\newdimen\TX@old@table
+\newdimen\TX@old@col
+\newdimen\TX@target
+\newdimen\TX@delta
+\newcount\TX@cols
+\newif\ifTX@
+\def\tabularx#1{%
+\edef\TX@{\@currenvir}%
+ {\ifnum0=`}\fi
+ \setlength\TX@target{#1}%
+ \TX@typeout{Target width: #1 = \the\TX@target.}%
+ \toks@{}\TX@get@body}
+
+\let\endtabularx\relax
+\long\def\TX@get@body#1\end
+ {\toks@\expandafter{\the\toks@#1}\TX@find@end}
+\def\TX@find@end#1{%
+ \def\@tempa{#1}%
+ \ifx\@tempa\TX@\expandafter\TX@endtabularx
+ \else\toks@\expandafter
+ {\the\toks@\end{#1}}\expandafter\TX@get@body\fi}
+\def\TX@{tabularx}
+\def\TX@endtabularx{%
+ \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}%
+ \let\verb\TX@verb
+ \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
+ \edef\TX@ckpt{\cl@@ckpt}%
+ \let\@elt\relax
+ \TX@old@table\maxdimen
+ \TX@col@width\TX@target
+ \global\TX@cols\@ne
+ \TX@typeout@
+ {\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
+ \TX@trial{\def\NC@rewrite@X{%
+ \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}%
+ \loop
+ \TX@arith
+ \ifTX@
+ \TX@trial{}%
+ \repeat
+ {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
+ \csname tabular*\expandafter\endcsname\expandafter\TX@target
+ \the\toks@
+ \csname endtabular*\endcsname}%
+ \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
+ \ifnum0=`{\fi}%
+ \expandafter\end\expandafter{\TX@}}
+\def\TX@arith{%
+ \TX@false
+ \ifdim\TX@old@table=\wd\@tempboxa
+ \TX@col@width\TX@old@col
+ \TX@typeout@{Reached minimum width, backing up.}%
+ \else
+ \dimen@\wd\@tempboxa
+ \advance\dimen@ -\TX@target
+ \ifdim\dimen@<\TX@delta
+ \TX@typeout@{Reached target.}%
+ \else
+ \ifnum\TX@cols>\@ne
+ \advance\TX@cols\m@ne
+ \fi
+ \divide\dimen@\TX@cols
+ \advance\dimen@ -\TX@col@width
+ \ifdim \dimen@ >\z@
+ \@memwarn{X Columns too narrow (table too wide)\MessageBreak}%
+ \TX@col@width\TX@error@width\relax
+ \else
+ \TX@old@col\TX@col@width
+ \TX@old@table\wd\@tempboxa
+ \TX@col@width-\dimen@
+ \TX@true
+ \fi
+ \fi
+ \fi}
+\def\TX@error@width{1em}
+\TX@delta\hfuzz
+\newcolumntype{X}{}
+\def\tabularxcolumn#1{p{#1}}
+\def\TX@newcol{\newcol@{X}[0]}
+\def\TX@trial#1{%
+ \setbox\@tempboxa\hbox{%
+ #1\relax
+ \let\@footnotetext\TX@trial@ftn
+ \let\TX@vwarn\@empty
+ \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
+ \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
+ \def\write{\begingroup
+ \def\let{\afterassignment\endgroup\toks@}%
+ \afterassignment\let\count@}%
+ \hbadness\@M
+ \hfuzz\maxdimen
+ \let\hbadness\@tempcnta
+ \let\hfuzz\@tempdima
+ \expandafter\tabular\the\toks@
+ \endtabular}%
+ \TX@ckpt
+ \TX@typeout@{\@spaces
+ \expandafter\TX@align
+ \the\wd\@tempboxa\space\space\space\space\space\@@
+ \expandafter\TX@align
+ \the\TX@col@width\space\space\space\space\space\@@
+ \@spaces\the\TX@cols}}
+\def\TX@align#1.#2#3#4#5#6#7#8#9\@@{%
+ \ifnum#1<10 \space\fi
+ \ifnum#1<100 \space\fi
+ \ifnum#1<\@m\space\fi
+ \ifnum#1<\@M\space\fi
+ #1.#2#3#4#5#6#7#8\space\space}
+\def\arraybackslash{\let\\\@arraycr}
+\def\tracingtabularx{%
+ \def\TX@typeout{\ClassWarningNoLine{bidimemoir}}%
+ \def\TX@typeout@##1{\typeout{(tabularx) ##1}}}
+\let\TX@typeout\@gobble
+\let\TX@typeout@\@gobble
+\newtoks\TX@ftn
+\long\def\TX@ftntext#1{%
+ \edef\@tempa{\the\TX@ftn\noexpand\footnotetext
+ [\the\csname c@\@mpfn\endcsname]}%
+ \global\TX@ftn\expandafter{\@tempa{#1}}}%
+\long\def\TX@xftntext[#1]#2{%
+ \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}}
+\long\def\TX@trial@ftn#1{}
+{\uccode`\*=`\ %
+\uppercase{\gdef\TX@verb{%
+ \leavevmode\null\TX@vwarn
+ {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
+ \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
+\def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
+ \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
+\def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
+\begingroup
+\catcode`\*=\catcode`\#
+\catcode`\#=12
+\gdef\TX@vfirst{%
+ \if\@tempa#%
+ \def\@tempb{\TX@v@#}%
+ \else
+ \let\@tempb\TX@v@
+ \if\@tempa\space~\else\@tempa\fi
+ \fi
+ \@tempb}
+\gdef\TX@v@*1 *2{%
+ \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
+\gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}
+\endgroup
+\def\TX@vwarn{%
+ \@warning{\noexpand\verb may be unreliable inside tabularx}%
+ \global\let\TX@vwarn\@empty}
+
+%%%%%%%%%% end Tabularx package code %%%%%%%%%%%%%%%%%%%%%
+
+%%\@memfakeusepackage{array}
+%%\@memfakeusepackage{dcolumn}
+%%\@memfakeusepackage{delarray}
+%%\@memfakeusepackage{tabularx}
+
+\newcommand*{\bktabrule}[1]{%
+ \hrule \@height#1}
+
+%%%%%%%%%% Booktabs package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% slightly modified by PRW %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% by permission of Simon Fear %%%%%%%%%%%%%%%%%%%%%
+
+\AtBeginDocument{%
+ \providecommand*{\CT@arc@}{}}
+
+\newdimen\heavyrulewidth
+\newdimen\lightrulewidth
+\newdimen\cmidrulewidth
+\newdimen\belowrulesep
+\newdimen\belowbottomsep
+\newdimen\aboverulesep
+\newdimen\abovetopsep
+\newdimen\cmidrulesep
+\newdimen\cmidrulekern
+\newdimen\defaultaddspace
+\heavyrulewidth=.08em
+\lightrulewidth=.05em
+\cmidrulewidth=.03em
+\belowrulesep=.65ex
+\belowbottomsep=\z@
+\aboverulesep=.4ex
+\abovetopsep=\z@
+\cmidrulesep=\doublerulesep
+\cmidrulekern=.5em
+\defaultaddspace=.5em
+
+\newcount\@cmidla
+\newcount\@cmidlb
+\newdimen\@aboverulesep
+\newdimen\@belowrulesep
+\newcount\@thisruleclass
+\newcount\@lastruleclass
+\@lastruleclass=0
+\newdimen\@thisrulewidth
+
+\def\futurenonspacelet#1{\def\@BTcs{#1}%
+ \afterassignment\@BTfnslone\let\nexttoken= }
+\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo}
+\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree
+ \else\let\next=\nexttoken\fi \next}
+\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= }
+
+
+
+
+\def\toprule{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=\abovetopsep
+ \global\@belowrulesep=\belowrulesep
+ \global\@thisruleclass=\@ne
+ \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}
+
+\def\midrule{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=\aboverulesep
+ \global\@belowrulesep=\belowrulesep
+ \global\@thisruleclass=\@ne
+ \@ifnextchar[{\@BTrule}{\@BTrule[\lightrulewidth]}}
+
+\def\bottomrule{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=\aboverulesep
+ \global\@belowrulesep=\belowbottomsep
+ \global\@thisruleclass=\@ne
+ \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}
+
+\def\specialrule#1#2#3{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=#2\global\@belowrulesep=#3\global\@thisruleclass=\tw@
+ \@BTrule[#1]}
+
+\def\addlinespace{\noalign{\ifnum0=`}\fi
+ \@ifnextchar[{\@addspace}{\@addspace[\defaultaddspace]}}
+\def\@addspace[#1]{\global\@belowrulesep=#1\global\@thisruleclass=\tw@
+ \futurelet\@tempa\@BTendrule}
+
+\def\@BTrule[#1]{%
+ \global\@thisrulewidth=#1\relax
+ \ifnum\@thisruleclass=\tw@\vskip\@aboverulesep\else
+ \ifnum\@lastruleclass=\z@\vskip\@aboverulesep\else
+ \ifnum\@lastruleclass=\@ne\vskip\doublerulesep\fi\fi\fi
+
+ \ifx\longtable\undefined\let\@BTswitch\@BTnormal\else
+ \ifx\hline\LT@hline\let\@BTswitch\@BLTrule
+ \else\let\@BTswitch\@BTnormal\fi\fi
+ \@BTswitch}
+
+\def\@BTnormal{%
+%% \bktabrule{\@thisrulewidth}
+ {\CT@arc@\bktabrule{\@thisrulewidth}}%
+ \futurenonspacelet\@tempa\@BTendrule}
+\def\@BLTrule{\@ifnextchar({\@@BLTrule}{\@@BLTrule()}}
+\def\@@BLTrule(#1){\@setrulekerning{#1}%
+\global\@cmidlb\LT@cols
+\ifnum0=`{\fi}%
+\@cmidruleb
+\noalign{\ifnum0=`}\fi
+\futurenonspacelet\@tempa\@BTendrule}
+
+\def\@BTendrule{%
+ \ifx\@tempa\toprule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\midrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\bottomrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\cmidrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\specialrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\addlinespace\global\@lastruleclass=\@thisruleclass
+ \else\global\@lastruleclass=\z@\fi\fi\fi\fi\fi\fi
+ \ifnum\@lastruleclass=\@ne\relax\else\vskip\@belowrulesep\fi
+ \ifnum0=`{\fi}}
+\def\@setrulekerning#1{%
+ \global\let\cmrkern@l\z@
+ \global\let\cmrkern@r\z@
+ \@tfor\@tempa :=#1\do
+ {\def\@tempb{r}%
+ \ifx\@tempa\@tempb
+ \global\let\cmrkern@r\cmidrulekern
+ \def\cmrsideswitch{\cmrkern@r}%
+ \else
+ \def\@tempb{l}%
+ \ifx\@tempa\@tempb
+ \global\let\cmrkern@l\cmidrulekern
+ \def\cmrsideswitch{\cmrkern@l}%
+ \else
+ \global\expandafter\let\cmrsideswitch\@tempa
+ \fi
+ \fi}}
+
+\def\cmidrule{\noalign{\ifnum0=`}\fi
+ \@ifnextchar[{\@cmidrule}{\@cmidrule[\cmidrulewidth]}}
+\def\@cmidrule[#1]{\@ifnextchar({\@@cmidrule[#1]}{\@@cmidrule[#1]()}}
+\def\@@cmidrule[#1](#2)#3{\@@@cmidrule[#3]{#1}{#2}}
+
+\def\@@@cmidrule[#1-#2]#3#4{\global\@cmidla#1\relax
+ \global\advance\@cmidla\m@ne
+ \ifnum\@cmidla>0\global\let\@gtempa\@cmidrulea\else
+ \global\let\@gtempa\@cmidruleb\fi
+ \global\@cmidlb#2\relax
+ \global\advance\@cmidlb-\@cmidla
+ \global\@thisrulewidth=#3
+ \@setrulekerning{#4}
+ \ifnum\@lastruleclass=\z@\vskip \aboverulesep\fi
+ \ifnum0=`{\fi}\@gtempa
+ \noalign{\ifnum0=`}\fi\futurenonspacelet\@tempa\@xcmidrule}
+\def\@xcmidrule{\ifx\@tempa\cmidrule\vskip-\@thisrulewidth
+ \global\@lastruleclass=\@ne\else
+ \ifx\@tempa\morecmidrules\vskip \cmidrulesep
+ \global\@lastruleclass=\@ne\else
+ \vskip \belowrulesep\global\@lastruleclass=\z@\fi\fi
+ \ifnum0=`{\fi}}
+
+\def\@cmidrulea{%
+ \multispan\@cmidla&\multispan\@cmidlb
+%% \unskip\hskip \cmrkern@l\leaders\bktabrule{\@thisrulewidth}\hfill
+ \unskip\hskip \cmrkern@l{%
+ \CT@arc@\leaders\bktabrule{\@thisrulewidth}\hfill}%
+ \hskip \cmrkern@r\cr}
+\def\@cmidruleb{%
+ \multispan\@cmidlb
+%% \unskip\hskip \cmrkern@l\leaders\bktabrule{\@thisrulewidth}\hfill
+ \unskip\hskip \cmrkern@l{%
+ \CT@arc@\leaders\bktabrule{\@thisrulewidth}\hfill}%
+ \hskip \cmrkern@r\cr}
+
+\def\morecmidrules{\noalign{\relax}}
+
+%%%%%%%%%% end of Booktabs package code %%%%%%%%%%%%%%%%%%%%%
+
+%%\@memfakeusepackage{booktabs}
+
+\ifetex
+ \renewcommand*{\killm@matf}[1]{%
+ \ifnum 6=\currentgrouptype
+ \ifvmode
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \expandafter\expandafter\expandafter\noalign
+ \fi
+ \fi
+ \@firstofone
+ {\@namelet{#1-m@mfb}\relax
+ \@namelet{#1-m@mfe}\relax
+ }%
+ }
+\fi
+
+\newskip\ctableftskip \ctableftskip=\fill
+\newskip\ctabrightskip \ctabrightskip=\fill
+
+\expandafter\def\csname ctabular*\endcsname{%
+ \@ifnextchar[ {\@ctabularstar}{\@ctabularstar[c]}}
+\def\@ctabularstar[#1]#2{\global\@curtab\@ne
+ \ctableftskip\fill
+ \ctabrightskip\fill
+ \if l#1% left
+ \ctableftskip\z@
+ \else
+ \if r#1% right
+ \ctabrightskip\z@
+ \fi
+ \fi
+ \setlength\dimen@{#2}%
+ \xdef\@halignto{to\the\dimen@}\NC@tabular}
+\newcommand*{\ctabular}[1][c]{\global\@curtab\@ne
+ \ctableftskip\fill
+ \ctabrightskip\fill
+ \if l#1% left
+ \ctableftskip\z@
+ \else
+ \if r#1% right
+ \ctabrightskip\z@
+ \fi
+ \fi
+ \gdef\@halignto{to\hsize}\NC@tabular}
+
+\newcommand*{\NC@tabular}{%
+ \par
+ \addvspace{\topsep}
+ \col@sep\tabcolsep
+ \let\d@llarbegin\begingroup
+ \let\d@llarend\endgroup
+ \@NCtabarray}
+
+\newcommand*{\@NCialign}{\everycr{}\tabskip\ctableftskip\halign}
+
+\newcommand*{\@NCtabarray}[1]{%
+ \@tempdima \ht\strutbox
+ \advance\@tempdima\extrarowheight
+ \setbox \@arstrutbox \hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp\strutbox
+ \@width\z@}%
+ \begingroup
+%% \@mkpream{@{\hspace{\@totalleftmargin}}#1@{}}%
+ \@mkpream{#1}%
+ \xdef\@preamble{\@NCialign \@halignto
+ \bgroup & \tabskip\z@
+ \@arstrut
+ \@preamble
+ \tabskip\ctabrightskip
+ \cr}%
+ \endgroup
+ \let\@sharp ##\let\protect\relax
+ \lineskip\z@
+ \baselineskip\z@
+ \let\\\@arraycr
+ \let\tabularnewline\\%
+ \let\par\@empty
+ \ctabsetlines
+ \@preamble
+}
+
+\def\endctabular{%
+ \crcr \egroup
+ \gdef\@preamble{}%
+ \addvspace{\topsep}
+ \noindent}
+\expandafter\let\csname endctabular*\endcsname=\endctabular
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand*{\memcline}[2]{\m@m@cline[#1]#2\@nil}
+\def\m@m@cline[#1]#2-#3\@nil{%
+ \omit
+ \@multicnt#2%
+ \advance\@multispan\m@ne
+ \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
+ \@multicnt#3%
+ \advance\@multicnt-#2%
+ \advance\@multispan\@ne
+ \leaders\hrule\@height #1\hfill % <- variable \@height value
+ \cr
+ \noalign{\vskip- #1}} % <- variable \@height value
+
+\newcommand*{\memhline}[1][\arrayrulewidth]{\memcline{#1}{1-\@curtab}}
+\newcommand*{\m@mhline}{\cline{1-\@curtab}}
+\def\m@m@BTnormal{%
+ \ifnum0=`{\fi} % closes the \noalign
+ \multispan{\@curtab} \leaders\bktabrule{\@thisrulewidth}\hfill\cr
+ \noalign{\ifnum0=`}\fi
+ \futurenonspacelet\@tempa\@BTendrule}
+
+\def\ctabsetlines{%
+ \let\hline\m@mhline
+ \let\@BTnormal\m@m@BTnormal}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcount\abovecolumnspenalty
+ \abovecolumnspenalty=10000
+\newcount\@linestogo % lines remaining to be procesed
+\newcount\@cellstogo % cells remaining in column or row
+\newcount\@cellsincolumn % number of lines per column
+\newtoks\crtok
+ \crtok = {\cr}%
+
+\newdimen\@mincolumnwidth
+\let\c@lleftskip\hfil % left skip within a column
+\let\c@lrightskip\hfil % right skip within a column
+
+\let\preautotab\relax
+\let\postautotab\relax
+
+\newcommand{\autocols}[5][0pt]{\par\begingroup
+ \ctabsetlines
+ \if l#2
+ \raggedright
+ \else
+ \if r#2
+ \raggedleft
+ \else
+ \centering
+ \fi
+ \fi
+ \let\c@lleftskip\hfil
+ \let\c@lrightskip\hfil
+ \if l#4
+ \let\c@lleftskip\relax
+ \else
+ \if r#4
+ \let\c@lrightskip\relax
+ \fi
+ \fi
+ \@mincolumnwidth\z@
+ \TX@cols=#3
+ \@curtab=#3
+ \@linestogo\z@
+ \@for\@tempa:=#5\do{
+ \advance\@linestogo\@ne
+ \settowidth{\@tempdima}{\@tempa}
+ \ifdim\@tempdima>\@mincolumnwidth
+ \@mincolumnwidth=\@tempdima
+ \fi
+ }
+ \advance\@mincolumnwidth\tabcolsep
+ \linespercol
+ \def\@endcolumnactions{%
+ \global\advance\@linestogo\m@ne
+ \ifnum\@cellstogo<\tw@
+ \global\advance\TX@cols\m@ne
+ \ifnum\TX@cols>\z@\linespercol\fi
+ \the\crtok
+ \else
+ &\global\advance\@cellstogo\m@ne
+ \fi}%
+ \ifdim #1 > \z@
+ \TX@col@width=#1
+ \divide\TX@col@width \TX@cols
+ \else
+ \TX@col@width=\@mincolumnwidth
+ \fi
+ \penalty\abovecolumnspenalty
+ \noindent% usually not a paragraph
+ \def\@preamble{}%
+ \begingroup
+ \let\@sharp\relax
+ \ifnum\@cellsincolumn>\@ne
+ \loop
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{%
+ \c@lleftskip\strut\@sharp\c@lrightskip} &}%
+ \advance\@cellsincolumn\m@ne
+ \ifnum\@cellsincolumn>\@ne
+ \repeat
+ \fi
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{\c@lleftskip\strut\@sharp\c@lrightskip}}%
+ \endgroup
+ \let\@sharp ##
+ \tabskip\ctableftskip
+%% \tabskip\z@
+ \valign \bgroup
+ \tabskip\z@
+ \@preamble
+ \tabskip\ctabrightskip\cr
+ \@for\@tempa:=#5\do{
+ \@tempa\unskip\space\@endcolumnactions}%
+ \the\crtok \egroup \par \endgroup}
+
+\newcommand*{\linespercol}{%
+ \@cellsincolumn=\@linestogo
+ \divide\@cellsincolumn \TX@cols
+ \@cellstogo=\@cellsincolumn
+ \multiply\@cellstogo \TX@cols
+ \@tempcnta=\@linestogo
+ \advance\@tempcnta -\@cellstogo
+ \ifnum \@tempcnta>\z@
+ \advance\@cellsincolumn \@ne
+ \fi
+ \global\@cellstogo=\@cellsincolumn}
+
+\newcommand{\autorows}[5][0pt]{\par\begingroup
+ \ctabsetlines
+ \ctableftskip\fill
+ \ctabrightskip\fill
+ \if l#2
+ \ctableftskip\z@
+ \else
+ \if r#2
+ \ctabrightskip\z@
+ \fi
+ \fi
+ \let\c@lleftskip\hfil
+ \let\c@lrightskip\hfil
+ \if l#4
+ \let\c@lleftskip\relax
+ \else
+ \if r#4
+ \let\c@lrightskip\relax
+ \fi
+ \fi
+ \TX@cols=#3\relax
+ \@curtab=#3\relax
+ \@cellstogo = \TX@cols
+ \@mincolumnwidth\z@
+ \@linestogo\z@
+ \@for\@tempa:=#5\do{%
+ \advance\@linestogo\@ne
+ \settowidth{\@tempdima}{\@tempa}
+ \ifdim\@tempdima>\@mincolumnwidth
+ \@mincolumnwidth=\@tempdima
+ \fi}%
+ \advance\@mincolumnwidth\tabcolsep
+ \def\@endcolumnactions{%
+ \global\advance\@linestogo\m@ne
+ \global\advance\@cellstogo\m@ne
+ \ifnum\@cellstogo<\@ne
+ \global\@cellstogo=\TX@cols
+ \the\crtok
+ \else
+ &
+ \fi}%
+ \ifdim #1>\z@
+ \TX@col@width=#1
+ \else
+ \TX@col@width=\hsize
+ \fi
+ \divide\TX@col@width \TX@cols
+ \ifdim #1=\z@
+ \TX@col@width=\@mincolumnwidth
+ \fi
+ \penalty\abovecolumnspenalty
+ \noindent % usually not a paragraph
+ \vskip -\z@ % don't know why we need this, but looks bad without it
+ \def\@preamble{}%
+ \begingroup
+ \let\@sharp\relax
+ \ifnum\TX@cols>\@ne
+ \loop
+ \ifdim #1<\z@
+ \g@addto@macro{\@preamble}{%
+ \strut\c@lleftskip\@sharp\c@lrightskip &}%
+ \else
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{%
+ \strut\c@lleftskip\@sharp\c@lrightskip} &}%
+ \fi
+ \advance\TX@cols\m@ne
+ \ifnum\TX@cols>\@ne
+ \repeat
+ \fi
+ \ifdim #1<\z@
+ \g@addto@macro{\@preamble}{%
+ \strut\c@lleftskip\@sharp\c@lrightskip}%
+ \else
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{\strut\c@lleftskip\@sharp\c@lrightskip}}%
+ \fi
+ \endgroup
+ \let\@sharp ##
+ \tabskip\ctableftskip
+ \halign to \hsize \bgroup
+ \tabskip\z@
+ \@preamble
+%% \tabskip\ctabrightskip\cr \preautotab
+ \tabskip\ctabrightskip\cr
+ \@for\@tempa:=#5\do{%
+ \@tempa\unskip\space\@endcolumnactions}%
+%% \the\crtok \postautotab \the\crtok \egroup \endgroup \par
+ \the\crtok \egroup \endgroup \par}
+
+\newcounter{newflo@tctr}
+ \setcounter{newflo@tctr}{1}
+
+\newcommand{\newfloat}[4][\@empty]{%
+%%% \@namedef{ftype@#2}{\value{newflo@tctr}}
+%%% \addtocounter{newflo@tctr}{\value{newflo@tctr}}
+ \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}%
+ \advance\c@newflo@tctr \c@newflo@tctr
+ \@ifundefined{c@#2}{% counter is not defined
+ \ifx \@empty#1\relax
+ \newcounter{#2}
+ \else
+ \newcounter{#2}[#1]
+ \expandafter\edef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}
+ \fi}{}
+ \setcounter{#2}{0}
+
+ \@namedef{ext@#2}{#3}% file extension
+ \@ifundefined{c@#3depth}{\newcounter{#3depth}}{}
+ \setcounter{#3depth}{1}
+
+ \@namedef{fps@#2}{tbp} % position
+ \@namedef{fnum@#2}{#4~\@nameuse{the#2}} % caption naming
+ \@namedef{fleg#2}{#4} % legend naming
+ \@namedef{flegtoc#2}##1{} % legend name in ToC
+
+ \newenvironment{#2}{\@float{#2}}{\end@float}
+ \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}
+} % end \newfloat
+
+\newcommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}}
+
+\newcommand{\newsubfloat}[1]{%
+ \newlistentry[#1]{sub#1}{\@nameuse{ext@#1}}{1}
+ \@namedef{ext@sub#1}{\csname ext@#1\endcsname}
+ \@namedef{thesub#1}{(\alph{sub#1})}
+ \@namedef{@thesub#1}{\@nameuse{thesub#1}%
+ \if@tightsubcap\hskip\subfloatlabelskip\else\space\fi}
+ \@namedef{@@thesub#1}{\@nameuse{thesub#1}}
+ \@namedef{p@sub#1}{\csname the#1\endcsname}
+ \@namedef{toclevel@sub#1}{1}}
+
+\newif\ifdonemaincaption
+ \donemaincaptionfalse
+
+\let\@memoldfloat\@float
+\renewcommand{\@float}[1]{\donemaincaptionfalse
+ \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}%
+ \@memoldfloat{#1}}
+\let\@memolddblfloat\@dblfloat
+\renewcommand{\@dblfloat}[1]{\donemaincaptionfalse
+ \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}%
+ \@memolddblfloat{#1}}
+
+\let\@memoldefloat\end@float
+\def\end@float{%
+ \@memlistsubcaptions{\@captype}\@memoldefloat}
+\let\@memoldedblfloat\end@dblfloat
+\def\end@dblfloat{%
+ \@memlistsubcaptions{\@captype}\@memoldedblfloat}
+
+\AtBeginDocument{\@ifpackageloaded{fixltx2e}{%
+ \def\end@dblfloat{%
+ \if@twocolumn
+ \@endfloatbox
+ \ifnum\@floatpenalty<\z@
+ \@largefloatcheck
+ \global\dp\@currbox1sp %
+ \@cons\@deferlist\@currbox
+ \fi
+ \ifnum\@floatpenalty=-\@Mii \@Esphack\fi
+ \else
+ \end@float
+ \fi}}{}}
+
+\newif\if@contcw
+\newif\if@conthang
+\newif\if@contindent
+
+\newcommand{\captiondelim}[1]{\def\@contdelim{#1}}
+\captiondelim{: }
+
+\newcommand{\captionnamefont}[1]{\def\@contnfont{#1}}
+\captionnamefont{}
+
+\newcommand{\captiontitlefont}[1]{\def\@conttfont{#1}}
+\captiontitlefont{}
+
+\newcommand*{\captionstyle}[1]{\def\@contcstyle{#1}}
+\captionstyle{}
+
+\renewcommand{\captionstyle}{%
+ \@ifnextchar[ {\@memcshort}{\@memcnorm}}
+\def\@memcshort[#1]#2{%
+ \def\@contcshortstyle{#1}
+ \def\@contcstyle{#2}}
+\def\@memcnorm#1{%
+ \def\@contcshortstyle{#1}
+ \def\@contcstyle{#1}}
+\captionstyle{}
+
+\newlength{\@contcwidth}
+\newcommand{\captionwidth}[1]{\setlength{\@contcwidth}{#1}}
+\captionwidth{\linewidth}
+\newcommand{\changecaptionwidth}{\@contcwtrue}
+\newcommand{\normalcaptionwidth}{\@contcwfalse}
+\normalcaptionwidth
+
+\newlength{\@contindw}
+\newcommand{\hangcaption}{\@conthangtrue\@contindentfalse}
+\newcommand{\indentcaption}[1]{\setlength{\@contindw}{#1}%
+ \@conthangfalse\@contindenttrue}
+\newcommand{\normalcaption}{\@conthangfalse\@contindentfalse}
+\normalcaption
+
+\newcommand{\precaption}[1]{\def\@contpre{#1}}
+\precaption{}
+\newcommand{\postcaption}[1]{\def\@contpost{#1}}
+\postcaption{}
+\newcommand{\midbicaption}[1]{\def\@contmidbi{#1}}
+\midbicaption{}
+
+\newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}}
+ \captiontitlefinal{}
+
+\newlength{\abovecaptionskip}
+ \setlength{\abovecaptionskip}{0.5\onelineskip}
+\newlength{\belowcaptionskip}
+ \setlength{\belowcaptionskip}{0.5\onelineskip}
+
+\let\@memoldcaption\caption
+\def\caption{\donemaincaptiontrue\@memoldcaption}
+
+\newcommand{\memcaptioninfo}[4]{}
+
+\let\@memold@caption\@caption
+\long\def\@caption#1[#2]#3{%
+ \M@gettitle{#2}%
+ \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
+ \@memold@caption{#1}[{#2}]{#3}}
+
\long\def\@makecaption#1#2{\let\@memtempa\relax
\ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip
\else \def\@memtempa{\vbox to\topskip{}}\fi
\let\@contfnote\footnote \renewcommand{\footnote}[2][]{}
\let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}
- \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2}
+ \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal}
\let\footnote\@contfnote
\let\footnotemark\@contfmark
\ifdim\wd\@tempboxa<\linewidth \centering \fi
@@ -649,20 +10115,20 @@ This work consists of the file \jobname.dtx
\if@conthang
\sbox\@tempboxa{\@contnfont #1\@contdelim}
\@contpre%
- \@ensure@dir{\@contcstyle\hangindent=\wd\@tempboxa
- \noindent\box\@tempboxa\@memtempa \@conttfont #2}\par
+ {\@contcstyle\hangindent=\wd\@tempboxa
+ \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par}
\else
\if@contindent
\@contpre%
- \@ensure@dir{\@contnfont #1\@contdelim}\@memtempa
- \@ensure@dir{\@contcstyle\hangindent=\@contindw
- \hangafter=\@ne\@conttfont #2}\par% <- v1.4
+ {\@contnfont #1\@contdelim}\@memtempa
+ {\@contcstyle\hangindent=\@contindw
+ \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4
\else
\@contpre%
- \@ensure@dir{\@contnfont #1\@contdelim}\@memtempa
- \@ensure@dir{\ifdim\wd\@tempboxa<\linewidth
+ {\@contnfont #1\@contdelim}\@memtempa
+ {\ifdim\wd\@tempboxa<\linewidth
\@contcshortstyle\else \@contcstyle\fi% <- v1.4
- \@conttfont #2}\par
+ \@conttfont #2\@contfinal\par}
\fi
\fi
\@contpost
@@ -671,224 +10137,8182 @@ This work consists of the file \jobname.dtx
} % end of the \parbox
\fi
\vskip\belowcaptionskip}
-}% else we redefine \@makecaption for the standard classes
-{\@ifundefined{@makecaption}{%
-%warning ??
-}{\long\def\@makecaption#1#2{%
+
+\newcommand{\contcaption}{%
+ \addtocounter{\@captype}{\m@ne}\refstepcounter{\@captype}%
+ \@contcaption\@captype}
+
+\long\def\@@contcaption#1#2{%
+ \par
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
+ \endgroup}
+
+\long\def\@contcaption#1#2{%
+ \if@contbotsub
+ \@memlistsubcaptions{#1}%
+ \@@contcaption{#1}{#2}%
+ \else
+ \@@contcaption{#1}{#2}%
+ \@memlistsubcaptions{#1}%
+ \fi}
+
+\newcommand{\memlegendinfo}[1]{}
+\newcommand{\legend}[1]{%
+ \M@gettitle{#1}%
+ \memlegendinfo{#1}%
+ \par
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \captiondelim{\mbox{}}
+ \@makecaption{}{\ignorespaces #1}\par
+ \endgroup}
+
+\newcommand{\namedlegend}{\@dblarg{\@legend\@captype}}
+\newcommand{\memnamedlegendinfo}[3]{}
+
+\long\def\@legend#1[#2]#3{%
+ \M@gettitle{#2}%
+ \memnamedlegendinfo{#1}{#2}{#3}%
+ \par
+ \csname flegtoc#1\endcsname{#2}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fleg#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}
+
+\newcommand{\newfixedcaption}[3][\caption]{%
+ \newcommand{#2}{\def\@captype{#3}#1}}
+\newcommand{\renewfixedcaption}[3][\caption]{%
+ \renewcommand{#2}{\def\@captype{#3}#1}}
+\newcommand{\providefixedcaption}[3][\caption]{%
+ \providecommand{#2}{\def\@captype{#3}#1}}
+
+\newcommand{\membitwonumcaptioninfo}[7]{}
+\newcommand{\membionenumcaptioninfo}[7]{}
+\newcommand{\membicaptioninfo}[6]{}
+
+\newcommand{\bitwonumcaption}[6][\@empty]{%
+ \begingroup
+ \let\memcaptioninfo\@gobblefour
+ \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
+ {\def\m@mscapi{#2}\caption[#2]{#3}}%
+ \ifx \@empty #1\else
+ \label{#1}%
+ \fi
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#4}%
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
+ \addtocounter{\@captype}{-1}%
+ \@contmidbi
+ \@ifmtarg{#5}{\def\m@mscapii{#6}\caption{#6}}%
+ {\def\m@mscapii{#5}\caption[#5]{#6}}%
+ \membitwonumcaptioninfo{\@captype}{\@nameuse{the\@captype}}%
+ {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}%
+ \endgroup}
+
+\newcommand{\bionenumcaption}[6][\@empty]{%
+ \begingroup
+ \let\memcaptioninfo\@gobblefour
+ \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
+ {\def\m@mscapi{#2}\caption[#2]{#3}}%
+ \ifx \@empty #1\else
+ \label{#1}%
+ \fi
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#4}%
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}
+ \@contmidbi
+ \contcaption{#6}%
+ \@ifmtarg{#5}{%
+ \def\m@mscapii{#6}%
+ \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
+ {\protect\numberline{}{\ignorespaces #6}}}{%
+ \def\m@mscapii{#5}%
+ \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
+ {\protect\numberline{}{\ignorespaces #5}}}%
+ \membionenumcaptioninfo{\@captype}{\@nameuse{the\@captype}}%
+ {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}%
+ \endgroup}
+
+\newcommand{\bicaption}[5][\@empty]{%
+ \begingroup
+ \let\memcaptioninfo\@gobblefour
+ \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
+ {\def\m@mscapi{#2}\caption[#2]{#3}}%
+ \ifx \@empty #1\else
+ \label{#1}%
+ \fi
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#4}
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
+ \@contmidbi
+ \contcaption{#5}%
+ \membicaptioninfo{\@captype}{\@nameuse{the\@captype}}%
+ {\m@mscapi}{#3}{#4}{#5}%
+ \endgroup}
+
+\newcommand{\bicontcaption}[3]{%
+ \begingroup
+ \contcaption{#1}%
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#2}%
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
+ \@contmidbi
+ \contcaption{#3}%
+ \endgroup}
+
+\newcommand{\subcaptionstyle}[1]{\def\@contsubcstyle{#1}}
+\subcaptionstyle{}
+
+\newif\if@shortsubcap
+\newif\if@hangsubcap
+\newcommand*{\shortsubcaption}{\@shortsubcaptrue}
+\newcommand*{\hangsubcaption}{\@hangsubcaptrue}
+\newcommand*{\normalsubcaption}{\@shortsubcapfalse\@hangsubcapfalse}
+\normalsubcaption
+
+\newskip\subfloattopskip
+\newskip\subfloatcapskip
+\newskip\subfloatcaptopadj
+\newskip\subfloatbottomskip
+\newskip\subfloatlabelskip
+\newdimen\subfloatcapmargin
+\newif\if@tightsubcap
+\newcommand{\loosesubcaptions}{%
+ \subfloattopskip = 10\p@
+ \subfloatcapskip = 10\p@
+ \subfloatcaptopadj = \z@
+ \subfloatbottomskip = 10\p@
+ \subfloatlabelskip = 0.33em
+ \subfloatcapmargin = 10\p@
+ \@tightsubcapfalse
+}
+
+\newcommand{\tightsubcaptions}{%
+ \subfloattopskip = 5\p@
+ \subfloatcapskip = \z@
+ \subfloatcaptopadj = 3\p@
+ \subfloatbottomskip = 5\p@
+ \subfloatlabelskip = 0.33em \@plus 0.07em \@minus 0.03em
+ \subfloatcapmargin = \z@
+ \@tightsubcaptrue
+}
+\tightsubcaptions
+
+\newcommand*{\subcaptionsize}[1]{\def\@subcapsize{#1}}
+\newcommand*{\subcaptionlabelfont}[1]{\def\@subcaplabelfont{#1}}
+\newcommand*{\subcaptionfont}[1]{\def\@subcapfont{#1}}
+\subcaptionsize{\footnotesize}
+\subcaptionlabelfont{\normalfont}
+\subcaptionfont{\normalfont}
+
+ \newcounter{@contsubnum}
+ \newcommand{\@contkeep}{%
+ \setcounter{@contsubnum}{\value{sub\@captype}}}
+ \newcommand{\@contset}{%
+ \setcounter{sub\@captype}{\value{@contsubnum}}}
+ \newcommand{\subconcluded}{%
+ \setcounter{sub\@captype}{0}}
+\newif\if@contbotsub
+ \@contbotsubtrue
+
+\newcommand{\subcaption}{%
+ \bgroup
+ \let\label=\memsub@label
+ \ifdonemaincaption\else
+ \advance\csname c@\@captype\endcsname\@ne
+ \fi
+ \refstepcounter{sub\@captype}\@contkeep
+ \@ifnextchar [%
+ {\@memsubcap{sub\@captype}}%
+ {\@memsubcap{sub\@captype}[\@empty]}}
+\long\def\@memsubcap#1[#2]#3{%
+ \@tempdima=\hsize
+ \vskip\subfloatcapskip
+ \ifx \@empty #2
+ \@memsubcaption{#1}{#3}{#3}%
+ \else
+ \@memsubcaption{#1}{#2}{#3}%
+ \fi
+ \vskip\subfloatcapskip
+ \egroup}
+\newcommand{\@memsubcaption}[3]{%
+ \ifx \relax#2\relax \else
+ \bgroup
+ \let\label\@gobble
+ \let\protect\string
+ \def\@memsubcaplabel{\@nameuse{@@the#1}}%
+ \xdef\@memsubfigcaptionlist{%
+ \@memsubfigcaptionlist,%
+ {\protect\numberline{\@memsubcaplabel}\noexpand{\ignorespaces #2}}}%
+ \egroup
+ \fi
+ \@makesubfloatcaption{\@nameuse{@the#1}}{#3}}
+
+\newcommand{\contsubcaption}{%
+ \bgroup
+ \let\label=\memsub@label
+ \@contset
+ \refstepcounter{sub\@captype}\@contkeep
+ \@ifnextchar [%
+ {\@memsubcap{sub\@captype}}%
+ {\@memsubcap{sub\@captype}[\@empty]}}
+\newenvironment{subfloat}{}{}
+
+\newcommand{\subbottom}{%
+ \@contbotsubtrue
+ \@memsubbody}
+
+\newcommand{\@memsubbody}{%
+ \bgroup
+ \let\label=\memsub@label
+ \ifdonemaincaption\else
+ \advance\csname c@\@captype\endcsname\@ne
+ \fi
+ \refstepcounter{sub\@captype}\@contkeep%
+ \leavevmode
+ \@ifnextchar [%
+ {\@memsubfig}%
+ {\@memsubfig[\@empty]}}
+
+\newcommand{\contsubbottom}{%
+ \@contbotsubtrue
+ \@memcontsubbody}
+
+\newcommand{\@memcontsubbody}{%
+ \bgroup
+ \let\label=\memsub@label
+ \@contset
+ \refstepcounter{sub\@captype}\@contkeep%
+ \leavevmode
+ \@ifnextchar [%
+ {\@memsubfig}%
+ {\@memsubfig[\@empty]}}
+
+\newcommand{\subtop}{%
+ \@contbotsubfalse
+ \@memsubbody}
+
+\newcommand{\contsubtop}{%
+ \@contbotsubfalse
+ \@memcontsubbody}
+
+\def\@memsubfig[#1]{%
+ \@ifnextchar [%
+ {\@memsubfloat{sub\@captype}[#1]}%
+ {\@memsubfloat{sub\@captype}[\@empty #1][#1]}}
+
+\def\@memsubfloat#1[#2][#3]#4{%
+ \@tempcnta=\@ne
+ \if@tightsubcap
+ \if@minipage
+ \@tempcnta=\z@
+ \else
+ \ifdim\lastskip=\z@
+ \@tempcnta=\@ne
+ \else
+ \@tempcnta=\tw@
+ \fi
+ \fi
+ \fi
+ \if@contbotsub
+ \def\subfig@top{\subfloattopskip}%
+ \def\subfig@bottom{\subfloatbottomskip}%
+ \else
+ \def\subfig@top{\subfloatbottomskip}%
+ \def\subfig@bottom{\subfloattopskip}%
+ \fi
+ \setbox\@tempboxa \hbox{#4}%
+ \@tempdima=\wd\@tempboxa
+ \vtop\bgroup
+ \vbox\bgroup
+ \ifcase\@tempcnta
+ \@minipagefalse
+ \or
+ \vspace{\subfig@top}
+ \or
+ \ifdim \lastskip=\z@ \else
+ \@tempskipb\subfig@top\@xaddvskip
+ \fi
+ \fi
+ \if@contbotsub
+ \box\@tempboxa\egroup
+ \ifx \@empty#3\relax \else
+ \vskip\subfloatcapskip
+ \@memsubcaption{#1}{#2}{#3}%
+ \fi
+ \else
+ \ifx \@empty#3\relax \else
+ \@memsubcaption{#1}{#2}{#3}%
+ \vskip\subfloatcapskip
+ \vskip\subfloatcaptopadj
+ \fi\egroup
+ \box\@tempboxa
+ \fi
+ \vspace{\subfig@bottom}
+ \egroup
+\egroup}
+
+\newcommand*{\@memsubfigcaptionlist}{}
+\newcommand*{\memlistsubcaptions}{%
+ \@ifstar
+ {\gdef\@memsubfigcaptionlist{}}%
+ {\@memlistsubcaptions{\@captype}}}
+
+\newcommand*{\@memlistsubcaptions}[1]{%
+ \@ifundefined{@captype}{}{%
+ \@ifundefined{ext@sub#1}{}{%
+ \@for \@tempa:=\@memsubfigcaptionlist \do {%
+ \ifx \@empty\@tempa\relax \else
+ \addcontentsline{\@nameuse{ext@sub#1}}{sub#1}{\@tempa}%
+ \fi}}}%
+ \gdef\@memsubfigcaptionlist{}}
+
+\newcommand{\@makesubfloatcaption}[2]{%
+ \setbox\@tempboxa\hbox{%
+ \@subcapsize
+ {\@subcaplabelfont #1}{\@subcapfont\ignorespaces #2}}%
+ \@tempdimb=-\subfloatcapmargin
+ \multiply\@tempdimb\tw@
+ \advance\@tempdimb\@tempdima
+ \hb@xt@\@tempdima{%
+ \hss
+ \ifdim \wd\@tempboxa >\@tempdimb
+ \memsubfig@caption{#1}{#2}%
+ \else
+ \if@shortsubcap
+ \memsubfig@caption{#1}{#2}%
+ \else
+ \box\@tempboxa
+ \fi
+ \fi
+ \hss}}
+
+\newcommand{\memsubfig@caption}[2]{%
+ \if@hangsubcap
+ \sbox{\@tempboxa}{\@subcapsize\@subcaplabelfont #1}%
+ \addtolength{\@tempdimb}{-\wd\@tempboxa}%
+ \usebox{\@tempboxa}%
+ \memsubfig@captionpar{\@tempdimb}{%
+ {\@subcapfont\ignorespaces #2}}%
+ \else
+ \memsubfig@captionpar{\@tempdimb}{{\@subcaplabelfont #1}%
+ {\@subcapfont\ignorespaces #2}}%
+ \fi}
+
+\newcommand{\memsubfig@captionpar}[2]{%
+ \parbox[t]{#1}{\@subcapsize\@contsubcstyle #2}}
+
+\newcommand{\memsub@label}{%
+ \@ifnextchar (%
+ {\sf@memsub@label}%
+ {\sf@memsub@label(Sub\@captype\space
+ \@nameuse{p@sub\@captype}%
+ \@nameuse{thesub\@captype})}}
+\def\sf@memsub@label(#1)#2{%
+ \protected@edef\mem@currentlabelname{#1}%
+ \sf@@memsub@label{#2}}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{nameref}{%
+ \newcommand*{\sf@@memsub@label}[1]{%
+ \@bsphack
+ \protected@write\@auxout{}{%
+ \string\newlabel{#1}%
+ {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \protected@write\@auxout{}{%
+ \string\newlabel{sub@#1}%
+ {{\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \@esphack}
+ }{\@ifpackageloaded{hyperref}{%
+ \newcommand*{\sf@@memsub@label}[1]{%
+ \@bsphack
+ \protected@write\@auxout{}{%
+ \string\newlabel{#1}%
+ {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \protected@write\@auxout{}{%
+ \string\newlabel{sub@#1}%
+ {{\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \@esphack}
+ }{%
+ \let\@memoldlabel\label
+ \newcommand*{\sf@@memsub@label}[1]{%
+ \@bsphack
+ \@memoldlabel{#1}%
+ \protected@write\@auxout{}{%
+ \string\newlabel{sub@#1}%
+ {{\@nameuse{@@thesub\@captype}}%
+ {\thepage}}}%
+ \@esphack}
+ }{}%
+ }
+}
+
+\newcommand*{\subcaptionref}{%
+ \@ifstar{\ssc@ref}{\sc@ref}}
+\newcommand*{\ssc@ref}[1]{\ref{sub@#1}}
+\newcommand*{\sc@ref}[1]{{\@subcaplabelfont\ref{sub@#1}}}
+
+\newsavebox{\m@mscap@capbox}
+\newsavebox{\m@mscap@fbox}
+
+\newdimen\sidecapsep
+ \sidecapsep=\marginparsep
+\newdimen\sidecapwidth
+ \sidecapwidth=\marginparwidth
+\newcommand*{\setsidecaps}[2]{%
+ \setlength{\sidecapsep}{#1}\@memznegtest{\sidecapsep}%
+ \setlength{\sidecapwidth}{#2}\@memznegtest{\sidecapwidth}}
+
+\newdimen\m@m@tempdima
+\newdimen\m@mscapraise
+\newdimen\sidecapraise
+ \sidecapraise \z@
+
+\newcommand*{\setsidecappos}[1]{%
+ \def\m@mscappos{#1}\def\@tempb{t}%
+ \ifx\@tempb\m@mscappos
+ \else
+ \def\@tempb{b}%
+ \ifx\@tempb\m@mscappos
+ \else
+ \def\@tempb{c}%
+ \ifx\@tempb\m@mscappos
+ \else
+ \@memerror{Argument to \string\setsidecappos\space is not t or c or b.
+ \MessageBreak Set to c}{\@ehc}%
+ \def\m@mscappos{c}%
+ \fi
+ \fi
+ \fi}
+\setsidecappos{c}
+
+\newcommand{\sidecapmargin}[1]{%
+ \def\@tempa{#1}\def\@tempb{left}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{0}% left
+ \else
+ \def\@tempb{right}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{1}% right
+ \else
+ \def\@tempb{outer}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{2}% outer
+ \else
+ \def\@tempb{inner}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{3}% inner
+ \else
+ \@memerror{Unrecognized argument for \string\sidecapmargin}%
+ {\@ehc}%
+ \def\m@mscapmarg{-1}% error
+ \fi
+ \fi
+ \fi
+ \fi}
+\sidecapmargin{left}
+
+\newif\ifscapmargleft
+
+\def\sidecapfloatwidth{\linewidth}
+\newdimen\m@mscapmainwidth
+
+\newdimen\m@mscaplkern
+\newcommand*{\setm@mscaplkern}{%
+ \m@mscaplkern=\sidecapwidth
+ \advance\m@mscaplkern \sidecapsep
+ \advance\m@mscaplkern \m@mscapmainwidth}
+
+\newcommand*{\sidecapstyle}{%
+%%% \captionnamefont{\bfseries}%
+ \ifscapmargleft
+ \captionstyle{\raggedleft}%
+ \else
+ \captionstyle{\raggedright}%
+ \fi}
+
+\newcommand*{\sidecaption}{%
+ \@ifnextchar [{\@sidecaption}{\@sidecaption[]}}
+\def\@sidecaption[#1]#2{%
+ \@ifnextchar [{\@@sidecaption{#1}{#2}}{\@@sidecaption{#1}{#2}[]}}
+\newcommand\@mem@scap@beforehook{}
+\newcommand\@mem@scap@afterhook{}
+
+\def\@@sidecaption#1#2[#3]{%
+ \ifx\@empty#1\@empty
+ \def\m@mscap@fortoc{#2}%
+ \else
+ \def\m@mscap@fortoc{#1}%
+ \fi
+ \def\m@mscap@forcap{#2}%
+ \ifx\@empty#3\@empty
+ \def\m@mscaplabel{}%
+ \else
+ \def\m@mscaplabel{\@bsphack\label{#3}\@esphack}%
+ \fi
+ \m@mscapstart@fbox}
+
+\newcommand*{\m@mscapstart@fbox}{%
+ \@mem@scap@beforehook%
+ \setlength{\m@mscapmainwidth}{\sidecapfloatwidth}%
+ \setm@mscaplkern
+ \begin{lrbox}{\m@mscap@fbox}%
+ \begin{minipage}[c]{\m@mscapmainwidth}}
+\newcommand*{\m@mscapend@fbox}{%
+ \end{minipage}%
+ \end{lrbox}}
+
+\def\endsidecaption{%
+ \m@mscapend@fbox
+ \refstepcounter\@captype
+ \m@mscaplabel
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+\newcommand*{\m@mscapopboxes}{%
+ \m@mcalcscapraise
+ \usebox{\m@mscap@fbox}\m@mscapcheckside
+ \ifscapmargleft%
+ \rlap{\kern-\m@mscaplkern
+ \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}%
+ \else%
+ \rlap{\kern\sidecapsep
+ \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}%
+ \fi
+ \gdef\m@mscapthisside{}%
+ \@mem@scap@afterhook%
+}
+
+\newcommand*{\m@mcalcscapraise}{%
+ \def\@tempb{t}%
+ \ifx\m@mscappos\@tempb
+ \settoheight{\m@m@tempdima}{\strut\usebox{\m@mscap@capbox}}%
+ \settoheight{\m@mscapraise}{\usebox{\m@mscap@fbox}}%
+ \advance\m@mscapraise -\m@m@tempdima
+ \advance\m@mscapraise 0.5ex
+ \else
+ \def\@tempb{b}%
+ \ifx\m@mscappos\@tempb
+ \settodepth{\m@m@tempdima}{\usebox{\m@mscap@fbox}}%
+ \settodepth{\m@mscapraise}{\strut\usebox{\m@mscap@capbox}}%
+ \advance\m@mscapraise -\m@m@tempdima
+ \else
+ \m@mscapraise=\z@
+ \advance\m@mscapraise 0.25ex
+ \fi
+ \fi
+ \advance\m@mscapraise \sidecapraise}
+
+\newcommand*{\m@mscapcheckside}{%
+ \if@twocolumn
+ \ifdim\hsize=\textwidth% float*
+ \m@mscapcheckregside
+ \else
+ \if@firstcolumn
+ \scapmarglefttrue
+ \else
+ \scapmargleftfalse
+ \fi
+ \fi
+ \else
+ \m@mscapcheckregside
+ \fi
+ \m@mscapthisside}
+\newcommand*{\m@mscapcheckregside}{%
+ \if@twoside
+ \checkoddpage
+ \ifnum\m@mscapmarg<\@ne% % left
+ \scapmarglefttrue
+ \else
+ \ifnum\m@mscapmarg=\@ne% % right
+ \scapmargleftfalse
+ \else
+ \ifnum\m@mscapmarg=\tw@% % outer
+ \scapmarglefttrue
+ \ifoddpage
+ \scapmargleftfalse
+ \fi
+ \else% % inner
+ \scapmargleftfalse
+ \ifoddpage
+ \scapmarglefttrue
+ \fi
+ \fi
+ \fi
+ \fi
+ \else% oneside
+ \scapmarglefttrue
+ \ifnum\m@mscapmarg>\@ne
+ \ifnum\m@mscapmarg<\thr@@
+ \scapmargleftfalse
+ \fi
+ \fi
+ \fi}
+
+\newcommand*{\overridescapmargin}[1]{%
+ \def\@tempb{#1}\def\@tempa{left}%
+ \ifx\@tempa\@tempb
+ \def\m@mscapthisside{\scapmarglefttrue}%
+ \else
+ \def\@tempa{right}%
+ \ifx\@tempa\@tempb
+ \def\m@mscapthisside{\scapmargleftfalse}%
+ \else
+ \@memerror{Argument to \string\overridescapmargin\space neither
+ left nor right}{\@ehc}%
+ \def\m@mscapthisside{}%
+ \fi
+ \fi}
+\newcommand*{\m@mscapthisside}{}
+
+\newcommand*{\sidecontcaption}{%
+ \@sidecontcaption}
+\def\@sidecontcaption#1{%
+ \@ifnextchar [{\@@sidecontcaption{#1}}{\@@sidecontcaption{#1}[]}}
+\def\@@sidecontcaption#1[#2]{%
+ \def\m@mscap@forcap{#1}%
+ \ifx\@empty#2\@empty
+ \def\m@mscaplabel{}%
+ \else
+ \def\m@mscaplabel{\@bsphack\label{#2}\@esphack}%
+ \fi
+ \m@mscapstart@fbox}
+
+\def\endsidecontcaption{%
+ \m@mscapend@fbox
+ \addtocounter{\@captype}{\m@ne}\refstepcounter\@captype
+ \m@mscaplabel
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \@contcaption\@captype{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+
+\newcommand*{\sidenamedlegend}{%
+ \@ifnextchar [{\@sidenamedlegend}{\@sidenamedlegend[]}}
+\def\@sidenamedlegend[#1]#2{%
+ \@@sidenamedlegend{#1}{#2}}
+\def\@@sidenamedlegend#1#2{%
+ \ifx\@empty#1\@empty
+ \def\m@mscap@fortoc{#2}%
+ \else
+ \def\m@mscap@fortoc{#1}%
+ \fi
+ \def\m@mscap@forcap{#2}%
+ \def\m@mscaplabel{}%
+ \m@mscapstart@fbox}
+
+\def\endsidenamedlegend{%
+ \m@mscapend@fbox
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \@legend\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+
+\newcommand*{\sidelegend}{%
+ \@@sidelegend}
+\def\@@sidelegend#1{%
+ \def\m@mscap@forcap{#1}%
+ \m@mscapstart@fbox}
+
+\def\endsidelegend{%
+ \m@mscapend@fbox
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \legend{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+
+\newlength{\beforeepigraphskip}
+ \setlength{\beforeepigraphskip}{.5\baselineskip}
+\newlength{\afterepigraphskip}
+ \setlength{\afterepigraphskip}{.5\baselineskip}
+\newlength{\epigraphwidth}
+ \setlength{\epigraphwidth}{.4\textwidth}
+\newlength{\epigraphrule}
+ \setlength{\epigraphrule}{.4\p@}
+\newcommand{\epigraphsize}{\small}
+\newcommand{\epigraphflush}{flushright}
+\newcommand{\textflush}{flushleft}
+\newcommand{\sourceflush}{flushright}
+\newcommand{\epigraphfontsize}[1]{\def\epigraphsize{#1}}
+\newcommand{\epigraphposition}[1]{\long\def\epigraphflush{#1}}
+\newcommand{\epigraphtextposition}[1]{\def\textflush{#1}}
+\newcommand{\epigraphsourceposition}[1]{\def\sourceflush{#1}}
+
+\newcommand{\@epirule}{\rule[.5ex]{\epigraphwidth}{\epigraphrule}}
+\newcommand{\@epitext}[1]{%
+ \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\par
+ \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex} \fi
+ \end{\textflush}\end{minipage}}
+\newcommand{\@episource}[1]{%
+ \begin{minipage}{\epigraphwidth}
+ \begin{\sourceflush} #1\par
+ \end{\sourceflush}\end{minipage}}
+
+\newcommand{\epigraph}[2]{\vspace{\beforeepigraphskip}
+ {\epigraphsize\begin{\epigraphflush}\begin{minipage}{\epigraphwidth}
+ \@epitext{#1}\\ \@episource{#2}
+ \end{minipage}\end{\epigraphflush}
+ \vspace{\afterepigraphskip}}}
+\newcommand{\qitem}[2]{{%
+ \raggedright\item \begin{minipage}{\epigraphwidth}
+ \@epitext{#1}\\ \@episource{#2}
+ \end{minipage}}}
+\newcommand{\qitemlabel}[1]{\hfill}
+\newenvironment{epigraphs}{%
+ \vspace{\beforeepigraphskip}\begin{\epigraphflush}
+ \epigraphsize
+ \begin{minipage}{\epigraphwidth}
+ \list{}%
+ {\itemindent\z@ \labelwidth\z@ \labelsep\z@
+ \leftmargin\z@ \rightmargin\z@
+ \let\makelabel\qitemlabel}}%
+ {\endlist\end{minipage}\end{\epigraphflush}
+ \vspace{\afterepigraphskip}}
+\newcommand{\dropchapter}[1]{%
+ \let\@epichapapp\@chapapp
+ \renewcommand{\@chapapp}{\vspace*{#1}\@epichapapp}}
+\newcommand{\undodrop}{\let\@chapapp\@epichapapp}
+\newif\if@epirhs \@epirhstrue
+\newif\if@epicenter \@epicentertrue
+\newcommand{\@epipos}{
+ \long\def\@ept{flushleft}
+ \ifx\epigraphflush\@ept
+ \@epirhsfalse \@epicenterfalse
+ \else
+ \long\def\@ept{center}
+ \ifx\epigraphflush\@ept
+ \@epirhsfalse \@epicentertrue
+ \else
+ \@epirhstrue \@epicenterfalse
+ \fi
+ \fi}
+\newcommand{\epigraphhead}[2][95]{%
+ \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}}
+ \def\ps@epigraph{\let\@mkboth\@gobbletwo
+ \@epipos
+ \if@epirhs
+ \def\@oddhead{\hfil\begin{picture}(0,0)
+ \put(0,-#1){\makebox(0,0)[r]{\@epitemp}}
+ \end{picture}}
+ \else
+ \if@epicenter
+ \def\@oddhead{\hfil\begin{picture}(0,0)
+ \put(0,-#1){\makebox(0,0)[b]{\@epitemp}}
+ \end{picture}\hfil}
+ \else
+ \def\@oddhead{\begin{picture}(0,0)
+ \put(0,-#1){\makebox(0,0)[l]{\@epitemp}}
+ \end{picture}\hfil}
+ \fi
+ \fi
+ \let\@evenhead\@oddhead
+ \def\@oddfoot{\reset@font\hfil\thepage\hfil}
+ \let\@evenfoot\@oddfoot}
+ \thispagestyle{epigraph}}
+
+\newcommand{\the@epigraph}{}
+\newcommand{\@epidrop}{95}
+\newcommand{\epigraphforheader}[2][95]{%
+ \def\@epidrop{#1}\long\def\the@epigraph{#2}}
+
+\newcommand{\epigraphpicture}{%
+ \def\@epitemp{%
+ \begin{minipage}{\epigraphwidth}\the@epigraph\end{minipage}}%
+ \@epipos
+ \if@epirhs
+ \begin{picture}(0,0)%
+ \put(0,-\@epidrop){\makebox(0,0)[r]{\@epitemp}}%
+ \end{picture}%
+ \else
+ \if@epicenter
+ \begin{picture}(0,0)%
+ \put(0,-\@epidrop){\makebox(0,0)[b]{\@epitemp}}%
+ \end{picture}%
+ \else
+ \begin{picture}(0,0)%
+ \put(0,-\@epidrop){\makebox(0,0)[l]{\@epitemp}}%
+ \end{picture}%
+ \fi
+ \fi}
+
+\newcommand*{\@memoldfonterr}[3]{%
+ \@memerror{Font command \protect#1\space is not supported}{%
+ Use \protect#2, or \protect#3{...}, or the oldfontcommands option}}
+\newcommand*{\@memoldfontwarn}[3]{%
+ \@memwarn{The \protect#1\space font command is deprecated.
+ \MessageBreak Use \protect#2{...} or {\protect#3... } instead}}
+
+\if@memoldfont
+ \def\@mem@rmwarn{\@memoldfontwarn{\rm}{\textrm}{\rmfamily}}
+ \DeclareOldFontCommand{\rm}{\@mem@rmwarn\gdef\@mem@rmwarn{}%
+ \normalfont\rmfamily}{\mathrm}
+\else
+ \def\rm{\@memoldfonterr{\rm}{\textrm}{\rmfamily}}
+\fi
+
+\if@memoldfont
+ \def\@mem@sfwarn{\@memoldfontwarn{\sf}{\textsf}{\sffamily}}
+ \DeclareOldFontCommand{\sf}{\@mem@sfwarn\gdef\@mem@sfwarn{}%
+ \normalfont\sffamily}{\mathsf}
+\else
+ \def\sf{\@memoldfonterr{\sf}{\textsf}{\sffamily}}
+\fi
+
+\if@memoldfont
+ \def\@mem@ttwarn{\@memoldfontwarn{\tt}{\texttt}{\ttfamily}}
+ \DeclareOldFontCommand{\tt}{\@mem@ttwarn\gdef\@mem@ttwarn{}%
+ \normalfont\ttfamily}{\mathtt}
+\else
+ \def\tt{\@memoldfonterr{\tt}{\texttt}{\ttfamily}}
+\fi
+
+\if@memoldfont
+ \def\@mem@bfwarn{\@memoldfontwarn{\bf}{\textbf}{\bfseries}}
+ \DeclareOldFontCommand{\bf}{\@mem@bfwarn\gdef\@mem@bfwarn{}%
+ \normalfont\bfseries}{\mathbf}
+\else
+ \def\bf{\@memoldfonterr{\bf}{\textbf}{\bfseries}}
+\fi
+
+\if@memoldfont
+ \def\@mem@itwarn{\@memoldfontwarn{\it}{\textit}{\itshape}}
+ \DeclareOldFontCommand{\it}{\@mem@itwarn\gdef\@mem@itwarn{}%
+ \normalfont\itshape}{\mathit}
+\else
+ \def\it{\@memoldfonterr{\it}{\textit}{\itshape}}
+\fi
+
+\if@memoldfont
+ \def\@mem@slwarn{\@memoldfontwarn{\sl}{\textsl}{\slshape}}
+ \DeclareOldFontCommand{\sl}{\@mem@slwarn\gdef\@mem@slwarn{}%
+ \normalfont\slshape}{\@nomath\sl}
+\else
+ \def\sl{\@memoldfonterr{\sl}{\textsl}{\slshape}}
+\fi
+
+\if@memoldfont
+ \def\@mem@scwarn{\@memoldfontwarn{\sc}{\textsc}{\scshape}}
+ \DeclareOldFontCommand{\sc}{\@mem@scwarn\gdef\@mem@scwarn{}%
+ \normalfont\scshape}{\@nomath\sc}
+\else
+ \def\sc{\@memoldfonterr{\sc}{\textsc}{\scshape}}
+\fi
+
+\if@memoldfont
+ \def\@mem@calwarn{%
+ \@memwarn{The \protect\cal\space font command is deprecated.
+ \MessageBreak Try to use \protect\mathcal\space instead}}
+ \DeclareRobustCommand*\cal{\@mem@calwarn\gdef\@mem@calwarn{}%
+ \@fontswitch\relax\mathcal}
+\else
+ \def\cal{%
+ \@memerror{Font command \protect\cal\space is not supported}{%
+ Use \protect\mathcal, or the oldfontcommands option}}
+\fi
+
+\if@memoldfont
+ \def\@mem@mitwarn{%
+ \@memwarn{The \protect\mit\space font command is deprecated.
+ \MessageBreak Try to use \protect\mathnormal\space instead}}
+ \DeclareRobustCommand*\mit{\@mem@mitwarn\gdef\@mem@mitwarn{}%
+ \@fontswitch\relax\mathnormal}
+\else
+ \def\mit{%
+ \@memerror{Font command \protect\mit\space is not supported}{%
+ Use \protect\mathnormal, or the oldfontcommands option}}
+\fi
+
+\DeclareRobustCommand{\em}{%
+ \@nomath\em
+ \ifdim\fontdimen\@ne\font > \z@
+ \eminnershape
+ \else
+ \itshape
+ \fi}
+\providecommand{\eminnershape}{\upshape}
+\DeclareTextFontCommand{\emph}{\em}
+
+\newcommand*{\fref}[1]{\figurerefname~\ref{#1}}
+\newcommand*{\tref}[1]{\tablerefname~\ref{#1}}
+\newcommand*{\pref}[1]{\pagerefname~\pageref{#1}}
+\newcommand*{\Aref}[1]{\appendixrefname\ref{#1}}
+\newcommand*{\Bref}[1]{\bookrefname\ref{#1}}
+\newcommand*{\Pref}[1]{\partrefname\ref{#1}}
+\newcommand*{\Cref}[1]{\chapterrefname\ref{#1}}
+\newcommand*{\Sref}[1]{\sectionrefname\ref{#1}}
+
+\newif\ifheadnameref
+\newcommand*{\headnameref}{\headnamereftrue}
+\newcommand*{\tocnameref}{\headnamereffalse}
+ \tocnameref
+\newcommand{\theTitleReference}[2]{#2}
+
+\let\@mem@old@label\label
+\def\label#1{\@bsphack\begingroup
+ \protected@edef\@currentlabel{\protect\M@TitleReference
+ {\@currentlabel}{\M@currentTitle}}%
+ \@mem@old@label{#1}%
+ \endgroup \@esphack}%
+
+\def\@mem@@gettitle#1{\begingroup \let\protect\@unexpandable@protect
+ \let\label\@mem@nestwarn
+ \let\index\@gobble \let\glossary\@gobble
+ \let\markboth\@gobbletwo \let\@mkboth\@gobbletwo
+ \let\markright\@gobble
+ \edef\@tempa{\noexpand\def\noexpand\M@currentTitle{#1}}%
+ \expandafter\endgroup\@tempa}
+
+\let\@mem@nestwarn\@gobble
+\let\M@TitleReference\@firstoftwo
+
+\newcommand*\@mem@titleref[1]{\begingroup
+ \let\numberline\@gobble
+ \let\M@TitleReference\@mem@theTR % interrupt recursion of \ref
+ \ref{#1}\endgroup}
+\let\@mem@titlerefnolink\@mem@titleref
+
+\DeclareRobustCommand\titleref{\@ifstar{\@mem@titlerefnolink}{\@mem@titleref}}
+
+\DeclareRobustCommand{\currenttitle}{\begingroup
+ \let\numberline\@gobble
+ \theTitleReference\@currentlabel\M@currentTitle\endgroup}
+
+\let\M@currentTitle\@empty
+
+\def\@mem@theTR{\let\M@TitleReference\@firstoftwo \theTitleReference}
+
+\newcommand*{\namerefon}{\let\M@gettitle\@mem@@gettitle}
+\newcommand*{\namerefoff}{\let\M@gettitle\@gobble}
+ \namerefon
+\newcommand{\@pnumwidth}{1.55em}
+\newcommand{\@tocrmarg} {2.55em}
+\newcommand{\@dotsep}{4.5}
+\newlength{\tocentryskip} \setlength{\tocentryskip}{1em}
+\newlength{\tocbaseline} \setlength{\tocbaseline}{20pt}
+\newcommand{\tocskip}[1]{%
+ \addtocontents{toc}{\protect\vspace{#1}}}
+\newcommand*{\ensureonecol}{%
+ \if@twocolumn
+ \@restonecoltrue\onecolumn
+ \else
+ \@restonecolfalse
+ \fi}
+\newcommand*{\restorefromonecol}{\if@restonecol\twocolumn\fi}
+
+\newlength{\cftparskip}
+\setlength{\cftparskip}{0pt}
+
+\newcommand{\newlistof}[3]{%
+ \@namedef{ext@#2}{#2}
+ \@ifundefined{c@#2depth}{\newcounter{#2depth}}{}
+ \setcounter{#2depth}{1}
+ \@namedef{#2mark}{\markboth{#3}{#3}}
+ \@namedef{#1}{\@ifstar{\@nameuse{@star#2}}{\@nameuse{@plain#2}}}
+ \@namedef{@star#2}{%
+ \ensureonecol
+ \par
+ \begingroup
+%%% \parindent\z@ \parskip\cftparskip
+ \@nameuse{@#2maketitle}
+\parskip\cftparskip
+ \@starttoc{#2}%
+ \endgroup
+ \restorefromonecol}
+ \@namedef{@plain#2}{%
+ \ensureonecol
+ \par
+ \begingroup
+%%% \parindent\z@ \parskip\cftparskip
+ \@nameuse{@#2maketitle}
+ \phantomsection
+ \addcontentsline{toc}{chapter}{#3}
+\parskip\cftparskip
+ \@starttoc{#2}%
+ \endgroup
+ \restorefromonecol}
+ \@namedef{@#2maketitle}{%
+ \@nameuse{#2headstart}
+ {\parindent\z@
+%%%% \parskip\cftparskip
+ \interlinepenalty\@M
+ \@nameuse{print#2nonum}%
+ \@nameuse{print#2title}{#3}%
+ \@nameuse{#2mark}%
+ \thispagestyle{chapter}%
+ \@nameuse{after#2title}
+ }
+ \@afterheading}
+ \@namedef{#2headstart}{\chapterheadstart}
+ \@namedef{after#2title}{\afterchaptertitle}
+ \@namedef{print#2nonum}{\printchapternonum}
+ \@namedef{print#2title}##1{\printchaptertitle{##1}}
+} % end \newlistof
+
+\renewcommand{\@starttoc}[1]{%
+ \begingroup\makeatletter
+ \@input{\jobname.#1}%
+ \if@filesw
+ \AtEndDocument{%
+ \expandafter\newwrite\csname tf@#1\endcsname
+ \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+ }%
+ \fi
+ \@nobreakfalse
+ \endgroup}
+
+\newlistof{tableofcontents}{toc}{\contentsname}
+\newcommand*{\setpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}}
+\newcommand*{\setrmarg}[1]{\renewcommand{\@tocrmarg}{#1}}
+\providecommand{\cftdot}{.}
+\providecommand{\cftdotfill}[1]{%
+ \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill}
+\providecommand{\cftdotsep}{4.5}
+\newcommand{\cftnodots}{2000}
+\newcommand*{\cftparfillskip}{\parfillskip=0pt plus1fil}
+\newcommand*{\@cftn@me}{}
+
+\renewcommand*{\numberline}[1]{%
+ \hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
+\newcommand{\@cftbsnum}{}
+\newcommand{\@cftasnum}{}
+\newcommand{\@cftasnumb}{}
+\newcommand{\newlistentry}[4][\@empty]{%
+ \@ifundefined{c@#2}{% check & set the counter
+ \ifx \@empty#1\relax
+ \newcounter{#2}
+ \else
+ \newcounter{#2}[#1]%
+ \expandafter\edef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}
+ \fi}{}
+ \setcounter{#2}{0}
+ \@namedef{l@#2}##1##2{%
+ \ifnum \@nameuse{c@#3depth} > #4\relax
+ \vskip \@nameuse{cftbefore#2skip}
+ {\if@RTL\rightskip\else\leftskip\fi \@nameuse{cft#2indent}\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \settowidth{\@tempdima}{\@nameuse{cft#2font}\@nameuse{cft#2name}}%
+ \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}%
+ \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
+ \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
+ \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
+ \expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\@nameuse{cft#2font}##1}\nobreak
+ \@nameuse{cft#2fillnum}{##2}}
+ \fi
+ } % end of \l@#2
+
+ \expandafter\newlength\csname cftbefore#2skip\endcsname
+ \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
+ \expandafter\newlength\csname cft#2indent\endcsname
+ \expandafter\newlength\csname cft#2numwidth\endcsname
+ \ifcase #4\relax % 0 (level 1)
+ \setlength{\@nameuse{cft#2indent}}{0em}
+ \setlength{\@nameuse{cft#2numwidth}}{2.3em}
+ \or % 1 (level 2)
+ \setlength{\@nameuse{cft#2indent}}{2.3em}
+ \setlength{\@nameuse{cft#2numwidth}}{3.2em}
+ \or % 2 (level 3)
+ \setlength{\@nameuse{cft#2indent}}{5.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{4.1em}
+ \or % 3 (level 4)
+ \setlength{\@nameuse{cft#2indent}}{8.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{5.0em}
+ \else % anything else
+ \setlength{\@nameuse{cft#2indent}}{10.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{6.0em}
+ \fi
+ \@namedef{cft#2font}{\normalfont}
+ \@namedef{cft#2name}{}
+ \@namedef{cft#2presnum}{}
+ \@namedef{cft#2aftersnum}{}
+ \@namedef{cft#2aftersnumb}{}
+ \@namedef{cft#2dotsep}{\cftdotsep}
+ \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
+ \@namedef{cft#2pagefont}{\normalfont}
+ \@namedef{cft#2afterpnum}{}
+ \@namedef{toclevel@#2}{#4}
+ \@namedef{cft#2formatpnum}##1{%
+ \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}}
+ \@namedef{cft#2fillnum}##1{%
+ {\@nameuse{cft#2leader}}\nobreak
+%%% \hb@xt@\@pnumwidth{%
+%%% \hfil\@nameuse{cft#2pagefont}##1}
+ \@nameuse{cft#2formatpnum}{##1}%
+ \@nameuse{cft#2afterpnum}\par}
+} % end \newlistentry
+
+\newcommand*{\cftsetindents}[3]{%
+ \setlength{\@nameuse{cft#1indent}}{#2}
+ \setlength{\@nameuse{cft#1numwidth}}{#3}}
+
+\newcommand*{\cftbookname}{}
+
+\newcommand*{\cftbookbreak}{\addpenalty{-\@highpenalty}%
+ \addvspace{\cftbeforebookskip}}
+\newcommand*{\l@book}[2]{%
+ \ifnum\c@tocdepth >-3\relax
+%% \addpenalty{-\@highpenalty}%
+ \cftbookbreak
+%% \addvspace{\cftbeforebookskip}%
+ \begingroup
+ {\if@RTL\rightskip\else\leftskip\fi \cftbookindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftbookindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \settowidth{\@tempdima}{\cftbookfont\cftbookname}%
+ \addtolength{\@tempdima}{\cftbooknumwidth}%
+ \let\@cftbsnum \cftbookpresnum
+ \let\@cftasnum \cftbookaftersnum
+ \let\@cftasnumb \cftbookaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftbookfont #1}%
+ \cftbookfillnum{#2}}
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\newcommand{\booknumberline}[1]{%
+ \hb@xt@\@tempdima{%
+ \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}%%\space}
+
+\newlength{\cftbeforebookskip}
+ \setlength{\cftbeforebookskip}{2.25em \@plus\p@}
+\newdimen\cftbookindent
+ \setlength{\cftbookindent}{0em}
+\newdimen\cftbooknumwidth
+ \setlength{\cftbooknumwidth}{1.5em}
+\newcommand*{\cftbookfont}{\large\bfseries}
+\newcommand*{\cftbookpresnum}{}
+\newcommand*{\cftbookaftersnum}{}
+\newcommand*{\cftbookaftersnumb}{}
+\newcommand*{\cftbookleader}{%
+ \large\bfseries\cftdotfill{\cftbookdotsep}}
+\newcommand*{\cftbookdotsep}{\cftnodots}
+\newcommand*{\cftbookpagefont}{\large\bfseries}
+\newcommand{\cftbookafterpnum}{}
+\newcommand{\cftbookfillnum}[1]{%
+ {\cftbookleader}%
+%%%% {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}%
+ \cftbookformatpnum{#1}%
+ \cftbookafterpnum\par}
+\newcommand{\cftbookformatpnum}[1]{%
+ \hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}
+
+\newcommand*{\cftpartname}{}
+
+\newcommand*{\cftpartbreak}{\addpenalty{-\@highpenalty}%
+ \addvspace{\cftbeforepartskip}}
+\newcommand*{\l@part}[2]{%
+ \ifnum \c@tocdepth >-2\relax
+%%% \addpenalty{-\@highpenalty}%
+%%% \addvspace{\cftbeforepartskip}%
+ \cftpartbreak
+ \begingroup
+ {\if@RTL\rightskip\else\leftskip\fi \cftpartindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftpartindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \settowidth{\@tempdima}{\cftpartfont\cftpartname}%
+ \addtolength{\@tempdima}{\cftpartnumwidth}%
+ \let\@cftbsnum \cftpartpresnum
+ \let\@cftasnum \cftpartaftersnum
+ \let\@cftasnumb \cftpartaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftpartfont #1}%
+ \cftpartfillnum{#2}}
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+
+\newcommand*{\toclevel@part}{-1}
+
+\newcommand{\partnumberline}[1]{%
+ \hb@xt@\@tempdima{%
+ \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}%%\space}
+
+ \newlength{\cftbeforepartskip}
+ \setlength{\cftbeforepartskip}{2.25em \@plus\p@}
+ \newlength{\cftpartindent}
+ \setlength{\cftpartindent}{0em}
+ \newlength{\cftpartnumwidth}
+ \setlength{\cftpartnumwidth}{1.5em}
+ \newcommand{\cftpartfont}{\large\bfseries}
+ \newcommand{\cftpartpresnum}{}
+ \newcommand{\cftpartaftersnum}{}
+ \newcommand{\cftpartaftersnumb}{}
+ \newcommand{\cftpartleader}{%
+ \large\bfseries\cftdotfill{\cftpartdotsep}}
+ \newcommand{\cftpartdotsep}{\cftnodots}
+ \newcommand{\cftpartpagefont}{\large\bfseries}
+ \newcommand{\cftpartafterpnum}{}
+ \newcommand*{\cftpartformatpnum}[1]{%
+ \hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}}
+ \newcommand{\cftpartfillnum}[1]{%
+ {\cftpartleader}%
+ {\cftpartformatpnum{#1}}%
+ \cftpartafterpnum\par}
+
+\newcommand*{\cftchaptername}{}
+
+\newcommand*{\l@chapapp}[3]{%
+ \ifnum \c@tocdepth >\m@ne
+ \cftchapterbreak
+ \vskip \cftbeforechapterskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftchapterindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftchapterindent\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \let\@cftbsnum \cftchapterpresnum
+ \let\@cftasnum \cftchapteraftersnum
+ \let\@cftasnumb \cftchapteraftersnumb
+ \def\@chapapp@head{#3}%
+ \settowidth{\@tempdima}{\cftchapterfont\@chapapp@head}%
+ \addtolength{\@tempdima}{\cftchapternumwidth}%
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftchapterfont #1}\nobreak
+ \cftchapterfillnum{#2}}
+ \fi}
+
+\newcommand*{\l@chapter}[2]{%
+ \l@chapapp{#1}{#2}{\cftchaptername}}
+
+\newcommand*{\toclevel@chapter}{0}
+
+\newcommand*{\cftappendixname}{}
+
+\newcommand*{\l@appendix}[2]{%
+ \l@chapapp{#1}{#2}{\cftappendixname}}
+\newcommand{\toclevel@appendix}{0}
+
+\newcommand{\chapternumberline}[1]{%
+ \hb@xt@\@tempdima{\@chapapp@head\@cftbsnum #1\@cftasnum\hfil}%
+ \@cftasnumb}
+
+ \newlength{\cftbeforechapterskip}
+ \setlength{\cftbeforechapterskip}{1.0em \@plus\p@}
+ \newlength{\cftchapterindent}
+ \setlength{\cftchapterindent}{0em}
+ \newlength{\cftchapternumwidth}
+ \setlength{\cftchapternumwidth}{1.5em}
+ \newcommand{\cftchapterfont}{\bfseries}
+ \newcommand{\cftchapterpresnum}{}
+ \newcommand{\cftchapteraftersnum}{}
+ \newcommand{\cftchapteraftersnumb}{}
+ \newcommand{\cftchapterleader}{%
+ \bfseries\cftdotfill{\cftchapterdotsep}}
+ \newcommand{\cftchapterdotsep}{\cftnodots}
+ \newcommand{\cftchapterpagefont}{\bfseries}
+ \newcommand{\cftchapterafterpnum}{}
+ \newcommand*{\cftchapterformatpnum}[1]{%
+ \hb@xt@\@pnumwidth{\hfil\cftchapterpagefont #1}}
+ \newcommand*{\cftchapterfillnum}[1]{
+ {\cftchapterleader}\nobreak
+ \cftchapterformatpnum{#1}%
+ \cftchapterafterpnum\par}
+ \newcommand{\cftchapterbreak}{\addpenalty{-\@highpenalty}}
+
+\newlistentry[chapter]{section}{toc}{0}
+ \cftsetindents{section}{1.5em}{2.3em}
+\newlistentry[section]{subsection}{toc}{1}
+ \cftsetindents{subsection}{3.8em}{3.2em}
+\newlistentry[subsection]{subsubsection}{toc}{2}
+ \cftsetindents{subsubsection}{7.0em}{4.1em}
+\newlistentry[subsubsection]{paragraph}{toc}{3}
+ \cftsetindents{paragraph}{10.0em}{5.0em}
+\newlistentry[paragraph]{subparagraph}{toc}{4}
+ \cftsetindents{subparagraph}{12.0em}{6.0em}
+
+\newcommand*{\@cftl@subfigtab}{
+\newlistentry[figure]{subfigure}{lof}{1}
+ \cftsetindents{subfigure}{2.3em}{2.5em}
+\newlistentry[table]{subtable}{lot}{1}
+ \cftsetindents{subtable}{2.3em}{2.5em}}
+\renewcommand*{\@cftl@subfigtab}{}
+
+\AtBeginDocument{\@ifpackageloaded{subfigure}{\@cftl@subfigtab}{}}
+
+\DeclareRobustCommand{\cftpagenumbersoff}[1]{%
+ \@namedef{cft#1fillnum}##1{%
+ \cftparfillskip\@nameuse{cft#1afterpnum}\par}}
+
+\DeclareRobustCommand{\cftpagenumberson}[1]{%
+ \@namedef{cft#1fillnum}##1{%
+ \@nameuse{cft#1leader}\nobreak
+ \@nameuse{cft#1formatpnum}{##1}%
+ \@nameuse{cft#1afterpnum}\par}}
+
+\newcommand{\chapterprecis}[1]{%
+ \chapterprecishere{#1}
+ \chapterprecistoc{#1}}
+\newcommand{\chapterprecishere}[1]{%
+ \prechapterprecis #1\postchapterprecis}
+\newdimen\prechapterprecisshift
+\ifartopt
+ \prechapterprecisshift=0pt
+\else
+ \prechapterprecisshift=-2\baselineskip
+\fi
+\newcommand*{\precisfont}{\normalfont\itshape}
+\newcommand{\prechapterprecis}{%
+ \vspace*{\prechapterprecisshift}%
+ \begin{quote}\precisfont}
+\newcommand*{\postchapterprecis}{\end{quote}}
+
+\newcommand{\precistocfont}{\normalfont\itshape}
+\newcommand{\chapterprecistoc}[1]{%
+ \addtocontents{toc}{\precistoctext{#1}}}
+\DeclareRobustCommand{\precistoctext}[1]{%
+ {\nopagebreak\if@RTL\rightskip\else\leftskip\fi \cftchapterindent\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \cftchapternumwidth\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg\relax
+ \precistocfont #1\par}}
+\newcommand{\cftlocalchange}[3]{%
+ \addtocontents{#1}{\protect\setpnumwidth{#2} \protect\setrmarg{#3}}}
+\newcommand{\cftaddtitleline}[4]{%
+ \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}}}
+\newcommand{\cftaddnumtitleline}[5]{%
+ \addtocontents{#1}%
+ {\protect\contentsline{#2}{\protect\numberline{#3}%
+ {\protect\ignorespaces #4}}{#5}}}
+\newcommand*{\cftinsert}[1]{\@nameuse{cftinsert#1}}
+\newcommand{\cftinsertcode}[2]{\@namedef{cftinsert#1}{#2}}
+\newcommand*{\cftinserthook}[2]{%
+ \addtocontents{#1}{\protect\cftinsert\protect{#2\protect}}}
+
+\newcommand*{\@setclcnt}[2]{%
+ \@tempswafalse
+ \nametest{#1}{none}%
+ \ifsamename
+ \setcounter{#2}{-10}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{book}%
+ \ifsamename
+ \setcounter{#2}{-2}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{part}%
+ \ifsamename
+ \setcounter{#2}{-1}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{chapter}%
+ \ifsamename
+ \setcounter{#2}{0}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{section}%
+ \ifsamename
+ \setcounter{#2}{1}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsection}%
+ \ifsamename
+ \setcounter{#2}{2}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsubsection}%
+ \ifsamename
+ \setcounter{#2}{3}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{paragraph}%
+ \ifsamename
+ \setcounter{#2}{4}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subparagraph}%
+ \ifsamename
+ \setcounter{#2}{5}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{all}%
+ \ifsamename
+ \setcounter{#2}{50}%
+ \@tempswatrue
+ \fi
+ \if@tempswa\else
+ \@memerror{%
+ Unknown document division name (#1)
+ }{%
+ I'll ignore it.
+ Type \space <return> and I'll continue.\MessageBreak
+ If you haven't mistyped the name then use
+ \protect\setcounter\space instead.}%
+ \fi}
+
+\newcommand*{\settocdepth}[1]{%
+ \@tempswafalse
+ \nametest{#1}{none}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{-10}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{book}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{-2}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{part}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{-1}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{chapter}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{0}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{section}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{1}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsection}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{2}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsubsection}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{3}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{paragraph}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{4}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subparagraph}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{5}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{all}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{50}}%
+ \@tempswatrue
+ \fi
+ \if@tempswa
+ \@ifundefined{toclevel@#1}{%
+ \@memwarn{Unknown toclevel for #1}%
+ }{%
+ \setcounter{tocdepth}{\@nameuse{toclevel@#1}}%
+ }
+ \else
+ \@memerror{%
+ Unknown document division name (#1)
+ }{%
+ I'll ignore it.
+ Type \space <return> and I'll continue.}%
+ \fi}
+
+\newcommand*{\toclevel@none}{-10}
+\newcommand*{\toclevel@all}{50}
+
+\DeclareRobustCommand{\changetocdepth}[1]{\setcounter{tocdepth}{#1}}
+
+\newcommand{\maxtocdepth}[1]{%
+ \@setclcnt{#1}{tocdepth}}
+\newcounter{maxsecnumdepth}
+\newcommand{\maxsecnumdepth}[1]{%
+ \@setclcnt{#1}{secnumdepth}\@setclcnt{#1}{maxsecnumdepth}}
+
+\newcommand{\setsecnumdepth}[1]{%
+ \ifx\@nodocument\relax% after the preamble
+ \@setclcnt{#1}{secnumdepth}%
+ \else
+ \@setclcnt{#1}{secnumdepth}%
+ \@setclcnt{#1}{maxsecnumdepth}%
+ \fi}
+\setsecnumdepth{section}
+
+\newdimen\bibindent
+ \setlength\bibindent{1.5em}
+\newlength{\bibitemsep}
+ \setlength{\bibitemsep}{\itemsep}
+\newcommand{\biblistextra}{\itemsep=\bibitemsep}
+
+\newenvironment{bibitemlist}[1]{%
+ \typeout{bibitemlist}
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \leftmargin\labelwidth
+ \advance\leftmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}%
+ \biblistextra}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}%
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+
+\newcommand{\newblock}{\hskip .11em\@plus.33em\@minus.07em}
+\let\@openbib@code\@empty
+\newcommand*{\setbiblabel}[1]{%
+ \renewcommand*{\@biblabel}[1]{#1}}
+\setbiblabel{[#1]\hfill}
+\newcommand{\@memb@bchap}{%
+ \chapter*{\bibname}%
+ \bibmark
+ \ifnobibintoc\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\bibname}%
+ \fi
+ \prebibhook}
+\newcommand{\@memb@bsec}{\section{\bibname}\prebibhook}
+\newcommand{\bibsection}{\@memb@bchap}
+
+\newenvironment{thebibliography}[1]{%
+ \bibsection
+ \begin{bibitemlist}{#1}}{\end{bibitemlist}\postbibhook}
+\newif\ifnobibintoc
+\newcommand*{\bibintoc}{\nobibintocfalse}
+\newcommand*{\nobibintoc}{\nobibintoctrue}
+\bibintoc
+
+\newcommand{\prebibhook}{}
+\newcommand{\postbibhook}{}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{natbib}{% natbib is loaded
+ \addtodef{\endthebibliography}{}{\vskip-\lastskip\postbibhook}
+ \@ifpackagewith{natbib}{sectionbib}{% with sectionbib option
+ \renewcommand{\bibsection}{\@memb@bsec}}%
+ {\renewcommand{\bibsection}{\@memb@bchap}}}%
+ {}
+ \@ifpackagewith{chapterbib}{sectionbib}{%
+ \renewcommand{\sectionbib}[2]{}
+ \renewcommand{\bibsection}{\@memb@bsec}}{}
+}
+
+\newif\ifonecolindex
+ \onecolindexfalse
+
+\newcommand*{\onecolindex}{\onecolindextrue}
+\newcommand*{\twocolindex}{\onecolindexfalse}
+
+\newenvironment{theindex}{%
+ \clearforchapter
+ \if@twocolumn
+ \@restonecolfalse
+ \else
+ \@restonecoltrue
+ \fi
+ \ifonecolindex
+ \onecolumn
+ \chapter*{\indexname}
+ \preindexhook
+ \else
+ \setlength{\columnseprule}{\indexrule}%
+ \setlength{\columnsep}{\indexcolsep}%
+ \twocolumn[\@makeschapterhead{\indexname}
+ \preindexhook]%
+ \fi
+ \indexmark
+ \ifnoindexintoc\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\indexname}%
+ \fi
+ \thispagestyle{indextitlepagestyle}\parindent\z@
+ \parskip\z@ \@plus .3\p@\relax
+ \let\item\@idxitem}%
+ {\if@restonecol\onecolumn\else\twocolumn\fi}
+
+\aliaspagestyle{indextitlepagestyle}{chapter}
+
+\newif\ifnoindexintoc
+\newcommand*{\indexintoc}{\noindexintocfalse}
+\newcommand*{\noindexintoc}{\noindexintoctrue}
+\indexintoc
+
+\newlength{\indexcolsep} \setlength{\indexcolsep}{35pt}
+\newlength{\indexrule} \setlength{\indexrule}{0pt}
+
+\newcommand{\preindexhook}{}
+\newcommand{\l@index}{\@dottedtocline{1}{0em}{0pt}}
+\newcommand{\@idxitem} {\par\hangindent 40\p@}
+\newcommand{\subitem} {\par\hangindent 40\p@ \hspace*{20\p@}}
+\newcommand{\subsubitem}{\par\hangindent 40\p@ \hspace*{30\p@}}
+\newcommand{\indexspace}{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
+
+\newcommand*{\makememindexhook}{}
+\providecommand*{\makeindex}{}
+\renewcommand*{\makeindex}[1][\jobname]{%
+ \if@filesw
+ \def\index{\@bsphack%
+ \@ifnextchar [{\@index}{\@index[\jobname]}}
+ \def\specialindex{\@bsphack\@spindex}%
+ \makememindexhook
+ \expandafter\newwrite\csname #1@idxfile\endcsname
+ \expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax
+ \typeout{Writing index file #1.idx }%
+ \fi}
+
+\renewcommand{\index}[2][\jobname]{\@bsphack\@esphack}
+\newcommand{\specialindex}[3]{\@bsphack\@esphack}
+
+\newcommand{\printindex}[1][\jobname]{\@input@{#1.ind}}
+
+\newif\ifreportnoidxfile
+\newcommand*{\reportnoidxfile}{\reportnoidxfiletrue}
+\newcommand*{\ignorenoidxfile}{\reportnoidxfilefalse}
+ \ignorenoidxfile
+\newif\ifshowindexmark
+\newcommand*{\showindexmarks}{\showindexmarktrue}
+\newcommand*{\hideindexmarks}{\showindexmarkfalse}
+ \hideindexmarks
+
+\def\@index[#1]{%
+ \@ifundefined{#1@idxfile}%
+ {\ifreportnoidxfile
+ \@memwarn{Undefined index file #1}%
+ \fi
+ \begingroup
+ \@sanitize
+ \@nowrindex}%
+ {\def\@idxfile{#1}%
+ \begingroup
+ \@sanitize
+ \@wrindexm@m}}
+\newcommand{\@nowrindex}[1]{%
+ \ifshowindexmark\@showidx{#1}\fi\endgroup\@esphack}
+
+\newcommand{\@wrindexm@m}[1]{\@@wrindexhyp#1||\\}
+\def\@@wrindexhyp#1|#2|#3\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \ifx\\#2\\%
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepage}}%
+ \else
+ \def\Hy@temp@A{#2}%
+ \ifx\Hy@temp@A\HyInd@ParenLeft
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}%
+ \else
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepage}}%
+ \fi
+ \fi
+ \endgroup
+ \@esphack}
+\newcommand{\hyperpage}[1]{#1}
+\newcommand{\hyperlink}[2]{#2}
+
+\newcommand{\@@wrindexm@m}[1]{\begingroup
+ \def\@idxfile{\@nameuse{#1@idxfile}}
+ \@sanitize
+ \@@@wrindexm@m}
+
+\newcommand{\@@@wrindexm@m}[2]{\endgroup}
+\AtBeginDocument{%
+ \def\@@@wrindexm@m#1#2{%
+ \if@filesw
+ \immediate\write \@idxfile{\string\indexentry{#1}{#2}}%
+ \fi
+ \endgroup}%
+}
+\newcommand{\@spindex}[2]{%
+ \@ifundefined{#1@idxfile}%
+ {\ifreportnoidxfile
+ \@memwarn{Undefined index file #1}%
+ \fi
+ \begingroup
+ \@sanitize
+ \@nowrindex}%
+ {\def\@idxfile{#1}%
+ \def\@sptheidx{#2}%
+ \begingroup
+ \@sanitize
+ \@wrspindex}}
+
+\newcommand{\@wrspindex}[1]{\@@wrspindexhyp#1||\\}
+\def\@@wrspindexhyp#1|#2|#3\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \ifx\\#2\\%
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ {#1|hyperspindexpage(\thepage)}%
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \def\Hy@temp@A{#2}%
+ \ifx\Hy@temp@A\HyInd@ParenLeft
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ {#1|#2hyperspindexpage(\thepage)}%
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2}%
+ {\@nameuse{the\@sptheidx}}}%
+ \fi
+ \fi
+ \endgroup
+ \@esphack}
+\def\hyperspindexpage(#1)#2{\hyperlink{page.#1}{#2}}
+
+\newif\ifmemhyperindex
+ \memhyperindextrue
+
+\newif\ifm@mxindy
+\m@mxindyfalse
+\newcommand*{\xindyindex}{\m@mxindytrue}
+\def\@@wrspindexhyp#1|#2|#3\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \ifx\\#2\\%
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \def\Hy@temp@A{#2}%
+ \ifx\Hy@temp@A\HyInd@ParenLeft
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2}%
+ {\@nameuse{the\@sptheidx}}}%
+ \fi
+ \fi
+ \endgroup
+ \@esphack}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{hyperref}{}{\memhyperindexfalse}%
+ \ifmemhyperindex\else
+ \def\@@wrindexhyp#1||\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1}{\thepage}}%
+ \endgroup
+ \@esphack}%
+ \def\@@wrspindexhyp#1||\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1}{\@nameuse{the\@sptheidx}}}%
+ \endgroup
+ \@esphack}%
+ \fi
+}
+
+\newcommand*{\see}[2]{\emph{\seename} #1}
+\newcommand*{\seename}{see}
+\newcommand*{\seealso}[2]{\emph{\alsoname} #1}
+\newcommand*{\alsoname}{see also}
+
+\newcommand{\citeindexfile}{\jobname}
+\AtBeginDocument{\@ifpackageloaded{natbib}{%
+ \def\NAT@index{\index[\citeindexfile]{\NAT@idxtxt}}}{}}
+
+\newtoks\indexmarkstyle
+ \indexmarkstyle{\normalfont\footnotesize\ttfamily}
+\newinsert\@indexbox
+ \dimen\@indexbox\maxdimen
+
+\begingroup
+ \catcode`\@\active
+ \expandafter\gdef\csname\string @sanitizeat\endcsname
+ {\def @{\char`\@}}
+\endgroup
+
+\newcommand{\@showidx}[1]{%
+ \insert\@indexbox{%
+ \@sanitizeat
+ \the\indexmarkstyle
+ \hsize\marginparwidth
+ \hangindent\marginparsep \parindent\z@
+ \everypar{}\let\par\@@par \parfillskip\@flushglue
+ \lineskip\normallineskip
+ \baselineskip .8\normalbaselineskip\sloppy
+ \raggedright \leavevmode
+ \vrule \@height .7\normalbaselineskip \@width \z@\relax
+ #1\relax
+ \vrule \@height \z@ \@depth .3\normalbaselineskip \@width \z@\relax
+ }%
+ \ifhmode\penalty\@M \hskip\z@skip\fi}
+
+\newcommand{\@leftidx}{\hskip-\marginparsep \hskip-\marginparwidth}
+\newcommand{\@rightidx}{\hskip\columnwidth \hskip\marginparsep}
+
+\newcommand{\@mkidx}{\vbox to \z@{%
+ \rlap{%
+ \if@twocolumn
+ \if@firstcolumn \@leftidx \else \@rightidx \fi
+ \else
+ \if@twoside
+ \ifodd\c@page \@rightidx \else \@leftidx \fi
+ \else
+ \@rightidx
+ \fi
+ \fi
+ \box\@indexbox
+ }%
+ \vss}}
+
+\renewcommand{\raggedbottom}{%
+ \def\@textbottom{\vskip\z@ plus.0001fil}%
+ \let\@texttop\@mkidx}
+\renewcommand{\flushbottom}{%
+ \let\@textbottom\relax
+ \let\@texttop\@mkidx}
+\let\@texttop\@mkidx
+
+\newcommand*{\sloppybottom}{%
+ \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}%
+ \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip
+ \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}}
+
+\newif\ifonecolglossary
+ \onecolglossarytrue
+\newcommand*{\onecolglossary}{\onecolglossarytrue}
+\newcommand*{\twocolglossary}{\onecolglossaryfalse}
+
+\newenvironment{theglossary}{%
+ \if@twocolumn
+ \@restonecolfalse
+ \else
+ \@restonecoltrue
+ \fi
+ \ifonecolglossary
+ \onecolumn
+ \chapter*{\glossaryname}
+ \preglossaryhook
+ \else
+ \setlength{\columnseprule}{\glossaryrule}
+ \setlength{\columnsep}{\glossarycolsep}
+ \twocolumn[\@makeschapterhead{\glossaryname}
+ \preglossaryhook]%
+ \fi
+ \glossarymark
+ \ifnoglossaryintoc\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\glossaryname}
+ \fi
+ \thispagestyle{chapter}\parindent\z@
+ \parskip\z@ \@plus .3\p@\relax
+ \begintheglossaryhook}%
+ {\atendtheglossaryhook\if@restonecol\onecolumn\else\twocolumn\fi}
+
+\newcommand*{\begintheglossaryhook}{}
+\newcommand*{\atendtheglossaryhook}{}
+\newcommand*{\preglossaryhook}{}
+
+\newif\ifnoglossaryintoc
+\newcommand*{\glossaryintoc}{\noglossaryintocfalse}
+\newcommand*{\noglossaryintoc}{\noglossaryintoctrue}
+ \glossaryintoc
+
+\newdimen\glossarycolsep \glossarycolsep=35\p@
+\newdimen\glossaryrule \glossaryrule=0\p@
+\newcommand*{\glossaryspace}{%
+ \par \vskip 1.0\onelineskip \@plus 5\p@ \@minus3\p@\relax}
+
+\providecommand*{\makeglossary}{}
+\renewcommand*{\makeglossary}[1][\jobname]{%
+ \makememglossaryhook
+ \@namedef{memglsact#1}{@}% actual
+ \@namedef{memglsnx#1}{}% no ref
+ \@namedef{memglsn#1}{\thepage}% num by page
+ \@namedef{memglsnf#1}{|memjustarg}% no special number format
+ \if@filesw \expandafter\newwrite\csname #1memglofile\endcsname
+ \expandafter\immediate\openout \csname #1memglofile\endcsname #1.glo\relax
+ \typeout{Writing glossary file #1.glo }%
+ \fi}
+
+\newcommand*{\makememglossaryhook}{}
+
+ \def\glossary{\@bsphack%
+ \@ifnextchar [{\@glossary}{\@glossary[\jobname]}}%
+\def\@glossary[#1]{%
+ \@ifnextchar ({\@@glossary[#1]}{\@@glossary[#1]()}}
+\def\@@glossary[#1](#2)#3#4{%
+ \@ifundefined{#1memglofile}{%
+ \begingroup
+ \@sanitize
+ \endgroup
+ \@esphack%
+ }{%
+ \def\memglofile{#1}%
+ \begingroup
+ \@sanitize
+ \ifx\@empty#2\@empty
+ \@wrglom@m{#3}{#3}{#4}%
+ \else
+ \@wrglom@m{#2}{#3}{#4}%
+ \fi}}
+
+\newcommand{\@wrglom@m}[3]{%
+ \protected@write\@auxout{}%
+ {\string\@@wrglom@m{\memglofile}{#1}{#2}{#3}{\@nameuse{memglsnx\memglofile}}{\@nameuse{memglsn\memglofile}}}%
+ \endgroup
+ \@esphack}
+
+\newcommand{\@@wrglom@m}[1]{\begingroup
+ \def\memglofile{\@nameuse{#1memglofile}}%
+ \def\m@mgf{#1}%
+ \@sanitize
+ \memwritetoglo}
+
+\newcommand{\memwritetoglo}[5]{\endgroup}
+\newcommand{\@ctualm@mwritetoglo}[5]{%
+ \immediate\write \memglofile{\string\glossaryentry{#1\@nameuse{memglsact\m@mgf}
+ {\string\memgloterm{#2}}{\string\memglodesc{#3}}
+ {\string\memgloref{#4}}\@nameuse{memglsnf\m@mgf}}{#5}}%
+ \endgroup}
+\AtBeginDocument{%
+ \let\memwritetoglo\@ctualm@mwritetoglo}
+
+\newcommand*{\changeglossactual}[2][\jobname]{%
+ \@namedef{memglsact#1}{#2}}
+\newcommand*{\changeglossref}[2][\jobname]{%
+ \@namedef{memglsnx#1}{#2}}
+\newcommand*{\changeglossnum}[2][\jobname]{%
+ \@namedef{memglsn#1}{#2}}
+\newcommand*{\changeglossnumformat}[2][\jobname]{%
+ \@namedef{memglsnf#1}{#2}}
+
+\newcommand{\glossitem}[4]{#1 #2 #3 #4\par}
+
+\newcommand*{\memgloterm}[1]{#1}
+\newcommand*{\memglodesc}[1]{#1}
+\newcommand*{\memgloref}[1]{#1}
+\newcommand*{\memglonum}[1]{#1}
+
+\newcommand*{\printglossary}[1][\jobname]{\@input@{#1.gls}}
+
+\def\@addmarginpar{%
+ \checkoddpage
+ \@next\@marbox\@currlist{\@cons\@freelist\@marbox
+ \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne
+ \if@twocolumn
+ \if@firstcolumn \@tempcnta\m@ne \fi
+ \else
+ \if@mparswitch
+ \ifoddpage \else \@tempcnta\m@ne \fi
+ \fi
+ \if@reversemargin \@tempcnta -\@tempcnta \fi
+ \fi
+ \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi
+ \@tempdima\@mparbottom
+ \advance\@tempdima -\@pageht
+ \advance\@tempdima\ht\@marbox
+ \ifdim\@tempdima >\z@
+ \@latex@warning@no@line {Marginpar on page
+ \thepage\space moved by \the\@tempdima}%
+ \else
+ \@tempdima\z@
+ \fi
+ \global\@mparbottom\@pageht
+ \global\advance\@mparbottom\@tempdima
+ \global\advance\@mparbottom\dp\@marbox
+ \global\advance\@mparbottom\marginparpush
+ \advance\@tempdima -\ht\@marbox
+ \global\setbox \@marbox
+ \vbox {\vskip \@tempdima
+ \box \@marbox}%
+ \global \ht\@marbox \z@
+ \global \dp\@marbox \z@
+ \kern -\@pagedp
+ \nointerlineskip
+ \hb@xt@\columnwidth
+ {\ifnum \@tempcnta >\z@
+ \hskip\columnwidth \hskip\marginparsep
+ \else
+ \hskip -\marginparsep \hskip -\marginparwidth
+ \fi
+ \box\@marbox \hss}%
+ \nointerlineskip
+ \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}%
+}
+
+\newcommand{\parnopar}{\parfillskip=0pt\par\parskip=0pt\noindent
+ \parfillskip\@flushglue}
+
+\newif\ifreversesidepar
+ \reversesidepartrue
+\newif\ifsideparswitch
+ \sideparswitchfalse
+\if@twoside \sideparswitchtrue \fi
+
+\newlength{\sideparvshift}
+%%%% \setlength{\sideparvshift}{-2.08ex}% seems to work for all font sizes
+
+\newcommand{\sidepar}{\@dblarg{\@sidepar}}
+\long\def\@sidepar[#1]#2{\@bsphack\strut\vadjust{%
+ \checkoddpage
+ \ifsideparswitch
+ \ifreversesidepar
+ \ifoddpage
+ \oddpagefalse
+ \else
+ \oddpagetrue
+ \fi
+ \fi
+ \else
+ \oddpagetrue
+ \ifreversesidepar
+ \oddpagefalse
+ \fi
+ \fi
+ \rlap{\kern-\parindent
+ \if@twocolumn
+ \if@firstcolumn% put at left
+ \kern -\marginparsep \kern -\marginparwidth
+ \else% put at right
+ \kern \columnwidth \kern \marginparsep
+ \fi
+ \else
+ \ifoddpage% put at right
+ \kern \textwidth \kern \marginparsep
+ \else% put at left
+ \kern -\marginparsep \kern -\marginparwidth
+ \fi
+ \fi
+ \setbox0=\vtop to 0pt{%
+ \begin{minipage}[t]{\marginparwidth}%
+ \normalfont\normalsize
+ \ifoddpage #2\else #1\fi%
+ \end{minipage}%
+ \vss}%
+ \vtop to 0pt{\kern\sideparvshift% default should be 0pt
+ \kern-\dp\strutbox
+ \kern-\ht0
+ \box0 \vss}}}%
+ \@esphack}
+\setlength{\sideparvshift}{0pt}
+
+\newinsert\sideins
+ \skip\sideins=0pt
+ \count\sideins=0
+
+\newlength{\sidebartopsep}
+ \setlength{\sidebartopsep}{0pt}
+\newcommand{\setsidebarheight}[1]{%
+ \setlength{\dimen\sideins}{#1}%
+ \advance\dimen\sideins-\topskip
+ \advance\dimen\sideins\ht\strutbox}
+
+\newlength{\sidebarhsep}
+\newlength{\sidebarvsep}
+\newlength{\sidebarwidth}
+\newcommand{\sidebarfont}{}
+\newcommand*{\setsidebars}[6]{%
+ \nametest{#1}{*}\ifsamename\else
+ \setlength{\sidebarhsep}{#1}\@memznegtest{\sidebarhsep}%
+ \fi
+ \nametest{#2}{*}\ifsamename\else
+ \setlength{\sidebarwidth}{#2}\@memznegtest{\sidebarwidth}%
+ \fi
+ \nametest{#3}{*}\ifsamename\else
+ \setlength{\sidebarvsep}{#3}\@memnegtest{\sidebarvsep}%
+ \fi
+ \nametest{#4}{*}\ifsamename\else
+ \setlength{\sidebartopsep}{#4}%
+ \fi
+ \nametest{#5}{*}\ifsamename\else
+ \def\sidebarfont{#5}%
+ \fi
+ \nametest{#6}{*}\ifsamename\else
+ \setsidebarheight{#6}%
+ \ifdim\dimen\sideins>\z@\else
+%%%% \@memerror{\protect\sidebarheight\space is zero or negative}{\@ehd}%
+ \@memwarn{\protect\sidebarheight\space is zero or negative}%
+ \fi
+ \fi}
+\setsidebars{\marginparsep}% sidebarhsep
+ {\marginparwidth}% sidebarwidth
+ {\onelineskip}% sidebarvsep
+ {0pt}% sidebartopsep
+ {\normalsize\normalfont}% sidebarfont
+ {\textheight}% sidebarheight
+
+\newcommand{\sidebarform}{\if@RTL\leftskip\else\rightskip\fi=\z@ \@plus 2em}
+
+\newif\ifsidebaroneside
+ \if@twoside\sidebaronesidefalse\else\sidebaronesidetrue\fi
+
+\newcommand*{\sidebarmargin}[1]{%
+ \def\@tempa{#1}\def\@tempb{left}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{0}%
+ \else
+ \def\@tempb{right}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{1}%
+ \else
+ \def\@tempb{outer}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{2}%
+ \else
+ \def\@tempb{inner}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{3}%
+ \else
+ \@memwarn{Bad \string\sidebarmargin\space argument}%
+ \gdef\m@msidebar@margin{1}%
+ \fi
+ \fi
+ \fi
+ \fi}
+%%%% default outer
+\gdef\m@msidebar@margin{2}
+\newcommand*{\m@sideb@left}{%
+ \@tempdimc \sidebarwidth
+ \advance\@tempdimc\sidebarhsep
+ \kern-\@tempdimc}
+\newcommand*{\m@sideb@right}{%
+ \@tempdimc \columnwidth% or \hsize
+ \advance\@tempdimc\sidebarhsep
+ \kern\@tempdimc}
+
+\newcommand{\sidecontents}{\hbox to \z@{%
+ \if@twocolumn% %% put outside nearest column
+ \if@firstcolumn% %% move to left
+ \m@sideb@left
+ \else% %% move to right
+ \m@sideb@right
+ \fi
+ \else% %% put into foremargin?
+ \ifsidebaroneside% %% put into right hand margin
+ \m@sideb@right
+ \else% %% pick the margin
+ \ifcase\m@msidebar@margin% 0 to left
+ \m@sideb@left
+ \or% 1 to right
+ \m@sideb@right
+ \or% 2 to outer
+ \ifodd\c@page% %% move to right
+ \m@sideb@right
+ \else% %% move to left
+ \m@sideb@left
+ \fi
+ \or% 3 to inner
+ \ifodd\c@page% %% move to left
+ \m@sideb@left
+ \else% %% move to right
+ \m@sideb@right
+ \fi
+ \fi
+ \fi
+ \fi
+ \vtop to0pt{%
+ \normalsize\normalfont\sidebarfont% select font so we know the strut size
+ \vskip\topskip \vskip-\ht\strutbox
+ \vskip\sidebartopsep% extra vertical shift
+ \unvbox\sideins \vss}%
+ \hss}}
+
+\newcommand{\sidebar}[1]{%
+ \insert\sideins{%
+ \hsize\sidebarwidth
+ \@parboxrestore
+ \sidebarform \normalsize\normalfont\sidebarfont
+ \splittopskip=\ht\strutbox
+ \splitmaxdepth=\dp\strutbox % doesn't do anything useful
+ \allowbreak
+ \prevdepth=\dp\strutbox % supersedes a "top-strut"
+ \vskip-\parskip
+ #1%
+ \ifvmode\else
+ \unskip\@finalstrut\strutbox
+ \fi\par
+ \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox \fi
+ \ifdim\prevdepth>99\p@
+ \nobreak
+ \vskip-\prevdepth
+ \allowbreak
+ \vskip\dp\strutbox
+ \fi
+ \vskip\sidebarvsep}}
+
+\renewcommand{\footnoterule}{%
+ \kern-3\p@
+ \hrule width .4\columnwidth
+ \kern 2.6\p@}
+\skip\footins=\bigskipamount
+\@addtoreset{footnote}{chapter}
+\newcommand*{\multfootsep}{\textsuperscript{\normalfont,}}
+\newcommand*{\multiplefootnotemarker}{3sp}
+\newcommand*{\m@mmf@prepare}{%
+ \kern-\multiplefootnotemarker
+ \kern\multiplefootnotemarker\relax}
+\newcommand*{\m@mmf@check}{%
+ \ifdim\lastkern=\multiplefootnotemarker\relax
+ \edef\@x@sf{\the\spacefactor}%
+ \unkern
+ \multfootsep
+ \spacefactor\@x@sf\relax
+ \fi}
+
+\renewcommand{\@footnotetext}[1]{\insert\footins{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font% <- v1.6180 addition
+ \foottextfont
+ \@preamfntext
+ \hsize\columnwidth
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \@finalstrut\strutbox}%
+ \color@endgroup}\m@mmf@prepare}
+\let\m@mold@footnotetext\@footnotetext
+\renewcommand*{\@footnotemark}{%
+ \leavevmode
+ \ifhmode
+ \edef\@x@sf{\the\spacefactor}%
+ \m@mmf@check
+ \nobreak
+ \fi
+ \@makefnmark
+ \m@mmf@prepare
+ \ifhmode\spacefactor\@x@sf\fi
+ \relax}
+
+\newlength{\footmarkwidth}
+\newlength{\footmarksep}
+\newlength{\footparindent}
+\newcommand*{\footmarkstyle}[1]{\def\footscript##1{#1}}
+\newcommand{\makefootmarkhook}{}
+
+\newcommand{\footfootmark}{%
+ \ifdim\footmarkwidth < \z@
+ \llap{\hb@xt@ -\footmarkwidth{%
+ \hss\normalfont\footscript{\@thefnmark}}%
+ \hspace*{-\footmarkwidth}}%
+ \else
+ \ifdim\footmarkwidth = \z@
+ {\normalfont\footscript{\@thefnmark}}%
+ \else
+ \hb@xt@\footmarkwidth{\hss\normalfont\footscript{\@thefnmark}}%
+ \fi
+ \fi}
+
+\newcommand{\makefootmark}[1]{%
+ \leavevmode
+ \parindent \footparindent\noindent
+ \leftskip\footmarksep\relax
+ \advance\leftskip \footmarkwidth \null\nobreak\hskip -\leftskip\relax
+ \makefootmarkhook\relax
+ \footfootmark #1}
+\newcommand{\@makefntext}[1]{\makefootmark #1}
+\footmarkstyle{\textsuperscript{#1}}
+\setlength{\footmarkwidth}{1.8em}
+\setlength{\footmarksep}{-1.8em}
+\setlength{\footparindent}{1em}
+
+\newcommand{\footref}[1]{%
+ \begingroup
+ \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
+ \endgroup
+ \@footnotemark}
+
+\def\verbfootnote{\@ifnextchar[\@xverbfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark\@verbfootnotetext}}
+
+\def\@xverbfootnote[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotemark\@verbfootnotetext}
+
+\long\def\@verbfootnotetext{%
+ \insert\footins\bgroup
+ \footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
+%%%% \color@begingroup
+ \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
+ \futurelet\next\fo@t
+}
+\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
+ \else \let\next\f@t\fi \next}
+\def\f@@t{\bgroup\aftergroup\@foot\let\next}
+\def\f@t#1{%
+ \color@begingroup
+ #1\@foot
+ \color@endgroup}
+\def\@foot{%
+ \strut\egroup
+%%%% \color@endgroup
+ \m@mmf@prepare
+ }
+
+\long\def\@verbmpfootnotetext{%
+ \global\setbox\@mpfootins\vbox{%
+ \reset@font\footnotesize
+ \unvbox\@mpfootins
+ \bgroup
+ \hsize\columnwidth
+ \@parboxrestore
+ \edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
+ }
+ \futurelet\next\fo@t
+}
+
+%%%%%%%%%%%%%% major extension to footnoting
+
+\newcommand*{\setfootnoterule}[4][]{%
+ \def\footnoterule{\kern -#2\relax #1\relax
+ \hrule width #3\relax
+ \kern #2\kern-#4}}
+\setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness}
+
+\newcommand{\m@mdoextrafeet}{\extrafeetins}
+\newcommand*{\extrafeetins}{%
+ \setbox\@outputbox \vbox{%
+ \boxmaxdepth \@maxdepth
+ \unvbox\@outputbox
+ \ifvoid\footinsv@r\else\@footstartv@r\@footgroupv@r\fi
+ \extrafeetinshook}}
+\newcommand{\extrafeetinshook}{}
+
+\newcommand{\m@mdodoreinextrafeet}{%
+ \ifvoid\footinsv@r\else\insert\footinsv@r{\unvbox\footinsv@r}\fi
+ \extrafeetreinshook}
+\newcommand{\extrafeetreinshook}{}
+
+\newcommand{\foottextfont}{\footnotesize}
+\newlength{\footinsdim}
+ \setlength{\footinsdim}{8in} % standard for \dimen\footins
+\newcommand{\@preamfntext}{%
+ \interlinepenalty\interfootnotelinepenalty
+ \floatingpenalty \@MM
+ \splittopskip=\footnotesep
+ \splitmaxdepth=\dp\strutbox
+ \@parboxrestore}
+
+\renewcommand{\@mpfootnotetext}[1]{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \foottextfont \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \reset@font% <- v1.6180 addition
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \@finalstrut\strutbox}%
+ \color@endgroup}}
+
+\let\m@mold@mpfootnotetext\@mpfootnotetext
+
+\newcommand{\m@mdoextrafeetmini}{%
+ \extrafeetminihook}
+\newcommand{\extrafeetminihook}{}
+%%%%\renewcommand{\@minipagerestore}{\m@mdoextrafeetmini}
+
+\newcommand{\extrafeetendmini}{%
+ \ifvoid\@mpfootinsv@r\else
+ \vskip\skip\@mpfootins
+ \normalcolor\footnoterule\mp@footgroupv@r
+ \fi
+ \extrafeetendminihook}
+\newcommand{\extrafeetendminihook}{}
+
+\newcommand{\m@mdoextrafeetendmini}{\extrafeetendmini}
+\def\endminipage{%
+ \par
+ \unskip
+ \ifvoid\@mpfootins\else
+ \vskip\skip\@mpfootins
+ \normalcolor
+ \footnoterule
+ \unvbox\@mpfootins
+ \fi
+ \m@mdoextrafeetendmini
+ \@minipagefalse
+ \color@endgroup
+ \egroup
+ \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
+
+\newcommand{\plainfootnotes}{%
+ \let\@footnotetext\m@mold@footnotetext
+ \let\@mpfootnotetext\m@mold@mpfootnotetext}
+
+\newcommand{\newfootnoteseries}[1]{%
+ \expandafter\newinsert\csname footins#1\endcsname% -> \footins#1
+ \expandafter\skip\csname footins#1\endcsname \bigskipamount%
+%%% - > \skip\footins#1 % [RS]
+ \newcounter{footnote#1}% -> \c@footnote#1
+ \@nameuse{c@footnote#1} \z@% -> \c@footnote#1=0
+ \global\@namelet{p@footnote#1} \@empty% -> \p@footnote#1
+ \@namedef{thefootnote#1}{\arabic{footnote#1}}% -> \thefootnote#1
+ \@namedef{foottextfont#1}{\foottextfont}% -> \foottextfont#1
+ \m@makefootnote{#1}% -> \footnote#1
+ \m@make@xfootnote{#1}% -> \@xfootnote#1
+ \m@make@footnotetext{#1}% -> \@footnotetext#1
+ \m@makefootnotemark{#1}% -> \footnotemark#1
+ \m@make@xfootnotemark{#1}% -> \@xfootnotemark#1
+ \m@make@footnotemark{#1}% -> \@footnotemark#1
+ \m@makefootnotetext{#1}% -> \footnotetext#1
+ \m@make@xfootnotenext{#1}% -> \@xfootnotenext#1
+ \m@make@mpfn{#1}% -> \@mpfn#1
+ \m@makethempfn{#1}% -> \thempfn#1
+ \m@make@makefnmark{#1}% -> \@makefnmark#1
+ \m@makefootref{#1}% -> \footref#1
+ \m@makefootfootmark{#1}% -> \footfootmark#1
+ \m@makemakefootmark{#1}% -> \makefootmark#1
+ \m@makefootmarkstyle{#1}% -> \footmarkstyle#1
+ \@namedef{@makefntext#1}##1{\@nameuse{makefootmark#1} ##1}%
+ \m@make@footstart{#1}% -> \@footstart#1
+ \m@make@footgroup{#1}% -> \@footgroup#1
+ \expandafter\newinsert\csname @mpfootins#1\endcsname% -> \@mpfootins#1
+ \newcounter{mpfootnote#1}% -> \c@mpfootnote#1
+ \global\@namelet{p@mpfootnote#1}\@empty
+ \@namedef{thempfootnote#1}{\itshape\alph{mpfootnote#1}}%
+ \m@make@mpfootnotetext{#1}% -> \@mpfootnotetext#1
+ \ifartopt\else% [RS]
+ \expandafter\@cons\csname cl@chapter\endcsname {{footnote#1}}%
+ \fi
+ \g@addto@macro{\extrafeetinshook}{%
+ \ifvoid\@nameuse{footins#1}\else
+ \@nameuse{@footstart#1}\@nameuse{@footgroup#1}\fi}
+ \g@addto@macro{\extrafeetreinshook}{%
+ \ifvoid\@nameuse{footins#1}\else
+ \insert\@nameuse{footins#1}{\unvbox\@nameuse{footins#1}}\fi}
+ \g@addto@macro{\extrafeetendminihook}{%
+ \ifvoid\@nameuse{@mpfootins#1}\else
+ \vskip\skip\@mpfootins
+ \normalcolor\footnoterule\@nameuse{mp@footgroup#1}\fi}
+ \g@addto@macro{\extrafeetminihook}{%
+ \@namedef{@mpfn#1}{mpfootnote#1}
+ \@namedef{thempfn#1}{\@nameuse{thempfootnote#1}}
+ \csname c@mpfootnote#1\endcsname\z@
+ \expandafter\let\expandafter\@t@mp \csname @mpfootnotetext#1\endcsname
+ \expandafter\let \csname @footnotetext#1\endcsname \@t@mp}
+ \g@addto@macro{\@mem@extranofeet}{% % [RS]
+ \ifvoid\@nameuse{footins#1}\else\@mem@nofootfalse\fi}
+ \plainfootstyle{#1}%
+}
+
+\newcommand{\m@makefootnote}[1]{
+ \@namedef{footnote#1}{\@ifnextchar[
+ {\@nameuse{@xfootnote#1}}{%\advance \@nameuse{c@\@mpfn#1} by \@ne
+ \stepcounter{\@mpfn#1}%
+ \@name@p@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \@nameuse{@footnotemark#1}\@nameuse{@footnotetext#1}}}}
+
+\newcommand{\m@make@xfootnote}[1]{
+ \@namedef{@xfootnote#1}[##1]{%
+ \begingroup
+ \csname c@\@mpfn#1\endcsname ##1\relax
+ \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \endgroup
+ \@nameuse{@footnotemark#1}\@nameuse{@footnotetext#1}}}
+
+\newcommand{\m@make@footnotetext}[1]{%
+ \@namelongdef{@footnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \hsize\columnwidth
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@makefntext#1}{%
+ \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1}##1}% <- v1.6180339a
+ \@finalstrut\strutbox}%
+ \color@endgroup}%
+ \m@mmf@prepare}}
+
+\newcommand{\m@make@mpfootnotetext}[1]{%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@makefntext#1}{%
+ \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1}##1}% <- v1.6180339a
+ \@finalstrut\strutbox}%
+ \color@endgroup}%
+ \m@mmf@prepare}}
+
+\newcommand{\m@makefootnotemark}[1]{
+\@namedef{footnotemark#1}{%
+ \@ifnextchar[ {\@nameuse{@xfootnotemark#1}}
+ {%\advance\@nameuse{c@footnote#1} by \@ne%
+ \stepcounter{footnote#1}%
+ \@name@p@xdef{@thefnmark#1}{\@nameuse{thefootnote#1}}%
+ \@nameuse{@footnotemark#1}}}}
+
+\newcommand{\m@make@xfootnotemark}[1]{%
+ \@namedef{@xfootnotemark#1}[##1]{%
+ \begingroup
+ \@nameuse{c@footnote#1} ##1\relax
+ \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thefootnote#1}}%
+ \endgroup
+ \@nameuse{@footnotemark#1}}}
+
+\newcommand{\m@make@footnotemark}[1]{%
+\@namedef{@footnotemark#1}{%
+ \leavevmode
+ \ifhmode
+ \edef\@x@sf{\the\spacefactor}%
+ \m@mmf@check
+ \nobreak
+ \fi
+ \@nameuse{@makefnmark#1}%
+ \m@mmf@prepare
+ \ifhmode\spacefactor\@x@sf\fi
+ \relax}}
+
+\newcommand{\m@makefootmarkstyle}[1]{%
+ \@namedef{footmarkstyle#1}##1{%
+ \@namedef{footscript#1}####1{##1}}}
+
+\newcommand{\m@makefootnotetext}[1]{%
+\@namedef{footnotetext#1}{%
+ \@ifnextchar[ {\@nameuse{@xfootnotenext#1}}%
+ {\@name@p@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \@nameuse{@footnotetext#1}}}}
+
+\newcommand{\m@make@xfootnotenext}[1]{
+\@namedef{@xfootnotenext#1}[##1]{%
+ \begingroup
+ \csname c@\@mpfn#1\endcsname ##1\relax
+ \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \endgroup
+ \@nameuse{@footnotetext#1}}}
+
+\newcommand{\m@make@mpfn}[1]{%
+ \@namedef{@mpfn#1}{\@nameuse{footnote#1}}}
+
+\newcommand{\m@makethempfn}[1]{%
+ \@namedef{thempfn#1}{\@nameuse{thefootnote#1}}}
+
+\newcommand{\m@make@makefnmark}[1]{%
+ \@namedef{@makefnmark#1}{%
+ \hbox{\@textsuperscript{\normalfont\@nameuse{@thefnmark#1}}}}}
+
+\newcommand{\m@makefootref}[1]{%
+ \@namedef{footref#1}##1{%
+ \begingroup
+ \@name@unresp@xdef{@thefnmark#1}{\ref{##1}}%
+ \endgroup
+ \@nameuse{@footnotemark#1}}}
+
+\newcommand{\m@makefootfootmark}[1]{%
+ \@namedef{footfootmark#1}{%
+ \ifdim\footmarkwidth < \z@
+ \llap{\hb@xt@ -\footmarkwidth{%
+ \hss\normalfont\@nameuse{footscript#1}%
+ {\@nameuse{@thefnmark#1}}}%
+ \hspace*{-\footmarkwidth}}%
+ \else
+ \ifdim\footmarkwidth = \z@
+ {\normalfont\@nameuse{footscript#1}{\@nameuse{@thefnmark#1}}}%
+ \else
+ \hb@xt@\footmarkwidth{%
+ \hss\normalfont\@nameuse{footscript#1}%
+ {\@nameuse{@thefnmark#1}}}%
+ \fi
+ \fi}}
+
+\newcommand{\m@makemakefootmark}[1]{%
+ \@namedef{makefootmark#1}##1{%
+ \leavevmode
+ \parindent \footparindent\noindent
+ \leftskip\footmarksep\relax
+ \advance\leftskip \footmarkwidth
+ \null\nobreak\hskip -\leftskip\relax
+ \makefootmarkhook\relax
+ \@nameuse{footfootmark#1}##1}}
+
+\newcommand{\m@make@footgroup}[1]{%
+ \@namedef{@footgroup#1}{\unvbox\@nameuse{footins#1}}}
+
+\newcommand{\m@makemp@footgroup}[1]{%
+ \@namedef{mp@footgroup#1}{\unvbox\@nameuse{@mpfootins#1}}}
+
+\newcommand{\m@make@footstart}[1]{%
+ \@namedef{@footstart#1}{%
+ \vskip\bigskipamount
+ \if@RTL\rightskip\else\leftskip\fi=\z@
+ \if@RTL\leftskip\else\rightskip\fi=\z@
+ \footnoterule}}
+
+\newcommand{\plainfootstyle}[1]{%
+ \m@make@footnotetext{#1}%
+ \m@make@footgroup{#1}%
+ \m@make@footstart{#1}%
+ \m@make@mpfootnotetext{#1}%
+ \m@makemp@footgroup{#1}%
+ \@nameuse{footmarkstyle#1}{\textsuperscript{##1}}
+ \expandafter\dimen\csname footins#1\endcsname=\footinsdim
+ \expandafter\count\csname footins#1\endcsname=1000\relax}
+
+\newinsert\footinsv@r
+ \skip\footinsv@r\bigskipamount
+ \count\footinsv@r=1000 % no magnifcation
+ \dimen\footinsv@r=\footinsdim
+\m@make@footstart{v@r}
+\newcommand{\@footgroupv@r}{}
+
+\newinsert\@mpfootinsv@r
+\newcommand{\mp@footgroupv@r}{}
+
+\newcount\m@m@k \newdimen\m@m@h
+\newcommand*{\m@mrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3
+ \@@line{\splittopskip=\m@m@h \vbadness=\@M \hfilneg
+ \valign{##\vfill\cr\m@mdosplits}}}
+\newcommand*{\m@mdosplits}{\ifnum\m@m@k>0 \noalign{\hfil}\m@msplitoff
+ \global\advance\m@m@k-1\cr\m@mdosplits\fi}
+\newcommand*{\m@msplitoff}{\dimen0=\ht0
+ \divide\dimen0 by\m@m@k \advance\dimen0 by\m@m@h
+ \setbox2 \vsplit0 to \dimen0
+ \unvbox2 }
+
+\newcommand{\twocolumnfootnotes}{%
+ \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
+ \let\@footnotetext\@twocolfootnotetext
+ \dimen\footinsv@r=2\footinsdim
+ \count\footinsv@r=500\relax
+ \m@make@twocol@footgroup{v@r}%
+ \let\@footgroupv@r\@twocol@footgroupv@r
+ \let\@mpfootnotetext\@mptwocolfootnotetext
+ \m@make@mptwocol@footgroup{v@r}%
+ \let\mp@footgroupv@r\@mptwocol@footgroupv@r}
+
+\newcommand{\@twocolfootnotetext}[1]{\insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@twocolfootfmt{#1}%
+ \color@endgroup}%
+ \m@mmf@prepare}
+
+\newcommand{\@preamtwofmt}{%
+ \hsize .45\hsize
+ \parindent=\z@
+ \tolerance=5000\relax
+ \raggedright
+ \leavevmode}
+
+\newcommand{\@twocolfootfmt}[1]{%
+ \@preamtwofmt
+ {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
+
+\newcommand{\@mptwocolfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@twocolfootfmt{#1}%
+ \color@endgroup}%
+ \m@mmf@prepare}
+
+\newcommand{\twocolumnfootstyle}[1]{%
+ \m@make@twocolfootnotetext{#1}%
+ \m@make@mptwocolfootnotetext{#1}%
+ \m@make@twocolfootfmt{#1}%
+ \m@make@twocol@footgroup{#1}%
+ \m@make@mptwocol@footgroup{#1}%
+ \m@make@footstart{#1}%
+ \@namelongdef{@footnotetext#1}##1{%
+ \@nameuse{@twocolfootnotetext#1}{##1}}%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \@nameuse{@mptwocolfootnotetext#1}{##1}}%
+ \@namedef{@footgroup#1}{\@nameuse{@twocol@footgroup#1}}%
+ \@namedef{mp@footgroup#1}{\@nameuse{@mptwocol@footgroup#1}}%
+ \expandafter\dimen\csname footins#1\endcsname=2\footinsdim
+ \expandafter\count\csname footins#1\endcsname=500\relax}
+
+\newcommand{\m@make@twocolfootnotetext}[1]{%
+ \@namelongdef{@twocolfootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@twocolfootfmt#1}{##1}%
+ \color@endgroup}%
+ \m@mmf@prepare}}
+
+\newcommand{\m@make@mptwocolfootnotetext}[1]{%
+\@namelongdef{@mptwocolfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@twocolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\newcommand{\m@make@twocolfootfmt}[1]{%
+ \@namedef{@twocolfootfmt#1}##1{%
+ \@preamtwofmt
+ {\@nameuse{footfootmark#1}\strut
+ {\@nameuse{foottextfont#1}##1}\strut\par}\allowbreak}}
+
+\newcommand{\m@make@twocol@footgroup}[1]{%
+ \@namedef{@twocol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{footins#1}}{\tw@}{\splittopskip}}}}
+
+\newcommand{\m@make@mptwocol@footgroup}[1]{%
+\@namedef{@mptwocol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\tw@}{\splittopskip}}}}
+
+\newcommand{\threecolumnfootnotes}{%
+ \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
+ \let\@footnotetext\@threecolfootnotetext
+ \dimen\footinsv@r=3\footinsdim
+ \count\footinsv@r=333\relax
+ \m@make@threecol@footgroup{v@r}%
+ \let\@footgroupv@r\@threecol@footgroupv@r
+ \let\@mpfootnotetext\@mpthreecolfootnotetext
+ \m@make@mpthreecol@footgroup{v@r}%
+ \let\mp@footgroupv@r\@mpthreecol@footgroupv@r}
+
+\newcommand{\@threecolfootnotetext}[1]{\insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@threecolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+\newcommand{\@preamthreefmt}{%
+ \hsize .3\hsize
+ \parindent=\z@
+ \tolerance=5000\relax
+ \raggedright
+ \leavevmode}
+
+\newcommand{\@threecolfootfmt}[1]{%
+ \@preamthreefmt
+ {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
+
+\newcommand{\@mpthreecolfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@threecolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+\newcommand{\threecolumnfootstyle}[1]{%
+ \m@make@threecolfootnotetext{#1}%
+ \m@make@mpthreecolfootnotetext{#1}%
+ \m@make@threecolfootfmt{#1}%
+ \m@make@threecol@footgroup{#1}%
+ \m@make@mpthreecol@footgroup{#1}%
+ \m@make@footstart{#1}%
+ \@namelongdef{@footnotetext#1}##1{%
+ \@nameuse{@threecolfootnotetext#1}{##1}}%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \@nameuse{@mpthreecolfootnotetext#1}{##1}}%
+ \@namedef{@footgroup#1}{\@nameuse{@threecol@footgroup#1}}%
+ \@namedef{mp@footgroup#1}{\@nameuse{@mpthreecol@footgroup#1}}%
+ \expandafter\dimen\csname footins#1\endcsname=3\footinsdim
+ \expandafter\count\csname footins#1\endcsname=333\relax}
+
+\newcommand{\m@make@threecolfootnotetext}[1]{%
+\@namelongdef{@threecolfootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@threecolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\newcommand{\m@make@mpthreecolfootnotetext}[1]{%
+\@namelongdef{@mpthreecolfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@threecolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\newcommand{\m@make@threecolfootfmt}[1]{%
+\@namelongdef{@threecolfootfmt#1}##1{%
+ \@preamthreefmt
+ {\@nameuse{footfootmark#1}\strut
+ {\@nameuse{foottextfont#1}##1}\strut\par}\allowbreak}}
+
+\newcommand{\m@make@threecol@footgroup}[1]{%
+\@namedef{@threecol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{footins#1}}{\thr@@}{\splittopskip}}}}
+
+\newcommand{\m@make@mpthreecol@footgroup}[1]{%
+\@namedef{@mpthreecol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\thr@@}{\splittopskip}}}}
+
+\newcommand{\m@munvxh}[1]{%
+ \setbox0=\vbox{\unvbox#1%
+ \global\setbox1=\lastbox}%
+ \unhbox1
+ \unskip
+ \unskip
+ \unpenalty
+ \hskip\m@mipn@skip}
+
+\newcommand{\m@mungebox}{%
+ \setbox0=\hbox{\m@munvxh0}%
+ \dp0=\z@
+ \ht0=\footfudgefactor\wd0
+ \box0
+ \penalty0}
+
+\newskip\m@mipn@skip
+\newcommand*{\m@minterparanoteglue}[1]{%
+ {\foottextfont\global\m@mipn@skip=#1\relax}}
+\m@minterparanoteglue{1em plus.4em minus.4em}
+
+\newcommand*{\m@mmakehboxofhboxes}{\setbox0=\hbox{}%
+ \loop
+ \unpenalty
+ \setbox2=\lastbox
+ \ifhbox2
+ \setbox0=\hbox{\box2\unhbox0}
+ \repeat}
+
+\newcommand*{\m@mremovehboxes}{\setbox0=\lastbox
+ \ifhbox0{\m@mremovehboxes}\unhbox0 \fi}
+
+\newcommand*{\footfudgefiddle}{64}
+
+\newcommand{\paragraphfootnotes}{%
+ \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
+ \let\@footnotetext\@parafootnotetext
+ \dimen\footinsv@r=\footinsdim
+ \count\footinsv@r=1000\relax
+ \m@make@para@footgroup{v@r}%
+ \let\@footgroupv@r\@para@footgroupv@r
+ \let\@mpfootnotetext\@mpparafootnotetext
+ \m@make@mppara@footgroup{v@r}%
+ \let\mp@footgroupv@r\@mppara@footgroupv@r
+ {\foottextfont
+ \dimen0=\baselineskip
+ \multiply\dimen0 by 1024
+ \divide\dimen0 by \hsize \multiply\dimen0 by \footfudgefiddle
+ \xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
+
+\newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{#1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+
+\newcommand{\@parafootfmt}[1]{%
+ \parindent=\z@
+ \parfillskip=0pt \@plus 1fil
+ {\footfootmark\strut {\foottextfont #1}\penalty-10}}
+
+\newcommand{\@mpparafootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{#1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+
+\newcommand{\paragraphfootstyle}[1]{%
+ \m@make@parafootnotetext{#1}%
+ \m@make@mpparafootnotetext{#1}%
+ \m@make@parafootfmt{#1}%
+ \m@make@para@footgroup{#1}%
+ \m@make@mppara@footgroup{#1}%
+ \m@make@para@footstart{#1}%
+ \@namelongdef{@footnotetext#1}##1{%
+ \@nameuse{@parafootnotetext#1}{##1}}%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \@nameuse{@mpparafootnotetext#1}{##1}}%
+ \@namedef{@footgroup#1}{\@nameuse{@para@footgroup#1}}%
+ \@namedef{mp@footgroup#1}{\@nameuse{@mppara@footgroup#1}}%
+ \@namedef{@footstart#1}{\@nameuse{@para@footstart#1}}%
+ \expandafter\dimen\csname footins#1\endcsname=\footinsdim
+ \expandafter\count\csname footins#1\endcsname=1000\relax
+ {\@nameuse{foottextfont#1}%
+ \dimen0=\baselineskip
+ \multiply\dimen0 by 1024
+ \divide\dimen0 by \hsize \multiply\dimen0 by 64
+ \xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
+
+\newcommand{\m@make@parafootnotetext}[1]{%
+\@namelongdef{@parafootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@nameuse{@parafootfmt#1}{##1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}}
+
+\newcommand{\m@make@mpparafootnotetext}[1]{%
+\@namelongdef{@mpparafootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@nameuse{@parafootfmt#1}{##1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}}
+
+\newcommand{\m@make@parafootfmt}[1]{%
+\@namelongdef{@parafootfmt#1}##1{%
+ \parindent=\z@
+ \parfillskip=0pt \@plus 1fil
+ {\@nameuse{footfootmark#1}\strut
+ {\@nameuse{foottextfont#1}##1}\penalty-10}}}
+
+\newcommand{\m@make@para@footgroup}[1]{%
+\@namedef{@para@footgroup#1}{%
+ \unvbox\@nameuse{footins#1}
+ \m@mmakehboxofhboxes
+ \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
+ \@nameuse{foottextfont#1}%
+ \noindent\unhbox0\par}}
+
+\newcommand{\m@make@mppara@footgroup}[1]{%
+\@namedef{@mppara@footgroup#1}{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \m@mmakehboxofhboxes
+ \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
+ \@nameuse{foottextfont#1}%
+ \noindent\unhbox0\par}}
+
+\newcommand{\m@make@para@footstart}[1]{%
+\@namedef{@para@footstart#1}{%
+ \vskip\bigskipamount
+ \if@RTL\rightskip\else\leftskip\fi=\z@
+ \if@RTL\leftskip\else\rightskip\fi=\z@
+ \parindent=\z@
+ \vskip\skip\@nameuse{footins#1}%
+ \footnoterule}}
+
+\newif\if@mem@nofoot
+\newcommand*{\@mem@testifnofoot}{%
+ \@mem@nofoottrue
+ \ifvoid\footins\else\@mem@nofootfalse\fi
+ \ifvoid\footinsv@r\else\@mem@nofootfalse\fi
+ \ifvoid\sideins\else\@mem@nofootfalse\fi
+ \@mem@extranofeet}
+\newcommand*{\@mem@extranofeet}{}
+
+\let\memold@doclearpage\@doclearpage
+\newcommand{\mem@doclearpage}{%
+ \@mem@testifnofoot
+ \if@mem@nofoot
+ \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
+ \setbox\@tempboxa\box\@cclv
+ \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
+ \global\let\@toplist\@empty
+ \global\let\@botlist\@empty
+ \global\@colroom\@colht
+ \ifx \@currlist\@empty
+ \else
+ \@latexerr{Float(s) lost}\@ehb
+ \global\let\@currlist\@empty
+ \fi
+ \@makefcolumn\@deferlist
+ \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
+ \if@twocolumn
+ \if@firstcolumn
+ \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
+ \global\let\@dbltoplist\@empty
+ \global\@colht\textheight
+ \begingroup
+ \@dblfloatplacement
+ \@makefcolumn\@dbldeferlist
+ \@whilesw\if@fcolmade \fi{\@outputpage
+ \@makefcolumn\@dbldeferlist}%
+ \endgroup
+ \else
+ \vbox{}\clearpage
+ \fi
+ \fi
+ \else
+ \setbox\@cclv\vbox{\box\@cclv\vfil}%
+ \@makecol\@opcol
+ \clearpage
+ \fi}
+\gdef\@doclearpage{\mem@doclearpage}
+
+\newcommand*{\m@m@makecolfloats}{%
+ \xdef\@freelist{\@freelist\@midlist}%
+ \global\let\@midlist\@empty
+ \@combinefloats}
+\newcommand*{\m@m@makecoltext}{%
+ \ifvbox\@kludgeins
+ \@makespecialcolbox
+ \else
+ \setbox\@outputbox \vbox to\@colht{%
+ \@texttop
+ \dimen@ \dp\@outputbox
+ \unvbox \@outputbox
+ \vskip -\dimen@
+ \@textbottom}%
+ \fi}
+
+\newcommand*{\m@m@makecolintro}{}
+
+\newcommand*{\m@mopfootnote}{\setbox\@outputbox \vbox{%
+ \boxmaxdepth\@maxdepth
+ \@tempdima\dp\@cclv
+ \unvbox\@cclv
+ \vskip-\@tempdima
+ \vskip \skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup}}
+
+\newcommand*{\m@mopfootnotebf}{%
+ \setbox\@outputbox \vbox{%
+ \boxmaxdepth\@maxdepth
+ \unvbox\@outputbox
+ \vskip\skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup}}
+
+\newcommand*{\m@mopsidebar}{%
+ \ifvoid\sideins\else
+ \setbox\@outputbox \vbox{%
+ \sidecontents
+ \unvbox\@outputbox}
+ \fi}
+
+\gdef\mem@makecol{%
+ \m@m@makecolintro
+ \ifvoid\footins
+ \setbox\@outputbox \box\@cclv
+ \else
+ \m@mopfootnote
+ \fi
+ \m@mdoextrafeet
+ \m@m@makecolfloats
+ \m@mopsidebar
+ \m@m@makecoltext
+ \global \maxdepth \@maxdepth}
+
+\gdef\mem@makecolbf{%
+ \m@m@makecolintro
+ \setbox\@outputbox \box\@cclv
+ \m@m@makecolfloats
+ \ifvoid\footins\else
+ \m@mopfootnotebf
+ \fi
+ \m@mdoextrafeet
+ \m@mopsidebar
+ \m@m@makecoltext
+ \global\maxdepth \@maxdepth}
+
+\gdef\mem@makecoldblf{%
+ \m@m@makecolintro
+ \setbox\@outputbox \box\@cclv
+ \m@m@makecolfloats
+ \m@mopsidebar% <- added
+ \ifvoid\footins
+ \else
+ \m@mopfootnote
+ \fi
+ \m@mdoextrafeet
+ \m@m@makecoltext
+ \global \maxdepth \@maxdepth}
+
+\newcommand{\feetabovefloat}{\gdef\@makecol{\mem@makecol}}
+\newcommand{\feetbelowfloat}{\gdef\@makecol{\mem@makecolbf}}
+\feetabovefloat
+
+\gdef\@reinserts{%
+ \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
+ \m@mdodoreinextrafeet
+ \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
+ \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi}
+
+\newif\ifm@mpnpageopt
+ \m@mpnpageoptfalse
+\newif\ifm@mpncontopt
+ \m@mpncontoptfalse
+\newcounter{pagenote}[chapter]
+\renewcommand{\thepagenote}{\arabic{pagenote}}
+\setcounter{pagenote}{0}
+
+\newcommand*{\notepageref}{\m@mpnpageopttrue}
+\@onlypreamble\notepageref
+\newcommand*{\continuousnotenums}{%
+ \counterwithout{pagenote}{chapter}
+ \renewcommand{\thepagenote}{\arabic{pagenote}}}
+\@onlypreamble\continuousnotenums
+
+\newif\ifmempagenotes
+ \mempagenotesfalse
+
+\newcommand*{\makepagenote}{%
+ \newwrite\@notefile
+ \immediate\openout\@notefile=\jobname.ent
+ \mempagenotestrue
+ \def\pagenote{\@bsphack\begingroup
+ \@sanitize
+ \m@m@wrpnote}%
+ \typeout{Writing note file \jobname.ent}%
+ \let\makepagenote\@empty}
+
+\newcommand{\immediate@protected@write}[3]{%
+ \begingroup
+ #2%
+ \let\protect\@unexpandable@protect
+ \edef\reserved@a{\immediate\write#1{#3}}%
+ \reserved@a
+ \endgroup
+ \if@nobreak\ifvmode\nobreak\fi\fi}
+
+\let\m@m@pnwrite\immediate@protected@write
+\AtBeginDocument{%
+ \ifm@mpnpageopt
+ \let\m@m@pnwrite\protected@write
+ \fi}
+
+\newcommand*{\pnchap}{\f@rtoc}
+\newcommand*{\pnschap}{\f@rbdy}
+
+\newcommand{\m@m@wrpnote}[2][]{%
+ \@ifmtarg{#1}{\refstepcounter{pagenote}%
+ \notenumintext{\thepagenote}}{}%
+ \ifm@mpn@new@chap
+ \global\m@mpn@new@chapfalse
+ \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}%
+ \fi
+ \ifm@mpn@new@schap
+ \global\m@mpn@new@schapfalse
+ \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}%
+ \fi
+ \m@m@pnwrite\@notefile{}
+ {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}%
+ \endgroup
+ \@esphack}
+
+\def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote}
+\newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack}
+
+\newcommand*{\pagetofootnote}{%
+ \let\memsavepagenote\pagenote
+ \renewcommand{\pagenote}[2][]{\footnote{##2}}}
+\newcommand*{\foottopagenote}{%
+ \let\memsavefootnote\footnote
+ \renewcommand*{\footnote}[2][]{\pagenote{##2}}}
+
+\newcommand{\addtonotes}[1]{\ifmempagenotes
+ \IfFileExists{\jobname.ent}{\m@m@pnwrite\@notefile{}{#1}}{\mempnofilewarn}%
+\fi}
+
+\newcommand{\notenumintext}[1]{%
+ \textsuperscript{#1}}
+\newcommand{\notenuminnotes}[1]{%
+ {\normalfont #1.}\space}
+\newcommand{\noteentry}[4]{%
+ \prenoteinnotes
+ \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}%
+ \postnoteinnotes}
+
+\newcommand{\idtextinnotes}[1]{%
+ [#1]\space}
+\newcommand{\noteidinnotes}[2]{%
+ \@ifmtarg{#2}{%
+ \notenuminnotes{#1}}{\idtextinnotes{#2}}}
+\newcommand{\pageinnotes}[1]{%
+ \ifm@mpnpageopt \printpageinnotes{#1}\fi}
+\newcommand*{\printpageinnotes}[1]{%
+ (\pagerefname\ #1)\space}
+\newcommand{\noteinnotes}[1]{#1}
+
+\newcommand{\prenoteinnotes}{\par\noindent}
+\newcommand{\postnoteinnotes}{\par}
+
+\providecommand*{\notesname}{Notes}
+\newcommand*{\notedivision}{\chapter{\notesname}}
+
+\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}}
+\newcommand*{\mempnofilewarn}{%
+ \ClassWarning{bidimemoir}{There is no .ent file}}
+
+\newcommand*{\@sprintpagenotes}{%
+ \ifmempagenotes
+ \notedivision
+\IfFileExists{\jobname.ent}{%
+ \immediate\closeout\@notefile
+ \input{\jobname.ent}%
+ \immediate\openout\@notefile=\jobname.ent%
+ }{%
+ \mempnofilewarn
+}%
+\fi}
+
+\newcommand*{\@printpagenotes}{%
+ \ifmempagenotes
+ \notedivision
+ \IfFileExists{\jobname.ent}{%
+ \immediate\closeout\@notefile
+ \input{\jobname.ent}%
+ }{%
+ \mempnofilewarn
+ }
+ \fi}
+
+\newcommand*{\pagenotesubhead}[3]{%
+ \section*{#1 #2 #3}}
+
+\newif\ifchangemarks\changemarksfalse
+\newcommand*{\changemarks}{\changemarkstrue}
+\newcommand*{\nochangemarks}{\changemarksfalse}
+
+\newcommand{\v@rid}[2]{%
+ \@bsphack
+ \ifchangemarks
+ \ifdraftdoc
+ \marginpar[#1]{#2}%
+ \fi\fi
+ \@esphack}
+
+\newcommand{\added}[1]{%
+ \@bsphack
+ \ifchangemarks
+ \v@rid{\small$\oplus$ #1}{\small$\oplus$ #1}%
+ \fi
+ \@esphack}
+\newcommand{\deleted}[1]{%
+ \@bsphack
+ \ifchangemarks
+ \v@rid{\small$\neq$ #1}{\small$\neq$ #1}%
+ \fi
+ \@esphack}
+\newcommand{\changed}[1]{%
+ \@bsphack
+ \ifchangemarks
+ \v@rid{\small$\Leftrightarrow$ #1}{\small$\Leftrightarrow$ #1}%
+ \fi
+ \@esphack}
+
+\newcommand*{\showtrimsoff}{\showtrimsfalse}
+\newcommand*{\showtrimson}{\showtrimstrue}
+
+\newcommand*{\trimmark}{%
+ \begin{picture}(0,0)
+ \unitlength 1cm
+ \thinlines
+ \put(-2,0){\line(1,0){4}}
+ \put(0,-2){\line(0,1){4}}
+ \end{picture}}
+
+\newcommand*{\Ltrimpictl}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(-2,0){\line(-1,0){18}}
+ \put(0,2){\line(0,1){18}}
+ \end{picture}}
+\newcommand*{\Ltrimpictr}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(2,0){\line(1,0){18}}
+ \put(0,2){\line(0,1){18}}
+ \end{picture}}
+\newcommand*{\Ltrimpicbl}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(-2,0){\line(-1,0){18}}
+ \put(0,-2){\line(0,-1){18}}
+ \end{picture}}
+\newcommand*{\Ltrimpicbr}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(2,0){\line(1,0){18}}
+ \put(0,-2){\line(0,-1){18}}
+ \end{picture}}
+
+\newcommand*{\Ftrimpicbl}{%
+ \begin{picture}(0,0)
+ \unitlength 1pt
+ \thinlines
+ \put(0,0){\framebox(\strip@pt\paperwidth,\strip@pt\paperheight){}}
+ \end{picture}}
+
+\newcommand*{\tmarktl}{\trimmark}
+\newcommand*{\tmarktr}{\trimmark}
+\newcommand*{\tmarkbl}{\trimmark}
+\newcommand*{\tmarkbr}{\trimmark}
+
+\newcommand*{\tmarktm}{}
+\newcommand*{\tmarkml}{}
+\newcommand*{\tmarkmr}{}
+\newcommand*{\tmarkbm}{}
+
+\newcommand*{\trimXmarks}{%
+ \let\tmarktl\trimmark
+ \let\tmarktr\trimmark
+ \let\tmarkbl\trimmark
+ \let\tmarkbr\trimmark}
+\newcommand*{\trimLmarks}{%
+ \let\tmarktl\Ltrimpictl
+ \let\tmarktr\Ltrimpictr
+ \let\tmarkbl\Ltrimpicbl
+ \let\tmarkbr\Ltrimpicbr}
+\newcommand*{\trimFrame}{%
+ \let\tmarktl\null
+ \let\tmarktr\null
+ \let\tmarkbl\Ftrimpicbl
+ \let\tmarkbr\null}
+\newcommand*{\trimNone}{%
+ \let\tmarktl\relax
+ \let\tmarktr\relax
+ \let\tmarkbl\relax
+ \let\tmarkbr\relax
+ \let\tmarktm\relax
+ \let\tmarkml\relax
+ \let\tmarkmr\relax
+ \let\tmarkbm\relax}
+
+\newcommand*{\trimmarks}{%
+ \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+ \hb@xt@\z@{\hskip-1in
+ \ifodd\c@page
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \else
+ \if@twoside
+ \hskip\trimedge % left of logical page
+ \else
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \fi
+ \fi
+ \vbox to \paperheight{%
+ \let\protect\relax % <- v1.4 addition
+ \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+ \hss}%
+ \vss}}
+
+\newcommand*{\registrationColour}[1]{#1}
+\newcommand*{\quarkmarks}{%
+\renewcommand*{\tmarktl}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(0,12){\line(0,1){24}}
+ \put(3,27){\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \
+ \today\ \ \printtime\ \ Page \thepage}
+ \end{picture}}}
+\renewcommand*{\tmarktm}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-24,24){\line(1,0){48}}
+ \put(0,12){\line(0,1){24}}
+ \put(0,24){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarktr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(0,12){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkmr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(24,-24){\line(0,1){48}}
+ \put(24,0){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarkbr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(0,-36){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkbm}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-24,-24){\line(1,0){48}}
+ \put(0,-36){\line(0,1){24}}
+ \put(0,-24){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarkbl}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(0,-36){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkml}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(-24,-24){\line(0,1){48}}
+ \put(-24,0){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\trimmarks}{%
+%% \special{papersize=\the\stockwidth,\the\stockheight}
+ {%
+ \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+ \hb@xt@\z@{\hskip-1in
+ \ifodd\c@page
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \else
+ \if@twoside
+ \hskip\trimedge % left of logical page
+ \else
+ \hskip\stockwidth \hsip-\trimedge \hskip-\paperwidth
+ \fi
+ \fi
+ \vbox to \paperheight{%
+ \let\protect\relax % <- v1.4 addition
+ \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+ \hss}%
+ \vss}}%
+}}
+
+\let\mem@oldshipout\shipout
+\newcommand*{\mem@shipi}{%
+ \ifvoid\@cclv\expandafter\aftergroup\fi\mem@shipii}
+\newcommand*\mem@shipii{%
+ \ifvoid\@cclv
+ \mem@oldshipout\box\@cclv
+ \else
+ \ifshowtrims
+ \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}%
+ \else
+ \mem@oldshipout\box\@cclv
+ \fi
+ \fi}
+\ifshowtrims
+ \renewcommand*{\shipout}{\afterassignment\mem@shipi\setbox\@cclv=}
+\fi
+
+\newtoks\every@verbatim
+ \every@verbatim={}
+\newtoks\afterevery@verbatim
+ \afterevery@verbatim={}
+
+\def\@makeother#1{\catcode`#112\relax}
+\begingroup
+ \catcode`\ =\active%
+ \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
+ \expandafter\endgroup\x
+\def\@xobeysp{\leavevmode\penalty\@M\ }
+\newtoks\verbatim@line
+\newcount\tab@position
+\def\@xobeytab{%
+ \loop
+ \toks@\expandafter{\the\toks@\@xobeysp}%
+ \advance\tab@position-1
+ \ifnum\tab@position>0 \repeat
+}
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}%
+\endgroup
+\def\verbatim@tabexpand#1{%
+ \ifx#1\@nil
+ \the\toks@
+ \expandafter\par
+ \else
+ \ifx#1\@xobeytab
+ \@xobeytab
+ \else
+ \toks@\expandafter{\the\toks@#1}%
+ \advance\tab@position\m@ne
+ \fi
+ \ifnum\tab@position=0 \tab@position\tab@size \fi
+ \expandafter\verbatim@tabexpand
+ \fi
+}
+
+\newif\ift@bs
+\newcommand{\tabson}[1][4]{%
+ \ifnum\@ne > #1\relax
+ \tabsoff
+ \else
+ \t@bstrue
+ \def\tab@size{#1\relax}%
+ \def\@maybeobeytabs{\@vobeytabs}%
+ \fi
+}
+\newcommand{\tabsoff}{%
+ \t@bsfalse
+ \def\tab@size{\z@}%
+ \def\@maybeobeytabs{}%
+}
+\tabsoff
+
+\def\tabverbatim@processline{\tab@position\tab@size
+ \toks@{}%
+ \expandafter\verbatim@tabexpand\the\verbatim@line\@nil}
+\def\notabverbatim@processline{\the\verbatim@line\par}
+
+\def\verbatim@startline{\verbatim@line{}}
+\def\verbatim@addtoline#1{%
+ \verbatim@line\expandafter{\the\verbatim@line#1}}
+\def\verbatim@processline{\notabverbatim@processline}
+\def\verbatim@finish{\ifcat$\the\verbatim@line$\else
+ \verbatim@processline\fi}
+\newcommand{\setverbatimfont}[1]{\def\m@mverbfont{#1}}
+\setverbatimfont{\normalfont\ttfamily}
+
+\def\verbatim@font{\m@mverbfont
+ \hyphenchar\font\m@ne
+ \let\do\do@noligs
+ \verbatim@nolig@list}
+
+\def\@verbatim{\the\every@verbatim
+ \trivlist \item \relax
+ \if@minipage\else\vskip\parskip\fi
+ \@beginparpenalty \predisplaypenalty
+ \if@RTL\rightskip\else\leftskip\fi\@totalleftmargin\if@RTL\leftskip\else\rightskip\fi\z@
+ \parindent\z@\parfillskip\@flushglue\parskip\z@
+ \@@par
+ \def\par{%
+ \if@tempswa
+ \leavevmode\null\@@par\penalty\interlinepenalty
+ \else
+ \@tempswatrue
+ \ifhmode\@@par\penalty\interlinepenalty\fi
+ \fi}%
+ \def\@noitemerr{\@warning{No verbatim text}}%
+ \obeylines
+ \let\do\@makeother \dospecials
+ \verbatim@font
+ \everypar \expandafter{\the\everypar \unpenalty}%
+ \wrapright\the\afterevery@verbatim}
+\def\verbatim{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@verbatim \frenchspacing\@vobeyspaces\@maybeobeytabs\verbatim@start}
+\@namedef{verbatim*}{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@verbatim\@maybeobeytabs\verbatim@start}
+\def\endverbatim{\endtrivlist\endgroup\@doendpe}
+\@namelet{endverbatim*}\endverbatim
+
+\newcommand{\setupcomment}{%
+ \let\do\@makeother\dospecials\catcode`\^^M\active
+ \let\verbatim@startline\relax
+ \let\verbatim@addtoline\@gobble
+ \let\verbatim@processline\relax
+ \let\verbatim@finish\relax}
+\newcommand{\newcomment}[1]{%
+ \expandafter\def\csname #1\endcsname{\@bsphack\setupcomment\verbatim@}%
+ \expandafter\let\csname end#1\endcsname=\@esphack}
+\newcommand{\commentsoff}[1]{%
+ \expandafter\def\csname #1\endcsname{}%
+ \expandafter\def\csname end#1\endcsname{}}
+\newcommand{\commentson}[1]{\newcomment{#1}}
+
+\newcomment{comment}
+
+\@ifundefined{vrb@catcodes}%
+ {\def\vrb@catcodes{%
+ \catcode`\!12\catcode`\[12\catcode`\]12}}{}
+\begingroup
+ \vrb@catcodes
+ \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
+ \catcode`\~=\active \lccode`\~=`\^^M
+ \lccode`\C=`\C
+ \lowercase{\endgroup
+ \def\verbatim@start#1{%
+ \verbatim@startline
+ \if\noexpand#1\noexpand~%
+ \let\next\verbatim@
+ \else \def\next{\verbatim@#1}\fi
+ \next}%
+ \def\verbatim@#1~{\verbatim@@#1!end\@nil}%
+ \def\verbatim@@#1!end{%
+ \verbatim@addtoline{#1}%
+ \futurelet\next\verbatim@@@}%
+ \def\verbatim@@@#1\@nil{%
+ \ifx\next\@nil
+ \verbatim@processline
+ \verbatim@startline
+ \let\next\verbatim@
+ \else
+ \def\@tempa##1!end\@nil{##1}%
+ \@temptokena{!end}%
+ \def\next{\expandafter\verbatim@test\@tempa#1\@nil~}%
+ \fi \next}%
+ \def\verbatim@test#1{%
+ \let\next\verbatim@test
+ \if\noexpand#1\noexpand~%
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena}%
+ \verbatim@processline
+ \verbatim@startline
+ \let\next\verbatim@
+ \else \if\noexpand#1
+ \@temptokena\expandafter{\the\@temptokena#1}%
+ \else \if\noexpand#1\noexpand[%
+ \let\@tempc\@empty
+ \let\next\verbatim@testend
+ \else
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena}%
+ \def\next{\verbatim@#1}%
+ \fi\fi\fi
+ \next}%
+ \def\verbatim@testend#1{%
+ \if\noexpand#1\noexpand~%
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena[}%
+ \expandafter\verbatim@addtoline
+ \expandafter{\@tempc}%
+ \verbatim@processline
+ \verbatim@startline
+ \let\next\verbatim@
+ \else\if\noexpand#1\noexpand]%
+ \let\next\verbatim@@testend
+ \else\if\noexpand#1\noexpand!%
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena[}%
+ \expandafter\verbatim@addtoline
+ \expandafter{\@tempc}%
+ \def\next{\verbatim@!}%
+ \else \expandafter\def\expandafter\@tempc\expandafter
+ {\@tempc#1}\fi\fi\fi
+ \next}%
+ \def\verbatim@@testend{%
+ \ifx\@tempc\@currenvir
+ \verbatim@finish
+ \edef\next{\noexpand\end{\@currenvir}%
+ \noexpand\verbatim@rescan{\@currenvir}}%
+ \else
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena[}%
+ \expandafter\verbatim@addtoline
+ \expandafter{\@tempc]}%
+ \let\next\verbatim@
+ \fi
+ \next}%
+ \def\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else
+ \@warning{Characters dropped after `\string\end{#1}'}\fi}}
+\newread\verbatim@in@stream
+\def\verbatim@readfile#1{%
+ \verbatim@startline
+ \openin\verbatim@in@stream #1\relax
+ \ifeof\verbatim@in@stream
+ \typeout{No file #1.}%
+ \else
+ \@addtofilelist{#1}%
+ \ProvidesFile{#1}[(verbatim)]%
+ \expandafter\endlinechar\expandafter\m@ne
+ \expandafter\verbatim@read@file
+ \expandafter\endlinechar\the\endlinechar\relax
+ \closein\verbatim@in@stream
+ \fi
+ \verbatim@finish
+}
+\def\verbatim@read@file{%
+ \read\verbatim@in@stream to\next
+ \ifeof\verbatim@in@stream
+ \else
+ \expandafter\verbatim@addtoline\expandafter{\next}%
+ \verbatim@processline
+ \verbatim@startline
+ \expandafter\verbatim@read@file
+ \fi
+}
+\def\verbatiminput{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@ifstar{\verbatim@input{\@maybeobeytabs}}%
+ {\verbatim@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+\def\verbatim@input#1#2{%
+ \IfFileExists {#2}{\@verbatim #1\relax
+ \verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}%
+ {\typeout {No file #2.}\endgroup}}
+\newlength{\verbatimindent}
+ \setlength{\verbatimindent}{3em}
+\newcommand*{\verbatimbreakchar}{\char`\%}
+\newcommand*{\setverbatimbreak}{%
+ \vspace*{-\baselineskip}%
+ \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+ {\kern\verbatimindent}{}}%
+}
+
+\newcommand*{\raggedwrap}{%
+ \@rightskip\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \if@RTL\rightskip\else\leftskip\fi\@totalleftmargin
+ \parindent\ragrparindent}
+\newcommand*{\wrappingon}{%
+ \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+ {\kern\verbatimindent}{}}%
+ \def\wrapright{\raggedwrap}}
+\newcommand*{\wrappingoff}{%
+ \def\@xobeysp{\leavevmode\penalty\@M\ }%
+ \def\wrapright{}}
+\wrappingoff
+
+\newwrite \verbatim@out
+\def\verbatimoutput#1{%
+ \@bsphack
+ \immediate\openout \verbatim@out #1
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active %% \catcode`\^^I=12
+ \def\verbatim@processline{%
+ \immediate\write\verbatim@out
+ {\the\verbatim@line}}%
+ \verbatim@start}
+\def\endverbatimoutput{%
+ \immediate\closeout\verbatim@out
+ \@esphack}
+\def\fboxverbatim{\begingroup%
+ \tabsoff %% PW otherwise box fills the width
+ \def\verbatim@processline{%
+ {\setbox0=\hbox{\the\verbatim@line}%
+ \hsize=\wd0 \the\verbatim@line\par}}%
+ \@minipagetrue%%%DPC%%%
+ \@tempswatrue%%%DPC%%%
+ \setbox0=\vbox\bgroup \verbatim
+}
+\def\endfboxverbatim{%
+ \endverbatim
+ \unskip\setbox0=\lastbox %%%DPC%%%
+ \egroup
+ \fbox{\box0}% <<<=== change here for centering,...
+\endgroup}
+\def\MakeShortVerb#1{%
+ \expandafter\ifx\csname cc\string#1\endcsname\relax
+ \@shortvrbinfo{Made }{#1}%
+ \add@special{#1}%
+ \expandafter
+ \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
+ \begingroup
+ \catcode`\~\active \lccode`\~`#1%
+ \lowercase{%
+ \global\expandafter\let
+ \csname ac\string#1\endcsname~%
+ \gdef~{\verb~}}%
+ \endgroup
+ \global\catcode`#1\active
+ \else
+ \@shortvrbinfo\@empty{#1 already}%
+ \fi}
+\def\DeleteShortVerb#1{%
+ \expandafter\ifx\csname cc\string#1\endcsname\relax
+ \else
+ \@shortvrbinfo{Deleted }{#1 as}%
+ \rem@special{#1}%
+ \global\catcode`#1\csname cc\string#1\endcsname
+ \global \expandafter\let \csname cc\string#1\endcsname \relax
+ \ifnum\catcode`#1=\active
+ \begingroup
+ \catcode`\~\active \lccode`\~`#1%
+ \lowercase{%
+ \global\expandafter\let\expandafter~%
+ \csname ac\string#1\endcsname}%
+ \endgroup \fi \fi}
+\def\@shortvrbinfo#1#2{%
+ \ClassInfo{bidimemoir}{%
+ #1\expandafter\@gobble\string#2 a short reference
+ for \string\verb}}
+\def\add@special#1{%
+ \rem@special{#1}%
+ \expandafter\gdef\expandafter\dospecials\expandafter
+ {\dospecials \do #1}%
+ \expandafter\gdef\expandafter\@sanitize\expandafter
+ {\@sanitize \@makeother #1}}
+\def\rem@special#1{%
+ \def\do##1{%
+ \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
+ \xdef\dospecials{\dospecials}%
+ \begingroup
+ \def\@makeother##1{%
+ \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
+ \xdef\@sanitize{\@sanitize}%
+ \endgroup}
+\def\boxverbflag{14 }
+\newlength{\bvboxsep} % user can change this
+\setlength{\bvboxsep}{1em}
+
+\newif\ifbvperpage % start/end lines on every page of multipage verbatim
+\bvperpagetrue
+
+\newcommand{\bvtopofpage}[1]{%
+ \long\def\b@vtop{#1}}
+\def\b@vtop{} % used in \boxverb@split for heading
+
+\newcounter{memfbvline}
+ \c@memfbvline=\z@
+\newcounter{bvlinectr}
+\newcommand*{\setbvlinenums}[2]{%
+ \c@bvlinectr #1\relax \advance\c@bvlinectr \m@ne
+ \ifnum\z@<\linemodnum% we are printing line numbers
+ \@tempcnta #2\relax
+ \divide\@tempcnta\linemodnum
+ \multiply\@tempcnta\linemodnum
+ \c@memfbvline #2\relax
+ \advance\c@memfbvline-\@tempcnta
+ \fi}
+
+\def\theb@vlinenumber{\getthelinenumber{bvlinectr}{memfbvline}}
+\newcommand*{\resetbvlinenumber}{\setcounter{bvlinectr}{0}}
+
+\def\b@vdocount{\ifbvcountlines\stepcounter{bvlinectr}\fi}
+\newlength{\bvnumlength}
+%% \settowidth{\bvnumlength}{\vlvnumfont 9999}
+\settowidth{\bvnumlength}{\normalfont 999}
+
+\newif\ifbvcountinside % TRUE if line numbers inside box
+ \bvcountinsidetrue
+\newcommand*{\bvnumbersinside}{\bvcountinsidetrue}
+\newcommand*{\bvnumbersoutside}{\bvcountinsidefalse}
+
+\def\b@vdoinside{%
+ \ifbvcountlines\ifbvcountinside%
+ \makebox[\bvnumlength][r]{%
+ \vlvnumfont \theb@vlinenumber\space}%
+ \fi\fi}
+
+\def\b@vdooutside{%
+ \ifbvcountlines\ifbvcountinside\else%
+ \llap{\makebox[\bvnumlength][r]{%
+ \vlvnumfont \theb@vlinenumber\space}}%
+ \fi\fi}
+
+\newcommand*{\@@m@mline}{\hb@xt@\linewidth}
+
+\newcommand{\setupboxverb@line}{%
+ \par
+ \ifbvperpage
+ \output=\expandafter{\expandafter\boxverb@split \the\output}
+ \fi
+ \def\verbatim@processline{\leavevmode
+ \b@vdocount%
+ \bvleftsidehook\vbox{\advance% \hsize-.8\p@ \@@line % changed to \linewidth
+ \linewidth-.8\p@ \@@line
+ {\b@vdooutside\strut\kern\bvboxsep%
+ \b@vdoinside%
+ \ift@bs
+ \tabverbatim@processline
+ \else
+ \the\verbatim@line
+ \fi
+ \hss}%
+ \kern\bvboxsep}\bvrightsidehook\par}}
+
+\newcommand{\setupbox@verb}{%
+ \if@RTL\rightskip\else\leftskip\fi\z@skip \if@RTL\leftskip\else\rightskip\fi\z@skip
+ \interlinepenalty\boxverbflag
+ \parfillskip\z@ plus\p@ minus\p@
+ \lineskip-\bvboxsep \baselineskip\z@skip
+ \frenchspacing\@vobeyspaces\@maybeobeytabs
+ \boxverb@toprule}
+
+\def\boxedverbatim{\begingroup
+ \let\@@line\@@m@mline% new from mempatch v4.9
+ \setupboxverb@line
+ \@verbatim
+ \setupbox@verb
+ \verbatim@start}
+\def\endboxedverbatim{\bvendrulehook\endtrivlist\endgroup\@doendpe}
+\@namedef{boxedverbatim*}{\let\frenchspacing\@gobble \boxedverbatim}
+\@namelet{endboxedverbatim*}\endboxverbatim
+
+\def\boxverb@toprule{\bvtoprulehook
+ \@@line{\bvleftsidehook \bvtopmidhook \bvrightsidehook}}
+
+\newcommand*{\bvendofpage}[1]{%
+ \def\boxverb@botpage{#1}}
+%%%%\bvendofpage{\hrule\kern-.4pt}
+\bvendofpage{\hrule width\linewidth\kern-.4pt}
+
+\def\boxverb@split{\ifnum\outputpenalty=\boxverbflag
+ \ifdim\dp\@cclv=\z@
+%%%% \setbox\@cclv\vbox{\unvbox\@cclv\hrule\kern-.4pt}%
+ \setbox\@cclv\vbox{\unvbox\@cclv\boxverb@botpage}%
+ \null \kern-.7\topskip \b@vtop \boxverb@toprule
+ \fi
+\fi}
+
+\def\bvtoprulehook{\hrule width\linewidth \nobreak\vskip-.1\p@}
+\def\bvendrulehook{\hrule width\linewidth}
+\def\bvleftsidehook{\vrule}
+\def\bvrightsidehook{\vrule}
+\def\bvtopmidhook{\rule{0\p@}{2\bvboxsep} \hss}
+
+\newcommand{\boxedverbatiminput}{\begingroup
+ \@ifstar{\let\frenchspacing\@gobble
+ \boxedverbatim@input\relax}%
+ {\boxedverbatim@input{\frenchspacing\@vobeyspaces}}}
+
+\def\boxedverbatim@input#1#2{%
+ \setupboxverb@line
+ \IfFileExists{#2}{\@verbatim #1\relax
+ \setupbox@verb
+ \verbatim@readfile{\@filef@und}%
+ \bvendrulehook\endtrivlist\endgroup\@doendpe}%
+ {\typeout {No file #2.}\endgroup}}
+
+\newcommand{\bvbox}{%
+ \bvperpagetrue%
+ \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}%
+ \renewcommand{\bvleftsidehook}{\vrule}%
+ \renewcommand{\bvrightsidehook}{\vrule}%
+ \renewcommand{\bvendrulehook}{\hrule}}
+
+\newcommand{\nobvbox}{%
+ \bvperpagefalse%
+ \renewcommand{\bvtoprulehook}{}%
+ \renewcommand{\bvleftsidehook}{}%
+ \renewcommand{\bvrightsidehook}{}%
+ \renewcommand{\bvendrulehook}{}}
+
+\newcommand{\bvtopandtail}{%
+ \bvperpagefalse%
+ \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}%
+ \renewcommand{\bvleftsidehook}{}%
+ \renewcommand{\bvrightsidehook}{}%
+ \renewcommand{\bvendrulehook}{\hrule}}
+
+\newcommand{\bvsides}{%
+ \bvperpagefalse%
+ \renewcommand{\bvtoprulehook}{\vskip 3ex}%
+ \renewcommand{\bvleftsidehook}{\vrule}%
+ \renewcommand{\bvrightsidehook}{\vrule}%
+ \renewcommand{\bvendrulehook}{}}
+
+\let\framed\relax \let\endframed\relax
+\let\shaded\relax \let\endshaded\relax
+
+\chardef\FrameRestore=\catcode`\| % for debug
+\catcode`\|=\catcode`\% % (debug: insert space after backslash)
+
+\def\MakeFramed#1{\par
+ \fb@sizeofframe\FrameCommand
+ \let\width\fb@frw \let\height\fb@frh
+ \begingroup
+ \skip@\lastskip
+ \if@nobreak\else
+ \penalty9999 % updates \page parameters
+ \ifdim\pagefilstretch=\z@ \ifdim\pagefillstretch=\z@
+ \edef\@tempa{\the\skip@}%
+ \ifx\@tempa\zero@glue \penalty-30
+ \else \vskip-\skip@ \penalty-30 \vskip\skip@
+ \fi\fi\fi
+ \penalty\z@
+ \advance\skip@ \z@ plus-.5\baselineskip
+ \advance\skip@ \z@ plus-.231\height
+ \advance\skip@ \z@ plus-.231\skip@
+ \advance\skip@ \z@ plus-.231\topsep
+ \vskip-\skip@ \penalty 1800 \vskip\skip@
+ \fi
+ \addvspace{\topsep}%
+ \endgroup
+ \penalty\@M \vskip 2\baselineskip \vskip\height
+ \penalty9999 \vskip -2\baselineskip \vskip-\height
+ \penalty9999 % updates \pagetotal
+|\message{After clearout, \pagetotal=\the\pagetotal,
+| \pagegoal=\the\pagegoal. }%
+ \fb@adjheight
+ \setbox\@tempboxa\vbox\bgroup
+ #1% Modifications to \hsize (can use \width and \height)
+ \textwidth\hsize \columnwidth\hsize}
+
+\def\endMakeFramed{\par
+ \kern\z@
+ \hrule\@width\hsize\@height\z@
+ \penalty-100 % put depth into height
+ \egroup
+ % {\showoutput\showbox\@tempboxa}%
+ \begingroup
+ \fb@put@frame\FrameCommand\FirstFrameCommand
+ \endgroup}
+
+\def\fb@put@frame#1#2{\relax
+ \ifdim\pagegoal=\maxdimen \pagegoal\vsize \fi
+ \ifinner
+ \fb@putboxa#1%
+ \fb@afterframe
+ \else
+ \dimen@\pagegoal \advance\dimen@-\pagetotal % natural space left on page
+ \ifdim\dimen@<2\baselineskip % Too little room on page
+| \message{Page has only \the\dimen@\space room left; eject. }%
+ \eject \fb@adjheight \fb@put@frame#1#2%
+ \else % there's appreciable room left on the page
+ \fb@sizeofframe#1%
+| \message{\string\pagetotal=\the\pagetotal,
+| \string\pagegoal=\the\pagegoal,
+| \string\pagestretch=\the\pagestretch,
+| \string\pageshrink=\the\pageshrink,
+| \string\fb@frh=\fb@frh. \space}
+| \message{Box of size \the\ht\@tempboxa\space + \fb@frh}%
+ \begingroup % temporarily set \dimen@ to be...
+ \advance\dimen@.8\pageshrink % maximum space available on page
+ \advance\dimen@-\fb@frh\relax % space available for frame's contents
+ \expandafter\endgroup
+ \ifdim\dimen@>\ht\@tempboxa % whole box does fit
+| \message{fits in \the\dimen@. }%
+ \fb@putboxa#1%
+ \fb@afterframe
+ \else % box must be split
+| \message{must be split to fit in \the\dimen@. }%
+ \fb@sizeofframe#2%
+ \setbox\@tempboxa\vbox{% simulate frame and flexiblity of the page:
+ \vskip \fb@frh \@plus\pagestretch \@minus.8\pageshrink
+ \kern137sp\kern-137sp\penalty-30
+ \unvbox\@tempboxa}%
+ \edef\fb@resto@set{\boxmaxdepth\the\boxmaxdepth
+ \splittopskip\the\splittopskip}%
+ \boxmaxdepth\z@ \splittopskip\z@
+| \message{Padded box of size \the\ht\@tempboxa\space split
+| to \the\dimen@}%
+ \setbox\tw@\vsplit\@tempboxa to\dimen@
+| \toks99\expandafter{\splitfirstmark}%
+| \toks98\expandafter{\splitbotmark}%
+| \message{Marks are: \the\toks99, \the\toks98. }%
+ \setbox\tw@\vbox{\unvbox\tw@}% natural-sized
+| \message{Natural height of split box is \the\ht\tw@, leaving
+| \the\ht\@tempboxa\space remainder. }%
+ \begingroup
+ \advance\dimen@\topskip
+ \expandafter\endgroup
+ \ifdim\dimen@>\pagegoal
+| \message{Frame is big -- Use up the full column. }%
+ \dimen@ii\pagegoal
+ \advance\dimen@ii -\topskip
+ \advance\dimen@ii \FrameHeightAdjust\relax
+ \else % suspect this is wrong:
+ \advance\dimen@.8\pageshrink
+ \ifdim\ht\tw@>\dimen@
+| \message{Box too tall; rebox it to \the\dimen@. }%
+ \dimen@ii\dimen@
+ \else % use natural size
+ \dimen@ii\ht\tw@
+ \fi
+ \fi
+ \advance\dimen@ii -\fb@frh
+ \setbox\tw@\vbox to\dimen@ii \bgroup
+ \vskip -\fb@frh \@plus-\pagestretch \@minus-.8\pageshrink
+ \unvbox\tw@ \unpenalty\unpenalty
+ \ifdim\lastkern=-137sp % whole box went to next page
+| \message{box split at beginning! }%
+ % need work here???
+ \egroup \fb@resto@set \eject % (\vskip for frame size was discarded)
+ \fb@adjheight
+ \fb@put@frame#1#2% INSERTED ???
+ \else % Got material split off at the head
+ \egroup \fb@resto@set
+ \ifvoid\@tempboxa % it all fit after all
+| \message{box split at end! }%
+ \setbox\@tempboxa\box\tw@
+ \fb@putboxa#1%
+ \fb@afterframe
+ \else % it really did split
+| \message{box split as expected. Its reboxed height
+| is \the\ht\tw@. }%
+ \ifdim\wd\tw@>\z@
+ \wd\tw@\wd\@tempboxa
+ \memfblineboxtwo{#2{\box\tw@}}% ??? \centerline bad idea? \\
+ \else
+| \message{Zero width means likely blank.
+| Don't frame it (guess)}%
+ \box\tw@
+ \fi
+ \hrule \@height\z@ \@width\hsize
+ \eject
+ \fb@adjheight
+ \fb@put@frame\LastFrameCommand\MidFrameCommand
+ \fi\fi\fi\fi\fi}
+
+\newcommand{\memfblineboxtwo}[1]{\centerline{#1}}
+\newcommand{\memfblineboxa}[1]{\centerline{#1}}
+
+\def\fb@putboxa#1{%
+ \ifvoid\@tempboxa
+%%%% PackageWarning{framed}{Boxa is void -- discard it. }%
+ \@memwarn{Boxa is void -- discard it. }%
+ \else
+| \message{Frame and place boxa. }%
+| %{\showoutput\showbox\@tempboxa}%
+%%%%%%% \centerline{#1{\box\@tempboxa}}%
+ \memfblineboxa{#1{\box\@tempboxa}}%
+ \fi}
+
+\def\fb@afterframe{%
+ \nointerlineskip \null %{\showoutput \showlists}
+ \penalty-30 \vskip\topsep \relax}
+
+\newdimen\fb@frw
+\newdimen\fb@frh
+\def\fb@sizeofframe#1{\begingroup
+ \setbox\z@\vbox{\vskip-5in \hbox{\hskip-5in
+ #1{\hbox{\vrule \@height 4.7in \@depth.3in \@width 5in}}}%
+ \vskip\z@skip}%
+| \message{Measuring frame addition for \string#1 in \@currenvir\space
+| gives ht \the\ht\z@\space and wd \the\wd\z@. }%
+ \global\fb@frw\wd\z@ \global\fb@frh\ht\z@
+ \endgroup}
+
+\def\fb@adjheight{%
+ \vbox to\FrameHeightAdjust{}% get proper baseline skip from above.
+ \penalty\@M \nointerlineskip
+ \vskip-\FrameHeightAdjust
+ \penalty\@M} % useful for tops of pages
+
+\edef\zero@glue{\the\z@skip}
+
+\catcode`\|=\FrameRestore
+
+\providecommand\FrameCommand{%
+ \setlength\fboxrule{\FrameRule}\setlength\fboxsep{\FrameSep}%
+ \fbox}
+\@ifundefined{FrameRule}{\newdimen\FrameRule \FrameRule=\fboxrule}{}
+\@ifundefined{FrameSep} {\newdimen\FrameSep \FrameSep =3\fboxsep}{}
+\providecommand\FirstFrameCommand{\FrameCommand}
+\providecommand\MidFrameCommand{\FrameCommand}
+\providecommand\LastFrameCommand{\FrameCommand}
+\providecommand\FrameHeightAdjust{6pt}
+
+\def\FrameRestore{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ % \message{FrameRestore:
+ % \@totalleftmargin=\the \@totalleftmargin,
+ % \rightmargin=\the\rightmargin,
+ % \@listdepth=\the\@listdepth. }%
+ \ifnum \ifdim\@totalleftmargin>\z@ 1\fi
+ \ifdim\rightmargin>\z@ 1\fi
+ \ifnum\@listdepth>0 1\fi 0>\z@
+ % \message{In a list: \linewidth=\the\linewidth,
+ % \@totalleftmargin=\the\@totalleftmargin,
+ % \parshape=\the\parshape, \columnwidth=\the\columnwidth,
+ % \hsize=\the\hsize,
+ % \labelwidth=\the\labelwidth. }%
+%%% \@setminipage % snug fit around the item
+%%% \advance\linewidth-\columnwidth \advance\linewidth\hsize
+%%% \parshape\@ne \@totalleftmargin \linewidth
+ \memfblistfixparams
+ \else % Not in list
+ \linewidth=\hsize
+ %\message{No list, set \string\linewidth=\the\hsize. }%
+ \fi
+ \sloppy}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand*{\memfblistfixparams}{%
+ \@setminipage % snug fit around the item
+ \advance\linewidth-\columnwidth \advance\linewidth\hsize
+ \parshape\@ne \@totalleftmargin \linewidth}
+
+\newenvironment{framed}% using default \FrameCommand
+ {\MakeFramed {\advance\hsize-\width \FrameRestore}}%
+ {\endMakeFramed}
+
+\newenvironment{shaded}{%
+ \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolor}}%
+ \MakeFramed {\FrameRestore}}%
+ {\endMakeFramed}
+
+\newenvironment{leftbar}{%
+ \def\FrameCommand{\vrule width 3pt \hspace{10pt}}%
+ \MakeFramed {\advance\hsize-\width \FrameRestore}}%
+ {\endMakeFramed}
+
+\newenvironment{snugshade}{%
+ \def\FrameCommand{\colorbox{shadecolor}}%
+ \MakeFramed {\FrameRestore\@setminipage}}%
+ {\par\unskip\endMakeFramed}
+
+\AtBeginPackage{framed}{%
+ \let\framed\relax \let\endframed\relax
+ \let\shaded\relax \let\endshaded\relax
+ \let\leftbar\relax \let\endleftbar\relax
+ \let\snugshade\relax \let\endsnugshade\relax}
+
+\newenvironment{qframe}{%
+ \def\FrameCommand##1{\fboxrule=\FrameRule\fboxsep=\FrameSep
+ \hskip\@totalleftmargin\fbox{##1}% There is no \@totalrightmargin, so...
+ \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+ \MakeFramed{\advance\hsize-\width
+ \advance\hsize \FrameSep
+ \@totalleftmargin\z@ \linewidth=\hsize}}%
+ {\endMakeFramed}
+
+\newenvironment{qshade}{%
+ \def\FrameCommand##1{\fboxsep=\FrameSep
+ \hskip\@totalleftmargin
+ \hskip -1\FrameSep
+ \colorbox{shadecolor}{##1}%
+ \hskip-\linewidth \hskip-\@totalleftmargin
+ \hskip -1\FrameSep
+ \hskip\columnwidth}%
+ \MakeFramed{\advance\hsize-\width
+ \advance\hsize 3\FrameSep
+ \@totalleftmargin\z@ \linewidth=\hsize}}%
+ {\endMakeFramed}
+
+\newcommand*{\newoutputstream}[1]{%
+ \@ifundefined{#1outstre@m}%
+ {\expandafter\newwrite\csname #1outstre@m\endcsname
+ \csname newif\expandafter\endcsname
+ \csname ifstre@m#1open\endcsname
+ \global\csname stre@m#1openfalse\endcsname
+ \expandafter\ifx\csname atstreamopen#1\endcsname\relax
+ \global\@namedef{atstreamopen#1}{}%
+ \fi
+ \expandafter\ifx\csname atstreamclose#1\endcsname\relax
+ \global\@namedef{atstreamclose#1}{}%
+ \fi
+ }%
+ {\@memwarn{Output stream #1\space is already defined}}}
+
+\newcommand*{\newinputstream}[1]{%
+ \@ifundefined{#1instre@m}%
+ {\expandafter\newread\csname #1instre@m\endcsname
+ \csname newif\expandafter\endcsname
+ \csname ifstre@m#1open\endcsname
+ \global\csname stre@m#1openfalse\endcsname
+ \expandafter\ifx\csname atstreamopen#1\endcsname\relax
+ \global\@namedef{atstreamopen#1}{}%
+ \fi
+ \expandafter\ifx\csname atstreamclose#1\endcsname\relax
+ \global\@namedef{atstreamclose#1}{}%
+ \fi
+ }%
+ {\@memwarn{Input stream #1\space is already defined}}}
+
+\newcommand{\IfStreamOpen}[3]{%
+ \csname ifstre@m#1open\endcsname#2\else#3\fi}
+\newcommand{\instre@mandopen}[2]{%
+ \@ifundefined{#1instre@m}{%
+ \@memwarn{#1\space is not an input stream}}%
+ {\IfStreamOpen{#1}{#2}{%
+ \@memwarn{Input stream #1\space is not open}}}}
+
+\newcommand{\instre@mandclosed}[2]{%
+ \@ifundefined{#1instre@m}{%
+ \@memwarn{#1\space is not an input stream}}%
+ {\IfStreamOpen{#1}{%
+ \@memwarn{Input stream #1\space is open}}{#2}}}
+
+\newcommand{\outstre@mandopen}[2]{%
+ \@ifundefined{#1outstre@m}{%
+ \@memwarn{#1\space is not an output stream}}%
+ {\IfStreamOpen{#1}{#2}{%
+ \@memwarn{Output stream #1\space is not open}}}}
+
+\newcommand{\outstre@mandclosed}[2]{%
+ \@ifundefined{#1outstre@m}{%
+ \@memwarn{#1\space is not an output stream}}%
+ {\IfStreamOpen{#1}{%
+ \@memwarn{Output stream #1\space is open}}{#2}}}
+
+\newcommand*{\openoutputfile}[2]{%
+ \outstre@mandclosed{#2}{%
+ \global\@namedef{#1@filename}{#1}%
+ \if@filesw
+ \immediate\openout\@nameuse{#2outstre@m}=\@nameuse{#1@filename}%
+ \fi
+ \global\csname stre@m#2opentrue\endcsname%
+ \@nameuse{atstreamopen#2}}}
+
+\newcommand*{\closeoutputstream}[1]{%
+ \outstre@mandopen{#1}{%
+ \@nameuse{atstreamclose#1}%
+ \immediate\closeout\@nameuse{#1outstre@m}%
+ \global\csname stre@m#1openfalse\endcsname}}
+
+\newcommand{\openinputfile}[2]{%
+ \IfFileExists{#1}{% file exists
+ \instre@mandclosed{#2}{%
+ \@addtofilelist{#1}%
+ \global\@namedef{#1@filename}{#1}%
+ \immediate\openin\@nameuse{#2instre@m}=\@nameuse{#1@filename}%
+ \global\csname stre@m#2opentrue\endcsname%
+ \@nameuse{atstreamopen#2}}}%
+ {% file not found
+ \typeout{No file #1.}
+ }}
+
+\newcommand{\closeinputstream}[1]{%
+ \instre@mandopen{#1}{%
+ \@nameuse{atstreamclose#1}%
+ \immediate\closein\@nameuse{#1instre@m}%
+ \global\csname stre@m#1openfalse\endcsname}}
+
+\def\writeverbatim#1{%
+ \@bsphack
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active
+ \def\verbatim@processline{%
+ \immediate\write\@nameuse{#1outstre@m}{\the\verbatim@line}}%
+ \verbatim@start}
+\def\endwriteverbatim{\@esphack}
+
+\newcommand{\addtostream}[2]{%
+ \@bsphack
+ \outstre@mandopen{#1}{%
+ {\let\protect\string
+ \immediate\write\@nameuse{#1outstre@m}{#2}%
+ }}%
+ \@esphack}
+
+\newif\ifstre@mnoteof
+\newcommand{\checkstre@meof}[1]{%
+ \stre@mnoteoftrue\ifeof\@nameuse{#1instre@m}\stre@mnoteoffalse\fi}
+
+\def\readstream#1{
+ \instre@mandopen{#1}{%
+ \loop \checkstre@meof{#1} \ifstre@mnoteof
+ \read\@nameuse{#1instre@m} to\temptokstre@m
+ \temptokstre@m
+ \repeat
+ }}
+
+\def\readaline#1{
+ \instre@mandopen{#1}{%
+ \ifeof\@nameuse{#1instre@m}
+ \@memwarn{No more to read from stream #1}
+ \else
+ \read\@nameuse{#1instre@m} to\temptokstre@m
+ \temptokstre@m
+ \fi}}
+
+\def\readverbatim{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@ifstar{\stre@mverb@input{\@maybeobeytabs}}%
+ {\stre@mverb@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+
+\newcommand{\stre@mverb@input}[2]{%
+ \IfStreamOpen{#2}%
+ {\@verbatim #1\relax
+ \def\@verbinstre@m{\@nameuse{#2instre@m}}
+ \verb@readstre@m\endtrivlist\endgroup\@doendpe}%
+ {\@memwarn{Stream #2\space is not open}\endgroup}}
+
+\newcommand{\verb@readstre@m}{%
+ \verbatim@startline
+ \expandafter\endlinechar\expandafter\m@ne
+ \expandafter\verbatim@read@stre@m
+ \expandafter\endlinechar\the\endlinechar\relax
+ \verbatim@finish}
+
+\newcommand{\verbatim@read@stre@m}{%
+ \read\@verbinstre@m to\next
+ \ifeof\@verbinstre@m
+ \else
+ \expandafter\verbatim@addtoline\expandafter{\next}%
+ \verbatim@processline
+ \verbatim@startline
+ \expandafter\verbatim@read@stre@m
+ \fi}
+
+\newcommand{\readboxedverbatim}{\begingroup
+ \@ifstar{\stre@mbvin\relax}%
+ {\stre@mbvin{\frenchspacing\@vobeyspaces}}}
+
+\newcommand{\stre@mbvin}[2]{%
+ \IfStreamOpen{#2}%
+ {\setupboxverb@line
+ \@verbatim #1\relax
+ \def\@verbinstre@m{\@nameuse{#2instre@m}}%
+ \setupbox@verb
+ \verb@readstre@m\bvendrulehook\endtrivlist\endgroup\@doendpe}%
+ {\@memwarn{Stream #2\space is not open}\endgroup}}
+
+\newcommand{\provideenvironment}{\@star@or@long\m@mprovenv}
+\newcommand{\m@mprovenv}[1]{\@ifundefined{#1}%
+ {\new@environment{#1}}% % create new environment
+ {\@memwarn{Environment `#1' already defined}%
+ \m@mgobbleoptsandtwo}}
+\newcommand{\m@mgobbleoptsandtwo}{%
+ \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}}
+\def\m@mgobbleoptandtwo[#1]{%
+ \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}}
+
+\newcommand*{\providecounter}[1]{%
+ \@ifundefined{c@#1}%
+ {\newcounter{#1}}%
+ {\@memwarn{Counter `#1' already defined}%
+ \@ifnextchar[{\m@mgobbleopt}{}}}
+
+\def\m@mgobbleopt[#1]{}
+
+\newcommand*{\providelength}[1]{%
+ \begingroup
+ \escapechar\m@ne\xdef\@gtempa{{\string#1}}%
+ \endgroup
+ \expandafter\@ifundefined\@gtempa
+ {\newlength{#1}}%
+ {\@memwarn{Length #1 already defined}}}
+
+\newcommand*{\newloglike}{\@ifstar{\m@mnewlogs}{\m@mnewlog}}
+\newcommand*{\m@mnewlogs}[2]{%
+ \newcommand*{#1}{\mathop{\operator@font #2}}}
+\newcommand*{\m@mnewlog}[2]{%
+ \newcommand*{#1}{\mathop{\operator@font #2}\nolimits}}
+
+\newcommand*{\provideloglike}{\@ifstar{\m@mprovlogs}{\m@mprovlog}}
+\newcommand*{\m@mprovlogs}[2]{%
+ \providecommand*{#1}{\mathop{\operator@font #2}}}
+\newcommand*{\m@mprovlog}[2]{%
+ \providecommand*{#1}{\mathop{\operator@font #2}\nolimits}}
+
+\providecommand{\@removefromreset}[2]{{%
+ \expandafter\let\csname c@#1\endcsname\@removefromreset
+ \def\@elt##1{%
+ \expandafter\ifx\csname c@##1\endcsname\@removefromreset
+ \else
+ \noexpand\@elt{##1}%
+ \fi}%
+ \expandafter\xdef\csname cl@#2\endcsname{%
+ \csname cl@#2\endcsname}}}
+
+\newcommand{\@ifbothcntrs}[3]{%
+ \@ifundefined{c@#1}{% counter undefined
+ \@memerror{#1 is not a counter}{\@eha}}%
+ {% else counter is defined
+ \@ifundefined{c@#2}{% within undefined
+ \@memerror{#2 is not a counter}{\@eha}}%
+ {% else both counter and within are defined
+ #3}}}
+
+\newcommand{\counterwithin}{\@ifstar{\@csinstar}{\@csin}}
+\newcommand{\@csinstar}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}}}
+\newcommand{\@csin}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}%
+ \@namedef{the#1}{\@nameuse{the#2}.\arabic{#1}}}}
+
+\newcommand{\counterwithout}{\@ifstar{\@csoutstar}{\@csout}}
+\newcommand{\@csoutstar}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}}}
+\newcommand{\@csout}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}%
+ \@namedef{the#1}{\arabic{#1}}}}
+
+\newif\ifoddpage
+\newif\ifstrictpagecheck
+ \strictpagecheckfalse
+\newcommand*{\strictpagecheck}{\strictpagechecktrue}
+\newcommand*{\easypagecheck}{\strictpagecheckfalse}
+
+\newcounter{cp@cntr}
+\newcommand{\cplabel}{^_}
+\DeclareRobustCommand{\checkoddpage}{%
+ \oddpagefalse%
+ \ifstrictpagecheck%
+ \stepcounter{cp@cntr}\pmemlabel{\cplabel\thecp@cntr}%
+ \@memcnta=\pmemlabelref{\cplabel\thecp@cntr}\relax
+ \ifodd\@memcnta\oddpagetrue\fi
+ \else
+ \ifodd\c@page\oddpagetrue\fi
+ \fi}
+
+\gdef\thepmemc@@page{\the\c@page}
+
+\long\def\pmemprotected@write#1#2#3{%
+ \begingroup
+ \let\thepmemc@@page\relax
+ #2%
+ \let\protect\@unexpandable@protect
+ \edef\reserved@a{\write#1{#3}}%
+ \reserved@a
+ \endgroup
+ \if@nobreak\ifvmode\nobreak\fi\fi}
+
+\newcommand{\pmemlabel}[1]{\@bsphack
+ \pmemprotected@write\@auxout{}%
+ {\string\newpmemlabel{#1}{\thepmemc@@page}}%
+ \@esphack}
+\newcommand{\newpmemlabel}[2]{{\global\@namedef{m@#1}{#2}}}
+\newcommand{\pmemlabelref}[1]{%
+ \expandafter\ifx\csname m@#1\endcsname\relax
+ 0%
+ \else
+ \csname m@#1\endcsname
+ \fi}
+
+\begingroup
+\catcode`\Q=3
+\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
+\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}
+\long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil}
+\endgroup
+
+\DeclareRobustCommand{\ch@ngetext}{%
+ \setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}%
+ \setlength{\vsize}{\textheight}\setlength{\columnwidth}{\textwidth}%
+ \if@twocolumn%
+ \advance\columnwidth-\columnsep \divide\columnwidth\tw@%
+ \@firstcolumntrue%
+ \fi%
+ \setlength{\hsize}{\columnwidth}%
+ \setlength{\linewidth}{\hsize}}
+
+\DeclareRobustCommand{\changetext}[5]{%
+ \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
+ \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
+ \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
+ \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
+ \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
+ \ch@ngetext}
+
+\DeclareRobustCommand{\changepage}[9]{%
+ \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
+ \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
+ \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
+ \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
+ \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
+ \ch@ngetext
+ \@ifmtarg{#6}{}{\addtolength{\topmargin}{#6}}%
+ \@ifmtarg{#7}{}{\addtolength{\headheight}{#7}}%
+ \@ifmtarg{#8}{}{\addtolength{\headsep}{#8}}%
+ \@ifmtarg{#9}{}{\addtolength{\footskip}{#9}}}
+
+\newenvironment{adjustwidth}[2]{%
+ \begin{list}{}{%
+ \topsep\z@%
+ \listparindent\parindent%
+ \parsep\parskip%
+ \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
+ {\setlength{\leftmargin}{#1}}%
+ \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
+ {\setlength{\rightmargin}{#2}}%
+ }
+ \item[]}{\end{list}}
+
+\newenvironment{adjustwidth*}[2]{%
+ \begin{list}{}{%
+ \topsep\z@%
+ \listparindent\parindent%
+ \parsep\parskip%
+ \checkoddpage
+ \ifoddpage % odd numbered page
+ \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
+ {\setlength{\leftmargin}{#1}}%
+ \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
+ {\setlength{\rightmargin}{#2}}%
+ \else % even numbered page
+ \@ifmtarg{#2}{\setlength{\leftmargin}{\z@}}%
+ {\setlength{\leftmargin}{#2}}%
+ \@ifmtarg{#1}{\setlength{\rightmargin}{\z@}}%
+ {\setlength{\rightmargin}{#1}}%
+ \fi
+ }
+ \item[]}{\end{list}}
+
+\newcommand{\calccentering}[1]{
+ #1 = \paperwidth
+ \advance #1 by -\textwidth
+ \divide #1 by \tw@
+ \advance #1 by -\spinemargin}
+
+\newenvironment{vplace}[1][1]{%
+ \par\vspace{\stretch{#1}}%
+}{%
+ \vspace*{\stretch{1}}%
+ \par}
+
+\newcommand{\cleartoevenpage}[1][\@empty]{%
+ \clearpage%
+ \ifodd\c@page\hbox{}#1\clearpage\fi}
+
+\newcommand{\movetoevenpage}[1][\@empty]{%
+ \newpage%
+ \ifodd\c@page\hbox{}#1\newpage\fi}
+
+\newcommand{\cleartooddpage}[1][\@empty]{%
+ \clearpage%
+ \ifodd\c@page\else\hbox{}#1\clearpage\fi}
+
+\newcommand{\movetooddpage}[1][\@empty]{%
+ \newpage%
+ \ifodd\c@page\else\hbox{}#1\newpage\fi}
+
+\newcommand{\needspace}[1]{\begingroup\setlength{\dimen@}{#1}%
+ \vskip\z@\@plus\dimen@\penalty -100\vskip\z@\@plus-\dimen@
+ \vskip\dimen@\penalty 9999\vskip-\dimen@\endgroup}
+
+\newcommand{\Needspace}{\@ifstar{\M@sneedsp@}{\M@needsp@}}
+\newcommand{\M@sneedsp@}[1]{\par \penalty-100\begingroup
+ \setlength{\dimen@}{#1}%
+ \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
+ \ifdim \dimen@>\dimen@ii
+ \break
+ \fi\endgroup}
+\newcommand{\M@needsp@}[1]{\par \penalty-100\begingroup
+ \setlength{\dimen@}{#1}%
+ \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
+ \ifdim \dimen@>\dimen@ii
+ \ifdim \dimen@ii>\z@
+ \vfil
+ \fi
+ \break
+ \fi\endgroup}
+
+\newcommand*{\midsloppy}{%
+ \tolerance 5000%
+ \hbadness 4000%
+ \emergencystretch 1.5em%
+ \hfuzz .1\p@
+ \vfuzz\hfuzz}
+\newenvironment{midsloppypar}{\par\midsloppy}{\par}
+
+\newcommand{\medspace}{\kern .22222em }
+\DeclareRobustCommand{\:}{%
+ \relax\ifmmode\mskip\medmuskip\else\medspace\fi}
+\DeclareRobustCommand{\!}{%
+ \relax\ifmmode\mskip-\thinmuskip\else\negthinspace\fi}
+
+\DeclareRobustCommand*{\slashfracstyle}[1]{%
+ {\m@th\ensuremath{\mbox{\fontsize\sf@size\z@\selectfont #1}}}}
+\DeclareRobustCommand*{\slashfrac}[2]{\leavevmode
+ \raise.5ex\hbox{\slashfracstyle{#1}}\kern-.13em/%
+ \kern-.15em\lower.25ex\hbox{\slashfracstyle{#2}}}
+
+\DeclareRobustCommand*{\textsubscript}[1]{%
+ \@textsubscript{\selectfont#1}}
+\newcommand*{\@textsubscript}[1]{%
+ {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
+
+%%%%%%%%%%%%%%%%%%%% number formatting
+
+\newif\iflowernumtoname
+ \lowernumtonamefalse
+\newif\ifpriornum
+\newif\ifminusnumber
+\newif\ifnotnumtonameallcaps
+\newif\ifmakeordinal
+
+\newcommand*{\namenumberand}{ and }
+\newcommand*{\namenumbercomma}{, }
+\newcommand*{\lcminusname}{minus }
+\newcommand*{\ucminusname}{Minus }
+\let\minusname\lcminusname
+\newcommand*{\fnumbersep}{,}
+\newcommand*\tensunitsep{-}
+\newcommand*{\nthstring}{th} % nth
+\newcommand*{\iststring}{st} % 1st
+\newcommand*{\iindstring}{nd} % 2nd
+\newcommand*{\iiirdstring}{rd} % 3rd
+\newcommand*{\tiethstring}{tieth} % tieth
+\newcommand*{\teenstring}{teen} % teen
+\newcommand{\ordscript}[1]{#1}
+
+\chardef\m@mten=10 % shorthand for 10
+
+\newcounter{ism@mctr} % units
+\newcounter{xsm@mctr} % tens
+\newcounter{csm@mctr} % hundreds
+\newcounter{ksm@mctr} % thousands
+\newcounter{xksm@mctr} % ten thousands
+\newcounter{cksm@mctr} % hundred thousands
+\newcounter{msm@mctr} % millions
+\newcounter{xmsm@mctr} % ten millions
+\newcounter{cmsm@mctr} % hundred millions
+\newcounter{bsm@mctr} % billions
+\newcounter{workm@mctr}
+
+\newcommand*{\numdigits}[1]{%
+ \setcounter{ism@mctr}{0}%
+ \setcounter{xsm@mctr}{0}%
+ \setcounter{csm@mctr}{0}%
+ \setcounter{ksm@mctr}{0}%
+ \setcounter{xksm@mctr}{0}%
+ \setcounter{cksm@mctr}{0}%
+ \setcounter{msm@mctr}{0}%
+ \setcounter{xmsm@mctr}{0}%
+ \setcounter{cmsm@mctr}{0}%
+ \setcounter{bsm@mctr}{0}%
+ \setcounter{workm@mctr}{#1}%
+ \minusnumberfalse
+ \ifnum \c@workm@mctr < \z@ % negative
+ \minusnumbertrue
+ \c@workm@mctr = -\c@workm@mctr
+ \fi
+ \ifnum \c@workm@mctr > \m@ne % units
+ \c@ism@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@ism@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % tens
+ \c@xsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@xsm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % hundreds
+ \c@csm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@csm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % thousands
+ \c@ksm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@ksm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % ten thousands
+ \c@xksm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@xksm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % hundred thousands
+ \c@cksm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@cksm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % millions
+ \c@msm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@msm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % ten millions
+ \c@xmsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@xmsm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % hundred millions
+ \c@cmsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@cmsm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@% billions
+ \c@bsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@bsm@mctr by -\c@workm@mctr
+ \fi}
+
+\newcommand*{\form@tnumber}[1]{%
+ \numdigits{#1}%
+ \ifminusnumber-\fi
+ \priornumfalse
+ \ifnum \c@bsm@mctr > \z@ % billions
+ \priornumtrue
+ \thebsm@mctr\fnumbersep
+ \fi
+ \ifpriornum % hundred millions
+ \thecmsm@mctr
+ \else
+ \ifnum \c@cmsm@mctr > \z@
+ \priornumtrue
+ \thecmsm@mctr
+ \fi
+ \fi
+ \ifpriornum % ten millions
+ \thexmsm@mctr
+ \else
+ \ifnum \c@xmsm@mctr > \z@
+ \priornumtrue
+ \thexmsm@mctr
+ \fi
+ \fi
+ \ifpriornum % millions
+ \themsm@mctr\fnumbersep
+ \else
+ \ifnum \c@msm@mctr > \z@
+ \priornumtrue
+ \themsm@mctr\fnumbersep
+ \fi
+ \fi
+ \ifpriornum % hundred thousands
+ \thecksm@mctr
+ \else
+ \ifnum \c@cksm@mctr > \z@
+ \priornumtrue
+ \thecksm@mctr
+ \fi
+ \fi
+ \ifpriornum % ten thousands
+ \thexksm@mctr
+ \else
+ \ifnum \c@xksm@mctr > \z@
+ \priornumtrue
+ \thexksm@mctr
+ \fi
+ \fi
+ \ifpriornum % thousands
+ \theksm@mctr\fnumbersep
+ \else
+ \ifnum \c@ksm@mctr > \z@
+ \priornumtrue
+ \theksm@mctr\fnumbersep
+ \fi
+ \fi
+ \ifpriornum % hundreds
+ \thecsm@mctr
+ \else
+ \ifnum \c@csm@mctr > \z@
+ \priornumtrue
+ \thecsm@mctr
+ \fi
+ \fi
+ \ifpriornum % tens
+ \thexsm@mctr
+ \else
+ \ifnum \c@xsm@mctr > \z@
+ \priornumtrue
+ \thexsm@mctr
+ \fi
+ \fi
+ \theism@mctr} % units
+
+\newcommand*{\cardinal}[1]{%
+ \begingroup
+ \let\fnumbersep\relax
+ \form@tnumber{#1}%
+ \endgroup}
+\newcommand*{\fcardinal}[1]{%
+ \begingroup
+ \form@tnumber{#1}%
+ \endgroup}
+
+\newcommand*{\ordinal}[1]{%
+ \begingroup
+ \let\fnumbersep\relax
+ \form@tnumber{#1}%
+ \let\ordstring\nthstring
+ \ifnum \c@xsm@mctr=\@ne\else
+ \ifcase \c@ism@mctr
+ \or \let\ordstring\iststring% 1st
+ \or \let\ordstring\iindstring% 2nd
+ \or \let\ordstring\iiirdstring% 3rd
+ \fi
+ \fi
+ \ordscript{\ordstring}%
+ \endgroup
+}
+\newcommand*{\fordinal}[1]{%
+ \begingroup
+ \form@tnumber{#1}%
+ \let\ordstring\nthstring
+ \ifnum \c@xsm@mctr=\@ne\else
+ \ifcase \c@ism@mctr
+ \or \let\ordstring\iststring% 1st
+ \or \let\ordstring\iindstring% 2nd
+ \or \let\ordstring\iiirdstring% 3rd
+ \fi
+ \fi
+ \ordscript{\ordstring}%
+ \endgroup
+}
+
+\newcommand*\nNameo{\iflowernumtoname z\else Z\fi ero}
+\newcommand*\nNamec{\iflowernumtoname h\else H\fi undred}
+\newcommand*\nNamem{\iflowernumtoname t\else T\fi housand}
+\newcommand*\nNamemm{\iflowernumtoname m\else M\fi illion}
+\newcommand*\nNamemmm{\iflowernumtoname b\else B\fi illion}
+
+\newcommand*\nNamei{\iflowernumtoname o\else O\fi ne}
+\newcommand*\nNameii{\iflowernumtoname t\else T\fi wo}
+\newcommand*\nNameiii{\iflowernumtoname t\else T\fi hree}
+\newcommand*\nNameiv{\iflowernumtoname f\else F\fi our}
+\newcommand*\nNamev{\iflowernumtoname f\else F\fi ive}
+\newcommand*\nNamevi{\iflowernumtoname s\else S\fi ix}
+\newcommand*\nNamevii{\iflowernumtoname s\else S\fi even}
+\newcommand*\nNameviii{\iflowernumtoname e\else E\fi ight}
+\newcommand*\nNameix{\iflowernumtoname n\else N\fi ine}
+\newcommand*\nNamex{\iflowernumtoname t\else T\fi en}
+\newcommand*\nNamexi{\iflowernumtoname e\else E\fi leven}
+\newcommand*\nNamexii{\iflowernumtoname t\else T\fi welve}
+\newcommand*\nNamexiii{\iflowernumtoname t\else T\fi hir\teenstring}
+\newcommand*\nNamexiv{\iflowernumtoname f\else F\fi our\teenstring}
+\newcommand*\nNamexv{\iflowernumtoname f\else F\fi if\teenstring}
+\newcommand*\nNamexvi{\iflowernumtoname s\else S\fi ix\teenstring}
+\newcommand*\nNamexvii{\iflowernumtoname s\else S\fi even\teenstring}
+\newcommand*\nNamexviii{\iflowernumtoname e\else E\fi igh\teenstring}
+\newcommand*\nNamexix{\iflowernumtoname n\else N\fi ine\teenstring}
+\newcommand*\nNamexx{\iflowernumtoname t\else T\fi wenty}
+\newcommand*\nNamexxx{\iflowernumtoname t\else T\fi hirty}
+\newcommand*\nNamexl{\iflowernumtoname f\else F\fi orty}
+\newcommand*\nNamel{\iflowernumtoname f\else F\fi ifty}
+\newcommand*\nNamelx{\iflowernumtoname s\else S\fi ixty}
+\newcommand*\nNamelxx{\iflowernumtoname s\else S\fi eventy}
+\newcommand*\nNamelxxx{\iflowernumtoname e\else E\fi ighty}
+\newcommand*\nNamexc{\iflowernumtoname n\else N\fi inety}
+
+\newcommand*{\unitnumbername}[1]{%
+ \ifcase #1 \nNameo\or
+ \nNamei\or
+ \nNameii\or
+ \nNameiii\or
+ \nNameiv\or
+ \nNamev\or
+ \nNamevi\or
+ \nNamevii\or
+ \nNameviii\or
+ \nNameix\fi}
+
+\newcommand*{\teennumbername}[1]{%
+ \ifcase #1 \nNamex\or
+ \nNamexi\or
+ \nNamexii\or
+ \nNamexiii\or
+ \nNamexiv\or
+ \nNamexv\or
+ \nNamexvi\or
+ \nNamexvii\or
+ \nNamexviii\or
+ \nNamexix\fi}
+
+\newcommand*{\tensnumbername}[2]{%
+ \ifnum #1=\@ne
+ \teennumbername{#2}\ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \else
+ \ifcase #1
+ \or
+ \or \nNamexx
+ \or \nNamexxx
+ \or \nNamexl
+ \or \nNamel
+ \or \nNamelx
+ \or \nNamelxx
+ \or \nNamelxxx
+ \or \nNamexc
+ \fi
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \ifnum #2 > \z@ \tensunitsep\unitnumbername{#2}\fi
+ \fi}
+
+\newcommand*\nthNameo{\nNameo\nthstring}
+\newcommand*\nthNamei{\iflowernumtoname f\else F\fi irst}
+\newcommand*\nthNameii{\iflowernumtoname s\else S\fi econd}
+\newcommand*\nthNameiii{\iflowernumtoname t\else T\fi hird}
+\newcommand*\nthNameiv{\nNameiv\nthstring}
+\newcommand*\nthNamev{\iflowernumtoname f\else F\fi if\nthstring}
+\newcommand*\nthNamevi{\nNamevi\nthstring}
+\newcommand*\nthNamevii{\nNamevii\nthstring}
+\newcommand*\nthNameviii{\iflowernumtoname e\else E\fi igh\nthstring}
+\newcommand*\nthNameix{\iflowernumtoname n\else N\fi in\nthstring}
+\newcommand*\nthNamexii{\iflowernumtoname t\else T\fi welf\nthstring}
+
+\newcommand*{\unitordinalname}[1]{%
+ \ifcase #1 \nthNameo\or
+ \nthNamei\or
+ \nthNameii\or
+ \nthNameiii\or
+ \nthNameiv\or
+ \nthNamev\or
+ \nthNamevi\or
+ \nthNamevii\or
+ \nthNameviii\or
+ \nthNameix\fi}
+
+\newcommand*{\teenordinalname}[1]{%
+ \ifcase #1 \nNamex\nthstring\or
+ \nNamexi\nthstring\or
+ \nthNamexii\or
+ \nNamexiii\nthstring\or
+ \nNamexiv\nthstring\or
+ \nNamexv\nthstring\or
+ \nNamexvi\nthstring\or
+ \nNamexvii\nthstring\or
+ \nNamexviii\nthstring\or
+ \nNamexix\nthstring\fi}
+
+\newcommand*{\tensordinalname}[2]{%
+ \ifnum #1=\@ne
+ \teenordinalname{#2}\ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \else
+ \ifnum #2> \z@
+ \ifcase #1
+ \or
+ \or \nNamexx
+ \or \nNamexxx
+ \or \nNamexl
+ \or \nNamel
+ \or \nNamelx
+ \or \nNamelxx
+ \or \nNamelxxx
+ \or \nNamexc
+ \fi
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \tensunitsep\unitordinalname{#2}
+ \else
+ \ifcase #1
+ \or
+ \or \nthNamexx
+ \or \nthNamexxx
+ \or \nthNamexl
+ \or \nthNamel
+ \or \nthNamelx
+ \or \nthNamelxx
+ \or \nthNamelxxx
+ \or \nthNamexc
+ \fi
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \fi
+ \fi}
+
+\newcommand*\nthNamexx{\iflowernumtoname t\else T\fi wen\tiethstring}
+\newcommand*\nthNamexxx{\iflowernumtoname t\else T\fi hir\tiethstring}
+\newcommand*\nthNamexl{\iflowernumtoname f\else F\fi or\tiethstring}
+\newcommand*\nthNamel{\iflowernumtoname f\else F\fi if\tiethstring}
+\newcommand*\nthNamelx{\iflowernumtoname s\else S\fi ix\tiethstring}
+\newcommand*\nthNamelxx{\iflowernumtoname s\else S\fi even\tiethstring}
+\newcommand*\nthNamelxxx{\iflowernumtoname e\else E\fi igh\tiethstring}
+\newcommand*\nthNamexc{\iflowernumtoname n\else N\fi ine\tiethstring}
+
+\newcommand*{\n@me@number}[1]{%
+\begingroup
+ \numdigits{#1}%
+ \ifminusnumber\minusname\fi
+ \priornumfalse
+%% billions
+ \ifnum \c@bsm@mctr > \z@
+ \unitnumbername{\thebsm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamemmm
+ \priornumtrue
+ \fi
+%% hundred millions
+ \ifnum \c@cmsm@mctr > \z@
+ \ifpriornum\namenumbercomma\fi
+ \unitnumbername{\thecmsm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
+ \priornumtrue
+ \fi
+%% tens/units millions
+ \ifnum \c@xmsm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cmsm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \tensnumbername{\thexmsm@mctr}{\themsm@mctr}%
+ \priornumtrue
+ \else
+ \ifnum \c@msm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cmsm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \unitnumbername{\themsm@mctr}%
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \priornumtrue
+ \fi
+ \fi
+ \ifnum \c@cmsm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamemm
+ \else
+ \ifnum \c@xmsm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamemm
+ \else
+ \ifnum \c@msm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamemm
+ \fi
+ \fi
+ \fi
+%% hundred thousands
+ \ifnum \c@cksm@mctr > \z@
+ \ifpriornum\namenumbercomma\fi
+ \unitnumbername{\thecksm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
+ \priornumtrue
+ \fi
+%% tens/units thousands
+ \ifnum \c@xksm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cksm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \tensnumbername{\thexksm@mctr}{\theksm@mctr}%
+ \priornumtrue
+ \else
+ \ifnum \c@ksm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cksm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \unitnumbername{\theksm@mctr}%
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \priornumtrue
+ \fi
+ \fi
+ \ifnum \c@cksm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamem
+ \else
+ \ifnum \c@xksm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamem
+ \else
+ \ifnum \c@ksm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamem
+ \fi
+ \fi
+ \fi
+%% hundreds
+ \ifnum \c@csm@mctr > \z@
+ \ifpriornum\namenumbercomma\fi
+ \unitnumbername{\thecsm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
+ \priornumtrue
+ \fi
+%% tens/units
+ \ifmakeordinal
+ \ifnum \c@xsm@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \tensordinalname{\thexsm@mctr}{\theism@mctr}%
+ \else
+ \ifnum \c@ism@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \unitordinalname{\theism@mctr}%
+ \else
+ \ifpriornum\nthstring\else\unitordinalname{\theism@mctr}\fi
+ \fi
+ \fi
+ \else % not ordinal
+ \ifnum \c@xsm@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \tensnumbername{\thexsm@mctr}{\theism@mctr}%
+ \else
+ \ifnum \c@ism@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \unitnumbername{\theism@mctr}%
+ \else
+ \ifpriornum\else\unitnumbername{\theism@mctr}\fi
+ \fi
+ \fi
+ \fi % end ifmakeordinal
+\endgroup}
+
+\DeclareRobustCommand{\numtoname}[1]{%
+ \makeordinalfalse
+ \notnumtonameallcapstrue%
+ \lowernumtonametrue%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\numtoName}[1]{%
+ \makeordinalfalse
+ \notnumtonameallcapstrue%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\NumToName}[1]{%
+ \makeordinalfalse
+ \notnumtonameallcapsfalse%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\ordinaltoname}[1]{%
+ \makeordinaltrue
+ \notnumtonameallcapstrue%
+ \lowernumtonametrue%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\ordinaltoName}[1]{%
+ \makeordinaltrue
+ \notnumtonameallcapstrue%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\OrdinalToName}[1]{%
+ \makeordinaltrue
+ \notnumtonameallcapsfalse%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\long\def \@topnewpage [#1]{%
+ \@nodocument
+ \@next\@currbox\@freelist{}{}%
+ \global \setbox\@currbox
+ \vbox {%
+ \break
+ \prevdepth\z@
+ \begingroup
+ \normalcolor
+ \hsize\textwidth
+ \@parboxrestore
+ \col@number \@ne
+ #1%
+ \vskip -\dbltextfloatsep
+ \endgroup
+ \null % ordinary \baselineskip
+ \vskip -\topskip
+ }%
+ \begingroup %% \showbox\@currbox
+ \splitmaxdepth\maxdepth \splittopskip\topskip
+ \setbox\@tempboxa \vsplit\@currbox to \z@
+ \endgroup %% \showbox\@currbox
+ \ifdim \ht\@currbox>\textheight
+ \ht\@currbox \textheight
+ \fi
+ \global \count\@currbox \tw@
+ \@tempdima -\ht\@currbox
+ \advance \@tempdima -\dbltextfloatsep
+ \global \advance \@colht \@tempdima
+ \ifx \@dbltoplist \@empty
+ \else
+ \@latexerr{Float(s) lost}\@ehb
+ \let \@dbltoplist \@empty
+ \fi
+ \@cons \@dbltoplist \@currbox
+ \global \@dbltopnum \m@ne
+ \ifdim \@colht<2.5\baselineskip
+ \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
+ too tall on page \thepage}%
+ \@emptycol
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \else
+ \global \vsize \@colht
+ \global \@colroom \@colht
+ \@floatplacement
+ \fi}
+
+\newcommand*{\m@mcalchm}{%
+ \count0 = \time \divide \count0 by 60\relax
+ \count2 = \count0\relax% the hour
+ \count4 = \time \multiply\count0 by 60\relax
+ \advance\count4 by -\count0\relax% the minute
+ \ifnum\count4<10 \toks1 = {0}% make a leading zero
+ \else \toks1 = {}%
+ \fi}
+%%% punctuation, am and pm for \printtime
+\newcommand*{\hmpunct}{:}% hours minutes separator
+\newcommand*{\amname}{am}% ante meridiem
+\newcommand*{\pmname}{pm}% post meridiem
+
+\newcommand*{\printtime}{%
+ \@ifstar{\m@msprtime}{\m@mprtime}}
+\newcommand*{\m@mprtime}{\begingroup
+ \m@mcalchm
+ \number\count2\hmpunct\the\toks1 \number\count4
+ \endgroup}
+\newcommand*{\m@msprtime}{\begingroup
+ \m@mcalchm
+ \def\@mpm{\pmname}%
+ \ifnum\count2<1\relax% early in the morning
+ \count2=12\relax
+ \ifnum\count4>0\relax% not midnight
+ \def\@mpm{\amname}%
+ \fi
+ \else
+ \ifnum\time<721\relax% noon or earlier
+ \def\@mpm{\amname}%
+ \else
+ \ifnum\time>779\relax% 1300 hrs or later
+ \advance\count2 by -12\relax
+ \fi
+ \fi
+ \fi
+ \number\count2\hmpunct\the\toks1 \number\count4\ \@mpm
+ \endgroup}
+
+\newcounter{sheetsequence}
+ \setcounter{sheetsequence}{1}
+ \renewcommand{\thesheetsequence}{\@arabic\c@sheetsequence}
+\g@addto@macro{\@outputpage}{\stepcounter{sheetsequence}}
+
+\newcounter{lastsheet}
+ \setcounter{lastsheet}{0}
+\newcounter{lastpage}
+ \setcounter{lastpage}{0}
+
+\newcommand{\dol@stsheet}{%
+ \if@filesw
+ \addtocounter{sheetsequence}{-1}%
+ \immediate\write\@auxout%
+ {\string\memsetcounter{lastsheet}{\the\c@sheetsequence}}%
+ \stepcounter{sheetsequence}%
+ \fi}
+\newcommand{\dol@stpage}{%
+ \if@filesw
+ \addtocounter{page}{-1}%
+ \immediate\write\@auxout%
+ {\string\memsetcounter{lastpage}{\the\c@page}}%
+ \stepcounter{page}%
+ \fi}
+\AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}}
+
+\newif\ifcntrmod
+\newif\ifnotcntrmod
+\newcommand*{\iscntrmod}[2]{
+ \@tempcnta=\@nameuse{c@#1}%
+ \@tempcntb=\@tempcnta
+ \divide\@tempcnta #2\relax
+ \multiply\@tempcnta #2\relax
+ \advance\@tempcntb-\@tempcnta
+ \ifnum\@tempcntb=0\relax
+ \cntrmodtrue
+ \notcntrmodfalse
+ \else
+ \cntrmodfalse
+ \notcntrmodtrue
+ \fi}
+
+\newcommand*{\@memensuresigpages}{%
+ \ifnum\@mempagespersig<\@ne
+ \else
+ \iscntrmod{sheetsequence}{\@mempagespersig}
+ \ifcntrmod
+ \else
+ \clearpage
+ \pagestyle{empty}
+ \mbox{}
+ \loop
+ \iscntrmod{sheetsequence}{\@mempagespersig}
+ \ifnotcntrmod
+ \clearpage
+ \pagestyle{empty}
+ \mbox{}
+ \repeat
+ \fi
+ \fi}
+
+\newcommand*{\leavespergathering}[1]{\@memcnta=#1\relax
+ \ifnum\@memcnta<\tw@
+ \def\@mempagespersig{-1}%
+ \else
+ \multiply\@memcnta \tw@
+ \edef\@mempagespersig{\@memcnta}%
+ \fi}
+\leavespergathering{0}
+
+\AtEndDocument{\@memensuresigpages}
+
+\newcommand*{\abstractname}{Abstract}
+\newcommand*{\contentsname}{Contents}
+\newcommand*{\listfigurename}{List of Figures}
+\newcommand*{\listtablename}{List of Tables}
+\newcommand*{\bookname}{Book}
+\newcommand*{\partname}{Part}
+\newcommand*{\chaptername}{Chapter}
+\newcommand*{\appendixname}{Appendix}
+\newcommand*{\appendixtocname}{Appendices}
+\newcommand*{\appendixpagename}{Appendices}
+\newcommand*{\bibname}{Bibliography}
+\newcommand*{\indexname}{Index}
+\newcommand*{\glossaryname}{Glossary}
+\newcommand*{\figurename}{Figure}
+\newcommand*{\tablename}{Table}
+\newcommand*{\figurerefname}{Figure}
+\newcommand*{\tablerefname}{Table}
+\newcommand*{\pagename}{page}
+\newcommand*{\pagerefname}{page}
+\newcommand*{\bookrefname}{Book~}
+\newcommand*{\partrefname}{Part~}
+\newcommand*{\chapterrefname}{Chapter~}
+\newcommand*{\sectionrefname}{\S}
+\newcommand*{\appendixrefname}{Appendix~}
+
+\newcommand{\today}{\ifcase\month\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or December\fi
+ \space\number\day, \number\year}
+\setlength\columnsep{10\p@}
+\setlength\columnseprule{0\p@}
+\pagestyle{headings}
+\pagenumbering{arabic}
+
+\setcounter{part}{0}
+\setcounter{chapter}{0}
+\setcounter{tocdepth}{1}
+\setcounter{secnumdepth}{2}
+\maxsecnumdepth{section}
+
+\linenumberfrequency{0}
+\linenumberfont{\small\rmfamily}
+\settowidth{\bvnumlength}{\vlvnumfont 9999}
+
+\if@twoside
+\else
+ \raggedbottom
+\fi
+\if@twocolumn
+ \twocolumn
+ \sloppy
+ \flushbottom
+\else
+ \onecolumn
+\fi
+
+\newfloat[chapter]{figure}{lof}{\figurename}
+%%% \kill@lastcounter{lofdepth}
+\renewcommand{\thefigure}{\thechapter\@SepMark\@arabic\c@figure}
+
+\newlistof{listoffigures}{lof}{\listfigurename}
+%%% \kill@lastcounter{lofdepth}
+\newlistentry[chapter]{figure}{lof}{0}
+ \cftsetindents{figure}{0em}{2.3em}
+%% \kill@lastcounter{lofdepth}
+
+\newfloat[chapter]{table}{lot}{\tablename}
+%%% \kill@lastcounter{lotdepth}
+\renewcommand{\thetable}{\thechapter\@SepMark\@arabic\c@table}
+
+\newlistof{listoftables}{lot}{\listtablename}
+%%% \kill@lastcounter{lotdepth}
+\newlistentry[chapter]{table}{lot}{0}
+ \cftsetindents{table}{0em}{2.3em}
+%% \kill@lastcounter{lotdepth}
+
+%%%\AtBeginDocument{%
+%%% \@ifundefined{c@lofdepth}%
+%%% {\newcounter{lofdepth}\setcounter{lofdepth}{1}}{}
+%%% \@ifundefined{c@lotdepth}%
+%%% {\newcounter{lotdepth}\setcounter{lotdepth}{1}}{}}
+
+\ifartopt
+ \chapterstyle{article}
+ \counterwithout{figure}{chapter}
+ \counterwithout{table}{chapter}
+ \counterwithout{footnote}{chapter}
+ \counterwithout{equation}{chapter}
+ \renewcommand{\chaptername}{}
+ \renewcommand{\maketitlehookb}{%
+ \vskip -1.5\topsep\vskip -1.5\partopsep}
+ \renewcommand{\maketitlehookc}{%
+ \vskip -1.5\topsep\vskip -1.5\partopsep}
+\fi
+
+\newcommand{\msdoublespacing}{}
+\newcommand{\mssinglespacing}{}
+\ifmsdoc
+ \renewcommand{\msdoublespacing}{%
+ \renewcommand{\baselinestretch}{1.6}\large\normalsize}
+ \renewcommand{\mssinglespacing}{%
+ \renewcommand{\baselinestretch}{1.0}\large\normalsize}
+ \renewcommand{\familydefault}{cmtt}
+ \renewcommand{\rmdefault}{cmtt}
+ \renewcommand{\sfdefault}{cmtt}
+ \renewcommand{\bfdefault}{m}
+ \renewcommand{\itdefault}{n}
+ \renewcommand{\sldefault}{n}
+ \renewcommand{\scdefault}{n}
+ \renewcommand{\baselinestretch}{1.6}
+ \@twocolumnfalse
+ \onecolumn
+ \sloppy
+ \@twosidefalse
+ \raggedbottom
+ \pagestyle{plain}
+\fi
+
+\EmulatedPackage{abstract}[2008/07/23]
+\EmulatedPackage{appendix}[2008/07/23]
+\EmulatedPackage{array}[2008/07/23]
+\EmulatedPackage{booktabs}[2008/07/23]
+\EmulatedPackage{ccaption}[2008/07/23]
+\EmulatedPackage{changepage}[2008/07/23]
+\EmulatedPackage{chngcntr}[2008/07/23]
+\EmulatedPackage{chngpage}[2008/07/23]
+\EmulatedPackage{crop}
+\EmulatedPackage{dcolumn}[2008/07/23]
+\EmulatedPackage{delarray}[2008/07/23]
+\EmulatedPackage{enumerate}[2008/07/23]
+\EmulatedPackage{epigraph}[2008/07/23]
+%%%%%\EmulatedPackage{framed}[2008/07/23]
+\EmulatedPackage{ifmtarg}[2008/07/23]
+\ifm@mifetex\EmulatedPackage{ifetex}[2008/07/23]\fi
+\ifm@mifluatex\EmulatedPackage{ifluatex}[2008/07/23]\fi
+\ifm@mifpdf\EmulatedPackage{ifpdf}[2008/07/23]\fi
+\ifm@mifxetex\EmulatedPackage{ifxetex}[2008/07/23]\fi
+\EmulatedPackage{index}[2008/07/23]
+\EmulatedPackage{makeidx}[2008/07/23]
+\EmulatedPackage{moreverb}[2008/07/23]
+\EmulatedPackage{mparhack}[2008/07/23]
+\EmulatedPackage{needspace}[2008/07/23]
+\EmulatedPackage{newfile}[2008/07/23]
+\EmulatedPackage{nextpage}[2008/07/23]
+\EmulatedPackage{pagenote}[2008/07/23]
+\EmulatedPackage{parskip}[2008/07/23]
+\EmulatedPackage{patchcmd}[2008/07/23]
+\EmulatedPackage{setspace}[2008/07/23]
+\EmulatedPackage{shortvrb}[2008/07/23]
+\EmulatedPackage{showidx}[2008/07/23]
+\EmulatedPackage{tabularx}[2008/07/23]
+\EmulatedPackage{titleref}[2008/07/23]
+\EmulatedPackage{titling}[2008/07/23]
+\EmulatedPackage{tocbibind}[2008/07/23]
+%\EmulatedPackage{tocloft}[2008/07/23]
+\EmulatedPackage{verbatim}[2008/07/23]
+\EmulatedPackage{verse}[2008/07/23]
+
+%%% revert changes to captioning macros if the caption package is used.
+\AtBeginPackage{caption}{
+\ClassWarningNoLine{bidimemoir}{%
+ You are using the caption package with the bidimemoir \MessageBreak
+ class. This may cause unexpected or inconsistent \MessageBreak
+ results if you use any of bidimemoir's captioning facilities}
+
+\long\def\@makecaption##1##2{%
\vskip\abovecaptionskip
- \sbox\@tempboxa{\@ensure@dir{#1: #2}}%
+ \sbox\@tempboxa{##1: ##2}%
\ifdim \wd\@tempboxa >\hsize
- \@ensure@dir{#1: #2}\par
+ \if@RTL\beginR\fi##1: ##2\par
\else
\global \@minipagefalse
- \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
+ \hb@xt@\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil\if@RTL\endR\fi}%
\fi
- \vskip\belowcaptionskip}%
+ \vskip\belowcaptionskip}
+
+\def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+}
+
+\long\def\@caption##1[##2]##3{%
+ \par
+ \addcontentsline{\csname ext@##1\endcsname}{##1}%
+ {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par
+ \endgroup}
+}
+
+\AtBeginPackage{float}{\let\newfloat\relax}
+
+\InputIfFileExists{mempatch.sty}{}{} % should be this
+% \end{macrocode}
+% \iffalse
+%</bidimemoir.cls>
+%<*pdfpages-bidi.def>
+% \fi
+% \part{pdfpages-bidi.def}
+% \begin{macrocode}
+\renewcommand*{\includepdf}[2][]{%
+ \begingroup
+ \@RTLfalse
+ \let\AM@threadname\relax
+ \AM@split@options{pdfpages}{#1}%
+ \edef\AM@temp{{pdfpages}{\the\@temptokena}}%
+ \expandafter\setkeys\AM@temp
+ \ifthenelse{\boolean{AM@pkg@draft} \and \boolean{AM@survey}}{%
+ \let\AM@currentdocname\relax
+ \renewcommand\includegraphics[2][]{Survey in draft-mode}%
+ \def\AM@pagecount{0}%
+ }{%
+ \AM@findfile{#2}%
+ \if\AM@threadname\relax
+ \def\AM@threadname{\AM@currentdocname}%
+ \fi
}%
- }%
-}% ELSE KOMASCRIPT
-{\@ifclassloaded{scrlttr2}{}% do nothing for letter class
-{\renewcommand{\@@makecaption}[3]{%
- \cap@margin
- \ifonelinecaptions
- \@tempcnta=\value{mpfootnote}\@tempcntb=\value{footnote}%
- \let\scr@tmp@footnotetext=\@footnotetext
- \let\@footnotetext=\@gobble
- \sbox\@tempboxa{%
- {\capfont\strut\ignorespaces
- #1{{\caplabelfont#2\captionformat}}%
- #3\unskip\strut}%
- }%
- \let\@footnotetext=\scr@tmp@footnotetext
- \let\scr@tmp@footnotetext=\undefined
- \setcounter{footnote}{\@tempcntb}%
- \setcounter{mpfootnote}{\@tempcnta}%
- \else
- \sbox\@tempboxa{\hspace*{2\cap@width}}%
- \fi
- \begingroup%
- \setlength{\@tempdima}{\cap@width}%
- \ifdim \wd\@tempboxa >\@tempdima
- \hb@xt@\hsize{%
- \setbox\@tempboxa\vbox{\hsize=\cap@width
- \ifdofullc@p
- \@ensure@dir{\capfont\@hangfrom{\scr@smashdp{\strut\ignorespaces
- #1{{\caplabelfont#2\captionformat}}}}%
- {#3\unskip\strut\par}}%
- \else%
- \ifdim\cap@indent<\z@
- \@ensure@dir{\capfont\strut\ignorespaces
- #1{{\caplabelfont #2\captionformat\par}}%
- \noindent\hspace*{-\cap@indent}#3\unskip\strut\par}%
- \else%
- \if@capbreak
- \@ensure@dir{\capfont\strut\ignorespaces
- #1{{\caplabelfont #2\captionformat\par}}%
- \noindent\@hangfrom{\hspace*{\cap@indent}}{#3\par}}%
- \else
- \@ensure@dir{\capfont\@hangfrom{\scr@smashdp\strut\hspace*{\cap@indent}}%
- {\hspace{-\cap@indent}\scr@smashdp{\ignorespaces#1%
- {{\caplabelfont#2\captionformat}}}#3\unskip\strut\par}}%
- \fi
- \fi
+ \ifAM@survey
+ \def\AM@pagestemp{}%
+ \@tempcnta=0
+ \def\foo{%
+ \@ifundefined{r@\AM@xrprefix pdfpages@page\the\@tempcnta}%
+ {\let\foo\relax}
+ {\expandafter\ifx\expandafter\\\AM@pagestemp\\
+ \edef\AM@pagestemp{%
+ \AM@pageref{\AM@xrprefix pdfpages@page\the\@tempcnta}}%
+ \else
+ \edef\AM@pagestemp{\AM@pagestemp,%
+ \AM@pageref{\AM@xrprefix pdfpages@page\the\@tempcnta}}%
\fi
- }%
- \setlength{\@tempdima}{\ht\@tempboxa}%
- \addtolength{\@tempdima}{\dp\@tempboxa}%
- \addtolength{\@tempdima}{-\ht\strutbox}%
- \ht\@tempboxa\ht\strutbox
- \dp\@tempboxa\@tempdima
- \strut\cap@left
- \box\@tempboxa
- \cap@right\strut
- }%
+ \advance\@tempcnta 1\relax
+ }%
+ \foo
+ }%
+ \foo
+ \expandafter\ifx\expandafter\\\AM@pagestemp\\
+ \def\AM@pagestemp{1}%
+ \fi
+ \fi
+ \ifAM@output
+ \expandafter\AM@readlist\expandafter{\AM@pagestemp}%
+ \AM@output{#1}%
+ \fi
+ \AM@CheckAtEnd
+ \endgroup
+ \AM@ClearShipoutPicture
+}
+% \end{macrocode}
+% \iffalse
+%</pdfpages-bidi.def>
+%<*pstricks-bidi.def>
+% \fi
+% \part{pstricks-bidi.def}
+% \begin{macrocode}
+\def\pspicture{\begingroup\@RTLfalse\pst@ifstar\pst@picture}%
+% \end{macrocode}
+% \iffalse
+%</pstricks-bidi.def>
+%<*refrep-bidi.def>
+% \fi
+% \part{refrep-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+{\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand\thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand\thetable%
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand\thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+% \end{macrocode}
+% \iffalse
+%</refrep-bidi.def>
+%<*report-bidi.def>
+% \fi
+% \part{report-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \beginR\@chapapp\ \thechapter. \ \endR%
+ \fi
+ \beginR##1\endR}}{}}%
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@
+ \beginR\thesection. \ \endR%
+ \fi
+ \beginR##1\endR}}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \beginR\@chapapp\ \thechapter. \ \endR%
+ \fi
+ \beginR##1\endR}}}}
+\fi
+\def\ps@myheadings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\@gobbletwo
+ \let\chaptermark\@gobble
+ \let\sectionmark\@gobble
+ }
+\pagestyle{plain}
+% \end{macrocode}
+% \iffalse
+%</report-bidi.def>
+%<*rapport3-bidi.def>
+% \fi
+% \part{rapport3-bidi.def}
+% \begin{macrocode}
+\renewcommand*\@regtocline[3]{%
+ \ifnum #1>\c@tocdepth
+ \else
+ \vskip\z@\@plus.2\p@
+ {\hangindent\z@ \@afterindenttrue \interlinepenalty\@M
+ \if@RTL\rightskip\else\leftskip\fi\unitindent
+ \if@RTL\leftskip\else\rightskip\fi\unitindent\@plus 1fil
+ \parfillskip\z@
+ \@tempdima\unitindent
+ \parindent\z@
+ \leavevmode
+ \hbox{}\hskip -\if@RTL\rightskip\else\leftskip\fi\relax#2\nobreak
+ \hskip 1em \nobreak{\slshape #3}\par
+ }%
+ \fi}
+\if@oldtoc
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \setlength\@tempdima{3em}%
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\else
+ \renewcommand*\l@part{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus \p@}%
+ \@regtocline{0}%
+ \fi}
+\fi
+\if@oldtoc
+\renewcommand*\l@chapter[2]{%
+ \addpenalty{-\@highpenalty}%
+ \vskip 1.0em \@plus\p@
+ \setlength\@tempdima{1.5em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode \bfseries
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
+ \penalty\@highpenalty
+ \endgroup}
+\else
+ \renewcommand*\l@chapter{\@regtocline{0}}
+\fi
+\renewcommand*\head@style{%
+ \interlinepenalty \@M
+ \hyphenpenalty=\@M \exhyphenpenalty=\@M
+ \if@RTL\leftskip\else\rightskip\fi=0cm plus .7\hsize\relax}
+\if@titlepage
+ \renewenvironment{abstract}{%
+ \titlepage
+ \null\vfil
+ \hbox{\SectFont \abstractname}
+ \noindent\ignorespaces}
+ {\par\vfil\null\endtitlepage}
+\else
+ \renewenvironment{abstract}{%
+ \if@twocolumn
+ \section*{\abstractname}%
+ \else
+ \small
+ \bgroup\if@RTL\leftskip\else\rightskip\fi=\unitindent
+ \hbox{\SectFont \abstractname}%
+ \noindent\ignorespaces
+ \fi}
+ {\if@twocolumn\else\par\egroup\fi}
+\fi
+\renewcommand*\thesection{\thechapter\@SepMark\@arabic\c@section}
+\renewcommand*\thesubsection{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*\thesubsubsection{\thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand*\theparagraph{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*\thesubparagraph{\theparagraph\@SepMark\@arabic\c@subparagraph}
+\renewcommand*\thefigure{%
+ \ifnum\c@chapter>\z@\thechapter\@SepMark\fi\@arabic\c@figure}
+\renewcommand*\thetable{%
+ \ifnum\c@chapter>\z@\thechapter\@SepMark\fi\@arabic\c@table}
+\renewcommand*\theequation{%
+ \ifnum \c@chapter>\z@ \thechapter\@SepMark\fi\@arabic\c@equation}
+% \end{macrocode}
+% \iffalse
+%</rapport3-bidi.def>
+%<*scrartcl-bidi.def>
+% \fi
+% \part{scrartcl-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >\m@ne\relax
+ \addpenalty{\@secpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \else
+ \penalty\@highpenalty
+ \fi
+ \endgroup
+ \fi
+ \fi
+}
+\renewcommand*\l@section[2]{%
+ \ifnum \c@tocdepth >\z@
+ \ifnum \lastpenalty<20009
+ \addpenalty{\@secpenalty}%
+ \fi
+ \addvspace{1.0em \@plus\p@}%
+ \setlength\@tempdima{1.5em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \raggedsectionentry
+ \parindent \z@ \advance\if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{sectionentry}{#1\nobreak
+ \usekomafont{sectionentrypagenumber}{%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \endgroup
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \penalty20008
+ \fi
+ \fi
+}
+\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
+\def\raggedpart{\if@RTL\raggedleft\else\raggedright\fi}
+\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
+\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection
+}
+\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph
+}
+% \end{macrocode}
+% \iffalse
+%</scrartcl-bidi.def>
+%<*scrbook-bidi.def>
+% \fi
+% \part{scrbook-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\renewcommand*\l@chapter[2]{%
+ \ifnum \c@tocdepth >\m@ne
+ \ifnum \lastpenalty<20010
+ \addpenalty{-\@highpenalty}%
+ \fi
+ \vskip 1.0em \@plus\p@
+ \setlength\@tempdima{1.5em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \raggedchapterentry
+ \parindent \z@ \advance\if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{chapterentry}{#1\nobreak
+ \usekomafont{chapterentrypagenumber}{%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20009
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
+\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
+\renewcommand*\thesection{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@section
+}
+\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection
+}
+\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph
+}
+\renewcommand*\thefigure{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@figure
+}
+\renewcommand*\thetable{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@table
+}
+\renewcommand*\theequation{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@equation
+}
+% \end{macrocode}
+% \iffalse
+%</scrbook-bidi.def>
+%<*scrreprt-bidi.def>
+% \fi
+% \part{scrreprt-bidi.def}
+% \begin{macrocode}
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\renewcommand*\l@chapter[2]{%
+ \ifnum \c@tocdepth >\m@ne
+ \ifnum \lastpenalty<20010
+ \addpenalty{-\@highpenalty}%
+ \fi
+ \vskip 1.0em \@plus\p@
+ \setlength\@tempdima{1.5em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \raggedchapterentry
+ \parindent \z@ \advance\if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{chapterentry}{#1\nobreak
+ \usekomafont{chapterentrypagenumber}{%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20009
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
+\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
+\renewcommand*\thesection{%
+ \thechapter\@SepMark%
+ \@arabic\c@section
+}
+\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection
+}
+\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph
+}
+\renewcommand*\thefigure{%
+ \thechapter\@SepMark%
+ \@arabic\c@figure
+}
+\renewcommand*\thetable{%
+ \thechapter\@SepMark%
+ \@arabic\c@table
+}
+\renewcommand*\theequation{%
+ \thechapter\@SepMark%
+ \@arabic\c@equation
+}
+% \end{macrocode}
+% \iffalse
+%</scrreprt-bidi.def>
+%<*stabular-bidi.def>
+% \fi
+% \part{stabular-bidi.def}
+% \begin{macrocode}
+\def\@stabular{\if@RTL\global\@RTLtabtrue\fi
+ \leavevmode \bgroup \if@RTLtab\beginR \fi
+ \let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@stabarray}
+\def\endstabular{\crcr\egroup\if@RTLtab\egroup\endR\egroup\fi
+ \egroup \if@RTLtab\endR\fi\egroup
+ \global\@RTLtabfalse}
+\expandafter \let \csname endstabular*\endcsname = \endstabular
+\def\@sarray[#1]#2{%
+ \bgroup
+ \setbox\@arstrutbox\hbox{%
+ \vrule \@height\arraystretch\ht\strutbox
+ \@depth\arraystretch \dp\strutbox
+ \@width\z@}%
+ \@mkpream{#2}%
+ \edef\@preamble{%
+ \ialign \noexpand\@halignto
+ \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \let\tabularnewline\\%
+% \let\par\@empty
+ \let\@sharp##%
+ \set@typeset@protect
+ \lineskip\z@skip\baselineskip\z@skip
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble}
+% \end{macrocode}
+% \iffalse
+%</stabular-bidi.def>
+%<*ragged2e-bidi.def>
+% \fi
+% \part{ragged2e-bidi.def}
+% \begin{macrocode}
+\renewcommand{\Centering}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\CenteringLeftskip
+ \@rightskip\CenteringRightskip
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\CenteringParfillskip
+ \parindent\CenteringParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand{\RaggedLeft}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\RaggedLeftLeftskip
+ \@rightskip\RaggedLeftRightskip
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\RaggedLeftParfillskip
+ \parindent\RaggedLeftParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand{\RaggedRight}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\RaggedRightLeftskip
+ \@rightskip\RaggedRightRightskip
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\RaggedRightParfillskip
+ \parindent\RaggedRightParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand{\justifying}{%
+ \let\\\@raggedtwoe@savedcr
+ \let\@gnewline\@raggedtwoe@saved@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\z@
+ \@rightskip\z@
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\JustifyingParfillskip
+ \parindent\JustifyingParindent
+ \@raggedtwoe@spaceskipfalse
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand*{\@raggedtwoe@raggedrightboxes@opt}{
+ \CheckCommand*{\@arrayparboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+ \linewidth\hsize
+ \@totalleftmargin\z@
+ \if@RTL\rightskip\else\leftskip\fi\z@skip \if@RTL\leftskip\else\rightskip\fi\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy}%
+ \renewcommand{\@arrayparboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parskip\z@skip
+ \everypar{}%
+ \linewidth\hsize
+ \@totalleftmargin\z@
+ \RaggedRight
+ \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy}%
+ \let\@raggedtwoe@raggedrightboxes@opt\relax
+ }
+\let\origin@RaggedLeft=\RaggedLeft
+\let\origin@RaggedRight=\RaggedRight
+\def\RaggedLeft{\if@RTL\origin@RaggedRight\else\origin@RaggedLeft\fi}
+\def\RaggedRight{\if@RTL\origin@RaggedLeft\else\origin@RaggedRight\fi}
+% \end{macrocode}
+% \iffalse
+%</ragged2e-bidi.def>
+%<*tabls-bidi.def>
+% \fi
+% \part{tabls-bidi.def}
+% \begin{macrocode}
+\def\endtabular{\endarray $\if@RTLtab\endR\fi\egroup
+ \global\@RTLtabfalse}
+
+\expandafter\let\csname endtabular*\endcsname=\endtabular
+
+\def\endarray{\ifvmode\csname crcr\endcsname % just do \crcr if \\ given
+ \else \\[\z@ \global\advance\@arstdepth-\@otarlinesep]%
+ \fi\egroup\if@RTLtab\egroup\endR\egroup\fi\@unrecurse\egroup}
+
+\def\@array[#1]#2{% remember global variables to allow recursion:
+ \edef\@unrecurse{\global\@skip@bove\the\@skip@bove
+ \global\@arstheight\the\@arstheight\global\@arstdepth\the\@arstdepth}%
+% Make the strut on the first line be shorter by the linesep outside
+ \let\@otarlinesep\@tarlinesep \global\@skip@bove-\@otarlinesep
+% This setup works for both tabular and array because of this test:
+ \ifx\@classz\@arrayclassz \let\@tarlinesep\arraylinesep
+ \else \let\@tarlinesep\tablinesep \fi
+ \divide\@tarlinesep\tw@ % half sep is applied to height & depth
+ \let\@seesize\relax \let\@rememsize\relax \@mkpream{#2}%
+ \@tempdima\arraystretch\ht\strutbox \@tempdimb\arraystretch\dp\strutbox
+ \ifdim\@tarlinesep>\z@ % (need \protect for \multicolumn)
+ \def\@rememsize{\protect\@r@m@msize}\let\@seesize\@s@@size
+ \advance\@tempdima-\@tarlinesep \advance\@tempdimb-\@tarlinesep
+ \fi \setbox\@arstrutbox\hbox{% set up smaller strut
+ \vrule \@height\@tempdima \@depth\@tempdimb \@width\z@}%
+ \let\protect\noexpand
+ \edef\@preamble{\ialign \noexpand\@halignto \bgroup
+ \unhcopy\@arstrutbox \@preamble \tabskip\z@skip &\@sharp \cr}%
+% I have added an extra column (&\@sharp) to take the smart strut.
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \if#1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
+ \bgroup \let\par\@empty
+ \global\@arstheight\ht\@arstrutbox \global\@arstdepth\dp\@arstrutbox
+ \advance\extrarulesep.5\arrayrulewidth
+ \let\@sharp##\let\protect\relax \lineskip\z@skip \baselineskip\z@skip
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble}
+% \end{macrocode}
+% \iffalse
+%</tabls-bidi.def>
+%<*tikz-bidi.def>
+% \fi
+% \part{tikz-bidi.def}
+% \begin{macrocode}
+\let\origin@tikzpicture=\tikzpicture
+\let\origin@endtikzpicture=\endtikzpicture
+\def\tikzpicture{\LTR\origin@tikzpicture}
+\def\endtikzpicture{\origin@endtikzpicture\endLTR}
+% \end{macrocode}
+% \iffalse
+%</tikz-bidi.def>
+%<*tocloft-bidi.def>
+% \fi
+% \part{tocloft-bidi.def}
+% \begin{macrocode}
+\if@cfthaspart
+\renewcommand*{\l@part}[2]{
+ \@cftdopartfalse
+ \ifnum \c@tocdepth >-2\relax
+ \if@cfthaschapter
+ \@cftdoparttrue
+ \fi
+ \ifnum \c@tocdepth >\m@ne
+ \if@cfthaschapter\else
+ \@cftdoparttrue
+ \fi
+ \fi
+ \fi
+ \if@cftdopart
+ \if@cfthaschapter
+ \addpenalty{-\@highpenalty}
\else
- \global \@minipagefalse
- \sbox\@tempboxa{%
- \@ensure@dir{\capfont\scr@smashdp{\strut\ignorespaces
- #1{{\caplabelfont#2\captionformat}}}%
- #3}%
- }%
- \hb@xt@\hsize{\strut\cap@left\box\@tempboxa\cap@right\strut}%
+ \addpenalty\@secpenalty
\fi
- \endgroup}
-}}%
+ \addvspace{\cftbeforepartskip}
+ \begingroup
+ {\if@RTL\rightskip\else\leftskip\fi \cftpartindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftpartindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftpartnumwidth\relax
+ \let\@cftbsnum \cftpartpresnum
+ \let\@cftasnum \cftpartaftersnum
+ \let\@cftasnumb \cftpartaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftpartfont \cftpartpresnum #1}
+ \cftpartfillnum{#2}}
+ \nobreak
+ \if@cfthaschapter
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}
+ \else
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}
+ \fi
+ \fi
+ \endgroup
+ \fi}
+\fi
+\if@cfthaschapter
+\renewcommand*{\l@chapter}[2]{
+ \ifnum \c@tocdepth >\m@ne
+ \addpenalty{-\@highpenalty}
+ \vskip \cftbeforechapskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftchapindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftchapindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftchapnumwidth\relax
+ \let\@cftbsnum \cftchappresnum
+ \let\@cftasnum \cftchapaftersnum
+ \let\@cftasnumb \cftchapaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftchapfont #1}\nobreak
+ \cftchapfillnum{#2}}
+ \fi}
+\fi
+\renewcommand*{\l@section}[2]{%
+ \ifnum \c@tocdepth >\z@
+ \if@cfthaschapter
+ \vskip \cftbeforesecskip
+ \else
+ \addpenalty\@secpenalty
+ \addvspace{\cftbeforesecskip}
+ \fi
+ {\if@RTL\rightskip\else\leftskip\fi \cftsecindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsecindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsecnumwidth\relax
+ \let\@cftbsnum \cftsecpresnum
+ \let\@cftasnum \cftsecaftersnum
+ \let\@cftasnumb \cftsecaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsecfont #1}\nobreak
+ \cftsecfillnum{#2}}
+ \fi}
+\renewcommand*{\l@subsection}[2]{%
+ \ifnum \c@tocdepth >\@ne
+ \vskip \cftbeforesubsecskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubsecindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubsecindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubsecnumwidth\relax
+ \let\@cftbsnum \cftsubsecpresnum
+ \let\@cftasnum \cftsubsecaftersnum
+ \let\@cftasnumb \cftsubsecaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubsecfont #1}\nobreak
+ \cftsubsecfillnum{#2}}
+ \fi}
+\renewcommand*{\l@subsubsection}[2]{%
+ \ifnum \c@tocdepth >\tw@
+ \vskip \cftbeforesubsubsecskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubsubsecindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubsubsecindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubsubsecnumwidth\relax
+ \let\@cftbsnum \cftsubsubsecpresnum
+ \let\@cftasnum \cftsubsubsecaftersnum
+ \let\@cftasnumb \cftsubsubsecaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubsubsecfont #1}\nobreak
+ \cftsubsubsecfillnum{#2}}
+ \fi}
+\renewcommand*{\l@paragraph}[2]{%
+ \ifnum \c@tocdepth >3\relax
+ \vskip \cftbeforeparaskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftparaindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftparaindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftparanumwidth\relax
+ \let\@cftbsnum \cftparapresnum
+ \let\@cftasnum \cftparaaftersnum
+ \let\@cftasnumb \cftparaaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftparafont #1}\nobreak
+ \cftparafillnum{#2}}
+ \fi}
+\renewcommand*{\l@subparagraph}[2]{%
+ \ifnum \c@tocdepth >4\relax
+ \vskip \cftbeforesubparaskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubparaindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubparaindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubparanumwidth\relax
+ \let\@cftbsnum \cftsubparapresnum
+ \let\@cftasnum \cftsubparaaftersnum
+ \let\@cftasnumb \cftsubparaaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubparafont #1}\nobreak
+ \cftsubparafillnum{#2}}
+ \fi}
+\renewcommand*{\l@figure}[2]{%
+ \ifnum \c@lofdepth >\z@
+ \vskip \cftbeforefigskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftfigindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftfignumwidth\relax
+ \let\@cftbsnum \cftfigpresnum
+ \let\@cftasnum \cftfigaftersnum
+ \let\@cftasnumb \cftfigaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftfigfont #1}\nobreak
+ \cftfigfillnum{#2}}
+ \fi
+ }
+\renewcommand*{\l@table}[2]{%
+ \ifnum\c@lotdepth >\z@
+ \vskip \cftbeforetabskip
+ {\if@RTL\rightskip\else\leftskip\fi \cfttabindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cfttabindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cfttabnumwidth\relax
+ \let\@cftbsnum \cfttabpresnum
+ \let\@cftasnum \cfttabaftersnum
+ \let\@cftasnumb \cfttabaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cfttabfont #1}\nobreak
+ \cfttabfillnum{#2}}
+ \fi
+ }
+\renewcommand{\@cftl@subfig}{
+\renewcommand*{\l@subfigure}[2]{%
+ \ifnum \c@lofdepth > \toclevel@subfigure
+ \vskip \cftbeforesubfigskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubfigindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubfignumwidth\relax
+ \let\@cftbsnum \cftsubfigpresnum
+ \let\@cftasnum \cftsubfigaftersnum
+ \let\@cftasnumb \cftsubfigaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubfigfont ##1}\nobreak
+ \cftsubfigfillnum{##2}}
+ \fi
+ }
+}
+\renewcommand{\@cftl@subtab}{
+\renewcommand*{\l@subtable}[2]{%
+ \ifnum \c@lotdepth > \toclevel@subtable
+ \vskip \cftbeforesubtabskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubtabindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubtabindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubtabnumwidth\relax
+ \let\@cftbsnum \cftsubtabpresnum
+ \let\@cftasnum \cftsubtabaftersnum
+ \let\@cftasnumb \cftsubtabaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubtabfont ##1}\nobreak
+ \cftsubtabfillnum{##2}}
+ \fi
+ }
+}
+\renewcommand{\newlistentry}[4][\@empty]{%
+ \@ifundefined{c@#2}{% check & set the counter
+ \ifx \@empty#1\relax
+ \newcounter{#2}
+ \else
+ \@ifundefined{c@#1}{\PackageWarning{tocloft}%
+ {#1 has no counter for use as a `within'}
+ \newcounter{#2}}%
+ {\newcounter{#2}[#1]%
+ \expandafter\edef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}}
+ \fi
+ \setcounter{#2}{0}
+ }
+ {\PackageError{tocloft}{#2 has been previously defined}{\@eha}}
+
+ \@namedef{l@#2}##1##2{%
+ \ifnum \@nameuse{c@#3depth} > #4\relax
+ \vskip \@nameuse{cftbefore#2skip}
+ {\if@RTL\rightskip\else\leftskip\fi \@nameuse{cft#2indent}\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \@nameuse{cft#2numwidth}\relax
+ \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
+ \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
+ \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\@nameuse{cft#2font}##1}\nobreak
+ \@nameuse{cft#2fillnum}{##2}}
+ \fi
+ } % end of \l@#2
+
+ \expandafter\newlength\csname cftbefore#2skip\endcsname
+ \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
+ \expandafter\newlength\csname cft#2indent\endcsname
+ \expandafter\newlength\csname cft#2numwidth\endcsname
+ \ifcase #4\relax % 0
+ \setlength{\@nameuse{cft#2indent}}{0em}
+ \setlength{\@nameuse{cft#2numwidth}}{1.5em}
+ \or % 1
+ \setlength{\@nameuse{cft#2indent}}{1.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{2.3em}
+ \or % 2
+ \setlength{\@nameuse{cft#2indent}}{3.8em}
+ \setlength{\@nameuse{cft#2numwidth}}{3.2em}
+ \or % 3
+ \setlength{\@nameuse{cft#2indent}}{7.0em}
+ \setlength{\@nameuse{cft#2numwidth}}{4.1em}
+ \else % anything else
+ \setlength{\@nameuse{cft#2indent}}{10.0em}
+ \setlength{\@nameuse{cft#2numwidth}}{5.0em}
+ \fi
+ \@namedef{cft#2font}{\normalfont}
+ \@namedef{cft#2presnum}{}
+ \@namedef{cft#2aftersnum}{}
+ \@namedef{cft#2aftersnumb}{}
+ \@namedef{cft#2dotsep}{\cftdotsep}
+ \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
+ \@namedef{cft#2pagefont}{\normalfont}
+ \@namedef{cft#2afterpnum}{}
+ \@namedef{toclevel@#2}{#4}
+ \@namedef{cft#2fillnum}##1{%
+ {\@nameuse{cft#2leader}}\nobreak
+ \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par}
+} % end \newlistentry
+\renewcommand{\cftchapterprecistoc}[1]{\addtocontents{toc}{%
+ {\if@RTL\rightskip\else\leftskip\fi \cftchapindent\relax
+ \advance\if@RTL\righskip\else\leftskip\fi \cftchapnumwidth\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg\relax
+ \textit{#1}\protect\par}}}
% \end{macrocode}
-% \subsection{\cmd{\textcolor}}
-% \cmd\textcolor\ needs to be redefined so that the color-switching
-% commands in the output will affect the correct portion of text also
-% in RL context, but this only works if the textual argument does not overlap
-% more than one line, which is why we issue a warning. See §~\ref{bidicolor}
-% above for an alternative approach to colored text using \XeTeX\ font features.
-% The following code (less the warning) is again taken from \texttt{rlbabel.def}.
+% \iffalse
+%</tocloft-bidi.def>
+%<*tocstyle-bidi.def>
+% \fi
+% \part{tocstyle-bidi.def}
% \begin{macrocode}
-\ifx\@textcolor\@undefined\else%
+\renewcommand*{\tocstyle@dottedtocline}[5]{%
+ \let\numberline\tocstyle@numberline
+ \ifnum #1>\c@tocdepth \else
+ \if@tocstyle@penalties
+ \begingroup
+ \@tempcnta 20010
+ \advance \@tempcnta by -#1
+ \ifnum \@tempcnta>\lastpenalty
+ \aftergroup\penalty\aftergroup\@lowpenalty
+ \fi
+ \endgroup
+ \fi
+ \edef\tocstyledepth{#1}%
+ \tocstyle@activate@features
+ \ifx\tocstyle@feature@entryvskip\relax
+ \vskip \z@ \@plus.2\p@
+ \else
+ \addvspace{\tocstyle@feature@entryvskip}%
+ \fi
+ {%
+ \parskip \z@ \parindent \z@ \if@RTL\rightskip\else\leftskip\fi \z@ \if@RTL\leftskip\else\rightskip\fi \z@
+ \tocstyle@feature@raggedhook
+ \@tempdima #3\relax
+ \@tempdimb #2\relax
+ \typeout{m (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+ \ifnum #1>\z@\relax
+ \@tempcnta #1\relax \advance\@tempcnta \m@ne
+ \ifcsname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \ifcsname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \@tempdimb
+ \csname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \advance\@tempdimb
+ \csname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \fi
+ \fi
+ \fi
+ \typeout{C (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \ifcsname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname
+ \ifdim \@tempdimb>
+ \csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname\relax
+ \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
+ @#1\endcsname{\the\@tempdimb}%
+ \fi
+ \else
+ \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
+ @#1\endcsname{\the\@tempdimb}%
+ \fi
+ \iftocstyle@autolength
+ \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
+ \@tempdimb \csname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
+ \relax
+ \fi
+ \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
+ \@tempdima \csname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
+ \relax
+ \fi
+ \typeout{a (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+ \typeout{A (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \else
+ \@tempdimb #2\relax
+ \typeout{M (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \fi
+ \ifcsname tocstyle@unumwidth@\tocstyleTOC @\endcsname
+ \ifdim \@tempdima>
+ \csname tocstyle@unumwidth@\tocstyleTOC @\endcsname\relax
+ \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
+ @\endcsname{\the\@tempdima}%
+ \fi
+ \else
+ \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
+ @\endcsname{\the\@tempdima}%
+ \fi
+ \ifcase\tocstyle@indentstyle\relax\else
+ \@tempdimb \z@
+ \ifcsname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
+ \@tempdima \csname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
+ \relax
+ \fi
+ \typeout{s (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+ \typeout{S (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \fi
+ \advance\parindent \@tempdimb\@afterindenttrue
+ \advance\if@RTL\rightskip\else\leftskip\fi \parindent
+ \advance\if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \ifx\tocstyle@feature@parfillskip\relax\else
+ \advance\parfillskip \tocstyle@feature@parfillskip\relax
+ \fi
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima
+ \null\nobreak
+ \iftocstyle@indentnotnumbered\else
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \fi
+ \tocstyle@feature@entryhook
+ {#4}\nobreak
+ \ifx\tocstyle@feature@leaders\relax
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle@feature@leaders
+ \fi
+ \nobreak
+ \ifx\tocstyle@feature@pagenumberbox\relax
+ \hb@xt@\@pnumwidth{\hfil\tocstyle@feature@pagenumberhook #5}%
+ \else
+ \tocstyle@feature@pagenumberbox{\tocstyle@feature@pagenumberhook #5}%
+ \fi
+ \par
+ }%
+ \if@tocstyle@penalties
+ \bgroup
+ \@tempcnta 20009
+ \advance\@tempcnta by -#1
+ \edef\reserved@a{\egroup\penalty\the\@tempcnta\relax}%
+ \reserved@a
+ \fi
+ \fi}
+\renewcommand*{\tocstyle@numberline}[1]{%
+ \begingroup
+ \ifx\tocstyle@feature@spaceafternumber\relax
+ \settowidth\@tempdima{\tocstyle@@numberline{#1}\enskip}%
+ \else
+ \settowidth\@tempdima{\tocstyle@@numberline{#1}}%
+ \advance \@tempdima \tocstyle@feature@spaceafternumber\relax
+ \fi
+ \ifcsname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname
+ \ifdim \@tempdima >
+ \csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname\relax
+ \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
+ @\tocstyledepth\endcsname{\the\@tempdima}%
+ \fi
+ \else
+ \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
+ @\tocstyledepth\endcsname{\the\@tempdima}%
+ \fi
+ \endgroup
+ \iftocstyle@indentnotnumbered
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \fi
+ \ifcase \tocstyle@indentstyle
+ \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
+ \or
+ \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
+ \else
+ \ifx\tocstyle@feature@spaceafternumber\relax
+ \hbox{\tocstyle@@numberline{#1}\enskip}%
+ \else
+ \hbox{\tocstyle@@numberline{#1}\hskip
+ \tocstyle@feature@spaceafternumber\relax}%
+ \fi
+ \fi
+}
\AtBeginDocument{%
- \def\@textcolor#1#2#3{%
- \if@rl\PackageWarning{bidi}{%
- \textcolor will not work in RL mode if the textual argument spans more than one line.^^J%
- With XeTeX you should set color as a font feature instead.}%
- \beginL\protect\leavevmode{\color#1{#2}\beginR#3\endR}\endL%
- \else%
- \protect\leavevmode{\color#1{#2}#3}%
- \fi%
+ \ifcsname l@part\endcsname
+ \ifcsname l@chapter\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@part{\tocstyle@l@define{part}{-1}}{}}%
+ \else
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@part{\tocstyle@l@define{part}{0}}{}}%
+ \fi
+ \fi
+ \ifcsname l@chapter\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@chapter{\tocstyle@l@define{chapter}{0}}{}}%
+ \fi
+ \ifcsname l@section\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@section{\tocstyle@l@define{section}{1}}{}}%
+ \fi
+ \ifcsname l@subsection\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@subsection{\tocstyle@l@define{subsection}{2}}{}}%
+ \fi
+ \ifcsname l@subsubsection\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@subsubsection{\tocstyle@l@define{subsubsection}{3}}{}}%
+ \fi
+ \ifcsname l@paragraph\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@paragraph{\tocstyle@l@define{paragraph}{4}}{}}%
+ \fi
+ \ifcsname l@subparagraph\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@subparagraph{\tocstyle@l@define{subparagraph}{5}}{}}%
+ \fi
+ \ifcsname l@table\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@table{\tocstyle@l@define{table}{1}}{}}%
+ \fi
+ \ifcsname l@figure\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@figure{\tocstyle@l@define{figure}{1}}{}}%
+ \fi
+ \def\@tempa#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth \else
+ \vskip \z@ \@plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {#4}\nobreak
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
+ mu$}\hfill
+ \nobreak
+ \hb@xt@\@pnumwidth{\hfil \normalfont \normalcolor #5}%
+ \par}%
+ \fi}%
+ \ifx\@dottedtocline\@tempa\else
+ \tocstyle@macrochangewarning\@dottedtocline
+ \fi
+ \let\tocstyle@saved@dottedtocline\@dottedtocline
+ \def\@tempa#1{\hb@xt@\@tempdima{#1\autodot\hfil}}%
+ \ifx\numberline\@tempa\else
+ \def\@tempa#1{\hb@xt@\@tempdima{#1\hfil}}%
+ \ifx\numberline@tempa\else
+ \tocstyle@macrochangewarning\numberline
+ \fi
+ \fi
+ \let\tocstyle@saved@numberline\numberline
+}
+\renewcommand*{\tocstyle@l@define}[2]{%
+ \advance\if@RTL\rightskip\else\leftskip\fi-\@tempdima
+ \edef\@tempa{%
+ \noexpand\global\noexpand\let
+ \expandafter\noexpand\csname tocstyle@saved@l@#1\endcsname
+ \expandafter\noexpand\csname l@#1\endcsname
+ \noexpand\gdef
+ \expandafter\noexpand\csname tocstyle@l@#1\endcsname{%
+ \noexpand\@dottedtocline{#2}{\the\if@RTL\rightskip\else\leftskip\fi}{\the\@tempdima}}%
+ \noexpand\g@addto@macro\noexpand\tocstyle@activate@all@l{%
+ \noexpand\let\expandafter\noexpand\csname l@#1\endcsname
+ \expandafter\noexpand\csname tocstyle@l@#1\endcsname
}%
-}%
-\fi
+ }%
+ \PackageInfo{tocstyle}{prepare \expandafter\string
+ \csname l@#1\endcsname\space for redefinition}%
+ \@tempa
+}
% \end{macrocode}
-% \subsection{Tabular environments}
-% This is taken almost verbatim from Farsi\TeX, with the addition of a
-% patch for the \pkg{array} package (which does not work correctly yet).
+% \iffalse
+%</tocstyle-bidi.def>
+%<*xltxtra-bidi.def>
+% \fi
+% \part{xltxtra-bidi.def}
% \begin{macrocode}
-\newif\if@tab@rl
-\if@rlmain\@tab@rltrue\else\@tab@rlfalse\fi
-\@ifpackageloaded{array}%
-{\PackageWarningNoLine{bidi}{%
- You are using the package array (or the memoir class). ^^J
- Unfortunately right-to-left tabular environments are not ^^J
- yet supported with the array package.}
-\let\@uthor=\author
-\def\author#1{\@uthor{\@ensure@dir{#1}}}
-}%
-%\def\@array[#1]#2{%
-% \@tempdima \ht \strutbox
-% \advance \@tempdima by\extrarowheight
-% \setbox \@arstrutbox \hbox{\vrule
-% \@height \arraystretch \@tempdima
-% \@depth \arraystretch \dp \strutbox
-% \@width \z@}%
-% \begingroup
-% \@mkpream{#2}%
-% \xdef\@preamble{\noexpand \ialign \@halignto
-% \bgroup \@arstrut \@preamble
-% \tabskip \z@ \cr}%
-% \endgroup
-% \@arrayleft
-% \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
-% \bgroup
-% \let \@sharp ##\let \protect \relax
-% \lineskip \z@
-% \baselineskip \z@
-% \if@tab@rl\hbox\bgroup\beginR\vbox\bgroup\fi
-% \m@th
-% \let\\\@arraycr \let\tabularnewline\\\let\par\@empty
-% \@preamble}
-%\def\@tabular{%
-% \if@rl\global\@tab@rltrue\fi
-% \leavevmode
-% \hbox \bgroup\if@tab@rl\beginR\fi
-% $\col@sep\tabcolsep
-% \let\d@llarbegin\begingroup \let\d@llarend\endgroup
-% \@tabarray}
-%\def\endtabular{\endarray\if@tab@rl\egroup\endR\egroup\fi
-%$\if@tab@rl\endR\fi
-%\egroup}%
-{% ELSE DEFAULT LATEX MACROS
-\def\@tabular{%
- \if@rl\global\@tab@rltrue\fi
- \leavevmode \hbox \bgroup \if@tab@rl\beginR\fi
- $\let\@acol\@tabacol
- \let\@classz\@tabclassz
- \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
-\def\endtabular{\crcr\egroup\if@tab@rl\egroup\endR\egroup\fi
- \egroup $\if@tab@rl\endR\fi \egroup}%
-\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
- height\arraystretch \ht\strutbox
- depth\arraystretch \dp\strutbox
- width\z@}\@mkpream{#2}\edef\@preamble{%
-\halign \noexpand\@halignto
-\bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}%
-\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
-\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
-\bgroup \let\par\relax
-\let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@
-\if@tab@rl\hbox\bgroup\beginR\vbox\bgroup\fi
-\@preamble}
-}
-% \end{macrocode}
-% \subsection{Equation labels in RL documents}
-% Adapted from Farsi\TeX.
-% \begin{macrocode}
-\def\@open@paren{\if@rlmain)\else(\fi}
-\def\@close@paren{\if@rlmain(\else)\fi}
-\def\tagform@#1{\maketag@@@{\@open@paren\ignorespaces#1\unskip\@@italiccorr\@close@paren}}
-% \end{macrocode}
-% \subsection{TODO}
-% \subsubsection{Unicode CTRL Chars}
-% \begin{macrocode}
-%% Make these Unicode chars active and define them so that they work
-%% in conformance to the Unicode bidi algorithm!
-%% \catcode"200E=\active
-%% \catcode"200F=\active
-%% \def‎{\setLR}
-%% \def‏{\setRL}
-%% 202A -> {\@ensure@LR\bgroup} ? or \LR
-%% 202B -> {\@ensure@RL\bgroup} ? or \RL
-%% 202C -> {\egroup} ? or \if@rl\@rlfalse\else\@rltrue\fi ?
-%% 202D -> {?} %LRO
-%% 202E -> {?} %RLO
-% \end{macrocode}
-%
-% \iffalse
-%</package>
-% \fi
-%
-% ^^A\clearpage
-% ^^A\PrintChanges
-%
-% ^^A\clearpage
-% ^^A\PrintIndex
-%
+\let\@@XeTeX\XeTeX
+\def\XeTeX{\@ensure@LTR{\@@XeTeX}}
+\let\@@XeLaTeX\XeLaTeX
+\def\XeLaTeX{\@ensure@LTR{\@@XeLaTeX}}
+% \end{macrocode}
+% \iffalse
+%</xltxtra-bidi.def>
+%<*wrapfig-bidi.def>
+% \fi
+% \part{wrapfig-bidi.def}
+% \begin{macrocode}
+\let\WF@@everypar\n@everypar
+% Put fig here if it fits or if it can't float
+\def\WF@putfigmaybe{%
+\ifinner
+ \vskip-\parskip \global\WF@floatfalse
+ \let\pagetotal\maxdimen % kludge flag for "not top of page"
+\else % outer page
+ \@tempdima\pagedepth % save page depth
+ {\advance\parskip\if@RTL\@tempdimb\else\@tempdima\fi\vskip-\parskip}% back up to baseline
+ \penalty\interlinepenalty % update pg. parameters
+ \@tempdimb\pagegoal \advance\@tempdimb-\pagetotal % room left on page
+ \ifdim\@tempdimb<\z@ % \WF@info{Page overfull already;}%
+ \global\WF@floatfalse
+ \ifdim-\@tempdimb>\pageshrink \else \pagebreak \fi
+ \else
+ \ifdim\WF@size>\@tempdimb
+% \WF@info{Size \the\WF@size\space does not fit in \the\@tempdimb}%
+ \ifWF@float \dimen@.5\baselineskip \else \dimen@ 2\baselineskip\fi
+ \ifdim\pagestretch>\dimen@ \dimen@\pagestretch \fi
+ \ifdim\pagefilstretch>\z@ \dimen@\@tempdimb \fi
+ \ifdim\pagefillstretch>\z@ \dimen@\@tempdimb \fi
+ \advance\dimen@.5\baselineskip
+ \ifdim\dimen@>\@tempdimb % \WF@info{Page nearly full; can stretch}%
+ \global\WF@floatfalse \pagebreak
+ \fi
+ \else % \WF@info{Fits in \the\@tempdimb;}%
+ \global\WF@floatfalse
+ \fi\fi
+ \vskip\@tempdima\relax % (return erased page depth)
+\fi
+\noindent
+\ifWF@float
+ \WF@fltmes
+\else % putting here;
+ \WF@info{Put \WF@wfname here:}%
+ {\ifodd\if@twoside\c@page\else\@ne\fi % assign l/r to i/o placement
+ \lccode`i`l\lccode`o`r\else \lccode`i`r\lccode`o`l\fi
+ \xdef\WF@place{\the\lccode\lccode\WF@place}}% twice to get only l or r
+ \hbox to\z@{% llap or rlap depending on {l} or {r}; calc effective width
+ \@tempdima\wd\WF@box \@tempdimb\WF@ovh
+ \advance\@tempdima-\@tempdimb \advance\@tempdima\columnsep
+ \@tempdimb\hsize \advance\@tempdimb-\@tempdima
+ \xdef\WF@adjlw{\the\@tempdima}%
+ \ifnum `l=\WF@place % fig on left
+ \if@RTL%
+ \kern\@tempdimb \kern\columnsep
+ \def\@tempa{\hss}% position to left of the gap
+ \else%
+ \hss % figure overlaps space to the left
+ \def\@tempa{\kern\columnsep}% position to left of the gap
+ \fi%
+ \else % fig on right
+ \if@RTL%
+ \hss
+ \@tempdima\z@
+ \def\@tempa{\kern\columnsep}
+ \else%
+ \@tempdima\z@ % no left indentation
+ \kern\@tempdimb \kern\columnsep
+ \def\@tempa{\hss}% figure overlaps space to the right
+ \fi%
+ \fi
+ \ifdim\@tempdimb<\hsize
+ \xdef\WF@wrapil{\the\@tempdima \the\@tempdimb}% indentation and length
+ \xdef\WF@adjtlm{\the\@tempdima}%
+ \else
+ \xdef\WF@wrapil{\z@ \the\hsize}%
+ \xdef\WF@adjlw{\z@}\xdef\WF@adjtlm{\z@}%
+ \fi
+ \ifdim\pagetotal=\z@ % \WF@info{Put \WF@wfname at top of p.\thepage}%
+ \global\advance\WF@size-\intextsep
+ \else % \WF@info{Putting \WF@wfname in middle of page}%
+ \setbox\WF@box\hbox{\lower\intextsep\box\WF@box}%
+ \fi \dp\WF@box\z@ \box\WF@box \@tempa
+ }% end \hbox to 0pt
+ \aftergroup\WF@startwrapping % after the \endgroup which immediately follows
+\fi}
+% \end{macrocode}
+% \iffalse
+%</wrapfig-bidi.def>
+% \fi
+% \clearpage
+% \PrintChanges
% \Finale
+%
+% \iffalse
+%<*beamer-sample.tex>
+\documentclass{beamer}
+\usetheme{Warsaw}
+\usepackage{fontspec}
+\setmainfont[Script=Arabic,Mapping=farsidigits]{XB Niloofar}
+\def\familydefault{\rmdefault}
+\newfontfamily\rmfamily[Mapping=tex-text]{Linux Libertine}
+\usepackage{bidi}
+\newenvironment{latin}{\begin{LTR}\rmfamily}{\end{LTR}}
+\def\biditheoremname{قضیه}
+\def\bidicorollaryname{نتیجه}
+\def\bidifactname{حقیقت}
+\def\bidilemmaname{لم}
+\def\bidiproblemname{مسئله}
+\def\bidisolutionname{پاسخ}
+\def\bididefinitionname{تعریف}
+\def\bididefinitionsname{تعریف‌ها}
+\def\bidiexamplename{مثال}
+\def\bidiexamplesname{مثال‌ها}
+\def\bidiproofname{اثبات}
+\title{عنوان اسلاید}
+\subtitle{این یک زیرعنوان است}
+\author{وفا خلیقی}
+\institute{دانشگاه تهران}
+\begin{document}
+\begin{frame}
+\titlepage
+\end{frame}
+
+
+\begin{frame}{این یک عنوان است}
+\framesubtitle{این زیرعنوان است}
+\begin{bidiexample}
+در این مثال به برسی توابعی خواهیم پرداخت که برای ما قابل استفاده هستند:
+\begin{equation}
+(x-y)^2=x^2-2xy+y^2
+\end{equation}
+\end{bidiexample}
+\begin{bidisolution}
+این یک پاسخ است
+\end{bidisolution}
+\begin{bidiproblem}
+این یک مسئله است.
+\end{bidiproblem}
+\end{frame}
+\begin{frame}{ادامهٔ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+\begin{biditheorem}
+این یک قضیه است.
+\end{biditheorem}
+\begin{bidiproof}
+این یک اثبات است
+\end{bidiproof}
+\begin{bidicorollary}
+این یک نتیجه است
+\end{bidicorollary}
+\begin{bidifact}
+این یک حقیقت است
+\end{bidifact}
+\end{frame}
+\begin{frame}{ادامهّ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+\begin{bidilemma}
+این یک لم است
+\end{bidilemma}
+\begin{bididefinition}
+این یک تعریف است
+\end{bididefinition}
+\begin{bididefinitions}
+این محیط مخصوص بیشتر از یک تعریف است
+\end{bididefinitions}
+\begin{bidiexamples}
+این محیط مخصوص بیشتر از یک مثال است.
+\end{bidiexamples}
+\end{frame}
+\begin{frame}{ادامهّ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+\begin{bidiblock}{محیط بلوک}
+این محیط بلوک است
+\end{bidiblock}
+\begin{bidiexampleblock}{محیط بلوک مثال}
+این محیط بلوک مثال است
+\end{bidiexampleblock}
+\begin{bidialertblock}{محیط بلوک هشدار}
+این محیط بلوک هشدار است.
+\end{bidialertblock}
+\end{frame}
+\begin{frame}{ادامهّ عنوان قبلی}
+\framesubtitle{ادامهٔ زیرعنوان قبلی}
+این هم مقداری متن معمولی می‌نویسم تا بتوانم به خط بعدی بروم و ببینم که آیا واقعاً \lr{beamer} دست از لجاجت برمی‌دارد یا نه
+\begin{latin}
+This is an English paragraph that I am writing here to see what happens after this, will I get a new bug or I am lucky enough?
+\end{latin}
+این دوباره متنی است فارسی که من آن را می‌نویسم و هنوز در حال آزمایش هستم تا بتوانم به خط بعدی بروم و نتیجه را مشاهده کنم.
+\end{frame}
+\end{document}
+%</beamer-sample.tex>
+%<*bidicasual-samplecv.tex>
+\documentclass[11pt,a4paper]{bidimoderncv}
+\cvtheme[red]{bidicasual} % you can use orange, red, green and blue as options
+\usepackage[scale=0.8]{geometry}
+\usepackage{fontspec}
+\usepackage[RTLdocument]{bidi}
+\def\refname{تألیفات}
+\setmainfont[Script=Arabic,Mapping=parsidigits]{XB Niloofar}
+\newfontfamily\rmfamily[Mapping=tex-text]{Linux Libertine}
+\AtBeginDocument{\recomputelengths}
+\resumename{رزومه}
+\firstname{سید محمد}
+\familyname{یزدی اصفهانی}
+\title{رزومهٔ من}
+\address{تهران، خیابان آزادی پلاک ۹}
+\mobile{۰۹۱۸۹۶۹۴۹۶}
+\phone{۹۸۹۰۸۳۴۱}
+\fax{۹۸۹۰۸۳۴۲}
+\email{vafa@users.berlios.de}
+\extrainfo{اطلاعات اضافی}
+\photo[64pt]{picture}
+\quote{نقل قول}
+\begin{document}
+\maketitle
+\section{تحصیلات}
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+
+\section{پایان‌نامهٔ کارشناسی ارشد}
+\cvline{عنوان}{\emph{عنوان}}
+\cvline{استاد راهنما}{استاد راهنما}
+\cvline{توضیح}{\small چکیده کوچک پایان‌نامه}
+
+\section{تجربیات}
+\subsection{عنوان}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\subsection{متفرقه}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح خط ۱\newline{}توضیح خط ۲}% arguments 3 to 6 are optional
+
+\section{زبانها}
+\cvlanguage{زبان ۱}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۲}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۳}{درجه مهارت}{نظر}
+
+\section{مهارتهای رایانه‌ای}
+\cvcomputer{طبقه ۱}{یک، دو، سه}{طبقه ۴}{یک، دو، سه}
+\cvcomputer{طبقه ۲}{یک، دو، سه}{طبقه ۵}{یک، دو، سه}
+\cvcomputer{طبقه ۳}{یک، دو، سه}{طبقه ۶}{یک، دو، سه}
+
+\section{علاقه‌ها}
+\cvline{علاقه ۱}{\small توضیح}
+\cvline{علاقه ۲}{\small توضیح}
+\cvline{علاقه ۳}{\small توضیح}
+
+\renewcommand{\listitemsymbol}{-} % change the symbol for lists
+
+\section{بعدی ۱}
+\cvlistitem{شماره ۱}
+\cvlistitem{شماره ۲}
+\cvlistitem[+]{شماره ۳} % optional other symbol
+
+\section{بعدی ۲}
+\cvlistdoubleitem[\Neutral]{شماره ۱}{شماره ۴}
+\cvlistdoubleitem[\Neutral]{شماره ۲}{شماره ۵}
+\cvlistdoubleitem[\Neutral]{شماره ۳}{}
+
+% Publications from a BibTeX file
+\nocite{*}
+\bibliographystyle{plain}
+\bibliography{publications} % 'publications' is the name of a BibTeX file
+
+\end{document}
+%</bidicasual-samplecv.tex>
+%<*bidiclassic-samplecv.tex>
+\documentclass[11pt,a4paper]{bidimoderncv}
+\cvtheme[orange]{bidiclassic} % you can use orange, red, green, grey and blue as options
+\usepackage[scale=0.8]{geometry}
+\usepackage{fontspec}
+\setmainfont[Script=Arabic,Mapping=parsidigits]{XB Zar}
+\newfontfamily\rmfamily[Mapping=tex-text]{Linux Libertine}
+\def\refname{تألیفات}
+\usepackage[RTLdocument]{bidi}
+\AtBeginDocument{\recomputelengths}
+\resumename{رزومه}
+\firstname{وفا}
+\familyname{خلیقی}
+\title{رزومهٔ من}
+\address{تهران، خیابان آزادی پلاک ۹}
+\mobile{۰۹۱۸۹۶۹۴۹۶}
+\phone{۹۸۹۰۸۳۴۱}
+\fax{۹۸۹۰۸۳۴۲}
+\email{me@you.com}
+\extrainfo{اطلاعات اضافی}
+\photo[64pt]{picture}
+\quote{نقل قول}
+\begin{document}
+\maketitle
+\section{تحصیلات}
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{درجه}{دانشگاه}{شهر}{\textit{نمره}}{توضیح} % arguments 3 to 6 are optional
+
+\section{پایان‌نامهٔ کارشناسی ارشد}
+\cvline{عنوان}{\emph{عنوان}}
+\cvline{استاد راهنما}{استاد راهنما}
+\cvline{توضیح}{\small چکیده کوچک پایان‌نامه}
+
+\section{تجربیات}
+\subsection{عنوان}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح} % arguments 3 to 6 are optional
+\subsection{متفرقه}
+\cventry{سال--سال}{نام شغل}{صاحب کار}{شهر}{}{توضیح خط ۱\newline{}توضیح خط ۲}% arguments 3 to 6 are optional
+
+\section{زبانها}
+\cvlanguage{زبان ۱}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۲}{درجه مهارت}{نظر}
+\cvlanguage{زبان ۳}{درجه مهارت}{نظر}
+
+\section{مهارتهای رایانه‌ای}
+\cvcomputer{طبقه ۱}{یک، دو، سه}{طبقه ۴}{یک، دو، سه}
+\cvcomputer{طبقه ۲}{یک، دو، سه}{طبقه ۵}{یک، دو، سه}
+\cvcomputer{طبقه ۳}{یک، دو، سه}{طبقه ۶}{یک، دو، سه}
+
+\section{علاقه‌ها}
+\cvline{علاقه ۱}{\small توضیح}
+\cvline{علاقه ۲}{\small توضیح}
+\cvline{علاقه ۳}{\small توضیح}
+
+\renewcommand{\listitemsymbol}{-} % change the symbol for lists
+
+\section{بعدی ۱}
+\cvlistitem{شماره ۱}
+\cvlistitem{شماره ۲}
+\cvlistitem[+]{شماره ۳} % optional other symbol
+
+\section{بعدی ۲}
+\cvlistdoubleitem[\Neutral]{شماره ۱}{شماره ۴}
+\cvlistdoubleitem[\Neutral]{شماره ۲}{شماره ۵}
+\cvlistdoubleitem[\Neutral]{شماره ۳}{}
+
+% Publications from a BibTeX file
+\nocite{*}
+\bibliographystyle{plain}
+\bibliography{publications} % 'publications' is the name of a BibTeX file
+
+\end{document}
+%</bidiclassic-samplecv.tex>
+%<*bidisample2e.tex>
+% This is a sample LaTeX input file. (Version of 12 August 2004.)
%
+% A '%' character causes TeX to ignore all remaining text on the line,
+% and is used for comments like this one.
+
+\documentclass{article} % Specifies the document class
+\usepackage[RTLdocument]{bidi}
+ % The preamble begins here.
+\title{An Example Document} % Declares the document's title.
+\author{Leslie Lamport} % Declares the author's name.
+\date{January 21, 1994} % Deleting this command produces today's date.
+
+\newcommand{\ip}[2]{(#1, #2)}
+ % Defines \ip{arg1}{arg2} to mean
+ % (arg1, arg2).
+
+%\newcommand{\ip}[2]{\langle #1 | #2\rangle}
+ % This is an alternative definition of
+ % \ip that is commented out.
+
+\begin{document} % End of preamble and beginning of text.
+
+\maketitle % Produces the title.
+
+This is an example input file. Comparing it with
+the output it generates can show you how to
+produce a simple document of your own.
+
+\section{Ordinary Text} % Produces section heading. Lower-level
+ % sections are begun with similar
+ % \subsection and \subsubsection commands.
+
+The ends of words and sentences are marked
+ by spaces. It doesn't matter how many
+spaces you type; one is as good as 100. The
+end of a line counts as a space.
+
+One or more blank lines denote the end
+of a paragraph.
+
+Since any number of consecutive spaces are treated
+like a single one, the formatting of the input
+file makes no difference to
+ \LaTeX, % The \LaTeX command generates the LaTeX logo.
+but it makes a difference to you. When you use
+\LaTeX, making your input file as easy to read
+as possible will be a great help as you write
+your document and when you change it. This sample
+file shows how you can add comments to your own input
+file.
+
+Because printing is different from typewriting,
+there are a number of things that you have to do
+differently when preparing an input file than if
+you were just typing the document directly.
+Quotation marks like
+ ``this''
+have to be handled specially, as do quotes within
+quotes:
+ ``\,`this' % \, separates the double and single quote.
+ is what I just
+ wrote, not `that'\,''.
+
+Dashes come in three sizes: an
+ intra-word
+dash, a medium dash for number ranges like
+ 1--2,
+and a punctuation
+ dash---like
+this.
+
+A sentence-ending space should be larger than the
+space between words within a sentence. You
+sometimes have to type special commands in
+conjunction with punctuation characters to get
+this right, as in the following sentence.
+ Gnats, gnus, etc.\ all % `\ ' makes an inter-word space.
+ begin with G\@. % \@ marks end-of-sentence punctuation.
+You should check the spaces after periods when
+reading your output to make sure you haven't
+forgotten any special cases. Generating an
+ellipsis
+ \ldots\ % `\ ' is needed after `\ldots' because TeX
+ % ignores spaces after command names like \ldots
+ % made from \ + letters.
+ %
+ % Note how a `%' character causes TeX to ignore
+ % the end of the input line, so these blank lines
+ % do not start a new paragraph.
+ %
+with the right spacing around the periods requires
+a special command.
+
+\LaTeX\ interprets some common characters as
+commands, so you must type special commands to
+generate them. These characters include the
+following:
+ \$ \& \% \# \{ and \}.
+
+In printing, text is usually emphasized with an
+ \emph{italic}
+type style.
+
+\begin{em}
+ A long segment of text can also be emphasized
+ in this way. Text within such a segment can be
+ given \emph{additional} emphasis.
+\end{em}
+
+It is sometimes necessary to prevent \LaTeX\ from
+breaking a line where it might otherwise do so.
+This may be at a space, as between the ``Mr.''\ and
+``Jones'' in
+ ``Mr.~Jones'', % ~ produces an unbreakable interword space.
+or within a word---especially when the word is a
+symbol like
+ \mbox{\emph{itemnum}}
+that makes little sense when hyphenated across
+lines.
+
+Footnotes\footnote{This is an example of a footnote.}
+pose no problem.
+
+\LaTeX\ is good at typesetting mathematical formulas
+like
+ \( x-3y + z = 7 \)
+or
+ \( a_{1} > x^{2n} + y^{2n} > x' \)
+or
+ \( \ip{A}{B} = \sum_{i} a_{i} b_{i} \).
+The spaces you type in a formula are
+ignored. Remember that a letter like
+ $x$ % $ ... $ and \( ... \) are equivalent
+is a formula when it denotes a mathematical
+symbol, and it should be typed as one.
+
+\section{Displayed Text}
+
+Text is displayed by indenting it from the left
+margin. Quotations are commonly displayed. There
+are short quotations
+\begin{quote}
+ This is a short quotation. It consists of a
+ single paragraph of text. See how it is formatted.
+\end{quote}
+and longer ones.
+\begin{quotation}
+ This is a longer quotation. It consists of two
+ paragraphs of text, neither of which are
+ particularly interesting.
+
+ This is the second paragraph of the quotation. It
+ is just as dull as the first paragraph.
+\end{quotation}
+Another frequently-displayed structure is a list.
+The following is an example of an \emph{itemized}
+list.
+\begin{itemize}
+ \item This is the first item of an itemized list.
+ Each item in the list is marked with a ``tick''.
+ You don't have to worry about what kind of tick
+ mark is used.
+
+ \item This is the second item of the list. It
+ contains another list nested inside it. The inner
+ list is an \emph{enumerated} list.
+ \begin{enumerate}
+ \item This is the first item of an enumerated
+ list that is nested within the itemized list.
+
+ \item This is the second item of the inner list.
+ \LaTeX\ allows you to nest lists deeper than
+ you really should.
+ \end{enumerate}
+ This is the rest of the second item of the outer
+ list. It is no more interesting than any other
+ part of the item.
+ \item This is the third item of the list.
+\end{itemize}
+You can even display poetry.
+\begin{verse}
+ There is an environment
+ for verse \\ % The \\ command separates lines
+ Whose features some poets % within a stanza.
+ will curse.
+
+ % One or more blank lines separate stanzas.
+
+ For instead of making\\
+ Them do \emph{all} line breaking, \\
+ It allows them to put too many words on a line when they'd rather be
+ forced to be terse.
+\end{verse}
+
+Mathematical formulas may also be displayed. A
+displayed formula
+is
+one-line long; multiline
+formulas require special formatting instructions.
+ \[ \ip{\Gamma}{\psi'} = x'' + y^{2} + z_{i}^{n}\]
+Don't start a paragraph with a displayed equation,
+nor make one a paragraph by itself.
+
+\end{document} % End of document.
+%</bidisample2e.tex>
+%<*bidismall2e.tex>
+% This is a small sample LaTeX input file (Version of 10 April 1994)
%
+% Use this file as a model for making your own LaTeX input file.
+% Everything to the right of a % is a remark to you and is ignored by LaTeX.
+
+% The Local Guide tells how to run LaTeX.
+
+% WARNING! Do not type any of the following 10 characters except as directed:
+% & $ # % _ { } ^ ~ \
+
+\documentclass{article} % Your input file must contain these two lines
+\usepackage[RTLdocument]{bidi}
+\begin{document} % plus the \end{document} command at the end.
+
+
+\section{Simple Text} % This command makes a section title.
+
+Words are separated by one or more spaces. Paragraphs are separated by
+one or more blank lines. The output is not affected by adding extra
+spaces or extra blank lines to the input file.
+
+Double quotes are typed like this: ``quoted text''.
+Single quotes are typed like this: `single-quoted text'.
+
+Long dashes are typed as three dash characters---like this.
+
+Emphasized text is typed like this: \emph{this is emphasized}.
+Bold text is typed like this: \textbf{this is bold}.
+
+\subsection{A Warning or Two} % This command makes a subsection title.
+
+If you get too much space after a mid-sentence period---abbreviations
+like etc.\ are the common culprits)---then type a backslash followed by
+a space after the period, as in this sentence.
+
+Remember, don't type the 10 special characters (such as dollar sign and
+backslash) except as directed! The following seven are printed by
+typing a backslash in front of them: \$ \& \# \% \_ \{ and \}.
+The manual tells how to make other symbols.
+
+\end{document} % The input file ends with this command.
+%</bidismall2e.tex>
+%<*presentation-sample.tex>
+\documentclass[12pt,twoside]{bidipresentation}
+\usepackage{eso-pic}
+\usepackage{graphicx}
+\usepackage{fontspec}
+\setmainfont[Script=Arabic,Mapping=farsidigits]{XB Niloofar}
+\newfontfamily\rmfamily[Mapping=tex-text]{XB Niloofar}
+\usepackage[RTLdocument]{bidi}
+\pagestyle{pres}
+\AddToShipoutPicture{
+\includegraphics{gradient.png}
+}
+
+\begin{document}
+\begin{titlepage}
+\distance{1}
+\centering \LARGE
+ \bfseries عنوان اسلاید
+
+\distance{1}
+\large
+وفا خلیقی\\[1ex]نام دانشگاه
+\distance{2}
+\end{titlepage}
+
+\begin{plainslide}[این عنوان یک صفحه است.]
+این اولین صفحه اسلاید ما است که من در حال نوشتن آن هستم و کمی بیشتر می‌نویسم تا به خط بعدی بروم
+\footnote{این یک زیرنویس فارسی است.}\LTRfootnote{This is an English footnote.}
+\begin{equation}
+(a+b)^2=a^2+2ab+b^2
+\end{equation}
+\begin{itemize}
+ \item یک
+ \item دو
+\end{itemize}
+
+\begin{enumerate}
+ \item یک
+ \item دو
+\end{enumerate}
+
+\begin{description}
+ \item [یک:] اولین عدد
+ \item [دو:] دومین عدد
+\end{description}
+
+\end{plainslide}
+\begin{rawslide}
+دومین صفحه
+
+\end{rawslide}
+
+\end{document}
+
+
+%</presentation-sample.tex>
+%<*test-bidi.tex>
+\documentclass{article}
+\usepackage{bidi}
+\title{Testing Basic Bidi Direction Change}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+In this document we test bidi direction change in \textsf{RTL} and \textsf{LTR}. These tests includes \texttt{flushleft}, \texttt{flushright} environments and \verb|\centerline{...}|, \verb|\leftline{...}|,\verb|\rightline{...}|,\verb|\raggedleft| and \verb|\raggedright| macros.
+\section{RTL Test}
+\setRTL
+\begin{flushleft}
+This is left in RTL
+\end{flushleft}
+\begin{flushright}
+This is right in RTL
+\end{flushright}
+\centerline{This is center in RTL}
+
+\leftline{This is left in RTL}
+
+\rightline{This is right in RTL}
+
+\raggedleft This is raggedleft in RTL
+
+\raggedright This is raggedright in RTL
+
+\setLTR
+\section{LTR Test}
+\begin{flushleft}
+This is left in LTR
+\end{flushleft}
+\begin{flushright}
+This is right in LTR
+\end{flushright}
+\centerline{This is center in LTR}
+
+\leftline{This is left in LTR}
+
+\rightline{This is right in LTR}
+
+\raggedleft This is raggedleft in LTR
+
+\raggedright This is raggedright in LTR
+\end{document}
+%</test-bidi.tex>
+%<*test-supertabular.tex>
+\documentclass{article}
+\usepackage{supertabular}
+\usepackage{bidi}
+\title{Testing \textsf{supertabular} package in RTL and LTR}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+\section{LTR}
+\tablecaption{The ISOGRK3 entity set}
+\tablehead
+ {\bfseries Entity&\bfseries Unicode Name&\bfseries Unicode\\ \hline}
+\tabletail
+ {\hline \multicolumn{3}{r}{\emph{Continued on next page}}\\}
+\tablelasttail{\hline}
+\begin{supertabular}{lll}
+alpha & GREEK SMALL LETTER ALPHA & 03B1\\
+beta & GREEK SMALL LETTER BETA & 03B2\\
+chi & GREEK SMALL LETTER CHI & 03C7\\
+Delta & GREEK CAPITAL LETTER DELTA & 0394\\
+delta & GREEK SMALL LETTER DELTA & 03B4\\
+epsi & GREEK SMALL LETTER EPSILON & 03B5\\
+epsis & GREEK LUNATE EPSILON SYMBOL & 03F5\\
+\empty
+epsiv & GREEK SMALL LETTER EPSILON & 03B5\\
+eta & GREEK SMALL LETTER ETA & 03B7\\
+Gamma & GREEK CAPITAL LETTER GAMMA & 0393\\
+gamma & GREEK SMALL LETTER GAMMA & 03B3\\
+gammad & GREEK SMALL LETTER DIGAMMA & 03DD\\
+iota & GREEK SMALL LETTER IOTA & 03B9\\
+kappa & GREEK SMALL LETTER KAPPA & 03BA\\
+kappav & GREEK KAPPA SYMBOL & 03F0\\
+Lambda & GREEK CAPITAL LETTER LAMDA & 039B\\
+lambda & GREEK SMALL LETTER LAMDA & 03BB\\
+mu & GREEK SMALL LETTER MU & 03BC\\
+nu & GREEK SMALL LETTER NU & 03BD\\
+Omega & GREEK CAPITAL LETTER OMEGA & 03A9\\
+omega & GREEK SMALL LETTER OMEGA & 03C9\\
+Phi & GREEK CAPITAL LETTER PHI & 03A6\\
+phis & GREEK PHI SYMBOL & 03D5\\
+phiv & GREEK SMALL LETTER PHI & 03C6\\
+Pi & GREEK CAPITAL LETTER PI & 03A0\\
+pi & GREEK SMALL LETTER PI & 03C0\\
+piv & GREEK PI SYMBOL & 03D6\\
+Psi & GREEK CAPITAL LETTER PSI & 03A8\\
+psi & GREEK SMALL LETTER PSI & 03C8\\
+rho & GREEK SMALL LETTER RHO & 03C1\\
+rhov & GREEK RHO SYMBOL & 03F1\\
+Sigma & GREEK CAPITAL LETTER SIGMA & 03A3\\
+sigma & GREEK SMALL LETTER SIGMA & 03C3\\
+sigmav & GREEK SMALL LETTER FINAL SIGMA & 03C2\\
+tau & GREEK SMALL LETTER TAU & 03C4\\
+Theta & GREEK CAPITAL LETTER THETA & 0398\\
+thetas & GREEK SMALL LETTER THETA & 03B8\\
+thetav & GREEK THETA SYMBOL & 03D1\\
+Upsi & GREEK UPSILON WITH HOOK SYMBOL & 03D2\\
+upsi & GREEK SMALL LETTER UPSILON & 03C5\\
+Xi & GREEK CAPITAL LETTER XI & 039E\\
+xi & GREEK SMALL LETTER XI & 03BE\\
+zeta & GREEK SMALL LETTER ZETA & 03B6\\
+\end{supertabular}
+\section{RTL}
+
+\setRTL
+\tablecaption{The ISOGRK3 entity set}
+\tablehead
+ {\bfseries Entity&\bfseries Unicode Name&\bfseries Unicode\\ \hline}
+\tabletail
+ {\hline \multicolumn{3}{r}{\emph{Continued on next page}}\\}
+\tablelasttail{\hline}
+\begin{supertabular}{lll}
+alpha & GREEK SMALL LETTER ALPHA & 03B1\\
+beta & GREEK SMALL LETTER BETA & 03B2\\
+chi & GREEK SMALL LETTER CHI & 03C7\\
+Delta & GREEK CAPITAL LETTER DELTA & 0394\\
+delta & GREEK SMALL LETTER DELTA & 03B4\\
+epsi & GREEK SMALL LETTER EPSILON & 03B5\\
+epsis & GREEK LUNATE EPSILON SYMBOL & 03F5\\
+\empty
+epsiv & GREEK SMALL LETTER EPSILON & 03B5\\
+eta & GREEK SMALL LETTER ETA & 03B7\\
+Gamma & GREEK CAPITAL LETTER GAMMA & 0393\\
+gamma & GREEK SMALL LETTER GAMMA & 03B3\\
+gammad & GREEK SMALL LETTER DIGAMMA & 03DD\\
+iota & GREEK SMALL LETTER IOTA & 03B9\\
+kappa & GREEK SMALL LETTER KAPPA & 03BA\\
+kappav & GREEK KAPPA SYMBOL & 03F0\\
+Lambda & GREEK CAPITAL LETTER LAMDA & 039B\\
+lambda & GREEK SMALL LETTER LAMDA & 03BB\\
+mu & GREEK SMALL LETTER MU & 03BC\\
+nu & GREEK SMALL LETTER NU & 03BD\\
+Omega & GREEK CAPITAL LETTER OMEGA & 03A9\\
+omega & GREEK SMALL LETTER OMEGA & 03C9\\
+Phi & GREEK CAPITAL LETTER PHI & 03A6\\
+phis & GREEK PHI SYMBOL & 03D5\\
+phiv & GREEK SMALL LETTER PHI & 03C6\\
+Pi & GREEK CAPITAL LETTER PI & 03A0\\
+pi & GREEK SMALL LETTER PI & 03C0\\
+piv & GREEK PI SYMBOL & 03D6\\
+Psi & GREEK CAPITAL LETTER PSI & 03A8\\
+psi & GREEK SMALL LETTER PSI & 03C8\\
+rho & GREEK SMALL LETTER RHO & 03C1\\
+rhov & GREEK RHO SYMBOL & 03F1\\
+Sigma & GREEK CAPITAL LETTER SIGMA & 03A3\\
+sigma & GREEK SMALL LETTER SIGMA & 03C3\\
+sigmav & GREEK SMALL LETTER FINAL SIGMA & 03C2\\
+tau & GREEK SMALL LETTER TAU & 03C4\\
+Theta & GREEK CAPITAL LETTER THETA & 0398\\
+thetas & GREEK SMALL LETTER THETA & 03B8\\
+thetav & GREEK THETA SYMBOL & 03D1\\
+Upsi & GREEK UPSILON WITH HOOK SYMBOL & 03D2\\
+upsi & GREEK SMALL LETTER UPSILON & 03C5\\
+Xi & GREEK CAPITAL LETTER XI & 039E\\
+xi & GREEK SMALL LETTER XI & 03BE\\
+zeta & GREEK SMALL LETTER ZETA & 03B6\\
+\end{supertabular}
+\end{document}
+%</test-supertabular.tex>
+%<*test-tabular.tex>
+\documentclass{article}
+\usepackage{bidi}
+\title{Testing \LaTeX's Default Tabular in \textsf{RTL} and \textsf{LTR}}
+\author{Vafa Khalighi}
+\newcommand{\rb}[1]{\raisebox{1.5ex}[0mm]{#1}}
+\begin{document}
+\maketitle
+In this document we test \LaTeX's default tabular in \textsf{RTL} and \textsf{LTR}.
+\section{LTR}
+\begin{center}\small
+\begin{tabular}{|l||c|l|c|l|c|l|}
+\hline
+& \multicolumn{2}{c|}{6.15--7.15 pm} & \multicolumn{2}{c|}{7.20--8.20 pm}
+& \multicolumn{2}{c|}{8.30--9.30 pm} \\ \cline{2-7}
+&& Teacher && Teacher && Teacher \\ \cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Day} & \rb{Subj.} & Room & \rb{Subj.} & Room & \rb{Subj.} & Room\\
+ \hline\hline
+&& Dr.~Smith && Ms.~Clark && Mr.~Mills\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Mon.} & \rb{UNIX} & Comp. Ctr & \rb{Fortran} & Hall A
+ & \rb{Math.} & Hall A \\ \hline
+&& Miss Baker && Ms.~Clark && Mr.~Mill\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Tues.} & \rb{\LaTeX} & Conf.~Room & \rb{Fortran} & Conf~Room
+ & \rb{Math.} & Hall A \\ \hline
+&& Dr.~Smith && Dr.~Jones && Dr.~Jones \\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Wed.} & \rb{UNIX} & Comp. Ctr & \rb{C} & Hall A
+ & \rb{ComSci.} & Hall A \\ \hline
+&& Miss Baker && Ms. Clark & \multicolumn{2}{c|}{} \\
+\cline{3-3}\cline{5-5}
+\rb{Fri.} & \rb{\LaTeX} & Conf.~Room & \rb{C++} & Conf.~Room
+& \multicolumn{2}{c|}{\rb{canceled}}\\ \hline
+\end{tabular}\end{center}
+\section{RTL}
+
+\setRTL
+\begin{center}\small
+\begin{tabular}{|l||c|l|c|l|c|l|}
+\hline
+& \multicolumn{2}{c|}{6.15--7.15 pm} & \multicolumn{2}{c|}{7.20--8.20 pm}
+& \multicolumn{2}{c|}{8.30--9.30 pm} \\ \cline{2-7}
+&& Teacher && Teacher && Teacher \\ \cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Day} & \rb{Subj.} & Room & \rb{Subj.} & Room & \rb{Subj.} & Room\\
+ \hline\hline
+&& Dr.~Smith && Ms.~Clark && Mr.~Mills\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Mon.} & \rb{UNIX} & Comp. Ctr & \rb{Fortran} & Hall A
+ & \rb{Math.} & Hall A \\ \hline
+&& Miss Baker && Ms.~Clark && Mr.~Mill\\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Tues.} & \rb{\LaTeX} & Conf.~Room & \rb{Fortran} & Conf~Room
+ & \rb{Math.} & Hall A \\ \hline
+&& Dr.~Smith && Dr.~Jones && Dr.~Jones \\
+\cline{3-3}\cline{5-5}\cline{7-7}
+\rb{Wed.} & \rb{UNIX} & Comp. Ctr & \rb{C} & Hall A
+ & \rb{ComSci.} & Hall A \\ \hline
+&& Miss Baker && Ms. Clark & \multicolumn{2}{c|}{} \\
+\cline{3-3}\cline{5-5}
+\rb{Fri.} & \rb{\LaTeX} & Conf.~Room & \rb{C++} & Conf.~Room
+& \multicolumn{2}{c|}{\rb{canceled}}\\ \hline
+\end{tabular}\end{center}
+\end{document}
+%</test-tabular.tex>
+%<*test-tabularx.tex>
+\documentclass{article}
+\usepackage{tabularx}
+\usepackage{bidi}
+\title{Testing \textsf{tabularx} Package in RTL and LTR}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+\section{LTR}
+\begin{tabularx}{\linewidth}{|l|p{1.25cm}|p{1.5cm}|X|}\hline
+\multicolumn{1}{|c|}{\textbf{Animal}}
+ & \textbf{Hair Colour}
+ & \multicolumn{2}{c|}{\textbf{Favourite foods}} \\\hline\hline
+Elephant & Gray & Peanuts
+ & Unshelled, prepared in Sea Salt, and warmed over hot stone grill \\\cline{3-4}
+ & & Cabbage and Greens
+ & Sun dried until lightly browned (2-3 days minimum);
+ seasoned with Hyperchem super feed \\\cline{4-4}
+ & & & Boiled to British standard \\\hline\hline
+Lion & Yellow & Elephants & Tartare \\\cline{4-4}
+& & & Must be served warm, with no trace of
+ buckshot. Gaiminess considered desireable. \\\hline
+\end{tabularx}
+\section{RTL}
+
+\setRTL
+\begin{tabularx}{\linewidth}{|l|p{1.25cm}|p{1.5cm}|X|}\hline
+\multicolumn{1}{|c|}{\textbf{Animal}}
+ & \textbf{Hair Colour}
+ & \multicolumn{2}{c|}{\textbf{Favourite foods}} \\\hline\hline
+Elephant & Gray & Peanuts
+ & Unshelled, prepared in Sea Salt, and warmed over hot stone grill \\\cline{3-4}
+ & & Cabbage and Greens
+ & Sun dried until lightly browned (2-3 days minimum);
+ seasoned with Hyperchem super feed \\\cline{4-4}
+ & & & Boiled to British standard \\\hline\hline
+Lion & Yellow & Elephants & Tartare \\\cline{4-4}
+& & & Must be served warm, with no trace of
+ buckshot. Gaiminess considered desireable. \\\hline
+\end{tabularx}
+\end{document}
+%</test-tabularx.tex>
+%<*test-tabulary.tex>
+\documentclass{article}
+\usepackage{tabulary}
+\setlength\tymin{10pt}
+\setlength\tymax{\maxdimen}
+\usepackage{bidi}
+\title{Testing \textsf{tabulary} package in RTL and LTR}
+\author{Vafa Khalighi}
+\begin{document}
+\maketitle
+\section{LTR}
+\begin{tabulary}{200pt}{|C|C|C|C|}
+ a & b b b b &
+ c c c c c c c c c c c c c c c c c c &
+ d d d d d d d d d d d d d d d d d d
+\empty
+ d d d d d d d d d d d d d d
+ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d
+ \end{tabulary}
+\section{RTL}
+
+\setRTL
+\begin{tabulary}{200pt}{|C|C|C|C|}
+ a & b b b b &
+ c c c c c c c c c c c c c c c c c c &
+ d d d d d d d d d d d d d d d d d d
+\empty
+ d d d d d d d d d d d d d d
+ d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d d
+ \end{tabulary}
+\end{document}
+%</test-tabulary.tex>
+%<*test1-wrapfig.tex>
+\documentclass{article}
+\usepackage{wrapfig}
+\usepackage{bidi}
+\newcommand\sample{Some text for our page
+ that might get reused over and over again. }
+\begin{document}
+\section{LTR}
+The starting place for the wrapfigure
+environment was manually determined in
+the current ex-
+
+\begin{wrapfigure}[7]{r}[0.2\width]{0pt}
+ \centering
+ \fbox{This is ``wrapfigure''.}
+ \caption{An example of the
+ \texttt{wrapfigure} environment}
+\end{wrapfigure}
+sample by first setting the text without
+the figure to find the linebreaks.
+
+\sample \sample \sample\sample \sample \sample\sample
+
+\section{RTL}
+
+\setRTL
+The starting place for the wrapfigure
+environment was manually determined in
+the current ex-
+
+\begin{wrapfigure}[7]{l}[0.2\width]{0pt}
+ \centering
+ \fbox{This is ``wrapfigure''.}
+ \caption{An example of the
+ \texttt{wrapfigure} environment}
+\end{wrapfigure}
+sample by first setting the text without
+the figure to find the linebreaks.
+
+\sample \sample \sample\sample \sample \sample\sample
+\end{document}
+%</test1-wrapfig.tex>
+%<*test2-wrapfig.tex>
+\documentclass{article}
+\usepackage{wrapfig}
+\usepackage{bidi}
+\newcommand\sample{Some text for our page
+ that might get reused over and over again. }
+\begin{document}
+\section{LTR}
+\begin{wraptable}[4]{l}{4cm}
+ \centering
+\fbox{This is ``wraptable''.}
+ \caption{The Caption}\label{T1}
+\end{wraptable}
+
+\sample \sample Reference to Table~\ref{T1}.
+\sample
+
+\section{RTL}
+\setRTL
+
+\begin{wraptable}[4]{r}{4cm}
+ \centering
+\fbox{This is ``wraptable''.}
+ \caption{The Caption}\label{T2}
+\end{wraptable}
+
+\sample \sample Reference to Table~\ref{T2}.
+\sample
+\end{document}
+%</test2-wrapfig.tex>
+%<*test3-wrapfig.tex>
+\documentclass[a4paper,12pt]{article}
+
+
+\usepackage{graphicx}
+\usepackage{wrapfig}
+\usepackage{bidi}
+\begin{document}
+\section{LTR}
+\subsection*{Wrapfig test}
+
+% text from en.wikipedia.org/wiki/Gull
+
+Gulls are birds in the family Laridae. They are most closely
+ related to the terns (family Sternidae), auks and skimmers,
+and more distantly to the waders. Most gulls belong to the
+large genus Larus.
+
+\begin{wrapfigure}{r}{0.5\textwidth}
+ \begin{center}
+ \includegraphics[width=0.48\textwidth]{gull}
+ \end{center}
+ \caption{A gull}
+\end{wrapfigure}
+
+They are in general medium to large birds, typically grey or white,
+often with black markings on the head or wings. They have stout,
+longish bills and webbed feet.
+
+Most gulls, particularly Larus species, are ground nesting carnivores,
+which will take live food or scavenge opportunistically. The live food
+often includes crabs and small fish. Apart from the kittiwakes, gulls
+are typically coastal or inland species, rarely venturing far out to sea.
+The large species take up to four years to attain full adult plumage,
+but two years is typical for small gulls.
+
+Gulls---the larger species in particular---are resourceful and
+highly intelligent birds, demonstrating complex methods of communication
+and a highly developed social structure. Certain species (e.g. the
+Herring Gull) have exhibited tool use behaviour. Many species of gull have
+learned to co-exist successfully with man and have thrived in human habitats.
+Others rely on kleptoparasitism to get their food.
+
+\newpage
+\section{RTL}
+
+\setRTL
+\subsection*{Wrapfig test}
+
+% text from en.wikipedia.org/wiki/Gull
+
+Gulls are birds in the family Laridae. They are most closely
+ related to the terns (family Sternidae), auks and skimmers,
+and more distantly to the waders. Most gulls belong to the
+large genus Larus.
+
+\begin{wrapfigure}{l}{0.5\textwidth}
+ \begin{center}
+ \includegraphics[width=0.48\textwidth]{gull}
+ \end{center}
+ \caption{A gull}
+\end{wrapfigure}
+
+They are in general medium to large birds, typically grey or white,
+often with black markings on the head or wings. They have stout,
+longish bills and webbed feet.
+
+Most gulls, particularly Larus species, are ground nesting carnivores,
+which will take live food or scavenge opportunistically. The live food
+often includes crabs and small fish. Apart from the kittiwakes, gulls
+are typically coastal or inland species, rarely venturing far out to sea.
+The large species take up to four years to attain full adult plumage,
+but two years is typical for small gulls.
+
+Gulls---the larger species in particular---are resourceful and
+highly intelligent birds, demonstrating complex methods of communication
+and a highly developed social structure. Certain species (e.g. the
+Herring Gull) have exhibited tool use behaviour. Many species of gull have
+learned to co-exist successfully with man and have thrived in human habitats.
+Others rely on kleptoparasitism to get their food.
+\end{document}
+%</test3-wrapfig.tex>
+% \fi
+%
% \typeout{*************************************************************}
% \typeout{*}
% \typeout{* To finish the installation you have to move the following}
-% \typeout{* file into a directory searched by XeTeX:}
+% \typeout{* file into a directory searched by TeX:}
% \typeout{*}
-% \typeout{* \space\space\space bidi.sty}
+% \typeout{* \space\space\space all *.cls, *.sty and *.def files}
% \typeout{*}
% \typeout{*************************************************************}
-%
\endinput
diff --git a/Master/texmf-dist/source/xelatex/bidi/bidi.ins b/Master/texmf-dist/source/xelatex/bidi/bidi.ins
deleted file mode 100644
index 3d60a60cbd7..00000000000
--- a/Master/texmf-dist/source/xelatex/bidi/bidi.ins
+++ /dev/null
@@ -1,30 +0,0 @@
-\input docstrip.tex
-\keepsilent
-\preamble
-
- ____________________________
-
- The bidi package
- (C) 2007-2008 François Charette
- License information appended
-
-\endpreamble
-\postamble
-
-Copyright (C) 2007-2008 by François Charette <firmicus at gmx dot net>
-
-Distributable under the LaTeX Project Public License,
-version 1.3c or higher (your choice). The latest version of
-this license is at: http://www.latex-project.org/lppl.txt
-
-This work is "maintained" (as per LPPL maintenance status)
-by François Charette.
-
-This work consists of the file \jobname.dtx
- and the derived files \jobname.sty and \jobname.pdf.
-
-\endpostamble
-\askforoverwritefalse
-\generate{\file{\jobname.sty}{\from{\jobname.dtx}{package}}}
-\nopreamble\nopostamble
-\endbatchfile
diff --git a/Master/texmf-dist/tex/xelatex/bidi/amsart-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/amsart-bidi.def
new file mode 100644
index 00000000000..fa6ebca6530
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/amsart-bidi.def
@@ -0,0 +1,67 @@
+%%
+%% This is file `amsart-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `amsart-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@tocline#1#2#3#4#5#6#7{\relax
+ \ifnum #1>\c@tocdepth % then omit
+ \else
+ \par \addpenalty\@secpenalty\addvspace{#2}%
+ \begingroup \hyphenpenalty\@M
+ \@ifempty{#4}{%
+ \@tempdima\csname r@tocindent\number#1\endcsname\relax
+ }{%
+ \@tempdima#4\relax
+ }%
+ \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
+ \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
+ #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
+ \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
+ \nobreak
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\arabic{subsection}}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\arabic{paragraph}}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\arabic{subparagraph}}
+\def\part{\@startsection{part}{0}%
+ \z@{\linespacing\@plus\linespacing}{.5\linespacing}%
+ {\normalfont\bfseries\raggedleft}}
+\renewenvironment{thebibliography}[1]{%
+ \@bibtitlestyle
+ \normalfont\bibliofont\labelsep .5em\relax
+ \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
+ \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \usecounter{enumiv}}%
+ \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
+ \sfcode`\.=\@m
+}{%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `amsart-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/amsbook-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/amsbook-bidi.def
new file mode 100644
index 00000000000..f0ad9f886b0
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/amsbook-bidi.def
@@ -0,0 +1,77 @@
+%%
+%% This is file `amsbook-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `amsbook-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@tocline#1#2#3#4#5#6#7{\relax
+ \ifnum #1>\c@tocdepth % then omit
+ \else
+ \par \addpenalty\@secpenalty\addvspace{#2}%
+ \begingroup \hyphenpenalty\@M
+ \@ifempty{#4}{%
+ \@tempdima\csname r@tocindent\number#1\endcsname\relax
+ }{%
+ \@tempdima#4\relax
+ }%
+ \parindent\z@ \if@RTL\rightskip\else\leftskip\fi#3\relax \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima\relax
+ \if@RTL\leftskip\else\rightskip\fi\@pnumwidth plus4em \parfillskip-\@pnumwidth
+ #5\leavevmode\hskip-\@tempdima #6\nobreak\relax
+ \hfil\hbox to\@pnumwidth{\@tocpagenum{#7}}\par
+ \nobreak
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\arabic{subsection}}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\arabic{subsubsection}}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\arabic{paragraph}}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\arabic{subparagraph}}
+\renewenvironment{thebibliography}[1]{%
+ \@bibtitlestyle
+ \normalfont\bibliofont\labelsep .5em\relax
+ \renewcommand\theenumiv{\arabic{enumiv}}\let\p@enumiv\@empty
+ \list{\@biblabel{\theenumiv}}{\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \leftmargin\labelwidth \advance\leftmargin\labelsep
+ \usecounter{enumiv}}%
+ \sloppy \clubpenalty\@M \widowpenalty\clubpenalty
+ \sfcode`\.=\@m
+}{%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist
+}
+\def\theindex{\@restonecoltrue\if@twocolumn\@restonecolfalse\fi
+\columnseprule\z@ \columnsep 35\p@
+\@indextitlestyle
+\thispagestyle{plain}%
+\let\item\@idxitem
+\parindent\z@ \parskip\z@\@plus.3\p@\relax
+\raggedleft
+\hyphenpenalty\@M
+\footnotesize}
+
+\def\@idxitem{\par\hangindent -2em}
+\def\subitem{\par\hangindent -2em\hspace*{1em}}
+\def\subsubitem{\par\hangindent -3em\hspace*{2em}}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `amsbook-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/amsthm-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/amsthm-bidi.def
new file mode 100644
index 00000000000..a0ed8577aef
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/amsthm-bidi.def
@@ -0,0 +1,30 @@
+%%
+%% This is file `amsthm-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `amsthm-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@thmcountersep{\@SepMark}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `amsthm-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/array-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/array-bidi.def
new file mode 100644
index 00000000000..9f2fa8a1193
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/array-bidi.def
@@ -0,0 +1,111 @@
+%%
+%% This is file `array-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `array-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@testpach{\@chclass
+ \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
+ \ifnum \@lastchclass=7 5 \else
+ \ifnum \@lastchclass=8 \tw@ \else
+ \ifnum \@lastchclass=9 \thr@@
+ \else \z@
+ \ifnum \@lastchclass = 10 \else
+ \edef\@nextchar{\expandafter\string\@nextchar}%
+ \@chnum
+ \if \@nextchar c\z@ \else
+ \if \@nextchar \if@RTLtab r\else l\fi\@ne \else
+ \if \@nextchar \if@RTLtab l\else r\fi\tw@ \else
+ \z@ \@chclass
+ \if\@nextchar |\@ne \else
+ \if \@nextchar !6 \else
+ \if \@nextchar @7 \else
+ \if \@nextchar <8 \else
+ \if \@nextchar >9 \else
+ 10
+ \@chnum
+ \if \@nextchar m\thr@@\else
+ \if \@nextchar p4 \else
+ \if \@nextchar b5 \else
+ \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
+ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
+\def\tabular{\gdef\@halignto{}\@tabular}
+\def\@tabular{\if@RTL\global\@RTLtabtrue\fi%
+ \leavevmode
+ \hbox\bgroup \if@RTLtab\beginR \fi
+ $%
+ \@tabularinit
+ \@array
+}
+\renewcommand\@array[2][c]{%
+ \@tempdima \ht \strutbox
+ \advance \@tempdima by\extrarowheight
+ \setbox \@arstrutbox \hbox{%
+ \vrule \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@
+ }%
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\@preamble{%
+ \noexpand \ialign \@halignto
+ \bgroup \@arstrut \@preamble
+ \tabskip \z@ \cr
+ }%
+ \endgroup
+ \@arrayleft
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
+ \bgroup
+ \@arrayinit
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble
+ % indent
+}
+%% environment body goes here
+\def\endtabular{%
+ \crcr
+ \egroup % \bgroup from \@preamble
+ \if@RTLtab\egroup\endR\egroup\fi % \vbox\hbox
+ \egroup
+ \gdef\@preamble{}%
+ $\if@RTLtab\endR\fi%
+ \egroup % original \hbox
+\global\@RTLtabfalse}
+\def\@tabularinit{%
+ \col@sep\tabcolsep
+ \let \d@llarbegin \begingroup
+ \let \d@llarend \endgroup
+}
+\def\@arrayinit{%
+ \let \@sharp ##
+ \let \protect \relax
+ \lineskip \z@
+ \baselineskip \z@
+ \m@th
+ \let \\ \@arraycr
+ \let \tabularnewline \\%
+ \let \par \@empty
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `array-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/article-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/article-bidi.def
new file mode 100644
index 00000000000..71a77895019
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/article-bidi.def
@@ -0,0 +1,130 @@
+%%
+%% This is file `article-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `article-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty\@secpenalty
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \fi
+ \endgroup
+ \fi}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@part[#1]#2{%
+ \ifnum \c@secnumdepth >\m@ne
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}{\thepart\hspace{1em}#1}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \fi
+ {\parindent \z@ \raggedleft
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \Large\bfseries \partname\nobreakspace\thepart
+ \par\nobreak
+ \fi
+ \huge \bfseries #2%
+ \markboth{}{}\par}%
+ \nobreak
+ \vskip 3ex
+ \@afterheading}
+ \def\ps@plain{\ps@empty
+\def\@oddfoot{\hfil\thepage\hfil}%
+\let\@evenfoot\@oddfoot
+}
+\renewenvironment{thebibliography}[1]
+ {\section*{\refname}%
+ \@mkboth{\MakeUppercase\refname}{\MakeUppercase\refname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\beginR\leftmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markboth {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@
+ \thesection\quad
+ \fi
+ \beginR##1\endR}}{}}%
+ \def\subsectionmark##1{%
+ \markright {%
+ \ifnum \c@secnumdepth >\@ne
+ \beginR\thesubsection\quad\endR
+ \fi
+ \beginR##1\endR}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \beginR\thesection\quad\endR
+ \fi
+ \beginR##1\endR}}}}
+\fi
+\def\ps@myheadings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\@gobbletwo
+ \let\sectionmark\@gobble
+ \let\subsectionmark\@gobble
+ }
+\pagestyle{plain}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `article-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/beamerthemebidiJLTree.sty b/Master/texmf-dist/tex/xelatex/bidi/beamerthemebidiJLTree.sty
new file mode 100644
index 00000000000..010f8255575
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/beamerthemebidiJLTree.sty
@@ -0,0 +1,133 @@
+%%
+%% This is file `beamerthemebidiJLTree.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `beamerthemebidiJLTree.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\ProvidesPackage{beamerthemebidiJLTree}
+
+\newif\ifbeamer@tree@showhooks
+\beamer@tree@showhookstrue
+
+\DeclareOptionBeamer{hooks}[true]{\csname beamer@tree@showhooks#1\endcsname}
+
+\ProcessOptionsBeamer
+\mode
+<presentation>
+
+\setbeamertemplate{navigation symbols}{}
+\usecolortheme{rose}
+\useinnertheme[shadow=true]{rounded}% les block
+
+\defbeamertemplate*{footline}{bidiJLTree theme}
+{
+ \begin{beamercolorbox}[colsep=1.5pt]{upper separation line foot}
+ \end{beamercolorbox}
+ \hbox{%
+ \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,left]{date in head/foot}%
+ \usebeamerfont{date in head/foot}
+ \insertframenumber{} / \inserttotalframenumber\hspace*{2ex}
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=.5\paperwidth,ht=2.25ex,dp=1ex,right]{title in head/foot}%
+ \usebeamerfont{title in head/foot}\beginR\hspace*{2ex}\insertauthor \hspace*{1ex} (\insertshortinstitute) \hspace*{2ex} \insertdate\endR
+ \end{beamercolorbox}}%
+}
+
+\defbeamertemplate*{sidebar right}{bidiJLTree theme}{}
+
+\usesectionheadtemplate
+{\hfil\insertsectionhead}
+{\hfill\color{fg!50!bg}\insertsectionhead}
+
+\usesubsectionheadtemplate
+{\hfil\insertsubsectionhead}
+{\hfill\color{fg!50!bg}\insertsubsectionhead}
+
+\defbeamertemplate*{headline}{bidiJLTree theme}
+{%
+ \leavevmode%
+ \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{upper separation line head}
+ \end{beamercolorbox}
+ \@tempdimb=3.625ex% 2.4375ex%
+ \multiply\@tempdimb by\beamer@sectionmax%
+%% \advance\@tempdimb by 1.125ex%
+ \advance\@tempdimb by -1.125ex%
+ \ifdim\@tempdimb<10.9ex% 3*(2.5+1.125)
+ \@tempdimb=10.9ex%
+ \fi
+ \begin{beamercolorbox}[wd=.45\paperwidth, ht=\@tempdimb]{left block}%
+ \usebeamerfont{section in head/foot}%
+ \vbox to\@tempdimb{\vfill\insertsectionnavigation{.45\paperwidth}\vfill}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=1.125ex,ht=\@tempdimb,dp=1.125ex]{middle separation line head}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=.44\paperwidth]{middle block}%
+ \vbox to\@tempdimb{\vfill%
+ \begin{beamercolorbox}[wd=.44\paperwidth,ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{title in head/foot}%
+ \usebeamerfont{title in head/foot}\insertshorttitle
+ \end{beamercolorbox}
+ \begin{beamercolorbox}[wd=.44\paperwidth,ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{section in head/foot}
+ \usebeamerfont{section in head/foot}%
+ \ifbeamer@tree@showhooks
+ \setbox\beamer@tempbox=\hbox{\insertsectionhead}%
+ \ifdim\wd\beamer@tempbox>1pt%
+ \hskip2pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
+ \hskip1pt%
+ \fi%
+ \else%
+ \hskip6pt%
+ \fi%
+ \insertsectionhead
+ \end{beamercolorbox}
+ \begin{beamercolorbox}[wd=.44\paperwidth,ht=2.5ex,dp=1.125ex,%
+ leftskip=.3cm,rightskip=.3cm plus1fil]{subsection in head/foot}
+ \usebeamerfont{subsection in head/foot}%
+ \ifbeamer@tree@showhooks
+ \setbox\beamer@tempbox=\hbox{\insertsubsectionhead}%
+ \ifdim\wd\beamer@tempbox>1pt%
+ \hskip9.4pt\raise1.9pt\hbox{\vrule width0.4pt height1.875ex\vrule width 5pt height0.4pt}%
+ \hskip1pt%
+ \fi%
+ \else%
+ \hskip12pt%
+ \fi%
+ \insertsubsectionhead
+ \end{beamercolorbox}%
+ \vfill}%
+ \end{beamercolorbox}%
+ \begin{beamercolorbox}[wd=.1\paperwidth,ht=\@tempdimb,right]{right block}%
+ \vbox to\@tempdimb{\vfill\insertlogo\vfill}
+ \end{beamercolorbox}
+ \vfill
+ \begin{beamercolorbox}[wd=\paperwidth,colsep=1.5pt]{lower separation line head}
+ \end{beamercolorbox}
+}
+\setbeamercolor{separation line}{use=structure,bg=structure.fg!50!bg}
+
+\mode
+<all>
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `beamerthemebidiJLTree.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bibitem.pdf b/Master/texmf-dist/tex/xelatex/bidi/bibitem.pdf
new file mode 100755
index 00000000000..49191743021
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bibitem.pdf
Binary files differ
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidi.sty b/Master/texmf-dist/tex/xelatex/bidi/bidi.sty
index 2ffa7b5c828..ad506033cd1 100644
--- a/Master/texmf-dist/tex/xelatex/bidi/bidi.sty
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidi.sty
@@ -4,79 +4,131 @@
%%
%% The original source files were:
%%
-%% bidi.dtx (with options: `package')
+%% bidi.dtx (with options: `bidi.sty')
%%
-%% ____________________________
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
%%
-%% The bidi package
-%% (C) 2007-2008 François Charette
-%% License information appended
%%
\NeedsTeXFormat{LaTeX2e}
-\ProvidesPackage{bidi}
- [2008/07/07 v0.3 Bidirectional typesetting in XeLaTeX]
-\newif\if@rlmain
-\@rlmainfalse
-\DeclareOption{rldocument}{\@rlmaintrue}
-\ProcessOptions
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\def\bididate{2009/08/01}
+\def\bidiversion{v1.0.1}
+\def\bidirevision{revision 68}
+\ProvidesPackage{bidi}[\bididate\space \bidiversion\space <\bidirevision>
+Bidirectional typesetting in XeLaTeX]
+\AtBeginDocument{\special{pdf: docinfo <<
+/Creator (Bidi \bidiversion\space <\bidirevision> Copyright © 2009 Vafa Khalighi)
+ >>}}
+\newif\if@RTLmain
+\newif\if@RTL
+\newif\if@RTLtab
+\newif\if@sentdir
+\newif\if@RTL@footnote
+\let\if@rlmain=\if@RTLmain
+\let\@rlmaintrue=\@RTLmaintrue
+\let\@rlmainfalse=\@RTLmainfalse
+\let\if@rl=\if@RTL
+\let\@rltrue=\@RTLtrue
+\let\@rlfalse=\@RTLfalse
+\let\if@rl@footnote=\if@RTL@footnote
+\let\@rl@footnotetrue=\@RTL@footnotetrue
+\let\@rl@footnotefalse=\@RTL@footnotefalse
+\let\if@tab@rl=\if@RTLtab
+\let\@tab@rltrue=\@RTLtabtrue
+\let\@tab@rlfalse=\@RTLtabfalse
+\@RTLmainfalse
+\RequirePackage{amsmath}
+\newcommand\bidi@isloaded[2][]{
+ \expandafter\ifx\csname if@bidi@#2loaded@\endcsname\relax
+ \expandafter\newif\csname if@bidi@#2loaded@\endcsname
+ \fi
+ \@ifpackageloaded{#2}
+ {\csname @bidi@#2loaded@true\endcsname #1}
+ {\csname @bidi@#2loaded@false\endcsname}}
+\bidi@isloaded{xunicode}
+\AtBeginDocument{
+ \if@bidi@xunicodeloaded@
+ \bidi@isloaded[\PackageError{bidi}{Oops! you have loaded package xunicode before bidi package. Please load package xunicode after bidi package, and then try to run xelatex on your document again}{}]{xunicode}
+ \fi%
+}
\ifx\TeXXeTstate\undefined\else%
\TeXXeTstate=1
\fi
-\ifx\beginL\@undefined%
+\ifx\beginR\@undefined%
\newlinechar`\^^J
\typeout{^^JTo avoid this error message,^^J%
run TeX--XeT or e-TeX engine instead of regular TeX.^^J}
\errmessage{Right-to-Left Support Error: use TeX--XeT or e-TeX
engine}%
\fi
-\newif\if@rl
-\AtBeginDocument{% Here we set the main document direction
- \if@rlmain\else
- \if@rl\@rlmaintrue%
- \else\@rlmainfalse%
+\AtBeginDocument{%
+ \if@RTLmain\else
+ \if@RTL\@RTLmaintrue%
+ \else\@RTLmainfalse%
\fi%
\fi%
}
+\def\Bidi@RTL@everypar{\if@RTL{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
+ \let\o@everypar=\everypar
+ \newtoks\n@everypar
+ \n@everypar\expandafter{\the\o@everypar}
+ \o@everypar{\Bidi@RTL@everypar\the\n@everypar}
+ \let\everypar=\n@everypar
\let\n@xt=\
-\def\LR{\protect\pLR}%
-\def\pLR{\protect\afterassignment\moreLR \let\n@xt= }
-\def\moreLR{\bracetext \aftergroup\endL \beginL\@rlfalse}
-\def\RL{\protect\pRL}
-\def\pRL{\protect\afterassignment\moreRL \let\n@xt= }
-\def\moreRL{\bracetext \aftergroup\endR \beginR\@rltrue}
+\def\LRE{\protect\pLRE}%
+\def\pLRE{\protect\afterassignment\moreLRE \let\n@xt= }
+\def\moreLRE{\bracetext \aftergroup\endL \beginL\@RTLfalse}
+\def\RLE{\protect\pRLE}
+\def\pRLE{\protect\afterassignment\moreRLE \let\n@xt= }
+\def\moreRLE{\bracetext \aftergroup\endR \beginR\@RTLtrue}
\def\bracetext{\ifcat\n@xt{\else\ifcat\n@xt}\fi
\errmessage{Missing left brace has been substituted}\fi \bgroup}
-\everydisplay{\if@rl\aftergroup\beginR\fi }
-\def\rl@everypar{\if@rl{\setbox\z@\lastbox\beginR\usebox\z@}\fi}
-\let\o@everypar=\everypar
-\newtoks\n@everypar
-\n@everypar\expandafter{\the\o@everypar}
-\o@everypar{\rl@everypar\the\n@everypar}
-\let\everypar=\n@everypar
-\def\@ensure@RL#1{\if@rl#1\else\RL{#1}\fi}
-\def\@ensure@LR#1{\if@rl\LR{#1}\else#1\fi}
-\def\@ensure@dir#1{\if@rl\RL{#1}\else{#1}\fi}
-\def\@ensure@maindir#1{\if@rlmain\RL{#1}\else{#1}\fi}
-\def\@@RL{RL}
-\def\@@LR{LR}
-\def\save@dir{\if@rl\gdef\saved@@dir{RL}\else\gdef\saved@@dir{LR}\fi}
-\def\reset@dir{\ifx\saved@@dir\@@RL\setRL\else\ifx\saved@@dir\@@LR\setLR\else\relax\fi\fi}
+\def\lr#1{\begingroup\beginL\rmfamily#1\endL\endgroup}
+\def\LTR{\bgroup\par\@RTLfalse\@RTL@footnotefalse}
+\def\endLTR{\par\egroup}
+\def\RTL{\bgroup\par\@RTLtrue\@RTL@footnotetrue}
+\def\endRTL{\par\egroup}
+\def\ltr{\if@RTL\par\@RTLfalse\@RTL@footnotefalse\fi}
+\def\rtl{\if@RTL\relax\else\par\@RTLtrue\@RTL@footnotetrue\fi}
+\def\setRTL{\@RTLtrue\@RTL@footnotetrue}
+\def\setLTR{\@RTLfalse\@RTL@footnotefalse}
+\let\unsetRTL=\setLTR
+\let\unsetLTR=\setRTL
+\let\LR=\LRE
+\let\RL=\RLE
+\def\@ensure@RTL#1{\if@RTL#1\else\RLE{#1}\fi}
+\def\@ensure@LTR#1{\if@RTL\LRE{#1}\else#1\fi}
+\let\@ensure@RL=\@ensure@RTL
+\let\@ensure@LR=\@ensure@LTR
+\def\@ensure@dir#1{\if@RTL\RLE{#1}\else{#1}\fi}
+\let\@ensure@maindir=\@ensure@dir
+\def\@@RTL{RTL}
+\def\@@LTR{LTR}
+\def\save@dir{\if@RTL\gdef\saved@@dir{RTL}\else\gdef\saved@@dir{LTR}\fi}
+\def\reset@dir{\ifx\saved@@dir\@@RTL\setRTL\else\ifx\saved@@dir\@@LTR\setLTR\else\relax\fi\fi}
\let\@@TeX\TeX
-\def\TeX{\@ensure@LR{\@@TeX}}
+\def\TeX{\@ensure@LTR{\@@TeX}}
\let\@@LaTeX\LaTeX
-\def\LaTeX{\@ensure@LR{\@@LaTeX}}
+\def\LaTeX{\@ensure@LTR{\@@LaTeX}}
\let\@@LaTeXe\LaTeXe
-\def\LaTeXe{\@ensure@LR{\@@LaTeXe}}
-\@ifpackageloaded{xltxtra}{
-\let\@@XeTeX\XeTeX
-\def\XeTeX{\@ensure@LR{\@@XeTeX}}
-\let\@@XeLaTeX\XeLaTeX
-\def\XeLaTeX{\@ensure@LR{\@@XeLaTeX}}
-}{}
-\@ifundefined{text}{}{%
-\let\t@xt=\text
-\def\text#1{\t@xt{\@ensure@dir{#1}}}}
+\def\LaTeXe{\@ensure@LTR{\@@LaTeXe}}
+\def\reflect#1{{\setbox0=\hbox{#1}\rlap{\kern0.5\wd0
+ \special{x:gsave}\special{x:scale -1 1}}\box0 \special{x:grestore}}}
+\def\XeTeX{\LR{\leavevmode$\smash{\hbox{X\lower.5ex
+ \hbox{\kern-.125em\reflect{E}}\kern-.1667em \TeX}}$}}
+\def\XeLaTeX{\LR{\leavevmode$\smash{\hbox{X\lower.5ex
+ \hbox{\kern-.125em\reflect{E}}\kern-.1667em \LaTeX}}$}}
+\let\setRL=\setRTL
+\let\setLR=\setLTR
+\let\unsetRL=\setLTR
+\DeclareOption{RTLdocument}{\@RTLtrue\@RTL@footnotetrue\RTLdblcol\autofootnoterule}
+\DeclareOption{rldocument}{\@RTLtrue\@RTL@footnotetrue\RTLdblcol\autofootnoterule}
+\def\rcases#1{\left.\vcenter{\normalbaselines\m@th
+ \ialign{$##\hfil$&\quad{##}\hfil\crcr#1\crcr}}\,\right\}}
+\def\SepMark#1{\gdef\@SepMark{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+\SepMark{.}
\def\list#1#2{%
\ifnum \@listdepth >5\relax
\@toodeep
@@ -96,318 +148,217 @@
\parindent\listparindent
\advance\linewidth -\rightmargin
\advance\linewidth -\leftmargin
- \if@rl
+ \if@RTL
\advance\@totalleftmargin \rightmargin
\else
\advance\@totalleftmargin \leftmargin
\fi
\parshape \@ne \@totalleftmargin \linewidth
\ignorespaces}
+\def\raggedright{%
+ \let\\\@centercr
+ \leftskip\z@skip\rightskip\@flushglue
+ \parindent\z@\parfillskip\z@skip}
+\let\@@raggedleft=\raggedleft
+\let\@@raggedright=\raggedright
+\renewcommand\raggedleft{\if@RTL\@@raggedright%
+ \else\@@raggedleft\fi}
+\renewcommand\raggedright{\if@RTL\@@raggedleft%
+ \else\@@raggedright\fi}
+\def\raggedright{%
+ \let\\\@centercr
+ \rightskip\z@skip\rightskip\@flushglue
+ \parindent\z@\parfillskip\z@skip}
+\renewcommand\raggedleft{\@@raggedleft}
+\renewcommand\raggedright{\@@raggedright}
+\def\centerline#1{%
+\if@RTL\@@line{\hss\beginR#1\endR\hss}
+\else\@@line{\hss#1\hss}\fi}
+\def\leftline#1{%
+\if@RTL\@@line{\beginR#1\endR\hss}
+\else\@@line{#1\hss}\fi}
+\def\rightline#1{%
+\if@RTL\@@line{\hss\beginR#1\endR}
+\else\@@line{\hss#1}\fi}
+\def\narrower{%
+ \advance\if@RTL\rightskip\else\leftskip\fi\parindent
+ \advance\if@RTL\leftskip\else\rightskip\fi\parindent}
+\def\leftmark{\beginR\expandafter\@leftmark\botmark\@empty\@empty\endR}
+\def\rightmark{\beginR\expandafter\@rightmark\firstmark\@empty\@empty\endR}
+\def\underline#1{%
+ \relax
+ \ifmmode\@@underline{#1}%
+ \else
+\if@RTL $\@@underline{\hbox{\beginR#1\endR}}\m@th$\relax
+\else
+$\@@underline{\hbox{#1}}\m@th$\relax\fi\fi}
+\if@compatibility
+ \let\undertext=\underline
+\fi
+\global\@RTLtabfalse
+\def\@tabular{\if@RTL\global\@RTLtabtrue\fi
+ \leavevmode \hbox \bgroup \if@RTLtab\beginR \fi
+ $\let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
+\def\endtabular{\crcr\egroup\if@RTLtab\egroup\endR\egroup\fi
+ \egroup $\if@RTLtab\endR\fi\egroup
+ \global\@RTLtabfalse}
+\expandafter \let \csname endtabular*\endcsname = \endtabular
+\def\@array[#1]#2{%
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
+ \bgroup
+ \setbox\@arstrutbox\hbox{%
+ \vrule \@height\arraystretch\ht\strutbox
+ \@depth\arraystretch \dp\strutbox
+ \@width\z@}%
+ \@mkpream{#2}%
+ \edef\@preamble{%
+ \ialign \noexpand\@halignto
+ \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \let\tabularnewline\\%
+ \let\par\@empty
+ \let\@sharp##%
+ \set@typeset@protect
+ \lineskip\z@skip\baselineskip\z@skip
+ \ifhmode \@preamerr\z@ \@@par\fi
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble}
+\def\@testpach#1{\@chclass \ifnum \@lastchclass=\tw@ 4 \else
+ \ifnum \@lastchclass=3 5 \else
+ \z@ \if #1c\@chnum \z@ \else
+ \if \if@RTLtab#1r\else#1l\fi\@chnum \@ne \else
+ \if \if@RTLtab#1l\else#1r\fi\@chnum \tw@ \else
+ \@chclass \if #1|\@ne \else
+ \if #1@\tw@ \else
+ \if #1p3 \else \z@ \@preamerr 0\fi
+ \fi \fi \fi \fi \fi \fi
+\fi}
\def\@dottedtocline#1#2#3#4#5{%
\ifnum #1>\c@tocdepth \else
\vskip \z@ \@plus.2\p@
- {\if@rl\rightskip\else\leftskip\fi #2\relax
- \if@rl\leftskip\else\rightskip\fi \@tocrmarg \parfillskip
- -\if@rl\leftskip\else\rightskip\fi
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
\parindent #2\relax\@afterindenttrue
\interlinepenalty\@M
\leavevmode
\@tempdima #3\relax
- \advance\if@rl\rightskip\else\leftskip\fi \@tempdima
- \null\nobreak\hskip -\if@rl\rightskip\else\leftskip\fi
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
{#4}\nobreak
\leaders\hbox{$\m@th
\mkern \@dotsep mu\hbox{.}\mkern \@dotsep
mu$}\hfill
\nobreak
- \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor \beginL#5\endL}%
+ \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
\par}%
\fi}
-\def\raggedright{%
- \let\\\@centercr
- \leftskip\z@skip\rightskip\@flushglue
- \parindent\z@\parfillskip\z@skip}
-\let\@@raggedleft=\raggedleft
-\let\@@raggedright=\raggedright
-\renewcommand\raggedleft{\if@rl\@@raggedright%
- \else\@@raggedleft\fi}
-\renewcommand\raggedright{\if@rl\@@raggedleft%
- \else\@@raggedright\fi}
-\let\@@@underline=\underline
-\def\underline#1{\@@@underline{\if@rl\RL{#1}\else #1\fi}}
-\if@compatibility
- \let\undertext=\underline
-\fi
-\let\lr@outputdblcol\@outputdblcol
-\renewcommand{\@outputdblcol}{%
- \if@rlmain%
- \rl@outputdblcol%
- \else%
- \lr@outputdblcol%
- \fi%
-}
-\newcommand{\rl@outputdblcol}{%
- \if@firstcolumn
- \global \@firstcolumnfalse
- \global \setbox\@leftcolumn \box\@outputbox
- \else
- \global \@firstcolumntrue
- \setbox\@outputbox \vbox {\hb@xt@\textwidth {%
- \hskip\columnwidth%
- \hfil\vrule\@width\columnseprule\hfil
- \hb@xt@\columnwidth {%
- \box\@leftcolumn \hss}%
- \hb@xt@\columnwidth {%
- \hskip-\textwidth%
- \box\@outputbox \hss}%
- \hskip\columnsep%
- \hskip\columnwidth}}%
- \@combinedblfloats
- \@outputpage
- \begingroup
- \@dblfloatplacement
- \@startdblcolumn
- \@whilesw\if@fcolmade \fi
- {\@outputpage
- \@startdblcolumn}%
- \endgroup
+\def\RTL@outputdblcol{\if@firstcolumn
+\global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\box\@outputbox
+ \else \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{%
+ \hbox to\textwidth{%
+ \hbox to\columnwidth{\box\@outputbox \hss}%
+ \hfil \vrule width\columnseprule\hfil
+ \hbox to\columnwidth{\box\@leftcolumn \hss}%
+ }}\@combinedblfloats
+\@outputpage \begingroup \@dblfloatplacement
+\@startdblcolumn
+\@whilesw\if@fcolmade \fi
+{\@outputpage\@startdblcolumn}\endgroup
+ \fi}
+\def\LTR@outputdblcol{\if@firstcolumn
+\global\@firstcolumnfalse
+ \global\setbox\@leftcolumn\box\@outputbox
+ \else \global\@firstcolumntrue
+ \setbox\@outputbox\vbox{\hbox to\textwidth{%
+ \hbox to\columnwidth
+ {\box\@leftcolumn \hss}\hfil
+ \vrule width\columnseprule\hfil
+ \hbox to\columnwidth{\box\@outputbox \hss}}}%
+ \@combinedblfloats
+ \@outputpage \begingroup \@dblfloatplacement
+ \@startdblcolumn
+ \@whilesw\if@fcolmade \fi
+ {\@outputpage\@startdblcolumn}\endgroup
+ \fi}
+\newcommand{\RTLdblcol}{\renewcommand{\@outputdblcol}{\RTL@outputdblcol}}
+\newcommand{\LTRdblcol}{\renewcommand{\@outputdblcol}{\LTR@outputdblcol}}
+\long\def\@makecaption#1#2{%
+ \vskip 10pt%
+ \setbox\@tempboxa\hbox{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize \if@RTL\beginR\fi#1: #2\par%
+ \else \hbox
+to\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil%
+\if@RTL\endR\fi}%
\fi}
-
-\newif\if@rl@footnote
-\if@rlmain\@rl@footnotetrue\else\@rl@footnotefalse\fi
-\let\@@footnoterule=\footnoterule
-\def\LRfootnoterule{\@@footnoterule}
-%%bug?-->this causes new par to be set, hence hack with vskip :-{
-\def\RLfootnoterule{\vskip -\baselineskip\hb@xt@\hsize{\hss\vbox{\@@footnoterule}}}
-\def\setfootnoteRL{\@rl@footnotetrue}
-\def\unsetfootnoteRL{\@rl@footnotefalse}
-\def\setfootnoteLR{\unsetfootnoteRL}
-\def\footnoterule{\if@rlmain\RLfootnoterule\else\LRfootnoterule\fi}
-\def\setRL{\@rltrue\@rl@footnotetrue}
-\def\unsetRL{\@rlfalse\@rl@footnotefalse}
-\def\setLR{\unsetRL}
-\long\def\@footnotetext#1{\insert\footins{%
- \if@rl@footnote\@rltrue\else\@rlfalse\fi
- \reset@font\footnotesize
- \interlinepenalty\interfootnotelinepenalty
- \splittopskip\footnotesep
- \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
- \hsize\columnwidth \@parboxrestore
- \protected@edef\@currentlabel{%
- \csname p@footnote\endcsname\@thefnmark
- }%
- \color@begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
- \color@endgroup}}%
-%%... also in minipages
-\long\def\@mpfootnotetext#1{%
- \global\setbox\@mpfootins\vbox{%
- \if@rl@footnote\@rltrue\else\@rlfalse\fi
- \unvbox\@mpfootins
- \reset@font\footnotesize
- \hsize\columnwidth
- \@parboxrestore
- \protected@edef\@currentlabel
- {\csname p@mpfootnote\endcsname\@thefnmark}%
- \color@begingroup
- \@makefntext{%
- \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}%
- \color@endgroup
- }}
-\@ifundefined{KOMAClassName}{%
-\@ifclassloaded{memoir}{%
-\long\def\@makecaption#1#2{\let\@memtempa\relax
- \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip
- \else \def\@memtempa{\vbox to\topskip{}}\fi
- \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}
- \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}
- \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2}
- \let\footnote\@contfnote
- \let\footnotemark\@contfmark
- \ifdim\wd\@tempboxa<\linewidth \centering \fi
- \if@contcw
- \centering
- \parbox{\@contcwidth}{%
- \ifdim\wd\@tempboxa<\@contcwidth \centering \fi
- \fi
- \if@conthang
- \sbox\@tempboxa{\@contnfont #1\@contdelim}
- \@contpre%
- \@ensure@dir{\@contcstyle\hangindent=\wd\@tempboxa
- \noindent\box\@tempboxa\@memtempa \@conttfont #2}\par
- \else
- \if@contindent
- \@contpre%
- \@ensure@dir{\@contnfont #1\@contdelim}\@memtempa
- \@ensure@dir{\@contcstyle\hangindent=\@contindw
- \hangafter=\@ne\@conttfont #2}\par% <- v1.4
- \else
- \@contpre%
- \@ensure@dir{\@contnfont #1\@contdelim}\@memtempa
- \@ensure@dir{\ifdim\wd\@tempboxa<\linewidth
- \@contcshortstyle\else \@contcstyle\fi% <- v1.4
- \@conttfont #2}\par
- \fi
- \fi
- \@contpost
- \if@contcw
- \par
- } % end of the \parbox
- \fi
- \vskip\belowcaptionskip}
-}% else we redefine \@makecaption for the standard classes
-{\@ifundefined{@makecaption}{%
-}{\long\def\@makecaption#1#2{%
- \vskip\abovecaptionskip
- \sbox\@tempboxa{\@ensure@dir{#1: #2}}%
- \ifdim \wd\@tempboxa >\hsize
- \@ensure@dir{#1: #2}\par
- \else
- \global \@minipagefalse
- \hb@xt@\hsize{\hfil\box\@tempboxa\hfil}%
- \fi
- \vskip\belowcaptionskip}%
- }%
- }%
-}% ELSE KOMASCRIPT
-{\@ifclassloaded{scrlttr2}{}% do nothing for letter class
-{\renewcommand{\@@makecaption}[3]{%
- \cap@margin
- \ifonelinecaptions
- \@tempcnta=\value{mpfootnote}\@tempcntb=\value{footnote}%
- \let\scr@tmp@footnotetext=\@footnotetext
- \let\@footnotetext=\@gobble
- \sbox\@tempboxa{%
- {\capfont\strut\ignorespaces
- #1{{\caplabelfont#2\captionformat}}%
- #3\unskip\strut}%
- }%
- \let\@footnotetext=\scr@tmp@footnotetext
- \let\scr@tmp@footnotetext=\undefined
- \setcounter{footnote}{\@tempcntb}%
- \setcounter{mpfootnote}{\@tempcnta}%
- \else
- \sbox\@tempboxa{\hspace*{2\cap@width}}%
- \fi
- \begingroup%
- \setlength{\@tempdima}{\cap@width}%
- \ifdim \wd\@tempboxa >\@tempdima
- \hb@xt@\hsize{%
- \setbox\@tempboxa\vbox{\hsize=\cap@width
- \ifdofullc@p
- \@ensure@dir{\capfont\@hangfrom{\scr@smashdp{\strut\ignorespaces
- #1{{\caplabelfont#2\captionformat}}}}%
- {#3\unskip\strut\par}}%
- \else%
- \ifdim\cap@indent<\z@
- \@ensure@dir{\capfont\strut\ignorespaces
- #1{{\caplabelfont #2\captionformat\par}}%
- \noindent\hspace*{-\cap@indent}#3\unskip\strut\par}%
- \else%
- \if@capbreak
- \@ensure@dir{\capfont\strut\ignorespaces
- #1{{\caplabelfont #2\captionformat\par}}%
- \noindent\@hangfrom{\hspace*{\cap@indent}}{#3\par}}%
- \else
- \@ensure@dir{\capfont\@hangfrom{\scr@smashdp\strut\hspace*{\cap@indent}}%
- {\hspace{-\cap@indent}\scr@smashdp{\ignorespaces#1%
- {{\caplabelfont#2\captionformat}}}#3\unskip\strut\par}}%
- \fi
- \fi
- \fi
- }%
- \setlength{\@tempdima}{\ht\@tempboxa}%
- \addtolength{\@tempdima}{\dp\@tempboxa}%
- \addtolength{\@tempdima}{-\ht\strutbox}%
- \ht\@tempboxa\ht\strutbox
- \dp\@tempboxa\@tempdima
- \strut\cap@left
- \box\@tempboxa
- \cap@right\strut
-}%
- \else
- \global \@minipagefalse
- \sbox\@tempboxa{%
- \@ensure@dir{\capfont\scr@smashdp{\strut\ignorespaces
- #1{{\caplabelfont#2\captionformat}}}%
- #3}%
- }%
- \hb@xt@\hsize{\strut\cap@left\box\@tempboxa\cap@right\strut}%
- \fi
- \endgroup}
-}}%
-\ifx\@textcolor\@undefined\else%
-\AtBeginDocument{%
- \def\@textcolor#1#2#3{%
- \if@rl\PackageWarning{bidi}{%
- \textcolor will not work in RL mode if the textual argument spans more than one line.^^J%
- With XeTeX you should set color as a font feature instead.}%
- \beginL\protect\leavevmode{\color#1{#2}\beginR#3\endR}\endL%
- \else%
- \protect\leavevmode{\color#1{#2}#3}%
- \fi%
- }%
-}%
-\fi
-\newif\if@tab@rl
-\if@rlmain\@tab@rltrue\else\@tab@rlfalse\fi
-\@ifpackageloaded{array}%
-{\PackageWarningNoLine{bidi}{%
- You are using the package array (or the memoir class). ^^J
- Unfortunately right-to-left tabular environments are not ^^J
- yet supported with the array package.}
-\let\@uthor=\author
-\def\author#1{\@uthor{\@ensure@dir{#1}}}
-}%
-{% ELSE DEFAULT LATEX MACROS
-\def\@tabular{%
- \if@rl\global\@tab@rltrue\fi
- \leavevmode \hbox \bgroup \if@tab@rl\beginR\fi
- $\let\@acol\@tabacol
- \let\@classz\@tabclassz
- \let\@classiv\@tabclassiv \let\\\@tabularcr\@tabarray}
-\def\endtabular{\crcr\egroup\if@tab@rl\egroup\endR\egroup\fi
- \egroup $\if@tab@rl\endR\fi \egroup}%
-\def\@array[#1]#2{\setbox\@arstrutbox=\hbox{\vrule
- height\arraystretch \ht\strutbox
- depth\arraystretch \dp\strutbox
- width\z@}\@mkpream{#2}\edef\@preamble{%
-\halign \noexpand\@halignto
-\bgroup \tabskip\z@ \@arstrut \@preamble \tabskip\z@ \cr}%
-\let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
-\if #1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
-\bgroup \let\par\relax
-\let\@sharp##\let\protect\relax \lineskip\z@\baselineskip\z@
-\if@tab@rl\hbox\bgroup\beginR\vbox\bgroup\fi
-\@preamble}
+\renewenvironment{equation}{%
+ \incr@eqnum
+ \mathdisplay@push
+ \st@rredfalse \global\@eqnswtrue
+ \beginL\mathdisplay{equation}%
+}{%
+ \endmathdisplay{equation}\endL%
+ \mathdisplay@pop
+ \ignorespacesafterend
+}
+\renewcommand{\numberwithin}[3][\arabic]{%
+ \@ifundefined{c@#2}{\@nocounterr{#2}}{%
+ \@ifundefined{c@#3}{\@nocnterr{#3}}{%
+ \@addtoreset{#2}{#3}%
+ \@xp\xdef\csname the#2\endcsname{%
+ \@xp\@nx\csname the#3\endcsname \@SepMark\@nx#1{#2}}}}%
}
-\def\@open@paren{\if@rlmain)\else(\fi}
-\def\@close@paren{\if@rlmain(\else)\fi}
-\def\tagform@#1{\maketag@@@{\@open@paren\ignorespaces#1\unskip\@@italiccorr\@close@paren}}
-%% Make these Unicode chars active and define them so that they work
-%% in conformance to the Unicode bidi algorithm!
-%% \catcode"200E=\active
-%% \catcode"200F=\active
-%% \def‎{\setLR}
-%% \def‏{\setRL}
-%% 202A -> {\@ensure@LR\bgroup} ? or \LR
-%% 202B -> {\@ensure@RL\bgroup} ? or \RL
-%% 202C -> {\egroup} ? or \if@rl\@rlfalse\else\@rltrue\fi ?
-%% 202D -> {?} %LRO
-%% 202E -> {?} %RLO
+\def\tagform@#1{\maketag@@@{)\ignorespaces\text{#1}\unskip\@@italiccorr(}}
+\renewcommand{\eqref}[1]{\beginL\textup{\tagform@{\ref{#1}}}\endL}
+\let\@@text=\text
+\def\text#1{\@@text{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+\@ifpackageloaded{amsthm}{\input{amsthm-bidi.def}}{}
+\@ifpackageloaded{xltxtra}{\input{xltxtra-bidi.def}}{}
+\@ifpackageloaded{wrapfig}{\input{wrapfig-bidi.def}}{}
+\@ifpackageloaded{graphicx}{\input{graphicx-bidi.def}}{}
+\@ifpackageloaded{fancyhdr}{\input{fancyhdr-bidi.def}}{}
+\@ifpackageloaded{draftwatermark}{\input{draftwatermark-bidi.def}}{}
+\@ifpackageloaded{pdfpages}{\input{pdfpages-bidi.def}}{}
+\@ifpackageloaded{listings}{\input{listings-bidi.def}}{}
+\@ifpackageloaded{pstricks}{\input{pstricks-bidi.def}}{}
+\@ifpackageloaded{tikz}{\input{tikz-bidi.def}}{}
+\@ifpackageloaded{array}{\input{array-bidi.def}}{}
+\@ifpackageloaded{stabular}{\input{stabular-bidi.def}}{}
+\@ifpackageloaded{longtable}{\input{longtable-bidi.def}}{}
+\@ifpackageloaded{minitoc}{\input{minitoc-bidi.def}}{}
+\@ifpackageloaded{ragged2e}{\input{ragged2e-bidi.def}}{}
+\@ifpackageloaded{tabls}{\input{tabls-bidi.def}}{}
+\@ifpackageloaded{tocloft}{\input{tocloft-bidi.def}}{}
+\@ifpackageloaded{tocstyle}{\input{tocstyle-bidi.def}}{}
+\@ifclassloaded{article}{\input{article-bidi.def}}{}
+\@ifclassloaded{amsart}{\input{amsart-bidi.def}}{}
+\@ifclassloaded{refrep}{\input{refrep-bidi.def}}{}
+\@ifclassloaded{report}{\input{report-bidi.def}}{}
+\@ifclassloaded{rapport3}{\input{rapport3-bidi.def}}{}
+\@ifclassloaded{scrartcl}{\input{scrartcl-bidi.def}}{}
+\@ifclassloaded{scrbook}{\input{scrbook-bidi.def}}{}
+\@ifclassloaded{scrreprt}{\input{scrreprt-bidi.def}}{}
+\@ifclassloaded{amsbook}{\input{amsbook-bidi.def}}{}
+\@ifclassloaded{bookest}{\input{bookest-bidi.def}}{}
+\@ifclassloaded{extbook}{\input{extbook-bidi.def}}{}
+\@ifclassloaded{book}{\input{book-bidi.def}}{}
+\@ifclassloaded{bidibeamer}{\input{bidibeamer-bidi.def}}{}
+\input{footnote-bidi.def}
+\ProcessOptions
+
%%
-%% Copyright (C) 2007-2008 by François Charette <firmicus at gmx dot net>
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
%%
%% Distributable under the LaTeX Project Public License,
%% version 1.3c or higher (your choice). The latest version of
%% this license is at: http://www.latex-project.org/lppl.txt
%%
%% This work is "maintained" (as per LPPL maintenance status)
-%% by François Charette.
+%% by Vafa Khalighi.
+%%
+%%
%%
-%% This work consists of the file bidi.dtx
-%% and the derived files bidi.sty and bidi.pdf.
%%
%%
%% End of file `bidi.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidi2in1.sty b/Master/texmf-dist/tex/xelatex/bidi/bidi2in1.sty
new file mode 100644
index 00000000000..c8eb1450449
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidi2in1.sty
@@ -0,0 +1,86 @@
+%%
+%% This is file `bidi2in1.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidi2in1.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidi2in1}
+\pagestyle{plain}
+\newcount\evenpage
+\newcount\oddpage
+\twocolumn
+\def\@oddfoot{\evenpage=\thepage%
+\multiply\evenpage by 2%
+\oddpage=\the\evenpage%
+\advance\oddpage by -1%
+\hfil\the\evenpage\hfil\hfil\the\oddpage\hfil}%
+\def\@evenfoot{\evenpage=\thepage%
+\multiply\evenpage by 2%
+\oddpage=\the\evenpage%
+\advance\oddpage by -1%
+\hfil\the\oddpage\hfil\hfil\the\evenpage\hfil}%
+\textwidth 9.49in
+\textheight 6.7in
+\columnsep 0.9in
+\columnseprule 0.125pt
+\headheight 0cm
+\topmargin 0in
+\marginparwidth 0in
+\marginparsep 0in
+\hoffset 0.05in % Corrected
+\voffset -0.5in %top margin space is 1.0in by default
+\oddsidemargin 0in
+\evensidemargin 0in
+\headsep 0cm
+\topskip 0cm
+\parskip 0.15in %
+\headsep 0pt
+\special{papersize=11.69in,8.26in}
+\renewcommand\maketitle{\par
+\begingroup
+\renewcommand\thefootnote{\@fnsymbol\c@footnote}%
+\def\@makefnmark{\rlap{\@textsuperscript{\normalfont\@thefnmark}}}%
+\long\def\@makefntext##1{\parindent 1em\noindent
+\hb@xt@1.8em{%
+\hss\@textsuperscript{\normalfont\@thefnmark}}##1}%
+\@maketitle
+\@thanks
+\endgroup
+\setcounter{footnote}{0}%
+\global\let\thanks\relax
+\global\let\maketitle\relax
+\global\let\@maketitle\relax
+\global\let\@thanks\@empty
+\global\let\@author\@empty
+\global\let\@date\@empty
+\global\let\@title\@empty
+\global\let\title\relax
+\global\let\author\relax
+\global\let\date\relax
+\global\let\and\relax
+}
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidi2in1.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidibeamer-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/bidibeamer-bidi.def
new file mode 100644
index 00000000000..decc751e62c
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidibeamer-bidi.def
@@ -0,0 +1,395 @@
+%%
+%% This is file `bidibeamer-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidibeamer-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\raggedleft
+\def\LTR{\bgroup\par\raggedright\@RTLfalse}
+\def\endLTR{\par\egroup}
+\def\RTL{\bgroup\par\raggedleft\@RTLtrue}
+\def\endRTL{\par\egroup}
+\long\def\beamer@@frametitle[#1]#2{%
+ \beamer@ifempty{#2}{}{%
+ \gdef\insertframetitle{\raggedleft\rightskip=2em{\beginR#2\endR\ifnum\beamer@autobreakcount>0\relax{}\space\usebeamertemplate*{frametitle continuation}\fi}}%
+ \gdef\beamer@frametitle{\beginR#2\endR}%
+ \gdef\beamer@shortframetitle{\beginR#1\endR}%
+}%
+}
+\def\@thm#1#2#3{%
+ \ifhmode\unskip\unskip\par\fi
+ \normalfont
+ \let\thmheadnl\relax
+ \let\thm@swap\@gobble
+ \thm@headpunct{.}% add period after heading
+ \thm@space@setup
+ #1% style overrides
+ \def\inserttheoremname{#3}
+ \def\inserttheorempunctuation{\the\thm@headpunct}
+ \def\@tempa{#2}%
+ \ifx\@empty\@tempa
+ \def\inserttheoremnumber{}
+ \else
+ \refstepcounter{#2}%
+ \expandafter\def\expandafter\inserttheoremnumber\expandafter{ \csname the#2\endcsname}
+ \fi
+ \beamer@begintheorem%
+\raggedleft\@RTLtrue
+}
+ \ifbeamer@countsect
+ \newtheorem{biditheorem}{\raggedleft \biditheoremname}[section]
+ \else
+ \newtheorem{biditheorem}{\raggedleft \biditheoremname}
+ \fi
+ \newtheorem{bidicorollary}[theorem]{\raggedleft \bidicorollaryname}
+ \newtheorem{bidifact}[theorem]{\raggedleft \bidifactname}
+ \newtheorem{bidilemma}[theorem]{\raggedleft \bidilemmaname}
+ \newtheorem{bidiproblem}[theorem]{\raggedleft \bidiproblemname}
+ \newtheorem{bidisolution}[theorem]{\raggedleft \bidisolutionname}
+\theoremstyle{definition}
+ \newtheorem{bididefinition}[theorem]{\raggedleft \bididefinitionname}
+ \newtheorem{bididefinitions}[theorem]{\raggedleft \bididefinitionsname}
+\theoremstyle{example}
+ \newtheorem{bidiexample}[theorem]{\raggedleft \bidiexamplename}
+ \newtheorem{bidiexamples}[theorem]{\raggedleft \bidiexamplesname}
+\newenvironment<>{bidiproof}[1][\raggedleft \bidiproofname]{%
+ \par
+ \def\insertproofname{#1\@addpunct{}}%
+ \pushQED{\qed}
+ \usebeamertemplate{proof begin}\@RTLtrue#2}
+{\popQED\usebeamertemplate{proof end}}
+ \newenvironment<>{bidiblock}[1]{%
+ \begin{actionenv}#2%
+ \def\insertblocktitle{\raggedleft#1}%
+ \par%
+ \usebeamertemplate{block begin}\raggedleft\@RTLtrue}
+ {\par%
+ \usebeamertemplate{block end}%
+ \end{actionenv}}
+ \newenvironment<>{bidialertblock}[1]{%
+ \begin{actionenv}#2%
+ \def\insertblocktitle{\raggedleft#1}%
+ \par%
+ \mode<presentation>{%\usebeamerfont{block}%
+ \setbeamercolor{local structure}{parent=alerted text}}%
+ \usebeamertemplate{block alerted begin}\raggedleft\@RTLtrue}
+ {\par%
+ \usebeamertemplate{block alerted end}%
+ \end{actionenv}}
+ \newenvironment<>{bidiexampleblock}[1]{%
+ \begin{actionenv}#2%
+ \def\insertblocktitle{\raggedleft#1}%
+ \par%
+ \mode<presentation>{%\usebeamerfont{block}%
+ \setbeamercolor{local structure}{parent=example text}}%
+ \usebeamertemplate{block example begin}\raggedleft\@RTLtrue}
+ {\par%
+ \usebeamertemplate{block example end}%
+ \end{actionenv}}
+\def\@listi{\if@RTL\rightmargin\leftmargini\else\leftmargin\leftmargini\fi
+ \topsep 3\p@ \@plus2\p@ \@minus2.5\p@
+ \parsep 0\p@
+ \itemsep3\p@ \@plus2\p@ \@minus3\p@}
+\let\@listI\@listi
+\def\@listii{\if@RTL\rightmargin\leftmarginii\else\leftmargin\leftmarginii\fi
+ \topsep 2\p@ \@plus1\p@ \@minus2\p@
+ \parsep 0\p@ \@plus\p@
+ \itemsep \parsep}
+\def\@listiii{\if@RTL\rightmargin\leftmarginiii\else\leftmargin\leftmarginiii\fi
+ \topsep 2\p@ \@plus1\p@ \@minus2\p@
+ \parsep 0\p@ \@plus\p@
+ \itemsep \parsep}
+\def\beamer@enum@{%
+ \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
+ \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
+ \expandafter
+ \list
+ {\usebeamertemplate{\beamer@enumtempl}}
+ {\usecounter\@enumctr%
+ \def\makelabel##1{{\hss\llap{{%
+ \usebeamerfont*{enumerate \beameritemnestingprefix item}%
+ \usebeamercolor[fg]{enumerate \beameritemnestingprefix item}##1}}}}}%
+ \beamer@cramped%
+ \raggedleft%
+ \beamer@firstlineitemizeunskip%
+}
+\renewcommand{\itemize}[1][]{%
+ \beamer@ifempty{#1}{}{\def\beamer@defaultospec{#1}}%
+ \ifnum \@itemdepth >2\relax\@toodeep\else
+ \advance\@itemdepth\@ne
+ \beamer@computepref\@itemdepth% sets \beameritemnestingprefix
+ \usebeamerfont{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamercolor[fg]{itemize/enumerate \beameritemnestingprefix body}%
+ \usebeamertemplate{itemize/enumerate \beameritemnestingprefix body begin}%
+ \list
+ {\usebeamertemplate{itemize \beameritemnestingprefix item}}
+ {\def\makelabel##1{%
+ {%
+ \hss\llap{{%
+ \usebeamerfont*{itemize \beameritemnestingprefix item}%
+ \usebeamercolor[fg]{itemize \beameritemnestingprefix item}##1}}%
+ }%
+ }%
+ }
+ \fi%
+ \beamer@cramped%
+ \raggedleft%
+ \beamer@firstlineitemizeunskip%
+}
+\def\@@description{%
+ \advance\beamer@descdefault by \labelsep%
+ \list
+ {}
+ {\labelwidth\beamer@descdefault\leftmargin\beamer@descdefault\let\makelabel\beamer@descriptionitem}%
+ \beamer@cramped%
+ \raggedleft\rightskip=6em
+ \beamer@firstlineitemizeunskip%
+}
+\AtBeginDocument{\@RTLfalse}
+\renewenvironment{beamer@frameslide}{%
+ \ifbeamer@autobreak\else%
+ \ifx\beamer@againname\@empty%
+ {\let\@elt\beamer@restorecounter\beamer@overlaycounterresets}%
+ \else%
+ {\let\@elt\beamer@labelrestorecounter\beamer@overlaycounterresets}%
+ \fi%
+ \fi%
+ \global\c@beamerpauses=1\relax%
+ \expandafter\beamer@ifempty\expandafter{\beamer@framestartpage}{%
+ \refstepcounter{subsectionslide}%
+ \xdef\beamer@framestartpage{\the\c@page}% only first time
+ }{\clearpage\beamer@notesactions}% cleanup from previous slide
+ \hypersetup{pdfpagetransition=R}%
+ \hypersetup{pdfpageduration=}%
+ \xdef\beamer@frameendpage{\the\c@page}% every time
+ \beamer@setuplinks%
+ \beamer@displaybreak%
+ \global\setbox\beamer@zoombox=\box\voidb@x%
+ \def\beamer@zoomer{}%
+ \beamer@slidehaszoomfalse%
+ \gdef\insertframetitle{}%
+ \gdef\insertframesubtitle{}%
+ \gdef\beamer@frametitle{}%
+ \gdef\beamer@shortframetitle{}%
+ \gdef\beamer@framesubtitle{}%
+ \let\beamer@startcomment=\beamer@startcommentinframe%
+ % Start slide:
+ \beamer@framenotesbegin\@RTLtrue%
+ \global\setbox\beamer@framebox=\vbox\bgroup%
+ \beamer@inframetrue%
+ \let\frame=\framelatex% inside frames, use LaTeX's \frame command
+ \begin{beamer@framepauses}%
+ \ifbeamer@shrink%
+ \hsize=\beamer@shrinkfactorinv\hsize%
+ \textwidth=\beamer@shrinkfactorinv\textwidth%
+ \linewidth=\beamer@shrinkfactorinv\linewidth%
+ \fi%
+ % Insert labels if necessary:
+ \ifx\beamer@againname\@empty\else%
+ \nointerlineskip\vbox to0pt{\vss%
+ \label<\the\beamer@slideinframe>{\beamer@againname<\the\beamer@slideinframe>}%
+ \ifnum\beamer@slideinframe=1\relax%
+ \label<1>{\beamer@againname}%
+ \fi%
+ }\nointerlineskip%
+ \fi%
+ \ifx\beamer@framehypertargets\@empty\else%
+ \nointerlineskip\vbox to0pt{\vss%
+ \beamer@framehypertargets%
+ \global\let\beamer@framehypertargets\@empty%
+ }\nointerlineskip%
+ \fi%
+ \vskip-\parskip\vbox{}%
+ \beamer@initfirstlineunskip%
+ \ifbeamer@plainframe\nointerlineskip\fi%
+ \beamer@checkframetitle}%
+ {\end{beamer@framepauses}%
+ \egroup%
+ \ifx\beamer@frametitle\@empty%
+ \setbox\beamer@frametitlebox=\box\voidb@x%
+ \else%
+ \setbox\beamer@frametitlebox=\vbox{%
+ \vbox{}%
+ {\parskip0pt\usebeamertemplate***{frametitle}\vskip0.25em}%
+ }%
+ \fi%
+ \ifbeamer@plainframe%
+ \beamer@frametextheight=\paperheight%
+ \else%
+ \beamer@frametextheight=\textheight%
+ \fi%
+ \advance\beamer@frametextheight by-\ht\beamer@frametitlebox%
+ \advance\beamer@frametextheight by-\dp\beamer@frametitlebox%
+ \advance\beamer@frametextheight by-\beamer@frametopskip%
+ \ifbeamer@shrink%
+ \beamer@shrinkframebox%
+ \fi%
+ \ifx\beamer@zoomer\@empty
+ \setbox\beamer@framebox=\vbox{%
+ \nobreak\vbox{}\nobreak\par\nobreak\beamer@entrycode\nobreak%
+ \nointerlineskip\unvbox\beamer@frametitlebox%
+ \nobreak%
+ \ifbeamer@autobreak%
+ \vskip\beamer@frametopskipautobreak%
+ \else%
+ \vskip\beamer@frametopskip%
+ \fi%
+ \nobreak%
+ \nointerlineskip\box\beamer@zoombox\nointerlineskip%
+ \nobreak%
+ \ifbeamer@slidehaszoom\box\beamer@framebox\else\unvbox\beamer@framebox\fi%
+ % bottom skip is added in autobreakframebox
+ }%
+ \beamer@autobreakframebox%
+ \else%
+ \beamer@zoomer%
+ \fi%
+ \beamer@undolabels%
+ \beamer@framenotesend%
+ \box\beamer@framebox}
+\long\def\beamer@title[#1]#2{%
+ \def\inserttitle{\beginR#2\endR}%
+ \def\beamer@shorttitle{\beginR#1\endR}%
+ }
+\long\def\beamer@subtitle[#1]#2{%
+ \def\insertsubtitle{\beginR#2\endR}%
+ \def\beamer@shortsubtitle{\beginR#1\endR}%
+ }
+\long\def\beamer@date[#1]#2{%
+ \def\insertdate{\beginR#2\endR}%
+ \def\beamer@shortdate{\beginR#1\endR}%
+ }
+\long\def\beamer@author[#1]#2{%
+ \def\insertauthor{\def\inst{\beamer@insttitle}\def\and{\beamer@andtitle}\beginR#2\endR}%
+ \def\beamer@shortauthor{\beginR#1\endR}%
+ \ifbeamer@autopdfinfo%
+ \def\beamer@andstripped{}%
+ \beamer@stripands#2 \and\relax
+ {\let\inst=\@gobble\let\thanks=\@gobble\def\and{, }\hypersetup{pdfauthor={\beamer@andstripped}}}
+ \fi%
+}
+\long\def\beamer@institute[#1]#2{%
+ \def\beamer@temp{\beginR#2\endR}%
+ \ifx\beamer@temp\@empty
+ \def\insertinstitute{}
+ \else
+ \def\insertinstitute{\def\inst{\beamer@instinst}\def\and{\beamer@andinst}\beginR#2\endR}%
+ \fi
+ \def\beamer@shortinstitute{\beginR#1\endR}}
+\renewenvironment{thebibliography}[1]
+{%\leavevmode\unskip%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\beamer@biblabeltemplate{\@biblabel{#1}}}%
+ \leftmargin\labelwidth
+ \advance\leftmargin\labelsep
+ \itemsep=0pt%
+ \partopsep=0pt%
+ \topsep=0pt%
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}
+ \let\makelabel\beamer@biblabeltemplate}%
+ \sloppy\raggedleft
+ \clubpenalty10000
+ \@clubpenalty \clubpenalty
+ \widowpenalty10000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \ifhmode\unskip\fi\endlist}
+\long\def\beamer@@@section#1{\beamer@section[\beginR#1\endR]{#1}}
+\def\beamer@@@subsection#1{\beamer@subsection[\beginR#1\endR]{#1}}
+\def\beamer@@@subsubsection#1{\beamer@subsubsection[\beginR#1\endR]{#1}}
+\long\def\beamer@subsectionintoc#1#2#3#4#5#6{%
+ \ifnum\c@tocdepth>1%
+ \ifnum#5=\beamer@showpartnumber%
+ {
+ \beamer@saveanother%
+ \gdef\beamer@todo{}%
+ \beamer@slideinframe=#1\relax%
+ \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
+ \ifbeamer@pausesubsections\pause\fi%
+ \beamer@tempcount=#6%
+ \advance\beamer@tempcount by\beamer@sectionadjust%
+ \edef\inserttocsectionnumber{\the\beamer@tempcount}%
+ \def\inserttocsubsectionnumber{#2}%
+ \def\inserttocsubsection{\rightskip=1.5em\hyperlink{Navigation#4}{\beginR#3\endR\hfill}}%
+ \beamer@tocifnothide{\ifnum\c@section=#1\beamer@toc@oss\else\beamer@toc@ooss\fi}%
+ {%
+ \def\beamer@breakhere{\\}%
+ \beamer@tocact{\ifnum\c@section=#1\ifnum\c@subsection=#2\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
+ {subsection in toc}%
+ }%
+ }}%
+ \beamer@restoreanother%
+ }
+ \beamer@todo%
+ \fi\fi%
+}
+\long\def\beamer@subsubsectionintoc#1#2#3#4#5#6#7{%
+ \ifnum\c@tocdepth>2%
+ \ifnum#1=\beamer@showpartnumber%
+ {
+ \beamer@saveanother%
+ \gdef\beamer@todo{}%
+ \beamer@slideinframe=#2\relax%
+ \expandafter\only\beamer@tocsections{\gdef\beamer@todo{%
+ \ifbeamer@pausesubsections\pause\fi%
+ \beamer@tempcount=#6%
+ \advance\beamer@tempcount by\beamer@sectionadjust%
+ \edef\inserttocsectionnumber{\the\beamer@tempcount}%
+ \def\inserttocsubsectionnumber{#3}%
+ \def\inserttocsubsubsectionnumber{#4}%
+ \def\inserttocsubsubsection{\rightskip=3em\hyperlink{Navigation#5}{\beginR#7\endR\hfill}}%
+ \beamer@tocifnothide{\ifnum\c@section=#2\beamer@toc@oss\else\beamer@toc@ooss\fi}%
+ {%
+ \def\beamer@breakhere{\\}%
+ \beamer@tocact{\ifnum\c@section=#2\ifnum\c@subsection=#3\beamer@toc@css\else\beamer@toc@oss\fi\else\beamer@toc@ooss\fi}
+ {subsubsection in toc}%
+ }%
+ }}%
+ \beamer@restoreanother%
+ }
+ \beamer@todo%
+ \fi\fi%
+}
+\long\def\beamer@makecaption#1#2{%
+ \def\insertcaptionname{\csname#1name\endcsname}%
+ \def\insertcaptionnumber{\csname the#1\endcsname}%
+ \def\insertcaption{#2}%
+ \nobreak\vskip\abovecaptionskip\nobreak
+ \sbox\@tempboxa{\usebeamertemplate**{caption}}%
+ \ifdim \wd\@tempboxa >\hsize
+ \usebeamertemplate**{caption}\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil\if@RTL\endR\fi}%
+ \fi
+ \nobreak\vskip\belowcaptionskip\nobreak}
+\let\origin@alert=\alert
+\def\alert#1{\ifmmode\origin@alert{#1}\else\if@RTL\beginL\origin@alert{\beginR#1\endR}\endL\else\origin@alert{#1}\fi\fi}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidibeamer-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidibeamer.cls b/Master/texmf-dist/tex/xelatex/bidi/bidibeamer.cls
new file mode 100644
index 00000000000..3efdf50bd0f
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidibeamer.cls
@@ -0,0 +1,370 @@
+%%
+%% This is file `bidibeamer.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidibeamer.cls')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+
+\RequirePackage{beamerbasercs}
+\def\beamer@version{3.07}
+
+\RequirePackage{beamerbasemodes}
+
+\beamer@transferifnecessary
+
+\ifx\pdfoutput\@undefined \newcount\pdfoutput \fi
+\ifx\pdfoutput\relax \newcount\pdfoutput \fi
+
+
+\newdimen\headheight % Total height of the headline (including depth)
+\newdimen\headdp % Depth of the headline
+\newdimen\footheight % Height of the footline
+\newdimen\sidebarheight % Height of the sidebars
+
+\newdimen\beamer@tempdim
+\newdimen\beamer@finalheight
+\newdimen\beamer@animht
+\newdimen\beamer@animdp
+\newdimen\beamer@animwd
+\newdimen\beamer@leftmargin
+\newdimen\beamer@rightmargin
+\newdimen\beamer@leftsidebar
+\newdimen\beamer@rightsidebar
+\newdimen\beamer@boxsize
+\newdimen\beamer@vboxoffset
+\newdimen\beamer@descdefault
+\newdimen\beamer@descriptionwidth
+
+\newskip\beamer@lastskip
+
+\newbox\beamer@areabox
+\newbox\beamer@animcurrent
+\newbox\beamer@animshowbox
+\newbox\beamer@sectionbox
+\newbox\beamer@logobox
+\newbox\beamer@linebox
+
+\newcount\beamer@sectioncount
+\newcount\beamer@subsubsectionmax
+\newcount\beamer@subsectionmax
+\newcount\beamer@sectionmax
+\newcount\beamer@totalheads
+\newcount\beamer@headcounter
+\newcount\beamer@partstartpage
+\newcount\beamer@sectionstartpage
+\newcount\beamer@subsectionstartpage
+\newcount\beamer@animationtempa
+\newcount\beamer@animationtempb
+\newcount\beamer@xpos
+\newcount\beamer@ypos
+\newcount\beamer@showpartnumber
+\newcount\beamer@currentsubsection
+\newcount\beamer@coveringdepth
+\newcount\beamer@sectionadjust
+\newcount\beamer@tocsectionnumber
+
+\newif\ifbeamer@sansmath
+\newif\ifbeamer@altmode
+\newif\ifbeamer@notes
+\newif\ifbeamer@notesnormals
+\newif\ifbeamer@compress
+\newif\ifbeamer@centered
+\newif\ifbeamer@draftmode
+\newif\ifbeamer@suppressreplacements % decides whether fonts should be substituted
+\newif\ifbeamer@frameswithnotesonly
+\newif\ifbeamer@ignorenonframe
+\newif\ifbeamer@autopdfinfo
+
+\RequirePackage{beamerbaseoptions}
+
+
+\beamer@suppressreplacementsfalse
+\beamer@altmodefalse
+\beamer@notesfalse
+\beamer@notesnormalstrue
+\beamer@compressfalse
+\beamer@draftmodefalse
+\beamer@frameswithnotesonlyfalse
+\beamer@ignorenonframefalse
+\beamer@autopdfinfotrue
+
+\DeclareOptionBeamer{usepdftitle}[true]{\csname beamer@autopdfinfo#1\endcsname}
+\DeclareOptionBeamer{envcountsect}{\beamer@countsecttrue}
+\DeclareOptionBeamer{notheorems}{\beamer@blocksfalse}
+\DeclareOptionBeamer{noamsthm}{\beamer@blocksfalse\beamer@amsfalse}
+
+\DeclareOptionBeamer{compress}{\beamer@compresstrue}
+
+\DeclareOptionBeamer{t}{\beamer@centeredfalse}
+\DeclareOptionBeamer{c}{\beamer@centeredtrue}
+
+\DeclareOptionBeamer{leqno}{\input{leqno.clo}}
+\DeclareOptionBeamer{fleqn}{\input{fleqn.clo}}
+
+\def\beamer@currentmode{beamer}
+\DeclareOptionBeamer{handout}{\gdef\beamer@currentmode{handout}}
+\DeclareOptionBeamer{trans}{\gdef\beamer@currentmode{trans}}
+
+\DeclareOptionBeamer{pdftex}{}% Used by hyperref
+\DeclareOptionBeamer{nativepdf}{}% Used by hyperref
+\DeclareOptionBeamer{pdfmark}{}% Used by hyperref
+\DeclareOptionBeamer{dvips}{}% Used by hyperref
+\DeclareOptionBeamer{dviwindo}{}% Used by hyperref
+\DeclareOptionBeamer{dvipsone}{}% Used by hyperref
+\DeclareOptionBeamer{vtex}{}% Used by hyperref
+\DeclareOptionBeamer{ps2pdf}{}% Used by hyperref
+
+\DeclareOptionBeamer{ignorenonframetext}{\beamer@ignorenonframetrue}
+
+\def\beamer@size{{size11.clo}}
+\DeclareOptionBeamer{bigger}{\def\beamer@size{{size12.clo}}}
+\DeclareOptionBeamer{smaller}{\def\beamer@size{{size10.clo}}}
+
+\DeclareOptionBeamer{8pt}{\def\beamer@size{{size8.clo}}}
+\DeclareOptionBeamer{9pt}{\def\beamer@size{{size9.clo}}}
+\DeclareOptionBeamer{10pt}{\def\beamer@size{{size10.clo}}}
+\DeclareOptionBeamer{11pt}{\def\beamer@size{{size11.clo}}}
+\DeclareOptionBeamer{12pt}{\def\beamer@size{{size12.clo}}}
+\DeclareOptionBeamer{14pt}{\def\beamer@size{{size14.clo}}}
+\DeclareOptionBeamer{17pt}{\def\beamer@size{{size17.clo}}}
+\DeclareOptionBeamer{20pt}{\def\beamer@size{{size20.clo}}}
+
+\DeclareOptionBeamer{draft}{\beamer@draftmodetrue}
+\def\insertpagenumber{\thepage}
+
+\def\beamer@activecjk{}
+\def\beamer@hypercjk{}
+
+\DeclareOptionBeamer{CJK}{\ExecuteOptionsBeamer{cjk}}
+\DeclareOptionBeamer{cjk}{
+ \def\beamer@hypercjk{\hypersetup{CJKbookmarks=true}}
+
+ \def\beamer@activecjk{
+ % Activate all >=128 characters.
+ \count@=127
+ \@whilenum\count@<254 \do{%
+ \advance\count@ by 1
+ \lccode`\~=\count@
+ \catcode\count@=\active
+ \lowercase{\def~{\kern1ex}}
+ }
+ }
+}
+
+\DeclareOptionBeamer{notes}[show]{\csname beamer@notesaction@#1\endcsname}
+\def\beamer@notesaction@hide{%
+ \ClassWarning{beamer}{This option is obsolete. Use beamer option
+ ``hide notes'' instead.}%
+ \beamer@notesfalse}
+\def\beamer@notesaction@show{%
+ \ClassWarning{beamer}{This option is obsolete. Use beamer option
+ ``show notes'' instead.}%
+ \beamer@notestrue}
+\def\beamer@notesaction@only{%
+ \ClassWarning{beamer}{This option is obsolete. Use beamer option
+ ``show only notes'' instead.}%
+ \beamer@notestrue
+ \beamer@notesnormalsfalse
+ \nofiles
+}
+\def\beamer@notesaction@onlyslideswithnotes{%
+ \beamer@notestrue%
+ \beamer@frameswithnotesonlytrue%
+ \nofiles
+}
+\DeclareOptionBeamer{inrow}{
+ \ClassError{beamer}{``inrow'' no longer supported. Use ``compress'' instead.}{}}
+\DeclareOptionBeamer{compressnotes}{%
+ \ClassWarning{beamer}{``compressnotes'' is obsolete. Use
+ \noexpand\setbeamertemplate{note page}[compressed] instead}
+ \AtBeginDocument{\beamertemplatenotecompress}}
+\DeclareOptionBeamer{notesonly}{
+ \ClassWarning{beamer}{``notesonly'' is obsolete. Use beamer option
+ ``show only notes'' instead.}
+ \beamer@notesaction@only}
+\DeclareOptionBeamer{blue}{
+ \ClassWarning{beamer}{``blue'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.2,0.2,0.7}]{structure}}}
+\DeclareOptionBeamer{red}{
+ \ClassWarning{beamer}{``red'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.7,0.2,0.2}]{structure}}}
+\DeclareOptionBeamer{blackandwhite}{
+ \ClassWarning{beamer}{``blackandwhite'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.2,0.2,0.2}]{structure}}}
+\DeclareOptionBeamer{brown}{
+ \ClassWarning{beamer}{``brown'' is obsolete. Use color theme structure instead}
+ \def\beamer@loadlater{\usecolortheme[rgb={0.66,0.4,0.166}]{structure}}}
+\DeclareOptionBeamer{slidescentered}{
+ \ClassWarning{beamer}{``slidescentered'' is obsolete. Use ``c'' instead}
+ \beamer@centeredtrue}
+\DeclareOptionBeamer{slidestop}{
+ \ClassWarning{beamer}{``slidestop'' is obsolete. Use ``t'' instead}
+ \beamer@centeredfalse}
+\DeclareOptionBeamer{sans}{%
+ \ClassWarning{beamer}{``sans'' is obsolete. Just remove this option}
+ \def\familydefault{\sfdefault}
+ \def\mathfamilydefault{\sfdefault}
+ \beamer@sansmathtrue
+}
+\DeclareOptionBeamer{serif}{%
+ \ClassWarning{beamer}{``serif'' is obsolete. Use font theme ``serif'' instead}
+ \def\familydefault{\rmdefault}
+ \def\mathfamilydefault{\rmdefault}
+ \beamer@sansmathfalse
+}
+\DeclareOptionBeamer{mathsans}{
+ \ClassWarning{beamer}{``mathsans'' is obsolete. Use font theme ``serif'' with option ``butsansserifmath''}
+ \def\mathfamilydefault{\sfdefault}\beamer@sansmathtrue}
+\DeclareOptionBeamer{mathserif}{
+ \ClassWarning{beamer}{``mathserif'' is obsolete. Use font theme ``serif'' with option ``onlymath''}
+ \def\mathfamilydefault{\rmdefault}\beamer@sansmathfalse}
+\DeclareOptionBeamer{professionalfont}{
+ \ClassWarning{beamer}{``professionalfont'' is obsolete. Use font theme ``professionalfonts'' instead}
+ \beamer@suppressreplacementstrue}
+
+\def\familydefault{\rmdefault}
+\def\mathfamilydefault{\sfdefault}
+\beamer@sansmathtrue
+
+\PassOptionsToPackage{bookmarks=true,%
+ bookmarksopen=true,%
+ pdfborder={0 0 0},%
+ pdfhighlight={/N},%
+ linkbordercolor={.5 .5 .5}}{hyperref}
+
+\DeclareOptionBeamer{pgf}{\PassOptionsToPackage{#1}{pgf}}
+\DeclareOptionBeamer{hyperref}{\PassOptionsToPackage{#1}{hyperref}}
+\DeclareOptionBeamer{color}{\PassOptionsToPackage{#1}{color}}
+\DeclareOptionBeamer{xcolor}{\PassOptionsToPackage{#1}{xcolor}}
+
+\def\beamer@loaducs{}
+
+\DeclareOptionBeamer{ucs}{%
+ \ifcase\pdfoutput
+ \def\beamer@loaducs{
+ \RequirePackage{ucs}%
+ \AtBeginDocument{\PreloadUnicodePage{0}}%
+ \AtBeginDocument{\PreloadUnicodePage{1}}%
+ }
+ \or
+ \PassOptionsToPackage{pdftex,unicode}{hyperref}
+ \def\beamer@loaducs{
+ \RequirePackage[hyperref]{ucs}%
+ \AtBeginDocument{\PreloadUnicodePage{0}}%
+ \AtBeginDocument{\PreloadUnicodePage{1}}%
+ }
+ \fi
+}
+\DeclareOptionBeamer{utf8}{\ExecuteOptionsBeamer{ucs}%
+ \g@addto@macro\beamer@loaducs{\RequirePackage[utf8]{inputenc}}%
+}
+
+
+\ExecuteOptionsBeamer{c}
+\ProcessOptionsBeamer
+
+\beamer@filterclassoptions
+
+\RequirePackage{pgfcore,pgfbaseimage}
+
+\RequirePackage{xxcolor}
+
+\RequirePackage{amssymb}
+
+\RequirePackage[%
+ papersize={12.80cm,9.60cm},
+ hmargin=1cm,%
+ vmargin=0cm,%
+ head=0.5cm,% will be changed later
+ headsep=0pt,%
+ foot=0.5cm% will be changed later
+ ]{geometry}
+
+\RequirePackage[implicit=false]{hyperref}
+
+\hypersetup{pdfcreator={LaTeX with beamer class version \beamer@version}}
+
+\beamer@loaducs
+\beamer@hypercjk
+
+\expandafter\input\beamer@size
+\geometry{headsep=0pt}
+
+\RequirePackage{beamerbasecompatibility}
+
+\RequirePackage{beamerbasefont}
+
+\normalfont
+\raggedleft
+
+\AtBeginDocument
+{
+ \addtocontents{toc}{\protect\beamer@endinputifotherversion{\beamer@version pt}}
+ \addtocontents{nav}{\protect\beamer@endinputifotherversion{\beamer@version pt}}
+}
+
+\RequirePackage{beamerbasemisc}
+
+\RequirePackage{beamerbasetwoscreens}
+
+\RequirePackage{beamerbaseoverlay}
+
+\RequirePackage{beamerbasetitle}
+
+\RequirePackage{beamerbasesection}
+
+\RequirePackage{beamerbaseframe}
+
+\RequirePackage{beamerbaseverbatim}
+
+\RequirePackage{beamerbaseframesize}
+
+\RequirePackage{beamerbaseframecomponents}
+
+\RequirePackage{beamerbasecolor}
+
+\RequirePackage{beamerbasenotes}
+
+\RequirePackage{beamerbasetoc}
+
+\RequirePackage{bidibeamerbasetemplates}
+
+\RequirePackage{beamerbaselocalstructure}
+
+\RequirePackage{beamerbasenavigation}
+
+\RequirePackage{beamerbasetheorems}
+
+\RequirePackage{beamerbasethemes}
+
+\usetheme{default}
+
+\csname beamer@loadlater\endcsname
+
+%%% Local Variables:
+%%% mode: latex
+%%% TeX-master: "~/texmf/tex/latex/beamer/examples/beamerexample1.tex"
+%%% End:
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidibeamer.cls'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidibeamerbaseauxtemplates.sty b/Master/texmf-dist/tex/xelatex/bidi/bidibeamerbaseauxtemplates.sty
new file mode 100644
index 00000000000..d6129057d6a
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidibeamerbaseauxtemplates.sty
@@ -0,0 +1,693 @@
+%%
+%% This is file `bidibeamerbaseauxtemplates.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidibeamerbaseauxtemplates.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+
+\mode<presentation>
+
+\RequirePackage{beamerbaseboxes}
+
+
+\normalsize
+\pgfdeclareradialshading[bg,parent.bg]{tocsphere}{\pgfpoint{-0.5ex}{0.6ex}}%
+{%
+ color(0cm)=(bg!35!white);
+ color(0.44ex)=(bg!75!white);
+ color(0.88ex)=(bg!70!black!90!parent.bg);
+ color(1.2ex)=(bg!50!black!90!parent.bg);
+ color(1.3ex)=(parent.bg)}
+
+\pgfdeclareradialshading[bg,parent.bg]{bigsphere}{\pgfpoint{-0.1849315ex}{.2260273ex}}%
+{%
+ color(0cm)=(bg!15);
+ color(0.1643835ex)=(bg!75);
+ color(0.3287671ex)=(bg!70!black);
+ color(0.4520547ex)=(bg!50!black);
+ color(0.53ex)=(parent.bg)}
+
+\pgfdeclareradialshading[bg,parent.bg]{smallsphere}{\pgfpoint{-0.1479452ex}{0.18287671ex}}%
+{%
+ color(0cm)=(bg!15);
+ color(0.1315068ex)=(bg!75);
+ color(0.2630136ex)=(bg!70!black);
+ color(0.36164383ex)=(bg!50!black);
+ color(0.427ex)=(parent.bg)}
+
+\def\beamer@usesphere#1#2{%
+ \hbox{\usebeamercolor{#1}\normalsize\pgfuseshading{#2}}}
+
+
+\define@key{beamer@backgroundgrid}{step}{\def\beamer@bggw{#1}}
+\define@key{beamer@backgroundgrid}{color}{\def\beamer@bggc{\color{#1}}}
+
+\defbeamertemplate{background}{grid}[1][]
+{%
+ \setkeys{beamer@backgroundgrid}{step=0.5cm,color=fg!10!bg}%
+ \setkeys{beamer@backgroundgrid}{#1}%
+ \begin{pgfpicture}{0cm}{0cm}{\the\paperwidth}{\the\paperheight}
+ \beamer@bggc
+ \pgfpathgrid[stepx=\beamer@bggw,stepy=\beamer@bggw]{\pgfpointorigin}{\pgfpoint{\the\paperwidth}{\the\paperheight}}
+ \pgfusepath{stroke}
+ \end{pgfpicture}%
+}
+
+\define@key{beamer@backgroundshade}{top}{\def\beamer@bgst{#1}}
+\define@key{beamer@backgroundshade}{bottom}{\def\beamer@bgsb{#1}}
+\define@key{beamer@backgroundshade}{right}{\def\beamer@bgst{#1}}
+\define@key{beamer@backgroundshade}{left}{\def\beamer@bgsb{#1}}
+\define@key{beamer@backgroundshade}{middle}{\def\beamer@bgsm{#1}}
+\define@key{beamer@backgroundshade}{midpoint}{\def\beamer@bgsmp{#1}}
+
+\def\beamer@calcvertshading#1#2#3{%
+ {\usebeamercolor{palette primary}}
+ \usebeamercolor{normal text}
+ \setkeys{beamer@backgroundshade}{top=palette primary.bg!25!bg,bottom=bg,middle={},midpoint=0.5}%
+ \setkeys{beamer@backgroundshade}{#3}
+ \ifx\beamer@bgsm\@empty
+ \pgfdeclareverticalshading{#1}{#2}%
+ {color(0cm)=(\beamer@bgsb); color(\the\paperheight)=(\beamer@bgst)}
+ \colorlet{beamer@backgroundshadestart}{\beamer@bgsb}%
+ \colorlet{beamer@backgroundshadeend}{\beamer@bgst}%
+ \colorlet{beamer@average}{beamer@backgroundshadestart!50!beamer@backgroundshadeend}%
+ \else
+ \pgfdeclareverticalshading{#1}{#2}%
+ {color(0cm)=(\beamer@bgsb); color(\beamer@bgsmp\paperheight)=(\beamer@bgsm); color(\the\paperheight)=(\beamer@bgst)}
+ \colorlet{beamer@average}{\beamer@bgsm}
+ \fi%
+}
+
+\def\beamer@calchorishading#1#2#3{%
+ {\usebeamercolor{palette primary}}
+ \usebeamercolor{normal text}
+ \setkeys{beamer@backgroundshade}{left=palette primary.bg!25!bg,right=bg,middle={},midpoint=0.5}%
+ \setkeys{beamer@backgroundshade}{#3}
+ \ifx\beamer@bgsm\@empty
+ \pgfdeclarehorizontalshading{#1}{\the\paperheight}%
+ {color(0cm)=(\beamer@bgsb); color(#2)=(\beamer@bgst)}
+ \colorlet{beamer@backgroundshadestart}{\beamer@bgsb}%
+ \colorlet{beamer@backgroundshadeend}{\beamer@bgst}%
+ \colorlet{beamer@average}{beamer@backgroundshadestart!50!beamer@backgroundshadeend}%
+ \else
+ \pgfdeclarehorizontalshading{#1}{\the\paperheight}%
+ {color(0cm)=(\beamer@bgsb); color(\beamer@bgsmp#2)=(\beamer@bgsm); color(#2)=(\beamer@bgst)}
+ \colorlet{beamer@average}{\beamer@bgsm}
+ \fi%
+}
+
+\defbeamertemplate{background canvas}{vertical shading}[1][]
+{%
+ \pgfuseshading{beamer@backgroundshading}%
+}
+[action]
+{
+ \beamer@calcvertshading{beamer@backgroundshading}{\the\paperwidth}{#1}
+ \colorlet{beamer@@average}{beamer@average}
+ \setbeamercolor{normal text}{bg=beamer@@average}
+}
+
+
+\defbeamertemplate{sidebar canvas left}{vertical shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasleftshading}%
+}
+[action]
+{
+ \beamer@calcvertshading{beamer@sidebarcanvasleftshading}{\the\beamer@leftsidebar}{#1}
+}
+
+\defbeamertemplate{sidebar canvas right}{vertical shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasrightshading}%
+}
+[action]
+{
+ \beamer@calcvertshading{beamer@sidebarcanvasrightshading}{\the\beamer@rightsidebar}{#1}
+}
+
+\defbeamertemplate{sidebar canvas left}{horizontal shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasleftshading}%
+}
+[action]
+{
+ \beamer@calchorishading{beamer@sidebarcanvasleftshading}{\beamer@leftsidebar}{#1}
+}
+
+\defbeamertemplate{sidebar canvas right}{horizontal shading}[1][]
+{%
+ \pgfuseshading{beamer@sidebarcanvasrightshading}%
+}
+[action]
+{
+ \beamer@calchorishading{beamer@sidebarcanvasrightshading}{\beamer@rightsidebar}{#1}
+}
+
+
+\defbeamertemplate{section in toc}{sections numbered}
+{\leavevmode\inserttocsectionnumber\@SepMark \inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{sections numbered}
+{\leavevmode\if@RTL\rightskip=2.5em\else\leftskip=2.5em\fi\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{sections numbered}
+{\leavevmode\normalsize\usebeamerfont{subsection in toc}\if@RTL\rightskip=3.5em\else\leftskip=3.5em\fi\usebeamerfont{subsubsection in toc}%
+ \inserttocsubsubsection\par}
+
+
+\defbeamertemplate{section in toc}{subsections numbered}
+{\leavevmode\if@RTL\rightskip=2em\else\leftskip=2em\fi\inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{subsections numbered}
+{\leavevmode\if@RTL\rightskip=2em\else\leftskip=2em\fi\rlap{\hskip-2em\inserttocsectionnumber\@SepMark\inserttocsubsectionnumber}\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{subsections numbered}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=3em\else\leftskip=3em\fi\usebeamerfont{subsubsection in toc}%
+ \inserttocsubsubsection\par}
+
+
+\defbeamertemplate{section in toc}{circle}
+{\leavevmode\if@RTL\rightskip=2ex\else\leftskip=2ex\fi%
+ \llap{%
+ \usebeamerfont*{section number projected}%
+ \usebeamercolor{section number projected}%
+ \beginL\begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \color{bg}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\inserttocsectionnumber}
+ \end{pgfpicture}\endL\kern1.25ex%
+ }%
+ \inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{circle}
+{\leavevmode\if@RTL\rightskip=2em\else\leftskip=2em\fi\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{circle}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=3em\else\leftskip=3em\fi\usebeamerfont{subsubsection in toc}%
+ \inserttocsubsubsection\par}
+
+
+\defbeamertemplate{section in toc}{square}
+{\leavevmode\if@RTL\rightskip=1.75ex\else\leftskip=1.75ex\fi%
+ \llap{%
+ \usebeamerfont*{section number projected}%
+ \usebeamercolor[bg]{section number projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{\hfil\color{fg}\inserttocsectionnumber\hfil}}%
+ \kern1.25ex\inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{square}
+{\leavevmode\if@RTL\rightskip=5ex\else\leftskip=5ex\fi\llap{%
+ \usebeamercolor[bg]{subsection number projected}%
+ \vrule width1ex height1ex\kern1ex}\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{square}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=7ex\else\leftskip=7ex\fi\usebeamerfont{subsubsection in toc}%
+ \llap{%
+ \usebeamercolor[bg]{subsubsection number projected}%
+ \vrule width0.75ex height0.75ex\kern1ex}\inserttocsubsubsection\par}
+
+
+\defbeamertemplate{section in toc}{ball unnumbered}
+{\leavevmode\raise0.1ex\beamer@usesphere{section number projected}{bigsphere}\kern1.25ex\inserttocsection\par}
+
+\defbeamertemplate{subsection in toc}{ball unnumbered}
+{\leavevmode\if@RTL\rightskip=1.5em\else\leftskip=1.5em\fi\raise0.2ex\beamer@usesphere{subsection number projected}{smallsphere}%
+ \kern1ex\inserttocsubsection\par}
+
+\defbeamertemplate{subsubsection in toc}{ball unnumbered}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=3em\else\leftskip=3em\fi\usebeamerfont{subsubsection in toc}%
+ \beamer@usesphere{subsubsection number projected}{smallsphere}%
+ \kern0.75ex\inserttocsubsubsection\par}
+
+
+\defbeamertemplate{section in toc}{ball}
+{\leavevmode\if@RTL\rightskip=2.75ex\else\leftskip=2.75ex\fi%
+ \llap{%
+ \normalsize%
+ \beginL\begin{pgfpicture}{-1ex}{-0.7ex}{1ex}{1ex}
+ \pgftext{\beamer@usesphere{section number projected}{tocsphere}}
+ \pgftext{%
+ \usebeamerfont*{section number projected}%
+ \usebeamercolor{section number projected}%
+ \color{fg!90!bg}%
+ \inserttocsectionnumber}
+ \end{pgfpicture}\endL%
+ \kern1.25ex}%
+ \inserttocsection\par
+}
+[action]
+{\setbeamerfont{section number projected}{size=\scriptsize}}
+
+\defbeamertemplate{subsection in toc}{ball}
+{\leavevmode\if@RTL\rightskip=5ex\else\leftskip=5ex\fi%
+ \llap{\raise0.1ex\beamer@usesphere{subsection number projected}{bigsphere}\kern1ex}%
+ \inserttocsubsection\par%
+}
+
+\defbeamertemplate{subsubsection in toc}{ball}
+{\leavevmode\normalsize\usebeamerfont{subsection in
+ toc}\if@RTL\rightskip=7ex\else\leftskip=7ex\fi\usebeamerfont{subsubsection in toc}%
+ \llap{\beamer@usesphere{subsubsection number projected}{bigsphere}\kern0.75ex}%
+ \inserttocsubsubsection\par%
+}
+
+
+\defbeamertemplatealias{itemize item}{triangle}{default}
+\defbeamertemplatealias{itemize subitem}{triangle}{default}
+\defbeamertemplatealias{itemize subsubitem}{triangle}{default}
+
+
+\defbeamertemplate{itemize item}{circle}{\small\raise0.5pt\hbox{\textbullet}}
+\defbeamertemplate{itemize subitem}{circle}{\footnotesize\raise0.5pt\hbox{\textbullet}}
+\defbeamertemplate{itemize subsubitem}{circle}{\footnotesize\raise0.5pt\hbox{\textbullet}}
+
+
+\defbeamertemplate{itemize item}{square}{\hbox{\vrule width 1ex height 1ex}}
+\defbeamertemplate{itemize subitem}{square}{\small\hbox{\vrule width 1ex height 1ex}}
+\defbeamertemplate{itemize subsubitem}{square}{\small\hbox{\vrule width 1ex height 1ex}}
+
+
+\defbeamertemplate{itemize item}{ball}{\raise0.2pt\beamer@usesphere{item projected}{bigsphere}}
+\defbeamertemplate{itemize subitem}{ball}{\raise0.2pt\beamer@usesphere{subitem projected}{smallsphere}}
+\defbeamertemplate{itemize subsubitem}{ball}{\raise0.2pt\beamer@usesphere{subsubitem projected}{smallsphere}}
+
+
+\defbeamertemplate{enumerate item}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
+ \usebeamercolor[fg]{item projected}
+ {\pgftransformscale{1.75}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}
+ \pgftext{\usebeamerfont*{item projected}\insertenumlabel}}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate subitem}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.55ex}{1ex}{1ex}
+ \usebeamercolor[fg]{subitem projected}
+ {\pgftransformscale{1.4}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ \pgftext{%
+ \usebeamerfont*{subitem projected}%
+ \insertsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate subsubitem}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.55ex}{1ex}{1ex}
+ \usebeamercolor[fg]{subsubitem projected}
+ {\pgftransformscale{1.4}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ \pgftext{%
+ \usebeamerfont*{subitem projected}%
+ \insertsubsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate mini template}{ball}
+{\beginL
+ \begin{pgfpicture}{-1ex}{-0.65ex}{1ex}{1ex}
+ \usebeamercolor[fg]{\beameritemnestingprefix item projected}
+ {\pgftransformscale{1.75}\pgftext{\normalsize\pgfuseshading{bigsphere}}}
+ {\pgftransformshift{\pgfpoint{0pt}{0.5pt}}%
+ \usebeamerfont*{\beameritemnestingprefix item projected}%
+ \pgftext{\insertenumlabel}}
+ \end{pgfpicture}
+\endL}
+
+
+\defbeamertemplate{enumerate item}{square}
+{
+ \hbox{%
+ \usebeamerfont*{item projected}%
+ \usebeamercolor[bg]{item projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertenumlabel%
+ \hfil}%
+ }%
+}
+[action]
+{\setbeamerfont{item projected}{size=\scriptsize}}
+
+\defbeamertemplate{enumerate subitem}{square}
+{
+ \hbox{%
+ \usebeamerfont*{subitem projected}%
+ \usebeamercolor[bg]{subitem projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertsubenumlabel%
+ \hfil}%
+ }%
+}
+
+\defbeamertemplate{enumerate subsubitem}{square}
+{
+ \hbox{%
+ \usebeamerfont*{subitem projected}%
+ \usebeamercolor[bg]{subsubitem projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertsubsubenumlabel%
+ \hfil}%
+ }%
+}
+
+\defbeamertemplate{enumerate mini template}{square}
+{
+ \hbox{%
+ \usebeamerfont*{\beameritemnestingprefix item projected}%
+ \usebeamercolor[bg]{\beameritemnestingprefix item projected}%
+ \vrule width2.25ex height1.85ex depth.4ex%
+ \hskip-2.25ex%
+ \hbox to2.25ex{%
+ \hfil%
+ \color{fg}\insertenumlabel%
+ \hfil}%
+ }%
+}
+
+
+\defbeamertemplate{enumerate item}{circle}
+{\beginL
+ \usebeamerfont*{item projected}%
+ \usebeamercolor[bg]{item projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertenumlabel}
+ \end{pgfpicture}%
+\endL}
+[action]
+{\setbeamerfont{item projected}{size=\scriptsize}}
+
+\defbeamertemplate{enumerate subitem}{circle}
+{\beginL
+ \usebeamerfont*{subitem projected}%
+ \usebeamercolor[bg]{subitem projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate subsubitem}{circle}
+{\beginL
+ \usebeamerfont*{subsubitem projected}%
+ \usebeamercolor[bg]{subsubitem projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertsubsubenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+\defbeamertemplate{enumerate mini template}{circle}
+{\beginL
+ \usebeamerfont*{\beameritemnestingprefix item projected}%
+ \usebeamercolor[bg]{\beameritemnestingprefix item projected}%
+ \begin{pgfpicture}{-1ex}{0ex}{1ex}{2ex}
+ \pgfpathcircle{\pgfpoint{0pt}{.75ex}}{1.2ex}
+ \pgfusepath{fill}
+ \pgftext[base]{\color{fg}\insertenumlabel}
+ \end{pgfpicture}%
+\endL}
+
+
+\defbeamertemplatealias{frametitle continuation}{roman}{default}
+
+\defbeamertemplate{frametitle continuation}{from second}[1][\insertcontinuationtext]
+{\expandafter\ifnum\insertcontinuationcount>1\relax#1\fi}
+
+
+\defbeamertemplatealias{bibliography item}{article}{default}
+
+\defbeamertemplate{bibliography item}{book}
+{\lower2pt\hbox{\pgfuseimage{beamericonbook}}}
+
+\defbeamertemplate{bibliography item}{text}
+{\insertbiblabel}
+
+\defbeamertemplate{bibliography item}{triangle}
+{\scriptsize\raise1.25pt\hbox{\donotcoloroutermaths$\if@RTL\blacktriangleleft\else\blacktriangleright\fi$}}
+
+
+\defbeamertemplate{headline}{text line}[1]
+{\hskip\Gm@lmargin\hbox to\@tempdima{\textwidth=\@tempdima\hsize=\textwidth\relax#1\hfil}\hskip\Gm@rmargin}
+
+
+\defbeamertemplate{footline}{text line}[1]
+{\hskip\Gm@lmargin\hbox to\@tempdima{\textwidth=\@tempdima\hsize=\textwidth\relax#1\hfil}\hskip\Gm@rmargin}
+
+\defbeamertemplate{footline}{page number}
+{%
+ \hfill%
+ \usebeamercolor[fg]{page number in head/foot}%
+ \usebeamerfont{page number in head/foot}%
+ \insertpagenumber\,/\,\insertpresentationendpage\kern1em\vskip2pt%
+}
+
+\defbeamertemplate{footline}{frame number}
+{
+ \hfill%
+ \usebeamercolor[fg]{page number in head/foot}%
+ \usebeamerfont{page number in head/foot}%
+ \insertframenumber\,/\,\inserttotalframenumber\kern1em\vskip2pt%
+}
+
+
+\defbeamertemplate{mini frame}{box}
+{%
+ \begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}{\the\beamer@boxsize}}
+ \pgfusepath{fill,stroke}
+ \end{pgfpicture}%
+}
+[action]
+{
+ \setbeamersize{mini frame size=.1cm,mini frame offset=.05cm}
+}
+
+\defbeamertemplate{mini frame in current subsection}{box}
+{%
+ \begin{pgfpicture}{0pt}{0pt}{.1cm}{.1cm}
+ \pgfpathrectangle{\pgfpointorigin}{\pgfpoint{\the\beamer@boxsize}{\the\beamer@boxsize}}
+ \pgfusepath{stroke}
+ \end{pgfpicture}%
+}
+
+\defbeamertemplate{mini frame}{tick}
+{%
+ \hskip-0.4pt\vrule height\beamer@boxsize width1.2pt%
+}
+[action]
+{
+ \setbeamersize{mini frame size=.1cm,mini frame offset=.05cm}
+}
+
+\defbeamertemplate{mini frame in current subsection}{tick}
+{%
+ \vrule height\beamer@boxsize width0.4pt%
+}
+
+
+\defbeamertemplate{caption}{numbered}
+{%
+ \raggedright
+ {%
+ \usebeamercolor[fg]{caption name}%
+ \usebeamerfont*{caption name}%
+ \insertcaptionname~\insertcaptionnumber:%
+ }
+ \insertcaption\par
+}
+
+\defbeamertemplate{caption}{caption name own line}
+{%
+ \begin{minipage}{\textwidth}
+ \raggedright
+ {%
+ \usebeamercolor[fg]{caption name}%
+ \usebeamerfont*{caption name}%
+ \insertcaptionname%
+ }\\
+ \insertcaption
+ \end{minipage}
+}
+
+
+\newdimen\beamer@blockheadheight%
+
+\defbeamertemplate{navigation symbols}{only frame symbol}
+{\insertframenavigationsymbol}
+
+\defbeamertemplate{navigation symbols}{vertical}
+{%
+ \vbox{%
+ \hbox{\insertslidenavigationsymbol}
+ \hbox{\insertframenavigationsymbol}
+ \hbox{\insertsubsectionnavigationsymbol}
+ \hbox{\insertsectionnavigationsymbol}
+ \hbox{\insertdocnavigationsymbol}
+ \hbox{\insertbackfindforwardnavigationsymbol}}%
+}
+
+\defbeamertemplatealias{navigation symbols}{horizontal}{default}
+
+
+\defbeamertemplateparent{blocks}[rounded]{block begin,block end,%
+ block alerted begin,block alerted end,%
+ block example begin,block example end}[1][]
+{[#1]}
+
+\defbeamertemplate{block begin}{rounded}[1][shadow=false]
+{
+ \par\vskip\medskipamount%
+ \begin{beamerboxesrounded}[upper=block title,lower=block body,#1]%
+ {\raggedright\usebeamerfont*{block title}\insertblocktitle}%
+ \raggedright%
+ \usebeamerfont{block body}%
+}
+\defbeamertemplate{block end}{rounded}[1][]
+{\end{beamerboxesrounded}\vskip\smallskipamount}
+
+\defbeamertemplate{block alerted begin}{rounded}[1][shadow=false]
+{
+ \par\vskip\medskipamount%
+ \begin{beamerboxesrounded}[upper=block title alerted,lower=block body alerted,#1]%
+ {\raggedright\usebeamerfont*{block title alerted}\insertblocktitle}%
+ \raggedright%
+ \usebeamerfont{block body alerted}%
+}%
+\defbeamertemplate{block alerted end}{rounded}[1][]
+{\end{beamerboxesrounded}\vskip\smallskipamount}
+
+\defbeamertemplate{block example begin}{rounded}[1][shadow=false]
+{
+ \par\vskip\medskipamount%
+ \begin{beamerboxesrounded}[upper=block title example,lower=block body example,#1]
+ {\raggedright\usebeamerfont*{block title example}\insertblocktitle}%
+ \raggedright%
+ \usebeamerfont{block body alerted}%
+}%
+\defbeamertemplate{block example end}{rounded}[1][]
+{\end{beamerboxesrounded}\vskip\smallskipamount}
+
+
+\defbeamertemplate{note page}{plain}
+{\insertnote}
+
+\defbeamertemplate{note page}{compressed}
+{%
+ {%
+ \tiny
+ \let\\=\relax%
+ \insertvrule{0.125\paperheight}{white!90!black}%
+ \vskip-0.125\paperheight
+ \nointerlineskip
+ \vbox{\hfill\insertslideintonotes{0.125}\hskip-\Gm@rmargin\hskip0pt%
+ \vskip-0.125\paperheight\nointerlineskip}%
+ \nointerlineskip
+ \vbox to .125\paperheight{
+ \setbox\beamer@tempbox=\hbox{\hbox{\insertsection}}%
+ \ht\beamer@tempbox=1em
+ \box\beamer@tempbox
+ \nointerlineskip
+ \setbox\beamer@tempbox=\hbox{\hbox{\quad\insertsubsection}}%
+ \ht\beamer@tempbox=1em
+ \box\beamer@tempbox
+ \nointerlineskip
+ \setbox\beamer@tempbox=\hbox{\hbox{\quad\quad\insertshortframetitle}}%
+ \ht\beamer@tempbox=1em
+ \box\beamer@tempbox
+ \vfil
+ }\vskip0.5em
+ }
+ \nointerlineskip
+ \insertnote
+}
+
+
+\defbeamertemplate{theorem begin}{ams style}
+{%
+ \begin{\inserttheoremblockenv}
+ {%
+ \inserttheoremheadfont
+ \inserttheoremname
+ \inserttheoremnumber
+ \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+ \inserttheorempunctuation
+ }%
+}
+
+\defbeamertemplate{theorem end}{ams style}
+{\end{\inserttheoremblockenv}}
+
+\defbeamertemplate{theorem begin}{numbered}
+{%
+ \begin{\inserttheoremblockenv}
+ {%
+ \inserttheoremname
+ \inserttheoremnumber
+ \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+ }%
+}
+
+\defbeamertemplate{theorem end}{numbered}
+{\end{\inserttheoremblockenv}}
+
+\defbeamertemplate{theorem begin}{normal font}
+{
+ \normalfont
+ \begin{\inserttheoremblockenv}
+ {%
+ \inserttheoremname
+ \ifx\inserttheoremaddition\@empty\else\ (\inserttheoremaddition)\fi%
+ }%
+}
+
+\defbeamertemplate{theorem end}{normal font}
+{\end{\inserttheoremblockenv}}
+
+\mode
+<all>
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidibeamerbaseauxtemplates.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidibeamerbasetemplates.sty b/Master/texmf-dist/tex/xelatex/bidi/bidibeamerbasetemplates.sty
new file mode 100644
index 00000000000..457ab099d4b
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidibeamerbasetemplates.sty
@@ -0,0 +1,139 @@
+%%
+%% This is file `bidibeamerbasetemplates.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidibeamerbasetemplates.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+
+
+\def\usebeamertemplate{\@ifstar{\beamer@usebeamertemplates}{\beamer@usebeamertemplatedo}}
+\def\beamer@usebeamertemplates{\@ifstar{\beamer@usebeamertemplatess}{\beamer@usebeamertemplatedos}}
+\def\beamer@usebeamertemplatess{\@ifstar{\beamer@usebeamertemplatedosss}{\beamer@usebeamertemplatedoss}}
+\def\beamer@usebeamertemplatedo#1{\csname beamer@@tmpl@#1\endcsname}
+\def\beamer@usebeamertemplatedos#1{{{\usebeamerfont{#1}\usebeamercolor[fg]{#1}\csname beamer@@tmpl@#1\endcsname}}}
+\def\beamer@usebeamertemplatedoss#1{{{\usebeamerfont*{#1}\usebeamercolor[fg]{#1}\csname beamer@@tmpl@#1\endcsname}}}
+\def\beamer@usebeamertemplatedosss#1{{{\usebeamerfont*{#1}\usebeamercolor*[fg]{#1}\csname beamer@@tmpl@#1\endcsname}}}
+
+\long\def\beamer@@empty{}
+\def\expandbeamertemplate#1{\csname beamer@@tmpl@#1\endcsname}
+\def\ifbeamertemplateempty#1#2#3{%
+ \def\beamer@ifdo{#3}%
+ \expandafter\ifx\csname beamer@@tmpl@#1\endcsname\relax\def\beamer@ifdo{#2}\fi%
+ \expandafter\ifx\csname beamer@@tmpl@#1\endcsname\beamer@@empty\def\beamer@ifdo{#2}\fi%
+ \beamer@ifdo}
+
+\mode<article>
+{
+ % the following do the same in article mode:
+ \let\beamer@usebeamertemplatedosss=\beamer@usebeamertemplatedo
+ \let\beamer@usebeamertemplatedoss=\beamer@usebeamertemplatedo
+ \let\beamer@usebeamertemplatedos=\beamer@usebeamertemplatedo
+}
+
+\newif\ifbeamer@sbt
+\newtoks\beamer@sbttoks
+
+\newcommand<>\defbeamertemplate{
+ \beamer@ifempty{#1}
+ {\def\beamer@@oar{<presentation>}}
+ {\def\beamer@@oar{#1}}\beamer@defbeamertemplate}
+\def\beamer@defbeamertemplate{\@ifstar{\beamer@sbttrue\beamer@sbtoo}{\beamer@sbtfalse\beamer@sbtoo}}
+\def\beamer@sbtoo#1#2{\@ifnextchar[{\beamer@sbto{#1}{#2}}{\beamer@sbto{#1}{#2}[0]}}
+\def\beamer@sbto#1#2[#3]{\@ifnextchar[{\beamer@@sbto{#1}{#2}[#3]}{\def\beamer@sbtotemp{}\beamer@@@sbto{#1}{#2}[#3]}}
+\long\def\beamer@@sbto#1#2[#3][#4]{\long\def\beamer@sbtotemp{[#4]}\beamer@@@sbto{#1}{#2}[#3]}
+\long\def\beamer@@@sbto#1#2[#3]#4{%
+ \beamer@sbttoks={\beamer@@@@sbto{#1}{#2}[#3]{#4}}%
+ \@ifnextchar[{\the\beamer@sbttoks}{\the\beamer@sbttoks[action]{}}%
+}
+\long\def\beamer@@@@sbto#1#2[#3]#4[#5]#6{%
+ \edef\beamer@@sbtoarg{\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname[#3]}%
+ \expandafter\expandafter\expandafter\newcommand\expandafter\beamer@@sbtoarg\beamer@sbtotemp{%
+ \expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname{#4}#6}%
+ \let\beamer@@next=\beamer@resetsbtoarg%
+ \expandafter\mode\beamer@@oar{\let\beamer@@next=\relax}%
+ \beamer@@next%
+ \ifbeamer@sbt\setbeamertemplate{#1}[#2]\relax\relax\relax\relax\relax\relax\relax\relax\relax\fi%
+}
+\def\beamer@resetsbtoarg{%
+ \expandafter\expandafter\expandafter\renewcommand\expandafter\beamer@@sbtoarg\beamer@sbtotemp{}
+}
+
+\def\defbeamertemplatealias#1#2#3{%
+ \edef\beamer@@temp{\def\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname{\expandafter\noexpand\csname beamer@@tmpop@#1@#3\endcsname}}%
+ \beamer@@temp}
+
+\def\defbeamertemplateparent#1{\@ifnextchar[{\beamer@sbtoparo{#1}}{\beamer@sbtoparo{#1}[*]}}
+\def\beamer@sbtoparo#1[#2]#3{\@ifnextchar[{\beamer@sbtopar{#1}[#2]{#3}}{\beamer@sbtopar{#1}[#2]{#3}[0]}}
+\def\beamer@sbtopar#1[#2]#3[#4]{\@ifnextchar[
+ {\beamer@@sbtopar{#1}[#2]{#3}[#4]}
+ {\def\beamer@sbtotemp{}\beamer@@@sbtopar{#1}[#2]{#3}[#4]}}
+\long\def\beamer@@sbtopar#1[#2]#3[#4][#5]{\long\def\beamer@sbtotemp{[#5]}\beamer@@@sbtopar{#1}[#2]{#3}[#4]}
+\long\def\beamer@@@sbtopar#1[#2]#3[#4]#5{%
+ \expandafter\def\csname beamer@@tmpgrp@#1\endcsname{#3}%
+ \edef\beamer@@sbtoarg{\noexpand\newcommand\expandafter\noexpand\csname beamer@@tmpop@#1@#2\endcsname[#4]}%
+ \expandafter\beamer@@sbtoarg\beamer@sbtotemp{%
+ \def\beamer@sbtlist{#3}%
+ \@for\beamer@templ:=\beamer@sbtlist\do
+ {\expandafter\expandafter\expandafter\setbeamertemplate
+ \expandafter\expandafter\expandafter{\expandafter\beamer@templ\expandafter}\expandafter[\beamer@@sbt@option]#5}}}
+
+\def\setbeamertemplate#1{%
+ \@ifnextchar[{\beamer@sbtchoose{#1}}{\beamer@sbtexec{#1}}}
+\long\def\beamer@sbtexec#1#2{%
+ \expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname{#2}%
+ \expandafter\ifx\csname beamer@@tmpgrp@#1\endcsname\relax%
+ \else%
+ \expandafter\expandafter\expandafter\def
+ \expandafter\expandafter\expandafter\beamer@sbt@group
+ \expandafter\expandafter\expandafter{\csname beamer@@tmpgrp@#1\endcsname}%
+ \@for\beamer@templ:=\beamer@sbt@group\do{\expandafter\setbeamertemplate\expandafter{\beamer@templ}{#2}}%
+ \fi%
+}
+\long\def\beamer@sbtchoose#1[#2]{\def\beamer@@sbt@option{#2}%
+ \expandafter\ifx\csname beamer@@tmpop@#1@#2\endcsname\relax%
+ \expandafter\let\expandafter\beamer@@next\csname beamer@@tmpop@#1@*\endcsname%
+ \else%
+ \expandafter\let\expandafter\beamer@@next\csname beamer@@tmpop@#1@#2\endcsname%
+ \fi%
+ \beamer@@next%
+}
+
+\newcommand\addtobeamertemplate[3]{%
+ \long\def\beamer@temp{#2}%
+ \expandafter\def\expandafter\beamer@@temp\expandafter{\expandafter\long\expandafter\def\csname beamer@@tmpl@#1\endcsname}%
+ \expandafter\expandafter\expandafter\long%
+ \expandafter\expandafter\expandafter\def%
+ \expandafter\expandafter\expandafter\beamer@@addtemplate%
+ \expandafter\expandafter\expandafter{\csname beamer@@tmpl@#1\endcsname}%
+ \expandafter\expandafter\expandafter\beamer@@temp%
+ \expandafter\expandafter\expandafter{\expandafter\beamer@temp\beamer@@addtemplate#3}%
+}
+
+\RequirePackage{bidibeamerbaseauxtemplates}
+
+\mode
+<all>
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidibeamerbasetemplates.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidicode.sty b/Master/texmf-dist/tex/xelatex/bidi/bidicode.sty
new file mode 100644
index 00000000000..9a328e1bb99
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidicode.sty
@@ -0,0 +1,166 @@
+%%
+%% This is file `bidicode.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidicode.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{bidicode}
+\RequirePackage{pstricks}
+\RequirePackage{fvrb-ex}
+\RequirePackage{showexpl}
+\definecolor{Orange}{rgb}{1,.4,.2}
+\definecolor{myblue}{rgb}{0.02,0.04,0.48}
+\definecolor{lightblue}{rgb}{0.61,.8,.8}
+\definecolor{myred}{rgb}{0.65,0.04,0.07}
+\definecolor{mygreen}{rgb}{0,.43,0}
+\definecolor{blendedred}{rgb}{0.9,0.1,0.1}
+\definecolor{blendedgreen}{rgb}{0.2,0.7,0.2}
+\definecolor{darkgray}{gray}{0.3}
+\definecolor{mygray}{gray}{0.6}
+\definecolor{skugga}{gray}{0.7}
+\definecolor{mybackground}{rgb}{1,0.8,0.5}
+\lstset{%
+ language=[LaTeX]TEX,%
+ float=hbp,%
+ basicstyle=\ttfamily\small, %
+ identifierstyle=\color{black}, %
+ keywordstyle=\color{myred}, %
+ stringstyle=\color{blue}, %
+ commentstyle=\color{blue}, %
+ columns=flexible, %
+ tabsize=4, %
+ frame=single, %
+ extendedchars=true, %
+ showspaces=false, %
+ showstringspaces=false, %
+ numbers=left,
+ numbersep=12pt,
+ numberstyle=\tiny, %
+ breaklines=true, %
+ breakautoindent=true,
+ captionpos=b,
+ xleftmargin=1em,
+ breaklines=true,
+ backgroundcolor=\color{mybackground},
+ breakautoindent=true,
+ rframe={},
+ explpreset={numbers=left,numberstyle=\tiny,numbersep=12pt,
+ xleftmargin=1em,columns=flexible,language=[LaTeX]TEX},
+ morekeywords={setLTR,setLR,setRTL,setRL,LRE,LR,RLE,RL,lr}
+}
+\lstdefinestyle{syntax}{backgroundcolor=\color{blue!20},numbers=none,xleftmargin=0pt,xrightmargin=0pt,
+ frame=single}
+\lstdefinestyle{code}{backgroundcolor=\color{red!20},numbers=left,xleftmargin=0pt,xrightmargin=0pt,
+ frame=single}
+
+\newcommand\Larg [1]{{\normalfont\itshape#1\/}}
+\newcommand\Larga[1]{$\langle$\Larg{#1}$\rangle$}
+\newcommand\Largb[1]{\lcb\Larg{#1}\rcb}
+\newcommand\Largs[1]{\lsb\Larg{#1}\rsb}
+\newcommand\Largr[1]{\lrb\Larg{#1}\rrb}
+\newcommand\LBEG[1]{{\normalfont\ttfamily\bs{}begin\lcb#1\rcb}}
+\newcommand\LEND[1]{{\normalfont\ttfamily\bs{}end\lcb#1\rcb}}
+
+\DeclareRobustCommand\bs{{\normalfont\ttfamily\textbackslash}}
+\DeclareRobustCommand\lcb{{\normalfont\ttfamily\textbraceleft}}
+\DeclareRobustCommand\rcb{{\normalfont\ttfamily\textbraceright}}
+\DeclareRobustCommand\lsb{{\normalfont\ttfamily[}}
+\DeclareRobustCommand\rsb{{\normalfont\ttfamily]}}
+\DeclareRobustCommand\lrb{{\normalfont\ttfamily(}}
+\DeclareRobustCommand\rrb{{\normalfont\ttfamily)}}
+
+\def\Lcs#1{\nxLcs{#1}}
+\def\LcsStar#1{\nxLcs{#1}\OptArg*{*}}
+\def\nxLcs#1{\texttt{\textbackslash#1}}
+
+\def\Coordx#1{$x_{#1}$}
+\def\Coordy#1{$y_{#1}$}
+\def\Coordz#1{$z_{#1}$}
+\def\Coord#1{\Coordx{#1},\kern 1pt\Coordy{#1}}
+\def\Coordn{\Coordx{n},\kern 1pt\Coordy{n}}
+\def\CoordIII#1{\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordz{#1}}
+\def\CAny{\Coordx{},\kern 1pt\Coordy{}}
+\def\CIIIAny{\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{}}
+\def\coord#1{(\Coordx{#1},\kern 1pt\Coordy{#1})}
+\def\coordn{(\Coordx{n},\kern 1pt\Coordy{n})}
+\def\coordiii#1{(\Coordx{#1},\kern 1pt\Coordy{#1},\kern 1pt\Coordz{#1})}
+\def\coordx#1{($x_{#1}$)}
+\def\coordy#1{($y_{#1}$)}
+\def\coordz#1{($z_{#1}$)}
+\def\cAny{(\Coordx{},\kern 1pt\Coordy{})}
+\def\ciiiAny{(\Coordx{},\kern 1pt\Coordy{},\kern 1pt\Coordz{})}
+
+\newsavebox{\boxdef}
+\newenvironment{BDef}
+ {\begin{lrbox}\boxdef
+ \def\arraystretch{1.0}
+ \begin{tabular}{@{}l@{}l@{}l@{}}
+ }
+ {\end{tabular}\end{lrbox}
+
+ {\BCmd\fbox{\usebox\boxdef}\endBCmd}
+ \aftergroup\@afterindentfalse\aftergroup\@afterheading
+ }
+
+\newenvironment{BDef*}
+ {\begin{lrbox}\boxdef
+ \def\arraystretch{1.0}
+ \begin{tabular}{@{}l@{}l@{}l@{}}
+ }
+ {\end{tabular}\end{lrbox}
+ {\begin{BCmd*}\fbox{\usebox\boxdef}\end{BCmd*}}
+ \aftergroup\@afterindentfalse\aftergroup\@afterheading
+ }
+\newenvironment{BCmd}{
+ \@beginparpenalty-\@lowpenalty
+ \topsep\BDefaboveskip
+ \fboxsep3pt
+ \flushleft}
+ {\@endparpenalty\@M
+ \@topsepadd\BDefbelowskip
+ \endflushleft}
+
+\newenvironment{BCmd*}{
+ \@beginparpenalty\@M
+ \topsep\BDefinlineskip
+ \fboxsep3pt
+ \flushleft}
+ {\@endparpenalty5000
+ \endflushleft}
+
+\newskip\BDefaboveskip
+\newskip\BDefbelowskip
+\newskip\BDefinlineskip
+\setlength\BDefaboveskip{10pt plus 4pt}
+\setlength\BDefbelowskip{6pt}
+\setlength\BDefinlineskip{6pt}
+
+\def\OptArgs{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{[Options]}}\kern1pt}
+\def\OptArg{\@ifnextchar*\OptArg@i{\OptArg@ii*}}
+\def\OptArg@i*#1{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{#1}}\kern1pt}
+\def\OptArg@ii*#1{\psframebox[framesep=2pt,fillstyle=solid,fillcolor=black!20,linecolor=black!20]{\texttt{[#1]}}\kern1pt}
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidicode.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidimemoir.cls b/Master/texmf-dist/tex/xelatex/bidi/bidimemoir.cls
new file mode 100644
index 00000000000..5b275cf146e
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidimemoir.cls
@@ -0,0 +1,11674 @@
+%%
+%% This is file `bidimemoir.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidimemoir.cls')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+%%
+%% This is file `bidimemoir.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidimemoir.dtx (with options: `class')
+%%
+%% Author: Peter Wilson (herries dot press at earthlink dot net)
+%% Herries Press
+%% Copyright 2001--2008 Peter R. Wilson
+%%
+%% This work may be distributed and/or modified under the
+%% conditions of the LaTeX Project Public License, either
+%% version 1.3 of this license or (at your option) any
+%% later version.
+%% The latest version of the license is in
+%% http://www.latex-project.org/lppl.txt
+%% and version 1.3 or later is part of all distributions of
+%% LaTeX version 2003/06/01 or later.
+%%
+%% This work has the LPPL maintenance status "author-maintained".
+%%
+%% This work consists of the files listed in the README file.
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{bidimemoir}%
+ [2009/06/10 modified memoir document class for bidi typesetting in XeLaTeX]
+\newcommand*{\@ptsize}{}
+\newcommand*{\@memptsize}{}
+\newlength{\onelineskip}
+\newlength{\lxvchars}
+\newlength{\xlvchars}
+\newcount\@memcnta
+\newcounter{@memmarkcntra}
+\newif\if@restonecol
+\newif\if@openright
+ \@openrighttrue
+
+\newif\if@openleft
+ \@openleftfalse
+
+\newif\if@mainmatter
+ \@mainmattertrue
+
+\newif\if@memoldfont
+ \@memoldfontfalse
+
+\newif\ifextrafontsizes
+ \extrafontsizesfalse
+
+\newcommand*{\@memerror}{\ClassError{bidimemoir}}
+\newcommand*{\@memwarn}{\ClassWarning{bidimemoir}}
+
+\newif\ifsamename
+\newcommand{\nametest}[2]{%
+ \samenamefalse
+ \begingroup
+ \def\@memtempa{#1} \def\@memtempb{#2}
+ \ifx \@memtempa\@memtempb
+ \endgroup
+ \samenametrue
+ \else
+ \endgroup
+ \fi}
+
+\newif\ifm@m@And
+\newif\ifm@m@Or
+\newif\ifm@m@Xor
+
+\newcommand{\kill@lastcounter}[1]{%
+ \count\count10 \z@
+ \advance\count10 \m@ne
+ \expandafter\let\csname c@#1\endcsname\relax}
+
+\newcommand{\@name@p@xdef}[1]{%
+ \expandafter\protected@xdef\csname #1\endcsname}
+\newcommand{\@name@unresp@xdef}[1]{%
+ \expandafter\unrestored@protected@xdef\csname #1\endcsname}
+\newcommand{\@namelet}[1]{%
+ \expandafter\let\csname #1\endcsname}
+\newcommand{\@namelongdef}[1]{%
+ \long\expandafter\def\csname #1\endcsname}
+\newcommand{\@nameedef}[1]{%
+ \expandafter\protected@edef\csname #1\endcsname}
+
+\newcommand{\memjustarg}[1]{#1}
+\newcommand{\memgobble}[1]{}
+
+\newcommand*{\@memfakeusepackage}[1]{%
+ \@namelet{ver@#1.sty}\@empty}
+
+\providecommand*{\EmulatedPackage}{}
+\renewcommand*{\EmulatedPackage}[1]{%
+ \@ifnextchar[{\@emulated@package{#1}}%
+ {\@emulated@package{#1}[\@empty]}%]
+}
+\providecommand*{\EmulatedPackageWithOptions}{}
+\renewcommand*{\EmulatedPackageWithOptions}[2]{%
+ \PassOptionsToPackage{#1}{#2}%
+ \EmulatedPackage{#2}%
+}
+\def\@emulated@package#1[#2]{%
+ \expandafter\xdef\csname ver@#1.\@pkgextension\endcsname{#2}%
+ \@ifundefined{opt@#1.\@pkgextension}%
+ {\@namedef{opt@#1.\@pkgextension}{}}{}%
+ \wlog{Package #1 \ifx\@empty#2\else[#2] \fi
+ \if,\csname opt@#1.\@pkgextension\endcsname,\else
+ (with options \csname opt@#1.\@pkgextension\endcsname) \fi
+ emulated by \@currname.}%
+}
+\@onlypreamble\EmulatedPackage
+\@onlypreamble\EmulatedPackageWithOptions
+\@onlypreamble\@emulated@package
+
+\newcommand*{\DisemulatePackage}[1]{%
+ \@namelet{ver@#1.\@pkgextension}\relax}
+\@onlypreamble\DisemulatePackage
+
+\renewcommand{\InputIfFileExists}[2]{%
+ \IfFileExists{#1}%
+ {#2\@addtofilelist{#1}\m@matbeginf{#1}%
+ \@@input \@filef@und
+ \m@matendf{#1}%
+ \killm@matf{#1}}}
+
+\newcommand{\m@matbeginf}[1]{\@ifundefined{#1-m@mfb}{}%
+ {\@nameuse{#1-m@mfb}}}
+\newcommand{\m@matendf}[1]{\@ifundefined{#1-m@mfe}{}%
+ {\@nameuse{#1-m@mfe}}}
+
+\newcommand*{\killm@matf}[1]{%
+ \@namelet{#1-m@mfb}\relax
+ \@namelet{#1-m@mfe}\relax}
+
+\newcommand{\AtBeginFile}[2]{\@ifundefined{#1-m@mfb}%
+ {\@namedef{#1-m@mfb}{#2}}%
+ {\expandafter\addtodef\csname #1-m@mfb\endcsname{}{#2}}}
+\newcommand{\AtEndFile}[2]{\@ifundefined{#1-m@mfe}%
+ {\@namedef{#1-m@mfe}{#2}}%
+ {\expandafter\addtodef\csname #1-m@mfe\endcsname{}{#2}}}
+
+\newcommand{\AtBeginPackage}[2]{%
+ \AtBeginFile{#1.\@pkgextension}{#2}}
+\newcommand{\AtEndPackage}[2]{%
+ \AtEndFile{#1.\@pkgextension}{#2}}
+\newcommand{\RequireAtEndPackage}[2]{%
+ \@ifpackageloaded{#1}{#2}%
+ {\AtEndFile{#1.\@pkgextension}{#2}}}
+
+\newcommand{\AtBeginClass}[2]{%
+ \AtBeginFile{#1.\@clsextension}{#2}}
+\newcommand{\AtEndClass}[2]{%
+ \AtEndFile{#1.\@clsextension}{#2}}
+\newcommand{\RequireAtEndClass}[2]{%
+ \@ifclassloaded{#1}{#2}%
+ {\AtEndFile{#1.\@clsextension}{#2}}}
+
+\newcommand{\phantomsection}{}
+
+ \renewcommand*{\nofiles}{%
+ \@fileswfalse% flag for suppressing \immediate \writes
+ \typeout{No auxiliary output files.^^J}%
+ \long\def\protected@write##1##2##3%
+ {\write\m@ne{}\if@nobreak\ifvmode\nobreak\fi\fi}%
+ }
+
+\newcommand*{\memsetcounter}[2]{\setcounter{#1}{#2}}
+\AtBeginDocument{\immediate\write\@mainaux{%
+ \string\providecommand*{\string\memsetcounter}[2]{}}}
+
+\def\bs{\texttt{\char`\\}}
+\ifx\l@nohyphenation\undefined
+ \newlanguage\l@nohyphenation
+\fi
+\DeclareRobustCommand{\meta}[1]{%
+ \ensuremath\langle
+ \ifmmode \expandafter \nfss@text \fi
+ {%
+ \meta@font@select
+ \edef\meta@hyphen@restore
+ {\hyphenchar\the\font\the\hyphenchar\font}%
+ \hyphenchar\font\m@ne
+ \language\l@nohyphenation
+ #1\/%
+ \meta@hyphen@restore
+ }\ensuremath\rangle
+}
+\def\meta@font@select{\itshape}
+
+\DeclareRobustCommand{\marg}[1]{%
+ {\ttfamily\char`\{}\meta{#1}{\ttfamily\char`\}}}
+\DeclareRobustCommand{\oarg}[1]{%
+ {\ttfamily\char`\[}\meta{#1}{\ttfamily\char`\]}}
+\DeclareRobustCommand{\parg}[1]{%
+ {\ttfamily\char`\(}\meta{#1}{\ttfamily\char`\)}}
+\DeclareRobustCommand{\cs}[1]{\texttt{\char`\\#1}}
+\newcommand{\cmdprint}[1]{\texttt{\string#1}}
+\newcommand{\cmd}[1]{\cmdprint{#1}%
+ \index{\expandafter\@gobble\string#1?\string\cmdprint{\string#1}}}
+
+\newif\ifm@mifpdf
+ \m@mifpdffalse
+\IfFileExists{ifpdf.sty}{\RequirePackage{ifpdf}\relax}{%
+ \ClassWarningNoLine{bidimemoir}{%
+ Package `ifpdf' is not installed.\MessageBreak
+ The package is being emulated}%
+\m@mifpdftrue
+\newif\ifpdf
+ \pdffalse
+\ifx\pdfoutput\undefined
+\else
+ \ifx\pdfoutput\@undefined
+ \else
+ \ifx\pdfoutput\relax
+ \else
+ \ifnum\pdfoutput>0\relax
+ \pdftrue
+ \fi
+ \fi
+ \fi
+\fi
+%%\EmulatedPackage{ifpdf}[2008/07/23]
+}
+
+\newif\ifm@mifetex
+ \m@mifetexfalse
+\IfFileExists{ifetex.sty}{\RequirePackage{ifetex}\relax}{%
+ \ClassInfo{bidimemoir}{%
+ An `ifetex' package is being emulated}%
+\m@mifetextrue
+\newif\ifetex
+ \etexfalse
+\ifx\eTeXversion\undefined
+\else
+ \ifx\eTeXversion\@undefined
+ \else
+ \ifx\eTeXversion\relax
+ \else
+ \ifnum\eTeXversion>0\relax
+ \etextrue
+ \fi
+ \fi
+ \fi
+\fi
+%%\EmulatedPackage{ifetex}[2008/07/23]
+}
+
+\newif\ifm@mifxetex
+ \m@mifxetexfalse
+\IfFileExists{ifxetex.sty}{\RequirePackage{ifxetex}\relax}{%
+ \ClassWarningNoLine{bidimemoir}{%
+ The `ifxetex' package is not installed.\MessageBreak
+ The package is being emulated}%
+\newif\ifxetex
+\@ifundefined{XeTeXrevision}{\xetexfalse}{\xetextrue}
+%%\EmulatedPackage{ifxetex}[2008/07/23]
+}
+\ifm@mifxetex
+\def\RequireXeTeX{%
+ \ifxetex\else
+ \@memerror{XeTeX is required to process this document}%
+ {Try again with xelatex, not (pdf)latex.\MessageBreak
+ Or try removing any XeTeX package(s).}
+ \fi}
+\fi
+
+\newif\ifm@mifluatex
+ \m@mifluatexfalse
+\IfFileExists{ifluatex.sty}{\RequirePackage{ifluatex}\relax}{%
+ \ClassWarningNoLine{bidimemoir}{%
+ The `ifluatex' package is not installed.\MessageBreak
+ The package is being emulated}%
+\m@mifluatextrue
+\newif\ifluatex
+ \luatexfalse
+\ifx\luatexversion\@undefined
+\else
+ \ifx\luatexversion\undefined
+ \else
+ \ifx\luatexversion\relax
+ \else
+ \luatextrue
+ \fi
+ \fi
+\fi
+%%\EmulatedPackage{ifluatex}[2008/07/23]
+}
+
+\edef\wo@dmacro{%
+ \string m\string a\string c\string r\string o\string :%
+}
+
+\def\wo@difmacro@begingroup#1{%
+ \begingroup
+ \edef\x{%
+ \noexpand\wo@dparsemacro\meaning#1\wo@dmacro\string -%
+ }%
+ \x\@nil{#1}%
+}
+
+\begingroup
+ \edef\x{\endgroup
+ \def\noexpand\wo@dparsemacro##1\wo@dmacro##2\string -}%
+\x#3\@nil#4{%
+ \ifx\\#3\\%
+ \endgroup
+ \@memwarn{\string `\string #4\string ' is not a macro}%
+ \expandafter\@gobble
+ \else
+ \expandafter\@firstofone
+ \fi
+}
+
+\def\addtodef{\@star@or@long\wo@daddtodef}
+\long\def\wo@daddtodef#1#2#3{%
+ \wo@difmacro@begingroup{#1}{%
+ \@temptokena{#2}%
+ \toks@\expandafter{#1#3}%
+ \edef\x{\endgroup
+ \l@ngrel@x\def\noexpand#1{\the\@temptokena \the\toks@}}%
+ \x
+ }%
+}
+
+\def\addtoiargdef{\@star@or@long\wo@daddtoiargdef}
+\long\def\wo@daddtoiargdef#1#2#3{%
+ \wo@difmacro@begingroup{#1}{%
+ \@temptokena{#2}%
+ \toks@\expandafter{#1{##1}#3}%
+ \edef\x{\endgroup
+ \l@ngrel@x\def\noexpand#1####1{\the\@temptokena \the\toks@}}%
+ \x
+ }%
+}
+
+%%%%%%%%%%%%%%%% Michael Downes' patchcmd 2000/07/31 v1.03 %%%%%%%%
+\newcommand{\patchcommand}[1]{%
+ \expandafter\patchcmd@a\meaning#1??->@\@nil#1%
+}
+\long\def\patchcmd@a#1#2#3->#4#5\@nil#6{%
+ \ifx @#4\relax \patchcmdError#6#1%
+ \expandafter\@gobbletwo % discard the other two arguments
+ \else
+ \if l#2\toks@{\patchcmd@e{}#6}% l in this position means \long
+ \else \toks@{\patchcmd@e*#6}% not \long
+ \fi
+ \patchcmd@b #3@#4#5 ? ? ? \@nil#6%
+ \expandafter\the\expandafter\toks@
+ \fi}
+\def\patchcmd@b#1:#2@#3#4 #5#6 #7 #8\@nil#9{%
+ \if \ifx @#7@\expandafter
+ \ifx\csname #6\endcsname#9T\else F\fi\else F\fi T%
+ \toks@\expandafter{\expandafter\patchcommand\csname #6 \endcsname}%
+ \else
+ \ifx @#2@% No arguments
+ \toks@\expandafter{\the\toks@ 0}%
+ \else
+ \patchcmd@c 0#2{\string##}0%
+ \fi
+ \fi}
+\def\patchcmd@c#1#2#3{%
+ \if\string###2% % yes it's a # token
+ \ifodd 0#31 % and it's followed by a number
+ \if 0#3\patchcmd@d#1\fi % number=0? then we're done
+ \else \patchcmd@d D% # not a number: must be a delimited arg
+ \fi
+ \else \patchcmd@d D% not a # token: must be a delmited arg
+ \fi
+ \patchcmd@c#3}
+\def\patchcmd@d#1{%
+ \if D#1%
+%%% \PackageError{patchcmd}{Cannot change a macro that has
+%%% delimited arguments}\@ehd
+ \@memerror{%
+ Cannot change a macro that has delimited arguments}{\@ehd}
+ \else
+ \toks@\expandafter{\the\toks@ #1}%
+ \fi
+ \begingroup
+ \aftergroup\@gobble
+ \let\patchcmd@c\endgroup}
+\def\patchcmd@e#1#2#3#4#5{%
+ \begingroup
+ \edef\@##1{%
+ \@temptokena\noexpand\expandafter{%
+ \noexpand#2%
+ \ifnum#3>0 {####1}\ifnum#3>1 {####2}\ifnum#3>2 {####3}%
+ \ifnum#3>3 {####4}\ifnum#3>4 {####5}\ifnum#3>5 {####6}%
+ \ifnum#3>6 {####7}\ifnum#3>7 {####8}\ifnum#3>8 {####9}%
+ \fi\fi\fi\fi\fi\fi\fi\fi\fi
+ ##1%
+ }%
+ }
+ \@{#5}%
+ \edef\@##1{\endgroup
+ \noexpand\renewcommand#1\noexpand#2\ifcase#3 \else [#3]\fi
+ {##1\the\@temptokena}}%
+ \@{#4}%
+}
+\long\def\patchcmdError#1#2{%
+ \begingroup
+ \toks@{Not redefinable}%
+ \ifcat\relax\noexpand#1% Is it a control sequence?
+ \begingroup
+ \let#1=?\ifx ?\relax % Is it "\relax"?
+ \endgroup % accept current value of \toks@
+ \else \endgroup
+ \if\ifx\relax#1u\else #2\fi u%
+ \toks@{Not defined}%
+ \fi
+ \fi
+ \fi
+ \edef\@{\endgroup
+%%% \noexpand\PackageError{patchcmd}{%
+%%% \the\toks@: \string#1}\noexpand\@ehd}%
+ \noexpand\@memerror{%
+ \the\toks@: \string#1}\noexpand\@ehd}%
+ \@}
+
+%%%%%%%%%%%%%%%%%%%%% end of patchcmd code %%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%\@memfakeusepackage{patchcmd}
+
+\newlength{\stockheight}
+\newlength{\stockwidth}
+\newlength{\trimtop}
+\newlength{\trimedge}
+
+\newcommand*{\stockdbill} {\stockheight=7in \stockwidth=3in}
+\newcommand*{\stockstatement} {\stockheight=8.5in \stockwidth=5.5in}
+\newcommand*{\stockexecutive} {\stockheight=10.5in \stockwidth=7.25in}
+\newcommand*{\stockletter} {\stockheight=11in \stockwidth=8.5in}
+\newcommand*{\stockold} {\stockheight=12in \stockwidth=9in}
+\newcommand*{\stocklegal} {\stockheight=14in \stockwidth=8.5in}
+\newcommand*{\stockledger} {\stockheight=17in \stockwidth=11in}
+\newcommand*{\stockbroadsheet}{\stockheight=22in \stockwidth=17in}
+
+\newcommand*{\stockpottvo} {\stockheight=6.25in \stockwidth=4in}
+\newcommand*{\stockfoolscapvo} {\stockheight=6.75in \stockwidth=4.25in}
+\newcommand*{\stockcrownvo} {\stockheight=7.5in \stockwidth=5in}
+\newcommand*{\stockpostvo} {\stockheight=8in \stockwidth=5in}
+\newcommand*{\stocklargecrownvo}{\stockheight=8in \stockwidth=5.25in}
+\newcommand*{\stocklargepostvo} {\stockheight=8.25in \stockwidth=5.25in}
+\newcommand*{\stocksmalldemyvo} {\stockheight=8.5in \stockwidth=5.675in}
+\newcommand*{\stockdemyvo} {\stockheight=8.75in \stockwidth=5.675in}
+\newcommand*{\stockmediumvo} {\stockheight=9in \stockwidth=5.75in}
+\newcommand*{\stocksmallroyalvo}{\stockheight=9.25in \stockwidth=6.175in}
+\newcommand*{\stockroyalvo} {\stockheight=10in \stockwidth=6.25in}
+\newcommand*{\stocksuperroyalvo}{\stockheight=10.25in \stockwidth=6.75in}
+\newcommand*{\stockimperialvo} {\stockheight=11in \stockwidth=7.5in}
+
+\newcommand*{\stockmcrownvo} {\stockheight=186mm \stockwidth=123mm}
+\newcommand*{\stockmlargecrownvo} {\stockheight=198mm \stockwidth=129mm}
+\newcommand*{\stockmdemyvo} {\stockheight=216mm \stockwidth=138mm}
+\newcommand*{\stockmsmallroyalvo} {\stockheight=234mm \stockwidth=156mm}
+
+\newcommand*{\stockao} {\stockheight=1189mm \stockwidth=841mm}
+\newcommand*{\stockai} {\stockheight=841mm \stockwidth=594mm}
+\newcommand*{\stockaii} {\stockheight=594mm \stockwidth=420mm}
+\newcommand*{\stockaiii}{\stockheight=420mm \stockwidth=297mm}
+\newcommand*{\stockaiv} {\stockheight=297mm \stockwidth=210mm}
+\newcommand*{\stockav} {\stockheight=210mm \stockwidth=148mm}
+\newcommand*{\stockavi} {\stockheight=148mm \stockwidth=105mm}
+
+\newcommand*{\stockbo} {\stockheight=1414mm \stockwidth=1000mm}
+\newcommand*{\stockbi} {\stockheight=1000mm \stockwidth=707mm}
+\newcommand*{\stockbii} {\stockheight=707mm \stockwidth=500mm}
+\newcommand*{\stockbiii}{\stockheight=500mm \stockwidth=353mm}
+\newcommand*{\stockbiv} {\stockheight=353mm \stockwidth=250mm}
+\newcommand*{\stockbv} {\stockheight=250mm \stockwidth=176mm}
+\newcommand*{\stockbvi} {\stockheight=176mm \stockwidth=125mm}
+
+\newcommand*{\pagedbill} {\paperheight=7in \paperwidth=3in}
+\newcommand*{\pagestatement} {\paperheight=8.5in \paperwidth=5.5in}
+\newcommand*{\pageexecutive} {\paperheight=10.5in \paperwidth=7.25in}
+\newcommand*{\pageletter} {\paperheight=11in \paperwidth=8.5in}
+\newcommand*{\pageold} {\paperheight=12in \paperwidth=9in}
+\newcommand*{\pagelegal} {\paperheight=14in \paperwidth=8.5in}
+\newcommand*{\pageledger} {\paperheight=17in \paperwidth=11in}
+\newcommand*{\pagebroadsheet}{\paperheight=22in \paperwidth=17in}
+
+\newcommand*{\pagepottvo} {\paperheight=6.25in \paperwidth=4in}
+\newcommand*{\pagefoolscapvo} {\paperheight=6.75in \paperwidth=4.25in}
+\newcommand*{\pagecrownvo} {\paperheight=7.5in \paperwidth=5in}
+\newcommand*{\pagepostvo} {\paperheight=8in \paperwidth=5in}
+\newcommand*{\pagelargecrownvo}{\paperheight=8in \paperwidth=5.25in}
+\newcommand*{\pagelargepostvo} {\paperheight=8.25in \paperwidth=5.25in}
+\newcommand*{\pagesmalldemyvo} {\paperheight=8.5in \paperwidth=5.675in}
+\newcommand*{\pagedemyvo} {\paperheight=8.75in \paperwidth=5.675in}
+\newcommand*{\pagemediumvo} {\paperheight=9in \paperwidth=5.75in}
+\newcommand*{\pagesmallroyalvo}{\paperheight=9.25in \paperwidth=6.175in}
+\newcommand*{\pageroyalvo} {\paperheight=10in \paperwidth=6.25in}
+\newcommand*{\pagesuperroyalvo}{\paperheight=10.25in \paperwidth=6.75in}
+\newcommand*{\pageimperialvo} {\paperheight=11in \paperwidth=7.5in}
+
+\newcommand*{\pagemcrownvo} {\paperheight=186mm \paperwidth=123mm}
+\newcommand*{\pagemlargecrownvo} {\paperheight=198mm \paperwidth=129mm}
+\newcommand*{\pagemdemyvo} {\paperheight=216mm \paperwidth=138mm}
+\newcommand*{\pagemsmallroyalvo} {\paperheight=234mm \paperwidth=156mm}
+
+\newcommand*{\pageao} {\paperheight=1189mm \paperwidth=841mm}
+\newcommand*{\pageai} {\paperheight=841mm \paperwidth=594mm}
+\newcommand*{\pageaii} {\paperheight=594mm \paperwidth=420mm}
+\newcommand*{\pageaiii}{\paperheight=420mm \paperwidth=297mm}
+\newcommand*{\pageaiv} {\paperheight=297mm \paperwidth=210mm}
+\newcommand*{\pageav} {\paperheight=210mm \paperwidth=148mm}
+\newcommand*{\pageavi} {\paperheight=148mm \paperwidth=105mm}
+
+\newcommand*{\pagebo} {\paperheight=1414mm \paperwidth=1000mm}
+\newcommand*{\pagebi} {\paperheight=1000mm \paperwidth=707mm}
+\newcommand*{\pagebii} {\paperheight=707mm \paperwidth=500mm}
+\newcommand*{\pagebiii}{\paperheight=500mm \paperwidth=353mm}
+\newcommand*{\pagebiv} {\paperheight=353mm \paperwidth=250mm}
+\newcommand*{\pagebv} {\paperheight=250mm \paperwidth=176mm}
+\newcommand*{\pagebvi} {\paperheight=176mm \paperwidth=125mm}
+
+\DeclareOption{a0paper}{\stockao}
+\DeclareOption{a1paper}{\stockai}
+\DeclareOption{a2paper}{\stockaii}
+\DeclareOption{a3paper}{\stockaiii}
+\DeclareOption{a4paper}{\stockaiv}
+\DeclareOption{a5paper}{\stockav}
+\DeclareOption{a6paper}{\stockavi}
+\DeclareOption{b0paper}{\stockbo}
+\DeclareOption{b1paper}{\stockbi}
+\DeclareOption{b2paper}{\stockbii}
+\DeclareOption{b3paper}{\stockbiii}
+\DeclareOption{b4paper}{\stockbiv}
+\DeclareOption{b5paper}{\stockbv}
+\DeclareOption{b6paper}{\stockbvi}
+\DeclareOption{mcrownvopaper}{\stockmcrownvo}
+\DeclareOption{mlargecrownvopaper}{\stockmlargecrownvo}
+\DeclareOption{mdemyvopaper}{\stockmdemyvo}
+\DeclareOption{msmallroyalvopaper}{\stockmsmallroyalvo}
+
+\DeclareOption{dbillpaper}{\stockdbill}
+\DeclareOption{statementpaper}{\stockstatement}
+\DeclareOption{executivepaper}{\stockexecutive}
+\DeclareOption{letterpaper}{\stockletter}
+\DeclareOption{oldpaper}{\stockold}
+\DeclareOption{legalpaper}{\stocklegal}
+\DeclareOption{ledgerpaper}{\stockledger}
+\DeclareOption{broadsheetpaper}{\stockbroadsheet}
+
+\DeclareOption{pottvopaper}{\stockpottvo}
+\DeclareOption{foolscapvopaper}{\stockfoolscapvo}
+\DeclareOption{crownvopaper}{\stockcrownvo}
+\DeclareOption{postvopaper}{\stockpostvo}
+\DeclareOption{largecrownvopaper}{\stocklargecrownvo}
+\DeclareOption{largepostvopaper}{\stocklargepostvo}
+\DeclareOption{smalldemyvopaper}{\stocksmalldemyvo}
+\DeclareOption{demyvopaper}{\stockdemyvo}
+\DeclareOption{mediumvopaper}{\stockmediumvo}
+\DeclareOption{smallroyalvopaper}{\stocksmallroyalvo}
+\DeclareOption{royalvopaper}{\stockroyalvo}
+\DeclareOption{superroyalvopaper}{\stocksuperroyalvo}
+\DeclareOption{imperialvopaper}{\stockimperialvo}
+
+\DeclareOption{ebook}
+ {\setlength\stockheight {9in}%
+ \setlength\stockwidth {6in}}
+
+\newif\ifmemlandscape
+ \memlandscapefalse
+\DeclareOption{landscape}{\memlandscapetrue}
+\DeclareOption{portrait}{\memlandscapefalse}
+
+\renewcommand*{\@ptsize}{0}
+\renewcommand*{\@memptsize}{10}
+\DeclareOption{9pt}{\renewcommand*{\@ptsize}{9}\renewcommand*{\@memptsize}{9}}
+\DeclareOption{10pt}{\renewcommand*{\@ptsize}{0}\renewcommand*{\@memptsize}{10}}
+\DeclareOption{11pt}{\renewcommand*{\@ptsize}{1}\renewcommand*{\@memptsize}{11}}
+\DeclareOption{12pt}{\renewcommand*{\@ptsize}{2}\renewcommand*{\@memptsize}{12}}
+\DeclareOption{14pt}{\renewcommand*{\@ptsize}{4}\renewcommand*{\@memptsize}{14}}
+\DeclareOption{17pt}{\renewcommand*{\@ptsize}{7}\renewcommand*{\@memptsize}{17}}
+\DeclareOption{20pt}{\renewcommand*{\@ptsize}{20}\renewcommand*{\@memptsize}{20}}
+\DeclareOption{25pt}{\renewcommand*{\@ptsize}{25}\renewcommand*{\@memptsize}{25}}
+\DeclareOption{30pt}{\renewcommand*{\@ptsize}{30}\renewcommand*{\@memptsize}{30}}
+\DeclareOption{36pt}{\renewcommand*{\@ptsize}{36}\renewcommand*{\@memptsize}{36}}
+\DeclareOption{48pt}{\renewcommand*{\@ptsize}{48}\renewcommand*{\@memptsize}{48}}
+\DeclareOption{60pt}{\renewcommand*{\@ptsize}{60}\renewcommand*{\@memptsize}{60}}
+
+\newif\if@nyptsizeopt
+ \@nyptsizeoptfalse
+\providecommand*{\anyptfilebase}{mem}
+\providecommand*{\anyptsize}{10}
+\DeclareOption{*pt}{\@nyptsizeopttrue}
+
+\DeclareOption{twoside}{\@twosidetrue \@mparswitchtrue}
+\DeclareOption{oneside}{\@twosidefalse \@mparswitchfalse}
+\DeclareOption{onecolumn}{\@twocolumnfalse}
+\DeclareOption{twocolumn}{\@twocolumntrue}
+\newif\ifdraftdoc\draftdocfalse
+\setlength{\overfullrule}{\z@}
+\DeclareOption{final}{\setlength{\overfullrule}{\z@}
+ \draftdocfalse
+ \msdocfalse}
+\DeclareOption{draft}{\setlength\overfullrule{5pt}%
+ \draftdoctrue
+ \msdocfalse}
+\newif\ifmsdoc
+ \msdocfalse
+\DeclareOption{ms}{%
+ \msdoctrue
+ \draftdocfalse
+ \setlength\overfullrule{\z@}
+}
+
+\newif\ifshowtrims
+ \showtrimsfalse
+\DeclareOption{showtrims}{\showtrimstrue}
+
+\newif\ifartopt
+ \artoptfalse
+\DeclareOption{article}{\artopttrue}
+
+\DeclareOption{openright}{\@openrighttrue}
+\DeclareOption{openany}{\@openrightfalse}
+\DeclareOption{openleft}{\@openlefttrue}
+\newcommand{\openright}{\@openrighttrue\@openleftfalse%
+ \gdef\clearforchapter{\cleartorecto}}
+\newcommand{\openany}{\@openrightfalse\@openleftfalse%
+ \gdef\clearforchapter{\clearpage}}
+\newcommand{\openleft}{\@openlefttrue
+ \gdef\clearforchapter{\cleartoverso}}
+
+\DeclareOption{leqno}{\input{leqno.clo}}
+\DeclareOption{fleqn}{\input{fleqn.clo}}
+\DeclareOption{openbib}{%
+ \AtEndOfClass{%
+ \renewcommand\@openbib@code{%
+ \advance\leftmargin\bibindent
+ \itemindent -\bibindent
+ \listparindent \itemindent
+ \parsep \z@
+ }%
+ \renewcommand\newblock{\par}}}
+
+\DeclareOption{oldfontcommands}{\@memoldfonttrue}
+\DeclareOption{extrafontsizes}{\extrafontsizestrue}
+
+\ExecuteOptions{final,letterpaper,10pt,onecolumn,openright,twoside,
+ portrait}
+\ProcessOptions*
+ \ifmemlandscape
+ \setlength\@tempdima {\stockheight}
+ \setlength\stockheight{\stockwidth}
+ \setlength\stockwidth {\@tempdima}
+ \fi
+
+\providecommand*{\bidimemoirpostopthook}{}
+ \bidimemoirpostopthook
+
+\def\cleartorecto{\clearpage\if@twoside \ifodd\c@page\else
+ \hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+\def\cleartoverso{\clearpage\if@twoside
+ \ifodd\c@page\hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+\if@openleft
+ \openleft
+\else
+ \if@openright
+ \openright
+ \else
+ \openany
+ \fi
+\fi
+
+\newcommand*{\@ivpt}{4}
+\newcommand*{\@xxxpt}{30}
+\newcommand*{\@xxxvipt}{36}
+\newcommand*{\@xlviiipt}{48}
+\newcommand*{\@lxpt}{60}
+\newcommand*{\@lxxiipt}{72}
+\newcommand*{\@lxxxivpt}{84}
+\newcommand*{\@xcvipt}{96}
+\newcommand*{\@cviiipt}{108}
+\newcommand*{\@cxxpt}{120}
+\newcommand*{\@cxxxiipt}{132}
+
+\providecommand*{\memfontfamily}{lmr}
+\providecommand*{\memfontenc}{T1}
+\providecommand*{\memfontpack}{lmodern}
+
+\if@nyptsizeopt
+ \newcommand*{\@nyptclofile}{\anyptfilebase\anyptsize.clo}
+ \IfFileExists{\@nyptclofile}{\def\@memptsize{\anyptsize}}{%
+ \@memerror{You have used the `*pt' option but \MessageBreak
+ file \@nyptclofile\space can't be found}%
+ {I'll use mem10.clo instead}
+ \renewcommand*{\@nyptclofile}{mem10.clo}%
+ \def\@memptsize{10}%
+ }
+ \renewcommand*{\@ptsize}{\@memptsize}
+ \usefont{\memfontenc}{\memfontfamily}{m}{n}
+ \input{\@nyptclofile}
+ \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc}
+\else
+ \ifextrafontsizes
+ \usefont{\memfontenc}{\memfontfamily}{m}{n}
+ \input{mem\@memptsize.clo}
+ \usepackage{\memfontpack}\usepackage[\memfontenc]{fontenc}
+ \else
+ \ifnum\@memptsize > 17\relax
+ \@memerror{The `extrafontsizes' option is required to use \MessageBreak
+ the `\@memptsize pt' option}%
+ {The 17pt option will be used instead}
+ \input{mem17.clo}
+ \else
+ \ifnum\@ptsize = 9\relax
+ \input{mem\@ptsize.clo}
+ \else
+ \input{mem1\@ptsize.clo}
+ \fi
+ \fi
+ \fi
+\fi
+
+\newcommand{\captionsize}{\normalsize}
+\setlength\lineskip{1\p@}
+\setlength\normallineskip{1\p@}
+\renewcommand{\baselinestretch}{}
+\setlength\parskip{0\p@ \@plus \p@}
+\@lowpenalty 51
+\@medpenalty 151
+\@highpenalty 301
+\clubpenalty 1000
+\widowpenalty 1000
+\newcommand*{\setlxvchars}[1][\normalfont]{\begingroup
+ #1
+ \settowidth{\lxvchars}{abcdefghijklmnopqrstuvwxyz}%
+ \setlength{\lxvchars}{2.042\lxvchars}%
+ \addtolength{\lxvchars}{33.41pt}%
+ \global\lxvchars=\lxvchars
+ \endgroup}
+\newcommand*{\setxlvchars}[1][\normalfont]{\begingroup
+ #1
+ \settowidth{\xlvchars}{abcdefghijklmnopqrstuvwxyz}%
+ \setlength{\xlvchars}{1.415\xlvchars}%
+ \addtolength{\xlvchars}{23.03pt}%
+ \global\xlvchars=\xlvchars
+ \endgroup}
+
+\newcommand*{\setrectanglesize}[3]{%
+ \nametest{#1}{*}%
+ \ifsamename % H = *
+ \nametest{#2}{*}%
+ \ifsamename % W = *
+ \@memerror{%
+ The combination of argument values is ambiguous.\MessageBreak
+ The lengths will be set to zero}{\@ehd}%
+ \setlength{\@tempdima}{0pt}%
+ \setlength{\@tempdimb}{0pt}%
+ \else % W
+ \nametest{#3}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdimb}{#2}%
+ \setlength{\@tempdima}{\@tempdimb}%
+ \else % r
+ \setlength{\@tempdimb}{#2}%
+ \setlength{\@tempdima}{#3\@tempdimb}%
+ \fi
+ \fi
+ \else % H
+ \nametest{#2}{*}%
+ \ifsamename % W = *
+ \nametest{#3}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{\@tempdima}%
+ \else % r
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#3\@tempdima}%
+ \fi
+ \else % W
+ \setlength{\@tempdima}{#1}%
+ \setlength{\@tempdimb}{#2}%
+ \fi
+ \fi}
+
+\newcommand*{\setfillsize}[5]{%
+ \nametest{#2}{*}%
+ \ifsamename % C = *
+ \nametest{#3}{*}%
+ \ifsamename % L = *
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \@memerror{%
+ The combination of argument values is ambiguous.\MessageBreak
+ The lengths will be set to zero}{\@ehd}
+ \setlength{\@tempdima}{0pt}%
+ \setlength{\@tempdimb}{0pt}%
+ \setlength{\@tempdimc}{0pt}%
+ \else % R
+ \nametest{#5}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdima}{\@tempdimb}%
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \else % r
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdima}{#5\@tempdimb}%
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \fi
+ \fi
+ \else % L
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \nametest{#5}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{\@tempdima}
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \else % r
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#5\@tempdima}
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \fi
+ \else % R
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdimc}{#1}%
+ \advance\@tempdimc -\@tempdima
+ \advance\@tempdimc -\@tempdimb
+ \fi
+ \fi
+ \else % C is valued
+ \nametest{#3}{*}%
+ \ifsamename % L = *
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \nametest{#5}{*}%
+ \ifsamename % r = *
+ \setlength{\@tempdimc}{#2}%
+ \setlength{\@tempdima}{#1}%
+ \advance\@tempdima -\@tempdimc
+ \@tempdima = 0.5\@tempdima
+ \@tempdimb = \@tempdima
+ \else % r (CODE PERHAPS FIXED)
+ \setlength{\@tempdimc}{#2} % C
+ \setlength{\@tempdimb}{#1} % T
+ \advance\@tempdimb -\@tempdimc % T - C
+ \@tempdima = 1000sp
+ \setlength{\@tempdima}{#5\@tempdima} % 1000r sp
+ \advance\@tempdima by 1000sp % 1000(1+r)sp
+ \@tempcnta = \@tempdima % 1000(1+r)
+ \@tempdima = \@tempdimb % T - C
+ \divide\@tempdima by \@tempcnta % (T-C)/1000(1+r) pts
+ \@tempdima = 1000\@tempdima % (T-C)/(1+r) pts = L
+ \advance\@tempdimb by -\@tempdima % = R
+ \fi
+ \else % R
+ \setlength{\@tempdimc}{#2}%
+ \setlength{\@tempdimb}{#4}%
+ \setlength{\@tempdima}{#1}%
+ \advance\@tempdima -\@tempdimc
+ \advance\@tempdima -\@tempdimb
+ \fi
+ \else % L
+ \nametest{#4}{*}%
+ \ifsamename % R = *
+ \setlength{\@tempdimc}{#2}%
+ \setlength{\@tempdima}{#3}%
+ \setlength{\@tempdimb}{#1}%
+ \advance\@tempdimb -\@tempdimc
+ \advance\@tempdimb -\@tempdima
+ \else % R
+ \@memerror{%
+ The combination of argument values is ambiguous.\MessageBreak
+ The lengths will be set to zero}{\@ehd}%
+ \setlength{\@tempdima}{0pt}%
+ \setlength{\@tempdimb}{0pt}%
+ \setlength{\@tempdimc}{#2}%
+ \fi
+ \fi
+ \fi}
+
+\newcommand{\setstocksize}[2]{%
+ \setlength{\stockheight}{#1}%
+ \setlength{\stockwidth}{#2}}
+\newcommand{\settrims}[2]{%
+ \setlength{\trimtop}{#1}%
+ \setlength{\trimedge}{#2}}
+\newcommand{\settrimmedsize}[3]{%
+ \setrectanglesize{#1}{#2}{#3}%
+ \setlength{\paperheight}{\@tempdima}%
+ \setlength{\paperwidth}{\@tempdimb}}
+
+\newcommand{\settypeblocksize}[3]{%
+ \setrectanglesize{#1}{#2}{#3}%
+ \setlength{\textheight}{\@tempdima}%
+ \setlength{\textwidth}{\@tempdimb}}
+
+\newlength{\binding}
+\newcommand*{\setbinding}[1]{\setlength{\binding}{#1}}
+ \setbinding{0pt}
+
+\newlength{\spinemargin}
+\newlength{\foremargin}
+\newcommand{\setlrmargins}[3]{%
+ \advance\paperwidth -\binding
+ \setfillsize{\paperwidth}{\textwidth}{#1}{#2}{#3}%
+ \setlength{\textwidth}{\@tempdimc}%
+ \setlength{\spinemargin}{\@tempdima}%
+ \setlength{\foremargin}{\@tempdimb}%
+ \advance\paperwidth \binding
+ \advance\spinemargin \binding}
+
+\newcommand{\setlrmarginsandblock}[3]{%
+ \advance\paperwidth -\binding
+ \setfillsize{\paperwidth}{*}{#1}{#2}{#3}%
+ \setlength{\textwidth}{\@tempdimc}%
+ \setlength{\spinemargin}{\@tempdima}%
+ \setlength{\foremargin}{\@tempdimb}%
+ \advance\paperwidth \binding
+ \advance\spinemargin \binding}
+
+\newlength{\uppermargin}
+\newlength{\lowermargin}
+\newcommand{\setulmargins}[3]{%
+ \setfillsize{\paperheight}{\textheight}{#1}{#2}{#3}%
+ \setlength{\textheight}{\@tempdimc}%
+ \setlength{\uppermargin}{\@tempdima}%
+ \setlength{\lowermargin}{\@tempdimb}}
+
+\newcommand{\setulmarginsandblock}[3]{%
+ \setfillsize{\paperheight}{*}{#1}{#2}{#3}%
+ \setlength{\textheight}{\@tempdimc}%
+ \setlength{\uppermargin}{\@tempdima}%
+ \setlength{\lowermargin}{\@tempdimb}}
+
+\newlength{\headdrop}
+\newcommand{\setheaderspaces}[3]{%
+ \setfillsize{\uppermargin}{\headheight}{#1}{#2}{#3}%
+ \setlength{\headheight}{\@tempdimc}%
+ \setlength{\headdrop}{\@tempdima}%
+ \setlength{\headsep}{\@tempdimb}}
+
+\newcommand{\setheadfoot}[2]{%
+ \setlength{\headheight}{#1}%
+ \setlength{\footskip}{#2}}
+
+\newcommand{\setcolsepandrule}[2]{%
+ \setlength{\columnsep}{#1}%
+ \setlength{\columnseprule}{#2}}
+
+\newcommand{\setmarginnotes}[3]{%
+ \setlength{\marginparsep}{#1}%
+ \setlength{\marginparwidth}{#2}%
+ \setlength{\marginparpush}{#3}}
+
+\settrimmedsize{\stockheight}{\stockwidth}{*}
+\settrims{\z@}{\z@}
+
+\setlength{\@tempdimb}{1.14\lxvchars}
+\setlength\@tempdima{\paperwidth}
+ \addtolength\@tempdima{-2in}
+\if@twocolumn
+ \ifdim\@tempdima>2\@tempdimb\relax
+ \setlength\textwidth{2\@tempdimb}
+ \else
+ \setlength\textwidth{\@tempdima}
+ \fi
+\else
+ \ifdim\@tempdima>\@tempdimb\relax
+ \setlength\textwidth{\@tempdimb}
+ \else
+ \setlength\textwidth{\@tempdima}
+ \fi
+\fi
+\@settopoint\textwidth
+
+\setlength\@tempdima{\paperheight}
+ \addtolength\@tempdima{-3.5in}
+ \divide\@tempdima\baselineskip
+\@tempcnta=\@tempdima
+\setlength\textheight{\@tempcnta\baselineskip}
+ \addtolength\textheight{\topskip}
+
+\if@twoside
+ \setlength\@tempdima {\paperwidth}
+ \addtolength\@tempdima {-\textwidth}
+ \setlength\oddsidemargin {.4\@tempdima}
+ \addtolength\oddsidemargin {-1in}
+ \setlength\marginparwidth {.6\@tempdima}
+ \addtolength\marginparwidth{-\marginparsep}
+ \addtolength\marginparwidth{-0.4in}
+\else
+ \setlength\@tempdima {\paperwidth}
+ \addtolength\@tempdima {-\textwidth}
+ \setlength\oddsidemargin {.5\@tempdima}
+ \addtolength\oddsidemargin {-1in}
+ \setlength\marginparwidth {.5\@tempdima}
+ \addtolength\marginparwidth{-\marginparsep}
+ \addtolength\marginparwidth{-0.8in} % don't know why this isn't .4
+\fi
+\ifdim\marginparwidth>2in
+ \setlength\marginparwidth{2in}%
+\fi
+\@settopoint\oddsidemargin
+\@settopoint\marginparwidth
+\ifdim\marginparwidth<1pt \setlength\marginparwidth{1pt}\fi
+
+\setlength\evensidemargin {\paperwidth}
+\addtolength\evensidemargin{-2in}
+\addtolength\evensidemargin{-\textwidth}
+\addtolength\evensidemargin{-\oddsidemargin}
+\@settopoint\evensidemargin
+\setlength\topmargin {\paperheight}
+\addtolength\topmargin{-2in}
+\addtolength\topmargin{-\headheight}
+\addtolength\topmargin{-\headsep}
+\addtolength\topmargin{-\textheight}
+\addtolength\topmargin{-\footskip}
+\addtolength\topmargin{-.5\topmargin}
+\@settopoint\topmargin
+
+\setlength{\spinemargin}{\oddsidemargin}
+\addtolength{\spinemargin}{1in}
+\setlrmargins{\spinemargin}{*}{*}
+
+\setlength{\uppermargin}{\topmargin}
+\addtolength{\uppermargin}{1in}
+\addtolength{\uppermargin}{\headheight}
+\addtolength{\uppermargin}{\headsep}
+\setulmargins{\uppermargin}{*}{*}
+
+\newcommand*{\@memznegtest}[1]{%
+ \ifdim#1>\z@\else
+ %%%% \@memerror{\protect#1\space is zero or negative}{\@ehd}%
+ \@memwarn{\protect#1\space is zero or negative}%
+ \fi}
+\newcommand*{\@memnegtest}[1]{%
+ \ifdim#1<\z@
+%%%% \@memerror{\protect#1\space is negative}{\@ehd}%
+ \@memwarn{\protect#1\space is negative}%
+ \fi}
+
+\newcommand*{\m@mclassicht}{%
+ \setlength{\@tempdima}{\textheight}%
+ \divide\@tempdima \baselineskip
+ \@tempcnta=\@tempdima
+ \setlength{\textheight}{\@tempcnta\baselineskip}%
+ \addtolength{\textheight}{\topskip}}
+
+\newcommand*{\m@mlinesht}{%
+ \setlength{\@tempdima}{\textheight}%
+ \advance\@tempdima -\baselineskip
+ \divide\@tempdima \baselineskip
+ \@tempcnta=\@tempdima
+ \setlength{\textheight}{\@tempcnta\baselineskip}%
+ \addtolength{\textheight}{\topskip}}
+
+\newcommand*{\m@mnearestht}{%
+ \setlength{\@tempdima}{\textheight}%
+ \advance\@tempdima -\topskip
+ \advance\@tempdima 0.5\baselineskip
+ \divide\@tempdima \baselineskip
+ \@tempcnta=\@tempdima
+ \setlength{\textheight}{\@tempcnta\baselineskip}%
+ \addtolength{\textheight}{\topskip}}
+
+\newcommand*{\checkthelayout}[1][classic]{%
+ \@memnegtest{\trimedge}
+ \@memnegtest{\trimtop}
+ \@memznegtest{\stockwidth}
+ \@memznegtest{\paperwidth}
+ \@memznegtest{\textwidth}
+%%% \@memznegtest{\spinemargin}
+ \@memnegtest{\spinemargin}
+%%% \@memznegtest{\foremargin}
+ \@memnegtest{\foremargin}
+ \@memznegtest{\marginparsep}
+ \@memznegtest{\marginparwidth}
+ \@memznegtest{\stockheight}
+ \@memznegtest{\paperheight}
+ \@memznegtest{\textheight}
+%%% \@memznegtest{\uppermargin}
+ \@memnegtest{\uppermargin}
+%%% \@memznegtest{\lowermargin}
+ \@memnegtest{\lowermargin}
+%%% \@memznegtest{\headheight}
+ \@memnegtest{\headheight}
+%%% \@memznegtest{\headsep}
+ \@memnegtest{\headsep}
+%%% \@memznegtest{\footskip}
+ \@memnegtest{\footskip}
+ \nametest{#1}{classic}%
+ \ifsamename
+ \m@mclassicht
+ \else
+ \nametest{#1}{lines}%
+ \ifsamename
+ \m@mlinesht
+ \else
+ \nametest{#1}{nearest}%
+ \ifsamename
+ \m@mnearestht
+ \else
+ \nametest{#1}{fixed}
+ \ifsamename
+ \else% not classic, lines, nearest, or fixed
+ \@memerror{Optional argument is not one of:\MessageBreak
+ classic, fixed, lines, or nearest. \MessageBreak
+ I will assume the default}%
+ {\@ehc}%
+ \fi
+ \fi
+ \fi
+ \fi
+ \setulmargins{\uppermargin}{*}{*}
+ \@tempdimb = -1pt
+ \@tempdima=\stockwidth
+ \advance\@tempdima -\trimedge
+ \advance\@tempdima -\paperwidth
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\paperwidth\space (\the\paperwidth) and/or
+ \protect\trimedge\space (\the\trimedge)
+ are too large for \protect\stockwidth\space (\the\stockwidth)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \paperwidth
+ \advance\@tempdima -\foremargin
+ \advance\@tempdima -\textwidth
+ \advance\@tempdima -\spinemargin
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\spinemargin\space (\the\spinemargin) and/or
+ \protect\textwidth\space (\the\textwidth) and/or
+ \protect\foremargin\space (\the\foremargin)
+ are too large for \protect\paperwidth\space (\the\paperwidth)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \stockheight
+ \advance\@tempdima -\trimtop
+ \advance\@tempdima -\paperheight
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\paperheight\space (\the\paperheight) and/or
+ \protect\trimtop\space (\the\trimtop)
+ are too large for \protect\stockheight\space (\the\stockheight)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \paperheight
+ \advance\@tempdima -\uppermargin
+ \advance\@tempdima -\textheight
+ \advance\@tempdima -\lowermargin
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\uppermargin\space (\the\uppermargin) and/or
+ \protect\textheight\space (\the\textheight) and/or
+ \protect\lowermargin\space (\the\lowermargin)
+ are too large for \protect\paperheight\space (\the\paperheight)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \uppermargin
+ \advance\@tempdima -\headheight
+ \advance\@tempdima -\headsep
+ \ifdim\@tempdima<\@tempdimb
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\headheight\space (\the\headheight) and/or
+ \protect\headsep\space (\the\headsep)
+ are too large for \protect\uppermargin\space (\the\uppermargin)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi
+ \@tempdima = \lowermargin
+ \advance\@tempdima -\footskip
+ \ifdim\@tempdima<\z@
+ \@tempdima = -\@tempdima
+ \@memerror{\protect\footskip\space (\the\footskip)
+ is too large for \protect\lowermargin\space (\the\lowermargin)
+ by \the\@tempdima}%
+ {\@ehd}
+ \fi}
+
+\newcommand*{\fixthelayout}{%
+ \topmargin = \trimtop
+ \advance\topmargin \uppermargin
+ \advance\topmargin -\headsep
+ \advance\topmargin -\headheight
+ \advance\topmargin -1in\relax
+ \oddsidemargin = \stockwidth
+ \advance\oddsidemargin -\trimedge
+ \advance\oddsidemargin -\paperwidth
+ \advance\oddsidemargin \spinemargin
+ \advance\oddsidemargin -1in\relax
+ \evensidemargin = \trimedge
+ \advance\evensidemargin \foremargin
+ \advance\evensidemargin -1in\relax
+ \@settopoint\textwidth
+ \@settopoint\oddsidemargin
+ \@settopoint\evensidemargin}
+
+\newcommand*{\typeoutlayout}{%
+ \typeout{}
+ \typeout{******************************************************}
+ \typeout{Stock height and width:
+ \the\stockheight\space by \the\stockwidth}
+ \typeout{Top and edge trims:
+ \the\trimtop\space and \the\trimedge}
+ \typeout{Page height and width:
+ \the\paperheight\space by \the\paperwidth}
+ \typeout{Text height and width:
+ \the\textheight\space by \the\textwidth}
+ \typeout{Spine and edge margins:
+ \the\spinemargin\space and \the\foremargin}
+ \typeout{Upper and lower margins:
+ \the\uppermargin\space and \the\lowermargin}
+ \typeout{Headheight and headsep:
+ \the\headheight\space and \the\headsep}
+ \typeout{Footskip:
+ \the\footskip}
+ \typeout{Columnsep and columnseprule:
+ \the\columnsep\space and \the\columnseprule}
+ \typeout{Marginparsep and marginparwidth:
+ \the\marginparsep\space and \the\marginparwidth}
+ \typeout{Sidecapsep and sidecapwidth:
+ \the\sidecapsep\space and \the\sidecapwidth}
+ \typeout{Sidebarhsep and sidebarwidth:
+ \the\sidebarhsep\space and \the\sidebarwidth}
+ \typeout{Sidebarvsep and sidebartopsep:
+ \the\sidebarvsep\space and \the\sidebartopsep}
+ \typeout{Sidebarheight:
+ \the\dimen\sideins}
+ \typeout{******************************************************}
+ \typeout{}}
+
+\newcommand*{\checkandfixthelayout}[1][classic]{%
+ \checkthelayout[#1]%
+ \fixthelayout
+ \typeoutlayout}
+
+\newcommand*{\fixpdflayout}{%
+ \pdfpageheight=\the\stockheight
+ \pdfpagewidth=\the\stockwidth
+ \ifdim\pdfvorigin=0pt\pdfvorigin=1in\fi
+ \ifdim\pdfhorigin=0pt\pdfhorigin=1in\fi}
+\newcommand*{\fixdvipslayout}{%
+ \AtBeginDvi{\special{papersize=\the\stockwidth,\the\stockheight}}}
+
+\AtBeginDocument{%
+ \ifpdf
+ \ifnum\pdfoutput<\@ne
+ \fixdvipslayout
+ \else
+ \fixpdflayout
+ \fi
+ \else
+ \fixdvipslayout
+ \fi}
+
+\newcommand{\typeoutstandardlayout}{%
+ \typeout{}
+ \typeout{******************************************************}
+ \typeout{Page height and width:
+ \the\paperheight\space by \the\paperwidth}
+ \typeout{Text height and width:
+ \the\textheight\space by \the\textwidth}
+ \typeout{Oddside and evenside margins:
+ \the\oddsidemargin\space and \the\evensidemargin}
+ \typeout{Topmargin and footskip:
+ \the\topmargin\space and \the\footskip}
+ \typeout{Headheight and headsep:
+ \the\headheight\space and \the\headsep}
+ \typeout{Columnsep and columnseprule:
+ \the\columnsep\space and \the\columnseprule}
+ \typeout{Marginparsep and marginparwidth:
+ \the\marginparsep\space and \the\marginparwidth}
+ \typeout{******************************************************}
+ \typeout{}
+}
+
+%%%% s = w/#1, t = 1.5s, e = 2s, f = 3s
+\newcommand*{\medievalpage}[1][9]{%
+ \spinemargin=\paperwidth
+ \divide\spinemargin #1\relax
+ \uppermargin = 1.5\spinemargin
+ \setlrmarginsandblock{\spinemargin}{*}{2}
+ \setulmarginsandblock{\uppermargin}{*}{2}}
+
+\newcommand*{\isopage}[1][9]{%
+ \spinemargin=\paperwidth
+ \divide\spinemargin #1\relax
+ \uppermargin=\paperheight
+ \divide\uppermargin #1\relax
+ \setlrmarginsandblock{\spinemargin}{*}{2}
+ \setulmarginsandblock{\uppermargin}{*}{2}}
+
+%%% s = w/#1, t = s, e = 2s, f = e
+\newcommand*{\semiisopage}[1][9]{%
+ \spinemargin=\paperwidth
+ \divide\spinemargin #1\relax
+ \uppermargin=\spinemargin
+ \setlrmarginsandblock{\spinemargin}{*}{2}
+ \setulmarginsandblock{\uppermargin}{*}{2}}
+
+\newcommand*{\setpagebl}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth}
+\newcommand*{\setpageml}[3]{%
+ \settrimmedsize{#1}{#2}{#3}
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \advance\trimtop -0.5\trimtop
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth}
+\newcommand*{\setpagetl}[3]{%
+ \settrimmedsize{#1}{#2}{#3}
+ \trimtop=0pt
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth}
+\newcommand*{\setpagetm}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=0pt
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth
+ \advance\trimedge -0.5\trimedge}
+
+\newcommand*{\setpagetr}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=0pt
+ \trimedge=0pt}
+\newcommand*{\setpagemr}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \advance\trimtop -0.5\trimtop
+ \trimedge=0pt}
+\newcommand*{\setpagebr}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \trimedge=0pt}
+\newcommand*{\setpagebm}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth
+ \advance\trimedge -0.5\trimedge}
+\newcommand*{\setpagecc}[3]{%
+ \settrimmedsize{#1}{#2}{#3}%
+ \trimtop=\stockheight \advance\trimtop -\paperheight
+ \advance\trimtop -0.5\trimtop
+ \trimedge=\stockwidth \advance\trimedge -\paperwidth
+ \advance\trimedge -0.5\trimedge}
+
+\setcounter{topnumber}{3}
+\renewcommand{\topfraction}{.85}
+\setcounter{bottomnumber}{2}
+\renewcommand{\bottomfraction}{.5}
+\setcounter{totalnumber}{4}
+\renewcommand{\textfraction}{.1}
+\renewcommand{\floatpagefraction}{.7}
+\setcounter{dbltopnumber}{3}
+\renewcommand{\dbltopfraction}{.85}
+\renewcommand{\dblfloatpagefraction}{.7}
+\newcommand{\makeevenhead}[4]{%
+ \@namedef{#1eheadl}{#2}
+ \@namedef{#1eheadc}{#3}
+ \@namedef{#1eheadr}{#4}
+}
+\newcommand{\makeoddhead}[4]{%
+ \@namedef{#1oheadl}{#2}
+ \@namedef{#1oheadc}{#3}
+ \@namedef{#1oheadr}{#4}
+}
+\newcommand{\makeevenfoot}[4]{%
+ \@namedef{#1efootl}{#2}
+ \@namedef{#1efootc}{#3}
+ \@namedef{#1efootr}{#4}
+}
+\newcommand{\makeoddfoot}[4]{%
+ \@namedef{#1ofootl}{#2}
+ \@namedef{#1ofootc}{#3}
+ \@namedef{#1ofootr}{#4}
+}
+
+\newcommand*{\makerunningwidth}[1]{%
+ \def\m@mhfstyle{#1}%
+ \m@mopthfwidth}
+\newcommand*{\m@mopthfwidth}[2][\@mpty]{%
+ \@namedef{\m@mhfstyle headrunwidth}{#2}%
+ \ifx\@mpty #1
+ \@namedef{\m@mhfstyle footrunwidth}{#2}%
+ \else
+ \@namedef{\m@mhfstyle footrunwidth}{#1}%
+ \fi}
+\newcommand*{\makerunningheadwidth}[2]{%
+ \@namedef{#1headrunwidth}{#2}%
+}
+\newcommand*{\makerunningfootwidth}[2]{%
+ \@namedef{#1footrunwidth}{#2}%
+}
+
+\newlength{\normalrulethickness}
+ \setlength{\normalrulethickness}{0.4pt}
+\newcommand{\footruleheight}{0pt}
+\newcommand{\footruleskip}{0.3\normalbaselineskip}
+\newcommand{\makeheadrule}[3]{%
+ \@namedef{#1headrule}{%
+ \hrule\@width #2\@height #3 \vskip-#3}}
+\newcommand{\makefootrule}[4]{%
+ \@namedef{#1footrule}{%
+ \vskip-#4\vskip-#3
+ \hrule\@width #2\@height #3 \vskip #4}}
+
+\newcommand{\makeheadposition}[5]{%
+ \nametest{flushleft}{#2}
+ \ifsamename
+ \@namedef{#1evenhpl}{\relax} \@namedef{#1evenhpr}{\hss}
+ \else
+ \nametest{flushright}{#2}
+ \ifsamename
+ \@namedef{#1evenhpl}{\hss} \@namedef{#1evenhpr}{\relax}
+ \else
+ \@namedef{#1evenhpl}{\hss} \@namedef{#1evenhpr}{\hss}
+ \fi
+ \fi
+ \nametest{flushleft}{#3}
+ \ifsamename
+ \@namedef{#1oddhpl}{\relax} \@namedef{#1oddhpr}{\hss}
+ \else
+ \nametest{flushright}{#3}
+ \ifsamename
+ \@namedef{#1oddhpl}{\hss} \@namedef{#1oddhpr}{\relax}
+ \else
+ \@namedef{#1oddhpl}{\hss} \@namedef{#1oddhpr}{\hss}
+ \fi
+ \fi
+ \nametest{flushleft}{#4}
+ \ifsamename
+ \@namedef{#1evenfpl}{\relax} \@namedef{#1evenfpr}{\hss}
+ \else
+ \nametest{flushright}{#4}
+ \ifsamename
+ \@namedef{#1evenfpl}{\hss} \@namedef{#1evenfpr}{\relax}
+ \else
+ \@namedef{#1evenfpl}{\hss} \@namedef{#1evenfpr}{\hss}
+ \fi
+ \fi
+ \nametest{flushleft}{#5}
+ \ifsamename
+ \@namedef{#1oddfpl}{\relax} \@namedef{#1oddfpr}{\hss}
+ \else
+ \nametest{flushright}{#5}
+ \ifsamename
+ \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\relax}
+ \else
+ \@namedef{#1oddfpl}{\hss} \@namedef{#1oddfpr}{\hss}
+ \fi
+ \fi}
+
+\newcommand{\makepsmarks}[2]{\@namedef{#1pshook}{#2}}
+
+\newcommand*{\m@mhe@dreset}{\def\baselinestretch{1}\normalsize}
+
+\newcommand*\makeheadfootvposition[3]{%
+ \@namedef{#1headvplacement}{#2}\@namedef{#1footvplacement}{#3}}
+
+\newcommand{\makepagestyle}[1]{%
+ \@namedef{ps@#1}{%
+ \@namedef{#1@evenhead}{%
+ \@nameuse{#1evenhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
+ \vbox{\hbox{%
+ \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedright\@nameuse{#1eheadl}\strut}}\hfill
+ \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \centering\@nameuse{#1eheadc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedleft\@nameuse{#1eheadr}\strut}}}%
+ \@nameuse{#1headrule}}}\@nameuse{#1evenhpr}}%
+ \@namedef{#1@oddhead}{%
+ \@nameuse{#1oddhpl}\hb@xt@\@nameuse{#1headrunwidth}{\m@mhe@dreset%
+ \vbox{\hbox{%
+ \rlap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedright\@nameuse{#1oheadl}\strut}}\hfill
+ \parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \centering\@nameuse{#1oheadc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1headvplacement}]{\@nameuse{#1headrunwidth}}{%
+ \raggedleft\@nameuse{#1oheadr}\strut}}}%
+ \@nameuse{#1headrule}}}\@nameuse{#1oddhpr}}%
+ \@namedef{#1@evenfoot}{%
+ \@nameuse{#1evenfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
+ \vbox{\@nameuse{#1footrule}\hbox{%
+ \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedright\@nameuse{#1efootl}\strut}}\hfill
+ \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \centering\@nameuse{#1efootc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedleft\@nameuse{#1efootr}\strut}}}%
+ }}\@nameuse{#1evenfpr}}%
+ \@namedef{#1@oddfoot}{%
+ \@nameuse{#1oddfpl}\hb@xt@\@nameuse{#1footrunwidth}{\m@mhe@dreset%
+ \vbox{\@nameuse{#1footrule}\hbox{%
+ \rlap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedright\@nameuse{#1ofootl}\strut}}\hfill
+ \parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \centering\@nameuse{#1ofootc}\strut}\hfill
+ \llap{\parbox[\@nameuse{#1footvplacement}]{\@nameuse{#1footrunwidth}}{%
+ \raggedleft\@nameuse{#1ofootr}\strut}}}%
+ }}\@nameuse{#1oddfpr}}%
+ \def\@evenhead{\@nameuse{#1@evenhead}}%
+ \def\@oddhead{\@nameuse{#1@oddhead}}%
+ \def\@evenfoot{\@nameuse{#1@evenfoot}}%
+ \def\@oddfoot{\@nameuse{#1@oddfoot}}%
+ \@nameuse{#1pshook}}%
+ \makeevenhead{#1}{}{}{}%
+ \makeoddhead{#1}{}{}{}%
+ \makeevenfoot{#1}{}{}{}%
+ \makeoddfoot{#1}{}{}{}%
+ \makerunningwidth{#1}{\textwidth}%
+ \makeheadposition{#1}{}{}{}{}%
+ \makeheadrule{#1}{\textwidth}{0pt}%
+ \makefootrule{#1}{\textwidth}{\footruleheight}{\footruleskip}%
+ \makeheadfootvposition{#1}{b}{b}%
+ \makepsmarks{#1}{}}
+
+\newcommand{\aliaspagestyle}[2]{%
+ \@namedef{ps@#1}{\@nameuse{ps@#2}}}
+
+\newcommand{\copypagestyle}[2]{%
+ \makepagestyle{#1}%
+ \makeevenhead{#1}{\@nameuse{#2eheadl}}%
+ {\@nameuse{#2eheadc}}{\@nameuse{#2eheadr}}%
+ \makeoddhead{#1}{\@nameuse{#2oheadl}}%
+ {\@nameuse{#2oheadc}}{\@nameuse{#2oheadr}}%
+ \makeevenfoot{#1}{\@nameuse{#2efootl}}%
+ {\@nameuse{#2efootc}}{\@nameuse{#2efootr}}%
+ \makeoddfoot{#1}{\@nameuse{#2ofootl}}%
+ {\@nameuse{#2ofootc}}{\@nameuse{#2ofootr}}%
+ \makerunningwidth{#1}[\@nameuse{#2footrunwidth}]{\@nameuse{#2headrunwidth}}%
+ \@namedef{#1evenhpl}{\@nameuse{#2evenhpl}}%
+ \@namedef{#1oddhpl}{\@nameuse{#2oddhpl}}%
+ \@namedef{#1evenhpr}{\@nameuse{#2evenhpr}}%
+ \@namedef{#1oddhpr}{\@nameuse{#2oddhpr}}%
+ \makeheadfootvposition{#1}{\@nameuse{#2headvplacement}}{\@nameuse{#2footvplacement}}%
+ \@namedef{#1evenfpl}{\@nameuse{#2evenfpl}}%
+ \@namedef{#1oddfpl}{\@nameuse{#2oddfpl}}%
+ \@namedef{#1evenfpr}{\@nameuse{#2evenfpr}}%
+ \@namedef{#1oddfpr}{\@nameuse{#2oddfpr}}%
+ \@namedef{#1headrule}{\@nameuse{#2headrule}}%
+ \@namedef{#1footrule}{\@nameuse{#2footrule}}%
+ \makepsmarks{#1}{\@nameuse{#2pshook}}}
+
+\newcommand{\ifonlyfloats}[2]{\if@fcolmade #1\else #2\fi}
+
+\newcommand{\mergepagefloatstyle}[3]{%
+ \@nameuse{ps@#3}\@nameuse{ps@#2}%
+ \@namedef{ps@#1}{%
+ \def\@evenhead{\ifonlyfloats{\@nameuse{#3@evenhead}}%
+ {\@nameuse{#2@evenhead}}}%
+ \def\@oddhead{\ifonlyfloats{\@nameuse{#3@oddhead}}%
+ {\@nameuse{#2@oddhead}}}%
+ \def\@evenfoot{\ifonlyfloats{\@nameuse{#3@evenfoot}}%
+ {\@nameuse{#2@evenfoot}}}%
+ \def\@oddfoot{\ifonlyfloats{\@nameuse{#3@oddfoot}}%
+ {\@nameuse{#2@oddfoot}}}%
+ \@namedef{#1pshook}{\@nameuse{#2pshook}}%
+}}
+
+\makepagestyle{empty}
+
+\makepagestyle{plain}
+ \makeevenfoot{plain}{}{\thepage}{}
+ \makeoddfoot{plain}{}{\thepage}{}
+
+\newcommand*{\nouppercaseheads}{\let\memUChead\relax}
+\newcommand*{\uppercaseheads}{\let\memUChead\MakeUppercase}
+\uppercaseheads
+
+\newcommand*{\createplainmark}[3]{%
+ \nametest{#2}{left}%
+ \ifsamename
+ \@namedef{#1mark}{\markboth{\memUChead{#3}}{}}%
+ \else
+ \nametest{#2}{right}%
+ \ifsamename
+ \@namedef{#1mark}{\markright{\memUChead{#3}}}%
+ \else
+ \nametest{#2}{both}%
+ \ifsamename\else
+ \@memerror{%
+ Unknown mark setting type `#2' for #1mark}{%
+ I expected `left', `both' or `right'. \MessageBreak
+ I will assume you meant `both'}%
+ \fi
+ \@namedef{#1mark}{\markboth{\memUChead{#3}}{\memUChead{#3}}}%
+ \fi
+ \fi}
+
+\newcommand\createmark[5]{%
+ \def\@tempa{00}
+ \nametest{#3}{nonumber}%
+ \ifsamename
+ \def\@tempa{01}%
+ \else
+ \nametest{#3}{shownumber}
+ \ifsamename\else
+ \@memerror{Unknown numbering value `#3' for #1mark}%
+ {I expected `shownumber' or `nonumber'.\MessageBreak
+ I will assume you meant `shownumber'}%
+ \fi
+ \fi
+ \expandafter\if\@tempa% compares the two \@tempa digits
+ \@namedef{#1marksn}##1{##1}%
+ \else
+ \@namedef{#1marksn}{\@gobble}%
+ \fi
+ \nametest{#2}{left}%
+ \ifsamename
+ \@namedef{#1mark}##1{%
+ \@setclcnt{#1}{@memmarkcntra}%
+ \advance\c@@memmarkcntra\m@ne
+ \markboth{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi
+ \fi
+ ##1}}{}}%
+ \else
+ \nametest{#2}{right}
+ \ifsamename
+ \@namedef{#1mark}##1{%
+ \@setclcnt{#1}{@memmarkcntra}
+ \advance\c@@memmarkcntra\m@ne
+ \markright{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter%
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi%
+ \fi%
+ ##1}}}%
+ \else
+ \nametest{#2}{both}%
+ \ifsamename\else
+ \@memerror{%
+ Unknown mark setting type `#2' for #1mark}{%
+ I expected `left', `both' or `right'. \MessageBreak
+ I will assume you meant `both'}%
+ \fi
+ \@namedef{#1mark}##1{%
+ \@setclcnt{#1}{@memmarkcntra}
+ \advance\c@@memmarkcntra\m@ne
+ \markboth{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi
+ \fi
+ ##1}}{%
+ \memUChead{%
+ \ifnum \c@secnumdepth > \c@@memmarkcntra
+ \if@mainmatter
+ \@nameuse{#1marksn}{#4\@nameuse{the#1}#5}%
+ \fi
+ \fi
+ ##1}}}%
+ \fi
+ \fi}
+
+\newcommand\addtopsmarks[3]{%
+ \expandafter\addtodef\expandafter{\csname #1pshook\endcsname}{#2}{#3}}
+\if@twoside
+ \makepagestyle{headings}
+ \makepsmarks{headings}{%
+ \def\chaptermark##1{%
+ \markboth{\memUChead{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \@chapapp\ \thechapter. \ %
+ \fi
+ \fi
+ ##1}}{}}%
+ \def\tocmark{\markboth{\memUChead{\contentsname}}{\memUChead{\contentsname}}}%
+ \def\lofmark{\markboth{\memUChead{\listfigurename}}{\memUChead{\listfigurename}}}%
+ \def\lotmark{\markboth{\memUChead{\listtablename}}{\memUChead{\listtablename}}}%
+ \def\bibmark{\markboth{\memUChead{\bibname}}{\memUChead{\bibname}}}%
+ \def\indexmark{\markboth{\memUChead{\indexname}}{\memUChead{\indexname}}}%
+ \def\sectionmark##1{%
+ \markright{\memUChead{%
+ \ifnum \c@secnumdepth > \z@
+ \thesection. \ %
+ \fi
+ ##1}}}}
+ \makepsmarks{headings}{%
+ \createmark{chapter}{left}{shownumber}{\@chapapp\ }{. \ }
+ \createmark{section}{right}{shownumber}{}{. \ }
+ \createplainmark{toc}{both}{\contentsname}
+ \createplainmark{lof}{both}{\listfigurename}
+ \createplainmark{lot}{both}{\listtablename}
+ \createplainmark{bib}{both}{\bibname}
+ \createplainmark{index}{both}{\indexname}
+ \createplainmark{glossary}{both}{\glossaryname}
+ }
+ \makeevenhead{headings}{\thepage}{}{\slshape\leftmark}
+ \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
+\else
+ \makepagestyle{headings}
+ \makepsmarks{headings}{%
+ \def\chaptermark##1{%
+ \markright{\memUChead{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \@chapapp\ \thechapter. \ %
+ \fi
+ \fi
+ ##1}}}%
+ \def\tocmark{\markright{\memUChead{\contentsname}}}%
+ \def\lofmark{\markright{\memUChead{\listfigurename}}}%
+ \def\lotmark{\markright{\memUChead{\listtablename}}}%
+ \def\bibmark{\markright{\memUChead{\bibname}}}%
+ \def\indexmark{\markright{\memUChead{\indexname}}}}
+ \makepsmarks{headings}{%
+ \createmark{chapter}{right}{shownumber}{\@chapapp\ }{. \ }
+ \createplainmark{toc}{right}{\contentsname}
+ \createplainmark{lof}{right}{\listfigurename}
+ \createplainmark{lot}{right}{\listtablename}
+ \createplainmark{bib}{right}{\bibname}
+ \createplainmark{index}{right}{\indexname}
+ \createplainmark{glossary}{right}{\glossaryname}
+ }
+ \makeoddhead{headings}{\slshape\rightmark}{}{\thepage}
+\fi
+
+\makepagestyle{myheadings}
+ \makepsmarks{myheadings}{%
+ \let\chaptermark\@gobble
+ \let\sectionmark\@gobble
+ \def\tocmark{}%
+ \def\lofmark{}%
+ \def\lotmark{}%
+ \def\bibmark{}%
+ \def\indexmark{}%
+ \def\glossarymark{}}
+ \makeevenhead{myheadings}{\thepage}{}{\slshape\leftmark}
+ \makeoddhead{myheadings}{\slshape\rightmark}{}{\thepage}
+
+\aliaspagestyle{chapter}{plain}
+\aliaspagestyle{part}{plain}
+\aliaspagestyle{cleared}{empty}
+
+\def\cleardoublepage{\clearpage\if@twoside \ifodd\c@page\else
+ \hbox{}\thispagestyle{cleared}%
+ \newpage\if@twocolumn\hbox{}\newpage\fi\fi\fi}
+
+\makepagestyle{ruled}
+\makeevenfoot{ruled}{\thepage}{}{}
+\makeoddfoot{ruled}{}{}{\thepage}
+\makeheadrule{ruled}{\textwidth}{\normalrulethickness}
+\newcommand{\@ruledmarks}{%
+ \def\chaptermark##1{%
+ \markboth{%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \thechapter. \ %
+ \fi
+ \fi
+ ##1}{}}
+ \def\sectionmark##1{\markright{##1}}
+ \def\tocmark{\markboth{\contentsname}{}}
+ \def\lofmark{\markboth{\listfigurename}{}}
+ \def\lotmark{\markboth{\listtablename}{}}
+ \def\bibmark{\markboth{\bibname}{}}
+ \def\indexmark{\markboth{\indexname}{}}
+ \def\glossarymark{\markboth{\glossaryname}{}}
+}
+\renewcommand*{\@ruledmarks}{%
+ \nouppercaseheads
+ \createmark{chapter}{left}{shownumber}{}{. \space}
+ \createmark{section}{right}{shownumber}{}{. \space}
+ \createplainmark{toc}{both}{\contentsname}
+ \createplainmark{lof}{both}{\listfigurename}
+ \createplainmark{lot}{both}{\listtablename}
+ \createplainmark{bib}{both}{\bibname}
+ \createplainmark{index}{both}{\indexname}
+ \createplainmark{glossary}{both}{\glossaryname}}
+\makepsmarks{ruled}{\@ruledmarks}
+\makeevenhead{ruled}{\scshape\leftmark}{}{}
+\makeoddhead{ruled}{}{}{\rightmark}
+
+\makepagestyle{Ruled}
+\makerunningwidth{Ruled}{1.1\textwidth}
+\makeheadposition{Ruled}{flushright}{flushleft}{flushright}{flushleft}
+\makeevenfoot{Ruled}{\thepage}{}{}
+\makeoddfoot{Ruled}{}{}{\thepage}
+\makeheadrule{Ruled}{1.1\textwidth}{\normalrulethickness}
+\makepsmarks{Ruled}{\@ruledmarks}
+\makeevenhead{Ruled}{\scshape\leftmark}{}{}
+\makeoddhead{Ruled}{}{}{\rightmark}
+
+\newlength{\headwidth}
+
+\makepagestyle{companion}
+\setlength{\headwidth}{\textwidth}
+ \addtolength{\headwidth}{\marginparsep}
+ \addtolength{\headwidth}{\marginparwidth}
+\makerunningwidth{companion}{\headwidth}
+\makeheadrule{companion}{\headwidth}{\normalrulethickness}
+\makeheadposition{companion}{flushright}{flushleft}{}{}
+\makepsmarks{companion}{%
+ \def\chaptermark##1{\markboth{##1}{##1}} % left mark & right marks
+ \def\sectionmark##1{\markright{%
+ \ifnum \c@secnumdepth>\z@
+ \thesection. \ %
+ \fi
+ ##1}}
+ \def\tocmark{\markboth{\contentsname}{\contentsname}}
+ \def\lofmark{\markboth{\listfigurename}{\listfigurename}}
+ \def\lotmark{\markboth{\listtablename}{\listtablename}}
+ \def\bibmark{\markboth{\bibname}{\bibname}}
+ \def\indexmark{\markboth{\indexname}{\indexname}}}
+\makepsmarks{companion}{%
+ \nouppercaseheads
+ \createmark{chapter}{both}{nonumber}{}{}
+ \createmark{section}{right}{shownumber}{}{. \space}
+ \createplainmark{toc}{both}{\contentsname}
+ \createplainmark{lof}{both}{\listfigurename}
+ \createplainmark{lot}{both}{\listtablename}
+ \createplainmark{bib}{both}{\bibname}
+ \createplainmark{index}{both}{\indexname}
+ \createplainmark{glossary}{both}{\glossaryname}}
+\makeevenhead{companion}{\normalfont\bfseries\thepage}{}%
+ {\normalfont\bfseries\leftmark}
+\makeoddhead{companion}{\normalfont\bfseries\rightmark}{}%
+ {\normalfont\bfseries\thepage}
+
+\newif\ifshowheadfootloc
+ \showheadfootloctrue
+\newcommand*{\showheadfootlocon}{\showheadfootloctrue}
+\newcommand*{\showheadfootlocoff}{\showheadfootlocfalse}
+\newif\ifshowtextblockloc
+ \showtextblockloctrue
+\newcommand*{\showtextblocklocon}{\showtextblockloctrue}
+\newcommand*{\showtextblocklocoff}{\showtextblocklocfalse}
+
+\newcommand*{\framepichead}{%
+\ifshowheadfootloc
+ \begin{picture}(0,0)
+ \unitlength 1pt
+ \put(0,0){\line(1,0){\strip@pt\textwidth}}
+ \end{picture}%
+\fi}
+
+\newcommand*{\framepictextfoot}{%
+ \begin{picture}(0,0)
+ \unitlength 1pt
+ \ifshowheadfootloc
+ \put(0,0){\line(1,0){\strip@pt\textwidth}}
+ \fi
+ \ifshowtextblockloc
+ \put(0,\strip@pt\footskip)%
+ {\framebox(\strip@pt\textwidth,\strip@pt\textheight){}}
+ \fi
+ \end{picture}}
+
+\makepagestyle{showlocs}
+\makeevenhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage}
+\makeoddhead{showlocs}{\framepichead\thepage}{\thepage}{\thepage}
+\makeevenfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage}
+\makeoddfoot{showlocs}{\framepictextfoot\thepage}{\thepage}{\thepage}
+
+\renewcommand{\pagenumbering}{%
+ \@ifstar{\@smempnum}{\@mempnum}}
+\newcommand{\@smempnum}[1]{%
+ \gdef\thepage{\csname @#1\endcsname \c@page}}
+\newcommand{\@mempnum}[1]{%
+ \@smempnum{#1}\global\c@page \@ne}
+
+\newcounter{storedpagenumber}
+ \setcounter{storedpagenumber}{1}
+\newcommand{\savepagenumber}{\global\c@storedpagenumber \c@page}
+\newcommand{\restorepagenumber}{\global\c@page \c@storedpagenumber}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand*{\setSpacing}[1]{%
+ \def\baselinestretch{#1}%
+ \@currsize}
+
+\newcommand*{\setSingleSpace}[1]{%
+ \def\m@m@singlespace{#1}}
+\setSingleSpace{1}
+
+\newcommand*{\SingleSpacing}{%
+ \setSpacing{\m@m@singlespace}%
+ \vskip\baselineskip% correction for coming into single spacing
+}
+\SingleSpacing
+
+\newcommand*{\OnehalfSpacing}{
+ \setSpacing{1.25}% default (10pt)
+ \ifcase \@ptsize \relax % 10pt
+ \setSpacing{1.25}%
+ \or% 11pt
+ \setSpacing{1.213}%
+ \or% 12pt
+ \setSpacing{1.241}%
+ \or\or% 14pt
+ \setSpacing{1.20}%
+ \or\or\or% 17pt
+ \setSpacing{1.16}%
+ \or\or% 9pt
+ \setSpacing{1.35}%
+ \else% the extended sizes
+ \setSpacing{1.16}%
+ \fi}
+
+\newcommand*{\DoubleSpacing}{
+ \setSpacing{1.667}% default (10pt)
+ \ifcase \@ptsize \relax % 10pt
+ \setSpacing{1.667}%
+ \or% 11pt
+ \setSpacing{1.618}%
+ \or% 12pt
+ \setSpacing{1.655}%
+ \or\or% 14pt
+ \setSpacing{1.60}%
+ \or\or\or% 17pt
+ \setSpacing{1.545}%
+ \or\or% 9pt
+ \setSpacing{1.8}%
+ \else% larger sizes
+ \setSpacing{1.5}%
+ \fi}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% check what this does!!!!!!!!
+\renewcommand*{\@setsize}[4]{%
+ \@nomath#1%
+ \let\@currsize#1%
+ \baselineskip #2%
+ \baselineskip \baselinestretch\baselineskip
+ \parskip \baselinestretch\parskip
+ \setbox\strutbox \hbox{%
+ \vrule height.7\baselineskip
+ depth .3\baselineskip
+ width \z@}%
+ \skip\footins \baselinestretch\skip\footins
+ \normalbaselineskip\baselineskip#3#4}
+
+\newenvironment{SingleSpace}{%
+ \vskip\baselineskip
+ \setSpacing{\m@m@singlespace}%
+ \vskip -\baselineskip
+}{\par}
+
+\newenvironment{SingleSpace*}{%
+%% \vskip\baselineskip
+ \setSpacing{\m@m@singlespace}%
+ \vskip 0.5\baselineskip
+}{\vskip -0.5\baselineskip}
+
+\newcommand*{\m@mrestore@spacing}{%
+ \par
+ \vskip \parskip
+ \vskip \baselineskip
+ \endgroup
+ \vskip -\parskip
+ \vskip -\baselineskip}
+
+\newenvironment{Spacing}[1]{%
+ \par
+ \begingroup
+ \setSpacing{#1}}{\m@mrestore@spacing}
+
+\newenvironment{OnehalfSpace}{%
+ \begingroup
+ \OnehalfSpacing}{\m@mrestore@spacing}
+
+\newenvironment{DoubleSpace}{%
+ \begingroup
+ \DoubleSpacing}{\m@mrestore@spacing}
+
+\newcommand*{\memdskipstretch}{0.0}
+\newcommand*{\setDisplayskipStretch}[1]{%
+ \renewcommand*{\memdskipstretch}{#1}}
+\newcommand*{\noDisplayskipStretch}{\setDisplayskipStretch{0.0}}
+
+\newcommand*{\memdskips}{%
+ \advance\abovedisplayskip \memdskipstretch\abovedisplayskip
+ \advance\belowdisplayskip \memdskipstretch\belowdisplayskip
+ \advance\abovedisplayshortskip \memdskipstretch\abovedisplayshortskip
+ \advance\belowdisplayshortskip \memdskipstretch\belowdisplayshortskip}
+\everydisplay\expandafter{%
+ \the\everydisplay
+ \memdskips}
+
+\let\m@m@xfloat\@xfloat
+\def\@xfloat #1[#2]{%
+ \m@m@xfloat #1[#2]%
+ \def\baselinestretch{\m@m@singlespace}%
+ \normalsize}
+
+\newdimen\memPD
+\newenvironment{vminipage}{%
+ \par
+ \@ifnextchar[%]
+ \@ivminipage
+ {\@iiiminipage t\relax[s]}
+}{%
+ \par\global\memPD=\prevdepth
+ \endminipage
+ \par
+ \kern-\memPD% no pagebreak allowed here
+ \hbox{\vrule depth \memPD width \z@}}
+
+ \def\@ivminipage[#1]{%
+ \@ifnextchar[%]
+ {\@iiminipage{t}}{\@iiiminipage{t}\relax[s]}}
+\newif\ifm@mnzpskip
+\newcommand*{\traditionalparskip}{%
+ \parskip \z@
+ \m@mnzpskipfalse}
+\newskip\m@mabparskip
+\newcommand*{\abnormalparskip}[1]{%
+ \setlength{\parskip}{#1}\m@mabparskip=#1\relax
+ \m@mnzpskiptrue}
+\newcommand*{\nonzeroparskip}{\abnormalparskip{%
+ 0.5\baselineskip
+ \@plus .1\baselineskip \@minus .1\baselineskip% NTG
+%% 0.5/baselineskip \@plus 2pt% RF
+}}
+\traditionalparskip
+
+\newcommand{\pretitle}[1]{\def\@bspretitle{#1}}
+\newcommand{\posttitle}[1]{\def\@bsposttitle{#1}}
+\newcommand{\preauthor}[1]{\def\@bspreauthor{#1}}
+\newcommand{\postauthor}[1]{\def\@bspostauthor{#1}}
+\newcommand{\predate}[1]{\def\@bspredate{#1}}
+\newcommand{\postdate}[1]{\def\@bspostdate{#1}}
+
+ \pretitle{\begin{center}\LARGE}
+ \posttitle{\par\end{center}\vskip 0.5em}
+ \preauthor{\begin{center}
+ \large \lineskip .5em%
+ \begin{tabular}[t]{c}}
+ \postauthor{\end{tabular}\par\end{center}}
+ \predate{\begin{center}\large}
+ \postdate{\par\end{center}}
+
+\newcommand{\maketitlehooka}{}
+\newcommand{\maketitlehookb}{}
+\newcommand{\maketitlehookc}{}
+\newcommand{\maketitlehookd}{}
+
+\newcommand{\thanksmarkseries}[1]{%
+ \def\@bsmarkseries{\renewcommand{\thefootnote}%
+ {\@nameuse{#1}{footnote}}}}
+\newcommand{\symbolthanksmark}{\thanksmarkseries{\fnsymbol}}
+\newcommand{\@bscontmark}{\setcounter{footnote}{0}}
+\newcommand{\continuousmarks}{\def\@bscontmark{}}
+\newcommand{\thanksheadextra}[2]{%
+ \def\@bsthanksheadpre{#1}%
+ \def\@bsthanksheadpost{#2}}
+\DeclareRobustCommand{\thanksmark}[1]{\footnotemark[#1]}
+\newcommand{\thanksgap}[1]{\hspace{#1}}
+\newcommand{\tamark}{\@thefnmark}
+
+\newlength{\thanksmarkwidth}
+\newlength{\thanksmarksep}
+\newcommand{\thanksmarkstyle}[1]{\def\thanksscript##1{#1}}
+\thanksmarkstyle{\textsuperscript{#1}}
+\newcommand{\makethanksmarkhook}{}
+
+\newcommand{\thanksfootmark}{%
+ \ifdim\thanksmarkwidth < \z@
+ \llap{\hb@xt@ -\thanksmarkwidth{%
+ \hss\normalfont\thanksscript{\tamark}}%
+ \hspace*{-\thanksmarkwidth}}%
+ \else
+ \ifdim\thanksmarkwidth = \z@
+ {\normalfont\thanksscript{\tamark}}%
+ \else
+ \hb@xt@\thanksmarkwidth{\hss\normalfont\thanksscript{\tamark}}%
+ \fi
+ \fi}
+
+\newcommand{\makethanksmark}{%
+ \leavevmode%
+ \parindent 1em\noindent
+ \if@RTL\rightskip\else\leftskip\fi\thanksmarksep\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi\thanksmarkwidth \null\nobreak\hskip-\if@RTL\rightskip\else\leftskip\fi\relax
+ \makethanksmarkhook\relax
+ \thanksfootmark}
+
+\newcommand{\usethanksrule}{\let\footnoterule\thanksrule}
+\newcommand{\cancelthanksrule}{\let\footnoterule\@bsfootnoterule}
+
+\thanksmarkseries{fnsymbol} % symbols
+\thanksheadextra{}{}
+\setlength{\thanksmarkwidth}{1.8em}
+\setlength{\thanksmarksep}{-\thanksmarkwidth}
+
+\AtBeginDocument{%
+ \let\thanksrule\footnoterule
+ \let\@bsfootnoterule\footnoterule
+}
+
+\newlength{\droptitle}
+\setlength{\droptitle}{0pt}
+
+\newcommand{\maketitle}{\par
+ \begingroup
+ \@bsmarkseries
+ \def\@makefnmark{\@textsuperscript{%
+ \normalfont\@bsthanksheadpre \tamark \@bsthanksheadpost}}%
+ \long\def\@makefntext##1{\makethanksmark ##1}
+ \if@twocolumn
+ \ifnum \col@number=\@ne
+ \@maketitle
+ \else
+ \twocolumn[\@maketitle]%
+ \fi
+ \else
+ \ifdim\pagetotal>\z@
+ \newpage
+ \fi
+ \global\@topnum\z@
+ \@maketitle
+ \fi
+ \thispagestyle{title}\@thanks
+ \endgroup
+ \@bscontmark % \setcounter{footnote}{0}%
+ }
+\aliaspagestyle{title}{plain}
+
+\newcommand*{\@mem@titlefootkill}[1]{%
+ \@memwarn{Do not use \string\footnote\space in
+ \string\maketitle.\MessageBreak
+ Use \protect\thanks\space instead}}
+
+\newcommand{\@maketitle}{%
+ \let\footnote\@mem@titlefootkill
+ \ifdim\pagetotal>\z@
+ \newpage
+ \fi
+ \null
+ \vskip 2em%
+ \vspace*{\droptitle}
+ \maketitlehooka
+ {\@bspretitle \@title \@bsposttitle}
+ \maketitlehookb
+ {\@bspreauthor \@author \@bspostauthor}
+ \maketitlehookc
+ {\@bspredate \@date \@bspostdate}
+ \maketitlehookd
+ \par
+ \vskip 1.5em}
+
+\newenvironment{titlingpage}%
+ {\let\footnoterule\relax
+ \let\footnotesize\small
+ \if@twocolumn
+ \@restonecoltrue\onecolumn
+ \else
+ \@restonecolfalse
+ \fi
+ \thispagestyle{titlingpage}%
+ \setcounter{page}{\@ne}%
+ }{%
+ \thispagestyle{titlingpage}%
+ \if@restonecol \twocolumn \fi
+ \if@twoside \cleardoublepage \else \clearpage \fi
+ \setcounter{page}{\@ne}}
+\aliaspagestyle{titlingpage}{empty}
+
+\newcommand{\emptythanks}{\global\let\@thanks\@empty}
+
+\newcommand*{\andnext}{%
+ \end{tabular}\\ \begin{tabular}[t]{c}}
+
+\newcommand{\@bsmtitlempty}{%
+ \global\let\maketitle\relax
+ \global\let\@maketitle\relax
+ \global\let\title\relax
+ \global\let\author\relax
+ \global\let\date\relax
+ \global\let\thanksmarkseries\relax
+ \global\let\thanksheadextra\relax
+ \global\let\thanksfootextra\relax
+ \global\let\thanksmark\relax
+ \global\let\thanksgap\relax}
+
+\newcommand{\keepthetitle}{%
+ \@bsmtitlempty
+ \global\let\thanks\relax
+ \global\let\and\relax
+ \global\let\andnext\relax
+ \global\let\@thanks\@empty
+ \global\let\@title\@empty
+ \global\let\@author\@empty
+ \global\let\@date\@empty}
+
+\newcommand{\killtitle}{%
+ \keepthetitle
+ \global\let\thetitle\relax
+ \global\let\theauthor\relax
+ \global\let\thedate\relax}
+
+\addtoiargdef{\title}{%
+ \begingroup\let\footnote\@gobble}{%
+ \begingroup
+ \renewcommand{\thanks}[1]{}
+ \renewcommand{\thanksmark}[1]{}
+ \renewcommand{\thanksgap}[1]{}
+ \protected@xdef\thetitle{#1}
+ \endgroup\endgroup}
+\addtoiargdef{\author}{%
+ \begingroup\let\footnote\@gobble}{%
+ \begingroup
+ \renewcommand{\thanks}[1]{}
+ \renewcommand{\and}{\unskip, }
+ \renewcommand{\andnext}{\unskip, }
+ \renewcommand{\thanksmark}[1]{}
+ \renewcommand{\thanksgap}[1]{}
+ \protected@xdef\theauthor{#1}
+ \endgroup\endgroup}
+\addtoiargdef{\date}{%
+ \begingroup\let\footnote\@gobble}{%
+ \begingroup
+ \renewcommand{\thanks}[1]{}
+ \renewcommand{\thanksmark}[1]{}
+ \renewcommand{\thanksgap}[1]{}
+ \protected@xdef\thedate{#1}
+ \endgroup\endgroup}
+
+\newcommand*{\bookpagemark}[1]{}
+\newcommand*{\partmark}[1]{}
+\newcommand*{\chaptermark}[1]{}
+
+\newcommand*{\bibmark}{}
+\newcommand*{\indexmark}{}
+\newcommand*{\glossarymark}{}
+
+\setcounter{secnumdepth}{2}
+\newcounter{book} \setcounter{book}{0}
+\newcounter{part} \setcounter{part}{0}
+\newcounter{chapter} \setcounter{chapter}{0}
+\newcounter{section}[chapter]
+\newcounter{subsection}[section]
+\newcounter{subsubsection}[subsection]
+\newcounter{paragraph}[subsubsection]
+\newcounter{subparagraph}[paragraph]
+\renewcommand*{\thebook}{\@Roman\c@book}
+\renewcommand*{\thepart}{\@Roman\c@part}
+\renewcommand*{\thechapter}{\@arabic\c@chapter}
+\renewcommand*{\thesection}{\thechapter\@SepMark\@arabic\c@section}
+\renewcommand*{\thesubsection}{%
+ \thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand*{\theparagraph}{%
+ \thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph}
+\newcommand{\@chapapp}{\chaptername}
+
+\newcommand{\frontmatter}{%
+ \@ifstar{\@smemfront}{\@memfront}}
+\newcommand{\@smemfront}{%
+ \cleardoublepage
+ \@mainmatterfalse
+ \setcounter{secnumdepth}{-10}
+ \counterwithout{figure}{chapter}
+ \counterwithout{table}{chapter}
+}
+\newcommand{\@memfront}{%
+ \@smemfront\pagenumbering{roman}}
+
+\newcommand{\mainmatter}{%
+ \@ifstar{\@smemmain}{\@memmain}}
+\newcommand*{\@smemmain}{%
+ \@mainmattertrue
+ \setcounter{secnumdepth}{\value{maxsecnumdepth}}
+ \ifartopt
+ \if@twoside
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \else
+ \cleardoublepage
+ \counterwithin{figure}{chapter}
+ \counterwithin{table}{chapter}
+ \fi}
+\newcommand{\@memmain}{%
+ \@smemmain\pagenumbering{arabic}}
+
+\newcommand{\backmatter}{%
+ \ifartopt
+ \clearpage
+ \else
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \fi
+ \@mainmatterfalse
+ \setcounter{secnumdepth}{-10}
+ \ifartopt\else
+ \counterwithout{figure}{chapter}
+ \counterwithout{table}{chapter}
+ \setcounter{figure}{0}
+ \setcounter{table}{0}
+ \fi}
+
+\newcommand*{\theHbook}{\arabic{book}}
+\newcommand*{\toclevel@book}{-2}
+
+\newcommand*{\book}{%
+ \@setupbook
+ \secdef\@book\@sbook}
+\newcommand*{\beforebookskip}{\null\vfil}
+\newcommand*{\midbookskip}{\par\vskip 2\onelineskip}
+\newcommand*{\afterbookskip}{\vfil\newpage}
+
+\newcommand{\@setupbook}{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{book}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \beforebookskip}
+
+\newcommand*{\booknamefont}{\normalfont\huge\bfseries}
+\newcommand*{\booknumfont}{\normalfont\huge\bfseries}
+\newcommand*{\booktitlefont}{\normalfont\Huge\bfseries}
+
+\newcommand*{\printbookname}{\booknamefont \bookname}
+\newcommand*{\booknamenum}{\space}
+\newcommand*{\printbooknum}{\booknumfont \thebook}
+\newcommand*{\printbooktitle}[1]{\booktitlefont #1}
+
+\newcommand{\membookinfo}[3]{}
+\newcommand{\membookstarinfo}[1]{}
+
+\long\def\@book[#1]#2{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \ifnum \c@secnumdepth >-3\relax
+ \refstepcounter{book}%
+ \addcontentsline{toc}{book}%
+ {\protect\booknumberline{\thebook}#1}%
+ \membookinfo{\thebook}{#1}{#2}%
+ \else
+ \addcontentsline{toc}{book}{#1}%
+ \membookinfo{}{#1}{#2}%
+ \fi
+ \bookpagemark{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >-3\relax
+ \printbookname \booknamenum \printbooknum
+ \midbookskip
+ \fi
+ \printbooktitle{#2}\par}%
+ \@endbook}
+
+\long\def\@sbook#1{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \membookstarinfo{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printbooktitle{#1}\par}%
+ \@endbook}
+
+\newif\ifm@mnobooknewpage
+ \m@mnobooknewpagefalse
+\newcommand*{\bookblankpage}{\m@mnobooknewpagefalse}
+\newcommand*{\nobookblankpage}{\m@mnobooknewpagetrue}
+
+\def\@endbook{\afterbookskip
+ \ifm@mnobooknewpage
+ \else
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{afterbook}%
+ \newpage
+ \fi
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+
+\aliaspagestyle{book}{empty}
+\aliaspagestyle{afterbook}{empty}
+
+\newcommand{\part}{%
+ \@setuppart
+ \secdef\@part\@spart}
+\newcommand{\beforepartskip}{\null\vfil}
+\newcommand{\midpartskip}{\par\vskip 2\onelineskip}
+\newcommand{\afterpartskip}{\vfil\newpage}
+
+\newcommand{\@setuppart}{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \thispagestyle{part}%
+ \if@twocolumn
+ \onecolumn
+ \@tempswatrue
+ \else
+ \@tempswafalse
+ \fi
+ \beforepartskip}
+
+\newcommand{\partnamefont}{\normalfont\huge\bfseries}
+\newcommand{\partnumfont}{\normalfont\huge\bfseries}
+\newcommand{\parttitlefont}{\normalfont\Huge\bfseries}
+
+\newcommand{\printpartname}{\partnamefont \partname}
+\newcommand{\partnamenum}{\space}
+\newcommand{\printpartnum}{\partnumfont \thepart}
+\newcommand{\printparttitle}[1]{\parttitlefont #1}
+
+\newcommand{\mempartinfo}[3]{}
+\newcommand{\mempartstarinfo}[1]{}
+
+\long\def\@part[#1]#2{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \ifnum \c@secnumdepth >-2\relax
+ \refstepcounter{part}%
+ \addcontentsline{toc}{part}%
+ {\protect\partnumberline{\thepart}#1}%
+ \mempartinfo{\thepart}{#1}{#2}%
+ \else
+ \addcontentsline{toc}{part}{#1}%
+ \mempartinfo{}{#1}{#2}%
+ \fi
+ \partmark{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \ifnum \c@secnumdepth >-2\relax
+ \printpartname \partnamenum \printpartnum
+ \midpartskip
+ \fi
+ \printparttitle{#2}\par}%
+ \@endpart}
+
+\long\def\@spart#1{%
+ \M@gettitle{#1}%
+ \phantomsection
+ \mempartstarinfo{#1}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{#1}\par}%
+ \@endpart}
+
+\newif\ifm@mnopartnewpage
+ \m@mnopartnewpagefalse
+\newcommand*{\partblankpage}{\m@mnopartnewpagefalse}
+\newcommand*{\nopartblankpage}{\m@mnopartnewpagetrue}
+
+\def\@endpart{\afterpartskip
+ \ifm@mnopartnewpage
+ \else
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{afterpart}%
+ \newpage
+ \fi
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+
+\aliaspagestyle{afterpart}{empty}
+
+\newcommand\chapter{%
+ \ifartopt\par\else
+ \clearforchapter
+ \thispagestyle{chapter}
+ \global\@topnum\z@
+ \fi
+ \@afterindentfalse
+ \@ifstar{\@m@mschapter}{\@m@mchapter}}
+
+\newcommand{\@m@mchapter}[1][]{%
+ \def\ch@pt@c{#1}% capture first optional arg
+ \@ifnextchar[{\@chapter}{\@chapter[]}%
+}
+\def\m@m@empty{\@empty}
+
+\newcommand{\memchapinfo}[4]{}
+\newcommand{\memchapstarinfo}[2]{}
+\newcommand{\memappchapinfo}[4]{}
+\newcommand{\memappchapstarinfo}[2]{}
+
+\newif\ifm@mpn@new@chap
+ \m@mpn@new@chapfalse
+\newif\ifm@mpn@new@schap
+ \m@mpn@new@schapfalse
+
+\def\@chapter[#1]#2{%
+ \m@mpn@new@chaptrue
+ \def\f@rbdy{#2}%
+ \ifx\ch@pt@c\@empty % no optional args
+ \def\f@rtoc{#2}%
+ \def\f@rhdr{#2}%
+ \else % at least one opt arg
+ \let\f@rtoc\ch@pt@c
+ \ifx\@empty#1\@empty
+ \let\f@rhdr\ch@pt@c
+ \else
+ \def\f@rhdr{#1}%
+ \fi
+ \fi
+ \m@m@Andfalse
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \m@m@Andtrue
+ \fi
+ \fi
+ \ifm@m@And
+ \refstepcounter{chapter}%
+ \fi
+ \ifartopt
+ \@makechapterhead{#2}%
+ \@afterheading
+ \chaptermark{\f@rhdr}%
+ \else
+ \chaptermark{\f@rhdr}
+ \insertchapterspace
+ \if@twocolumn
+ \@topnewpage[\@makechapterhead{#2}]%
+ \else
+ \@makechapterhead{#2}%
+ \fi
+ \@afterheading
+ \fi
+ \ifm@m@And
+ \ifanappendix
+ \addcontentsline{toc}{appendix}{%
+ \protect\chapternumberline{\thechapter}\f@rtoc}%
+ \memappchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}%
+ \else
+ \addcontentsline{toc}{chapter}{%
+ \protect\chapternumberline{\thechapter}\f@rtoc}%
+ \memchapinfo{\thechapter}{\f@rtoc}{\f@rhdr}{#2}%
+ \fi
+ \else
+ \addcontentsline{toc}{chapter}{\f@rtoc}%
+ \ifanappendix
+ \memappchapinfo{}{\f@rtoc}{\f@rhdr}{#2}%
+ \else
+ \memchapinfo{}{\f@rtoc}{\f@rhdr}{#2}%
+ \fi
+ \fi
+ \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{\f@rtoc}\fi}
+
+\def\@makechapterhead#1{%
+ \chapterheadstart% \vspace*{50\p@}%
+ {\parindent \z@ \if@RTL\raggedleft\else\raggedright\fi \normalfont
+ \ifm@m@And
+ \printchaptername \chapternamenum \printchapternum
+ \afterchapternum % \par\nobreak \vskip 20\p@
+ \else
+ \printchapternonum
+ \fi
+ \interlinepenalty\@M
+ \printchaptertitle{#1} % \Huge \bfseries #1
+ \afterchaptertitle % \par\nobreak \vskip 40\p@
+ }}
+
+\newcommand*{\insertchapterspace}{%
+ \addtocontents{lof}{\protect\addvspace{10pt}}%
+ \addtocontents{lot}{\protect\addvspace{10pt}}}
+
+\newlength{\beforechapskip}\setlength{\beforechapskip}{50pt}
+\newlength{\midchapskip}\setlength{\midchapskip}{20pt}
+\newlength{\afterchapskip}\setlength{\afterchapskip}{40pt}
+
+\newcommand{\@chs@def@ult}{%
+ \def\chapterheadstart{\vspace*{\beforechapskip}}%
+ \def\printchaptername{\chapnamefont \@chapapp}%
+ \def\chapternamenum{\space}%
+ \def\printchapternum{\chapnumfont \thechapter}%
+ \def\afterchapternum{\par\nobreak\vskip \midchapskip}%
+ \def\printchapternonum{}%
+ \def\printchaptertitle##1{\chaptitlefont ##1}%
+ \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}%
+ \def\chapnamefont{\normalfont\huge\bfseries}%
+ \def\chapnumfont{\normalfont\huge\bfseries}%
+ \def\chaptitlefont{\normalfont\Huge\bfseries}%
+ \setlength{\beforechapskip}{50pt}%
+ \setlength{\midchapskip}{20pt}%
+ \setlength{\afterchapskip}{40pt}}
+
+\newcommand{\@m@mschapter}[2][\@empty]{%
+ \@schapter{#2}%
+ \ifx \@empty#1
+ \def\f@rhdr{#2}%
+ \else% opt arg
+ \def\f@rhdr{#1}%
+ \setcounter{secnumdepth}{-10}%
+ \chaptermark{#1}%
+ \setcounter{secnumdepth}{\value{maxsecnumdepth}}%
+ \fi
+ \ifanappendix
+ \memappchapstarinfo{\f@rhdr}{#2}%
+ \else
+ \memchapstarinfo{\f@rhdr}{#2}%
+ \fi
+ \ifheadnameref\M@gettitle{\f@rhdr}\else\M@gettitle{#2}\fi}
+
+\newcommand{\@schapter}[1]{%
+ \m@mpn@new@schaptrue
+ \def\f@rbdy{#1}%
+ \ifartopt
+ \@makeschapterhead{#1}%
+ \else
+ \if@twocolumn
+ \@topnewpage[\@makeschapterhead{#1}]%
+ \else
+ \@makeschapterhead{#1}%
+ \fi
+ \fi
+ \@afterheading}
+
+\def\@makeschapterhead#1{%
+ \chapterheadstart
+ {\parindent \z@ \if@RTL\raggedleft\else\raggedright\fi \normalfont
+ \printchapternonum
+ \interlinepenalty\@M
+ \printchaptertitle{#1}%
+ \afterchaptertitle}%
+}
+
+\newcommand{\makechapterstyle}[2]{\@namedef{chs@#1}{\@chs@def@ult #2}}
+\newcommand{\chapterstyle}[1]{\@nameuse{chs@#1}}
+
+\makechapterstyle{default}{}%
+%% \setlength{\beforechapskip}{50pt}
+%% \def\chapterheadstart{\vspace*{\beforechapskip}}
+%% \def\chapnamefont{\normalfont\huge\bfseries}
+%% \def\printchaptername{\chapnamefont \@chapapp}
+%% \def\chapternamenum{\space}
+%% \def\chapnumfont{\normalfont\huge\bfseries}
+%% \def\printchapternum{\chapnumfont \thechapter}
+%% \setlength{\midchapskip}{20pt}
+%% \def\afterchapternum{\par\nobreak\vskip \midchapskip}
+%% \def\printchapternonum{}
+%% \def\chaptitlefont{\normalfont\Huge\bfseries}
+%% \def\printchaptertitle##1{\chaptitlefont ##1}
+%% \setlength{\afterchapskip}{40pt}
+%% \def\afterchaptertitle{\par\nobreak\vskip \afterchapskip}}
+\chapterstyle{default}
+
+\makechapterstyle{section}{%
+ \chapterstyle{default}
+ \renewcommand{\printchaptername}{}
+ \renewcommand{\chapternamenum}{}
+ \renewcommand{\chapnumfont}{\normalfont\Huge\bfseries}
+ \renewcommand{\printchapternum}{\chapnumfont \thechapter\space}
+ \renewcommand{\afterchapternum}{}}
+
+\makechapterstyle{article}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
+ \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}
+ \setlength{\afterchapskip}{2.3ex \@plus .2ex}
+ \renewcommand{\printchaptername}{}
+ \renewcommand{\chapternamenum}{}
+ \renewcommand{\chaptitlefont}{\normalfont\Large\bfseries}
+ \renewcommand{\chapnumfont}{\chaptitlefont}
+ \renewcommand{\printchapternum}{\chapnumfont \thechapter\quad}
+ \renewcommand{\afterchapternum}{}}
+
+\makechapterstyle{reparticle}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{3.5ex \@plus 1ex \@minus .2ex}
+ \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}
+ \setlength{\afterchapskip}{2.3ex \@plus .2ex}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \renewcommand*{\printchapternum}{\@hangfrom{\chapnumfont \thechapter\quad}}%
+ \renewcommand*{\afterchapternum}{}}
+
+\newcommand*{\reparticle}{%
+ \chapterstyle{reparticle}
+ \setsecheadstyle{\normalfont\large\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+ \setsubsecheadstyle{\normalfont\bfseries\if@RTL\raggedleft\else\raggedright\fi}}
+
+\makechapterstyle{hangnum}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \settowidth{\chapindent}{\chapnumfont 999}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \noindent\llap{\makebox[\chapindent][l]{\chapnumfont \thechapter}}}
+ \renewcommand*{\afterchapternum}{}}
+
+\newlength{\chapindent}
+
+\makechapterstyle{companion}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\scshape}
+ \renewcommand*{\printchaptername}{\raggedleft\chapnamefont \@chapapp}
+ \renewcommand*{\chapnumfont}{\normalfont\Huge}
+ \setlength{\chapindent}{\marginparsep}
+ \addtolength{\chapindent}{\marginparwidth}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \begin{adjustwidth}{}{-\chapindent}
+ \raggedleft \chaptitlefont ##1\par\nobreak
+ \end{adjustwidth}}}
+
+\makechapterstyle{demo}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\printchapternum}{\chapnumfont \numtoName{\c@chapter}}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}%
+ {\vskip\onelineskip \hrule\vskip \afterchapskip}}
+
+\makechapterstyle{bianchi}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnamefont}{\normalfont\Large\sffamily\itshape}
+ \renewcommand*{\chapnumfont}{\normalfont\huge}
+ \renewcommand*{\printchaptername}{%
+ \chapnamefont\centering\@chapapp}
+ \renewcommand*{\printchapternum}{\chapnumfont \textit{\thechapter}}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \centering \chaptitlefont\textbf{##1}\par}
+ \renewcommand*{\afterchaptertitle}{\vskip\onelineskip \hrule\vskip
+ \afterchapskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont \textit{9}}\afterchapternum}}
+
+\makechapterstyle{bringhurst}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapterheadstart}{}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \if@RTL\raggedleft\else\raggedright\fi\Large\scshape\MakeLowercase{##1}}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip\onelineskip}}
+
+\makechapterstyle{brotherton}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}}
+
+\makechapterstyle{chappell}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{0pt}
+ \renewcommand*{\chapnamefont}{\large\centering}
+ \renewcommand*{\chapnumfont}{\large}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\printchaptername \chapnumfont 1}
+ \afterchapternum
+ \vskip \onelineskip \vskip -\topskip}
+ \renewcommand*{\chaptitlefont}{\Large\itshape}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \centering\chaptitlefont ##1}}
+
+\makechapterstyle{culver}{%
+ \chapterstyle{default}
+ \chapterstyle{article}%
+ \renewcommand*{\thechapter}{\Roman{chapter}}
+ \renewcommand*{\printchapternum}{% center number/title
+ \centering\chapnumfont \thechapter\space\space}%
+ \renewcommand*{\printchapternonum}{\centering}
+ \renewcommand*{\clearforchapter}{}% no new page
+ \aliaspagestyle{chapter}{headings}}% no special pagestyle
+
+\makechapterstyle{dash}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{5\onelineskip}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\large}
+ \settoheight{\midchapskip}{\chapnumfont 1}
+ \renewcommand*{\printchapternum}{\centering \chapnumfont
+ \rule[0.5\midchapskip]{1em}{0.4pt} \thechapter\
+ \rule[0.5\midchapskip]{1em}{0.4pt}}
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 0.5\onelineskip}
+ \renewcommand*{\printchapternonum}{\centering
+ \vphantom{\chapnumfont 1}\afterchapternum}
+ \renewcommand*{\chaptitlefont}{\normalfont\Large}
+ \renewcommand*{\printchaptertitle}[1]{\centering \chaptitlefont ##1}
+ \setlength{\afterchapskip}{2.5\onelineskip}}
+
+\makechapterstyle{demo2}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip \afterchapskip}
+ \setlength{\beforechapskip}{3\baselineskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont One}
+ \afterchapternum%
+ \vskip\topskip}
+ \setlength{\beforechapskip}{2\onelineskip}}
+
+\makechapterstyle{demo3}{%
+ \chapterstyle{default}
+ \renewcommand*{\printchaptername}{\centering}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape}
+ \renewcommand*{\printchapternum}{\chapnumfont
+ \ifanappendix \thechapter \else \numtoName{\c@chapter}\fi}
+ \renewcommand*{\chaptitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hrule\vskip\onelineskip \raggedleft \chaptitlefont ##1}
+ \renewcommand*{\afterchaptertitle}{%
+ \vskip\onelineskip \hrule\vskip \afterchapskip}
+ \setlength{\beforechapskip}{0pt}
+ \setlength{\midchapskip}{2\onelineskip}
+ \setlength{\afterchapskip}{2\onelineskip}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont One}
+ \afterchapternum%
+ \vskip\topskip}}
+
+\makechapterstyle{ell}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\sffamily}
+ \renewcommand*{\chaptitlefont}{\normalfont\huge\sffamily}
+ \settowidth{\chapindent}{\chapnumfont 111}
+ \renewcommand*{\chapterheadstart}{\begingroup
+ \vspace*{\beforechapskip}%
+ \begin{adjustwidth}{}{-\chapindent}%
+ \hrulefill
+ \smash{\rule{0.4pt}{15mm}}
+ \end{adjustwidth}\endgroup}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \begin{adjustwidth}{}{-\chapindent}
+ \hfill
+ \raisebox{10mm}[0pt][0pt]{\chapnumfont \thechapter}%
+ \hspace*{1em}
+ \end{adjustwidth}\vspace*{-3.0\onelineskip}}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \vskip\onelineskip
+ \raggedleft {\chaptitlefont ##1}\par\nobreak}}
+
+\makechapterstyle{ger}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapterheadstart}{\vspace*{\beforechapskip}
+ \mbox{}\\\mbox{}\rule[0pt]{\textwidth}{0.4pt}\par}
+ \setlength{\midchapskip}{20pt}
+ \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1
+ \\\mbox{}\rule[5pt]{\textwidth}{0.4pt}}}
+
+\makechapterstyle{lyhne}{% needs graphicx package
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{1.5cm}
+ \setlength{\afterchapskip}{1cm}
+ \setlength{\midchapskip}{2cm}
+ \renewcommand*{\chapnamefont}{\normalfont\normalsize\scshape\raggedleft}
+ \renewcommand*{\chaptitlefont}{\normalfont\normalsize\bfseries\sffamily\raggedleft}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{\makebox[0pt][l]{\hspace{0.2em}%
+ \resizebox{!}{2ex}{\chapnamefont\bfseries\sffamily\thechapter}}}
+ \renewcommand*{\afterchapternum}{\par\hspace{1.5cm}\hrule\vspace{0.2cm}}
+ \renewcommand*{\printchapternonum}{\vphantom{\chapnamefont 1}\afterchapternum}
+ \renewcommand*{\afterchaptertitle}{\vskip 0.2cm
+ \hrule\vskip\afterchapskip}}
+
+\makechapterstyle{madsen}{% requires graphicx package
+ \chapterstyle{default}
+ \renewcommand*{\chapnamefont}{%
+ \normalfont\Large\scshape\raggedleft}
+ \renewcommand*{\chaptitlefont}{%
+ \normalfont\Huge\bfseries\sffamily\raggedleft}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \makebox[0pt][l]{\hspace{0.4em}
+ \resizebox{!}{4ex}{%
+ \chapnamefont\bfseries\sffamily\thechapter}
+ }%
+ }%
+ \renewcommand*{\afterchapternum}{%
+ \par\hspace{1.5cm}\hrule\vskip\midchapskip}}
+
+\newcommand*{\colorchapnum}{}
+\newcommand*{\colorchaptitle}{}
+\makechapterstyle{pedersen}{%
+ \chapterstyle{default}
+ \setlength{\beforechapskip}{-20pt}
+ \setlength{\afterchapskip}{10pt}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\itshape}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE\itshape\colorchapnum}
+ \renewcommand*{\chaptitlefont}{\normalfont\huge\itshape\colorchaptitle}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchaptername}{}
+ \setlength{\midchapskip}{20mm}% was \numberheight
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\printchapternum}{%
+ \sidebar{\raisebox{0pt}[0pt][0pt]{\makebox[0pt][l]{%
+ \resizebox{!}{\midchapskip}{\chapnumfont\thechapter}}}}}
+ \renewcommand*{\printchaptertitle}[1]{\chaptitlefont ##1}}
+
+%% Thomas Dye's southall chapter style
+\makechapterstyle{southall}{%
+ \chapterstyle{default}
+ \setlength{\afterchapskip}{5\baselineskip}
+ \setlength{\beforechapskip}{36pt}% \headindent
+ \setlength{\midchapskip}{\textwidth}% \rightblock
+ \addtolength{\midchapskip}{-\beforechapskip}
+ \renewcommand*{\chapterheadstart}{\vspace*{2\baselineskip}}
+ \renewcommand*{\chaptitlefont}{\huge\rmfamily\if@RTL\raggedleft\else\raggedright\fi}
+ \renewcommand*{\chapnumfont}{\chaptitlefont}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\afterchapternum}{}
+ \renewcommand*{\printchapternum}{%
+ \begin{minipage}[t][\baselineskip][b]{\beforechapskip}
+ {\vspace{0pt}\chapnumfont%%%\figureversion{lining}
+ \thechapter}
+ \end{minipage}}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \hfill\begin{minipage}[t]{\midchapskip}
+ {\vspace{0pt}\chaptitlefont ##1\par}\end{minipage}}
+ \renewcommand*{\afterchaptertitle}{%
+ \par\vspace{\baselineskip}%
+ \hrulefill \par\nobreak\noindent \vskip \afterchapskip}}
+
+\makechapterstyle{thatcher}{%
+ \chapterstyle{default}
+ \renewcommand*{\chapterheadstart}{}
+ \renewcommand*{\printchaptername}{%
+ \centerline{\chapnumfont{\@chapapp\ \thechapter}}}
+ \renewcommand*{\chapternamenum}{}
+ \renewcommand*{\chapnumfont}{\normalfont\scshape\MakeLowercase}
+ \renewcommand*{\printchapternum}{}
+ \renewcommand*{\afterchapternum}{%
+ \par\centerline{\parbox{0.5in}{\hrulefill}}\par}
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\chapnumfont \@chapapp 1}\par
+ \parbox{0.5in}{}\par}
+ \renewcommand*{\chaptitlefont}{\normalfont\large}
+ \renewcommand*{\printchaptertitle}[1]{%
+ \centering \chaptitlefont\MakeUppercase{##1}}}
+
+\makechapterstyle{veelo}{%
+ \setlength{\afterchapskip}{40pt}
+ \renewcommand*{\chapterheadstart}{\vspace*{40pt}}
+ \renewcommand*{\afterchapternum}{\par\nobreak\vskip 25pt}
+ \renewcommand*{\chapnamefont}{\normalfont\LARGE\flushright}
+ \renewcommand*{\chapnumfont}{\normalfont\HUGE}
+ \renewcommand*{\chaptitlefont}{\normalfont\HUGE\bfseries\flushright}
+ \renewcommand*{\printchaptername}{%
+ \chapnamefont\MakeUppercase{\@chapapp}}
+ \renewcommand*{\chapternamenum}{}
+ \setlength{\beforechapskip}{18mm}% \numberheight
+ \setlength{\midchapskip}{\paperwidth}% \barlength
+ \addtolength{\midchapskip}{-\textwidth}
+ \addtolength{\midchapskip}{-\spinemargin}
+ \renewcommand*{\printchapternum}{%
+ \makebox[0pt][l]{%
+ \hspace{.8em}%
+ \resizebox{!}{\beforechapskip}{\chapnumfont \thechapter}%
+ \hspace{.8em}%
+ \rule{\midchapskip}{\beforechapskip}%
+ }%
+ }%
+ \makeoddfoot{plain}{}{}{\thepage}}
+
+\makechapterstyle{verville}{%
+ % \chapterstyle{default}
+ \setlength{\beforechapskip}{0pt}
+ \renewcommand*{\printchaptername}{}
+ \renewcommand*{\printchapternum}{%
+ \hrule \vskip 0.5\onelineskip
+ \Huge \centering \thechapter.\ }
+ \renewcommand*{\printchapternonum}{%
+ \hrule \vskip 0.5\onelineskip
+ \Huge \centering}
+ \renewcommand*{\afterchapternum}{}
+ \setlength{\midchapskip}{0pt}
+ \renewcommand*{\printchaptertitle}[1]{%
+ ##1 \par
+ \vskip 0.5\onelineskip
+ \hrule}}
+
+\makechapterstyle{crosshead}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \renewcommand*{\chapterheadstart}{\vspace{\beforechapskip}}%
+ \setlength{\afterchapskip}{2\onelineskip \@plus .2\onelineskip
+ \@minus 0.2\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\LARGE\bfseries}%
+ \renewcommand*{\chaptitlefont}{\chapnumfont}%
+ \renewcommand*{\printchapternum}{%
+ \centering\chapnumfont \thechapter\quad}%
+ \renewcommand{\afterchapternum}{}%
+ \renewcommand*{\printchapternonum}{\centering}}
+
+\makechapterstyle{dowding}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\chapnamefont}{\normalfont}%
+ \renewcommand*{\chapnumfont}{\chapnamefont}%
+ \renewcommand*{\printchapternum}{\centering\chapnumfont \ifanappendix \thechapter
+ \else \numtoName{\c@chapter}\fi}%
+ \renewcommand*{\chaptitlefont}{\normalfont\itshape\huge\centering}%
+ \renewcommand*{\printchapternonum}{%
+ \vphantom{\printchaptername}\vskip\midchapskip}}
+
+\makechapterstyle{komalike}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \setlength{\afterchapskip}{1.5\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\LARGE\sffamily\bfseries}%
+ \renewcommand*{\printchapternum}{\chapnumfont \thechapter\space}%
+ \renewcommand*{\afterchapternum}{}%
+ \renewcommand*{\chaptitlefont}{\normalfont\LARGE\sffamily\bfseries}}
+
+\makechapterstyle{ntglike}{%
+ \setlength{\beforechapskip}{50pt \@plus 20pt}%
+ \renewcommand*{\chapnamefont}{\normalfont\Large\bfseries}%
+ \renewcommand*{\chapnumfont}{\normalfont\Large\bfseries}%
+ \renewcommand*{\chaptitlefont}{\normalfont\Large\bfseries}}
+
+\makechapterstyle{tandh}{%
+ \setlength{\beforechapskip}{1\onelineskip}%
+ \setlength{\afterchapskip}{2\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\printchapternum}{\chapnumfont \thechapter\quad}%
+ \renewcommand*{\afterchapternum}{}%
+ \renewcommand*{\chaptitlefont}{\chapnumfont\if@RTL\raggedleft\else\raggedright\fi}}
+
+\makechapterstyle{wilsondob}{%
+ \setlength{\beforechapskip}{2\onelineskip}%
+ \setlength{\afterchapskip}{4\onelineskip \@plus .1\onelineskip
+ \@minus 0.167\onelineskip}%
+ \renewcommand*{\printchaptername}{}%
+ \renewcommand*{\chapternamenum}{}%
+ \renewcommand*{\chapnumfont}{\normalfont\Huge\itshape}%
+ \renewcommand*{\printchapternum}{\raggedleft\chapnumfont \thechapter\quad}%
+ \renewcommand*{\afterchapternum}{}%
+ \renewcommand*{\chaptitlefont}{\chapnumfont}%
+ \renewcommand*{\printchapternonum}{\raggedleft}}
+
+\newif\ifraggedbottomsection
+ \raggedbottomsectionfalse
+\newcommand*{\raggedbottomsection}{\raggedbottomsectiontrue}
+\newcommand*{\normalbottomsection}{\raggedbottomsectionfalse}
+
+\newlength{\bottomsectionskip}
+ \setlength{\bottomsectionskip}{10mm}
+
+\newcommand{\@trplargomm}[1]{%
+ \@ifnextchar[{\@xtrplargomm{#1}}%
+ {\@xxtrplarg{#1}}}
+\long\def\@xtrplargomm#1[#2]{\@dblarg{#1[#2]}}
+\newcommand{\@xxtrplarg}[2]{#1[{#2}][{#2}]{#2}}
+\newcommand{\@trplargoom}[1]{%
+ \@ifnextchar[{\@xtrplargoom{#1}}%
+ {\@xxtrplarg{#1}}}
+\long\def\@xtrplargoom#1[#2]{%
+ \@ifnextchar[{#1[{#2}]}%
+ {#1[{#2}][{#2}]}}
+
+\newcommand{\memsecinfo}[5]{}
+\newcommand{\memsecstarinfo}[2]{}
+
+\renewcommand{\@startsection}[6]{%
+ \ifraggedbottomsection\if@nobreak\else
+ \vskip\z@\@plus\bottomsectionskip
+ \penalty\z@
+ \vskip\z@\@plus -\bottomsectionskip
+ \fi\fi
+ \def\m@msecn@me{#1}%
+ \if@noskipsec \leavevmode \fi
+ \par
+ \@tempskipa #4\relax
+ \@afterindenttrue
+ \ifdim \@tempskipa <\z@
+ \@tempskipa -\@tempskipa \@afterindentfalse
+ \fi
+ \if@nobreak
+ \everypar{}%
+ \else
+ \addpenalty\@secpenalty\addvspace\@tempskipa
+ \fi
+ \@ifstar
+ {\@ssect{#3}{#4}{#5}{#6}}%
+ {\@trplargoom{\M@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}
+
+\def\M@sect#1#2#3#4#5#6[#7][#8]#9{%
+ \ifheadnameref\M@gettitle{#8}\else\M@gettitle{#7}\fi
+ \ifnum #2>\c@secnumdepth
+ \let\@svsec\@empty
+ \memsecinfo{#1}{}{#7}{#8}{#9}%
+ \else
+ \refstepcounter{#1}%
+ \protected@edef\@svsec{\@seccntformat{#1}\relax}%
+ \memsecinfo{#1}{\@nameuse{the#1}}{#7}{#8}{#9}%
+ \fi
+ \@tempskipa #5\relax
+ \ifdim \@tempskipa>\z@
+ \begingroup
+ #6{%
+ \@hangfrom{\hskip #3\relax\@svsec}%
+ \interlinepenalty \@M #9\@@par}%
+ \endgroup
+ \csname #1mark\endcsname{#8}%
+ \addcontentsline{toc}{#1}{%
+ \ifnum #2>\c@secnumdepth \else
+ \protect\numberline{\csname the#1\endcsname}%
+ \fi
+ #7}%
+ \else
+ \def\@svsechd{%
+ #6{\hskip #3\relax
+ \@svsec #9}%
+ \csname #1mark\endcsname{#8}%
+ \addcontentsline{toc}{#1}{%
+ \ifnum #2>\c@secnumdepth \else
+ \protect\numberline{\csname the#1\endcsname}%
+ \fi
+ #7}}%
+ \fi
+ \@xsect{#5}}
+
+\let\@mem@old@ssect\@ssect
+\def\@ssect#1#2#3#4#5{%
+ \M@gettitle{#5}%
+ \memsecstarinfo{\m@msecn@me}{#5}%
+ \@mem@old@ssect{#1}{#2}{#3}{#4}{#5}}
+
+\newcommand{\section}{%
+ \sechook%
+ \@startsection{section}{1}% level 1
+ {\secindent}% heading indent
+ {\beforesecskip}% skip before the heading
+ {\aftersecskip}% skip after the heading
+ {\normalfont\secheadstyle}} % font
+\newcommand{\sechook}{}
+\newcommand{\setsechook}[1]{\renewcommand{\sechook}{#1}}
+\newlength{\secindent}
+\newcommand{\setsecindent}[1]{\setlength{\secindent}{#1}}
+ \setsecindent{\z@}
+\newskip\beforesecskip
+\newcommand{\setbeforesecskip}[1]{\setlength{\beforesecskip}{#1}}
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}
+\newskip\aftersecskip
+\newcommand{\setaftersecskip}[1]{\setlength{\aftersecskip}{#1}}
+ \setaftersecskip{2.3ex \@plus .2ex}
+\newcommand{\secheadstyle}{}
+\newcommand{\setsecheadstyle}[1]{\renewcommand{\secheadstyle}{#1}}
+ \setsecheadstyle{\Large\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+
+\newcommand{\subsection}{%
+ \subsechook%
+ \@startsection{subsection}{2}% level 2
+ {\subsecindent}% heading indent
+ {\beforesubsecskip}% skip before the heading
+ {\aftersubsecskip}% skip after the heading
+ {\normalfont\subsecheadstyle}} % font
+\newcommand{\subsechook}{}
+\newcommand{\setsubsechook}[1]{\renewcommand{\subsechook}{#1}}
+\newlength{\subsecindent}
+\newcommand{\setsubsecindent}[1]{\setlength{\subsecindent}{#1}}
+ \setsubsecindent{\z@}
+\newskip\beforesubsecskip
+\newcommand{\setbeforesubsecskip}[1]{\setlength{\beforesubsecskip}{#1}}
+ \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}
+\newskip\aftersubsecskip
+\newcommand{\setaftersubsecskip}[1]{\setlength{\aftersubsecskip}{#1}}
+ \setaftersubsecskip{1.5ex \@plus .2ex}
+\newcommand{\subsecheadstyle}{}
+\newcommand{\setsubsecheadstyle}[1]{\renewcommand{\subsecheadstyle}{#1}}
+ \setsubsecheadstyle{\large\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+
+\newcommand{\subsubsection}{%
+ \subsubsechook%
+ \@startsection{subsubsection}{3}% level 3
+ {\subsubsecindent}% heading indent
+ {\beforesubsubsecskip}% skip before the heading
+ {\aftersubsubsecskip}% skip after the heading
+ {\normalfont\subsubsecheadstyle}} % font
+\newcommand{\subsubsechook}{}
+\newcommand{\setsubsubsechook}[1]{\renewcommand{\subsubsechook}{#1}}
+\newlength{\subsubsecindent}
+\newcommand{\setsubsubsecindent}[1]{%
+ \setlength{\subsubsecindent}{#1}}
+ \setsubsubsecindent{\z@}
+\newskip\beforesubsubsecskip
+\newcommand{\setbeforesubsubsecskip}[1]{%
+ \setlength{\beforesubsubsecskip}{#1}}
+ \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}
+\newskip\aftersubsubsecskip
+\newcommand{\setaftersubsubsecskip}[1]{%
+ \setlength{\aftersubsubsecskip}{#1}}
+ \setaftersubsubsecskip{1.5ex \@plus .2ex}
+\newcommand{\subsubsecheadstyle}{}
+\newcommand{\setsubsubsecheadstyle}[1]{%
+ \renewcommand{\subsubsecheadstyle}{#1}}
+ \setsubsubsecheadstyle{\normalsize\bfseries\if@RTL\raggedleft\else\raggedright\fi}
+
+\newcommand{\paragraph}{%
+ \parahook%
+ \@startsection{paragraph}{4}% level 4
+ {\paraindent}% heading indent
+ {\beforeparaskip}% skip before the heading
+ {\afterparaskip}% skip after the heading
+ {\normalfont\paraheadstyle}} % font
+\newcommand{\parahook}{}
+\newcommand{\setparahook}[1]{\renewcommand{\parahook}{#1}}
+\newlength{\paraindent}
+\newcommand{\setparaindent}[1]{\setlength{\paraindent}{#1}}
+ \setparaindent{\z@}
+\newskip\beforeparaskip
+\newcommand{\setbeforeparaskip}[1]{\setlength{\beforeparaskip}{#1}}
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}
+\newskip\afterparaskip
+\newcommand{\setafterparaskip}[1]{\setlength{\afterparaskip}{#1}}
+ \setafterparaskip{-1em}
+\newcommand{\paraheadstyle}{}
+\newcommand{\setparaheadstyle}[1]{\renewcommand{\paraheadstyle}{#1}}
+ \setparaheadstyle{\normalsize\bfseries}
+
+\newcommand{\subparagraph}{%
+ \subparahook%
+ \@startsection{subparagraph}{5}% level 5
+ {\subparaindent}% heading indent
+ {\beforesubparaskip}% skip before the heading
+ {\aftersubparaskip}% skip after the heading
+ {\normalfont\subparaheadstyle}} % font
+\newcommand{\subparahook}{}
+\newcommand{\setsubparahook}[1]{\renewcommand{\subparahook}{#1}}
+\newlength{\subparaindent}
+\newcommand{\setsubparaindent}[1]{%
+ \setlength{\subparaindent}{#1}}
+ \setsubparaindent{\parindent}
+\newskip\beforesubparaskip
+\newcommand{\setbeforesubparaskip}[1]{%
+ \setlength{\beforesubparaskip}{#1}}
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}
+\newskip\aftersubparaskip
+\newcommand{\setaftersubparaskip}[1]{%
+ \setlength{\aftersubparaskip}{#1}}
+ \setaftersubparaskip{-1em}
+\newcommand{\subparaheadstyle}{}
+\newcommand{\setsubparaheadstyle}[1]{%
+ \renewcommand{\subparaheadstyle}{#1}}
+ \setsubparaheadstyle{\normalsize\bfseries}
+
+\newcommand{\sethangfrom}[1]{\renewcommand{\@hangfrom}[1]{#1}}
+\newcommand{\setsecnumformat}[1]{\renewcommand{\@seccntformat}[1]{#1}}
+\newcommand{\hangsecnum}{%
+ \def\@seccntformat##1{\llap{\csname the##1\endcsname\quad}}}
+\newcommand{\defaultsecnum}{%
+ \def\@seccntformat##1{\csname the##1\endcsname\quad}}
+
+\newcommand{\plainbreak}{\@ifstar{\@spbreak}{\@pbreak}}
+\newcommand*{\@pbreak}[1]{\par
+ \penalty -100
+ \vskip #1\onelineskip \@plus 2\onelineskip
+ \penalty -20
+ \vskip \z@ \@plus -2\onelineskip
+ \@afterindentfalse
+ \@afterheading}
+\newcommand*{\@spbreak}[1]{\par
+ \penalty -100
+ \vskip #1\onelineskip \@plus 2\onelineskip
+ \penalty -20
+ \vskip \z@ \@plus -2\onelineskip
+ \@afterindenttrue
+ \@afterheading}
+
+\newcommand{\fancybreak}{\@ifstar{\@sfbreak}{\@fbreak}}
+\newcommand{\@fbreak}[1]{\par
+ \penalty -100
+ \noindent\parbox{\linewidth}{\centering #1}%%\null
+ \par
+%% \penalty -20
+%% \vskip -\onelineskip
+ \@afterindentfalse
+ \@afterheading}
+\newcommand{\@sfbreak}[1]{\par
+ \penalty -100
+ \noindent\parbox{\linewidth}{\centering #1}%%\null
+ \par
+%% \penalty -20
+%% \vskip -\onelineskip
+ \@afterindenttrue
+ \@afterheading}
+
+\newcommand{\plainfancybreak}{\@ifstar{\@spfbreak}{\@pfbreak}}
+\newcommand{\@pfbreak}[3]{\par
+ \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal
+ \ifdim #1>\@tempdimc \@fbreak{#3}\else \@pbreak{#2}\fi}
+\newcommand{\@spfbreak}[3]{\par
+ \@tempdimc\pagegoal \advance\@tempdimc-\pagetotal
+ \ifdim #1>\@tempdimc \@sfbreak{#3}\else \@spbreak{#2}\fi}
+
+\newcommand*{\pen@ltyabovepfbreak}{2}
+\newcommand*{\pen@ltybelowpfbreak}{-4}
+
+\newlength{\pfbreakskip}
+ \setlength{\pfbreakskip}{2\baselineskip}
+\newcommand{\pfbreakdisplay}{*\quad*\quad*}
+
+\def\pfbre@kdispl@y{\vbox to 1\pfbreakskip{\vss
+ \hb@xt@ \columnwidth{\hss \pfbreakdisplay \hss}%
+ \vss}}
+
+\edef\nopfbreakOutput{\the\output}
+\def\pfbreakOutput{%
+ \ifnum\outputpenalty=\pen@ltyabovepfbreak
+ \nopfbreakOutput
+ \pfbre@kdispl@y
+ \nobreak
+ \vskip-\pfbreakskip
+ \else\ifnum\outputpenalty=\pen@ltybelowpfbreak
+ \unvbox 255\relax
+ \nobreak
+ \vskip-\pfbreakskip
+ \pfbre@kdispl@y
+ \break
+ \else
+ \nopfbreakOutput
+ \fi
+ \fi}
+\output={\pfbreakOutput}
+
+\newcommand{\pfbreak}{\@ifstar{\@spfbreakgap}{\@pfbreakgap}}
+\newcommand{\@pfbreakgap}{%
+ \par {%
+ \skip@\lastskip
+ \nobreak
+ \vskip -\ifdim\prevdepth>\maxdepth \maxdepth
+ \else\ifdim\prevdepth>-1000pt\prevdepth
+ \else\ifinner 0pt
+ \else \pagedepth
+ \fi \fi \fi
+ \vskip -\skip@
+ \ifdim\skip@<\pfbreakskip
+ \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip
+ \fi
+ \penalty\pen@ltyabovepfbreak
+ \vskip\skip@
+ \penalty\pen@ltybelowpfbreak
+ }
+ \@afterindentfalse
+ \@afterheading
+}
+\newcommand{\@spfbreakgap}{%
+ \par {%
+ \skip@\lastskip
+ \nobreak
+ \vskip -\ifdim\prevdepth>\maxdepth \maxdepth
+ \else\ifdim\prevdepth>-1000pt\prevdepth
+ \else\ifinner 0pt
+ \else \pagedepth
+ \fi \fi \fi
+ \vskip -\skip@
+ \ifdim\skip@<\pfbreakskip
+ \advance\skip@ -1\skip@ \advance\skip@ 1\pfbreakskip
+ \fi
+ \penalty\pen@ltyabovepfbreak
+ \vskip\skip@
+ \penalty\pen@ltybelowpfbreak
+ }
+ \@afterindenttrue
+ \@afterheading
+}
+
+\newcommand*{\noprelistbreak}{\@nobreaktrue\nopagebreak}
+
+\newcommand{\makeheadstyles}[2]{%
+ \@namedef{hds@#1}{\@hds@def@ult #2}}
+\newcommand*{\headstyles}[1]{\@nameuse{hds@#1}}
+\newcommand*{\@hds@def@ult}{%
+ \renewcommand*{\beforebookskip}{\null\vfil}%
+ \renewcommand*{\midbookskip}{\par\vskip 20pt}%
+ \renewcommand*{\afterbookskip}{\vfil\newpage}%
+ \renewcommand*{\booknamefont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\booknumfont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\booktitlefont}{\normalfont\Huge\bfseries}%
+ \renewcommand*{\printbookname}{\booknamefont \bookname}%
+ \renewcommand*{\booknamenum}{\space}%
+ \renewcommand*{\printbooknum}{\booknumfont \thebook}%
+ \renewcommand*{\printbooktitle}[1]{\booktitlefont{##1}}%
+ \renewcommand*{\beforepartskip}{\null\vfil}%
+ \renewcommand*{\midpartskip}{\par\vskip 20pt}%
+ \renewcommand*{\afterpartskip}{\vfil\newpage}%
+ \renewcommand*{\partnamefont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\partnumfont}{\normalfont\huge\bfseries}%
+ \renewcommand*{\parttitlefont}{\normalfont\Huge\bfseries}%
+ \renewcommand*{\printpartname}{\partnamefont \partname}%
+ \renewcommand*{\partnamenum}{\space}%
+ \renewcommand*{\printpartnum}{\partnumfont \thepart}%
+ \renewcommand*{\printparttitle}[1]{\parttitlefont{##1}}%
+ \@chs@def@ult% default chapterstyle
+ \setsechook{}
+ \setsecindent{\z@}%
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}%
+ \setaftersecskip{2.3ex \@plus .2ex}%
+ \setsecheadstyle{\Large\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setsubsechook{}%
+ \setsubsecindent{\z@}%
+ \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsecskip{1.5ex \@plus .2ex}%
+ \setsubsecheadstyle{\large\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setsubsubsechook{}%
+ \setsubsubsecindent{\z@}%
+ \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsubsecskip{1.5ex \@plus .2ex}%
+ \setsubsubsecheadstyle{\normalsize\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setparahook{}%
+ \setparaindent{\z@}%
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalsize\bfseries}%
+ \setsubparahook{}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalsize\bfseries}}
+
+\makeheadstyles{default}{}
+\headstyles{default}
+
+\newcommand*{\addperiod}[1]{#1.}
+
+\makeheadstyles{memman}{%
+ \renewcommand*{\booknamefont}{\normalfont\huge\sffamily}
+ \renewcommand*{\booknumfont}{\normalfont\huge\sffamily}
+ \renewcommand*{\booktitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\midbookskip}{\par\vskip 2\onelineskip}%
+ \renewcommand*{\partnamefont}{\normalfont\huge\sffamily}
+ \renewcommand*{\partnumfont}{\normalfont\huge\sffamily}
+ \renewcommand*{\parttitlefont}{\normalfont\Huge\sffamily}
+ \renewcommand*{\midpartskip}{\par\vskip 2\onelineskip}%
+ \chapterstyle{demo3}
+ \setbeforesecskip{-1.333\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\scshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{bringhurst}{%
+\chapterstyle{bringhurst}
+ \setbeforesecskip{-1\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\if@RTL\raggedleft\else\raggedright\fi\scshape\MakeLowercase}%
+ \setbeforesubsecskip{-1.0\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{1.0\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\sethangfrom{\noindent ####1}\normalfont\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubsubsecskip{-1em}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\scshape\MakeLowercase}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{crosshead}{%
+ \chapterstyle{crosshead}
+ \setbeforesecskip{-1.25\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.75\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\centering\MakeUppercase}%
+ \setbeforesubsecskip{-1.25\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.75\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\centering\bfseries}%
+ \setbeforesubsubsecskip{-.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\centering\scshape\MakeLowercase}%
+ \setbeforeparaskip{-.667\onelineskip
+ \@plus -02.5\onelineskip \@minus -0.25\onelineskip}%
+ \setafterparaskip{.333\onelineskip \@plus 0.1\onelineskip}%
+ \setparaheadstyle{\normalfont\normalsize\centering\itshape}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\scshape\MakeLowercase}}
+
+\makeheadstyles{dowding}{%
+ \chapterstyle{dowding}
+ \setbeforesecskip{-2\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\centering\MakeUppercase}%
+ \setbeforesubsecskip{-1.2\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\scshape\centering\MakeLowercase}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\centering\itshape}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{komalike}{%
+ \renewcommand*{\partnamefont}{\huge\sffamily\bfseries}%
+ \renewcommand*{\partnumfont}{\huge\sffamily\bfseries}%
+ \renewcommand*{\parttitlefont}{\huge\sffamily\bfseries}%
+ \chapterstyle{komalike}
+ \setbeforesecskip{-3.5ex \@plus -1ex \@minus -.2ex}%
+ \setaftersecskip{2.3ex \@plus .2ex}%
+ \setsecheadstyle{\normalfont\Large\sffamily\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsecskip{1.5ex \@plus .2ex}%
+ \setsubsecheadstyle{\normalfont\large\sffamily\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-3.25ex \@plus -1ex \@minus -.2ex}%
+ \setaftersubsubsecskip{1.5ex \@plus .2ex}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\sffamily\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\sffamily\bfseries}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\sffamily\bfseries}}
+
+\makeheadstyles{ntglike}{%
+ \renewcommand*{\partnamefont}{\Large\bfseries\MakeUppercase}%
+ \renewcommand*{\partnumfont}{\Large\bfseries}%
+ \renewcommand*{\parttitlefont}{\Large\MakeUppercase}%
+ \chapterstyle{ntglike}
+ \setbeforesecskip{-2\onelineskip
+ \@plus -1\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.5\onelineskip}%
+ \setsecheadstyle{\normalfont\large\bfseries}%
+ \setbeforesubsecskip{-1\onelineskip
+ \@plus -.5\onelineskip \@minus -.25\onelineskip}%
+ \setaftersubsecskip{0.01\onelineskip}%
+ \setsubsecheadstyle{\normalfont\normalsize\bfseries}%
+ \setbeforesubsubsecskip{-1\onelineskip
+ \@plus -.5\onelineskip \@minus -.25\onelineskip}%
+ \setaftersubsubsecskip{0.01\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\slshape}%
+ \setbeforeparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\slshape}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{3.25ex \@plus 1ex \@minus .2ex}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\slshape}}
+
+\makeheadstyles{tandh}{%
+ \chapterstyle{tandh}
+ \setbeforesecskip{-2\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{1\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\if@RTL\raggedleft\else\raggedright\fi\MakeUppercase}%
+ \setbeforesubsecskip{-1.2\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.8\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\Large\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\bfseries\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\makeheadstyles{wilsondob}{%
+ \chapterstyle{wilsondob}
+ \setbeforesecskip{-1.333\onelineskip
+ \@plus -0.5\onelineskip \@minus -.5\onelineskip}%
+ \setaftersecskip{0.667\onelineskip \@plus 0.1\onelineskip}%
+ \setsecheadstyle{\normalfont\if@RTL\raggedleft\else\raggedright\fi\MakeUppercase}%
+ \setbeforesubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsecheadstyle{\normalfont\Large\itshape\if@RTL\raggedleft\else\raggedright\fi}%
+ \setbeforesubsubsecskip{-0.667\onelineskip
+ \@plus -0.25\onelineskip \@minus -0.25\onelineskip}%
+ \setaftersubsubsecskip{0.333\onelineskip \@plus 0.1\onelineskip}%
+ \setsubsubsecheadstyle{\normalfont\normalsize\if@RTL\raggedleft\else\raggedright\fi\scshape\MakeLowercase}%
+ \setbeforeparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setafterparaskip{-1em}%
+ \setparaheadstyle{\normalfont\normalsize\itshape\addperiod}%
+ \setsubparaindent{\parindent}%
+ \setbeforesubparaskip{1.0\onelineskip
+ \@plus 0.5\onelineskip \@minus 0.2\onelineskip}%
+ \setaftersubparaskip{-1em}%
+ \setsubparaheadstyle{\normalfont\normalsize\itshape\addperiod}}
+
+\newif\ifanappendix
+ \anappendixfalse
+\newcommand{\appendix}{\par
+ \setcounter{chapter}{0}%
+ \setcounter{section}{0}%
+ \gdef\@chapapp{\appendixname}%
+ \gdef\thechapter{\@Alph\c@chapter}%
+ \anappendixtrue}
+
+\newcommand{\appendixpage}{%
+ \@ifstar{\@sapppage}{\@apppage}}
+\newcommand{\memapppageinfo}[1]{}
+\newcommand{\memapppagestarinfo}[1]{}
+
+\def\@apppage{%
+ \@setuppart
+ \addappheadtotoc
+ \partmark{\appendixpagename}%
+ \memapppageinfo{\appendixpagename}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{\appendixpagename}\par}%
+ \@endpart}
+\def\@sapppage{%
+ \@setuppart
+ \partmark{\appendixpagename}%
+ \memapppagestarinfo{\appendixpagename}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{\appendixpagename}\par}%
+ \@endpart}
+
+\def\addappheadtotoc{%
+ \phantomsection\addcontentsline{toc}{chapter}{\appendixtocname}}
+\newcounter{@ppsavesec}
+\newcounter{@ppsaveapp}
+\setcounter{@ppsaveapp}{0}
+\newcommand{\@ppsavesec}{%
+ \setcounter{@ppsavesec}{\value{chapter}}}
+\newcommand{\@pprestoresec}{%
+ \setcounter{chapter}{\value{@ppsavesec}}}
+\newcommand{\@ppsaveapp}{%
+ \setcounter{@ppsaveapp}{\value{chapter}}}
+\newcommand{\restoreapp}{%
+ \setcounter{chapter}{\value{@ppsaveapp}}}
+
+\newcommand{\@resets@pp}{%
+ \par
+ \@ppsavesec
+ \setcounter{section}{0}%
+ \setcounter{chapter}{0}%
+ \renewcommand\@chapapp{\appendixname}%
+ \renewcommand\thechapter{\@Alph\c@chapter}%
+ \restoreapp
+}
+
+\newenvironment{appendices}%
+ {\@resets@pp\anappendixtrue}%
+ {\@ppsaveapp\@pprestoresec\anappendixfalse}
+
+\newcommand{\setthesection}{\thechapter\@SepMark\Alph{section}}
+
+\newcommand{\@resets@ppsub}{
+ \par
+ \setcounter{section}{0}
+ \renewcommand{\thesection}{\setthesection}
+}
+
+\newif\ifnamesubappendix
+ \namesubappendixfalse
+\newcommand*{\namedsubappendices}{\namesubappendixtrue}
+\newcommand*{\unnamedsubappendices}{\namesubappendixfalse}
+
+\newenvironment{subappendices}{%
+ \@resets@ppsub
+ \def\addappheadtotoc{\phantomsection
+ \addcontentsline{toc}{section}{\appendixtocname}}
+ \ifnamesubappendix
+ \def\sectionname{\appendixname}
+ \def\@seccntformat##1{\@ifundefined{##1name}%
+ {}{\csname ##1name\endcsname\ }%
+ \csname the##1\endcsname\quad}
+ \fi
+ }{}
+
+\newcommand{\@formatsecmark@pp}[1]{%
+ \MakeUppercase{\appendixname\space
+ \ifnum \c@secnumdepth >\z@
+ \thesection\quad
+ \fi
+ #1}}
+\newcommand*{\leadpagetoclevel}{chapter}
+\newcommand*{\newleadpage}[3][empty]{%
+ \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}%
+ {\dlfm@mapppage{#1}{#2}{#3}}}}
+\newcommand*{\renewleadpage}[3][empty]{%
+ \@namedef{#2}{\@ifstar{\dlfm@msapppage{#1}{#2}{#3}}%
+ {\dlfm@mapppage{#1}{#2}{#3}}}}
+
+\newcommand{\memleadpageinfo}[3]{}
+\newcommand{\memleadpagestarinfo}[3]{}
+
+\newcommand*{\dlfm@msapppage}[3]{%
+ \@setuppart
+ \partmark{#3}%
+ \memleadpagestarinfo{#1}{#2}{#3}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{#3}\par
+ \thispagestyle{#1}}%
+ \dlfm@m@endpart{#1}}
+\newcommand*{\dlfm@mapppage}[3]{%
+ \@setuppart
+ \phantomsection
+ \addcontentsline{toc}{\leadpagetoclevel}{#3}%
+ \partmark{#3}%
+ \memleadpageinfo{#1}{#2}{#3}%
+ {\centering
+ \interlinepenalty \@M
+ \normalfont
+ \printparttitle{#3}\par
+ \thispagestyle{#1}}%
+ \dlfm@m@endpart{#1}}
+
+\newcommand*{\dlfm@m@endpart}[1]{%
+ \if@twoside
+ \if@openright
+ \null
+ \thispagestyle{#1}%
+ \newpage
+ \fi
+ \fi
+ \if@tempswa
+ \twocolumn
+ \fi}
+
+\let\memorigdbs\\
+\let\memorigpar\par
+\let\atcentercr\@centercr
+
+\newcommand*{\flushleftright}{%
+ \let\\\memorigdbs
+ \if@RTL\rightskip\else\leftskip\fi\z@skip
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip\@flushglue
+ \everypar{}}
+
+\newcommand*{\linenottooshort}[1][4em]{%
+ \@tempdima=\hsize
+ \advance\@tempdima -#1
+ \if@RTL\rightskip\else\leftskip\fi\z@skip
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip=\@tempdima \@minus \@tempdima}
+
+\newcommand*{\russianpar}{\ifhmode\unskip
+ \strut\vadjust{}\nobreak
+ \discretionary{}%
+ {\hbox{\hskip2\parindent
+ \vrule depth 273sp width 0sp height \ht\strutbox}}%
+ {\hbox{\hskip\parindent}}%
+ \hskip-2\parindent \@minus 2\parindent
+ \hskip\hsize \@minus \hsize
+ \kern\z@ \parfillskip\z@
+ \memorigpar
+ \ifdim\prevdepth=273sp
+ \nobreak
+ \vskip-2\baselineskip
+ \hbox{\strut}%
+ \fi\fi}
+
+\newcommand*{\lastlineparrule}{%
+ \hrule height 0.5ex depth \@tempdimb\relax}
+\newcommand*{\lastlinerulefill}{%
+ \let\\\@centercr
+ \@tempdimb=-0.5ex \advance\@tempdimb 0.4pt
+ \unskip\nobreak\space
+ \leaders\lastlineparrule\hskip\@flushglue
+ \vadjust{}{\parfillskip\z@\memorigpar}}
+
+\newcommand*{\centerlastline}{%
+ \if@RTL\rightskip\else\leftskip\fi\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi=\z@ plus -1fil
+ \parfillskip=\z@ plus 2fil}
+
+\newcommand*{\leftcenterright}{%;
+ \let\\\break
+ \parindent\z@
+ \if@RTL\rightskip\else\leftskip\fi\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip \z@ \@plus -1fil
+ \everypar={\hskip \z@ \@plus -1fil}}
+
+\newcommand*{\centerfloat}{%
+ \parindent \z@
+ \if@RTL\rightskip\else\leftskip\fi \z@ \@plus 1fil \@minus \textwidth
+ \if@RTL\leftskip\else\rightskip\fi\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip \z@skip}
+
+\newdimen\ragrparindent
+ \setlength{\ragrparindent}{\parindent}
+\newcommand{\raggedyright}[1][2em]{%
+ \let\\\@centercr\@rightskip \z@ \@plus #1\relax \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \if@RTL\rightskip\else\leftskip\fi\z@skip
+ \parindent\ragrparindent}
+
+\newcommand*{\justlastraggedleft}{%
+ \if@RTL\rightskip\else\leftskip\fi\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi-\if@RTL\rightskip\else\leftskip\fi
+ \parfillskip\if@RTL\rightskip\else\leftskip\fi
+ \parindent \z@}
+
+\newcommand*{\raggedrightthenleft}{%
+ \parindent \z@
+ \if@RTL\rightskip\else\leftskip\fi \z@ \@plus 1fill
+ \if@RTL\leftskip\else\rightskip\fi\@flushglue
+ \parfillskip \z@
+ \everypar{\hskip \z@ \@plus -1fill}}
+
+\newcommand{\hangfrom}[1]{%
+ \setbox\@tempboxa\hbox{{#1}}%
+ \hangindent \wd\@tempboxa\noindent\box\@tempboxa}
+
+\newcommand{\hangpara}[2]{\hangindent#1\hangafter#2\noindent}
+\newenvironment{hangparas}[2]{\setlength{\parindent}{\z@}
+ \everypar={\hangpara{#1}{#2}}}{\par}
+
+\newcommand{\leftspringright}[4]{%
+ \@tempdimb=\hsize
+ \par\noindent\hbox to\@tempdimb{%
+ \vtop{\hsize=#1\@tempdimb \flushleft#3\par}\hss
+ \vtop{\hsize=#2\@tempdimb \flushright#4\par}}}
+
+\newcommand*{\sourceatright}[2][2em]{{%
+ \unskip\nobreak\hfil\penalty50
+ \hskip#1\hbox{}\nobreak\hfil{#2}
+ \parfillskip\z@\finalhyphendemerits=0\par}}
+
+\if@twocolumn
+ \setlength{\leftmargini}{2em}
+\else
+ \setlength{\leftmargini}{2.5em}
+\fi
+\leftmargin \leftmargini
+\setlength{\leftmarginii}{2.2em}
+\setlength{\leftmarginiii}{1.87em}
+\setlength{\leftmarginiv}{1.7em}
+\if@twocolumn
+ \setlength{\leftmarginv}{.5em}
+ \setlength{\leftmarginvi}{.5em}
+\else
+ \setlength{\leftmarginv}{1em}
+ \setlength{\leftmarginvi}{1em}
+\fi
+\setlength{\itemindent}{\z@}
+\setlength{\labelsep}{0.5em}
+\setlength{\labelwidth}{\leftmargini}
+ \addtolength{\labelwidth}{-\labelsep}
+\@beginparpenalty -\@lowpenalty
+\@endparpenalty -\@lowpenalty
+\@itempenalty -\@lowpenalty
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newdimen\everylistparindent
+ \everylistparindent \z@
+\renewcommand*{\list}[2]{%
+ \ifnum \@listdepth >5\relax
+ \@toodeep
+ \else
+ \global\advance\@listdepth\@ne
+ \fi
+ \rightmargin\z@
+ \listparindent\everylistparindent
+ \itemindent\z@
+ \csname @list\romannumeral\the\@listdepth\endcsname
+ \def\@itemlabel{#1}%
+ \let\makelabel\@mklab
+ \@nmbrlistfalse
+ #2\relax
+ \@trivlist
+ \parskip\parsep
+ \parindent\listparindent
+ \advance\linewidth -\rightmargin
+ \advance\linewidth -\leftmargin
+ \advance\@totalleftmargin \leftmargin
+ \parshape \@ne \@totalleftmargin \linewidth
+ \ignorespaces}
+
+\newlength{\parsepi}
+\newlength{\topsepi}
+\newlength{\itemsepi}
+\newlength{\parsepii}
+\newlength{\topsepii}
+\newlength{\topsepiii}
+
+\newlength{\itemsepii}
+\newlength{\itemsepiii}
+\newlength{\partopsepii}
+\newlength{\partopsepiii}
+\newcommand*{\setnzplist}{%
+ \partopsep \p@ \@plus\z@ \@minus\p@
+ \topsepi\z@
+ \parsepi\parskip
+ \itemsepi\z@
+ \topsepii\z@
+ \parsepii\parskip
+ \itemsepii\z@
+ \topsepiii\z@
+%% \parsepiii\parskip
+ \itemsepiii\z@}
+
+\newcommand*{\defaultlists}{%
+ \setlength{\partopsep}{0.2\onelineskip \@plus 0.1\onelineskip
+ \@minus 0.1\onelineskip}%
+ \parsepi = 0.3333\onelineskip \@plus 0.1667\onelineskip \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = 0.6667\onelineskip \@plus 0.3333\onelineskip
+ \@minus 0.2\onelineskip
+ \parsepii = 0.1667\onelineskip \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent \listparindent
+ \itemsepii\parsepii
+ \itemsepiii\topsepiii
+ \partopsepiii \p@ \@plus\z@ \@minus\p@
+ \ifm@mnzpskip
+ \setnzplist
+ \fi}
+\defaultlists
+
+\newcommand*{\firmlists}{%
+ \@ifstar{\m@msfirmlists}{\m@mfirmlists}}
+
+\newcommand*{\m@msfirmlists}{
+ \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}%
+ \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \parsepi
+ \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\listparindent}
+
+\newcommand*{\m@mfirmlists}{
+ \setlength{\partopsep}{0.1\onelineskip \@plus 0.05\onelineskip
+ \@minus 0.05\onelineskip}%
+ \parsepi = 0.1667\onelineskip \@plus 0.0833\onelineskip \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \parsepi
+ \parsepii = 0.0833\onelineskip \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\listparindent}
+
+\newcommand*{\tightlists}{%
+ \@ifstar{\m@mstightlists}{\m@mtightlists}}
+
+\newcommand*{\m@mstightlists}{%
+ \setlength{\partopsep}{\z@ \@plus \p@ \@minus \p@}%
+ \parsepi = \z@ \@plus \p@ \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \z@ \@plus \p@ \@minus \p@
+ \parsepii = \z@ \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\parindent
+ \ifm@mnzpskip
+ \setnzplist
+ \partopsepiii\partopsep
+ \fi}
+
+\newcommand*{\m@mtightlists}{%
+ \setlength{\partopsep}{0.5\onelineskip \@plus \p@ \@minus \p@}%
+ \parsepi = \z@ \@plus \p@ \@minus \p@
+ \itemsepi = \parsepi
+ \topsepi = \z@ \@plus \p@ \@minus \p@
+ \parsepii = \z@ \@plus \p@ \@minus \p@
+ \topsepii = \parsepi
+ \topsepiii = \parsepii
+ \everylistparindent\parindent
+ \ifm@mnzpskip
+ \setnzplist
+ \partopsepiii\partopsep
+ \fi}
+
+\newcommand{\firmlist}{%
+ \setlength{\itemsep}{0.5\itemsep}\setlength{\parskip}{0.5\parskip}}
+\newcommand{\tightlist}{%
+ \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
+
+\newskip\m@msavetopsep
+\newskip\m@msavepartopsep
+\newcommand*{\savetrivseps}{%
+ \m@msavetopsep\topsep
+ \m@msavepartopsep\partopsep}
+\newcommand*{\restoretrivseps}{%
+ \topsep\m@msavetopsep
+ \partopsep\m@msavepartopsep}
+\savetrivseps
+
+\newcommand*{\zerotrivseps}{%
+ \topsep\z@
+ \partopsep\z@}
+
+\def\@listi{\leftmargin\leftmargini
+ \parsep\parsepi
+ \topsep\topsepi
+ \itemsep\itemsepi}
+\let\@listI\@listi
+\defaultlists
+\@listi
+
+\def\@listii{\leftmargin\leftmarginii
+ \labelwidth\leftmarginii
+ \advance\labelwidth-\labelsep
+ \topsep\topsepii
+ \parsep\parsepii
+ \itemsep\parsepii}
+
+\def\@listiii{\leftmargin\leftmarginiii
+ \labelwidth\leftmarginiii
+ \advance\labelwidth-\labelsep
+ \topsep\topsepiii
+ \parsep\z@
+%%% \itemsep\topsep
+%%% \partopsep \p@ \@plus\z@ \@minus\p@
+ \itemsep\itemsepiii
+ \partopsep\partopsepiii}
+
+\def\@listiv{\leftmargin\leftmarginiv
+ \labelwidth\leftmarginiv
+ \advance\labelwidth-\labelsep}
+
+\def\@listv{\leftmargin\leftmarginv
+ \labelwidth\leftmarginv
+ \advance\labelwidth-\labelsep}
+
+\def\@listvi{\leftmargin\leftmarginvi
+ \labelwidth\leftmarginvi
+ \advance\labelwidth-\labelsep}
+
+\renewcommand{\theenumi}{\@arabic\c@enumi}
+\renewcommand{\theenumii}{\@alph\c@enumii}
+\renewcommand{\theenumiii}{\@roman\c@enumiii}
+\renewcommand{\theenumiv}{\@Alph\c@enumiv}
+\newcommand{\labelenumi}{\theenumi.}
+\newcommand{\labelenumii}{\theenumii)}
+\newcommand{\labelenumiii}{\theenumiii.}
+\newcommand{\labelenumiv}{\theenumiv.}
+\renewcommand{\p@enumii}{\theenumi}
+\renewcommand{\p@enumiii}{\theenumi(\theenumii)}
+\renewcommand{\p@enumiv}{\p@enumiii\theenumiii}
+\newtoks\@enLab
+\def\@enQmark{?}
+\def\@enLabel#1#2{%
+ \edef\@enThe{\noexpand#1{\@enumctr}}%
+ \@enLab\expandafter{\the\@enLab\csname the\@enumctr\endcsname}%
+ \@enloop}
+\def\@enSpace{\afterassignment\@enSp@ce\let\@memtempa= }
+\def\@enSp@ce{\@enLab\expandafter{\the\@enLab\space}\@enloop}
+\def\@enGroup#1{\@enLab\expandafter{\the\@enLab{#1}}\@enloop}
+\def\@enOther#1{\@enLab\expandafter{\the\@enLab#1}\@enloop}
+\def\@enloop{\futurelet\@entemp\@enloop@}
+\def\@enloop@{%
+ \ifx A\@entemp \def\@memtempa{\@enLabel\Alph }\else
+ \ifx a\@entemp \def\@memtempa{\@enLabel\alph }\else
+ \ifx i\@entemp \def\@memtempa{\@enLabel\roman }\else
+ \ifx I\@entemp \def\@memtempa{\@enLabel\Roman }\else
+ \ifx 1\@entemp \def\@memtempa{\@enLabel\arabic}\else
+ \ifx \@sptoken\@entemp \let\@memtempa\@enSpace \else
+ \ifx \bgroup\@entemp \let\@memtempa\@enGroup \else
+ \ifx \@enum@\@entemp \let\@memtempa\@gobble \else
+ \let\@memtempa\@enOther
+ \@enhook
+ \fi\fi\fi\fi\fi\fi\fi\fi
+ \@memtempa}
+%% \providecommand\@enhook{}
+ \newcommand\@enhook{}
+\def\enumerate{%
+ \ifnum \@enumdepth >3 \@toodeep\else
+ \advance\@enumdepth \@ne
+ \edef\@enumctr{enum\romannumeral\the\@enumdepth}\fi
+ \@ifnextchar[{\@@enum@}{\@enum@}}
+\def\@@enum@[#1]{%
+ \@enLab{}\let\@enThe\@enQmark
+ \@enloop#1\@enum@
+ \ifx\@enThe\@enQmark\@warning{The counter will not be printed.%
+ ^^J\space\@spaces\@spaces\@spaces The label is: \the\@enLab}\fi
+ \expandafter\edef\csname label\@enumctr\endcsname{\the\@enLab}%
+ \expandafter\let\csname the\@enumctr\endcsname\@enThe
+ \csname c@\@enumctr\endcsname7
+ \expandafter\settowidth
+ \csname leftmargin\romannumeral\@enumdepth\endcsname
+ {\the\@enLab\hspace{\labelsep}}%
+ \@enum@}
+\def\@enum@{\list{\csname label\@enumctr\endcsname}%
+ {\usecounter{\@enumctr}\def\makelabel##1{\hss\llap{##1}}}}
+
+\newcommand{\labelitemi}{\textbullet}
+\newcommand{\labelitemii}{\normalfont\bfseries \textendash}
+\newcommand{\labelitemiii}{\textasteriskcentered}
+\newcommand{\labelitemiv}{\textperiodcentered}
+\renewcommand{\itemize}[1][\@empty]{%
+ \ifnum \@itemdepth >\thr@@\@toodeep\else
+ \advance\@itemdepth\@ne
+ \ifx \@empty #1\else % optional argument
+ \@namedef{labelitem\romannumeral\the\@itemdepth}{#1}%
+ \fi
+ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
+ \expandafter
+ \list
+ \csname\@itemitem\endcsname
+ {\def\makelabel##1{\hss\llap{##1}}}%
+ \fi}
+\let\enditemize =\endlist
+
+\newenvironment{description}%
+ {\list{}{\labelwidth\z@ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}}%
+ {\endlist}
+\newcommand*{\descriptionlabel}[1]{\hspace\labelsep
+ \normalfont\bfseries #1}
+\newenvironment{blockdescription}%
+ {\list{}{\labelwidth\z@ \itemindent 0.5em \labelsep 0.5em
+ \let\makelabel\blockdescriptionlabel}}%
+ {\endlist}
+\newcommand*{\blockdescriptionlabel}[1]{%%% \hspace\labelsep
+ \normalfont\bfseries #1}
+\newenvironment{quotation}%
+ {\list{}{\listparindent 1.5em%
+ \itemindent \listparindent
+ \rightmargin \leftmargin
+ \parsep \z@ \@plus\p@}%
+ \item[]}%
+ {\endlist}
+\newenvironment{quote}%
+ {\list{}{\rightmargin\leftmargin}%
+ \item[]}%
+ {\endlist}
+\newcommand{\symbollabel}[1]{{#1 \hfill}}
+\newenvironment{symbols}{\list{}%
+ {\itemindent 0em \leftmargin 8em
+ \labelsep 1em \labelwidth 5em
+ \let\makelabel\symbollabel}}%
+ {\endlist}
+\newcommand{\symboldef}[2]{\item[#1] #2}
+\newif\if@bsonecol
+ \@bsonecoltrue
+\newif\ifadd@bstotoc
+ \add@bstotocfalse
+\newif\ifnumber@bs
+ \number@bsfalse
+\newif\if@bsrunin
+ \@bsruninfalse
+
+\newcommand{\abstractcol}{\@bsonecolfalse}
+\newcommand{\abstractintoc}{\add@bstotoctrue}
+\newcommand{\abstractnum}{\number@bstrue\@bsruninfalse}
+\newcommand{\abstractrunin}{\@bsrunintrue\number@bsfalse}
+
+\newcommand{\abstractnamefont}{\normalfont\small\bfseries}
+\newcommand{\abstracttextfont}{\normalfont\small}
+\newcommand{\abscolnamefont}{\normalfont\Large\bfseries}
+\newcommand{\abscoltextfont}{\normalfont}
+
+\newcommand{\absnamepos}{center}
+\newlength{\abstitleskip} \setlength{\abstitleskip}{-0.5em}
+\newlength{\absleftindent}
+ \absleftindent=\leftmargin
+\newdimen\abs@leftindent
+ \abs@leftindent=\leftmargin
+\newlength{\absrightindent}
+ \absrightindent=\leftmargin
+\newlength{\absparindent}
+\newlength{\absparsep}
+
+\newcommand{\abslabeldelim}[1]{\def\@bslabeldelim{#1}}
+\abslabeldelim{}
+\newcommand{\@bsrunintitle}{%
+ \hspace*{\abstitleskip}{\abstractnamefont\abstractname\@bslabeldelim}}
+
+\newcommand{\setup@bstract}{%
+ \abs@leftindent=\absleftindent
+ \if@twocolumn
+ \if@bsonecol
+ \else
+ \abs@leftindent=\z@
+ \absrightindent=\z@
+ \renewcommand*{\abstractnamefont}{\abscolnamefont}
+ \renewcommand*{\abstracttextfont}{\abscoltextfont}
+ \renewcommand*{\absnamepos}{flushleft}
+ \setlength{\abstitleskip}{-2ex}
+ \fi
+ \fi}
+
+\AtBeginDocument{\setlength{\absparindent}{\parindent}
+ \setlength{\absparsep}{\parskip}}
+
+\newenvironment{@bstr@ctlist}{%
+ \list{}{%
+ %%\topsep \z@
+ \partopsep \z@
+ \listparindent \absparindent
+ \itemindent \listparindent
+ \leftmargin \abs@leftindent
+ \rightmargin \absrightindent
+ \parsep \absparsep}%
+ \item\relax}
+ {\endlist}
+
+\newcommand{\put@bsintoc}{%
+ \ifadd@bstotoc
+ \ifnumber@bs\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\abstractname}
+ \fi
+ \fi}
+
+\newcommand{\num@bs}{\chapter{\abstractname}}
+
+\newenvironment{abstract}{%
+ \setup@bstract
+ \if@bsrunin\else
+ \ifnumber@bs \num@bs \else
+ \begin{\absnamepos}\abstractnamefont\abstractname\end\absnamepos%
+ \vspace{\abstitleskip}%
+ \fi
+ \fi
+ \put@bsintoc%
+ \begin{@bstr@ctlist}\if@bsrunin\@bsrunintitle\fi\abstracttextfont}%
+ {\par\end{@bstr@ctlist}}
+
+\newenvironment{onecolabstract}{%
+ \begin{@twocolumnfalse}\begin{abstract}}{%
+ \end{abstract}\end{@twocolumnfalse}}
+
+\addtoiargdef{\thanks}{}{%
+ \protected@xdef\@bs@thanks{\@bs@thanks
+ \protect\footnotetext[\the\c@footnote]{#1}}%
+}
+\let\@bs@thanks\@empty
+
+\newcommand{\saythanks}{\begingroup
+ \renewcommand{\thefootnote}{\fnsymbol{footnote}}\@bs@thanks
+ \endgroup\global\let\@bs@thanks\@empty}
+
+\newcounter{vslineno}
+\newcounter{poemline}
+\newcounter{modulo@vs}
+\newcounter{memfvsline}
+
+%%%\newcommand{\poemlines}[1]{\linenumberfrequency{#1}%
+%%% \@memwarn{Use \string\linenumberfrequency\space
+%%% instead of \string\poemlines}}
+
+\newcommand{\linenumberfont}[1]{\def\vlvnumfont{#1}}
+%%% \linenumberfont{\small\rmfamily}
+
+\newif\ifbvcountlines% TRUE to print line numbers of (boxed) verbatim lines
+ \bvcountlinesfalse
+
+\newcommand{\linenumberfrequency}[1]{%
+ \ifnum #1< \@ne
+ \def\linemodnum{0\relax}
+ \bvcountlinesfalse
+ \else
+ \def\linemodnum{#1\relax}
+ \bvcountlinestrue
+ \fi}
+
+%%%%\linenumberfrequency{0}
+
+\newcommand*{\setverselinenums}[2]{%
+ \c@poemline #1\relax \advance\c@poemline \m@ne
+ \refstepcounter{poemline}%
+ \ifnum\z@<\linemodnum% we are printing line numbers
+ \@tempcnta #2\relax
+ \divide\@tempcnta\linemodnum
+ \multiply\@tempcnta\linemodnum
+ \c@memfvsline #2\relax
+ \advance\c@memfvsline-\@tempcnta
+ \fi}
+
+\newcommand{\getthelinenumber}[2]{%
+ \ifnum\@ne>\linemodnum% no line numbers
+ \else
+ \ifnum\@ne=\linemodnum% every line numbered
+ \@nameuse{the#1}%
+ \else
+ \@tempcnta=\@nameuse{c@#1}%
+ \advance\@tempcnta -\@nameuse{c@#2}%
+ \divide\@tempcnta \linemodnum
+ \multiply\@tempcnta \linemodnum
+ \advance\@tempcnta \@nameuse{c@#2}%
+ \ifnum\@tempcnta=\@nameuse{c@#1}\@nameuse{the#1}\fi
+ \fi
+ \fi}
+
+\newif\ifaltindent
+ \altindentfalse
+\newif\ifpattern
+ \patternfalse
+\newif\ifstarpattern
+ \starpatternfalse
+
+\newlength{\vleftskip}
+ \setlength{\vleftskip}{3em}
+\newlength{\vrightskip}
+ \setlength{\vrightskip}{1em}
+
+\newlength{\stanzaskip}
+ \setlength{\stanzaskip}{\onelineskip}
+
+\newcommand{\flagverse}[1]{%
+ \hskip-\if@RTL\vrightskip\else\vleftskip\fi\llap{#1}\hskip\if@RTL\vrightskip\else\vleftskip\fi\ignorespaces}
+
+\newlength{\versewidth}
+\newlength{\vgap} \setlength{\vgap}{1.5em}
+\newcommand{\vin}{\hspace*{\vgap}}
+\newlength{\vindent} \setlength{\vindent}{2\vgap}
+\newcommand{\vinphantom}[1]{\leavevmode\phantom{#1}}
+\newcommand*{\vleftofline}[1]{\leavevmode\llap{#1}}
+\newdimen\vleftmargin
+ \vleftmargin=\leftmargini
+
+\newcommand{\verselinebreak}[1][\z@]{\newline\hspace*{#1}\ignorespaces}
+
+\newcommand{\incr@vsline}{%
+ \refstepcounter{poemline}%
+ \stepcounter{vslineno}}
+
+\newcommand{\@vsifbang}[1]{\@ifnextchar !{\@firstoftwo{#1}}}
+\newcommand{\@vsifgt}[1]{\@ifnextchar >{\@firstoftwo{#1}}}
+
+\newcommand*{\verselinenumbersright}{\def\@vstypelinenum{\@vslnumright}}
+\newcommand*{\verselinenumbersleft}{\def\@vstypelinenum{\@vslnumleft}}
+\verselinenumbersright
+
+\newcommand*{\@vslnumright}{%
+ \hfill\rlap{\kern\if@RTL\vleftskip\else\vrightskip\fi\kern\rightmargin%
+ \vlvnumfont\getthelinenumber{poemline}{memfvsline}}}
+\newcommand*{\@vslnumleft}{%
+ \hfill\rlap{\kern-\textwidth\kern-\if@RTL\vleftskip\else\vrightskip\fi%
+ \vlvnumfont\getthelinenumber{poemline}{memfvsline}}}
+\newcommand{\@vscentercr}{%
+ \ifhmode \unskip\else \@nolnerr\fi
+ \@vstypelinenum%
+ \@vsifgt{\verselinebreak}{%
+ \incr@vsline
+ \par\@ifstar{\nobreak\@vsxcentercr}{%
+ \@vsifbang{\@ifnextchar[ {\@vsicentercr}{}}{\@vsxcentercr}}}}
+\newcommand{\@vsxcentercr}{\addvspace{-\parskip}%
+ \@ifnextchar[ {\@vsicentercr}{\start@vsline}}
+\def\@vsicentercr[#1]{\vskip #1\ignorespaces \start@vsline}
+\newcommand{\start@vsline}{%
+ \ifaltindent\ifodd\c@vslineno\else\vin\fi\fi%
+ \ifpattern\get@vsindent\fi%
+ \ifstarpattern\getstar@vsindent\fi}
+
+\newcounter{verse}
+\setcounter{verse}{0}
+\newcommand{\theHpoemline}{\theverse.\thepoemline}
+
+\newenvironment{verse}[1][\linewidth]{%
+ \refstepcounter{verse}%
+ \setcounter{poemline}{0}\refstepcounter{poemline}%
+ \setcounter{vslineno}{1}%
+ \let\\=\@vscentercr
+ \list{}{\itemsep \z@
+ \itemindent -\vindent
+ \listparindent\itemindent
+ \leftmargin \vleftmargin
+ \parsep \stanzaskip
+ \ifdim #1<\linewidth% %% short line
+ \rightmargin \z@
+ \leftmargin \linewidth
+ \advance\leftmargin -#1\relax
+ \advance\leftmargin -0.5\leftmargin
+ \advance\leftmargin \vindent
+ \else
+ \ifdim #1>\linewidth% %% long line
+ \rightmargin \z@
+ \leftmargin \vindent
+ \else% %% default
+ \rightmargin \leftmargin
+ \advance\leftmargin \vindent
+ \fi
+ \fi}
+ \item[]}{\endlist}
+
+\newenvironment{altverse}%
+ {\starpatternfalse\patternfalse\altindenttrue
+ \setcounter{vslineno}{1}}%
+ {\altindentfalse}
+
+\newif\ifbounderror
+ \bounderrorfalse
+\newif\ifinteger
+
+\newcounter{chrsinstr} % CHARactersINSTRing
+
+\newcommand{\newarray}[3]{%
+ \@nameedef{#1-low}{#2}%
+ \@nameedef{#1-high}{#3}%
+ \ifnum #3<#2
+ \@memerror{Limits for array #1 are in reverse order}{\@ehc}%
+ \fi}
+
+\newcommand{\stringtoarray}[2]{%
+ \def\@vsarrayname{#1}%
+ \protected@edef\the@vsstring{#2}%
+ \newarray{\@vsarrayname}{1}{1}%
+ \@ifmtarg{#2}{%
+ \c@chrsinstr \z@
+ \@namedef{\@vsarrayname-1}{}
+ }{%
+ \c@chrsinstr \@ne
+ \expandafter\@vsstringtoarray \the@vsstring\@vsend
+ }}
+
+\def\@vsstringtoarray #1#2\@vsend{%
+ \@namedef{\@vsarrayname-\the\c@chrsinstr}{#1}
+ \@nameedef{\@vsarrayname-high}{\the\c@chrsinstr}
+ \@ifmtarg{#2}{%
+ \def\@vsinext{}%
+ }{%
+ \advance\c@chrsinstr \@ne
+ \def\@vsinext{%
+ \@vsstringtoarray #2\@vsend%
+ }%
+ }
+ \@vsinext}
+
+\newcommand{\setarrayelement}[3]{%
+ \checkarrayindex{#1}{#2}%
+ \@nameedef{#1-#2}{#3}}
+\newcommand{\getarrayelement}[3]{%
+ \checkarrayindex{#1}{#2}%
+ \protected@edef#3{\@nameuse{#1-#2}}}
+
+\newcommand{\checkarrayindex}[2]{%
+ \bounderrorfalse
+ \expandafter\ifx\csname #1-low\endcsname\relax%
+ \ifpattern\else
+ \@memerror{No array called #1}{\@ehc}%
+ \fi
+ \bounderrortrue
+ \fi
+ \ifnum #2<\@nameuse{#1-low}\relax%
+ \ifpattern\else
+ \@memerror{Index #2 outside limits for array #1}{\@ehc}%
+ \fi
+ \bounderrortrue
+ \fi
+ \ifnum #2>\@nameuse{#1-high}\relax%
+ \ifpattern\else
+ \@memerror{Index #2 outside limits for array #1}{\@ehc}%
+ \fi
+ \bounderrortrue
+ \fi}
+
+\newcommand{\arraytostring}[2]{%
+ \def#2{}%
+ \c@chrsinstr = \@nameuse{#1-low}%
+ \@vsarraytostring{#1}{#2}}
+
+\newcommand{\@vsarraytostring}[2]{%
+ \ifnum\c@chrsinstr>\@nameuse{#1-high}\else
+ \protected@edef#2{#2\@nameuse{#1-\thechrsinstr}}%
+ \advance\c@chrsinstr\@ne%
+ \@vsarraytostring{#1}{#2}%
+ \fi}
+
+\newcommand{\checkifinteger}[1]{%
+ \protected@edef\@vsa{#1}%
+ \ifcat _\ifnum9<1\gobm{#1} _\else A\fi
+ \integertrue%
+ \else
+ \integerfalse%
+ \fi}
+\newcommand{\gobm}[1]{#1}
+
+\newcommand{\indentpattern}[1]{%
+ \stringtoarray{Array@vs}{#1}}
+\newcommand{\get@vsindent}{%
+ \getarrayelement{Array@vs}{\number\value{vslineno}}{\@vspat}%
+ \ifbounderror
+ \arraytostring{Array@vs}{\@vsp@t}%
+ \@memwarn{%
+ Index `\thevslineno' for pattern `\@vsp@t' is out of bounds}%
+ \def\@vspat{0}%
+ \else
+ \checkifinteger{\@vspat}%
+ \ifinteger\else
+ \arraytostring{Array@vs}{\@vsp@t}%
+ \@memwarn{%
+ `\@vspat' at index `\thevslineno' in pattern `\@vsp@t'
+ is not a digit}%
+ \def\@vspat{0}%
+ \fi
+ \fi
+ \ifcase\@vspat\else\hspace*{\@vspat\vgap}\fi}
+\newcommand{\getstar@vsindent}{%
+ \expandafter\ifx\csname Array@vs-high\endcsname\relax
+ \@memerror{A pattern has not been specified}{\@ehc}
+ \else
+ \ifnum\c@vslineno>\@nameuse{Array@vs-high}%
+ \setcounter{vslineno}{1}%
+ \fi
+ \get@vsindent
+ \fi}
+
+\newenvironment{patverse}%
+ {\starpatternfalse\patterntrue\altindentfalse
+ \setcounter{vslineno}{1}}%
+ {\patternfalse}
+
+\newenvironment{patverse*}%
+ {\starpatterntrue\patternfalse\altindentfalse
+ \setcounter{vslineno}{1}}%
+ {\starpatternfalse}
+
+\newcommand{\poemtitle}{\par%
+ \secdef\@vsptitle\@vssptitle}
+\newcommand{\poemtoc}{section}
+
+\newcommand{\mempoeminfo}[1]{}
+\newcommand{\mempoemstarinfo}[1]{}
+
+\long\def\@vsptitle[#1]#2{%
+ \phantomsection
+ \addcontentsline{toc}{\poemtoc}{#1}%
+ \M@gettitle{#1}%
+ \mempoeminfo{#1}%
+ \poemtitlemark{#1}%
+ \@vstypeptitle{#2}%
+ \@afterheading}
+
+\long\def\@vssptitle#1{%
+ \M@gettitle{#1}%
+ \mempoemstarinfo{#1}%
+ \@vstypeptitle{#1}%
+ \@afterheading}
+
+\newcommand{\@vstypeptitle}[1]{%
+ \vspace{\beforepoemtitleskip}%
+ {\poemtitlefont #1\par}%
+ \vspace{\afterpoemtitleskip}%
+}
+
+\newcommand{\poemtitlefont}{\normalfont\large\bfseries\centering}
+\newcommand{\poemtitlemark}[1]{}
+
+\newlength{\beforepoemtitleskip}
+ \setlength{\beforepoemtitleskip}{3.5ex \@plus 1ex \@minus .2ex}
+\newlength{\afterpoemtitleskip}
+ \setlength{\afterpoemtitleskip}{2.3ex \@plus.2ex}
+
+\newif\if@numptitle
+\newcommand*{\NumberPoemTitle}{\@numptitletrue}
+\newcommand*{\PlainPoemTitle}{\@numptitlefalse}
+\NumberPoemTitle
+
+\newcounter{poem}\setcounter{poem}{0}
+ \renewcommand*{\thepoem}{\@arabic\c@poem}
+\newcommand*{\theHpoem}{\arabic{poem}}
+
+\newcommand*{\poemtitlestarmark}[1]{}
+\newcommand*{\poemtitlepstyle}{}
+\newcommand*{\poemtitlestarpstyle}{}
+
+\newcommand\PoemTitle{%
+ \par
+ \@afterindentfalse
+ \@ifstar{\@m@msPoemTitle}{\@m@mPoemTitle}}
+
+\newcommand{\@m@mPoemTitle}[1][]{%
+ \def\poemt@c{#1}% capture first optional arg
+ \@ifnextchar[{\@PoemTitle}{\@PoemTitle[]}%
+}
+
+\newcommand{\memPoemTitleinfo}[4]{}
+\newcommand{\memPoemTitlestarinfo}[2]{}
+
+\def\@PoemTitle[#1]#2{%
+ \phantomsection
+ \ifx\poemt@c\@empty % no optional args
+ \def\poemf@rtoc{#2}%
+ \def\poemf@rhdr{#2}%
+ \else % at least one opt arg
+ \let\poemf@rtoc\poemt@c
+ \ifx\@empty#1\@empty
+ \let\poemf@rhdr\poemt@c
+ \else
+ \def\poemf@rhdr{#1}%
+ \fi
+ \fi
+ \m@m@Andfalse
+ \if@numptitle
+ \if@mainmatter
+ \m@m@Andtrue
+ \fi
+ \fi
+ \ifm@m@And
+ \refstepcounter{poem}%
+ \fi
+ \@makePoemTitlehead{#2}%
+ \@afterheading
+ \poemtitlemark{\poemf@rhdr}%
+ \poemtitlepstyle
+ \ifm@m@And
+ \addcontentsline{toc}{\poemtoc}{%
+ \protect\numberline{\thepoem}\poemf@rtoc}%
+ \memPoemTitleinfo{\thepoem}{\poemf@rtoc}{\poemf@rhdr}{#2}%
+ \else
+ \addcontentsline{toc}{\poemtoc}{\poemf@rtoc}%
+ \memPoemTitleinfo{}{\poemf@rtoc}{\poemf@rhdr}{#2}%
+ \fi
+ \ifheadnameref\M@gettitle{\poemf@rhdr}\else\M@gettitle{\poemf@rtoc}\fi}
+
+\def\@makePoemTitlehead#1{{%
+ \PoemTitleheadstart
+ \parindent \z@ \normalfont
+ \ifm@m@And
+ \printPoemTitlenum
+ \afterPoemTitlenum
+ \else
+ \printPoemTitlenonum
+ \fi
+ \interlinepenalty\@M
+ \printPoemTitletitle{#1}%
+ \afterPoemTitle}}
+
+\newcommand{\@PTchs@def@ult}{%
+ \def\PoemTitleheadstart{\vspace{\beforePoemTitleskip}}
+ \def\printPoemTitlenum{\PoemTitlenumfont \thepoem}
+ \def\afterPoemTitlenum{\par\nobreak\vskip \midPoemTitleskip}
+ \def\printPoemTitlenonum{}
+ \def\printPoemTitletitle##1{\PoemTitlefont ##1}
+ \def\afterPoemTitle{\par\nobreak\vskip \afterPoemTitleskip}}
+\@PTchs@def@ult
+
+\newcommand*{\PoemTitlenumfont}{\normalfont\large\centering}
+\newcommand*{\PoemTitlefont}{\normalfont\large\centering}
+\newlength{\beforePoemTitleskip}
+ \setlength{\beforePoemTitleskip}{1\onelineskip}
+\newlength{\midPoemTitleskip}
+ \setlength{\midPoemTitleskip}{0pt}
+\newlength{\afterPoemTitleskip}
+ \setlength{\afterPoemTitleskip}{1\onelineskip}
+
+\newcommand{\@m@msPoemTitle}[2][\@empty]{%
+ \@sPoemTitle{#2}%
+ \ifx \@empty#1
+ \def\poemf@rhdr{#2}%
+ \else % opt arg
+ \def\poemf@rhdr{#1}%
+ \fi
+ \poemtitlestarmark{\poemf@rhdr}%
+ \poemtitlestarpstyle
+ \memPoemTitlestarinfo{\poemf@rhdr}{#2}}
+
+\newcommand{\@sPoemTitle}[1]{%
+ \@makesPoemTitlehead{#1}%
+ \@afterheading
+ \M@gettitle{#1}}
+
+\def\@makesPoemTitlehead#1{{%
+ \PoemTitleheadstart
+ \parindent \z@ \normalfont
+ \printPoemTitlenonum
+ \interlinepenalty\@M
+ \printPoemTitletitle{#1}
+ \afterPoemTitle}}
+
+\setlength\arraycolsep{5\p@}
+\setlength\tabcolsep{6\p@}
+\setlength\arrayrulewidth{.4\p@}
+\setlength\doublerulesep{2\p@}
+\setlength\tabbingsep{\labelsep}
+
+\newcommand{\@minipagerestore}{%
+ \let\@verbfootnotetext\@verbmpfootnotetext
+ \m@mdoextrafeetmini
+ \ifm@mnzpskip \parskip=\m@mabparskip\fi}
+
+\skip\@mpfootins = \skip\footins
+
+\setlength\fboxsep{3\p@}
+\setlength\fboxrule{.4\p@}
+
+\@addtoreset{equation}{chapter}
+\renewcommand{\theequation}{%
+ \ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+
+%%%%%%%%%% Array package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% Frank Mittelbach & David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\def\@addtopreamble#1{\xdef\@preamble{\@preamble #1}}
+\def\@testpach{\@chclass
+ \ifnum \@lastchclass=6 \@ne \@chnum \@ne \else
+ \ifnum \@lastchclass=7 5 \else
+ \ifnum \@lastchclass=8 \tw@ \else
+ \ifnum \@lastchclass=9 \thr@@
+ \else \z@
+ \ifnum \@lastchclass = 10 \else
+ \edef\@nextchar{\expandafter\string\@nextchar}%
+ \@chnum
+ \if \@nextchar c\z@ \else
+ \if \@nextchar l\@ne \else
+ \if \@nextchar r\tw@ \else
+ \z@ \@chclass
+ \if\@nextchar |\@ne \else
+ \if \@nextchar !6 \else
+ \if \@nextchar @7 \else
+ \if \@nextchar <8 \else
+ \if \@nextchar >9 \else
+ 10
+ \@chnum
+ \if \@nextchar m\thr@@\else
+ \if \@nextchar p4 \else
+ \if \@nextchar b5 \else
+ \z@ \@chclass \z@ \@preamerr \z@ \fi \fi \fi \fi
+ \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi \fi}
+\def\prepnext@tok{\advance \count@ \@ne
+ \toks\count@{}}
+
+\def\save@decl{\toks \count@ = \expandafter\expandafter\expandafter
+ {\expandafter\@nextchar\the\toks\count@}}
+
+\def\insert@column{%
+ \the@toks \the \@tempcnta
+ \ignorespaces \@sharp \unskip
+ \the@toks \the \count@ \relax}
+\let\m@mold@addamp\@addamp
+\newcommand*{\m@m@addamp}{%
+ \if@firstamp
+ \@firstampfalse
+ \global\@curtab\@ne
+ \else
+ \@addtopreamble{&}
+ \global\advance\@curtab\@ne
+ \fi}
+\let\@addamp\m@m@addamp
+
+\newdimen\col@sep
+\def\@acol{\@addtopreamble{\hskip\col@sep}}
+\def\@mkpream#1{\gdef\@preamble{}\@lastchclass 4 \@firstamptrue
+ \let\@sharp\relax \let\@startpbox\relax \let\@endpbox\relax
+ \@temptokena{#1}\@tempswatrue
+ \@whilesw\if@tempswa\fi{\@tempswafalse\the\NC@list}%
+ \count@\m@ne
+ \let\the@toks\relax
+ \prepnext@tok
+ \expandafter \@tfor \expandafter \@nextchar
+ \expandafter :\expandafter =\the\@temptokena \do
+ {\@testpach
+ \ifcase \@chclass \@classz \or \@classi \or \@classii
+ \or \save@decl \or \or \@classv \or \@classvi
+ \or \@classvii \or \@classviii
+ \or \@classx
+ \or \@classx \fi
+ \@lastchclass\@chclass}%
+ \ifcase\@lastchclass
+ \@acol \or
+ \or
+ \@acol \or
+ \@preamerr \thr@@ \or
+ \@preamerr \tw@ \@addtopreamble\@sharp \or
+ \or
+ \else \@preamerr \@ne \fi
+ \def\the@toks{\the\toks}}
+\def\@classx{%
+ \ifcase \@lastchclass
+ \@acolampacol \or
+ \@addamp \@acol \or
+ \@acolampacol \or
+ \or
+ \@acol \@firstampfalse \or
+ \@addamp
+ \fi}
+\def\@classz{\@classx
+ \@tempcnta \count@
+ \prepnext@tok
+ \@addtopreamble{\ifcase \@chnum
+ \hfil
+ \d@llarbegin
+ \insert@column
+ \d@llarend \hfil \or
+ \hskip1sp\d@llarbegin \insert@column \d@llarend \hfil \or
+ \hfil\hskip1sp\d@llarbegin \insert@column \d@llarend \or
+ $\vcenter%$
+ \@startpbox{\@nextchar}\insert@column \@endpbox $\or%$
+ \vtop \@startpbox{\@nextchar}\insert@column \@endpbox \or
+ \vbox \@startpbox{\@nextchar}\insert@column \@endpbox
+ \fi}\prepnext@tok}
+
+\let\@classix\relax
+
+\def\@classviii{\ifnum \@lastchclass >\z@\ifnum\@lastchclass=\tw@\else
+ \@preamerr 4\@chclass 6 \@classvi \fi\fi}
+
+\def\@arrayrule{\@addtopreamble \vline}
+
+\def\@classvii{\ifnum \@lastchclass = \thr@@
+ \@preamerr \thr@@ \fi}
+
+\def\@classvi{\ifcase \@lastchclass
+ \@acol \or
+ \@addtopreamble{\hskip \doublerulesep}\or
+ \@acol \or
+ \@classvii
+ \fi}
+
+\def\@classii{\advance \count@ \m@ne
+ \save@decl\prepnext@tok}
+
+\def\@classv{\save@decl
+ \expandafter\NC@ecs\@nextchar\extracolsep{}\extracolsep\@@@
+ \@addtopreamble{\d@llarbegin\the@toks\the\count@\relax\d@llarend}%
+ \prepnext@tok}
+\def\NC@ecs#1\extracolsep#2#3\extracolsep#4\@@@{\def\@tempa{#2}%
+ \ifx\@tempa\@empty\else\toks\count@={#1\tabskip#2\relax#3}\fi}
+
+\def\@classi{\@classvi
+ \ifcase \@chnum \@arrayrule \or
+ \@classv \fi}
+
+\def\@startpbox#1{\bgroup
+ \setlength\hsize{#1}\@arrayparboxrestore
+ \everypar{%
+ \vrule \@height \ht\@arstrutbox \@width \z@
+ \everypar{}}%
+ }
+\def\@endpbox{\@finalstrut\@arstrutbox \egroup\hfil}
+\def\@array[#1]#2{%
+ \@tempdima \ht \strutbox
+ \advance \@tempdima by\extrarowheight
+ \setbox \@arstrutbox \hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@}%
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\@preamble{\noexpand \ialign \@halignto
+ \bgroup \@arstrut \@preamble
+ \tabskip \z@ \cr}%
+ \endgroup
+ \@arrayleft
+ \if #1t\vtop \else \if#1b\vbox \else \vcenter \fi \fi
+ \bgroup
+ \let \@sharp ##\let \protect \relax
+ \lineskip \z@
+ \baselineskip \z@
+ \m@th
+ \let\\\@arraycr \let\tabularnewline\\\let\par\@empty \@preamble}
+\newdimen \extrarowheight
+\extrarowheight=0pt
+\def\@arstrut{\unhcopy\@arstrutbox}
+\def\@arraycr{\relax\iffalse{\fi\ifnum 0=`}\fi
+ \@ifstar \@xarraycr \@xarraycr}
+\def\@xarraycr{\@ifnextchar [%
+ \@argarraycr {\ifnum 0=`{}\fi\cr}}
+\def\@argarraycr[#1]{\ifnum0=`{}\fi\ifdim #1>\z@
+ \expandafter\@xargarraycr\else
+ \expandafter\@yargarraycr\fi{#1}}
+\def\@xargarraycr#1{\unskip
+ \@tempdima #1\advance\@tempdima \dp\@arstrutbox
+ \vrule \@depth\@tempdima \@width\z@ \cr}
+\def\@yargarraycr#1{\cr\noalign{\vskip #1}}
+\long\def\multicolumn#1#2#3{%
+ \multispan{#1}\begingroup
+ \def\@addamp{\if@firstamp \@firstampfalse \else
+ \@preamerr 5\fi}%
+ \@mkpream{#2}\@addtopreamble\@empty
+ \endgroup
+ \def\@sharp{#3}%
+ \@arstrut \@preamble
+ \null
+ \ignorespaces}
+\let\d@llarbegin\begingroup
+\let\d@llarend\endgroup
+\def\array{\col@sep\arraycolsep
+ \def\d@llarbegin{$}\let\d@llarend\d@llarbegin\gdef\@halignto{}%$
+ \@tabarray}
+\def\@tabarray{\@ifnextchar[{\@@array}{\@@array[c]}}
+\let\@@array\@array
+\def\tabular{\gdef\@halignto{}\@tabular}
+\expandafter\def\csname tabular*\endcsname#1{%
+ \setlength\dimen@{#1}%
+ \xdef\@halignto{to\the\dimen@}\@tabular}
+\def\@tabular{%
+ \leavevmode
+ \hbox \bgroup $\col@sep\tabcolsep \let\d@llarbegin\begingroup%$
+ \let\d@llarend\endgroup
+ \@tabarray}
+\def\endarray{\crcr \egroup \egroup \@arrayright \gdef\@preamble{}}
+\let\@arrayleft\@empty
+\let\@arrayright\@empty
+\def\endtabular{\endarray $\egroup}%$
+\expandafter\let\csname endtabular*\endcsname=\endtabular
+\let\@ampacol=\relax \let\@expast=\relax
+\let\@arrayclassiv=\relax \let\@arrayclassz=\relax
+\let\@tabclassiv=\relax \let\@tabclassz=\relax
+\let\@arrayacol=\relax \let\@tabacol=\relax
+\let\@tabularcr=\relax \let\@@endpbox=\relax
+\let\@argtabularcr=\relax \let\@xtabularcr=\relax
+\def\@preamerr#1{\def\@tempd{{..} at wrong position: }%
+ \ClassError{bidimemoir}{%
+ \ifcase #1 Illegal pream-token (\@nextchar): `c' used\or %0
+ Missing arg: token ignored\or %1
+ Empty preamble: `l' used\or %2
+ >\@tempd token ignored\or %3
+ <\@tempd changed to !{..}\or %4
+ Only one column-spec. allowed.\fi}\@ehc} %5
+
+\def\newcolumntype#1{%
+ \edef\NC@char{\string#1}%
+ \@ifundefined{NC@find@\NC@char}%
+ {\@tfor\next:=<>clrmbp@!|\do{\if\noexpand\next\NC@char
+ \@memwarn{Redefining primitive column \NC@char}\fi}%
+ \NC@list\expandafter{\the\NC@list\NC@do#1}}%
+ {\@memwarn{Column \NC@char\space is already defined}}%
+ \@namedef{NC@find@\NC@char}##1#1{\NC@{##1}}%
+ \@ifnextchar[{\newcol@{\NC@char}}{\newcol@{\NC@char}[0]}}
+\def\newcol@#1[#2]#3{\expandafter\@reargdef
+ \csname NC@rewrite@#1\endcsname[#2]{\NC@find#3}}
+\def\NC@#1{%
+ \@temptokena\expandafter{\the\@temptokena#1}\futurelet\next\NC@ifend}
+\def\NC@ifend{%
+ \ifx\next\relax
+ \else\@tempswatrue\expandafter\NC@rewrite\fi}
+\def\NC@do#1{%
+ \expandafter\let\expandafter\NC@rewrite
+ \csname NC@rewrite@\string#1\endcsname
+ \expandafter\let\expandafter\NC@find
+ \csname NC@find@\string#1\endcsname
+ \expandafter\@temptokena\expandafter{\expandafter}%
+ \expandafter\NC@find\the\@temptokena#1\relax}
+\def\showcols{{\def\NC@do##1{\let\NC@do\NC@show}\the\NC@list}}
+\def\NC@show#1{%
+ \typeout{Column #1\expandafter\expandafter\expandafter\NC@strip
+ \expandafter\meaning\csname NC@rewrite@#1\endcsname\@@}}
+\def\NC@strip#1:#2->#3 #4\@@{#2 -> #4}
+\newtoks\NC@list
+\newcolumntype{*}[2]{}
+\long\@namedef{NC@rewrite@*}#1#2{%
+ \count@#1\relax
+ \loop
+ \ifnum\count@>\z@
+ \advance\count@\m@ne
+ \@temptokena\expandafter{\the\@temptokena#2}%
+ \repeat
+ \NC@find}
+
+\newlength{\extratabsurround}
+\setlength{\extratabsurround}{2pt}
+\newlength{\backup@length}
+\newcommand{\firsthline}{%
+ \multicolumn1c{%
+ \global\backup@length\ht\@arstrutbox
+ \global\advance\backup@length\dp\@arstrutbox
+ \global\advance\backup@length\arrayrulewidth
+ \raise\extratabsurround\copy\@arstrutbox
+ }\\[-\backup@length]\hline
+}
+\newcommand{\lasthline}{\hline\multicolumn1c{%
+ \global\backup@length2\ht\@arstrutbox
+ \global\advance\backup@length2\dp\@arstrutbox
+ \global\advance\backup@length\arrayrulewidth
+ }\\[-\backup@length]%
+ \multicolumn1c{%
+ \lower\extratabsurround\copy\@arstrutbox
+ }%
+}
+\CheckCommand*\@xhline{\ifx\reserved@a\hline
+ \vskip\doublerulesep
+ \vskip-\arrayrulewidth
+ \fi
+ \ifnum0=`{\fi}}
+\renewcommand*\@xhline{\ifx\reserved@a\hline
+ \vskip\doublerulesep
+ \fi
+ \ifnum0=`{\fi}}
+
+%%%%%%%%%%% end Array package code %%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%% Dcolumn package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\def\DC@#1#2#3{%
+ \uccode`\~=`#1\relax
+ \m@th
+ \afterassignment\DC@x\count@#3\relax{#1}{#2}}
+\def\DC@x#1\relax#2#3{%
+ \ifnum\z@>\count@
+ \expandafter\DC@centre
+ \else
+ \expandafter\DC@right
+ \fi
+ {#2}{#3}{#1}}
+\def\DC@centre#1#2#3{%
+ \let\DC@end\DC@endcentre
+ \uppercase{\def~}{$\egroup\setbox\tw@=\hbox\bgroup${#2}}%$
+ \setbox\tw@=\hbox{${\phantom{{#2}}}$}%
+ \setbox\z@=\hbox\bgroup$\mathcode`#1="8000 }%$
+\def\DC@endcentre{$\egroup%$
+ \ifdim \wd\z@>\wd\tw@
+ \setbox\tw@=\hbox to\wd\z@{\unhbox\tw@\hfill}%
+ \else
+ \setbox\z@=\hbox to\wd\tw@{\hfill\unhbox\z@}\fi
+ \box\z@\box\tw@}
+\def\DC@right#1#2#3{%
+ \ifx\relax#3\relax
+ \hfill
+ \let\DC@rl\bgroup
+ \else
+ \edef\DC@rl{to\the\count@\dimen@ii\bgroup\hss\hfill}%
+ \count@\@gobble#3\relax
+ \fi
+ \let\DC@end\DC@endright
+ \uppercase{\def~}{$\egroup\setbox\tw@\hbox to\dimen@\bgroup${#2}}%
+ \setbox\z@\hbox{$1$}\dimen@ii\wd\z@
+ \dimen@\count@\dimen@ii
+ \setbox\z@\hbox{${#2}$}\advance\dimen@\wd\z@
+ \setbox\tw@\hbox to\dimen@{}%
+ \setbox\z@\hbox\DC@rl$\mathcode`#1="8000 }%$
+\def\DC@endright{$\hfil\egroup\box\z@\box\tw@}%$
+\newcolumntype{D}[3]{>{\DC@{#1}{#2}{#3}}c<{\DC@end}}
+
+%%%%%%%%%% end Dcolumn package code %%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%% Delarray package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\def\@@array[#1]{\@ifnextchar\bgroup
+ {\let\@arrayleft\relax\let\@arrayright\relax\@array[#1]}%
+ {\@del@array[#1]}}
+\def\@del@array[#1]#2#3#4{%
+ \setbox\z@\hbox{$\left#2\right#4$}%
+ \if#1c\def\@arrayleft{\left#2}\def\@arrayright{\right#4}%
+ \else\def\@arrayleft{\setbox\z@}%
+ \def\@arrayright{%
+ \dimen@=\dp\z@
+ \advance\dimen@-\ht\z@
+ \divide \dimen@ by \tw@
+ \advance\dimen@ by\fontdimen22 \textfont\tw@
+ \lower\dimen@\hbox{$\left#2\vcenter{\unvbox\z@}\right#4$}}%
+ \fi
+ \@array[#1]{#3}}
+%%%%%%%%%% end Delarray package code %%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%% Tabularx package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% With acknowledgements to David Carlisle %%%%%%%%%%%%%%%%%%%%%
+
+\newdimen\TX@col@width
+\newdimen\TX@old@table
+\newdimen\TX@old@col
+\newdimen\TX@target
+\newdimen\TX@delta
+\newcount\TX@cols
+\newif\ifTX@
+\def\tabularx#1{%
+\edef\TX@{\@currenvir}%
+ {\ifnum0=`}\fi
+ \setlength\TX@target{#1}%
+ \TX@typeout{Target width: #1 = \the\TX@target.}%
+ \toks@{}\TX@get@body}
+
+\let\endtabularx\relax
+\long\def\TX@get@body#1\end
+ {\toks@\expandafter{\the\toks@#1}\TX@find@end}
+\def\TX@find@end#1{%
+ \def\@tempa{#1}%
+ \ifx\@tempa\TX@\expandafter\TX@endtabularx
+ \else\toks@\expandafter
+ {\the\toks@\end{#1}}\expandafter\TX@get@body\fi}
+\def\TX@{tabularx}
+\def\TX@endtabularx{%
+ \expandafter\TX@newcol\expandafter{\tabularxcolumn{\TX@col@width}}%
+ \let\verb\TX@verb
+ \def\@elt##1{\global\value{##1}\the\value{##1}\relax}%
+ \edef\TX@ckpt{\cl@@ckpt}%
+ \let\@elt\relax
+ \TX@old@table\maxdimen
+ \TX@col@width\TX@target
+ \global\TX@cols\@ne
+ \TX@typeout@
+ {\@spaces Table Width\@spaces Column Width\@spaces X Columns}%
+ \TX@trial{\def\NC@rewrite@X{%
+ \global\advance\TX@cols\@ne\NC@find p{\TX@col@width}}}%
+ \loop
+ \TX@arith
+ \ifTX@
+ \TX@trial{}%
+ \repeat
+ {\let\@footnotetext\TX@ftntext\let\@xfootnotenext\TX@xftntext
+ \csname tabular*\expandafter\endcsname\expandafter\TX@target
+ \the\toks@
+ \csname endtabular*\endcsname}%
+ \global\TX@ftn\expandafter{\expandafter}\the\TX@ftn
+ \ifnum0=`{\fi}%
+ \expandafter\end\expandafter{\TX@}}
+\def\TX@arith{%
+ \TX@false
+ \ifdim\TX@old@table=\wd\@tempboxa
+ \TX@col@width\TX@old@col
+ \TX@typeout@{Reached minimum width, backing up.}%
+ \else
+ \dimen@\wd\@tempboxa
+ \advance\dimen@ -\TX@target
+ \ifdim\dimen@<\TX@delta
+ \TX@typeout@{Reached target.}%
+ \else
+ \ifnum\TX@cols>\@ne
+ \advance\TX@cols\m@ne
+ \fi
+ \divide\dimen@\TX@cols
+ \advance\dimen@ -\TX@col@width
+ \ifdim \dimen@ >\z@
+ \@memwarn{X Columns too narrow (table too wide)\MessageBreak}%
+ \TX@col@width\TX@error@width\relax
+ \else
+ \TX@old@col\TX@col@width
+ \TX@old@table\wd\@tempboxa
+ \TX@col@width-\dimen@
+ \TX@true
+ \fi
+ \fi
+ \fi}
+\def\TX@error@width{1em}
+\TX@delta\hfuzz
+\newcolumntype{X}{}
+\def\tabularxcolumn#1{p{#1}}
+\def\TX@newcol{\newcol@{X}[0]}
+\def\TX@trial#1{%
+ \setbox\@tempboxa\hbox{%
+ #1\relax
+ \let\@footnotetext\TX@trial@ftn
+ \let\TX@vwarn\@empty
+ \expandafter\let\expandafter\tabularx\csname tabular*\endcsname
+ \expandafter\let\expandafter\endtabularx\csname endtabular*\endcsname
+ \def\write{\begingroup
+ \def\let{\afterassignment\endgroup\toks@}%
+ \afterassignment\let\count@}%
+ \hbadness\@M
+ \hfuzz\maxdimen
+ \let\hbadness\@tempcnta
+ \let\hfuzz\@tempdima
+ \expandafter\tabular\the\toks@
+ \endtabular}%
+ \TX@ckpt
+ \TX@typeout@{\@spaces
+ \expandafter\TX@align
+ \the\wd\@tempboxa\space\space\space\space\space\@@
+ \expandafter\TX@align
+ \the\TX@col@width\space\space\space\space\space\@@
+ \@spaces\the\TX@cols}}
+\def\TX@align#1.#2#3#4#5#6#7#8#9\@@{%
+ \ifnum#1<10 \space\fi
+ \ifnum#1<100 \space\fi
+ \ifnum#1<\@m\space\fi
+ \ifnum#1<\@M\space\fi
+ #1.#2#3#4#5#6#7#8\space\space}
+\def\arraybackslash{\let\\\@arraycr}
+\def\tracingtabularx{%
+ \def\TX@typeout{\ClassWarningNoLine{bidimemoir}}%
+ \def\TX@typeout@##1{\typeout{(tabularx) ##1}}}
+\let\TX@typeout\@gobble
+\let\TX@typeout@\@gobble
+\newtoks\TX@ftn
+\long\def\TX@ftntext#1{%
+ \edef\@tempa{\the\TX@ftn\noexpand\footnotetext
+ [\the\csname c@\@mpfn\endcsname]}%
+ \global\TX@ftn\expandafter{\@tempa{#1}}}%
+\long\def\TX@xftntext[#1]#2{%
+ \global\TX@ftn\expandafter{\the\TX@ftn\footnotetext[#1]{#2}}}
+\long\def\TX@trial@ftn#1{}
+{\uccode`\*=`\ %
+\uppercase{\gdef\TX@verb{%
+ \leavevmode\null\TX@vwarn
+ {\ifnum0=`}\fi\ttfamily\let\\\ignorespaces
+ \@ifstar{\let~*\TX@vb}{\TX@vb}}}}
+\def\TX@vb#1{\def\@tempa##1#1{\toks@{##1}\edef\@tempa{\the\toks@}%
+ \expandafter\TX@v\meaning\@tempa\\ \\\ifnum0=`{\fi}}\@tempa!}
+\def\TX@v#1!{\afterassignment\TX@vfirst\let\@tempa= }
+\begingroup
+\catcode`\*=\catcode`\#
+\catcode`\#=12
+\gdef\TX@vfirst{%
+ \if\@tempa#%
+ \def\@tempb{\TX@v@#}%
+ \else
+ \let\@tempb\TX@v@
+ \if\@tempa\space~\else\@tempa\fi
+ \fi
+ \@tempb}
+\gdef\TX@v@*1 *2{%
+ \TX@v@hash*1##\relax\if*2\\\else~\expandafter\TX@v@\fi*2}
+\gdef\TX@v@hash*1##*2{*1\ifx*2\relax\else#\expandafter\TX@v@hash\fi*2}
+\endgroup
+\def\TX@vwarn{%
+ \@warning{\noexpand\verb may be unreliable inside tabularx}%
+ \global\let\TX@vwarn\@empty}
+
+%%%%%%%%%% end Tabularx package code %%%%%%%%%%%%%%%%%%%%%
+
+%%\@memfakeusepackage{array}
+%%\@memfakeusepackage{dcolumn}
+%%\@memfakeusepackage{delarray}
+%%\@memfakeusepackage{tabularx}
+
+\newcommand*{\bktabrule}[1]{%
+ \hrule \@height#1}
+
+%%%%%%%%%% Booktabs package code %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% slightly modified by PRW %%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%% by permission of Simon Fear %%%%%%%%%%%%%%%%%%%%%
+
+\AtBeginDocument{%
+ \providecommand*{\CT@arc@}{}}
+
+\newdimen\heavyrulewidth
+\newdimen\lightrulewidth
+\newdimen\cmidrulewidth
+\newdimen\belowrulesep
+\newdimen\belowbottomsep
+\newdimen\aboverulesep
+\newdimen\abovetopsep
+\newdimen\cmidrulesep
+\newdimen\cmidrulekern
+\newdimen\defaultaddspace
+\heavyrulewidth=.08em
+\lightrulewidth=.05em
+\cmidrulewidth=.03em
+\belowrulesep=.65ex
+\belowbottomsep=\z@
+\aboverulesep=.4ex
+\abovetopsep=\z@
+\cmidrulesep=\doublerulesep
+\cmidrulekern=.5em
+\defaultaddspace=.5em
+
+\newcount\@cmidla
+\newcount\@cmidlb
+\newdimen\@aboverulesep
+\newdimen\@belowrulesep
+\newcount\@thisruleclass
+\newcount\@lastruleclass
+\@lastruleclass=0
+\newdimen\@thisrulewidth
+
+\def\futurenonspacelet#1{\def\@BTcs{#1}%
+ \afterassignment\@BTfnslone\let\nexttoken= }
+\def\@BTfnslone{\expandafter\futurelet\@BTcs\@BTfnsltwo}
+\def\@BTfnsltwo{\expandafter\ifx\@BTcs\@sptoken\let\next=\@BTfnslthree
+ \else\let\next=\nexttoken\fi \next}
+\def\@BTfnslthree{\afterassignment\@BTfnslone\let\next= }
+
+\def\toprule{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=\abovetopsep
+ \global\@belowrulesep=\belowrulesep
+ \global\@thisruleclass=\@ne
+ \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}
+
+\def\midrule{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=\aboverulesep
+ \global\@belowrulesep=\belowrulesep
+ \global\@thisruleclass=\@ne
+ \@ifnextchar[{\@BTrule}{\@BTrule[\lightrulewidth]}}
+
+\def\bottomrule{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=\aboverulesep
+ \global\@belowrulesep=\belowbottomsep
+ \global\@thisruleclass=\@ne
+ \@ifnextchar[{\@BTrule}{\@BTrule[\heavyrulewidth]}}
+
+\def\specialrule#1#2#3{\noalign{\ifnum0=`}\fi
+ \@aboverulesep=#2\global\@belowrulesep=#3\global\@thisruleclass=\tw@
+ \@BTrule[#1]}
+
+\def\addlinespace{\noalign{\ifnum0=`}\fi
+ \@ifnextchar[{\@addspace}{\@addspace[\defaultaddspace]}}
+\def\@addspace[#1]{\global\@belowrulesep=#1\global\@thisruleclass=\tw@
+ \futurelet\@tempa\@BTendrule}
+
+\def\@BTrule[#1]{%
+ \global\@thisrulewidth=#1\relax
+ \ifnum\@thisruleclass=\tw@\vskip\@aboverulesep\else
+ \ifnum\@lastruleclass=\z@\vskip\@aboverulesep\else
+ \ifnum\@lastruleclass=\@ne\vskip\doublerulesep\fi\fi\fi
+
+ \ifx\longtable\undefined\let\@BTswitch\@BTnormal\else
+ \ifx\hline\LT@hline\let\@BTswitch\@BLTrule
+ \else\let\@BTswitch\@BTnormal\fi\fi
+ \@BTswitch}
+
+\def\@BTnormal{%
+%% \bktabrule{\@thisrulewidth}
+ {\CT@arc@\bktabrule{\@thisrulewidth}}%
+ \futurenonspacelet\@tempa\@BTendrule}
+\def\@BLTrule{\@ifnextchar({\@@BLTrule}{\@@BLTrule()}}
+\def\@@BLTrule(#1){\@setrulekerning{#1}%
+\global\@cmidlb\LT@cols
+\ifnum0=`{\fi}%
+\@cmidruleb
+\noalign{\ifnum0=`}\fi
+\futurenonspacelet\@tempa\@BTendrule}
+
+\def\@BTendrule{%
+ \ifx\@tempa\toprule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\midrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\bottomrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\cmidrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\specialrule\global\@lastruleclass=\@thisruleclass
+ \else\ifx\@tempa\addlinespace\global\@lastruleclass=\@thisruleclass
+ \else\global\@lastruleclass=\z@\fi\fi\fi\fi\fi\fi
+ \ifnum\@lastruleclass=\@ne\relax\else\vskip\@belowrulesep\fi
+ \ifnum0=`{\fi}}
+\def\@setrulekerning#1{%
+ \global\let\cmrkern@l\z@
+ \global\let\cmrkern@r\z@
+ \@tfor\@tempa :=#1\do
+ {\def\@tempb{r}%
+ \ifx\@tempa\@tempb
+ \global\let\cmrkern@r\cmidrulekern
+ \def\cmrsideswitch{\cmrkern@r}%
+ \else
+ \def\@tempb{l}%
+ \ifx\@tempa\@tempb
+ \global\let\cmrkern@l\cmidrulekern
+ \def\cmrsideswitch{\cmrkern@l}%
+ \else
+ \global\expandafter\let\cmrsideswitch\@tempa
+ \fi
+ \fi}}
+
+\def\cmidrule{\noalign{\ifnum0=`}\fi
+ \@ifnextchar[{\@cmidrule}{\@cmidrule[\cmidrulewidth]}}
+\def\@cmidrule[#1]{\@ifnextchar({\@@cmidrule[#1]}{\@@cmidrule[#1]()}}
+\def\@@cmidrule[#1](#2)#3{\@@@cmidrule[#3]{#1}{#2}}
+
+\def\@@@cmidrule[#1-#2]#3#4{\global\@cmidla#1\relax
+ \global\advance\@cmidla\m@ne
+ \ifnum\@cmidla>0\global\let\@gtempa\@cmidrulea\else
+ \global\let\@gtempa\@cmidruleb\fi
+ \global\@cmidlb#2\relax
+ \global\advance\@cmidlb-\@cmidla
+ \global\@thisrulewidth=#3
+ \@setrulekerning{#4}
+ \ifnum\@lastruleclass=\z@\vskip \aboverulesep\fi
+ \ifnum0=`{\fi}\@gtempa
+ \noalign{\ifnum0=`}\fi\futurenonspacelet\@tempa\@xcmidrule}
+\def\@xcmidrule{\ifx\@tempa\cmidrule\vskip-\@thisrulewidth
+ \global\@lastruleclass=\@ne\else
+ \ifx\@tempa\morecmidrules\vskip \cmidrulesep
+ \global\@lastruleclass=\@ne\else
+ \vskip \belowrulesep\global\@lastruleclass=\z@\fi\fi
+ \ifnum0=`{\fi}}
+
+\def\@cmidrulea{%
+ \multispan\@cmidla&\multispan\@cmidlb
+%% \unskip\hskip \cmrkern@l\leaders\bktabrule{\@thisrulewidth}\hfill
+ \unskip\hskip \cmrkern@l{%
+ \CT@arc@\leaders\bktabrule{\@thisrulewidth}\hfill}%
+ \hskip \cmrkern@r\cr}
+\def\@cmidruleb{%
+ \multispan\@cmidlb
+%% \unskip\hskip \cmrkern@l\leaders\bktabrule{\@thisrulewidth}\hfill
+ \unskip\hskip \cmrkern@l{%
+ \CT@arc@\leaders\bktabrule{\@thisrulewidth}\hfill}%
+ \hskip \cmrkern@r\cr}
+
+\def\morecmidrules{\noalign{\relax}}
+
+%%%%%%%%%% end of Booktabs package code %%%%%%%%%%%%%%%%%%%%%
+
+%%\@memfakeusepackage{booktabs}
+
+\ifetex
+ \renewcommand*{\killm@matf}[1]{%
+ \ifnum 6=\currentgrouptype
+ \ifvmode
+ \expandafter\expandafter\expandafter\@firstoftwo
+ \expandafter\expandafter\expandafter\noalign
+ \fi
+ \fi
+ \@firstofone
+ {\@namelet{#1-m@mfb}\relax
+ \@namelet{#1-m@mfe}\relax
+ }%
+ }
+\fi
+
+\newskip\ctableftskip \ctableftskip=\fill
+\newskip\ctabrightskip \ctabrightskip=\fill
+
+\expandafter\def\csname ctabular*\endcsname{%
+ \@ifnextchar[ {\@ctabularstar}{\@ctabularstar[c]}}
+\def\@ctabularstar[#1]#2{\global\@curtab\@ne
+ \ctableftskip\fill
+ \ctabrightskip\fill
+ \if l#1% left
+ \ctableftskip\z@
+ \else
+ \if r#1% right
+ \ctabrightskip\z@
+ \fi
+ \fi
+ \setlength\dimen@{#2}%
+ \xdef\@halignto{to\the\dimen@}\NC@tabular}
+\newcommand*{\ctabular}[1][c]{\global\@curtab\@ne
+ \ctableftskip\fill
+ \ctabrightskip\fill
+ \if l#1% left
+ \ctableftskip\z@
+ \else
+ \if r#1% right
+ \ctabrightskip\z@
+ \fi
+ \fi
+ \gdef\@halignto{to\hsize}\NC@tabular}
+
+\newcommand*{\NC@tabular}{%
+ \par
+ \addvspace{\topsep}
+ \col@sep\tabcolsep
+ \let\d@llarbegin\begingroup
+ \let\d@llarend\endgroup
+ \@NCtabarray}
+
+\newcommand*{\@NCialign}{\everycr{}\tabskip\ctableftskip\halign}
+
+\newcommand*{\@NCtabarray}[1]{%
+ \@tempdima \ht\strutbox
+ \advance\@tempdima\extrarowheight
+ \setbox \@arstrutbox \hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp\strutbox
+ \@width\z@}%
+ \begingroup
+%% \@mkpream{@{\hspace{\@totalleftmargin}}#1@{}}%
+ \@mkpream{#1}%
+ \xdef\@preamble{\@NCialign \@halignto
+ \bgroup & \tabskip\z@
+ \@arstrut
+ \@preamble
+ \tabskip\ctabrightskip
+ \cr}%
+ \endgroup
+ \let\@sharp ##\let\protect\relax
+ \lineskip\z@
+ \baselineskip\z@
+ \let\\\@arraycr
+ \let\tabularnewline\\%
+ \let\par\@empty
+ \ctabsetlines
+ \@preamble
+}
+
+\def\endctabular{%
+ \crcr \egroup
+ \gdef\@preamble{}%
+ \addvspace{\topsep}
+ \noindent}
+\expandafter\let\csname endctabular*\endcsname=\endctabular
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcommand*{\memcline}[2]{\m@m@cline[#1]#2\@nil}
+\def\m@m@cline[#1]#2-#3\@nil{%
+ \omit
+ \@multicnt#2%
+ \advance\@multispan\m@ne
+ \ifnum\@multicnt=\@ne\@firstofone{&\omit}\fi
+ \@multicnt#3%
+ \advance\@multicnt-#2%
+ \advance\@multispan\@ne
+ \leaders\hrule\@height #1\hfill % <- variable \@height value
+ \cr
+ \noalign{\vskip- #1}} % <- variable \@height value
+
+\newcommand*{\memhline}[1][\arrayrulewidth]{\memcline{#1}{1-\@curtab}}
+\newcommand*{\m@mhline}{\cline{1-\@curtab}}
+\def\m@m@BTnormal{%
+ \ifnum0=`{\fi} % closes the \noalign
+ \multispan{\@curtab} \leaders\bktabrule{\@thisrulewidth}\hfill\cr
+ \noalign{\ifnum0=`}\fi
+ \futurenonspacelet\@tempa\@BTendrule}
+
+\def\ctabsetlines{%
+ \let\hline\m@mhline
+ \let\@BTnormal\m@m@BTnormal}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newcount\abovecolumnspenalty
+ \abovecolumnspenalty=10000
+\newcount\@linestogo % lines remaining to be procesed
+\newcount\@cellstogo % cells remaining in column or row
+\newcount\@cellsincolumn % number of lines per column
+\newtoks\crtok
+ \crtok = {\cr}%
+
+\newdimen\@mincolumnwidth
+\let\c@lleftskip\hfil % left skip within a column
+\let\c@lrightskip\hfil % right skip within a column
+
+\let\preautotab\relax
+\let\postautotab\relax
+
+\newcommand{\autocols}[5][0pt]{\par\begingroup
+ \ctabsetlines
+ \if l#2
+ \raggedright
+ \else
+ \if r#2
+ \raggedleft
+ \else
+ \centering
+ \fi
+ \fi
+ \let\c@lleftskip\hfil
+ \let\c@lrightskip\hfil
+ \if l#4
+ \let\c@lleftskip\relax
+ \else
+ \if r#4
+ \let\c@lrightskip\relax
+ \fi
+ \fi
+ \@mincolumnwidth\z@
+ \TX@cols=#3
+ \@curtab=#3
+ \@linestogo\z@
+ \@for\@tempa:=#5\do{
+ \advance\@linestogo\@ne
+ \settowidth{\@tempdima}{\@tempa}
+ \ifdim\@tempdima>\@mincolumnwidth
+ \@mincolumnwidth=\@tempdima
+ \fi
+ }
+ \advance\@mincolumnwidth\tabcolsep
+ \linespercol
+ \def\@endcolumnactions{%
+ \global\advance\@linestogo\m@ne
+ \ifnum\@cellstogo<\tw@
+ \global\advance\TX@cols\m@ne
+ \ifnum\TX@cols>\z@\linespercol\fi
+ \the\crtok
+ \else
+ &\global\advance\@cellstogo\m@ne
+ \fi}%
+ \ifdim #1 > \z@
+ \TX@col@width=#1
+ \divide\TX@col@width \TX@cols
+ \else
+ \TX@col@width=\@mincolumnwidth
+ \fi
+ \penalty\abovecolumnspenalty
+ \noindent% usually not a paragraph
+ \def\@preamble{}%
+ \begingroup
+ \let\@sharp\relax
+ \ifnum\@cellsincolumn>\@ne
+ \loop
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{%
+ \c@lleftskip\strut\@sharp\c@lrightskip} &}%
+ \advance\@cellsincolumn\m@ne
+ \ifnum\@cellsincolumn>\@ne
+ \repeat
+ \fi
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{\c@lleftskip\strut\@sharp\c@lrightskip}}%
+ \endgroup
+ \let\@sharp ##
+ \tabskip\ctableftskip
+%% \tabskip\z@
+ \valign \bgroup
+ \tabskip\z@
+ \@preamble
+ \tabskip\ctabrightskip\cr
+ \@for\@tempa:=#5\do{
+ \@tempa\unskip\space\@endcolumnactions}%
+ \the\crtok \egroup \par \endgroup}
+
+\newcommand*{\linespercol}{%
+ \@cellsincolumn=\@linestogo
+ \divide\@cellsincolumn \TX@cols
+ \@cellstogo=\@cellsincolumn
+ \multiply\@cellstogo \TX@cols
+ \@tempcnta=\@linestogo
+ \advance\@tempcnta -\@cellstogo
+ \ifnum \@tempcnta>\z@
+ \advance\@cellsincolumn \@ne
+ \fi
+ \global\@cellstogo=\@cellsincolumn}
+
+\newcommand{\autorows}[5][0pt]{\par\begingroup
+ \ctabsetlines
+ \ctableftskip\fill
+ \ctabrightskip\fill
+ \if l#2
+ \ctableftskip\z@
+ \else
+ \if r#2
+ \ctabrightskip\z@
+ \fi
+ \fi
+ \let\c@lleftskip\hfil
+ \let\c@lrightskip\hfil
+ \if l#4
+ \let\c@lleftskip\relax
+ \else
+ \if r#4
+ \let\c@lrightskip\relax
+ \fi
+ \fi
+ \TX@cols=#3\relax
+ \@curtab=#3\relax
+ \@cellstogo = \TX@cols
+ \@mincolumnwidth\z@
+ \@linestogo\z@
+ \@for\@tempa:=#5\do{%
+ \advance\@linestogo\@ne
+ \settowidth{\@tempdima}{\@tempa}
+ \ifdim\@tempdima>\@mincolumnwidth
+ \@mincolumnwidth=\@tempdima
+ \fi}%
+ \advance\@mincolumnwidth\tabcolsep
+ \def\@endcolumnactions{%
+ \global\advance\@linestogo\m@ne
+ \global\advance\@cellstogo\m@ne
+ \ifnum\@cellstogo<\@ne
+ \global\@cellstogo=\TX@cols
+ \the\crtok
+ \else
+ &
+ \fi}%
+ \ifdim #1>\z@
+ \TX@col@width=#1
+ \else
+ \TX@col@width=\hsize
+ \fi
+ \divide\TX@col@width \TX@cols
+ \ifdim #1=\z@
+ \TX@col@width=\@mincolumnwidth
+ \fi
+ \penalty\abovecolumnspenalty
+ \noindent % usually not a paragraph
+ \vskip -\z@ % don't know why we need this, but looks bad without it
+ \def\@preamble{}%
+ \begingroup
+ \let\@sharp\relax
+ \ifnum\TX@cols>\@ne
+ \loop
+ \ifdim #1<\z@
+ \g@addto@macro{\@preamble}{%
+ \strut\c@lleftskip\@sharp\c@lrightskip &}%
+ \else
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{%
+ \strut\c@lleftskip\@sharp\c@lrightskip} &}%
+ \fi
+ \advance\TX@cols\m@ne
+ \ifnum\TX@cols>\@ne
+ \repeat
+ \fi
+ \ifdim #1<\z@
+ \g@addto@macro{\@preamble}{%
+ \strut\c@lleftskip\@sharp\c@lrightskip}%
+ \else
+ \g@addto@macro{\@preamble}{%
+ \hb@xt@ \TX@col@width{\strut\c@lleftskip\@sharp\c@lrightskip}}%
+ \fi
+ \endgroup
+ \let\@sharp ##
+ \tabskip\ctableftskip
+ \halign to \hsize \bgroup
+ \tabskip\z@
+ \@preamble
+%% \tabskip\ctabrightskip\cr \preautotab
+ \tabskip\ctabrightskip\cr
+ \@for\@tempa:=#5\do{%
+ \@tempa\unskip\space\@endcolumnactions}%
+%% \the\crtok \postautotab \the\crtok \egroup \endgroup \par
+ \the\crtok \egroup \endgroup \par}
+
+\newcounter{newflo@tctr}
+ \setcounter{newflo@tctr}{1}
+
+\newcommand{\newfloat}[4][\@empty]{%
+%%% \@namedef{ftype@#2}{\value{newflo@tctr}}
+%%% \addtocounter{newflo@tctr}{\value{newflo@tctr}}
+ \expandafter\edef\csname ftype@#2\endcsname{\the\c@newflo@tctr}%
+ \advance\c@newflo@tctr \c@newflo@tctr
+ \@ifundefined{c@#2}{% counter is not defined
+ \ifx \@empty#1\relax
+ \newcounter{#2}
+ \else
+ \newcounter{#2}[#1]
+ \expandafter\edef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}
+ \fi}{}
+ \setcounter{#2}{0}
+
+ \@namedef{ext@#2}{#3}% file extension
+ \@ifundefined{c@#3depth}{\newcounter{#3depth}}{}
+ \setcounter{#3depth}{1}
+
+ \@namedef{fps@#2}{tbp} % position
+ \@namedef{fnum@#2}{#4~\@nameuse{the#2}} % caption naming
+ \@namedef{fleg#2}{#4} % legend naming
+ \@namedef{flegtoc#2}##1{} % legend name in ToC
+
+ \newenvironment{#2}{\@float{#2}}{\end@float}
+ \newenvironment{#2*}{\@dblfloat{#2}}{\end@dblfloat}
+} % end \newfloat
+
+\newcommand*{\setfloatlocations}[2]{\@namedef{fps@#1}{#2}}
+
+\newcommand{\newsubfloat}[1]{%
+ \newlistentry[#1]{sub#1}{\@nameuse{ext@#1}}{1}
+ \@namedef{ext@sub#1}{\csname ext@#1\endcsname}
+ \@namedef{thesub#1}{(\alph{sub#1})}
+ \@namedef{@thesub#1}{\@nameuse{thesub#1}%
+ \if@tightsubcap\hskip\subfloatlabelskip\else\space\fi}
+ \@namedef{@@thesub#1}{\@nameuse{thesub#1}}
+ \@namedef{p@sub#1}{\csname the#1\endcsname}
+ \@namedef{toclevel@sub#1}{1}}
+
+\newif\ifdonemaincaption
+ \donemaincaptionfalse
+
+\let\@memoldfloat\@float
+\renewcommand{\@float}[1]{\donemaincaptionfalse
+ \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}%
+ \@memoldfloat{#1}}
+\let\@memolddblfloat\@dblfloat
+\renewcommand{\@dblfloat}[1]{\donemaincaptionfalse
+ \@ifundefined{c@sub#1}{}{\csname c@sub#1\endcsname = 0\relax}%
+ \@memolddblfloat{#1}}
+
+\let\@memoldefloat\end@float
+\def\end@float{%
+ \@memlistsubcaptions{\@captype}\@memoldefloat}
+\let\@memoldedblfloat\end@dblfloat
+\def\end@dblfloat{%
+ \@memlistsubcaptions{\@captype}\@memoldedblfloat}
+
+\AtBeginDocument{\@ifpackageloaded{fixltx2e}{%
+ \def\end@dblfloat{%
+ \if@twocolumn
+ \@endfloatbox
+ \ifnum\@floatpenalty<\z@
+ \@largefloatcheck
+ \global\dp\@currbox1sp %
+ \@cons\@deferlist\@currbox
+ \fi
+ \ifnum\@floatpenalty=-\@Mii \@Esphack\fi
+ \else
+ \end@float
+ \fi}}{}}
+
+\newif\if@contcw
+\newif\if@conthang
+\newif\if@contindent
+
+\newcommand{\captiondelim}[1]{\def\@contdelim{#1}}
+\captiondelim{: }
+
+\newcommand{\captionnamefont}[1]{\def\@contnfont{#1}}
+\captionnamefont{}
+
+\newcommand{\captiontitlefont}[1]{\def\@conttfont{#1}}
+\captiontitlefont{}
+
+\newcommand*{\captionstyle}[1]{\def\@contcstyle{#1}}
+\captionstyle{}
+
+\renewcommand{\captionstyle}{%
+ \@ifnextchar[ {\@memcshort}{\@memcnorm}}
+\def\@memcshort[#1]#2{%
+ \def\@contcshortstyle{#1}
+ \def\@contcstyle{#2}}
+\def\@memcnorm#1{%
+ \def\@contcshortstyle{#1}
+ \def\@contcstyle{#1}}
+\captionstyle{}
+
+\newlength{\@contcwidth}
+\newcommand{\captionwidth}[1]{\setlength{\@contcwidth}{#1}}
+\captionwidth{\linewidth}
+\newcommand{\changecaptionwidth}{\@contcwtrue}
+\newcommand{\normalcaptionwidth}{\@contcwfalse}
+\normalcaptionwidth
+
+\newlength{\@contindw}
+\newcommand{\hangcaption}{\@conthangtrue\@contindentfalse}
+\newcommand{\indentcaption}[1]{\setlength{\@contindw}{#1}%
+ \@conthangfalse\@contindenttrue}
+\newcommand{\normalcaption}{\@conthangfalse\@contindentfalse}
+\normalcaption
+
+\newcommand{\precaption}[1]{\def\@contpre{#1}}
+\precaption{}
+\newcommand{\postcaption}[1]{\def\@contpost{#1}}
+\postcaption{}
+\newcommand{\midbicaption}[1]{\def\@contmidbi{#1}}
+\midbicaption{}
+
+\newcommand*{\captiontitlefinal}[1]{\def\@contfinal{#1}}
+ \captiontitlefinal{}
+
+\newlength{\abovecaptionskip}
+ \setlength{\abovecaptionskip}{0.5\onelineskip}
+\newlength{\belowcaptionskip}
+ \setlength{\belowcaptionskip}{0.5\onelineskip}
+
+\let\@memoldcaption\caption
+\def\caption{\donemaincaptiontrue\@memoldcaption}
+
+\newcommand{\memcaptioninfo}[4]{}
+
+\let\@memold@caption\@caption
+\long\def\@caption#1[#2]#3{%
+ \M@gettitle{#2}%
+ \memcaptioninfo{#1}{\csname the#1\endcsname}{#2}{#3}%
+ \@memold@caption{#1}[{#2}]{#3}}
+
+\long\def\@makecaption#1#2{\let\@memtempa\relax
+ \ifdim\prevdepth>-99\p@ \vskip\abovecaptionskip
+ \else \def\@memtempa{\vbox to\topskip{}}\fi
+ \let\@contfnote\footnote \renewcommand{\footnote}[2][]{}
+ \let\@contfmark\footnotemark \renewcommand{\footnotemark}[1][]{}
+ \sbox\@tempboxa{\@contnfont #1\@contdelim \@conttfont #2\@contfinal}
+ \let\footnote\@contfnote
+ \let\footnotemark\@contfmark
+ \ifdim\wd\@tempboxa<\linewidth \centering \fi
+ \if@contcw
+ \centering
+ \parbox{\@contcwidth}{%
+ \ifdim\wd\@tempboxa<\@contcwidth \centering \fi
+ \fi
+ \if@conthang
+ \sbox\@tempboxa{\@contnfont #1\@contdelim}
+ \@contpre%
+ {\@contcstyle\hangindent=\wd\@tempboxa
+ \noindent\box\@tempboxa\@memtempa \@conttfont #2\@contfinal\par}
+ \else
+ \if@contindent
+ \@contpre%
+ {\@contnfont #1\@contdelim}\@memtempa
+ {\@contcstyle\hangindent=\@contindw
+ \hangafter=\@ne\@conttfont #2\@contfinal\par}% <- v1.4
+ \else
+ \@contpre%
+ {\@contnfont #1\@contdelim}\@memtempa
+ {\ifdim\wd\@tempboxa<\linewidth
+ \@contcshortstyle\else \@contcstyle\fi% <- v1.4
+ \@conttfont #2\@contfinal\par}
+ \fi
+ \fi
+ \@contpost
+ \if@contcw
+ \par
+ } % end of the \parbox
+ \fi
+ \vskip\belowcaptionskip}
+
+\newcommand{\contcaption}{%
+ \addtocounter{\@captype}{\m@ne}\refstepcounter{\@captype}%
+ \@contcaption\@captype}
+
+\long\def\@@contcaption#1#2{%
+ \par
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@#1\endcsname}{\ignorespaces #2}\par
+ \endgroup}
+
+\long\def\@contcaption#1#2{%
+ \if@contbotsub
+ \@memlistsubcaptions{#1}%
+ \@@contcaption{#1}{#2}%
+ \else
+ \@@contcaption{#1}{#2}%
+ \@memlistsubcaptions{#1}%
+ \fi}
+
+\newcommand{\memlegendinfo}[1]{}
+\newcommand{\legend}[1]{%
+ \M@gettitle{#1}%
+ \memlegendinfo{#1}%
+ \par
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \captiondelim{\mbox{}}
+ \@makecaption{}{\ignorespaces #1}\par
+ \endgroup}
+
+\newcommand{\namedlegend}{\@dblarg{\@legend\@captype}}
+\newcommand{\memnamedlegendinfo}[3]{}
+
+\long\def\@legend#1[#2]#3{%
+ \M@gettitle{#2}%
+ \memnamedlegendinfo{#1}{#2}{#3}%
+ \par
+ \csname flegtoc#1\endcsname{#2}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fleg#1\endcsname}{\ignorespaces #3}\par
+ \endgroup}
+
+\newcommand{\newfixedcaption}[3][\caption]{%
+ \newcommand{#2}{\def\@captype{#3}#1}}
+\newcommand{\renewfixedcaption}[3][\caption]{%
+ \renewcommand{#2}{\def\@captype{#3}#1}}
+\newcommand{\providefixedcaption}[3][\caption]{%
+ \providecommand{#2}{\def\@captype{#3}#1}}
+
+\newcommand{\membitwonumcaptioninfo}[7]{}
+\newcommand{\membionenumcaptioninfo}[7]{}
+\newcommand{\membicaptioninfo}[6]{}
+
+\newcommand{\bitwonumcaption}[6][\@empty]{%
+ \begingroup
+ \let\memcaptioninfo\@gobblefour
+ \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
+ {\def\m@mscapi{#2}\caption[#2]{#3}}%
+ \ifx \@empty #1\else
+ \label{#1}%
+ \fi
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#4}%
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
+ \addtocounter{\@captype}{-1}%
+ \@contmidbi
+ \@ifmtarg{#5}{\def\m@mscapii{#6}\caption{#6}}%
+ {\def\m@mscapii{#5}\caption[#5]{#6}}%
+ \membitwonumcaptioninfo{\@captype}{\@nameuse{the\@captype}}%
+ {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}%
+ \endgroup}
+
+\newcommand{\bionenumcaption}[6][\@empty]{%
+ \begingroup
+ \let\memcaptioninfo\@gobblefour
+ \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
+ {\def\m@mscapi{#2}\caption[#2]{#3}}%
+ \ifx \@empty #1\else
+ \label{#1}%
+ \fi
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#4}%
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}
+ \@contmidbi
+ \contcaption{#6}%
+ \@ifmtarg{#5}{%
+ \def\m@mscapii{#6}%
+ \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
+ {\protect\numberline{}{\ignorespaces #6}}}{%
+ \def\m@mscapii{#5}%
+ \addcontentsline{\csname ext@\@captype\endcsname}{\@captype}%
+ {\protect\numberline{}{\ignorespaces #5}}}%
+ \membionenumcaptioninfo{\@captype}{\@nameuse{the\@captype}}%
+ {\m@mscapi}{#3}{#4}{\m@mscapii}{#6}%
+ \endgroup}
+
+\newcommand{\bicaption}[5][\@empty]{%
+ \begingroup
+ \let\memcaptioninfo\@gobblefour
+ \@ifmtarg{#2}{\def\m@mscapi{#3}\caption{#3}}%
+ {\def\m@mscapi{#2}\caption[#2]{#3}}%
+ \ifx \@empty #1\else
+ \label{#1}%
+ \fi
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#4}
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
+ \@contmidbi
+ \contcaption{#5}%
+ \membicaptioninfo{\@captype}{\@nameuse{the\@captype}}%
+ {\m@mscapi}{#3}{#4}{#5}%
+ \endgroup}
+
+\newcommand{\bicontcaption}[3]{%
+ \begingroup
+ \contcaption{#1}%
+ \setlength{\abovecaptionskip}{0pt}%
+ \setlength{\belowcaptionskip}{0pt}%
+ \edef\@memtempc{#2}%
+ \expandafter\renewcommand\csname \@captype name\endcsname{\@memtempc}%
+ \@contmidbi
+ \contcaption{#3}%
+ \endgroup}
+
+\newcommand{\subcaptionstyle}[1]{\def\@contsubcstyle{#1}}
+\subcaptionstyle{}
+
+\newif\if@shortsubcap
+\newif\if@hangsubcap
+\newcommand*{\shortsubcaption}{\@shortsubcaptrue}
+\newcommand*{\hangsubcaption}{\@hangsubcaptrue}
+\newcommand*{\normalsubcaption}{\@shortsubcapfalse\@hangsubcapfalse}
+\normalsubcaption
+
+\newskip\subfloattopskip
+\newskip\subfloatcapskip
+\newskip\subfloatcaptopadj
+\newskip\subfloatbottomskip
+\newskip\subfloatlabelskip
+\newdimen\subfloatcapmargin
+\newif\if@tightsubcap
+\newcommand{\loosesubcaptions}{%
+ \subfloattopskip = 10\p@
+ \subfloatcapskip = 10\p@
+ \subfloatcaptopadj = \z@
+ \subfloatbottomskip = 10\p@
+ \subfloatlabelskip = 0.33em
+ \subfloatcapmargin = 10\p@
+ \@tightsubcapfalse
+}
+
+\newcommand{\tightsubcaptions}{%
+ \subfloattopskip = 5\p@
+ \subfloatcapskip = \z@
+ \subfloatcaptopadj = 3\p@
+ \subfloatbottomskip = 5\p@
+ \subfloatlabelskip = 0.33em \@plus 0.07em \@minus 0.03em
+ \subfloatcapmargin = \z@
+ \@tightsubcaptrue
+}
+\tightsubcaptions
+
+\newcommand*{\subcaptionsize}[1]{\def\@subcapsize{#1}}
+\newcommand*{\subcaptionlabelfont}[1]{\def\@subcaplabelfont{#1}}
+\newcommand*{\subcaptionfont}[1]{\def\@subcapfont{#1}}
+\subcaptionsize{\footnotesize}
+\subcaptionlabelfont{\normalfont}
+\subcaptionfont{\normalfont}
+
+ \newcounter{@contsubnum}
+ \newcommand{\@contkeep}{%
+ \setcounter{@contsubnum}{\value{sub\@captype}}}
+ \newcommand{\@contset}{%
+ \setcounter{sub\@captype}{\value{@contsubnum}}}
+ \newcommand{\subconcluded}{%
+ \setcounter{sub\@captype}{0}}
+\newif\if@contbotsub
+ \@contbotsubtrue
+
+\newcommand{\subcaption}{%
+ \bgroup
+ \let\label=\memsub@label
+ \ifdonemaincaption\else
+ \advance\csname c@\@captype\endcsname\@ne
+ \fi
+ \refstepcounter{sub\@captype}\@contkeep
+ \@ifnextchar [%
+ {\@memsubcap{sub\@captype}}%
+ {\@memsubcap{sub\@captype}[\@empty]}}
+\long\def\@memsubcap#1[#2]#3{%
+ \@tempdima=\hsize
+ \vskip\subfloatcapskip
+ \ifx \@empty #2
+ \@memsubcaption{#1}{#3}{#3}%
+ \else
+ \@memsubcaption{#1}{#2}{#3}%
+ \fi
+ \vskip\subfloatcapskip
+ \egroup}
+\newcommand{\@memsubcaption}[3]{%
+ \ifx \relax#2\relax \else
+ \bgroup
+ \let\label\@gobble
+ \let\protect\string
+ \def\@memsubcaplabel{\@nameuse{@@the#1}}%
+ \xdef\@memsubfigcaptionlist{%
+ \@memsubfigcaptionlist,%
+ {\protect\numberline{\@memsubcaplabel}\noexpand{\ignorespaces #2}}}%
+ \egroup
+ \fi
+ \@makesubfloatcaption{\@nameuse{@the#1}}{#3}}
+
+\newcommand{\contsubcaption}{%
+ \bgroup
+ \let\label=\memsub@label
+ \@contset
+ \refstepcounter{sub\@captype}\@contkeep
+ \@ifnextchar [%
+ {\@memsubcap{sub\@captype}}%
+ {\@memsubcap{sub\@captype}[\@empty]}}
+\newenvironment{subfloat}{}{}
+
+\newcommand{\subbottom}{%
+ \@contbotsubtrue
+ \@memsubbody}
+
+\newcommand{\@memsubbody}{%
+ \bgroup
+ \let\label=\memsub@label
+ \ifdonemaincaption\else
+ \advance\csname c@\@captype\endcsname\@ne
+ \fi
+ \refstepcounter{sub\@captype}\@contkeep%
+ \leavevmode
+ \@ifnextchar [%
+ {\@memsubfig}%
+ {\@memsubfig[\@empty]}}
+
+\newcommand{\contsubbottom}{%
+ \@contbotsubtrue
+ \@memcontsubbody}
+
+\newcommand{\@memcontsubbody}{%
+ \bgroup
+ \let\label=\memsub@label
+ \@contset
+ \refstepcounter{sub\@captype}\@contkeep%
+ \leavevmode
+ \@ifnextchar [%
+ {\@memsubfig}%
+ {\@memsubfig[\@empty]}}
+
+\newcommand{\subtop}{%
+ \@contbotsubfalse
+ \@memsubbody}
+
+\newcommand{\contsubtop}{%
+ \@contbotsubfalse
+ \@memcontsubbody}
+
+\def\@memsubfig[#1]{%
+ \@ifnextchar [%
+ {\@memsubfloat{sub\@captype}[#1]}%
+ {\@memsubfloat{sub\@captype}[\@empty #1][#1]}}
+
+\def\@memsubfloat#1[#2][#3]#4{%
+ \@tempcnta=\@ne
+ \if@tightsubcap
+ \if@minipage
+ \@tempcnta=\z@
+ \else
+ \ifdim\lastskip=\z@
+ \@tempcnta=\@ne
+ \else
+ \@tempcnta=\tw@
+ \fi
+ \fi
+ \fi
+ \if@contbotsub
+ \def\subfig@top{\subfloattopskip}%
+ \def\subfig@bottom{\subfloatbottomskip}%
+ \else
+ \def\subfig@top{\subfloatbottomskip}%
+ \def\subfig@bottom{\subfloattopskip}%
+ \fi
+ \setbox\@tempboxa \hbox{#4}%
+ \@tempdima=\wd\@tempboxa
+ \vtop\bgroup
+ \vbox\bgroup
+ \ifcase\@tempcnta
+ \@minipagefalse
+ \or
+ \vspace{\subfig@top}
+ \or
+ \ifdim \lastskip=\z@ \else
+ \@tempskipb\subfig@top\@xaddvskip
+ \fi
+ \fi
+ \if@contbotsub
+ \box\@tempboxa\egroup
+ \ifx \@empty#3\relax \else
+ \vskip\subfloatcapskip
+ \@memsubcaption{#1}{#2}{#3}%
+ \fi
+ \else
+ \ifx \@empty#3\relax \else
+ \@memsubcaption{#1}{#2}{#3}%
+ \vskip\subfloatcapskip
+ \vskip\subfloatcaptopadj
+ \fi\egroup
+ \box\@tempboxa
+ \fi
+ \vspace{\subfig@bottom}
+ \egroup
+\egroup}
+
+\newcommand*{\@memsubfigcaptionlist}{}
+\newcommand*{\memlistsubcaptions}{%
+ \@ifstar
+ {\gdef\@memsubfigcaptionlist{}}%
+ {\@memlistsubcaptions{\@captype}}}
+
+\newcommand*{\@memlistsubcaptions}[1]{%
+ \@ifundefined{@captype}{}{%
+ \@ifundefined{ext@sub#1}{}{%
+ \@for \@tempa:=\@memsubfigcaptionlist \do {%
+ \ifx \@empty\@tempa\relax \else
+ \addcontentsline{\@nameuse{ext@sub#1}}{sub#1}{\@tempa}%
+ \fi}}}%
+ \gdef\@memsubfigcaptionlist{}}
+
+\newcommand{\@makesubfloatcaption}[2]{%
+ \setbox\@tempboxa\hbox{%
+ \@subcapsize
+ {\@subcaplabelfont #1}{\@subcapfont\ignorespaces #2}}%
+ \@tempdimb=-\subfloatcapmargin
+ \multiply\@tempdimb\tw@
+ \advance\@tempdimb\@tempdima
+ \hb@xt@\@tempdima{%
+ \hss
+ \ifdim \wd\@tempboxa >\@tempdimb
+ \memsubfig@caption{#1}{#2}%
+ \else
+ \if@shortsubcap
+ \memsubfig@caption{#1}{#2}%
+ \else
+ \box\@tempboxa
+ \fi
+ \fi
+ \hss}}
+
+\newcommand{\memsubfig@caption}[2]{%
+ \if@hangsubcap
+ \sbox{\@tempboxa}{\@subcapsize\@subcaplabelfont #1}%
+ \addtolength{\@tempdimb}{-\wd\@tempboxa}%
+ \usebox{\@tempboxa}%
+ \memsubfig@captionpar{\@tempdimb}{%
+ {\@subcapfont\ignorespaces #2}}%
+ \else
+ \memsubfig@captionpar{\@tempdimb}{{\@subcaplabelfont #1}%
+ {\@subcapfont\ignorespaces #2}}%
+ \fi}
+
+\newcommand{\memsubfig@captionpar}[2]{%
+ \parbox[t]{#1}{\@subcapsize\@contsubcstyle #2}}
+
+\newcommand{\memsub@label}{%
+ \@ifnextchar (%
+ {\sf@memsub@label}%
+ {\sf@memsub@label(Sub\@captype\space
+ \@nameuse{p@sub\@captype}%
+ \@nameuse{thesub\@captype})}}
+\def\sf@memsub@label(#1)#2{%
+ \protected@edef\mem@currentlabelname{#1}%
+ \sf@@memsub@label{#2}}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{nameref}{%
+ \newcommand*{\sf@@memsub@label}[1]{%
+ \@bsphack
+ \protected@write\@auxout{}{%
+ \string\newlabel{#1}%
+ {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \protected@write\@auxout{}{%
+ \string\newlabel{sub@#1}%
+ {{\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \@esphack}
+ }{\@ifpackageloaded{hyperref}{%
+ \newcommand*{\sf@@memsub@label}[1]{%
+ \@bsphack
+ \protected@write\@auxout{}{%
+ \string\newlabel{#1}%
+ {{\@nameuse{p@sub\@captype}\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \protected@write\@auxout{}{%
+ \string\newlabel{sub@#1}%
+ {{\@nameuse{@@thesub\@captype}}%
+ {\thepage}%
+ {\mem@currentlabelname\relax}%
+ {\@currentHref}{}}}%
+ \@esphack}
+ }{%
+ \let\@memoldlabel\label
+ \newcommand*{\sf@@memsub@label}[1]{%
+ \@bsphack
+ \@memoldlabel{#1}%
+ \protected@write\@auxout{}{%
+ \string\newlabel{sub@#1}%
+ {{\@nameuse{@@thesub\@captype}}%
+ {\thepage}}}%
+ \@esphack}
+ }{}%
+ }
+}
+
+\newcommand*{\subcaptionref}{%
+ \@ifstar{\ssc@ref}{\sc@ref}}
+\newcommand*{\ssc@ref}[1]{\ref{sub@#1}}
+\newcommand*{\sc@ref}[1]{{\@subcaplabelfont\ref{sub@#1}}}
+
+\newsavebox{\m@mscap@capbox}
+\newsavebox{\m@mscap@fbox}
+
+\newdimen\sidecapsep
+ \sidecapsep=\marginparsep
+\newdimen\sidecapwidth
+ \sidecapwidth=\marginparwidth
+\newcommand*{\setsidecaps}[2]{%
+ \setlength{\sidecapsep}{#1}\@memznegtest{\sidecapsep}%
+ \setlength{\sidecapwidth}{#2}\@memznegtest{\sidecapwidth}}
+
+\newdimen\m@m@tempdima
+\newdimen\m@mscapraise
+\newdimen\sidecapraise
+ \sidecapraise \z@
+
+\newcommand*{\setsidecappos}[1]{%
+ \def\m@mscappos{#1}\def\@tempb{t}%
+ \ifx\@tempb\m@mscappos
+ \else
+ \def\@tempb{b}%
+ \ifx\@tempb\m@mscappos
+ \else
+ \def\@tempb{c}%
+ \ifx\@tempb\m@mscappos
+ \else
+ \@memerror{Argument to \string\setsidecappos\space is not t or c or b.
+ \MessageBreak Set to c}{\@ehc}%
+ \def\m@mscappos{c}%
+ \fi
+ \fi
+ \fi}
+\setsidecappos{c}
+
+\newcommand{\sidecapmargin}[1]{%
+ \def\@tempa{#1}\def\@tempb{left}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{0}% left
+ \else
+ \def\@tempb{right}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{1}% right
+ \else
+ \def\@tempb{outer}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{2}% outer
+ \else
+ \def\@tempb{inner}%
+ \ifx\@tempb\@tempa
+ \def\m@mscapmarg{3}% inner
+ \else
+ \@memerror{Unrecognized argument for \string\sidecapmargin}%
+ {\@ehc}%
+ \def\m@mscapmarg{-1}% error
+ \fi
+ \fi
+ \fi
+ \fi}
+\sidecapmargin{left}
+
+\newif\ifscapmargleft
+
+\def\sidecapfloatwidth{\linewidth}
+\newdimen\m@mscapmainwidth
+
+\newdimen\m@mscaplkern
+\newcommand*{\setm@mscaplkern}{%
+ \m@mscaplkern=\sidecapwidth
+ \advance\m@mscaplkern \sidecapsep
+ \advance\m@mscaplkern \m@mscapmainwidth}
+
+\newcommand*{\sidecapstyle}{%
+%%% \captionnamefont{\bfseries}%
+ \ifscapmargleft
+ \captionstyle{\raggedleft}%
+ \else
+ \captionstyle{\raggedright}%
+ \fi}
+
+\newcommand*{\sidecaption}{%
+ \@ifnextchar [{\@sidecaption}{\@sidecaption[]}}
+\def\@sidecaption[#1]#2{%
+ \@ifnextchar [{\@@sidecaption{#1}{#2}}{\@@sidecaption{#1}{#2}[]}}
+\newcommand\@mem@scap@beforehook{}
+\newcommand\@mem@scap@afterhook{}
+
+\def\@@sidecaption#1#2[#3]{%
+ \ifx\@empty#1\@empty
+ \def\m@mscap@fortoc{#2}%
+ \else
+ \def\m@mscap@fortoc{#1}%
+ \fi
+ \def\m@mscap@forcap{#2}%
+ \ifx\@empty#3\@empty
+ \def\m@mscaplabel{}%
+ \else
+ \def\m@mscaplabel{\@bsphack\label{#3}\@esphack}%
+ \fi
+ \m@mscapstart@fbox}
+
+\newcommand*{\m@mscapstart@fbox}{%
+ \@mem@scap@beforehook%
+ \setlength{\m@mscapmainwidth}{\sidecapfloatwidth}%
+ \setm@mscaplkern
+ \begin{lrbox}{\m@mscap@fbox}%
+ \begin{minipage}[c]{\m@mscapmainwidth}}
+\newcommand*{\m@mscapend@fbox}{%
+ \end{minipage}%
+ \end{lrbox}}
+
+\def\endsidecaption{%
+ \m@mscapend@fbox
+ \refstepcounter\@captype
+ \m@mscaplabel
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \@caption\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+\newcommand*{\m@mscapopboxes}{%
+ \m@mcalcscapraise
+ \usebox{\m@mscap@fbox}\m@mscapcheckside
+ \ifscapmargleft%
+ \rlap{\kern-\m@mscaplkern
+ \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}%
+ \else%
+ \rlap{\kern\sidecapsep
+ \raisebox{\m@mscapraise}{\usebox{\m@mscap@capbox}}}%
+ \fi
+ \gdef\m@mscapthisside{}%
+ \@mem@scap@afterhook%
+}
+
+\newcommand*{\m@mcalcscapraise}{%
+ \def\@tempb{t}%
+ \ifx\m@mscappos\@tempb
+ \settoheight{\m@m@tempdima}{\strut\usebox{\m@mscap@capbox}}%
+ \settoheight{\m@mscapraise}{\usebox{\m@mscap@fbox}}%
+ \advance\m@mscapraise -\m@m@tempdima
+ \advance\m@mscapraise 0.5ex
+ \else
+ \def\@tempb{b}%
+ \ifx\m@mscappos\@tempb
+ \settodepth{\m@m@tempdima}{\usebox{\m@mscap@fbox}}%
+ \settodepth{\m@mscapraise}{\strut\usebox{\m@mscap@capbox}}%
+ \advance\m@mscapraise -\m@m@tempdima
+ \else
+ \m@mscapraise=\z@
+ \advance\m@mscapraise 0.25ex
+ \fi
+ \fi
+ \advance\m@mscapraise \sidecapraise}
+
+\newcommand*{\m@mscapcheckside}{%
+ \if@twocolumn
+ \ifdim\hsize=\textwidth% float*
+ \m@mscapcheckregside
+ \else
+ \if@firstcolumn
+ \scapmarglefttrue
+ \else
+ \scapmargleftfalse
+ \fi
+ \fi
+ \else
+ \m@mscapcheckregside
+ \fi
+ \m@mscapthisside}
+\newcommand*{\m@mscapcheckregside}{%
+ \if@twoside
+ \checkoddpage
+ \ifnum\m@mscapmarg<\@ne% % left
+ \scapmarglefttrue
+ \else
+ \ifnum\m@mscapmarg=\@ne% % right
+ \scapmargleftfalse
+ \else
+ \ifnum\m@mscapmarg=\tw@% % outer
+ \scapmarglefttrue
+ \ifoddpage
+ \scapmargleftfalse
+ \fi
+ \else% % inner
+ \scapmargleftfalse
+ \ifoddpage
+ \scapmarglefttrue
+ \fi
+ \fi
+ \fi
+ \fi
+ \else% oneside
+ \scapmarglefttrue
+ \ifnum\m@mscapmarg>\@ne
+ \ifnum\m@mscapmarg<\thr@@
+ \scapmargleftfalse
+ \fi
+ \fi
+ \fi}
+
+\newcommand*{\overridescapmargin}[1]{%
+ \def\@tempb{#1}\def\@tempa{left}%
+ \ifx\@tempa\@tempb
+ \def\m@mscapthisside{\scapmarglefttrue}%
+ \else
+ \def\@tempa{right}%
+ \ifx\@tempa\@tempb
+ \def\m@mscapthisside{\scapmargleftfalse}%
+ \else
+ \@memerror{Argument to \string\overridescapmargin\space neither
+ left nor right}{\@ehc}%
+ \def\m@mscapthisside{}%
+ \fi
+ \fi}
+\newcommand*{\m@mscapthisside}{}
+
+\newcommand*{\sidecontcaption}{%
+ \@sidecontcaption}
+\def\@sidecontcaption#1{%
+ \@ifnextchar [{\@@sidecontcaption{#1}}{\@@sidecontcaption{#1}[]}}
+\def\@@sidecontcaption#1[#2]{%
+ \def\m@mscap@forcap{#1}%
+ \ifx\@empty#2\@empty
+ \def\m@mscaplabel{}%
+ \else
+ \def\m@mscaplabel{\@bsphack\label{#2}\@esphack}%
+ \fi
+ \m@mscapstart@fbox}
+
+\def\endsidecontcaption{%
+ \m@mscapend@fbox
+ \addtocounter{\@captype}{\m@ne}\refstepcounter\@captype
+ \m@mscaplabel
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \@contcaption\@captype{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+
+\newcommand*{\sidenamedlegend}{%
+ \@ifnextchar [{\@sidenamedlegend}{\@sidenamedlegend[]}}
+\def\@sidenamedlegend[#1]#2{%
+ \@@sidenamedlegend{#1}{#2}}
+\def\@@sidenamedlegend#1#2{%
+ \ifx\@empty#1\@empty
+ \def\m@mscap@fortoc{#2}%
+ \else
+ \def\m@mscap@fortoc{#1}%
+ \fi
+ \def\m@mscap@forcap{#2}%
+ \def\m@mscaplabel{}%
+ \m@mscapstart@fbox}
+
+\def\endsidenamedlegend{%
+ \m@mscapend@fbox
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \@legend\@captype[\m@mscap@fortoc]{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+
+\newcommand*{\sidelegend}{%
+ \@@sidelegend}
+\def\@@sidelegend#1{%
+ \def\m@mscap@forcap{#1}%
+ \m@mscapstart@fbox}
+
+\def\endsidelegend{%
+ \m@mscapend@fbox
+ \begin{lrbox}{\m@mscap@capbox}%
+ \begin{minipage}[c]{\sidecapwidth}%
+ \sidecapstyle
+ \legend{\m@mscap@forcap}
+ \end{minipage}%
+ \end{lrbox}%
+ \m@mscapopboxes}
+
+\newlength{\beforeepigraphskip}
+ \setlength{\beforeepigraphskip}{.5\baselineskip}
+\newlength{\afterepigraphskip}
+ \setlength{\afterepigraphskip}{.5\baselineskip}
+\newlength{\epigraphwidth}
+ \setlength{\epigraphwidth}{.4\textwidth}
+\newlength{\epigraphrule}
+ \setlength{\epigraphrule}{.4\p@}
+\newcommand{\epigraphsize}{\small}
+\newcommand{\epigraphflush}{flushright}
+\newcommand{\textflush}{flushleft}
+\newcommand{\sourceflush}{flushright}
+\newcommand{\epigraphfontsize}[1]{\def\epigraphsize{#1}}
+\newcommand{\epigraphposition}[1]{\long\def\epigraphflush{#1}}
+\newcommand{\epigraphtextposition}[1]{\def\textflush{#1}}
+\newcommand{\epigraphsourceposition}[1]{\def\sourceflush{#1}}
+
+\newcommand{\@epirule}{\rule[.5ex]{\epigraphwidth}{\epigraphrule}}
+\newcommand{\@epitext}[1]{%
+ \begin{minipage}{\epigraphwidth}\begin{\textflush} #1\par
+ \ifdim\epigraphrule>\z@ \@epirule \else \vspace*{1ex} \fi
+ \end{\textflush}\end{minipage}}
+\newcommand{\@episource}[1]{%
+ \begin{minipage}{\epigraphwidth}
+ \begin{\sourceflush} #1\par
+ \end{\sourceflush}\end{minipage}}
+
+\newcommand{\epigraph}[2]{\vspace{\beforeepigraphskip}
+ {\epigraphsize\begin{\epigraphflush}\begin{minipage}{\epigraphwidth}
+ \@epitext{#1}\\ \@episource{#2}
+ \end{minipage}\end{\epigraphflush}
+ \vspace{\afterepigraphskip}}}
+\newcommand{\qitem}[2]{{%
+ \raggedright\item \begin{minipage}{\epigraphwidth}
+ \@epitext{#1}\\ \@episource{#2}
+ \end{minipage}}}
+\newcommand{\qitemlabel}[1]{\hfill}
+\newenvironment{epigraphs}{%
+ \vspace{\beforeepigraphskip}\begin{\epigraphflush}
+ \epigraphsize
+ \begin{minipage}{\epigraphwidth}
+ \list{}%
+ {\itemindent\z@ \labelwidth\z@ \labelsep\z@
+ \leftmargin\z@ \rightmargin\z@
+ \let\makelabel\qitemlabel}}%
+ {\endlist\end{minipage}\end{\epigraphflush}
+ \vspace{\afterepigraphskip}}
+\newcommand{\dropchapter}[1]{%
+ \let\@epichapapp\@chapapp
+ \renewcommand{\@chapapp}{\vspace*{#1}\@epichapapp}}
+\newcommand{\undodrop}{\let\@chapapp\@epichapapp}
+\newif\if@epirhs \@epirhstrue
+\newif\if@epicenter \@epicentertrue
+\newcommand{\@epipos}{
+ \long\def\@ept{flushleft}
+ \ifx\epigraphflush\@ept
+ \@epirhsfalse \@epicenterfalse
+ \else
+ \long\def\@ept{center}
+ \ifx\epigraphflush\@ept
+ \@epirhsfalse \@epicentertrue
+ \else
+ \@epirhstrue \@epicenterfalse
+ \fi
+ \fi}
+\newcommand{\epigraphhead}[2][95]{%
+ \def\@epitemp{\begin{minipage}{\epigraphwidth}#2\end{minipage}}
+ \def\ps@epigraph{\let\@mkboth\@gobbletwo
+ \@epipos
+ \if@epirhs
+ \def\@oddhead{\hfil\begin{picture}(0,0)
+ \put(0,-#1){\makebox(0,0)[r]{\@epitemp}}
+ \end{picture}}
+ \else
+ \if@epicenter
+ \def\@oddhead{\hfil\begin{picture}(0,0)
+ \put(0,-#1){\makebox(0,0)[b]{\@epitemp}}
+ \end{picture}\hfil}
+ \else
+ \def\@oddhead{\begin{picture}(0,0)
+ \put(0,-#1){\makebox(0,0)[l]{\@epitemp}}
+ \end{picture}\hfil}
+ \fi
+ \fi
+ \let\@evenhead\@oddhead
+ \def\@oddfoot{\reset@font\hfil\thepage\hfil}
+ \let\@evenfoot\@oddfoot}
+ \thispagestyle{epigraph}}
+
+\newcommand{\the@epigraph}{}
+\newcommand{\@epidrop}{95}
+\newcommand{\epigraphforheader}[2][95]{%
+ \def\@epidrop{#1}\long\def\the@epigraph{#2}}
+
+\newcommand{\epigraphpicture}{%
+ \def\@epitemp{%
+ \begin{minipage}{\epigraphwidth}\the@epigraph\end{minipage}}%
+ \@epipos
+ \if@epirhs
+ \begin{picture}(0,0)%
+ \put(0,-\@epidrop){\makebox(0,0)[r]{\@epitemp}}%
+ \end{picture}%
+ \else
+ \if@epicenter
+ \begin{picture}(0,0)%
+ \put(0,-\@epidrop){\makebox(0,0)[b]{\@epitemp}}%
+ \end{picture}%
+ \else
+ \begin{picture}(0,0)%
+ \put(0,-\@epidrop){\makebox(0,0)[l]{\@epitemp}}%
+ \end{picture}%
+ \fi
+ \fi}
+
+\newcommand*{\@memoldfonterr}[3]{%
+ \@memerror{Font command \protect#1\space is not supported}{%
+ Use \protect#2, or \protect#3{...}, or the oldfontcommands option}}
+\newcommand*{\@memoldfontwarn}[3]{%
+ \@memwarn{The \protect#1\space font command is deprecated.
+ \MessageBreak Use \protect#2{...} or {\protect#3... } instead}}
+
+\if@memoldfont
+ \def\@mem@rmwarn{\@memoldfontwarn{\rm}{\textrm}{\rmfamily}}
+ \DeclareOldFontCommand{\rm}{\@mem@rmwarn\gdef\@mem@rmwarn{}%
+ \normalfont\rmfamily}{\mathrm}
+\else
+ \def\rm{\@memoldfonterr{\rm}{\textrm}{\rmfamily}}
+\fi
+
+\if@memoldfont
+ \def\@mem@sfwarn{\@memoldfontwarn{\sf}{\textsf}{\sffamily}}
+ \DeclareOldFontCommand{\sf}{\@mem@sfwarn\gdef\@mem@sfwarn{}%
+ \normalfont\sffamily}{\mathsf}
+\else
+ \def\sf{\@memoldfonterr{\sf}{\textsf}{\sffamily}}
+\fi
+
+\if@memoldfont
+ \def\@mem@ttwarn{\@memoldfontwarn{\tt}{\texttt}{\ttfamily}}
+ \DeclareOldFontCommand{\tt}{\@mem@ttwarn\gdef\@mem@ttwarn{}%
+ \normalfont\ttfamily}{\mathtt}
+\else
+ \def\tt{\@memoldfonterr{\tt}{\texttt}{\ttfamily}}
+\fi
+
+\if@memoldfont
+ \def\@mem@bfwarn{\@memoldfontwarn{\bf}{\textbf}{\bfseries}}
+ \DeclareOldFontCommand{\bf}{\@mem@bfwarn\gdef\@mem@bfwarn{}%
+ \normalfont\bfseries}{\mathbf}
+\else
+ \def\bf{\@memoldfonterr{\bf}{\textbf}{\bfseries}}
+\fi
+
+\if@memoldfont
+ \def\@mem@itwarn{\@memoldfontwarn{\it}{\textit}{\itshape}}
+ \DeclareOldFontCommand{\it}{\@mem@itwarn\gdef\@mem@itwarn{}%
+ \normalfont\itshape}{\mathit}
+\else
+ \def\it{\@memoldfonterr{\it}{\textit}{\itshape}}
+\fi
+
+\if@memoldfont
+ \def\@mem@slwarn{\@memoldfontwarn{\sl}{\textsl}{\slshape}}
+ \DeclareOldFontCommand{\sl}{\@mem@slwarn\gdef\@mem@slwarn{}%
+ \normalfont\slshape}{\@nomath\sl}
+\else
+ \def\sl{\@memoldfonterr{\sl}{\textsl}{\slshape}}
+\fi
+
+\if@memoldfont
+ \def\@mem@scwarn{\@memoldfontwarn{\sc}{\textsc}{\scshape}}
+ \DeclareOldFontCommand{\sc}{\@mem@scwarn\gdef\@mem@scwarn{}%
+ \normalfont\scshape}{\@nomath\sc}
+\else
+ \def\sc{\@memoldfonterr{\sc}{\textsc}{\scshape}}
+\fi
+
+\if@memoldfont
+ \def\@mem@calwarn{%
+ \@memwarn{The \protect\cal\space font command is deprecated.
+ \MessageBreak Try to use \protect\mathcal\space instead}}
+ \DeclareRobustCommand*\cal{\@mem@calwarn\gdef\@mem@calwarn{}%
+ \@fontswitch\relax\mathcal}
+\else
+ \def\cal{%
+ \@memerror{Font command \protect\cal\space is not supported}{%
+ Use \protect\mathcal, or the oldfontcommands option}}
+\fi
+
+\if@memoldfont
+ \def\@mem@mitwarn{%
+ \@memwarn{The \protect\mit\space font command is deprecated.
+ \MessageBreak Try to use \protect\mathnormal\space instead}}
+ \DeclareRobustCommand*\mit{\@mem@mitwarn\gdef\@mem@mitwarn{}%
+ \@fontswitch\relax\mathnormal}
+\else
+ \def\mit{%
+ \@memerror{Font command \protect\mit\space is not supported}{%
+ Use \protect\mathnormal, or the oldfontcommands option}}
+\fi
+
+\DeclareRobustCommand{\em}{%
+ \@nomath\em
+ \ifdim\fontdimen\@ne\font > \z@
+ \eminnershape
+ \else
+ \itshape
+ \fi}
+\providecommand{\eminnershape}{\upshape}
+\DeclareTextFontCommand{\emph}{\em}
+
+\newcommand*{\fref}[1]{\figurerefname~\ref{#1}}
+\newcommand*{\tref}[1]{\tablerefname~\ref{#1}}
+\newcommand*{\pref}[1]{\pagerefname~\pageref{#1}}
+\newcommand*{\Aref}[1]{\appendixrefname\ref{#1}}
+\newcommand*{\Bref}[1]{\bookrefname\ref{#1}}
+\newcommand*{\Pref}[1]{\partrefname\ref{#1}}
+\newcommand*{\Cref}[1]{\chapterrefname\ref{#1}}
+\newcommand*{\Sref}[1]{\sectionrefname\ref{#1}}
+
+\newif\ifheadnameref
+\newcommand*{\headnameref}{\headnamereftrue}
+\newcommand*{\tocnameref}{\headnamereffalse}
+ \tocnameref
+\newcommand{\theTitleReference}[2]{#2}
+
+\let\@mem@old@label\label
+\def\label#1{\@bsphack\begingroup
+ \protected@edef\@currentlabel{\protect\M@TitleReference
+ {\@currentlabel}{\M@currentTitle}}%
+ \@mem@old@label{#1}%
+ \endgroup \@esphack}%
+
+\def\@mem@@gettitle#1{\begingroup \let\protect\@unexpandable@protect
+ \let\label\@mem@nestwarn
+ \let\index\@gobble \let\glossary\@gobble
+ \let\markboth\@gobbletwo \let\@mkboth\@gobbletwo
+ \let\markright\@gobble
+ \edef\@tempa{\noexpand\def\noexpand\M@currentTitle{#1}}%
+ \expandafter\endgroup\@tempa}
+
+\let\@mem@nestwarn\@gobble
+\let\M@TitleReference\@firstoftwo
+
+\newcommand*\@mem@titleref[1]{\begingroup
+ \let\numberline\@gobble
+ \let\M@TitleReference\@mem@theTR % interrupt recursion of \ref
+ \ref{#1}\endgroup}
+\let\@mem@titlerefnolink\@mem@titleref
+
+\DeclareRobustCommand\titleref{\@ifstar{\@mem@titlerefnolink}{\@mem@titleref}}
+
+\DeclareRobustCommand{\currenttitle}{\begingroup
+ \let\numberline\@gobble
+ \theTitleReference\@currentlabel\M@currentTitle\endgroup}
+
+\let\M@currentTitle\@empty
+
+\def\@mem@theTR{\let\M@TitleReference\@firstoftwo \theTitleReference}
+
+\newcommand*{\namerefon}{\let\M@gettitle\@mem@@gettitle}
+\newcommand*{\namerefoff}{\let\M@gettitle\@gobble}
+ \namerefon
+\newcommand{\@pnumwidth}{1.55em}
+\newcommand{\@tocrmarg} {2.55em}
+\newcommand{\@dotsep}{4.5}
+\newlength{\tocentryskip} \setlength{\tocentryskip}{1em}
+\newlength{\tocbaseline} \setlength{\tocbaseline}{20pt}
+\newcommand{\tocskip}[1]{%
+ \addtocontents{toc}{\protect\vspace{#1}}}
+\newcommand*{\ensureonecol}{%
+ \if@twocolumn
+ \@restonecoltrue\onecolumn
+ \else
+ \@restonecolfalse
+ \fi}
+\newcommand*{\restorefromonecol}{\if@restonecol\twocolumn\fi}
+
+\newlength{\cftparskip}
+\setlength{\cftparskip}{0pt}
+
+\newcommand{\newlistof}[3]{%
+ \@namedef{ext@#2}{#2}
+ \@ifundefined{c@#2depth}{\newcounter{#2depth}}{}
+ \setcounter{#2depth}{1}
+ \@namedef{#2mark}{\markboth{#3}{#3}}
+ \@namedef{#1}{\@ifstar{\@nameuse{@star#2}}{\@nameuse{@plain#2}}}
+ \@namedef{@star#2}{%
+ \ensureonecol
+ \par
+ \begingroup
+%%% \parindent\z@ \parskip\cftparskip
+ \@nameuse{@#2maketitle}
+\parskip\cftparskip
+ \@starttoc{#2}%
+ \endgroup
+ \restorefromonecol}
+ \@namedef{@plain#2}{%
+ \ensureonecol
+ \par
+ \begingroup
+%%% \parindent\z@ \parskip\cftparskip
+ \@nameuse{@#2maketitle}
+ \phantomsection
+ \addcontentsline{toc}{chapter}{#3}
+\parskip\cftparskip
+ \@starttoc{#2}%
+ \endgroup
+ \restorefromonecol}
+ \@namedef{@#2maketitle}{%
+ \@nameuse{#2headstart}
+ {\parindent\z@
+%%%% \parskip\cftparskip
+ \interlinepenalty\@M
+ \@nameuse{print#2nonum}%
+ \@nameuse{print#2title}{#3}%
+ \@nameuse{#2mark}%
+ \thispagestyle{chapter}%
+ \@nameuse{after#2title}
+ }
+ \@afterheading}
+ \@namedef{#2headstart}{\chapterheadstart}
+ \@namedef{after#2title}{\afterchaptertitle}
+ \@namedef{print#2nonum}{\printchapternonum}
+ \@namedef{print#2title}##1{\printchaptertitle{##1}}
+} % end \newlistof
+
+\renewcommand{\@starttoc}[1]{%
+ \begingroup\makeatletter
+ \@input{\jobname.#1}%
+ \if@filesw
+ \AtEndDocument{%
+ \expandafter\newwrite\csname tf@#1\endcsname
+ \immediate\openout \csname tf@#1\endcsname \jobname.#1\relax
+ }%
+ \fi
+ \@nobreakfalse
+ \endgroup}
+
+\newlistof{tableofcontents}{toc}{\contentsname}
+\newcommand*{\setpnumwidth}[1]{\renewcommand{\@pnumwidth}{#1}}
+\newcommand*{\setrmarg}[1]{\renewcommand{\@tocrmarg}{#1}}
+\providecommand{\cftdot}{.}
+\providecommand{\cftdotfill}[1]{%
+ \leaders\hbox{$\m@th\mkern #1 mu\hbox{\cftdot}\mkern #1 mu$}\hfill}
+\providecommand{\cftdotsep}{4.5}
+\newcommand{\cftnodots}{2000}
+\newcommand*{\cftparfillskip}{\parfillskip=0pt plus1fil}
+\newcommand*{\@cftn@me}{}
+
+\renewcommand*{\numberline}[1]{%
+ \hb@xt@\@tempdima{\@cftn@me\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}
+\newcommand{\@cftbsnum}{}
+\newcommand{\@cftasnum}{}
+\newcommand{\@cftasnumb}{}
+\newcommand{\newlistentry}[4][\@empty]{%
+ \@ifundefined{c@#2}{% check & set the counter
+ \ifx \@empty#1\relax
+ \newcounter{#2}
+ \else
+ \newcounter{#2}[#1]%
+ \expandafter\edef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}
+ \fi}{}
+ \setcounter{#2}{0}
+ \@namedef{l@#2}##1##2{%
+ \ifnum \@nameuse{c@#3depth} > #4\relax
+ \vskip \@nameuse{cftbefore#2skip}
+ {\if@RTL\rightskip\else\leftskip\fi \@nameuse{cft#2indent}\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \settowidth{\@tempdima}{\@nameuse{cft#2font}\@nameuse{cft#2name}}%
+ \addtolength{\@tempdima}{\@nameuse{cft#2numwidth}}%
+ \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
+ \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
+ \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
+ \expandafter\let\expandafter\@cftn@me\csname cft#2name\endcsname
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\@nameuse{cft#2font}##1}\nobreak
+ \@nameuse{cft#2fillnum}{##2}}
+ \fi
+ } % end of \l@#2
+
+ \expandafter\newlength\csname cftbefore#2skip\endcsname
+ \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
+ \expandafter\newlength\csname cft#2indent\endcsname
+ \expandafter\newlength\csname cft#2numwidth\endcsname
+ \ifcase #4\relax % 0 (level 1)
+ \setlength{\@nameuse{cft#2indent}}{0em}
+ \setlength{\@nameuse{cft#2numwidth}}{2.3em}
+ \or % 1 (level 2)
+ \setlength{\@nameuse{cft#2indent}}{2.3em}
+ \setlength{\@nameuse{cft#2numwidth}}{3.2em}
+ \or % 2 (level 3)
+ \setlength{\@nameuse{cft#2indent}}{5.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{4.1em}
+ \or % 3 (level 4)
+ \setlength{\@nameuse{cft#2indent}}{8.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{5.0em}
+ \else % anything else
+ \setlength{\@nameuse{cft#2indent}}{10.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{6.0em}
+ \fi
+ \@namedef{cft#2font}{\normalfont}
+ \@namedef{cft#2name}{}
+ \@namedef{cft#2presnum}{}
+ \@namedef{cft#2aftersnum}{}
+ \@namedef{cft#2aftersnumb}{}
+ \@namedef{cft#2dotsep}{\cftdotsep}
+ \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
+ \@namedef{cft#2pagefont}{\normalfont}
+ \@namedef{cft#2afterpnum}{}
+ \@namedef{toclevel@#2}{#4}
+ \@namedef{cft#2formatpnum}##1{%
+ \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}}
+ \@namedef{cft#2fillnum}##1{%
+ {\@nameuse{cft#2leader}}\nobreak
+%%% \hb@xt@\@pnumwidth{%
+%%% \hfil\@nameuse{cft#2pagefont}##1}
+ \@nameuse{cft#2formatpnum}{##1}%
+ \@nameuse{cft#2afterpnum}\par}
+} % end \newlistentry
+
+\newcommand*{\cftsetindents}[3]{%
+ \setlength{\@nameuse{cft#1indent}}{#2}
+ \setlength{\@nameuse{cft#1numwidth}}{#3}}
+
+\newcommand*{\cftbookname}{}
+
+\newcommand*{\cftbookbreak}{\addpenalty{-\@highpenalty}%
+ \addvspace{\cftbeforebookskip}}
+\newcommand*{\l@book}[2]{%
+ \ifnum\c@tocdepth >-3\relax
+%% \addpenalty{-\@highpenalty}%
+ \cftbookbreak
+%% \addvspace{\cftbeforebookskip}%
+ \begingroup
+ {\if@RTL\rightskip\else\leftskip\fi \cftbookindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftbookindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \settowidth{\@tempdima}{\cftbookfont\cftbookname}%
+ \addtolength{\@tempdima}{\cftbooknumwidth}%
+ \let\@cftbsnum \cftbookpresnum
+ \let\@cftasnum \cftbookaftersnum
+ \let\@cftasnumb \cftbookaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftbookfont #1}%
+ \cftbookfillnum{#2}}
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\newcommand{\booknumberline}[1]{%
+ \hb@xt@\@tempdima{%
+ \cftbookname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}%%\space}
+
+\newlength{\cftbeforebookskip}
+ \setlength{\cftbeforebookskip}{2.25em \@plus\p@}
+\newdimen\cftbookindent
+ \setlength{\cftbookindent}{0em}
+\newdimen\cftbooknumwidth
+ \setlength{\cftbooknumwidth}{1.5em}
+\newcommand*{\cftbookfont}{\large\bfseries}
+\newcommand*{\cftbookpresnum}{}
+\newcommand*{\cftbookaftersnum}{}
+\newcommand*{\cftbookaftersnumb}{}
+\newcommand*{\cftbookleader}{%
+ \large\bfseries\cftdotfill{\cftbookdotsep}}
+\newcommand*{\cftbookdotsep}{\cftnodots}
+\newcommand*{\cftbookpagefont}{\large\bfseries}
+\newcommand{\cftbookafterpnum}{}
+\newcommand{\cftbookfillnum}[1]{%
+ {\cftbookleader}%
+%%%% {\hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}%
+ \cftbookformatpnum{#1}%
+ \cftbookafterpnum\par}
+\newcommand{\cftbookformatpnum}[1]{%
+ \hb@xt@\@pnumwidth{\hss {\cftbookpagefont #1}}}
+
+\newcommand*{\cftpartname}{}
+
+\newcommand*{\cftpartbreak}{\addpenalty{-\@highpenalty}%
+ \addvspace{\cftbeforepartskip}}
+\newcommand*{\l@part}[2]{%
+ \ifnum \c@tocdepth >-2\relax
+%%% \addpenalty{-\@highpenalty}%
+%%% \addvspace{\cftbeforepartskip}%
+ \cftpartbreak
+ \begingroup
+ {\if@RTL\rightskip\else\leftskip\fi \cftpartindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftpartindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \settowidth{\@tempdima}{\cftpartfont\cftpartname}%
+ \addtolength{\@tempdima}{\cftpartnumwidth}%
+ \let\@cftbsnum \cftpartpresnum
+ \let\@cftasnum \cftpartaftersnum
+ \let\@cftasnumb \cftpartaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftpartfont #1}%
+ \cftpartfillnum{#2}}
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+
+\newcommand*{\toclevel@part}{-1}
+
+\newcommand{\partnumberline}[1]{%
+ \hb@xt@\@tempdima{%
+ \cftpartname\@cftbsnum #1\@cftasnum\hfil}\@cftasnumb}%%\space}
+
+ \newlength{\cftbeforepartskip}
+ \setlength{\cftbeforepartskip}{2.25em \@plus\p@}
+ \newlength{\cftpartindent}
+ \setlength{\cftpartindent}{0em}
+ \newlength{\cftpartnumwidth}
+ \setlength{\cftpartnumwidth}{1.5em}
+ \newcommand{\cftpartfont}{\large\bfseries}
+ \newcommand{\cftpartpresnum}{}
+ \newcommand{\cftpartaftersnum}{}
+ \newcommand{\cftpartaftersnumb}{}
+ \newcommand{\cftpartleader}{%
+ \large\bfseries\cftdotfill{\cftpartdotsep}}
+ \newcommand{\cftpartdotsep}{\cftnodots}
+ \newcommand{\cftpartpagefont}{\large\bfseries}
+ \newcommand{\cftpartafterpnum}{}
+ \newcommand*{\cftpartformatpnum}[1]{%
+ \hb@xt@\@pnumwidth{\hss {\cftpartpagefont #1}}}
+ \newcommand{\cftpartfillnum}[1]{%
+ {\cftpartleader}%
+ {\cftpartformatpnum{#1}}%
+ \cftpartafterpnum\par}
+
+\newcommand*{\cftchaptername}{}
+
+\newcommand*{\l@chapapp}[3]{%
+ \ifnum \c@tocdepth >\m@ne
+ \cftchapterbreak
+ \vskip \cftbeforechapterskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftchapterindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftchapterindent\relax
+ \@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \let\@cftbsnum \cftchapterpresnum
+ \let\@cftasnum \cftchapteraftersnum
+ \let\@cftasnumb \cftchapteraftersnumb
+ \def\@chapapp@head{#3}%
+ \settowidth{\@tempdima}{\cftchapterfont\@chapapp@head}%
+ \addtolength{\@tempdima}{\cftchapternumwidth}%
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftchapterfont #1}\nobreak
+ \cftchapterfillnum{#2}}
+ \fi}
+
+\newcommand*{\l@chapter}[2]{%
+ \l@chapapp{#1}{#2}{\cftchaptername}}
+
+\newcommand*{\toclevel@chapter}{0}
+
+\newcommand*{\cftappendixname}{}
+
+\newcommand*{\l@appendix}[2]{%
+ \l@chapapp{#1}{#2}{\cftappendixname}}
+\newcommand{\toclevel@appendix}{0}
+
+\newcommand{\chapternumberline}[1]{%
+ \hb@xt@\@tempdima{\@chapapp@head\@cftbsnum #1\@cftasnum\hfil}%
+ \@cftasnumb}
+
+ \newlength{\cftbeforechapterskip}
+ \setlength{\cftbeforechapterskip}{1.0em \@plus\p@}
+ \newlength{\cftchapterindent}
+ \setlength{\cftchapterindent}{0em}
+ \newlength{\cftchapternumwidth}
+ \setlength{\cftchapternumwidth}{1.5em}
+ \newcommand{\cftchapterfont}{\bfseries}
+ \newcommand{\cftchapterpresnum}{}
+ \newcommand{\cftchapteraftersnum}{}
+ \newcommand{\cftchapteraftersnumb}{}
+ \newcommand{\cftchapterleader}{%
+ \bfseries\cftdotfill{\cftchapterdotsep}}
+ \newcommand{\cftchapterdotsep}{\cftnodots}
+ \newcommand{\cftchapterpagefont}{\bfseries}
+ \newcommand{\cftchapterafterpnum}{}
+ \newcommand*{\cftchapterformatpnum}[1]{%
+ \hb@xt@\@pnumwidth{\hfil\cftchapterpagefont #1}}
+ \newcommand*{\cftchapterfillnum}[1]{
+ {\cftchapterleader}\nobreak
+ \cftchapterformatpnum{#1}%
+ \cftchapterafterpnum\par}
+ \newcommand{\cftchapterbreak}{\addpenalty{-\@highpenalty}}
+
+\newlistentry[chapter]{section}{toc}{0}
+ \cftsetindents{section}{1.5em}{2.3em}
+\newlistentry[section]{subsection}{toc}{1}
+ \cftsetindents{subsection}{3.8em}{3.2em}
+\newlistentry[subsection]{subsubsection}{toc}{2}
+ \cftsetindents{subsubsection}{7.0em}{4.1em}
+\newlistentry[subsubsection]{paragraph}{toc}{3}
+ \cftsetindents{paragraph}{10.0em}{5.0em}
+\newlistentry[paragraph]{subparagraph}{toc}{4}
+ \cftsetindents{subparagraph}{12.0em}{6.0em}
+
+\newcommand*{\@cftl@subfigtab}{
+\newlistentry[figure]{subfigure}{lof}{1}
+ \cftsetindents{subfigure}{2.3em}{2.5em}
+\newlistentry[table]{subtable}{lot}{1}
+ \cftsetindents{subtable}{2.3em}{2.5em}}
+\renewcommand*{\@cftl@subfigtab}{}
+
+\AtBeginDocument{\@ifpackageloaded{subfigure}{\@cftl@subfigtab}{}}
+
+\DeclareRobustCommand{\cftpagenumbersoff}[1]{%
+ \@namedef{cft#1fillnum}##1{%
+ \cftparfillskip\@nameuse{cft#1afterpnum}\par}}
+
+\DeclareRobustCommand{\cftpagenumberson}[1]{%
+ \@namedef{cft#1fillnum}##1{%
+ \@nameuse{cft#1leader}\nobreak
+ \@nameuse{cft#1formatpnum}{##1}%
+ \@nameuse{cft#1afterpnum}\par}}
+
+\newcommand{\chapterprecis}[1]{%
+ \chapterprecishere{#1}
+ \chapterprecistoc{#1}}
+\newcommand{\chapterprecishere}[1]{%
+ \prechapterprecis #1\postchapterprecis}
+\newdimen\prechapterprecisshift
+\ifartopt
+ \prechapterprecisshift=0pt
+\else
+ \prechapterprecisshift=-2\baselineskip
+\fi
+\newcommand*{\precisfont}{\normalfont\itshape}
+\newcommand{\prechapterprecis}{%
+ \vspace*{\prechapterprecisshift}%
+ \begin{quote}\precisfont}
+\newcommand*{\postchapterprecis}{\end{quote}}
+
+\newcommand{\precistocfont}{\normalfont\itshape}
+\newcommand{\chapterprecistoc}[1]{%
+ \addtocontents{toc}{\precistoctext{#1}}}
+\DeclareRobustCommand{\precistoctext}[1]{%
+ {\nopagebreak\if@RTL\rightskip\else\leftskip\fi \cftchapterindent\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \cftchapternumwidth\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg\relax
+ \precistocfont #1\par}}
+\newcommand{\cftlocalchange}[3]{%
+ \addtocontents{#1}{\protect\setpnumwidth{#2} \protect\setrmarg{#3}}}
+\newcommand{\cftaddtitleline}[4]{%
+ \addtocontents{#1}{\protect\contentsline{#2}{#3}{#4}}}
+\newcommand{\cftaddnumtitleline}[5]{%
+ \addtocontents{#1}%
+ {\protect\contentsline{#2}{\protect\numberline{#3}%
+ {\protect\ignorespaces #4}}{#5}}}
+\newcommand*{\cftinsert}[1]{\@nameuse{cftinsert#1}}
+\newcommand{\cftinsertcode}[2]{\@namedef{cftinsert#1}{#2}}
+\newcommand*{\cftinserthook}[2]{%
+ \addtocontents{#1}{\protect\cftinsert\protect{#2\protect}}}
+
+\newcommand*{\@setclcnt}[2]{%
+ \@tempswafalse
+ \nametest{#1}{none}%
+ \ifsamename
+ \setcounter{#2}{-10}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{book}%
+ \ifsamename
+ \setcounter{#2}{-2}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{part}%
+ \ifsamename
+ \setcounter{#2}{-1}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{chapter}%
+ \ifsamename
+ \setcounter{#2}{0}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{section}%
+ \ifsamename
+ \setcounter{#2}{1}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsection}%
+ \ifsamename
+ \setcounter{#2}{2}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsubsection}%
+ \ifsamename
+ \setcounter{#2}{3}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{paragraph}%
+ \ifsamename
+ \setcounter{#2}{4}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subparagraph}%
+ \ifsamename
+ \setcounter{#2}{5}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{all}%
+ \ifsamename
+ \setcounter{#2}{50}%
+ \@tempswatrue
+ \fi
+ \if@tempswa\else
+ \@memerror{%
+ Unknown document division name (#1)
+ }{%
+ I'll ignore it.
+ Type \space <return> and I'll continue.\MessageBreak
+ If you haven't mistyped the name then use
+ \protect\setcounter\space instead.}%
+ \fi}
+
+\newcommand*{\settocdepth}[1]{%
+ \@tempswafalse
+ \nametest{#1}{none}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{-10}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{book}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{-2}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{part}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{-1}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{chapter}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{0}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{section}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{1}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsection}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{2}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subsubsection}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{3}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{paragraph}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{4}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{subparagraph}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{5}}%
+ \@tempswatrue
+ \fi
+ \nametest{#1}{all}%
+ \ifsamename
+ \addtocontents{toc}{\changetocdepth{50}}%
+ \@tempswatrue
+ \fi
+ \if@tempswa
+ \@ifundefined{toclevel@#1}{%
+ \@memwarn{Unknown toclevel for #1}%
+ }{%
+ \setcounter{tocdepth}{\@nameuse{toclevel@#1}}%
+ }
+ \else
+ \@memerror{%
+ Unknown document division name (#1)
+ }{%
+ I'll ignore it.
+ Type \space <return> and I'll continue.}%
+ \fi}
+
+\newcommand*{\toclevel@none}{-10}
+\newcommand*{\toclevel@all}{50}
+
+\DeclareRobustCommand{\changetocdepth}[1]{\setcounter{tocdepth}{#1}}
+
+\newcommand{\maxtocdepth}[1]{%
+ \@setclcnt{#1}{tocdepth}}
+\newcounter{maxsecnumdepth}
+\newcommand{\maxsecnumdepth}[1]{%
+ \@setclcnt{#1}{secnumdepth}\@setclcnt{#1}{maxsecnumdepth}}
+
+\newcommand{\setsecnumdepth}[1]{%
+ \ifx\@nodocument\relax% after the preamble
+ \@setclcnt{#1}{secnumdepth}%
+ \else
+ \@setclcnt{#1}{secnumdepth}%
+ \@setclcnt{#1}{maxsecnumdepth}%
+ \fi}
+\setsecnumdepth{section}
+
+\newdimen\bibindent
+ \setlength\bibindent{1.5em}
+\newlength{\bibitemsep}
+ \setlength{\bibitemsep}{\itemsep}
+\newcommand{\biblistextra}{\itemsep=\bibitemsep}
+
+\newenvironment{bibitemlist}[1]{%
+ \typeout{bibitemlist}
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \leftmargin\labelwidth
+ \advance\leftmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}%
+ \biblistextra}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}%
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+
+\newcommand{\newblock}{\hskip .11em\@plus.33em\@minus.07em}
+\let\@openbib@code\@empty
+\newcommand*{\setbiblabel}[1]{%
+ \renewcommand*{\@biblabel}[1]{#1}}
+\setbiblabel{[#1]\hfill}
+\newcommand{\@memb@bchap}{%
+ \chapter*{\bibname}%
+ \bibmark
+ \ifnobibintoc\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\bibname}%
+ \fi
+ \prebibhook}
+\newcommand{\@memb@bsec}{\section{\bibname}\prebibhook}
+\newcommand{\bibsection}{\@memb@bchap}
+
+\newenvironment{thebibliography}[1]{%
+ \bibsection
+ \begin{bibitemlist}{#1}}{\end{bibitemlist}\postbibhook}
+\newif\ifnobibintoc
+\newcommand*{\bibintoc}{\nobibintocfalse}
+\newcommand*{\nobibintoc}{\nobibintoctrue}
+\bibintoc
+
+\newcommand{\prebibhook}{}
+\newcommand{\postbibhook}{}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{natbib}{% natbib is loaded
+ \addtodef{\endthebibliography}{}{\vskip-\lastskip\postbibhook}
+ \@ifpackagewith{natbib}{sectionbib}{% with sectionbib option
+ \renewcommand{\bibsection}{\@memb@bsec}}%
+ {\renewcommand{\bibsection}{\@memb@bchap}}}%
+ {}
+ \@ifpackagewith{chapterbib}{sectionbib}{%
+ \renewcommand{\sectionbib}[2]{}
+ \renewcommand{\bibsection}{\@memb@bsec}}{}
+}
+
+\newif\ifonecolindex
+ \onecolindexfalse
+
+\newcommand*{\onecolindex}{\onecolindextrue}
+\newcommand*{\twocolindex}{\onecolindexfalse}
+
+\newenvironment{theindex}{%
+ \clearforchapter
+ \if@twocolumn
+ \@restonecolfalse
+ \else
+ \@restonecoltrue
+ \fi
+ \ifonecolindex
+ \onecolumn
+ \chapter*{\indexname}
+ \preindexhook
+ \else
+ \setlength{\columnseprule}{\indexrule}%
+ \setlength{\columnsep}{\indexcolsep}%
+ \twocolumn[\@makeschapterhead{\indexname}
+ \preindexhook]%
+ \fi
+ \indexmark
+ \ifnoindexintoc\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\indexname}%
+ \fi
+ \thispagestyle{indextitlepagestyle}\parindent\z@
+ \parskip\z@ \@plus .3\p@\relax
+ \let\item\@idxitem}%
+ {\if@restonecol\onecolumn\else\twocolumn\fi}
+
+\aliaspagestyle{indextitlepagestyle}{chapter}
+
+\newif\ifnoindexintoc
+\newcommand*{\indexintoc}{\noindexintocfalse}
+\newcommand*{\noindexintoc}{\noindexintoctrue}
+\indexintoc
+
+\newlength{\indexcolsep} \setlength{\indexcolsep}{35pt}
+\newlength{\indexrule} \setlength{\indexrule}{0pt}
+
+\newcommand{\preindexhook}{}
+\newcommand{\l@index}{\@dottedtocline{1}{0em}{0pt}}
+\newcommand{\@idxitem} {\par\hangindent 40\p@}
+\newcommand{\subitem} {\par\hangindent 40\p@ \hspace*{20\p@}}
+\newcommand{\subsubitem}{\par\hangindent 40\p@ \hspace*{30\p@}}
+\newcommand{\indexspace}{\par \vskip 10\p@ \@plus5\p@ \@minus3\p@\relax}
+
+\newcommand*{\makememindexhook}{}
+\providecommand*{\makeindex}{}
+\renewcommand*{\makeindex}[1][\jobname]{%
+ \if@filesw
+ \def\index{\@bsphack%
+ \@ifnextchar [{\@index}{\@index[\jobname]}}
+ \def\specialindex{\@bsphack\@spindex}%
+ \makememindexhook
+ \expandafter\newwrite\csname #1@idxfile\endcsname
+ \expandafter\immediate\openout \csname #1@idxfile\endcsname #1.idx\relax
+ \typeout{Writing index file #1.idx }%
+ \fi}
+
+\renewcommand{\index}[2][\jobname]{\@bsphack\@esphack}
+\newcommand{\specialindex}[3]{\@bsphack\@esphack}
+
+\newcommand{\printindex}[1][\jobname]{\@input@{#1.ind}}
+
+\newif\ifreportnoidxfile
+\newcommand*{\reportnoidxfile}{\reportnoidxfiletrue}
+\newcommand*{\ignorenoidxfile}{\reportnoidxfilefalse}
+ \ignorenoidxfile
+\newif\ifshowindexmark
+\newcommand*{\showindexmarks}{\showindexmarktrue}
+\newcommand*{\hideindexmarks}{\showindexmarkfalse}
+ \hideindexmarks
+
+\def\@index[#1]{%
+ \@ifundefined{#1@idxfile}%
+ {\ifreportnoidxfile
+ \@memwarn{Undefined index file #1}%
+ \fi
+ \begingroup
+ \@sanitize
+ \@nowrindex}%
+ {\def\@idxfile{#1}%
+ \begingroup
+ \@sanitize
+ \@wrindexm@m}}
+\newcommand{\@nowrindex}[1]{%
+ \ifshowindexmark\@showidx{#1}\fi\endgroup\@esphack}
+
+\newcommand{\@wrindexm@m}[1]{\@@wrindexhyp#1||\\}
+\def\@@wrindexhyp#1|#2|#3\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \ifx\\#2\\%
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|hyperpage}{\thepage}}%
+ \else
+ \def\Hy@temp@A{#2}%
+ \ifx\Hy@temp@A\HyInd@ParenLeft
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2hyperpage}{\thepage}}%
+ \else
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2}{\thepage}}%
+ \fi
+ \fi
+ \endgroup
+ \@esphack}
+\newcommand{\hyperpage}[1]{#1}
+\newcommand{\hyperlink}[2]{#2}
+
+\newcommand{\@@wrindexm@m}[1]{\begingroup
+ \def\@idxfile{\@nameuse{#1@idxfile}}
+ \@sanitize
+ \@@@wrindexm@m}
+
+\newcommand{\@@@wrindexm@m}[2]{\endgroup}
+\AtBeginDocument{%
+ \def\@@@wrindexm@m#1#2{%
+ \if@filesw
+ \immediate\write \@idxfile{\string\indexentry{#1}{#2}}%
+ \fi
+ \endgroup}%
+}
+\newcommand{\@spindex}[2]{%
+ \@ifundefined{#1@idxfile}%
+ {\ifreportnoidxfile
+ \@memwarn{Undefined index file #1}%
+ \fi
+ \begingroup
+ \@sanitize
+ \@nowrindex}%
+ {\def\@idxfile{#1}%
+ \def\@sptheidx{#2}%
+ \begingroup
+ \@sanitize
+ \@wrspindex}}
+
+\newcommand{\@wrspindex}[1]{\@@wrspindexhyp#1||\\}
+\def\@@wrspindexhyp#1|#2|#3\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \ifx\\#2\\%
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ {#1|hyperspindexpage(\thepage)}%
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \def\Hy@temp@A{#2}%
+ \ifx\Hy@temp@A\HyInd@ParenLeft
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ {#1|#2hyperspindexpage(\thepage)}%
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2}%
+ {\@nameuse{the\@sptheidx}}}%
+ \fi
+ \fi
+ \endgroup
+ \@esphack}
+\def\hyperspindexpage(#1)#2{\hyperlink{page.#1}{#2}}
+
+\newif\ifmemhyperindex
+ \memhyperindextrue
+
+\newif\ifm@mxindy
+\m@mxindyfalse
+\newcommand*{\xindyindex}{\m@mxindytrue}
+\def\@@wrspindexhyp#1|#2|#3\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \ifx\\#2\\%
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ \ifm@mxindy{#1}\else{#1|hyperspindexpage(\thepage)}\fi
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \def\Hy@temp@A{#2}%
+ \ifx\Hy@temp@A\HyInd@ParenLeft
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}%
+ \ifm@mxindy{#1|#2}\else{#1|#2hyperspindexpage(\thepage)}\fi
+ {\@nameuse{the\@sptheidx}}}%
+ \else
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1|#2}%
+ {\@nameuse{the\@sptheidx}}}%
+ \fi
+ \fi
+ \endgroup
+ \@esphack}
+
+\AtBeginDocument{%
+ \@ifpackageloaded{hyperref}{}{\memhyperindexfalse}%
+ \ifmemhyperindex\else
+ \def\@@wrindexhyp#1||\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1}{\thepage}}%
+ \endgroup
+ \@esphack}%
+ \def\@@wrspindexhyp#1||\\{%
+ \ifshowindexmark\@showidx{#1}\fi
+ \protected@write\@auxout{}%
+ {\string\@@wrindexm@m{\@idxfile}{#1}{\@nameuse{the\@sptheidx}}}%
+ \endgroup
+ \@esphack}%
+ \fi
+}
+
+\newcommand*{\see}[2]{\emph{\seename} #1}
+\newcommand*{\seename}{see}
+\newcommand*{\seealso}[2]{\emph{\alsoname} #1}
+\newcommand*{\alsoname}{see also}
+
+\newcommand{\citeindexfile}{\jobname}
+\AtBeginDocument{\@ifpackageloaded{natbib}{%
+ \def\NAT@index{\index[\citeindexfile]{\NAT@idxtxt}}}{}}
+
+\newtoks\indexmarkstyle
+ \indexmarkstyle{\normalfont\footnotesize\ttfamily}
+\newinsert\@indexbox
+ \dimen\@indexbox\maxdimen
+
+\begingroup
+ \catcode`\@\active
+ \expandafter\gdef\csname\string @sanitizeat\endcsname
+ {\def @{\char`\@}}
+\endgroup
+
+\newcommand{\@showidx}[1]{%
+ \insert\@indexbox{%
+ \@sanitizeat
+ \the\indexmarkstyle
+ \hsize\marginparwidth
+ \hangindent\marginparsep \parindent\z@
+ \everypar{}\let\par\@@par \parfillskip\@flushglue
+ \lineskip\normallineskip
+ \baselineskip .8\normalbaselineskip\sloppy
+ \raggedright \leavevmode
+ \vrule \@height .7\normalbaselineskip \@width \z@\relax
+ #1\relax
+ \vrule \@height \z@ \@depth .3\normalbaselineskip \@width \z@\relax
+ }%
+ \ifhmode\penalty\@M \hskip\z@skip\fi}
+
+\newcommand{\@leftidx}{\hskip-\marginparsep \hskip-\marginparwidth}
+\newcommand{\@rightidx}{\hskip\columnwidth \hskip\marginparsep}
+
+\newcommand{\@mkidx}{\vbox to \z@{%
+ \rlap{%
+ \if@twocolumn
+ \if@firstcolumn \@leftidx \else \@rightidx \fi
+ \else
+ \if@twoside
+ \ifodd\c@page \@rightidx \else \@leftidx \fi
+ \else
+ \@rightidx
+ \fi
+ \fi
+ \box\@indexbox
+ }%
+ \vss}}
+
+\renewcommand{\raggedbottom}{%
+ \def\@textbottom{\vskip\z@ plus.0001fil}%
+ \let\@texttop\@mkidx}
+\renewcommand{\flushbottom}{%
+ \let\@textbottom\relax
+ \let\@texttop\@mkidx}
+\let\@texttop\@mkidx
+
+\newcommand*{\sloppybottom}{%
+ \def\@textbottom{\vskip \z@ \@plus.0001fil \@minus .95\topskip}%
+ \topskip=1\topskip \@plus 0.625\topskip \@minus .95\topskip
+ \def\@texttop{\vskip \z@ \@plus -0.625\topskip \@minus -0.95\topskip}}
+
+\newif\ifonecolglossary
+ \onecolglossarytrue
+\newcommand*{\onecolglossary}{\onecolglossarytrue}
+\newcommand*{\twocolglossary}{\onecolglossaryfalse}
+
+\newenvironment{theglossary}{%
+ \if@twocolumn
+ \@restonecolfalse
+ \else
+ \@restonecoltrue
+ \fi
+ \ifonecolglossary
+ \onecolumn
+ \chapter*{\glossaryname}
+ \preglossaryhook
+ \else
+ \setlength{\columnseprule}{\glossaryrule}
+ \setlength{\columnsep}{\glossarycolsep}
+ \twocolumn[\@makeschapterhead{\glossaryname}
+ \preglossaryhook]%
+ \fi
+ \glossarymark
+ \ifnoglossaryintoc\else
+ \phantomsection
+ \addcontentsline{toc}{chapter}{\glossaryname}
+ \fi
+ \thispagestyle{chapter}\parindent\z@
+ \parskip\z@ \@plus .3\p@\relax
+ \begintheglossaryhook}%
+ {\atendtheglossaryhook\if@restonecol\onecolumn\else\twocolumn\fi}
+
+\newcommand*{\begintheglossaryhook}{}
+\newcommand*{\atendtheglossaryhook}{}
+\newcommand*{\preglossaryhook}{}
+
+\newif\ifnoglossaryintoc
+\newcommand*{\glossaryintoc}{\noglossaryintocfalse}
+\newcommand*{\noglossaryintoc}{\noglossaryintoctrue}
+ \glossaryintoc
+
+\newdimen\glossarycolsep \glossarycolsep=35\p@
+\newdimen\glossaryrule \glossaryrule=0\p@
+\newcommand*{\glossaryspace}{%
+ \par \vskip 1.0\onelineskip \@plus 5\p@ \@minus3\p@\relax}
+
+\providecommand*{\makeglossary}{}
+\renewcommand*{\makeglossary}[1][\jobname]{%
+ \makememglossaryhook
+ \@namedef{memglsact#1}{@}% actual
+ \@namedef{memglsnx#1}{}% no ref
+ \@namedef{memglsn#1}{\thepage}% num by page
+ \@namedef{memglsnf#1}{|memjustarg}% no special number format
+ \if@filesw \expandafter\newwrite\csname #1memglofile\endcsname
+ \expandafter\immediate\openout \csname #1memglofile\endcsname #1.glo\relax
+ \typeout{Writing glossary file #1.glo }%
+ \fi}
+
+\newcommand*{\makememglossaryhook}{}
+
+ \def\glossary{\@bsphack%
+ \@ifnextchar [{\@glossary}{\@glossary[\jobname]}}%
+\def\@glossary[#1]{%
+ \@ifnextchar ({\@@glossary[#1]}{\@@glossary[#1]()}}
+\def\@@glossary[#1](#2)#3#4{%
+ \@ifundefined{#1memglofile}{%
+ \begingroup
+ \@sanitize
+ \endgroup
+ \@esphack%
+ }{%
+ \def\memglofile{#1}%
+ \begingroup
+ \@sanitize
+ \ifx\@empty#2\@empty
+ \@wrglom@m{#3}{#3}{#4}%
+ \else
+ \@wrglom@m{#2}{#3}{#4}%
+ \fi}}
+
+\newcommand{\@wrglom@m}[3]{%
+ \protected@write\@auxout{}%
+ {\string\@@wrglom@m{\memglofile}{#1}{#2}{#3}{\@nameuse{memglsnx\memglofile}}{\@nameuse{memglsn\memglofile}}}%
+ \endgroup
+ \@esphack}
+
+\newcommand{\@@wrglom@m}[1]{\begingroup
+ \def\memglofile{\@nameuse{#1memglofile}}%
+ \def\m@mgf{#1}%
+ \@sanitize
+ \memwritetoglo}
+
+\newcommand{\memwritetoglo}[5]{\endgroup}
+\newcommand{\@ctualm@mwritetoglo}[5]{%
+ \immediate\write \memglofile{\string\glossaryentry{#1\@nameuse{memglsact\m@mgf}
+ {\string\memgloterm{#2}}{\string\memglodesc{#3}}
+ {\string\memgloref{#4}}\@nameuse{memglsnf\m@mgf}}{#5}}%
+ \endgroup}
+\AtBeginDocument{%
+ \let\memwritetoglo\@ctualm@mwritetoglo}
+
+\newcommand*{\changeglossactual}[2][\jobname]{%
+ \@namedef{memglsact#1}{#2}}
+\newcommand*{\changeglossref}[2][\jobname]{%
+ \@namedef{memglsnx#1}{#2}}
+\newcommand*{\changeglossnum}[2][\jobname]{%
+ \@namedef{memglsn#1}{#2}}
+\newcommand*{\changeglossnumformat}[2][\jobname]{%
+ \@namedef{memglsnf#1}{#2}}
+
+\newcommand{\glossitem}[4]{#1 #2 #3 #4\par}
+
+\newcommand*{\memgloterm}[1]{#1}
+\newcommand*{\memglodesc}[1]{#1}
+\newcommand*{\memgloref}[1]{#1}
+\newcommand*{\memglonum}[1]{#1}
+
+\newcommand*{\printglossary}[1][\jobname]{\@input@{#1.gls}}
+
+\def\@addmarginpar{%
+ \checkoddpage
+ \@next\@marbox\@currlist{\@cons\@freelist\@marbox
+ \@cons\@freelist\@currbox}\@latexbug\@tempcnta\@ne
+ \if@twocolumn
+ \if@firstcolumn \@tempcnta\m@ne \fi
+ \else
+ \if@mparswitch
+ \ifoddpage \else \@tempcnta\m@ne \fi
+ \fi
+ \if@reversemargin \@tempcnta -\@tempcnta \fi
+ \fi
+ \ifnum\@tempcnta <\z@ \global\setbox\@marbox\box\@currbox \fi
+ \@tempdima\@mparbottom
+ \advance\@tempdima -\@pageht
+ \advance\@tempdima\ht\@marbox
+ \ifdim\@tempdima >\z@
+ \@latex@warning@no@line {Marginpar on page
+ \thepage\space moved by \the\@tempdima}%
+ \else
+ \@tempdima\z@
+ \fi
+ \global\@mparbottom\@pageht
+ \global\advance\@mparbottom\@tempdima
+ \global\advance\@mparbottom\dp\@marbox
+ \global\advance\@mparbottom\marginparpush
+ \advance\@tempdima -\ht\@marbox
+ \global\setbox \@marbox
+ \vbox {\vskip \@tempdima
+ \box \@marbox}%
+ \global \ht\@marbox \z@
+ \global \dp\@marbox \z@
+ \kern -\@pagedp
+ \nointerlineskip
+ \hb@xt@\columnwidth
+ {\ifnum \@tempcnta >\z@
+ \hskip\columnwidth \hskip\marginparsep
+ \else
+ \hskip -\marginparsep \hskip -\marginparwidth
+ \fi
+ \box\@marbox \hss}%
+ \nointerlineskip
+ \hbox{\vrule \@height\z@ \@width\z@ \@depth\@pagedp}%
+}
+
+\newcommand{\parnopar}{\parfillskip=0pt\par\parskip=0pt\noindent
+ \parfillskip\@flushglue}
+
+\newif\ifreversesidepar
+ \reversesidepartrue
+\newif\ifsideparswitch
+ \sideparswitchfalse
+\if@twoside \sideparswitchtrue \fi
+
+\newlength{\sideparvshift}
+%%%% \setlength{\sideparvshift}{-2.08ex}% seems to work for all font sizes
+
+\newcommand{\sidepar}{\@dblarg{\@sidepar}}
+\long\def\@sidepar[#1]#2{\@bsphack\strut\vadjust{%
+ \checkoddpage
+ \ifsideparswitch
+ \ifreversesidepar
+ \ifoddpage
+ \oddpagefalse
+ \else
+ \oddpagetrue
+ \fi
+ \fi
+ \else
+ \oddpagetrue
+ \ifreversesidepar
+ \oddpagefalse
+ \fi
+ \fi
+ \rlap{\kern-\parindent
+ \if@twocolumn
+ \if@firstcolumn% put at left
+ \kern -\marginparsep \kern -\marginparwidth
+ \else% put at right
+ \kern \columnwidth \kern \marginparsep
+ \fi
+ \else
+ \ifoddpage% put at right
+ \kern \textwidth \kern \marginparsep
+ \else% put at left
+ \kern -\marginparsep \kern -\marginparwidth
+ \fi
+ \fi
+ \setbox0=\vtop to 0pt{%
+ \begin{minipage}[t]{\marginparwidth}%
+ \normalfont\normalsize
+ \ifoddpage #2\else #1\fi%
+ \end{minipage}%
+ \vss}%
+ \vtop to 0pt{\kern\sideparvshift% default should be 0pt
+ \kern-\dp\strutbox
+ \kern-\ht0
+ \box0 \vss}}}%
+ \@esphack}
+\setlength{\sideparvshift}{0pt}
+
+\newinsert\sideins
+ \skip\sideins=0pt
+ \count\sideins=0
+
+\newlength{\sidebartopsep}
+ \setlength{\sidebartopsep}{0pt}
+\newcommand{\setsidebarheight}[1]{%
+ \setlength{\dimen\sideins}{#1}%
+ \advance\dimen\sideins-\topskip
+ \advance\dimen\sideins\ht\strutbox}
+
+\newlength{\sidebarhsep}
+\newlength{\sidebarvsep}
+\newlength{\sidebarwidth}
+\newcommand{\sidebarfont}{}
+\newcommand*{\setsidebars}[6]{%
+ \nametest{#1}{*}\ifsamename\else
+ \setlength{\sidebarhsep}{#1}\@memznegtest{\sidebarhsep}%
+ \fi
+ \nametest{#2}{*}\ifsamename\else
+ \setlength{\sidebarwidth}{#2}\@memznegtest{\sidebarwidth}%
+ \fi
+ \nametest{#3}{*}\ifsamename\else
+ \setlength{\sidebarvsep}{#3}\@memnegtest{\sidebarvsep}%
+ \fi
+ \nametest{#4}{*}\ifsamename\else
+ \setlength{\sidebartopsep}{#4}%
+ \fi
+ \nametest{#5}{*}\ifsamename\else
+ \def\sidebarfont{#5}%
+ \fi
+ \nametest{#6}{*}\ifsamename\else
+ \setsidebarheight{#6}%
+ \ifdim\dimen\sideins>\z@\else
+%%%% \@memerror{\protect\sidebarheight\space is zero or negative}{\@ehd}%
+ \@memwarn{\protect\sidebarheight\space is zero or negative}%
+ \fi
+ \fi}
+\setsidebars{\marginparsep}% sidebarhsep
+ {\marginparwidth}% sidebarwidth
+ {\onelineskip}% sidebarvsep
+ {0pt}% sidebartopsep
+ {\normalsize\normalfont}% sidebarfont
+ {\textheight}% sidebarheight
+
+\newcommand{\sidebarform}{\if@RTL\leftskip\else\rightskip\fi=\z@ \@plus 2em}
+
+\newif\ifsidebaroneside
+ \if@twoside\sidebaronesidefalse\else\sidebaronesidetrue\fi
+
+\newcommand*{\sidebarmargin}[1]{%
+ \def\@tempa{#1}\def\@tempb{left}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{0}%
+ \else
+ \def\@tempb{right}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{1}%
+ \else
+ \def\@tempb{outer}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{2}%
+ \else
+ \def\@tempb{inner}%
+ \ifx\@tempa\@tempb
+ \gdef\m@msidebar@margin{3}%
+ \else
+ \@memwarn{Bad \string\sidebarmargin\space argument}%
+ \gdef\m@msidebar@margin{1}%
+ \fi
+ \fi
+ \fi
+ \fi}
+%%%% default outer
+\gdef\m@msidebar@margin{2}
+\newcommand*{\m@sideb@left}{%
+ \@tempdimc \sidebarwidth
+ \advance\@tempdimc\sidebarhsep
+ \kern-\@tempdimc}
+\newcommand*{\m@sideb@right}{%
+ \@tempdimc \columnwidth% or \hsize
+ \advance\@tempdimc\sidebarhsep
+ \kern\@tempdimc}
+
+\newcommand{\sidecontents}{\hbox to \z@{%
+ \if@twocolumn% %% put outside nearest column
+ \if@firstcolumn% %% move to left
+ \m@sideb@left
+ \else% %% move to right
+ \m@sideb@right
+ \fi
+ \else% %% put into foremargin?
+ \ifsidebaroneside% %% put into right hand margin
+ \m@sideb@right
+ \else% %% pick the margin
+ \ifcase\m@msidebar@margin% 0 to left
+ \m@sideb@left
+ \or% 1 to right
+ \m@sideb@right
+ \or% 2 to outer
+ \ifodd\c@page% %% move to right
+ \m@sideb@right
+ \else% %% move to left
+ \m@sideb@left
+ \fi
+ \or% 3 to inner
+ \ifodd\c@page% %% move to left
+ \m@sideb@left
+ \else% %% move to right
+ \m@sideb@right
+ \fi
+ \fi
+ \fi
+ \fi
+ \vtop to0pt{%
+ \normalsize\normalfont\sidebarfont% select font so we know the strut size
+ \vskip\topskip \vskip-\ht\strutbox
+ \vskip\sidebartopsep% extra vertical shift
+ \unvbox\sideins \vss}%
+ \hss}}
+
+\newcommand{\sidebar}[1]{%
+ \insert\sideins{%
+ \hsize\sidebarwidth
+ \@parboxrestore
+ \sidebarform \normalsize\normalfont\sidebarfont
+ \splittopskip=\ht\strutbox
+ \splitmaxdepth=\dp\strutbox % doesn't do anything useful
+ \allowbreak
+ \prevdepth=\dp\strutbox % supersedes a "top-strut"
+ \vskip-\parskip
+ #1%
+ \ifvmode\else
+ \unskip\@finalstrut\strutbox
+ \fi\par
+ \ifdim\prevdepth>\dp\strutbox \prevdepth=\dp\strutbox \fi
+ \ifdim\prevdepth>99\p@
+ \nobreak
+ \vskip-\prevdepth
+ \allowbreak
+ \vskip\dp\strutbox
+ \fi
+ \vskip\sidebarvsep}}
+
+\renewcommand{\footnoterule}{%
+ \kern-3\p@
+ \hrule width .4\columnwidth
+ \kern 2.6\p@}
+\skip\footins=\bigskipamount
+\@addtoreset{footnote}{chapter}
+\newcommand*{\multfootsep}{\textsuperscript{\normalfont,}}
+\newcommand*{\multiplefootnotemarker}{3sp}
+\newcommand*{\m@mmf@prepare}{%
+ \kern-\multiplefootnotemarker
+ \kern\multiplefootnotemarker\relax}
+\newcommand*{\m@mmf@check}{%
+ \ifdim\lastkern=\multiplefootnotemarker\relax
+ \edef\@x@sf{\the\spacefactor}%
+ \unkern
+ \multfootsep
+ \spacefactor\@x@sf\relax
+ \fi}
+
+\renewcommand{\@footnotetext}[1]{\insert\footins{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font% <- v1.6180 addition
+ \foottextfont
+ \@preamfntext
+ \hsize\columnwidth
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \@finalstrut\strutbox}%
+ \color@endgroup}\m@mmf@prepare}
+\let\m@mold@footnotetext\@footnotetext
+\renewcommand*{\@footnotemark}{%
+ \leavevmode
+ \ifhmode
+ \edef\@x@sf{\the\spacefactor}%
+ \m@mmf@check
+ \nobreak
+ \fi
+ \@makefnmark
+ \m@mmf@prepare
+ \ifhmode\spacefactor\@x@sf\fi
+ \relax}
+
+\newlength{\footmarkwidth}
+\newlength{\footmarksep}
+\newlength{\footparindent}
+\newcommand*{\footmarkstyle}[1]{\def\footscript##1{#1}}
+\newcommand{\makefootmarkhook}{}
+
+\newcommand{\footfootmark}{%
+ \ifdim\footmarkwidth < \z@
+ \llap{\hb@xt@ -\footmarkwidth{%
+ \hss\normalfont\footscript{\@thefnmark}}%
+ \hspace*{-\footmarkwidth}}%
+ \else
+ \ifdim\footmarkwidth = \z@
+ {\normalfont\footscript{\@thefnmark}}%
+ \else
+ \hb@xt@\footmarkwidth{\hss\normalfont\footscript{\@thefnmark}}%
+ \fi
+ \fi}
+
+\newcommand{\makefootmark}[1]{%
+ \leavevmode
+ \parindent \footparindent\noindent
+ \leftskip\footmarksep\relax
+ \advance\leftskip \footmarkwidth \null\nobreak\hskip -\leftskip\relax
+ \makefootmarkhook\relax
+ \footfootmark #1}
+\newcommand{\@makefntext}[1]{\makefootmark #1}
+\footmarkstyle{\textsuperscript{#1}}
+\setlength{\footmarkwidth}{1.8em}
+\setlength{\footmarksep}{-1.8em}
+\setlength{\footparindent}{1em}
+
+\newcommand{\footref}[1]{%
+ \begingroup
+ \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
+ \endgroup
+ \@footnotemark}
+
+\def\verbfootnote{\@ifnextchar[\@xverbfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}%
+ \@footnotemark\@verbfootnotetext}}
+
+\def\@xverbfootnote[#1]{%
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}%
+ \endgroup
+ \@footnotemark\@verbfootnotetext}
+
+\long\def\@verbfootnotetext{%
+ \insert\footins\bgroup
+ \footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
+%%%% \color@begingroup
+ \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
+ \futurelet\next\fo@t
+}
+\def\fo@t{\ifcat\bgroup\noexpand\next \let\next\f@@t
+ \else \let\next\f@t\fi \next}
+\def\f@@t{\bgroup\aftergroup\@foot\let\next}
+\def\f@t#1{%
+ \color@begingroup
+ #1\@foot
+ \color@endgroup}
+\def\@foot{%
+ \strut\egroup
+%%%% \color@endgroup
+ \m@mmf@prepare
+ }
+
+\long\def\@verbmpfootnotetext{%
+ \global\setbox\@mpfootins\vbox{%
+ \reset@font\footnotesize
+ \unvbox\@mpfootins
+ \bgroup
+ \hsize\columnwidth
+ \@parboxrestore
+ \edef\@currentlabel{\csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@makefntext{\rule{\z@}{\footnotesep}\ignorespaces}%
+ }
+ \futurelet\next\fo@t
+}
+
+%%%%%%%%%%%%%% major extension to footnoting
+
+\newcommand*{\setfootnoterule}[4][]{%
+ \def\footnoterule{\kern -#2\relax #1\relax
+ \hrule width #3\relax
+ \kern #2\kern-#4}}
+\setfootnoterule{3pt}{0.4\columnwidth}{\normalrulethickness}
+
+\newcommand{\m@mdoextrafeet}{\extrafeetins}
+\newcommand*{\extrafeetins}{%
+ \setbox\@outputbox \vbox{%
+ \boxmaxdepth \@maxdepth
+ \unvbox\@outputbox
+ \ifvoid\footinsv@r\else\@footstartv@r\@footgroupv@r\fi
+ \extrafeetinshook}}
+\newcommand{\extrafeetinshook}{}
+
+\newcommand{\m@mdodoreinextrafeet}{%
+ \ifvoid\footinsv@r\else\insert\footinsv@r{\unvbox\footinsv@r}\fi
+ \extrafeetreinshook}
+\newcommand{\extrafeetreinshook}{}
+
+\newcommand{\foottextfont}{\footnotesize}
+\newlength{\footinsdim}
+ \setlength{\footinsdim}{8in} % standard for \dimen\footins
+\newcommand{\@preamfntext}{%
+ \interlinepenalty\interfootnotelinepenalty
+ \floatingpenalty \@MM
+ \splittopskip=\footnotesep
+ \splitmaxdepth=\dp\strutbox
+ \@parboxrestore}
+
+\renewcommand{\@mpfootnotetext}[1]{%
+ \global\setbox\@mpfootins\vbox{%
+ \unvbox\@mpfootins
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \foottextfont \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \reset@font% <- v1.6180 addition
+ \@makefntext{%
+ \rule\z@\footnotesep\ignorespaces{\foottextfont #1}%
+ \@finalstrut\strutbox}%
+ \color@endgroup}}
+
+\let\m@mold@mpfootnotetext\@mpfootnotetext
+
+\newcommand{\m@mdoextrafeetmini}{%
+ \extrafeetminihook}
+\newcommand{\extrafeetminihook}{}
+%%%%\renewcommand{\@minipagerestore}{\m@mdoextrafeetmini}
+
+\newcommand{\extrafeetendmini}{%
+ \ifvoid\@mpfootinsv@r\else
+ \vskip\skip\@mpfootins
+ \normalcolor\footnoterule\mp@footgroupv@r
+ \fi
+ \extrafeetendminihook}
+\newcommand{\extrafeetendminihook}{}
+
+\newcommand{\m@mdoextrafeetendmini}{\extrafeetendmini}
+\def\endminipage{%
+ \par
+ \unskip
+ \ifvoid\@mpfootins\else
+ \vskip\skip\@mpfootins
+ \normalcolor
+ \footnoterule
+ \unvbox\@mpfootins
+ \fi
+ \m@mdoextrafeetendmini
+ \@minipagefalse
+ \color@endgroup
+ \egroup
+ \expandafter\@iiiparbox\@mpargs{\unvbox\@tempboxa}}
+
+\newcommand{\plainfootnotes}{%
+ \let\@footnotetext\m@mold@footnotetext
+ \let\@mpfootnotetext\m@mold@mpfootnotetext}
+
+\newcommand{\newfootnoteseries}[1]{%
+ \expandafter\newinsert\csname footins#1\endcsname% -> \footins#1
+ \expandafter\skip\csname footins#1\endcsname \bigskipamount%
+%%% - > \skip\footins#1 % [RS]
+ \newcounter{footnote#1}% -> \c@footnote#1
+ \@nameuse{c@footnote#1} \z@% -> \c@footnote#1=0
+ \global\@namelet{p@footnote#1} \@empty% -> \p@footnote#1
+ \@namedef{thefootnote#1}{\arabic{footnote#1}}% -> \thefootnote#1
+ \@namedef{foottextfont#1}{\foottextfont}% -> \foottextfont#1
+ \m@makefootnote{#1}% -> \footnote#1
+ \m@make@xfootnote{#1}% -> \@xfootnote#1
+ \m@make@footnotetext{#1}% -> \@footnotetext#1
+ \m@makefootnotemark{#1}% -> \footnotemark#1
+ \m@make@xfootnotemark{#1}% -> \@xfootnotemark#1
+ \m@make@footnotemark{#1}% -> \@footnotemark#1
+ \m@makefootnotetext{#1}% -> \footnotetext#1
+ \m@make@xfootnotenext{#1}% -> \@xfootnotenext#1
+ \m@make@mpfn{#1}% -> \@mpfn#1
+ \m@makethempfn{#1}% -> \thempfn#1
+ \m@make@makefnmark{#1}% -> \@makefnmark#1
+ \m@makefootref{#1}% -> \footref#1
+ \m@makefootfootmark{#1}% -> \footfootmark#1
+ \m@makemakefootmark{#1}% -> \makefootmark#1
+ \m@makefootmarkstyle{#1}% -> \footmarkstyle#1
+ \@namedef{@makefntext#1}##1{\@nameuse{makefootmark#1} ##1}%
+ \m@make@footstart{#1}% -> \@footstart#1
+ \m@make@footgroup{#1}% -> \@footgroup#1
+ \expandafter\newinsert\csname @mpfootins#1\endcsname% -> \@mpfootins#1
+ \newcounter{mpfootnote#1}% -> \c@mpfootnote#1
+ \global\@namelet{p@mpfootnote#1}\@empty
+ \@namedef{thempfootnote#1}{\itshape\alph{mpfootnote#1}}%
+ \m@make@mpfootnotetext{#1}% -> \@mpfootnotetext#1
+ \ifartopt\else% [RS]
+ \expandafter\@cons\csname cl@chapter\endcsname {{footnote#1}}%
+ \fi
+ \g@addto@macro{\extrafeetinshook}{%
+ \ifvoid\@nameuse{footins#1}\else
+ \@nameuse{@footstart#1}\@nameuse{@footgroup#1}\fi}
+ \g@addto@macro{\extrafeetreinshook}{%
+ \ifvoid\@nameuse{footins#1}\else
+ \insert\@nameuse{footins#1}{\unvbox\@nameuse{footins#1}}\fi}
+ \g@addto@macro{\extrafeetendminihook}{%
+ \ifvoid\@nameuse{@mpfootins#1}\else
+ \vskip\skip\@mpfootins
+ \normalcolor\footnoterule\@nameuse{mp@footgroup#1}\fi}
+ \g@addto@macro{\extrafeetminihook}{%
+ \@namedef{@mpfn#1}{mpfootnote#1}
+ \@namedef{thempfn#1}{\@nameuse{thempfootnote#1}}
+ \csname c@mpfootnote#1\endcsname\z@
+ \expandafter\let\expandafter\@t@mp \csname @mpfootnotetext#1\endcsname
+ \expandafter\let \csname @footnotetext#1\endcsname \@t@mp}
+ \g@addto@macro{\@mem@extranofeet}{% % [RS]
+ \ifvoid\@nameuse{footins#1}\else\@mem@nofootfalse\fi}
+ \plainfootstyle{#1}%
+}
+
+\newcommand{\m@makefootnote}[1]{
+ \@namedef{footnote#1}{\@ifnextchar[
+ {\@nameuse{@xfootnote#1}}{%\advance \@nameuse{c@\@mpfn#1} by \@ne
+ \stepcounter{\@mpfn#1}%
+ \@name@p@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \@nameuse{@footnotemark#1}\@nameuse{@footnotetext#1}}}}
+
+\newcommand{\m@make@xfootnote}[1]{
+ \@namedef{@xfootnote#1}[##1]{%
+ \begingroup
+ \csname c@\@mpfn#1\endcsname ##1\relax
+ \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \endgroup
+ \@nameuse{@footnotemark#1}\@nameuse{@footnotetext#1}}}
+
+\newcommand{\m@make@footnotetext}[1]{%
+ \@namelongdef{@footnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \hsize\columnwidth
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@makefntext#1}{%
+ \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1}##1}% <- v1.6180339a
+ \@finalstrut\strutbox}%
+ \color@endgroup}%
+ \m@mmf@prepare}}
+
+\newcommand{\m@make@mpfootnotetext}[1]{%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@makefntext#1}{%
+ \rule\z@\footnotesep\ignorespaces{\@nameuse{foottextfont#1}##1}% <- v1.6180339a
+ \@finalstrut\strutbox}%
+ \color@endgroup}%
+ \m@mmf@prepare}}
+
+\newcommand{\m@makefootnotemark}[1]{
+\@namedef{footnotemark#1}{%
+ \@ifnextchar[ {\@nameuse{@xfootnotemark#1}}
+ {%\advance\@nameuse{c@footnote#1} by \@ne%
+ \stepcounter{footnote#1}%
+ \@name@p@xdef{@thefnmark#1}{\@nameuse{thefootnote#1}}%
+ \@nameuse{@footnotemark#1}}}}
+
+\newcommand{\m@make@xfootnotemark}[1]{%
+ \@namedef{@xfootnotemark#1}[##1]{%
+ \begingroup
+ \@nameuse{c@footnote#1} ##1\relax
+ \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thefootnote#1}}%
+ \endgroup
+ \@nameuse{@footnotemark#1}}}
+
+\newcommand{\m@make@footnotemark}[1]{%
+\@namedef{@footnotemark#1}{%
+ \leavevmode
+ \ifhmode
+ \edef\@x@sf{\the\spacefactor}%
+ \m@mmf@check
+ \nobreak
+ \fi
+ \@nameuse{@makefnmark#1}%
+ \m@mmf@prepare
+ \ifhmode\spacefactor\@x@sf\fi
+ \relax}}
+
+\newcommand{\m@makefootmarkstyle}[1]{%
+ \@namedef{footmarkstyle#1}##1{%
+ \@namedef{footscript#1}####1{##1}}}
+
+\newcommand{\m@makefootnotetext}[1]{%
+\@namedef{footnotetext#1}{%
+ \@ifnextchar[ {\@nameuse{@xfootnotenext#1}}%
+ {\@name@p@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \@nameuse{@footnotetext#1}}}}
+
+\newcommand{\m@make@xfootnotenext}[1]{
+\@namedef{@xfootnotenext#1}[##1]{%
+ \begingroup
+ \csname c@\@mpfn#1\endcsname ##1\relax
+ \@name@unresp@xdef{@thefnmark#1}{\@nameuse{thempfn#1}}%
+ \endgroup
+ \@nameuse{@footnotetext#1}}}
+
+\newcommand{\m@make@mpfn}[1]{%
+ \@namedef{@mpfn#1}{\@nameuse{footnote#1}}}
+
+\newcommand{\m@makethempfn}[1]{%
+ \@namedef{thempfn#1}{\@nameuse{thefootnote#1}}}
+
+\newcommand{\m@make@makefnmark}[1]{%
+ \@namedef{@makefnmark#1}{%
+ \hbox{\@textsuperscript{\normalfont\@nameuse{@thefnmark#1}}}}}
+
+\newcommand{\m@makefootref}[1]{%
+ \@namedef{footref#1}##1{%
+ \begingroup
+ \@name@unresp@xdef{@thefnmark#1}{\ref{##1}}%
+ \endgroup
+ \@nameuse{@footnotemark#1}}}
+
+\newcommand{\m@makefootfootmark}[1]{%
+ \@namedef{footfootmark#1}{%
+ \ifdim\footmarkwidth < \z@
+ \llap{\hb@xt@ -\footmarkwidth{%
+ \hss\normalfont\@nameuse{footscript#1}%
+ {\@nameuse{@thefnmark#1}}}%
+ \hspace*{-\footmarkwidth}}%
+ \else
+ \ifdim\footmarkwidth = \z@
+ {\normalfont\@nameuse{footscript#1}{\@nameuse{@thefnmark#1}}}%
+ \else
+ \hb@xt@\footmarkwidth{%
+ \hss\normalfont\@nameuse{footscript#1}%
+ {\@nameuse{@thefnmark#1}}}%
+ \fi
+ \fi}}
+
+\newcommand{\m@makemakefootmark}[1]{%
+ \@namedef{makefootmark#1}##1{%
+ \leavevmode
+ \parindent \footparindent\noindent
+ \leftskip\footmarksep\relax
+ \advance\leftskip \footmarkwidth
+ \null\nobreak\hskip -\leftskip\relax
+ \makefootmarkhook\relax
+ \@nameuse{footfootmark#1}##1}}
+
+\newcommand{\m@make@footgroup}[1]{%
+ \@namedef{@footgroup#1}{\unvbox\@nameuse{footins#1}}}
+
+\newcommand{\m@makemp@footgroup}[1]{%
+ \@namedef{mp@footgroup#1}{\unvbox\@nameuse{@mpfootins#1}}}
+
+\newcommand{\m@make@footstart}[1]{%
+ \@namedef{@footstart#1}{%
+ \vskip\bigskipamount
+ \if@RTL\rightskip\else\leftskip\fi=\z@
+ \if@RTL\leftskip\else\rightskip\fi=\z@
+ \footnoterule}}
+
+\newcommand{\plainfootstyle}[1]{%
+ \m@make@footnotetext{#1}%
+ \m@make@footgroup{#1}%
+ \m@make@footstart{#1}%
+ \m@make@mpfootnotetext{#1}%
+ \m@makemp@footgroup{#1}%
+ \@nameuse{footmarkstyle#1}{\textsuperscript{##1}}
+ \expandafter\dimen\csname footins#1\endcsname=\footinsdim
+ \expandafter\count\csname footins#1\endcsname=1000\relax}
+
+\newinsert\footinsv@r
+ \skip\footinsv@r\bigskipamount
+ \count\footinsv@r=1000 % no magnifcation
+ \dimen\footinsv@r=\footinsdim
+\m@make@footstart{v@r}
+\newcommand{\@footgroupv@r}{}
+
+\newinsert\@mpfootinsv@r
+\newcommand{\mp@footgroupv@r}{}
+
+\newcount\m@m@k \newdimen\m@m@h
+\newcommand*{\m@mrigidbalance}[3]{\setbox0=\box#1 \m@m@k=#2 \m@m@h=#3
+ \@@line{\splittopskip=\m@m@h \vbadness=\@M \hfilneg
+ \valign{##\vfill\cr\m@mdosplits}}}
+\newcommand*{\m@mdosplits}{\ifnum\m@m@k>0 \noalign{\hfil}\m@msplitoff
+ \global\advance\m@m@k-1\cr\m@mdosplits\fi}
+\newcommand*{\m@msplitoff}{\dimen0=\ht0
+ \divide\dimen0 by\m@m@k \advance\dimen0 by\m@m@h
+ \setbox2 \vsplit0 to \dimen0
+ \unvbox2 }
+
+\newcommand{\twocolumnfootnotes}{%
+ \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
+ \let\@footnotetext\@twocolfootnotetext
+ \dimen\footinsv@r=2\footinsdim
+ \count\footinsv@r=500\relax
+ \m@make@twocol@footgroup{v@r}%
+ \let\@footgroupv@r\@twocol@footgroupv@r
+ \let\@mpfootnotetext\@mptwocolfootnotetext
+ \m@make@mptwocol@footgroup{v@r}%
+ \let\mp@footgroupv@r\@mptwocol@footgroupv@r}
+
+\newcommand{\@twocolfootnotetext}[1]{\insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@twocolfootfmt{#1}%
+ \color@endgroup}%
+ \m@mmf@prepare}
+
+\newcommand{\@preamtwofmt}{%
+ \hsize .45\hsize
+ \parindent=\z@
+ \tolerance=5000\relax
+ \raggedright
+ \leavevmode}
+
+\newcommand{\@twocolfootfmt}[1]{%
+ \@preamtwofmt
+ {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
+
+\newcommand{\@mptwocolfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@twocolfootfmt{#1}%
+ \color@endgroup}%
+ \m@mmf@prepare}
+
+\newcommand{\twocolumnfootstyle}[1]{%
+ \m@make@twocolfootnotetext{#1}%
+ \m@make@mptwocolfootnotetext{#1}%
+ \m@make@twocolfootfmt{#1}%
+ \m@make@twocol@footgroup{#1}%
+ \m@make@mptwocol@footgroup{#1}%
+ \m@make@footstart{#1}%
+ \@namelongdef{@footnotetext#1}##1{%
+ \@nameuse{@twocolfootnotetext#1}{##1}}%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \@nameuse{@mptwocolfootnotetext#1}{##1}}%
+ \@namedef{@footgroup#1}{\@nameuse{@twocol@footgroup#1}}%
+ \@namedef{mp@footgroup#1}{\@nameuse{@mptwocol@footgroup#1}}%
+ \expandafter\dimen\csname footins#1\endcsname=2\footinsdim
+ \expandafter\count\csname footins#1\endcsname=500\relax}
+
+\newcommand{\m@make@twocolfootnotetext}[1]{%
+ \@namelongdef{@twocolfootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@twocolfootfmt#1}{##1}%
+ \color@endgroup}%
+ \m@mmf@prepare}}
+
+\newcommand{\m@make@mptwocolfootnotetext}[1]{%
+\@namelongdef{@mptwocolfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@twocolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\newcommand{\m@make@twocolfootfmt}[1]{%
+ \@namedef{@twocolfootfmt#1}##1{%
+ \@preamtwofmt
+ {\@nameuse{footfootmark#1}\strut
+ {\@nameuse{foottextfont#1}##1}\strut\par}\allowbreak}}
+
+\newcommand{\m@make@twocol@footgroup}[1]{%
+ \@namedef{@twocol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{footins#1}}{\tw@}{\splittopskip}}}}
+
+\newcommand{\m@make@mptwocol@footgroup}[1]{%
+\@namedef{@mptwocol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\tw@}{\splittopskip}}}}
+
+\newcommand{\threecolumnfootnotes}{%
+ \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
+ \let\@footnotetext\@threecolfootnotetext
+ \dimen\footinsv@r=3\footinsdim
+ \count\footinsv@r=333\relax
+ \m@make@threecol@footgroup{v@r}%
+ \let\@footgroupv@r\@threecol@footgroupv@r
+ \let\@mpfootnotetext\@mpthreecolfootnotetext
+ \m@make@mpthreecol@footgroup{v@r}%
+ \let\mp@footgroupv@r\@mpthreecol@footgroupv@r}
+
+\newcommand{\@threecolfootnotetext}[1]{\insert\footinsv@r{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@threecolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+\newcommand{\@preamthreefmt}{%
+ \hsize .3\hsize
+ \parindent=\z@
+ \tolerance=5000\relax
+ \raggedright
+ \leavevmode}
+
+\newcommand{\@threecolfootfmt}[1]{%
+ \@preamthreefmt
+ {\footfootmark\strut {\foottextfont #1}\strut\par}\allowbreak}
+
+\newcommand{\@mpthreecolfootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \color@begingroup
+ \@threecolfootfmt{#1}%
+ \color@endgroup}\m@mmf@prepare}
+
+\newcommand{\threecolumnfootstyle}[1]{%
+ \m@make@threecolfootnotetext{#1}%
+ \m@make@mpthreecolfootnotetext{#1}%
+ \m@make@threecolfootfmt{#1}%
+ \m@make@threecol@footgroup{#1}%
+ \m@make@mpthreecol@footgroup{#1}%
+ \m@make@footstart{#1}%
+ \@namelongdef{@footnotetext#1}##1{%
+ \@nameuse{@threecolfootnotetext#1}{##1}}%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \@nameuse{@mpthreecolfootnotetext#1}{##1}}%
+ \@namedef{@footgroup#1}{\@nameuse{@threecol@footgroup#1}}%
+ \@namedef{mp@footgroup#1}{\@nameuse{@mpthreecol@footgroup#1}}%
+ \expandafter\dimen\csname footins#1\endcsname=3\footinsdim
+ \expandafter\count\csname footins#1\endcsname=333\relax}
+
+\newcommand{\m@make@threecolfootnotetext}[1]{%
+\@namelongdef{@threecolfootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{%
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@threecolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\newcommand{\m@make@mpthreecolfootnotetext}[1]{%
+\@namelongdef{@mpthreecolfootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \color@begingroup
+ \@nameuse{@threecolfootfmt#1}{##1}%
+ \color@endgroup}\m@mmf@prepare}}
+
+\newcommand{\m@make@threecolfootfmt}[1]{%
+\@namelongdef{@threecolfootfmt#1}##1{%
+ \@preamthreefmt
+ {\@nameuse{footfootmark#1}\strut
+ {\@nameuse{foottextfont#1}##1}\strut\par}\allowbreak}}
+
+\newcommand{\m@make@threecol@footgroup}[1]{%
+\@namedef{@threecol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{footins#1}}{\thr@@}{\splittopskip}}}}
+
+\newcommand{\m@make@mpthreecol@footgroup}[1]{%
+\@namedef{@mpthreecol@footgroup#1}{{%
+ \@nameuse{foottextfont#1} \splittopskip=\ht\strutbox
+ \m@mrigidbalance{\@nameuse{@mpfootins#1}}{\thr@@}{\splittopskip}}}}
+
+\newcommand{\m@munvxh}[1]{%
+ \setbox0=\vbox{\unvbox#1%
+ \global\setbox1=\lastbox}%
+ \unhbox1
+ \unskip
+ \unskip
+ \unpenalty
+ \hskip\m@mipn@skip}
+
+\newcommand{\m@mungebox}{%
+ \setbox0=\hbox{\m@munvxh0}%
+ \dp0=\z@
+ \ht0=\footfudgefactor\wd0
+ \box0
+ \penalty0}
+
+\newskip\m@mipn@skip
+\newcommand*{\m@minterparanoteglue}[1]{%
+ {\foottextfont\global\m@mipn@skip=#1\relax}}
+\m@minterparanoteglue{1em plus.4em minus.4em}
+
+\newcommand*{\m@mmakehboxofhboxes}{\setbox0=\hbox{}%
+ \loop
+ \unpenalty
+ \setbox2=\lastbox
+ \ifhbox2
+ \setbox0=\hbox{\box2\unhbox0}
+ \repeat}
+
+\newcommand*{\m@mremovehboxes}{\setbox0=\lastbox
+ \ifhbox0{\m@mremovehboxes}\unhbox0 \fi}
+
+\newcommand*{\footfudgefiddle}{64}
+
+\newcommand{\paragraphfootnotes}{%
+ \@namedef{foottextfontv@r}{\foottextfont}% % [RS]
+ \let\@footnotetext\@parafootnotetext
+ \dimen\footinsv@r=\footinsdim
+ \count\footinsv@r=1000\relax
+ \m@make@para@footgroup{v@r}%
+ \let\@footgroupv@r\@para@footgroupv@r
+ \let\@mpfootnotetext\@mpparafootnotetext
+ \m@make@mppara@footgroup{v@r}%
+ \let\mp@footgroupv@r\@mppara@footgroupv@r
+ {\foottextfont
+ \dimen0=\baselineskip
+ \multiply\dimen0 by 1024
+ \divide\dimen0 by \hsize \multiply\dimen0 by \footfudgefiddle
+ \xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
+
+\newcommand{\@parafootnotetext}[1]{\insert\footinsv@r{
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{#1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+
+\newcommand{\@parafootfmt}[1]{%
+ \parindent=\z@
+ \parfillskip=0pt \@plus 1fil
+ {\footfootmark\strut {\foottextfont #1}\penalty-10}}
+
+\newcommand{\@mpparafootnotetext}[1]{%
+ \global\setbox\@mpfootinsv@r\vbox{%
+ \unvbox\@mpfootinsv@r
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\foottextfont
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote\endcsname\@thefnmark}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@parafootfmt{#1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}
+
+\newcommand{\paragraphfootstyle}[1]{%
+ \m@make@parafootnotetext{#1}%
+ \m@make@mpparafootnotetext{#1}%
+ \m@make@parafootfmt{#1}%
+ \m@make@para@footgroup{#1}%
+ \m@make@mppara@footgroup{#1}%
+ \m@make@para@footstart{#1}%
+ \@namelongdef{@footnotetext#1}##1{%
+ \@nameuse{@parafootnotetext#1}{##1}}%
+ \@namelongdef{@mpfootnotetext#1}##1{%
+ \@nameuse{@mpparafootnotetext#1}{##1}}%
+ \@namedef{@footgroup#1}{\@nameuse{@para@footgroup#1}}%
+ \@namedef{mp@footgroup#1}{\@nameuse{@mppara@footgroup#1}}%
+ \@namedef{@footstart#1}{\@nameuse{@para@footstart#1}}%
+ \expandafter\dimen\csname footins#1\endcsname=\footinsdim
+ \expandafter\count\csname footins#1\endcsname=1000\relax
+ {\@nameuse{foottextfont#1}%
+ \dimen0=\baselineskip
+ \multiply\dimen0 by 1024
+ \divide\dimen0 by \hsize \multiply\dimen0 by 64
+ \xdef\footfudgefactor{\expandafter\strip@pt\dimen0 }}}
+
+\newcommand{\m@make@parafootnotetext}[1]{%
+\@namelongdef{@parafootnotetext#1}##1{%
+ \insert\@nameuse{footins#1}{
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \@preamfntext
+ \protected@edef\@currentlabel{%
+ \csname p@footnote#1\endcsname \@nameuse{@thefnmark#1}}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@nameuse{@parafootfmt#1}{##1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}}
+
+\newcommand{\m@make@mpparafootnotetext}[1]{%
+\@namelongdef{@mpparafootnotetext#1}##1{%
+ \global\setbox\@nameuse{@mpfootins#1}\vbox{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \def\baselinestretch{\m@m@singlespace}% <- v1.61803 addition
+ \reset@font\@nameuse{foottextfont#1}%
+ \hsize\columnwidth \@parboxrestore
+ \protected@edef\@currentlabel{%
+ \csname p@mpfootnote#1\endcsname\@nameuse{@thefnmark#1}}%
+ \setbox0=\vbox{\hsize=\maxdimen
+ \color@begingroup
+ \noindent \@nameuse{@parafootfmt#1}{##1}%
+ \color@endgroup}%
+ \m@mungebox}\m@mmf@prepare}}
+
+\newcommand{\m@make@parafootfmt}[1]{%
+\@namelongdef{@parafootfmt#1}##1{%
+ \parindent=\z@
+ \parfillskip=0pt \@plus 1fil
+ {\@nameuse{footfootmark#1}\strut
+ {\@nameuse{foottextfont#1}##1}\penalty-10}}}
+
+\newcommand{\m@make@para@footgroup}[1]{%
+\@namedef{@para@footgroup#1}{%
+ \unvbox\@nameuse{footins#1}
+ \m@mmakehboxofhboxes
+ \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
+ \@nameuse{foottextfont#1}%
+ \noindent\unhbox0\par}}
+
+\newcommand{\m@make@mppara@footgroup}[1]{%
+\@namedef{@mppara@footgroup#1}{%
+ \unvbox\@nameuse{@mpfootins#1}
+ \m@mmakehboxofhboxes
+ \setbox0=\hbox{\unhbox0 \m@mremovehboxes}%
+ \@nameuse{foottextfont#1}%
+ \noindent\unhbox0\par}}
+
+\newcommand{\m@make@para@footstart}[1]{%
+\@namedef{@para@footstart#1}{%
+ \vskip\bigskipamount
+ \if@RTL\rightskip\else\leftskip\fi=\z@
+ \if@RTL\leftskip\else\rightskip\fi=\z@
+ \parindent=\z@
+ \vskip\skip\@nameuse{footins#1}%
+ \footnoterule}}
+
+\newif\if@mem@nofoot
+\newcommand*{\@mem@testifnofoot}{%
+ \@mem@nofoottrue
+ \ifvoid\footins\else\@mem@nofootfalse\fi
+ \ifvoid\footinsv@r\else\@mem@nofootfalse\fi
+ \ifvoid\sideins\else\@mem@nofootfalse\fi
+ \@mem@extranofeet}
+\newcommand*{\@mem@extranofeet}{}
+
+\let\memold@doclearpage\@doclearpage
+\newcommand{\mem@doclearpage}{%
+ \@mem@testifnofoot
+ \if@mem@nofoot
+ \setbox\@tempboxa\vsplit\@cclv to\z@ \unvbox\@tempboxa
+ \setbox\@tempboxa\box\@cclv
+ \xdef\@deferlist{\@toplist\@botlist\@deferlist}%
+ \global\let\@toplist\@empty
+ \global\let\@botlist\@empty
+ \global\@colroom\@colht
+ \ifx \@currlist\@empty
+ \else
+ \@latexerr{Float(s) lost}\@ehb
+ \global\let\@currlist\@empty
+ \fi
+ \@makefcolumn\@deferlist
+ \@whilesw\if@fcolmade \fi{\@opcol\@makefcolumn\@deferlist}%
+ \if@twocolumn
+ \if@firstcolumn
+ \xdef\@dbldeferlist{\@dbltoplist\@dbldeferlist}%
+ \global\let\@dbltoplist\@empty
+ \global\@colht\textheight
+ \begingroup
+ \@dblfloatplacement
+ \@makefcolumn\@dbldeferlist
+ \@whilesw\if@fcolmade \fi{\@outputpage
+ \@makefcolumn\@dbldeferlist}%
+ \endgroup
+ \else
+ \vbox{}\clearpage
+ \fi
+ \fi
+ \else
+ \setbox\@cclv\vbox{\box\@cclv\vfil}%
+ \@makecol\@opcol
+ \clearpage
+ \fi}
+\gdef\@doclearpage{\mem@doclearpage}
+
+\newcommand*{\m@m@makecolfloats}{%
+ \xdef\@freelist{\@freelist\@midlist}%
+ \global\let\@midlist\@empty
+ \@combinefloats}
+\newcommand*{\m@m@makecoltext}{%
+ \ifvbox\@kludgeins
+ \@makespecialcolbox
+ \else
+ \setbox\@outputbox \vbox to\@colht{%
+ \@texttop
+ \dimen@ \dp\@outputbox
+ \unvbox \@outputbox
+ \vskip -\dimen@
+ \@textbottom}%
+ \fi}
+
+\newcommand*{\m@m@makecolintro}{}
+
+\newcommand*{\m@mopfootnote}{\setbox\@outputbox \vbox{%
+ \boxmaxdepth\@maxdepth
+ \@tempdima\dp\@cclv
+ \unvbox\@cclv
+ \vskip-\@tempdima
+ \vskip \skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup}}
+
+\newcommand*{\m@mopfootnotebf}{%
+ \setbox\@outputbox \vbox{%
+ \boxmaxdepth\@maxdepth
+ \unvbox\@outputbox
+ \vskip\skip\footins
+ \color@begingroup
+ \normalcolor
+ \footnoterule
+ \unvbox \footins
+ \color@endgroup}}
+
+\newcommand*{\m@mopsidebar}{%
+ \ifvoid\sideins\else
+ \setbox\@outputbox \vbox{%
+ \sidecontents
+ \unvbox\@outputbox}
+ \fi}
+
+\gdef\mem@makecol{%
+ \m@m@makecolintro
+ \ifvoid\footins
+ \setbox\@outputbox \box\@cclv
+ \else
+ \m@mopfootnote
+ \fi
+ \m@mdoextrafeet
+ \m@m@makecolfloats
+ \m@mopsidebar
+ \m@m@makecoltext
+ \global \maxdepth \@maxdepth}
+
+\gdef\mem@makecolbf{%
+ \m@m@makecolintro
+ \setbox\@outputbox \box\@cclv
+ \m@m@makecolfloats
+ \ifvoid\footins\else
+ \m@mopfootnotebf
+ \fi
+ \m@mdoextrafeet
+ \m@mopsidebar
+ \m@m@makecoltext
+ \global\maxdepth \@maxdepth}
+
+\gdef\mem@makecoldblf{%
+ \m@m@makecolintro
+ \setbox\@outputbox \box\@cclv
+ \m@m@makecolfloats
+ \m@mopsidebar% <- added
+ \ifvoid\footins
+ \else
+ \m@mopfootnote
+ \fi
+ \m@mdoextrafeet
+ \m@m@makecoltext
+ \global \maxdepth \@maxdepth}
+
+\newcommand{\feetabovefloat}{\gdef\@makecol{\mem@makecol}}
+\newcommand{\feetbelowfloat}{\gdef\@makecol{\mem@makecolbf}}
+\feetabovefloat
+
+\gdef\@reinserts{%
+ \ifvoid\footins\else\insert\footins{\unvbox\footins}\fi
+ \m@mdodoreinextrafeet
+ \ifvbox\@kludgeins\insert\@kludgeins{\unvbox\@kludgeins}\fi
+ \ifvoid\sideins\else\insert\sideins{\unvbox\sideins}\fi}
+
+\newif\ifm@mpnpageopt
+ \m@mpnpageoptfalse
+\newif\ifm@mpncontopt
+ \m@mpncontoptfalse
+\newcounter{pagenote}[chapter]
+\renewcommand{\thepagenote}{\arabic{pagenote}}
+\setcounter{pagenote}{0}
+
+\newcommand*{\notepageref}{\m@mpnpageopttrue}
+\@onlypreamble\notepageref
+\newcommand*{\continuousnotenums}{%
+ \counterwithout{pagenote}{chapter}
+ \renewcommand{\thepagenote}{\arabic{pagenote}}}
+\@onlypreamble\continuousnotenums
+
+\newif\ifmempagenotes
+ \mempagenotesfalse
+
+\newcommand*{\makepagenote}{%
+ \newwrite\@notefile
+ \immediate\openout\@notefile=\jobname.ent
+ \mempagenotestrue
+ \def\pagenote{\@bsphack\begingroup
+ \@sanitize
+ \m@m@wrpnote}%
+ \typeout{Writing note file \jobname.ent}%
+ \let\makepagenote\@empty}
+
+\newcommand{\immediate@protected@write}[3]{%
+ \begingroup
+ #2%
+ \let\protect\@unexpandable@protect
+ \edef\reserved@a{\immediate\write#1{#3}}%
+ \reserved@a
+ \endgroup
+ \if@nobreak\ifvmode\nobreak\fi\fi}
+
+\let\m@m@pnwrite\immediate@protected@write
+\AtBeginDocument{%
+ \ifm@mpnpageopt
+ \let\m@m@pnwrite\protected@write
+ \fi}
+
+\newcommand*{\pnchap}{\f@rtoc}
+\newcommand*{\pnschap}{\f@rbdy}
+
+\newcommand{\m@m@wrpnote}[2][]{%
+ \@ifmtarg{#1}{\refstepcounter{pagenote}%
+ \notenumintext{\thepagenote}}{}%
+ \ifm@mpn@new@chap
+ \global\m@mpn@new@chapfalse
+ \addtonotes{\string\pagenotesubhead{\@chapapp}{\thechapter}{\pnchap}}%
+ \fi
+ \ifm@mpn@new@schap
+ \global\m@mpn@new@schapfalse
+ \addtonotes{\string\pagenotesubhead{\@chapapp}{}{\pnschap}}%
+ \fi
+ \m@m@pnwrite\@notefile{}
+ {\string\noteentry{\thepagenote}{#1}{#2}{\thepage}}%
+ \endgroup
+ \@esphack}
+
+\def\pagenote{\@bsphack\begingroup \@sanitize\m@m@pagenote}
+\newcommand{\m@m@pagenote}[2][]{\endgroup\@esphack}
+
+\newcommand*{\pagetofootnote}{%
+ \let\memsavepagenote\pagenote
+ \renewcommand{\pagenote}[2][]{\footnote{##2}}}
+\newcommand*{\foottopagenote}{%
+ \let\memsavefootnote\footnote
+ \renewcommand*{\footnote}[2][]{\pagenote{##2}}}
+
+\newcommand{\addtonotes}[1]{\ifmempagenotes
+ \IfFileExists{\jobname.ent}{\m@m@pnwrite\@notefile{}{#1}}{\mempnofilewarn}%
+\fi}
+
+\newcommand{\notenumintext}[1]{%
+ \textsuperscript{#1}}
+\newcommand{\notenuminnotes}[1]{%
+ {\normalfont #1.}\space}
+\newcommand{\noteentry}[4]{%
+ \prenoteinnotes
+ \noteidinnotes{#1}{#2}\pageinnotes{#4}\noteinnotes{#3}%
+ \postnoteinnotes}
+
+\newcommand{\idtextinnotes}[1]{%
+ [#1]\space}
+\newcommand{\noteidinnotes}[2]{%
+ \@ifmtarg{#2}{%
+ \notenuminnotes{#1}}{\idtextinnotes{#2}}}
+\newcommand{\pageinnotes}[1]{%
+ \ifm@mpnpageopt \printpageinnotes{#1}\fi}
+\newcommand*{\printpageinnotes}[1]{%
+ (\pagerefname\ #1)\space}
+\newcommand{\noteinnotes}[1]{#1}
+
+\newcommand{\prenoteinnotes}{\par\noindent}
+\newcommand{\postnoteinnotes}{\par}
+
+\providecommand*{\notesname}{Notes}
+\newcommand*{\notedivision}{\chapter{\notesname}}
+
+\newcommand*{\printpagenotes}{\@ifstar{\@sprintpagenotes}{\@printpagenotes}}
+\newcommand*{\mempnofilewarn}{%
+ \ClassWarning{bidimemoir}{There is no .ent file}}
+
+\newcommand*{\@sprintpagenotes}{%
+ \ifmempagenotes
+ \notedivision
+\IfFileExists{\jobname.ent}{%
+ \immediate\closeout\@notefile
+ \input{\jobname.ent}%
+ \immediate\openout\@notefile=\jobname.ent%
+ }{%
+ \mempnofilewarn
+}%
+\fi}
+
+\newcommand*{\@printpagenotes}{%
+ \ifmempagenotes
+ \notedivision
+ \IfFileExists{\jobname.ent}{%
+ \immediate\closeout\@notefile
+ \input{\jobname.ent}%
+ }{%
+ \mempnofilewarn
+ }
+ \fi}
+
+\newcommand*{\pagenotesubhead}[3]{%
+ \section*{#1 #2 #3}}
+
+\newif\ifchangemarks\changemarksfalse
+\newcommand*{\changemarks}{\changemarkstrue}
+\newcommand*{\nochangemarks}{\changemarksfalse}
+
+\newcommand{\v@rid}[2]{%
+ \@bsphack
+ \ifchangemarks
+ \ifdraftdoc
+ \marginpar[#1]{#2}%
+ \fi\fi
+ \@esphack}
+
+\newcommand{\added}[1]{%
+ \@bsphack
+ \ifchangemarks
+ \v@rid{\small$\oplus$ #1}{\small$\oplus$ #1}%
+ \fi
+ \@esphack}
+\newcommand{\deleted}[1]{%
+ \@bsphack
+ \ifchangemarks
+ \v@rid{\small$\neq$ #1}{\small$\neq$ #1}%
+ \fi
+ \@esphack}
+\newcommand{\changed}[1]{%
+ \@bsphack
+ \ifchangemarks
+ \v@rid{\small$\Leftrightarrow$ #1}{\small$\Leftrightarrow$ #1}%
+ \fi
+ \@esphack}
+
+\newcommand*{\showtrimsoff}{\showtrimsfalse}
+\newcommand*{\showtrimson}{\showtrimstrue}
+
+\newcommand*{\trimmark}{%
+ \begin{picture}(0,0)
+ \unitlength 1cm
+ \thinlines
+ \put(-2,0){\line(1,0){4}}
+ \put(0,-2){\line(0,1){4}}
+ \end{picture}}
+
+\newcommand*{\Ltrimpictl}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(-2,0){\line(-1,0){18}}
+ \put(0,2){\line(0,1){18}}
+ \end{picture}}
+\newcommand*{\Ltrimpictr}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(2,0){\line(1,0){18}}
+ \put(0,2){\line(0,1){18}}
+ \end{picture}}
+\newcommand*{\Ltrimpicbl}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(-2,0){\line(-1,0){18}}
+ \put(0,-2){\line(0,-1){18}}
+ \end{picture}}
+\newcommand*{\Ltrimpicbr}{%
+ \begin{picture}(0,0)
+ \unitlength 1mm
+ \thinlines
+ \put(2,0){\line(1,0){18}}
+ \put(0,-2){\line(0,-1){18}}
+ \end{picture}}
+
+\newcommand*{\Ftrimpicbl}{%
+ \begin{picture}(0,0)
+ \unitlength 1pt
+ \thinlines
+ \put(0,0){\framebox(\strip@pt\paperwidth,\strip@pt\paperheight){}}
+ \end{picture}}
+
+\newcommand*{\tmarktl}{\trimmark}
+\newcommand*{\tmarktr}{\trimmark}
+\newcommand*{\tmarkbl}{\trimmark}
+\newcommand*{\tmarkbr}{\trimmark}
+
+\newcommand*{\tmarktm}{}
+\newcommand*{\tmarkml}{}
+\newcommand*{\tmarkmr}{}
+\newcommand*{\tmarkbm}{}
+
+\newcommand*{\trimXmarks}{%
+ \let\tmarktl\trimmark
+ \let\tmarktr\trimmark
+ \let\tmarkbl\trimmark
+ \let\tmarkbr\trimmark}
+\newcommand*{\trimLmarks}{%
+ \let\tmarktl\Ltrimpictl
+ \let\tmarktr\Ltrimpictr
+ \let\tmarkbl\Ltrimpicbl
+ \let\tmarkbr\Ltrimpicbr}
+\newcommand*{\trimFrame}{%
+ \let\tmarktl\null
+ \let\tmarktr\null
+ \let\tmarkbl\Ftrimpicbl
+ \let\tmarkbr\null}
+\newcommand*{\trimNone}{%
+ \let\tmarktl\relax
+ \let\tmarktr\relax
+ \let\tmarkbl\relax
+ \let\tmarkbr\relax
+ \let\tmarktm\relax
+ \let\tmarkml\relax
+ \let\tmarkmr\relax
+ \let\tmarkbm\relax}
+
+\newcommand*{\trimmarks}{%
+ \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+ \hb@xt@\z@{\hskip-1in
+ \ifodd\c@page
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \else
+ \if@twoside
+ \hskip\trimedge % left of logical page
+ \else
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \fi
+ \fi
+ \vbox to \paperheight{%
+ \let\protect\relax % <- v1.4 addition
+ \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+ \hss}%
+ \vss}}
+
+\newcommand*{\registrationColour}[1]{#1}
+\newcommand*{\quarkmarks}{%
+\renewcommand*{\tmarktl}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(0,12){\line(0,1){24}}
+ \put(3,27){\ttfamily\fontsize{8bp}{10bp}\selectfont\jobname\ \
+ \today\ \ \printtime\ \ Page \thepage}
+ \end{picture}}}
+\renewcommand*{\tmarktm}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-24,24){\line(1,0){48}}
+ \put(0,12){\line(0,1){24}}
+ \put(0,24){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarktr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(0,12){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkmr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(24,-24){\line(0,1){48}}
+ \put(24,0){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarkbr}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(12,0){\line(1,0){24}}
+ \put(0,-36){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkbm}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-24,-24){\line(1,0){48}}
+ \put(0,-36){\line(0,1){24}}
+ \put(0,-24){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\tmarkbl}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(0,-36){\line(0,1){24}}
+ \end{picture}}}
+\renewcommand*{\tmarkml}{\registrationColour{%
+ \begin{picture}(0,0)
+ \setlength{\unitlength}{1bp}\thicklines
+ \put(-36,0){\line(1,0){24}}
+ \put(-24,-24){\line(0,1){48}}
+ \put(-24,0){\oval(12,12)}
+ \end{picture}}}
+\renewcommand*{\trimmarks}{%
+%% \special{papersize=\the\stockwidth,\the\stockheight}
+ {%
+ \vbox to \z@{\vskip-1in \vskip\trimtop % top of logical page
+ \hb@xt@\z@{\hskip-1in
+ \ifodd\c@page
+ \hskip\stockwidth \hskip-\trimedge \hskip-\paperwidth
+ \else
+ \if@twoside
+ \hskip\trimedge % left of logical page
+ \else
+ \hskip\stockwidth \hsip-\trimedge \hskip-\paperwidth
+ \fi
+ \fi
+ \vbox to \paperheight{%
+ \let\protect\relax % <- v1.4 addition
+ \hb@xt@\paperwidth{\tmarktl\hfil\tmarktm\hfil\tmarktr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkml\hfil\tmarkmr}%
+ \vfil
+ \hb@xt@\paperwidth{\tmarkbl\hfil\tmarkbm\hfil\tmarkbr}}%
+ \hss}%
+ \vss}}%
+}}
+
+\let\mem@oldshipout\shipout
+\newcommand*{\mem@shipi}{%
+ \ifvoid\@cclv\expandafter\aftergroup\fi\mem@shipii}
+\newcommand*\mem@shipii{%
+ \ifvoid\@cclv
+ \mem@oldshipout\box\@cclv
+ \else
+ \ifshowtrims
+ \mem@oldshipout\vbox{\trimmarks\unvbox\@cclv}%
+ \else
+ \mem@oldshipout\box\@cclv
+ \fi
+ \fi}
+\ifshowtrims
+ \renewcommand*{\shipout}{\afterassignment\mem@shipi\setbox\@cclv=}
+\fi
+
+\newtoks\every@verbatim
+ \every@verbatim={}
+\newtoks\afterevery@verbatim
+ \afterevery@verbatim={}
+
+\def\@makeother#1{\catcode`#112\relax}
+\begingroup
+ \catcode`\ =\active%
+ \def\x{\def\@vobeyspaces{\catcode`\ \active\let \@xobeysp}}
+ \expandafter\endgroup\x
+\def\@xobeysp{\leavevmode\penalty\@M\ }
+\newtoks\verbatim@line
+\newcount\tab@position
+\def\@xobeytab{%
+ \loop
+ \toks@\expandafter{\the\toks@\@xobeysp}%
+ \advance\tab@position-1
+ \ifnum\tab@position>0 \repeat
+}
+\begingroup
+ \catcode`\^^I=\active
+ \gdef\@vobeytabs{\catcode`\^^I\active\let^^I\@xobeytab}%
+\endgroup
+\def\verbatim@tabexpand#1{%
+ \ifx#1\@nil
+ \the\toks@
+ \expandafter\par
+ \else
+ \ifx#1\@xobeytab
+ \@xobeytab
+ \else
+ \toks@\expandafter{\the\toks@#1}%
+ \advance\tab@position\m@ne
+ \fi
+ \ifnum\tab@position=0 \tab@position\tab@size \fi
+ \expandafter\verbatim@tabexpand
+ \fi
+}
+
+\newif\ift@bs
+\newcommand{\tabson}[1][4]{%
+ \ifnum\@ne > #1\relax
+ \tabsoff
+ \else
+ \t@bstrue
+ \def\tab@size{#1\relax}%
+ \def\@maybeobeytabs{\@vobeytabs}%
+ \fi
+}
+\newcommand{\tabsoff}{%
+ \t@bsfalse
+ \def\tab@size{\z@}%
+ \def\@maybeobeytabs{}%
+}
+\tabsoff
+
+\def\tabverbatim@processline{\tab@position\tab@size
+ \toks@{}%
+ \expandafter\verbatim@tabexpand\the\verbatim@line\@nil}
+\def\notabverbatim@processline{\the\verbatim@line\par}
+
+\def\verbatim@startline{\verbatim@line{}}
+\def\verbatim@addtoline#1{%
+ \verbatim@line\expandafter{\the\verbatim@line#1}}
+\def\verbatim@processline{\notabverbatim@processline}
+\def\verbatim@finish{\ifcat$\the\verbatim@line$\else
+ \verbatim@processline\fi}
+\newcommand{\setverbatimfont}[1]{\def\m@mverbfont{#1}}
+\setverbatimfont{\normalfont\ttfamily}
+
+\def\verbatim@font{\m@mverbfont
+ \hyphenchar\font\m@ne
+ \let\do\do@noligs
+ \verbatim@nolig@list}
+
+\def\@verbatim{\the\every@verbatim
+ \trivlist \item \relax
+ \if@minipage\else\vskip\parskip\fi
+ \@beginparpenalty \predisplaypenalty
+ \if@RTL\rightskip\else\leftskip\fi\@totalleftmargin\if@RTL\leftskip\else\rightskip\fi\z@
+ \parindent\z@\parfillskip\@flushglue\parskip\z@
+ \@@par
+ \def\par{%
+ \if@tempswa
+ \leavevmode\null\@@par\penalty\interlinepenalty
+ \else
+ \@tempswatrue
+ \ifhmode\@@par\penalty\interlinepenalty\fi
+ \fi}%
+ \def\@noitemerr{\@warning{No verbatim text}}%
+ \obeylines
+ \let\do\@makeother \dospecials
+ \verbatim@font
+ \everypar \expandafter{\the\everypar \unpenalty}%
+ \wrapright\the\afterevery@verbatim}
+\def\verbatim{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@verbatim \frenchspacing\@vobeyspaces\@maybeobeytabs\verbatim@start}
+\@namedef{verbatim*}{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@verbatim\@maybeobeytabs\verbatim@start}
+\def\endverbatim{\endtrivlist\endgroup\@doendpe}
+\@namelet{endverbatim*}\endverbatim
+
+\newcommand{\setupcomment}{%
+ \let\do\@makeother\dospecials\catcode`\^^M\active
+ \let\verbatim@startline\relax
+ \let\verbatim@addtoline\@gobble
+ \let\verbatim@processline\relax
+ \let\verbatim@finish\relax}
+\newcommand{\newcomment}[1]{%
+ \expandafter\def\csname #1\endcsname{\@bsphack\setupcomment\verbatim@}%
+ \expandafter\let\csname end#1\endcsname=\@esphack}
+\newcommand{\commentsoff}[1]{%
+ \expandafter\def\csname #1\endcsname{}%
+ \expandafter\def\csname end#1\endcsname{}}
+\newcommand{\commentson}[1]{\newcomment{#1}}
+
+\newcomment{comment}
+
+\@ifundefined{vrb@catcodes}%
+ {\def\vrb@catcodes{%
+ \catcode`\!12\catcode`\[12\catcode`\]12}}{}
+\begingroup
+ \vrb@catcodes
+ \lccode`\!=`\\ \lccode`\[=`\{ \lccode`\]=`\}
+ \catcode`\~=\active \lccode`\~=`\^^M
+ \lccode`\C=`\C
+ \lowercase{\endgroup
+ \def\verbatim@start#1{%
+ \verbatim@startline
+ \if\noexpand#1\noexpand~%
+ \let\next\verbatim@
+ \else \def\next{\verbatim@#1}\fi
+ \next}%
+ \def\verbatim@#1~{\verbatim@@#1!end\@nil}%
+ \def\verbatim@@#1!end{%
+ \verbatim@addtoline{#1}%
+ \futurelet\next\verbatim@@@}%
+ \def\verbatim@@@#1\@nil{%
+ \ifx\next\@nil
+ \verbatim@processline
+ \verbatim@startline
+ \let\next\verbatim@
+ \else
+ \def\@tempa##1!end\@nil{##1}%
+ \@temptokena{!end}%
+ \def\next{\expandafter\verbatim@test\@tempa#1\@nil~}%
+ \fi \next}%
+ \def\verbatim@test#1{%
+ \let\next\verbatim@test
+ \if\noexpand#1\noexpand~%
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena}%
+ \verbatim@processline
+ \verbatim@startline
+ \let\next\verbatim@
+ \else \if\noexpand#1
+ \@temptokena\expandafter{\the\@temptokena#1}%
+ \else \if\noexpand#1\noexpand[%
+ \let\@tempc\@empty
+ \let\next\verbatim@testend
+ \else
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena}%
+ \def\next{\verbatim@#1}%
+ \fi\fi\fi
+ \next}%
+ \def\verbatim@testend#1{%
+ \if\noexpand#1\noexpand~%
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena[}%
+ \expandafter\verbatim@addtoline
+ \expandafter{\@tempc}%
+ \verbatim@processline
+ \verbatim@startline
+ \let\next\verbatim@
+ \else\if\noexpand#1\noexpand]%
+ \let\next\verbatim@@testend
+ \else\if\noexpand#1\noexpand!%
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena[}%
+ \expandafter\verbatim@addtoline
+ \expandafter{\@tempc}%
+ \def\next{\verbatim@!}%
+ \else \expandafter\def\expandafter\@tempc\expandafter
+ {\@tempc#1}\fi\fi\fi
+ \next}%
+ \def\verbatim@@testend{%
+ \ifx\@tempc\@currenvir
+ \verbatim@finish
+ \edef\next{\noexpand\end{\@currenvir}%
+ \noexpand\verbatim@rescan{\@currenvir}}%
+ \else
+ \expandafter\verbatim@addtoline
+ \expandafter{\the\@temptokena[}%
+ \expandafter\verbatim@addtoline
+ \expandafter{\@tempc]}%
+ \let\next\verbatim@
+ \fi
+ \next}%
+ \def\verbatim@rescan#1#2~{\if\noexpand~\noexpand#2~\else
+ \@warning{Characters dropped after `\string\end{#1}'}\fi}}
+\newread\verbatim@in@stream
+\def\verbatim@readfile#1{%
+ \verbatim@startline
+ \openin\verbatim@in@stream #1\relax
+ \ifeof\verbatim@in@stream
+ \typeout{No file #1.}%
+ \else
+ \@addtofilelist{#1}%
+ \ProvidesFile{#1}[(verbatim)]%
+ \expandafter\endlinechar\expandafter\m@ne
+ \expandafter\verbatim@read@file
+ \expandafter\endlinechar\the\endlinechar\relax
+ \closein\verbatim@in@stream
+ \fi
+ \verbatim@finish
+}
+\def\verbatim@read@file{%
+ \read\verbatim@in@stream to\next
+ \ifeof\verbatim@in@stream
+ \else
+ \expandafter\verbatim@addtoline\expandafter{\next}%
+ \verbatim@processline
+ \verbatim@startline
+ \expandafter\verbatim@read@file
+ \fi
+}
+\def\verbatiminput{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@ifstar{\verbatim@input{\@maybeobeytabs}}%
+ {\verbatim@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+\def\verbatim@input#1#2{%
+ \IfFileExists {#2}{\@verbatim #1\relax
+ \verbatim@readfile{\@filef@und}\endtrivlist\endgroup\@doendpe}%
+ {\typeout {No file #2.}\endgroup}}
+\newlength{\verbatimindent}
+ \setlength{\verbatimindent}{3em}
+\newcommand*{\verbatimbreakchar}{\char`\%}
+\newcommand*{\setverbatimbreak}{%
+ \vspace*{-\baselineskip}%
+ \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+ {\kern\verbatimindent}{}}%
+}
+
+\newcommand*{\raggedwrap}{%
+ \@rightskip\@flushglue
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \if@RTL\rightskip\else\leftskip\fi\@totalleftmargin
+ \parindent\ragrparindent}
+\newcommand*{\wrappingon}{%
+ \def\@xobeysp{~\discretionary{\verbatimbreakchar}%
+ {\kern\verbatimindent}{}}%
+ \def\wrapright{\raggedwrap}}
+\newcommand*{\wrappingoff}{%
+ \def\@xobeysp{\leavevmode\penalty\@M\ }%
+ \def\wrapright{}}
+\wrappingoff
+
+\newwrite \verbatim@out
+\def\verbatimoutput#1{%
+ \@bsphack
+ \immediate\openout \verbatim@out #1
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active %% \catcode`\^^I=12
+ \def\verbatim@processline{%
+ \immediate\write\verbatim@out
+ {\the\verbatim@line}}%
+ \verbatim@start}
+\def\endverbatimoutput{%
+ \immediate\closeout\verbatim@out
+ \@esphack}
+\def\fboxverbatim{\begingroup%
+ \tabsoff %% PW otherwise box fills the width
+ \def\verbatim@processline{%
+ {\setbox0=\hbox{\the\verbatim@line}%
+ \hsize=\wd0 \the\verbatim@line\par}}%
+ \@minipagetrue%%%DPC%%%
+ \@tempswatrue%%%DPC%%%
+ \setbox0=\vbox\bgroup \verbatim
+}
+\def\endfboxverbatim{%
+ \endverbatim
+ \unskip\setbox0=\lastbox %%%DPC%%%
+ \egroup
+ \fbox{\box0}% <<<=== change here for centering,...
+\endgroup}
+\def\MakeShortVerb#1{%
+ \expandafter\ifx\csname cc\string#1\endcsname\relax
+ \@shortvrbinfo{Made }{#1}%
+ \add@special{#1}%
+ \expandafter
+ \xdef\csname cc\string#1\endcsname{\the\catcode`#1}%
+ \begingroup
+ \catcode`\~\active \lccode`\~`#1%
+ \lowercase{%
+ \global\expandafter\let
+ \csname ac\string#1\endcsname~%
+ \gdef~{\verb~}}%
+ \endgroup
+ \global\catcode`#1\active
+ \else
+ \@shortvrbinfo\@empty{#1 already}%
+ \fi}
+\def\DeleteShortVerb#1{%
+ \expandafter\ifx\csname cc\string#1\endcsname\relax
+ \else
+ \@shortvrbinfo{Deleted }{#1 as}%
+ \rem@special{#1}%
+ \global\catcode`#1\csname cc\string#1\endcsname
+ \global \expandafter\let \csname cc\string#1\endcsname \relax
+ \ifnum\catcode`#1=\active
+ \begingroup
+ \catcode`\~\active \lccode`\~`#1%
+ \lowercase{%
+ \global\expandafter\let\expandafter~%
+ \csname ac\string#1\endcsname}%
+ \endgroup \fi \fi}
+\def\@shortvrbinfo#1#2{%
+ \ClassInfo{bidimemoir}{%
+ #1\expandafter\@gobble\string#2 a short reference
+ for \string\verb}}
+\def\add@special#1{%
+ \rem@special{#1}%
+ \expandafter\gdef\expandafter\dospecials\expandafter
+ {\dospecials \do #1}%
+ \expandafter\gdef\expandafter\@sanitize\expandafter
+ {\@sanitize \@makeother #1}}
+\def\rem@special#1{%
+ \def\do##1{%
+ \ifnum`#1=`##1 \else \noexpand\do\noexpand##1\fi}%
+ \xdef\dospecials{\dospecials}%
+ \begingroup
+ \def\@makeother##1{%
+ \ifnum`#1=`##1 \else \noexpand\@makeother\noexpand##1\fi}%
+ \xdef\@sanitize{\@sanitize}%
+ \endgroup}
+\def\boxverbflag{14 }
+\newlength{\bvboxsep} % user can change this
+\setlength{\bvboxsep}{1em}
+
+\newif\ifbvperpage % start/end lines on every page of multipage verbatim
+\bvperpagetrue
+
+\newcommand{\bvtopofpage}[1]{%
+ \long\def\b@vtop{#1}}
+\def\b@vtop{} % used in \boxverb@split for heading
+
+\newcounter{memfbvline}
+ \c@memfbvline=\z@
+\newcounter{bvlinectr}
+\newcommand*{\setbvlinenums}[2]{%
+ \c@bvlinectr #1\relax \advance\c@bvlinectr \m@ne
+ \ifnum\z@<\linemodnum% we are printing line numbers
+ \@tempcnta #2\relax
+ \divide\@tempcnta\linemodnum
+ \multiply\@tempcnta\linemodnum
+ \c@memfbvline #2\relax
+ \advance\c@memfbvline-\@tempcnta
+ \fi}
+
+\def\theb@vlinenumber{\getthelinenumber{bvlinectr}{memfbvline}}
+\newcommand*{\resetbvlinenumber}{\setcounter{bvlinectr}{0}}
+
+\def\b@vdocount{\ifbvcountlines\stepcounter{bvlinectr}\fi}
+\newlength{\bvnumlength}
+%% \settowidth{\bvnumlength}{\vlvnumfont 9999}
+\settowidth{\bvnumlength}{\normalfont 999}
+
+\newif\ifbvcountinside % TRUE if line numbers inside box
+ \bvcountinsidetrue
+\newcommand*{\bvnumbersinside}{\bvcountinsidetrue}
+\newcommand*{\bvnumbersoutside}{\bvcountinsidefalse}
+
+\def\b@vdoinside{%
+ \ifbvcountlines\ifbvcountinside%
+ \makebox[\bvnumlength][r]{%
+ \vlvnumfont \theb@vlinenumber\space}%
+ \fi\fi}
+
+\def\b@vdooutside{%
+ \ifbvcountlines\ifbvcountinside\else%
+ \llap{\makebox[\bvnumlength][r]{%
+ \vlvnumfont \theb@vlinenumber\space}}%
+ \fi\fi}
+
+\newcommand*{\@@m@mline}{\hb@xt@\linewidth}
+
+\newcommand{\setupboxverb@line}{%
+ \par
+ \ifbvperpage
+ \output=\expandafter{\expandafter\boxverb@split \the\output}
+ \fi
+ \def\verbatim@processline{\leavevmode
+ \b@vdocount%
+ \bvleftsidehook\vbox{\advance% \hsize-.8\p@ \@@line % changed to \linewidth
+ \linewidth-.8\p@ \@@line
+ {\b@vdooutside\strut\kern\bvboxsep%
+ \b@vdoinside%
+ \ift@bs
+ \tabverbatim@processline
+ \else
+ \the\verbatim@line
+ \fi
+ \hss}%
+ \kern\bvboxsep}\bvrightsidehook\par}}
+
+\newcommand{\setupbox@verb}{%
+ \if@RTL\rightskip\else\leftskip\fi\z@skip \if@RTL\leftskip\else\rightskip\fi\z@skip
+ \interlinepenalty\boxverbflag
+ \parfillskip\z@ plus\p@ minus\p@
+ \lineskip-\bvboxsep \baselineskip\z@skip
+ \frenchspacing\@vobeyspaces\@maybeobeytabs
+ \boxverb@toprule}
+
+\def\boxedverbatim{\begingroup
+ \let\@@line\@@m@mline% new from mempatch v4.9
+ \setupboxverb@line
+ \@verbatim
+ \setupbox@verb
+ \verbatim@start}
+\def\endboxedverbatim{\bvendrulehook\endtrivlist\endgroup\@doendpe}
+\@namedef{boxedverbatim*}{\let\frenchspacing\@gobble \boxedverbatim}
+\@namelet{endboxedverbatim*}\endboxverbatim
+
+\def\boxverb@toprule{\bvtoprulehook
+ \@@line{\bvleftsidehook \bvtopmidhook \bvrightsidehook}}
+
+\newcommand*{\bvendofpage}[1]{%
+ \def\boxverb@botpage{#1}}
+%%%%\bvendofpage{\hrule\kern-.4pt}
+\bvendofpage{\hrule width\linewidth\kern-.4pt}
+
+\def\boxverb@split{\ifnum\outputpenalty=\boxverbflag
+ \ifdim\dp\@cclv=\z@
+%%%% \setbox\@cclv\vbox{\unvbox\@cclv\hrule\kern-.4pt}%
+ \setbox\@cclv\vbox{\unvbox\@cclv\boxverb@botpage}%
+ \null \kern-.7\topskip \b@vtop \boxverb@toprule
+ \fi
+\fi}
+
+\def\bvtoprulehook{\hrule width\linewidth \nobreak\vskip-.1\p@}
+\def\bvendrulehook{\hrule width\linewidth}
+\def\bvleftsidehook{\vrule}
+\def\bvrightsidehook{\vrule}
+\def\bvtopmidhook{\rule{0\p@}{2\bvboxsep} \hss}
+
+\newcommand{\boxedverbatiminput}{\begingroup
+ \@ifstar{\let\frenchspacing\@gobble
+ \boxedverbatim@input\relax}%
+ {\boxedverbatim@input{\frenchspacing\@vobeyspaces}}}
+
+\def\boxedverbatim@input#1#2{%
+ \setupboxverb@line
+ \IfFileExists{#2}{\@verbatim #1\relax
+ \setupbox@verb
+ \verbatim@readfile{\@filef@und}%
+ \bvendrulehook\endtrivlist\endgroup\@doendpe}%
+ {\typeout {No file #2.}\endgroup}}
+
+\newcommand{\bvbox}{%
+ \bvperpagetrue%
+ \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}%
+ \renewcommand{\bvleftsidehook}{\vrule}%
+ \renewcommand{\bvrightsidehook}{\vrule}%
+ \renewcommand{\bvendrulehook}{\hrule}}
+
+\newcommand{\nobvbox}{%
+ \bvperpagefalse%
+ \renewcommand{\bvtoprulehook}{}%
+ \renewcommand{\bvleftsidehook}{}%
+ \renewcommand{\bvrightsidehook}{}%
+ \renewcommand{\bvendrulehook}{}}
+
+\newcommand{\bvtopandtail}{%
+ \bvperpagefalse%
+ \renewcommand{\bvtoprulehook}{\hrule \nobreak \vskip-.1\p@}%
+ \renewcommand{\bvleftsidehook}{}%
+ \renewcommand{\bvrightsidehook}{}%
+ \renewcommand{\bvendrulehook}{\hrule}}
+
+\newcommand{\bvsides}{%
+ \bvperpagefalse%
+ \renewcommand{\bvtoprulehook}{\vskip 3ex}%
+ \renewcommand{\bvleftsidehook}{\vrule}%
+ \renewcommand{\bvrightsidehook}{\vrule}%
+ \renewcommand{\bvendrulehook}{}}
+
+\let\framed\relax \let\endframed\relax
+\let\shaded\relax \let\endshaded\relax
+
+\chardef\FrameRestore=\catcode`\| % for debug
+\catcode`\|=\catcode`\% % (debug: insert space after backslash)
+
+\def\MakeFramed#1{\par
+ \fb@sizeofframe\FrameCommand
+ \let\width\fb@frw \let\height\fb@frh
+ \begingroup
+ \skip@\lastskip
+ \if@nobreak\else
+ \penalty9999 % updates \page parameters
+ \ifdim\pagefilstretch=\z@ \ifdim\pagefillstretch=\z@
+ \edef\@tempa{\the\skip@}%
+ \ifx\@tempa\zero@glue \penalty-30
+ \else \vskip-\skip@ \penalty-30 \vskip\skip@
+ \fi\fi\fi
+ \penalty\z@
+ \advance\skip@ \z@ plus-.5\baselineskip
+ \advance\skip@ \z@ plus-.231\height
+ \advance\skip@ \z@ plus-.231\skip@
+ \advance\skip@ \z@ plus-.231\topsep
+ \vskip-\skip@ \penalty 1800 \vskip\skip@
+ \fi
+ \addvspace{\topsep}%
+ \endgroup
+ \penalty\@M \vskip 2\baselineskip \vskip\height
+ \penalty9999 \vskip -2\baselineskip \vskip-\height
+ \penalty9999 % updates \pagetotal
+|\message{After clearout, \pagetotal=\the\pagetotal,
+| \pagegoal=\the\pagegoal. }%
+ \fb@adjheight
+ \setbox\@tempboxa\vbox\bgroup
+ #1% Modifications to \hsize (can use \width and \height)
+ \textwidth\hsize \columnwidth\hsize}
+
+\def\endMakeFramed{\par
+ \kern\z@
+ \hrule\@width\hsize\@height\z@
+ \penalty-100 % put depth into height
+ \egroup
+ % {\showoutput\showbox\@tempboxa}%
+ \begingroup
+ \fb@put@frame\FrameCommand\FirstFrameCommand
+ \endgroup}
+
+\def\fb@put@frame#1#2{\relax
+ \ifdim\pagegoal=\maxdimen \pagegoal\vsize \fi
+ \ifinner
+ \fb@putboxa#1%
+ \fb@afterframe
+ \else
+ \dimen@\pagegoal \advance\dimen@-\pagetotal % natural space left on page
+ \ifdim\dimen@<2\baselineskip % Too little room on page
+| \message{Page has only \the\dimen@\space room left; eject. }%
+ \eject \fb@adjheight \fb@put@frame#1#2%
+ \else % there's appreciable room left on the page
+ \fb@sizeofframe#1%
+| \message{\string\pagetotal=\the\pagetotal,
+| \string\pagegoal=\the\pagegoal,
+| \string\pagestretch=\the\pagestretch,
+| \string\pageshrink=\the\pageshrink,
+| \string\fb@frh=\fb@frh. \space}
+| \message{Box of size \the\ht\@tempboxa\space + \fb@frh}%
+ \begingroup % temporarily set \dimen@ to be...
+ \advance\dimen@.8\pageshrink % maximum space available on page
+ \advance\dimen@-\fb@frh\relax % space available for frame's contents
+ \expandafter\endgroup
+ \ifdim\dimen@>\ht\@tempboxa % whole box does fit
+| \message{fits in \the\dimen@. }%
+ \fb@putboxa#1%
+ \fb@afterframe
+ \else % box must be split
+| \message{must be split to fit in \the\dimen@. }%
+ \fb@sizeofframe#2%
+ \setbox\@tempboxa\vbox{% simulate frame and flexiblity of the page:
+ \vskip \fb@frh \@plus\pagestretch \@minus.8\pageshrink
+ \kern137sp\kern-137sp\penalty-30
+ \unvbox\@tempboxa}%
+ \edef\fb@resto@set{\boxmaxdepth\the\boxmaxdepth
+ \splittopskip\the\splittopskip}%
+ \boxmaxdepth\z@ \splittopskip\z@
+| \message{Padded box of size \the\ht\@tempboxa\space split
+| to \the\dimen@}%
+ \setbox\tw@\vsplit\@tempboxa to\dimen@
+| \toks99\expandafter{\splitfirstmark}%
+| \toks98\expandafter{\splitbotmark}%
+| \message{Marks are: \the\toks99, \the\toks98. }%
+ \setbox\tw@\vbox{\unvbox\tw@}% natural-sized
+| \message{Natural height of split box is \the\ht\tw@, leaving
+| \the\ht\@tempboxa\space remainder. }%
+ \begingroup
+ \advance\dimen@\topskip
+ \expandafter\endgroup
+ \ifdim\dimen@>\pagegoal
+| \message{Frame is big -- Use up the full column. }%
+ \dimen@ii\pagegoal
+ \advance\dimen@ii -\topskip
+ \advance\dimen@ii \FrameHeightAdjust\relax
+ \else % suspect this is wrong:
+ \advance\dimen@.8\pageshrink
+ \ifdim\ht\tw@>\dimen@
+| \message{Box too tall; rebox it to \the\dimen@. }%
+ \dimen@ii\dimen@
+ \else % use natural size
+ \dimen@ii\ht\tw@
+ \fi
+ \fi
+ \advance\dimen@ii -\fb@frh
+ \setbox\tw@\vbox to\dimen@ii \bgroup
+ \vskip -\fb@frh \@plus-\pagestretch \@minus-.8\pageshrink
+ \unvbox\tw@ \unpenalty\unpenalty
+ \ifdim\lastkern=-137sp % whole box went to next page
+| \message{box split at beginning! }%
+ % need work here???
+ \egroup \fb@resto@set \eject % (\vskip for frame size was discarded)
+ \fb@adjheight
+ \fb@put@frame#1#2% INSERTED ???
+ \else % Got material split off at the head
+ \egroup \fb@resto@set
+ \ifvoid\@tempboxa % it all fit after all
+| \message{box split at end! }%
+ \setbox\@tempboxa\box\tw@
+ \fb@putboxa#1%
+ \fb@afterframe
+ \else % it really did split
+| \message{box split as expected. Its reboxed height
+| is \the\ht\tw@. }%
+ \ifdim\wd\tw@>\z@
+ \wd\tw@\wd\@tempboxa
+ \memfblineboxtwo{#2{\box\tw@}}% ??? \centerline bad idea? \\
+ \else
+| \message{Zero width means likely blank.
+| Don't frame it (guess)}%
+ \box\tw@
+ \fi
+ \hrule \@height\z@ \@width\hsize
+ \eject
+ \fb@adjheight
+ \fb@put@frame\LastFrameCommand\MidFrameCommand
+ \fi\fi\fi\fi\fi}
+
+\newcommand{\memfblineboxtwo}[1]{\centerline{#1}}
+\newcommand{\memfblineboxa}[1]{\centerline{#1}}
+
+\def\fb@putboxa#1{%
+ \ifvoid\@tempboxa
+%%%% PackageWarning{framed}{Boxa is void -- discard it. }%
+ \@memwarn{Boxa is void -- discard it. }%
+ \else
+| \message{Frame and place boxa. }%
+| %{\showoutput\showbox\@tempboxa}%
+%%%%%%% \centerline{#1{\box\@tempboxa}}%
+ \memfblineboxa{#1{\box\@tempboxa}}%
+ \fi}
+
+\def\fb@afterframe{%
+ \nointerlineskip \null %{\showoutput \showlists}
+ \penalty-30 \vskip\topsep \relax}
+
+\newdimen\fb@frw
+\newdimen\fb@frh
+\def\fb@sizeofframe#1{\begingroup
+ \setbox\z@\vbox{\vskip-5in \hbox{\hskip-5in
+ #1{\hbox{\vrule \@height 4.7in \@depth.3in \@width 5in}}}%
+ \vskip\z@skip}%
+| \message{Measuring frame addition for \string#1 in \@currenvir\space
+| gives ht \the\ht\z@\space and wd \the\wd\z@. }%
+ \global\fb@frw\wd\z@ \global\fb@frh\ht\z@
+ \endgroup}
+
+\def\fb@adjheight{%
+ \vbox to\FrameHeightAdjust{}% get proper baseline skip from above.
+ \penalty\@M \nointerlineskip
+ \vskip-\FrameHeightAdjust
+ \penalty\@M} % useful for tops of pages
+
+\edef\zero@glue{\the\z@skip}
+
+\catcode`\|=\FrameRestore
+
+\providecommand\FrameCommand{%
+ \setlength\fboxrule{\FrameRule}\setlength\fboxsep{\FrameSep}%
+ \fbox}
+\@ifundefined{FrameRule}{\newdimen\FrameRule \FrameRule=\fboxrule}{}
+\@ifundefined{FrameSep} {\newdimen\FrameSep \FrameSep =3\fboxsep}{}
+\providecommand\FirstFrameCommand{\FrameCommand}
+\providecommand\MidFrameCommand{\FrameCommand}
+\providecommand\LastFrameCommand{\FrameCommand}
+\providecommand\FrameHeightAdjust{6pt}
+
+\def\FrameRestore{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ % \message{FrameRestore:
+ % \@totalleftmargin=\the \@totalleftmargin,
+ % \rightmargin=\the\rightmargin,
+ % \@listdepth=\the\@listdepth. }%
+ \ifnum \ifdim\@totalleftmargin>\z@ 1\fi
+ \ifdim\rightmargin>\z@ 1\fi
+ \ifnum\@listdepth>0 1\fi 0>\z@
+ % \message{In a list: \linewidth=\the\linewidth,
+ % \@totalleftmargin=\the\@totalleftmargin,
+ % \parshape=\the\parshape, \columnwidth=\the\columnwidth,
+ % \hsize=\the\hsize,
+ % \labelwidth=\the\labelwidth. }%
+%%% \@setminipage % snug fit around the item
+%%% \advance\linewidth-\columnwidth \advance\linewidth\hsize
+%%% \parshape\@ne \@totalleftmargin \linewidth
+ \memfblistfixparams
+ \else % Not in list
+ \linewidth=\hsize
+ %\message{No list, set \string\linewidth=\the\hsize. }%
+ \fi
+ \sloppy}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\newcommand*{\memfblistfixparams}{%
+ \@setminipage % snug fit around the item
+ \advance\linewidth-\columnwidth \advance\linewidth\hsize
+ \parshape\@ne \@totalleftmargin \linewidth}
+
+\newenvironment{framed}% using default \FrameCommand
+ {\MakeFramed {\advance\hsize-\width \FrameRestore}}%
+ {\endMakeFramed}
+
+\newenvironment{shaded}{%
+ \def\FrameCommand{\fboxsep=\FrameSep \colorbox{shadecolor}}%
+ \MakeFramed {\FrameRestore}}%
+ {\endMakeFramed}
+
+\newenvironment{leftbar}{%
+ \def\FrameCommand{\vrule width 3pt \hspace{10pt}}%
+ \MakeFramed {\advance\hsize-\width \FrameRestore}}%
+ {\endMakeFramed}
+
+\newenvironment{snugshade}{%
+ \def\FrameCommand{\colorbox{shadecolor}}%
+ \MakeFramed {\FrameRestore\@setminipage}}%
+ {\par\unskip\endMakeFramed}
+
+\AtBeginPackage{framed}{%
+ \let\framed\relax \let\endframed\relax
+ \let\shaded\relax \let\endshaded\relax
+ \let\leftbar\relax \let\endleftbar\relax
+ \let\snugshade\relax \let\endsnugshade\relax}
+
+\newenvironment{qframe}{%
+ \def\FrameCommand##1{\fboxrule=\FrameRule\fboxsep=\FrameSep
+ \hskip\@totalleftmargin\fbox{##1}% There is no \@totalrightmargin, so...
+ \hskip-\linewidth \hskip-\@totalleftmargin \hskip\columnwidth}%
+ \MakeFramed{\advance\hsize-\width
+ \advance\hsize \FrameSep
+ \@totalleftmargin\z@ \linewidth=\hsize}}%
+ {\endMakeFramed}
+
+\newenvironment{qshade}{%
+ \def\FrameCommand##1{\fboxsep=\FrameSep
+ \hskip\@totalleftmargin
+ \hskip -1\FrameSep
+ \colorbox{shadecolor}{##1}%
+ \hskip-\linewidth \hskip-\@totalleftmargin
+ \hskip -1\FrameSep
+ \hskip\columnwidth}%
+ \MakeFramed{\advance\hsize-\width
+ \advance\hsize 3\FrameSep
+ \@totalleftmargin\z@ \linewidth=\hsize}}%
+ {\endMakeFramed}
+
+\newcommand*{\newoutputstream}[1]{%
+ \@ifundefined{#1outstre@m}%
+ {\expandafter\newwrite\csname #1outstre@m\endcsname
+ \csname newif\expandafter\endcsname
+ \csname ifstre@m#1open\endcsname
+ \global\csname stre@m#1openfalse\endcsname
+ \expandafter\ifx\csname atstreamopen#1\endcsname\relax
+ \global\@namedef{atstreamopen#1}{}%
+ \fi
+ \expandafter\ifx\csname atstreamclose#1\endcsname\relax
+ \global\@namedef{atstreamclose#1}{}%
+ \fi
+ }%
+ {\@memwarn{Output stream #1\space is already defined}}}
+
+\newcommand*{\newinputstream}[1]{%
+ \@ifundefined{#1instre@m}%
+ {\expandafter\newread\csname #1instre@m\endcsname
+ \csname newif\expandafter\endcsname
+ \csname ifstre@m#1open\endcsname
+ \global\csname stre@m#1openfalse\endcsname
+ \expandafter\ifx\csname atstreamopen#1\endcsname\relax
+ \global\@namedef{atstreamopen#1}{}%
+ \fi
+ \expandafter\ifx\csname atstreamclose#1\endcsname\relax
+ \global\@namedef{atstreamclose#1}{}%
+ \fi
+ }%
+ {\@memwarn{Input stream #1\space is already defined}}}
+
+\newcommand{\IfStreamOpen}[3]{%
+ \csname ifstre@m#1open\endcsname#2\else#3\fi}
+\newcommand{\instre@mandopen}[2]{%
+ \@ifundefined{#1instre@m}{%
+ \@memwarn{#1\space is not an input stream}}%
+ {\IfStreamOpen{#1}{#2}{%
+ \@memwarn{Input stream #1\space is not open}}}}
+
+\newcommand{\instre@mandclosed}[2]{%
+ \@ifundefined{#1instre@m}{%
+ \@memwarn{#1\space is not an input stream}}%
+ {\IfStreamOpen{#1}{%
+ \@memwarn{Input stream #1\space is open}}{#2}}}
+
+\newcommand{\outstre@mandopen}[2]{%
+ \@ifundefined{#1outstre@m}{%
+ \@memwarn{#1\space is not an output stream}}%
+ {\IfStreamOpen{#1}{#2}{%
+ \@memwarn{Output stream #1\space is not open}}}}
+
+\newcommand{\outstre@mandclosed}[2]{%
+ \@ifundefined{#1outstre@m}{%
+ \@memwarn{#1\space is not an output stream}}%
+ {\IfStreamOpen{#1}{%
+ \@memwarn{Output stream #1\space is open}}{#2}}}
+
+\newcommand*{\openoutputfile}[2]{%
+ \outstre@mandclosed{#2}{%
+ \global\@namedef{#1@filename}{#1}%
+ \if@filesw
+ \immediate\openout\@nameuse{#2outstre@m}=\@nameuse{#1@filename}%
+ \fi
+ \global\csname stre@m#2opentrue\endcsname%
+ \@nameuse{atstreamopen#2}}}
+
+\newcommand*{\closeoutputstream}[1]{%
+ \outstre@mandopen{#1}{%
+ \@nameuse{atstreamclose#1}%
+ \immediate\closeout\@nameuse{#1outstre@m}%
+ \global\csname stre@m#1openfalse\endcsname}}
+
+\newcommand{\openinputfile}[2]{%
+ \IfFileExists{#1}{% file exists
+ \instre@mandclosed{#2}{%
+ \@addtofilelist{#1}%
+ \global\@namedef{#1@filename}{#1}%
+ \immediate\openin\@nameuse{#2instre@m}=\@nameuse{#1@filename}%
+ \global\csname stre@m#2opentrue\endcsname%
+ \@nameuse{atstreamopen#2}}}%
+ {% file not found
+ \typeout{No file #1.}
+ }}
+
+\newcommand{\closeinputstream}[1]{%
+ \instre@mandopen{#1}{%
+ \@nameuse{atstreamclose#1}%
+ \immediate\closein\@nameuse{#1instre@m}%
+ \global\csname stre@m#1openfalse\endcsname}}
+
+\def\writeverbatim#1{%
+ \@bsphack
+ \let\do\@makeother\dospecials
+ \catcode`\^^M\active
+ \def\verbatim@processline{%
+ \immediate\write\@nameuse{#1outstre@m}{\the\verbatim@line}}%
+ \verbatim@start}
+\def\endwriteverbatim{\@esphack}
+
+\newcommand{\addtostream}[2]{%
+ \@bsphack
+ \outstre@mandopen{#1}{%
+ {\let\protect\string
+ \immediate\write\@nameuse{#1outstre@m}{#2}%
+ }}%
+ \@esphack}
+
+\newif\ifstre@mnoteof
+\newcommand{\checkstre@meof}[1]{%
+ \stre@mnoteoftrue\ifeof\@nameuse{#1instre@m}\stre@mnoteoffalse\fi}
+
+\def\readstream#1{
+ \instre@mandopen{#1}{%
+ \loop \checkstre@meof{#1} \ifstre@mnoteof
+ \read\@nameuse{#1instre@m} to\temptokstre@m
+ \temptokstre@m
+ \repeat
+ }}
+
+\def\readaline#1{
+ \instre@mandopen{#1}{%
+ \ifeof\@nameuse{#1instre@m}
+ \@memwarn{No more to read from stream #1}
+ \else
+ \read\@nameuse{#1instre@m} to\temptokstre@m
+ \temptokstre@m
+ \fi}}
+
+\def\readverbatim{\begingroup
+ \ift@bs
+ \def\verbatim@processline{\tabverbatim@processline}%
+ \fi
+ \@ifstar{\stre@mverb@input{\@maybeobeytabs}}%
+ {\stre@mverb@input{\frenchspacing\@vobeyspaces\@maybeobeytabs}}}
+
+\newcommand{\stre@mverb@input}[2]{%
+ \IfStreamOpen{#2}%
+ {\@verbatim #1\relax
+ \def\@verbinstre@m{\@nameuse{#2instre@m}}
+ \verb@readstre@m\endtrivlist\endgroup\@doendpe}%
+ {\@memwarn{Stream #2\space is not open}\endgroup}}
+
+\newcommand{\verb@readstre@m}{%
+ \verbatim@startline
+ \expandafter\endlinechar\expandafter\m@ne
+ \expandafter\verbatim@read@stre@m
+ \expandafter\endlinechar\the\endlinechar\relax
+ \verbatim@finish}
+
+\newcommand{\verbatim@read@stre@m}{%
+ \read\@verbinstre@m to\next
+ \ifeof\@verbinstre@m
+ \else
+ \expandafter\verbatim@addtoline\expandafter{\next}%
+ \verbatim@processline
+ \verbatim@startline
+ \expandafter\verbatim@read@stre@m
+ \fi}
+
+\newcommand{\readboxedverbatim}{\begingroup
+ \@ifstar{\stre@mbvin\relax}%
+ {\stre@mbvin{\frenchspacing\@vobeyspaces}}}
+
+\newcommand{\stre@mbvin}[2]{%
+ \IfStreamOpen{#2}%
+ {\setupboxverb@line
+ \@verbatim #1\relax
+ \def\@verbinstre@m{\@nameuse{#2instre@m}}%
+ \setupbox@verb
+ \verb@readstre@m\bvendrulehook\endtrivlist\endgroup\@doendpe}%
+ {\@memwarn{Stream #2\space is not open}\endgroup}}
+
+\newcommand{\provideenvironment}{\@star@or@long\m@mprovenv}
+\newcommand{\m@mprovenv}[1]{\@ifundefined{#1}%
+ {\new@environment{#1}}% % create new environment
+ {\@memwarn{Environment `#1' already defined}%
+ \m@mgobbleoptsandtwo}}
+\newcommand{\m@mgobbleoptsandtwo}{%
+ \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}}
+\def\m@mgobbleoptandtwo[#1]{%
+ \@ifnextchar [{\m@mgobbleoptandtwo}{\@gobbletwo}}
+
+\newcommand*{\providecounter}[1]{%
+ \@ifundefined{c@#1}%
+ {\newcounter{#1}}%
+ {\@memwarn{Counter `#1' already defined}%
+ \@ifnextchar[{\m@mgobbleopt}{}}}
+
+\def\m@mgobbleopt[#1]{}
+
+\newcommand*{\providelength}[1]{%
+ \begingroup
+ \escapechar\m@ne\xdef\@gtempa{{\string#1}}%
+ \endgroup
+ \expandafter\@ifundefined\@gtempa
+ {\newlength{#1}}%
+ {\@memwarn{Length #1 already defined}}}
+
+\newcommand*{\newloglike}{\@ifstar{\m@mnewlogs}{\m@mnewlog}}
+\newcommand*{\m@mnewlogs}[2]{%
+ \newcommand*{#1}{\mathop{\operator@font #2}}}
+\newcommand*{\m@mnewlog}[2]{%
+ \newcommand*{#1}{\mathop{\operator@font #2}\nolimits}}
+
+\newcommand*{\provideloglike}{\@ifstar{\m@mprovlogs}{\m@mprovlog}}
+\newcommand*{\m@mprovlogs}[2]{%
+ \providecommand*{#1}{\mathop{\operator@font #2}}}
+\newcommand*{\m@mprovlog}[2]{%
+ \providecommand*{#1}{\mathop{\operator@font #2}\nolimits}}
+
+\providecommand{\@removefromreset}[2]{{%
+ \expandafter\let\csname c@#1\endcsname\@removefromreset
+ \def\@elt##1{%
+ \expandafter\ifx\csname c@##1\endcsname\@removefromreset
+ \else
+ \noexpand\@elt{##1}%
+ \fi}%
+ \expandafter\xdef\csname cl@#2\endcsname{%
+ \csname cl@#2\endcsname}}}
+
+\newcommand{\@ifbothcntrs}[3]{%
+ \@ifundefined{c@#1}{% counter undefined
+ \@memerror{#1 is not a counter}{\@eha}}%
+ {% else counter is defined
+ \@ifundefined{c@#2}{% within undefined
+ \@memerror{#2 is not a counter}{\@eha}}%
+ {% else both counter and within are defined
+ #3}}}
+
+\newcommand{\counterwithin}{\@ifstar{\@csinstar}{\@csin}}
+\newcommand{\@csinstar}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}}}
+\newcommand{\@csin}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@addtoreset{#1}{#2}%
+ \@namedef{the#1}{\@nameuse{the#2}.\arabic{#1}}}}
+
+\newcommand{\counterwithout}{\@ifstar{\@csoutstar}{\@csout}}
+\newcommand{\@csoutstar}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}}}
+\newcommand{\@csout}[2]{%
+ \@ifbothcntrs{#1}{#2}{\@removefromreset{#1}{#2}%
+ \@namedef{the#1}{\arabic{#1}}}}
+
+\newif\ifoddpage
+\newif\ifstrictpagecheck
+ \strictpagecheckfalse
+\newcommand*{\strictpagecheck}{\strictpagechecktrue}
+\newcommand*{\easypagecheck}{\strictpagecheckfalse}
+
+\newcounter{cp@cntr}
+\newcommand{\cplabel}{^_}
+\DeclareRobustCommand{\checkoddpage}{%
+ \oddpagefalse%
+ \ifstrictpagecheck%
+ \stepcounter{cp@cntr}\pmemlabel{\cplabel\thecp@cntr}%
+ \@memcnta=\pmemlabelref{\cplabel\thecp@cntr}\relax
+ \ifodd\@memcnta\oddpagetrue\fi
+ \else
+ \ifodd\c@page\oddpagetrue\fi
+ \fi}
+
+\gdef\thepmemc@@page{\the\c@page}
+
+\long\def\pmemprotected@write#1#2#3{%
+ \begingroup
+ \let\thepmemc@@page\relax
+ #2%
+ \let\protect\@unexpandable@protect
+ \edef\reserved@a{\write#1{#3}}%
+ \reserved@a
+ \endgroup
+ \if@nobreak\ifvmode\nobreak\fi\fi}
+
+\newcommand{\pmemlabel}[1]{\@bsphack
+ \pmemprotected@write\@auxout{}%
+ {\string\newpmemlabel{#1}{\thepmemc@@page}}%
+ \@esphack}
+\newcommand{\newpmemlabel}[2]{{\global\@namedef{m@#1}{#2}}}
+\newcommand{\pmemlabelref}[1]{%
+ \expandafter\ifx\csname m@#1\endcsname\relax
+ 0%
+ \else
+ \csname m@#1\endcsname
+ \fi}
+
+\begingroup
+\catcode`\Q=3
+\long\gdef\@ifmtarg#1{\@xifmtarg#1QQ\@secondoftwo\@firstoftwo\@nil}
+\long\gdef\@xifmtarg#1#2Q#3#4#5\@nil{#4}
+\long\gdef\@ifnotmtarg#1{\@xifmtarg#1QQ\@firstofone\@gobble\@nil}
+\endgroup
+
+\DeclareRobustCommand{\ch@ngetext}{%
+ \setlength{\@colht}{\textheight}\setlength{\@colroom}{\textheight}%
+ \setlength{\vsize}{\textheight}\setlength{\columnwidth}{\textwidth}%
+ \if@twocolumn%
+ \advance\columnwidth-\columnsep \divide\columnwidth\tw@%
+ \@firstcolumntrue%
+ \fi%
+ \setlength{\hsize}{\columnwidth}%
+ \setlength{\linewidth}{\hsize}}
+
+\DeclareRobustCommand{\changetext}[5]{%
+ \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
+ \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
+ \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
+ \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
+ \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
+ \ch@ngetext}
+
+\DeclareRobustCommand{\changepage}[9]{%
+ \@ifmtarg{#1}{}{\addtolength{\textheight}{#1}}%
+ \@ifmtarg{#2}{}{\addtolength{\textwidth}{#2}}%
+ \@ifmtarg{#3}{}{\addtolength{\evensidemargin}{#3}}%
+ \@ifmtarg{#4}{}{\addtolength{\oddsidemargin}{#4}}%
+ \@ifmtarg{#5}{}{\addtolength{\columnsep}{#5}}%
+ \ch@ngetext
+ \@ifmtarg{#6}{}{\addtolength{\topmargin}{#6}}%
+ \@ifmtarg{#7}{}{\addtolength{\headheight}{#7}}%
+ \@ifmtarg{#8}{}{\addtolength{\headsep}{#8}}%
+ \@ifmtarg{#9}{}{\addtolength{\footskip}{#9}}}
+
+\newenvironment{adjustwidth}[2]{%
+ \begin{list}{}{%
+ \topsep\z@%
+ \listparindent\parindent%
+ \parsep\parskip%
+ \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
+ {\setlength{\leftmargin}{#1}}%
+ \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
+ {\setlength{\rightmargin}{#2}}%
+ }
+ \item[]}{\end{list}}
+
+\newenvironment{adjustwidth*}[2]{%
+ \begin{list}{}{%
+ \topsep\z@%
+ \listparindent\parindent%
+ \parsep\parskip%
+ \checkoddpage
+ \ifoddpage % odd numbered page
+ \@ifmtarg{#1}{\setlength{\leftmargin}{\z@}}%
+ {\setlength{\leftmargin}{#1}}%
+ \@ifmtarg{#2}{\setlength{\rightmargin}{\z@}}%
+ {\setlength{\rightmargin}{#2}}%
+ \else % even numbered page
+ \@ifmtarg{#2}{\setlength{\leftmargin}{\z@}}%
+ {\setlength{\leftmargin}{#2}}%
+ \@ifmtarg{#1}{\setlength{\rightmargin}{\z@}}%
+ {\setlength{\rightmargin}{#1}}%
+ \fi
+ }
+ \item[]}{\end{list}}
+
+\newcommand{\calccentering}[1]{
+ #1 = \paperwidth
+ \advance #1 by -\textwidth
+ \divide #1 by \tw@
+ \advance #1 by -\spinemargin}
+
+\newenvironment{vplace}[1][1]{%
+ \par\vspace{\stretch{#1}}%
+}{%
+ \vspace*{\stretch{1}}%
+ \par}
+
+\newcommand{\cleartoevenpage}[1][\@empty]{%
+ \clearpage%
+ \ifodd\c@page\hbox{}#1\clearpage\fi}
+
+\newcommand{\movetoevenpage}[1][\@empty]{%
+ \newpage%
+ \ifodd\c@page\hbox{}#1\newpage\fi}
+
+\newcommand{\cleartooddpage}[1][\@empty]{%
+ \clearpage%
+ \ifodd\c@page\else\hbox{}#1\clearpage\fi}
+
+\newcommand{\movetooddpage}[1][\@empty]{%
+ \newpage%
+ \ifodd\c@page\else\hbox{}#1\newpage\fi}
+
+\newcommand{\needspace}[1]{\begingroup\setlength{\dimen@}{#1}%
+ \vskip\z@\@plus\dimen@\penalty -100\vskip\z@\@plus-\dimen@
+ \vskip\dimen@\penalty 9999\vskip-\dimen@\endgroup}
+
+\newcommand{\Needspace}{\@ifstar{\M@sneedsp@}{\M@needsp@}}
+\newcommand{\M@sneedsp@}[1]{\par \penalty-100\begingroup
+ \setlength{\dimen@}{#1}%
+ \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
+ \ifdim \dimen@>\dimen@ii
+ \break
+ \fi\endgroup}
+\newcommand{\M@needsp@}[1]{\par \penalty-100\begingroup
+ \setlength{\dimen@}{#1}%
+ \dimen@ii\pagegoal \advance\dimen@ii-\pagetotal
+ \ifdim \dimen@>\dimen@ii
+ \ifdim \dimen@ii>\z@
+ \vfil
+ \fi
+ \break
+ \fi\endgroup}
+
+\newcommand*{\midsloppy}{%
+ \tolerance 5000%
+ \hbadness 4000%
+ \emergencystretch 1.5em%
+ \hfuzz .1\p@
+ \vfuzz\hfuzz}
+\newenvironment{midsloppypar}{\par\midsloppy}{\par}
+
+\newcommand{\medspace}{\kern .22222em }
+\DeclareRobustCommand{\:}{%
+ \relax\ifmmode\mskip\medmuskip\else\medspace\fi}
+\DeclareRobustCommand{\!}{%
+ \relax\ifmmode\mskip-\thinmuskip\else\negthinspace\fi}
+
+\DeclareRobustCommand*{\slashfracstyle}[1]{%
+ {\m@th\ensuremath{\mbox{\fontsize\sf@size\z@\selectfont #1}}}}
+\DeclareRobustCommand*{\slashfrac}[2]{\leavevmode
+ \raise.5ex\hbox{\slashfracstyle{#1}}\kern-.13em/%
+ \kern-.15em\lower.25ex\hbox{\slashfracstyle{#2}}}
+
+\DeclareRobustCommand*{\textsubscript}[1]{%
+ \@textsubscript{\selectfont#1}}
+\newcommand*{\@textsubscript}[1]{%
+ {\m@th\ensuremath{_{\mbox{\fontsize\sf@size\z@#1}}}}}
+
+%%%%%%%%%%%%%%%%%%%% number formatting
+
+\newif\iflowernumtoname
+ \lowernumtonamefalse
+\newif\ifpriornum
+\newif\ifminusnumber
+\newif\ifnotnumtonameallcaps
+\newif\ifmakeordinal
+
+\newcommand*{\namenumberand}{ and }
+\newcommand*{\namenumbercomma}{, }
+\newcommand*{\lcminusname}{minus }
+\newcommand*{\ucminusname}{Minus }
+\let\minusname\lcminusname
+\newcommand*{\fnumbersep}{,}
+\newcommand*\tensunitsep{-}
+\newcommand*{\nthstring}{th} % nth
+\newcommand*{\iststring}{st} % 1st
+\newcommand*{\iindstring}{nd} % 2nd
+\newcommand*{\iiirdstring}{rd} % 3rd
+\newcommand*{\tiethstring}{tieth} % tieth
+\newcommand*{\teenstring}{teen} % teen
+\newcommand{\ordscript}[1]{#1}
+
+\chardef\m@mten=10 % shorthand for 10
+
+\newcounter{ism@mctr} % units
+\newcounter{xsm@mctr} % tens
+\newcounter{csm@mctr} % hundreds
+\newcounter{ksm@mctr} % thousands
+\newcounter{xksm@mctr} % ten thousands
+\newcounter{cksm@mctr} % hundred thousands
+\newcounter{msm@mctr} % millions
+\newcounter{xmsm@mctr} % ten millions
+\newcounter{cmsm@mctr} % hundred millions
+\newcounter{bsm@mctr} % billions
+\newcounter{workm@mctr}
+
+\newcommand*{\numdigits}[1]{%
+ \setcounter{ism@mctr}{0}%
+ \setcounter{xsm@mctr}{0}%
+ \setcounter{csm@mctr}{0}%
+ \setcounter{ksm@mctr}{0}%
+ \setcounter{xksm@mctr}{0}%
+ \setcounter{cksm@mctr}{0}%
+ \setcounter{msm@mctr}{0}%
+ \setcounter{xmsm@mctr}{0}%
+ \setcounter{cmsm@mctr}{0}%
+ \setcounter{bsm@mctr}{0}%
+ \setcounter{workm@mctr}{#1}%
+ \minusnumberfalse
+ \ifnum \c@workm@mctr < \z@ % negative
+ \minusnumbertrue
+ \c@workm@mctr = -\c@workm@mctr
+ \fi
+ \ifnum \c@workm@mctr > \m@ne % units
+ \c@ism@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@ism@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % tens
+ \c@xsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@xsm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % hundreds
+ \c@csm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@csm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % thousands
+ \c@ksm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@ksm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % ten thousands
+ \c@xksm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@xksm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % hundred thousands
+ \c@cksm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@cksm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % millions
+ \c@msm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@msm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % ten millions
+ \c@xmsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@xmsm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@ % hundred millions
+ \c@cmsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@cmsm@mctr by -\c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \fi
+ \ifnum \c@workm@mctr > \z@% billions
+ \c@bsm@mctr = \c@workm@mctr
+ \divide \c@workm@mctr by \m@mten
+ \multiply \c@workm@mctr by \m@mten
+ \advance \c@bsm@mctr by -\c@workm@mctr
+ \fi}
+
+\newcommand*{\form@tnumber}[1]{%
+ \numdigits{#1}%
+ \ifminusnumber-\fi
+ \priornumfalse
+ \ifnum \c@bsm@mctr > \z@ % billions
+ \priornumtrue
+ \thebsm@mctr\fnumbersep
+ \fi
+ \ifpriornum % hundred millions
+ \thecmsm@mctr
+ \else
+ \ifnum \c@cmsm@mctr > \z@
+ \priornumtrue
+ \thecmsm@mctr
+ \fi
+ \fi
+ \ifpriornum % ten millions
+ \thexmsm@mctr
+ \else
+ \ifnum \c@xmsm@mctr > \z@
+ \priornumtrue
+ \thexmsm@mctr
+ \fi
+ \fi
+ \ifpriornum % millions
+ \themsm@mctr\fnumbersep
+ \else
+ \ifnum \c@msm@mctr > \z@
+ \priornumtrue
+ \themsm@mctr\fnumbersep
+ \fi
+ \fi
+ \ifpriornum % hundred thousands
+ \thecksm@mctr
+ \else
+ \ifnum \c@cksm@mctr > \z@
+ \priornumtrue
+ \thecksm@mctr
+ \fi
+ \fi
+ \ifpriornum % ten thousands
+ \thexksm@mctr
+ \else
+ \ifnum \c@xksm@mctr > \z@
+ \priornumtrue
+ \thexksm@mctr
+ \fi
+ \fi
+ \ifpriornum % thousands
+ \theksm@mctr\fnumbersep
+ \else
+ \ifnum \c@ksm@mctr > \z@
+ \priornumtrue
+ \theksm@mctr\fnumbersep
+ \fi
+ \fi
+ \ifpriornum % hundreds
+ \thecsm@mctr
+ \else
+ \ifnum \c@csm@mctr > \z@
+ \priornumtrue
+ \thecsm@mctr
+ \fi
+ \fi
+ \ifpriornum % tens
+ \thexsm@mctr
+ \else
+ \ifnum \c@xsm@mctr > \z@
+ \priornumtrue
+ \thexsm@mctr
+ \fi
+ \fi
+ \theism@mctr} % units
+
+\newcommand*{\cardinal}[1]{%
+ \begingroup
+ \let\fnumbersep\relax
+ \form@tnumber{#1}%
+ \endgroup}
+\newcommand*{\fcardinal}[1]{%
+ \begingroup
+ \form@tnumber{#1}%
+ \endgroup}
+
+\newcommand*{\ordinal}[1]{%
+ \begingroup
+ \let\fnumbersep\relax
+ \form@tnumber{#1}%
+ \let\ordstring\nthstring
+ \ifnum \c@xsm@mctr=\@ne\else
+ \ifcase \c@ism@mctr
+ \or \let\ordstring\iststring% 1st
+ \or \let\ordstring\iindstring% 2nd
+ \or \let\ordstring\iiirdstring% 3rd
+ \fi
+ \fi
+ \ordscript{\ordstring}%
+ \endgroup
+}
+\newcommand*{\fordinal}[1]{%
+ \begingroup
+ \form@tnumber{#1}%
+ \let\ordstring\nthstring
+ \ifnum \c@xsm@mctr=\@ne\else
+ \ifcase \c@ism@mctr
+ \or \let\ordstring\iststring% 1st
+ \or \let\ordstring\iindstring% 2nd
+ \or \let\ordstring\iiirdstring% 3rd
+ \fi
+ \fi
+ \ordscript{\ordstring}%
+ \endgroup
+}
+
+\newcommand*\nNameo{\iflowernumtoname z\else Z\fi ero}
+\newcommand*\nNamec{\iflowernumtoname h\else H\fi undred}
+\newcommand*\nNamem{\iflowernumtoname t\else T\fi housand}
+\newcommand*\nNamemm{\iflowernumtoname m\else M\fi illion}
+\newcommand*\nNamemmm{\iflowernumtoname b\else B\fi illion}
+
+\newcommand*\nNamei{\iflowernumtoname o\else O\fi ne}
+\newcommand*\nNameii{\iflowernumtoname t\else T\fi wo}
+\newcommand*\nNameiii{\iflowernumtoname t\else T\fi hree}
+\newcommand*\nNameiv{\iflowernumtoname f\else F\fi our}
+\newcommand*\nNamev{\iflowernumtoname f\else F\fi ive}
+\newcommand*\nNamevi{\iflowernumtoname s\else S\fi ix}
+\newcommand*\nNamevii{\iflowernumtoname s\else S\fi even}
+\newcommand*\nNameviii{\iflowernumtoname e\else E\fi ight}
+\newcommand*\nNameix{\iflowernumtoname n\else N\fi ine}
+\newcommand*\nNamex{\iflowernumtoname t\else T\fi en}
+\newcommand*\nNamexi{\iflowernumtoname e\else E\fi leven}
+\newcommand*\nNamexii{\iflowernumtoname t\else T\fi welve}
+\newcommand*\nNamexiii{\iflowernumtoname t\else T\fi hir\teenstring}
+\newcommand*\nNamexiv{\iflowernumtoname f\else F\fi our\teenstring}
+\newcommand*\nNamexv{\iflowernumtoname f\else F\fi if\teenstring}
+\newcommand*\nNamexvi{\iflowernumtoname s\else S\fi ix\teenstring}
+\newcommand*\nNamexvii{\iflowernumtoname s\else S\fi even\teenstring}
+\newcommand*\nNamexviii{\iflowernumtoname e\else E\fi igh\teenstring}
+\newcommand*\nNamexix{\iflowernumtoname n\else N\fi ine\teenstring}
+\newcommand*\nNamexx{\iflowernumtoname t\else T\fi wenty}
+\newcommand*\nNamexxx{\iflowernumtoname t\else T\fi hirty}
+\newcommand*\nNamexl{\iflowernumtoname f\else F\fi orty}
+\newcommand*\nNamel{\iflowernumtoname f\else F\fi ifty}
+\newcommand*\nNamelx{\iflowernumtoname s\else S\fi ixty}
+\newcommand*\nNamelxx{\iflowernumtoname s\else S\fi eventy}
+\newcommand*\nNamelxxx{\iflowernumtoname e\else E\fi ighty}
+\newcommand*\nNamexc{\iflowernumtoname n\else N\fi inety}
+
+\newcommand*{\unitnumbername}[1]{%
+ \ifcase #1 \nNameo\or
+ \nNamei\or
+ \nNameii\or
+ \nNameiii\or
+ \nNameiv\or
+ \nNamev\or
+ \nNamevi\or
+ \nNamevii\or
+ \nNameviii\or
+ \nNameix\fi}
+
+\newcommand*{\teennumbername}[1]{%
+ \ifcase #1 \nNamex\or
+ \nNamexi\or
+ \nNamexii\or
+ \nNamexiii\or
+ \nNamexiv\or
+ \nNamexv\or
+ \nNamexvi\or
+ \nNamexvii\or
+ \nNamexviii\or
+ \nNamexix\fi}
+
+\newcommand*{\tensnumbername}[2]{%
+ \ifnum #1=\@ne
+ \teennumbername{#2}\ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \else
+ \ifcase #1
+ \or
+ \or \nNamexx
+ \or \nNamexxx
+ \or \nNamexl
+ \or \nNamel
+ \or \nNamelx
+ \or \nNamelxx
+ \or \nNamelxxx
+ \or \nNamexc
+ \fi
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \ifnum #2 > \z@ \tensunitsep\unitnumbername{#2}\fi
+ \fi}
+
+\newcommand*\nthNameo{\nNameo\nthstring}
+\newcommand*\nthNamei{\iflowernumtoname f\else F\fi irst}
+\newcommand*\nthNameii{\iflowernumtoname s\else S\fi econd}
+\newcommand*\nthNameiii{\iflowernumtoname t\else T\fi hird}
+\newcommand*\nthNameiv{\nNameiv\nthstring}
+\newcommand*\nthNamev{\iflowernumtoname f\else F\fi if\nthstring}
+\newcommand*\nthNamevi{\nNamevi\nthstring}
+\newcommand*\nthNamevii{\nNamevii\nthstring}
+\newcommand*\nthNameviii{\iflowernumtoname e\else E\fi igh\nthstring}
+\newcommand*\nthNameix{\iflowernumtoname n\else N\fi in\nthstring}
+\newcommand*\nthNamexii{\iflowernumtoname t\else T\fi welf\nthstring}
+
+\newcommand*{\unitordinalname}[1]{%
+ \ifcase #1 \nthNameo\or
+ \nthNamei\or
+ \nthNameii\or
+ \nthNameiii\or
+ \nthNameiv\or
+ \nthNamev\or
+ \nthNamevi\or
+ \nthNamevii\or
+ \nthNameviii\or
+ \nthNameix\fi}
+
+\newcommand*{\teenordinalname}[1]{%
+ \ifcase #1 \nNamex\nthstring\or
+ \nNamexi\nthstring\or
+ \nthNamexii\or
+ \nNamexiii\nthstring\or
+ \nNamexiv\nthstring\or
+ \nNamexv\nthstring\or
+ \nNamexvi\nthstring\or
+ \nNamexvii\nthstring\or
+ \nNamexviii\nthstring\or
+ \nNamexix\nthstring\fi}
+
+\newcommand*{\tensordinalname}[2]{%
+ \ifnum #1=\@ne
+ \teenordinalname{#2}\ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \else
+ \ifnum #2> \z@
+ \ifcase #1
+ \or
+ \or \nNamexx
+ \or \nNamexxx
+ \or \nNamexl
+ \or \nNamel
+ \or \nNamelx
+ \or \nNamelxx
+ \or \nNamelxxx
+ \or \nNamexc
+ \fi
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \tensunitsep\unitordinalname{#2}
+ \else
+ \ifcase #1
+ \or
+ \or \nthNamexx
+ \or \nthNamexxx
+ \or \nthNamexl
+ \or \nthNamel
+ \or \nthNamelx
+ \or \nthNamelxx
+ \or \nthNamelxxx
+ \or \nthNamexc
+ \fi
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \fi
+ \fi}
+
+\newcommand*\nthNamexx{\iflowernumtoname t\else T\fi wen\tiethstring}
+\newcommand*\nthNamexxx{\iflowernumtoname t\else T\fi hir\tiethstring}
+\newcommand*\nthNamexl{\iflowernumtoname f\else F\fi or\tiethstring}
+\newcommand*\nthNamel{\iflowernumtoname f\else F\fi if\tiethstring}
+\newcommand*\nthNamelx{\iflowernumtoname s\else S\fi ix\tiethstring}
+\newcommand*\nthNamelxx{\iflowernumtoname s\else S\fi even\tiethstring}
+\newcommand*\nthNamelxxx{\iflowernumtoname e\else E\fi igh\tiethstring}
+\newcommand*\nthNamexc{\iflowernumtoname n\else N\fi ine\tiethstring}
+
+\newcommand*{\n@me@number}[1]{%
+\begingroup
+ \numdigits{#1}%
+ \ifminusnumber\minusname\fi
+ \priornumfalse
+%% billions
+ \ifnum \c@bsm@mctr > \z@
+ \unitnumbername{\thebsm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamemmm
+ \priornumtrue
+ \fi
+%% hundred millions
+ \ifnum \c@cmsm@mctr > \z@
+ \ifpriornum\namenumbercomma\fi
+ \unitnumbername{\thecmsm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
+ \priornumtrue
+ \fi
+%% tens/units millions
+ \ifnum \c@xmsm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cmsm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \tensnumbername{\thexmsm@mctr}{\themsm@mctr}%
+ \priornumtrue
+ \else
+ \ifnum \c@msm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cmsm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \unitnumbername{\themsm@mctr}%
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \priornumtrue
+ \fi
+ \fi
+ \ifnum \c@cmsm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamemm
+ \else
+ \ifnum \c@xmsm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamemm
+ \else
+ \ifnum \c@msm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamemm
+ \fi
+ \fi
+ \fi
+%% hundred thousands
+ \ifnum \c@cksm@mctr > \z@
+ \ifpriornum\namenumbercomma\fi
+ \unitnumbername{\thecksm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
+ \priornumtrue
+ \fi
+%% tens/units thousands
+ \ifnum \c@xksm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cksm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \tensnumbername{\thexksm@mctr}{\theksm@mctr}%
+ \priornumtrue
+ \else
+ \ifnum \c@ksm@mctr > \z@
+ \ifpriornum
+ \ifnum\c@cksm@mctr>\z@\namenumberand\else\namenumbercomma\fi
+ \fi
+ \unitnumbername{\theksm@mctr}%
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi
+ \priornumtrue
+ \fi
+ \fi
+ \ifnum \c@cksm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamem
+ \else
+ \ifnum \c@xksm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamem
+ \else
+ \ifnum \c@ksm@mctr > \z@
+ \ifpriornum\space\fi
+ \nNamem
+ \fi
+ \fi
+ \fi
+%% hundreds
+ \ifnum \c@csm@mctr > \z@
+ \ifpriornum\namenumbercomma\fi
+ \unitnumbername{\thecsm@mctr}\space
+ \ifnotnumtonameallcaps\lowernumtonametrue\fi\nNamec
+ \priornumtrue
+ \fi
+%% tens/units
+ \ifmakeordinal
+ \ifnum \c@xsm@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \tensordinalname{\thexsm@mctr}{\theism@mctr}%
+ \else
+ \ifnum \c@ism@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \unitordinalname{\theism@mctr}%
+ \else
+ \ifpriornum\nthstring\else\unitordinalname{\theism@mctr}\fi
+ \fi
+ \fi
+ \else % not ordinal
+ \ifnum \c@xsm@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \tensnumbername{\thexsm@mctr}{\theism@mctr}%
+ \else
+ \ifnum \c@ism@mctr > \z@
+ \ifpriornum\namenumberand\fi
+ \unitnumbername{\theism@mctr}%
+ \else
+ \ifpriornum\else\unitnumbername{\theism@mctr}\fi
+ \fi
+ \fi
+ \fi % end ifmakeordinal
+\endgroup}
+
+\DeclareRobustCommand{\numtoname}[1]{%
+ \makeordinalfalse
+ \notnumtonameallcapstrue%
+ \lowernumtonametrue%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\numtoName}[1]{%
+ \makeordinalfalse
+ \notnumtonameallcapstrue%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\NumToName}[1]{%
+ \makeordinalfalse
+ \notnumtonameallcapsfalse%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\ordinaltoname}[1]{%
+ \makeordinaltrue
+ \notnumtonameallcapstrue%
+ \lowernumtonametrue%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\ordinaltoName}[1]{%
+ \makeordinaltrue
+ \notnumtonameallcapstrue%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\DeclareRobustCommand{\OrdinalToName}[1]{%
+ \makeordinaltrue
+ \notnumtonameallcapsfalse%
+ \lowernumtonamefalse%
+ \n@me@number{#1}}
+
+\long\def \@topnewpage [#1]{%
+ \@nodocument
+ \@next\@currbox\@freelist{}{}%
+ \global \setbox\@currbox
+ \vbox {%
+ \break
+ \prevdepth\z@
+ \begingroup
+ \normalcolor
+ \hsize\textwidth
+ \@parboxrestore
+ \col@number \@ne
+ #1%
+ \vskip -\dbltextfloatsep
+ \endgroup
+ \null % ordinary \baselineskip
+ \vskip -\topskip
+ }%
+ \begingroup %% \showbox\@currbox
+ \splitmaxdepth\maxdepth \splittopskip\topskip
+ \setbox\@tempboxa \vsplit\@currbox to \z@
+ \endgroup %% \showbox\@currbox
+ \ifdim \ht\@currbox>\textheight
+ \ht\@currbox \textheight
+ \fi
+ \global \count\@currbox \tw@
+ \@tempdima -\ht\@currbox
+ \advance \@tempdima -\dbltextfloatsep
+ \global \advance \@colht \@tempdima
+ \ifx \@dbltoplist \@empty
+ \else
+ \@latexerr{Float(s) lost}\@ehb
+ \let \@dbltoplist \@empty
+ \fi
+ \@cons \@dbltoplist \@currbox
+ \global \@dbltopnum \m@ne
+ \ifdim \@colht<2.5\baselineskip
+ \@latex@warning@no@line {Optional argument of \noexpand\twocolumn
+ too tall on page \thepage}%
+ \@emptycol
+ \if@firstcolumn
+ \else
+ \@emptycol
+ \fi
+ \else
+ \global \vsize \@colht
+ \global \@colroom \@colht
+ \@floatplacement
+ \fi}
+
+\newcommand*{\m@mcalchm}{%
+ \count0 = \time \divide \count0 by 60\relax
+ \count2 = \count0\relax% the hour
+ \count4 = \time \multiply\count0 by 60\relax
+ \advance\count4 by -\count0\relax% the minute
+ \ifnum\count4<10 \toks1 = {0}% make a leading zero
+ \else \toks1 = {}%
+ \fi}
+%%% punctuation, am and pm for \printtime
+\newcommand*{\hmpunct}{:}% hours minutes separator
+\newcommand*{\amname}{am}% ante meridiem
+\newcommand*{\pmname}{pm}% post meridiem
+
+\newcommand*{\printtime}{%
+ \@ifstar{\m@msprtime}{\m@mprtime}}
+\newcommand*{\m@mprtime}{\begingroup
+ \m@mcalchm
+ \number\count2\hmpunct\the\toks1 \number\count4
+ \endgroup}
+\newcommand*{\m@msprtime}{\begingroup
+ \m@mcalchm
+ \def\@mpm{\pmname}%
+ \ifnum\count2<1\relax% early in the morning
+ \count2=12\relax
+ \ifnum\count4>0\relax% not midnight
+ \def\@mpm{\amname}%
+ \fi
+ \else
+ \ifnum\time<721\relax% noon or earlier
+ \def\@mpm{\amname}%
+ \else
+ \ifnum\time>779\relax% 1300 hrs or later
+ \advance\count2 by -12\relax
+ \fi
+ \fi
+ \fi
+ \number\count2\hmpunct\the\toks1 \number\count4\ \@mpm
+ \endgroup}
+
+\newcounter{sheetsequence}
+ \setcounter{sheetsequence}{1}
+ \renewcommand{\thesheetsequence}{\@arabic\c@sheetsequence}
+\g@addto@macro{\@outputpage}{\stepcounter{sheetsequence}}
+
+\newcounter{lastsheet}
+ \setcounter{lastsheet}{0}
+\newcounter{lastpage}
+ \setcounter{lastpage}{0}
+
+\newcommand{\dol@stsheet}{%
+ \if@filesw
+ \addtocounter{sheetsequence}{-1}%
+ \immediate\write\@auxout%
+ {\string\memsetcounter{lastsheet}{\the\c@sheetsequence}}%
+ \stepcounter{sheetsequence}%
+ \fi}
+\newcommand{\dol@stpage}{%
+ \if@filesw
+ \addtocounter{page}{-1}%
+ \immediate\write\@auxout%
+ {\string\memsetcounter{lastpage}{\the\c@page}}%
+ \stepcounter{page}%
+ \fi}
+\AtBeginDocument{\AtEndDocument{\clearpage\dol@stsheet\dol@stpage}}
+
+\newif\ifcntrmod
+\newif\ifnotcntrmod
+\newcommand*{\iscntrmod}[2]{
+ \@tempcnta=\@nameuse{c@#1}%
+ \@tempcntb=\@tempcnta
+ \divide\@tempcnta #2\relax
+ \multiply\@tempcnta #2\relax
+ \advance\@tempcntb-\@tempcnta
+ \ifnum\@tempcntb=0\relax
+ \cntrmodtrue
+ \notcntrmodfalse
+ \else
+ \cntrmodfalse
+ \notcntrmodtrue
+ \fi}
+
+\newcommand*{\@memensuresigpages}{%
+ \ifnum\@mempagespersig<\@ne
+ \else
+ \iscntrmod{sheetsequence}{\@mempagespersig}
+ \ifcntrmod
+ \else
+ \clearpage
+ \pagestyle{empty}
+ \mbox{}
+ \loop
+ \iscntrmod{sheetsequence}{\@mempagespersig}
+ \ifnotcntrmod
+ \clearpage
+ \pagestyle{empty}
+ \mbox{}
+ \repeat
+ \fi
+ \fi}
+
+\newcommand*{\leavespergathering}[1]{\@memcnta=#1\relax
+ \ifnum\@memcnta<\tw@
+ \def\@mempagespersig{-1}%
+ \else
+ \multiply\@memcnta \tw@
+ \edef\@mempagespersig{\@memcnta}%
+ \fi}
+\leavespergathering{0}
+
+\AtEndDocument{\@memensuresigpages}
+
+\newcommand*{\abstractname}{Abstract}
+\newcommand*{\contentsname}{Contents}
+\newcommand*{\listfigurename}{List of Figures}
+\newcommand*{\listtablename}{List of Tables}
+\newcommand*{\bookname}{Book}
+\newcommand*{\partname}{Part}
+\newcommand*{\chaptername}{Chapter}
+\newcommand*{\appendixname}{Appendix}
+\newcommand*{\appendixtocname}{Appendices}
+\newcommand*{\appendixpagename}{Appendices}
+\newcommand*{\bibname}{Bibliography}
+\newcommand*{\indexname}{Index}
+\newcommand*{\glossaryname}{Glossary}
+\newcommand*{\figurename}{Figure}
+\newcommand*{\tablename}{Table}
+\newcommand*{\figurerefname}{Figure}
+\newcommand*{\tablerefname}{Table}
+\newcommand*{\pagename}{page}
+\newcommand*{\pagerefname}{page}
+\newcommand*{\bookrefname}{Book~}
+\newcommand*{\partrefname}{Part~}
+\newcommand*{\chapterrefname}{Chapter~}
+\newcommand*{\sectionrefname}{\S}
+\newcommand*{\appendixrefname}{Appendix~}
+
+\newcommand{\today}{\ifcase\month\or
+ January\or February\or March\or April\or May\or June\or
+ July\or August\or September\or October\or November\or December\fi
+ \space\number\day, \number\year}
+\setlength\columnsep{10\p@}
+\setlength\columnseprule{0\p@}
+\pagestyle{headings}
+\pagenumbering{arabic}
+
+\setcounter{part}{0}
+\setcounter{chapter}{0}
+\setcounter{tocdepth}{1}
+\setcounter{secnumdepth}{2}
+\maxsecnumdepth{section}
+
+\linenumberfrequency{0}
+\linenumberfont{\small\rmfamily}
+\settowidth{\bvnumlength}{\vlvnumfont 9999}
+
+\if@twoside
+\else
+ \raggedbottom
+\fi
+\if@twocolumn
+ \twocolumn
+ \sloppy
+ \flushbottom
+\else
+ \onecolumn
+\fi
+
+\newfloat[chapter]{figure}{lof}{\figurename}
+%%% \kill@lastcounter{lofdepth}
+\renewcommand{\thefigure}{\thechapter\@SepMark\@arabic\c@figure}
+
+\newlistof{listoffigures}{lof}{\listfigurename}
+%%% \kill@lastcounter{lofdepth}
+\newlistentry[chapter]{figure}{lof}{0}
+ \cftsetindents{figure}{0em}{2.3em}
+%% \kill@lastcounter{lofdepth}
+
+\newfloat[chapter]{table}{lot}{\tablename}
+%%% \kill@lastcounter{lotdepth}
+\renewcommand{\thetable}{\thechapter\@SepMark\@arabic\c@table}
+
+\newlistof{listoftables}{lot}{\listtablename}
+%%% \kill@lastcounter{lotdepth}
+\newlistentry[chapter]{table}{lot}{0}
+ \cftsetindents{table}{0em}{2.3em}
+%% \kill@lastcounter{lotdepth}
+
+%%%\AtBeginDocument{%
+%%% \@ifundefined{c@lofdepth}%
+%%% {\newcounter{lofdepth}\setcounter{lofdepth}{1}}{}
+%%% \@ifundefined{c@lotdepth}%
+%%% {\newcounter{lotdepth}\setcounter{lotdepth}{1}}{}}
+
+\ifartopt
+ \chapterstyle{article}
+ \counterwithout{figure}{chapter}
+ \counterwithout{table}{chapter}
+ \counterwithout{footnote}{chapter}
+ \counterwithout{equation}{chapter}
+ \renewcommand{\chaptername}{}
+ \renewcommand{\maketitlehookb}{%
+ \vskip -1.5\topsep\vskip -1.5\partopsep}
+ \renewcommand{\maketitlehookc}{%
+ \vskip -1.5\topsep\vskip -1.5\partopsep}
+\fi
+
+\newcommand{\msdoublespacing}{}
+\newcommand{\mssinglespacing}{}
+\ifmsdoc
+ \renewcommand{\msdoublespacing}{%
+ \renewcommand{\baselinestretch}{1.6}\large\normalsize}
+ \renewcommand{\mssinglespacing}{%
+ \renewcommand{\baselinestretch}{1.0}\large\normalsize}
+ \renewcommand{\familydefault}{cmtt}
+ \renewcommand{\rmdefault}{cmtt}
+ \renewcommand{\sfdefault}{cmtt}
+ \renewcommand{\bfdefault}{m}
+ \renewcommand{\itdefault}{n}
+ \renewcommand{\sldefault}{n}
+ \renewcommand{\scdefault}{n}
+ \renewcommand{\baselinestretch}{1.6}
+ \@twocolumnfalse
+ \onecolumn
+ \sloppy
+ \@twosidefalse
+ \raggedbottom
+ \pagestyle{plain}
+\fi
+
+\EmulatedPackage{abstract}[2008/07/23]
+\EmulatedPackage{appendix}[2008/07/23]
+\EmulatedPackage{array}[2008/07/23]
+\EmulatedPackage{booktabs}[2008/07/23]
+\EmulatedPackage{ccaption}[2008/07/23]
+\EmulatedPackage{changepage}[2008/07/23]
+\EmulatedPackage{chngcntr}[2008/07/23]
+\EmulatedPackage{chngpage}[2008/07/23]
+\EmulatedPackage{crop}
+\EmulatedPackage{dcolumn}[2008/07/23]
+\EmulatedPackage{delarray}[2008/07/23]
+\EmulatedPackage{enumerate}[2008/07/23]
+\EmulatedPackage{epigraph}[2008/07/23]
+%%%%%\EmulatedPackage{framed}[2008/07/23]
+\EmulatedPackage{ifmtarg}[2008/07/23]
+\ifm@mifetex\EmulatedPackage{ifetex}[2008/07/23]\fi
+\ifm@mifluatex\EmulatedPackage{ifluatex}[2008/07/23]\fi
+\ifm@mifpdf\EmulatedPackage{ifpdf}[2008/07/23]\fi
+\ifm@mifxetex\EmulatedPackage{ifxetex}[2008/07/23]\fi
+\EmulatedPackage{index}[2008/07/23]
+\EmulatedPackage{makeidx}[2008/07/23]
+\EmulatedPackage{moreverb}[2008/07/23]
+\EmulatedPackage{mparhack}[2008/07/23]
+\EmulatedPackage{needspace}[2008/07/23]
+\EmulatedPackage{newfile}[2008/07/23]
+\EmulatedPackage{nextpage}[2008/07/23]
+\EmulatedPackage{pagenote}[2008/07/23]
+\EmulatedPackage{parskip}[2008/07/23]
+\EmulatedPackage{patchcmd}[2008/07/23]
+\EmulatedPackage{setspace}[2008/07/23]
+\EmulatedPackage{shortvrb}[2008/07/23]
+\EmulatedPackage{showidx}[2008/07/23]
+\EmulatedPackage{tabularx}[2008/07/23]
+\EmulatedPackage{titleref}[2008/07/23]
+\EmulatedPackage{titling}[2008/07/23]
+\EmulatedPackage{tocbibind}[2008/07/23]
+\EmulatedPackage{verbatim}[2008/07/23]
+\EmulatedPackage{verse}[2008/07/23]
+
+%%% revert changes to captioning macros if the caption package is used.
+\AtBeginPackage{caption}{
+\ClassWarningNoLine{bidimemoir}{%
+ You are using the caption package with the bidimemoir \MessageBreak
+ class. This may cause unexpected or inconsistent \MessageBreak
+ results if you use any of bidimemoir's captioning facilities}
+
+\long\def\@makecaption##1##2{%
+ \vskip\abovecaptionskip
+ \sbox\@tempboxa{##1: ##2}%
+ \ifdim \wd\@tempboxa >\hsize
+ \if@RTL\beginR\fi##1: ##2\par
+ \else
+ \global \@minipagefalse
+ \hb@xt@\hsize{\if@RTL\beginR\fi\hfil\box\@tempboxa\hfil\if@RTL\endR\fi}%
+ \fi
+ \vskip\belowcaptionskip}
+
+\def\caption{%
+ \ifx\@captype\@undefined
+ \@latex@error{\noexpand\caption outside float}\@ehd
+ \expandafter\@gobble
+ \else
+ \refstepcounter\@captype
+ \expandafter\@firstofone
+ \fi
+ {\@dblarg{\@caption\@captype}}%
+}
+
+\long\def\@caption##1[##2]##3{%
+ \par
+ \addcontentsline{\csname ext@##1\endcsname}{##1}%
+ {\protect\numberline{\csname the##1\endcsname}{\ignorespaces ##2}}%
+ \begingroup
+ \@parboxrestore
+ \if@minipage
+ \@setminipage
+ \fi
+ \normalsize
+ \@makecaption{\csname fnum@##1\endcsname}{\ignorespaces ##3}\par
+ \endgroup}
+}
+
+\AtBeginPackage{float}{\let\newfloat\relax}
+
+\InputIfFileExists{mempatch.sty}{}{} % should be this
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidimemoir.cls'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidimoderncv.cls b/Master/texmf-dist/tex/xelatex/bidi/bidimoderncv.cls
new file mode 100644
index 00000000000..d751d42dc3b
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidimoderncv.cls
@@ -0,0 +1,275 @@
+%%
+%% This is file `bidimoderncv.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidimoderncv.cls')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{bidimoderncv}
+\newif\if@DEBUG\@DEBUGfalse
+\DeclareOption{a4paper}{
+ \setlength\paperheight{297mm}
+ \setlength\paperwidth{210mm}}
+\DeclareOption{a5paper}{
+ \setlength\paperheight{210mm}
+ \setlength\paperwidth{148mm}}
+\DeclareOption{b5paper}{
+ \setlength\paperheight{250mm}
+ \setlength\paperwidth{176mm}}
+\DeclareOption{letterpaper}{
+ \setlength\paperheight{11in}
+ \setlength\paperwidth{8.5in}}
+\DeclareOption{legalpaper}{
+ \setlength\paperheight{14in}
+ \setlength\paperwidth{8.5in}}
+\DeclareOption{executivepaper}{
+ \setlength\paperheight{10.5in}
+ \setlength\paperwidth{7.25in}}
+\DeclareOption{landscape}{
+ \setlength\@tempdima{\paperheight}
+ \setlength\paperheight{\paperwidth}
+ \setlength\paperwidth{\@tempdima}}
+\newcommand\@ptsize{}
+\DeclareOption{10pt}{\renewcommand\@ptsize{0}}
+\DeclareOption{11pt}{\renewcommand\@ptsize{1}}
+\DeclareOption{12pt}{\renewcommand\@ptsize{2}}
+\DeclareOption{draft}{\setlength\overfullrule{5pt}}
+\DeclareOption{final}{\setlength\overfullrule{0pt}}
+\newif\if@colour\@colourtrue
+\DeclareOption{nocolour}{\@colourfalse}
+\ExecuteOptions{a4paper,11pt,colour,final}
+\ProcessOptions\relax
+\input{size1\@ptsize.clo}
+\RequirePackage{graphicx}
+\RequirePackage{pstricks}
+\RequirePackage{ifthen}
+\RequirePackage{marvosym}
+\addtolength{\oddsidemargin}{-54pt}
+\addtolength{\textwidth}{109pt}
+\addtolength{\topmargin}{-70pt}
+\addtolength{\textheight}{122pt}
+\addtolength{\marginparsep}{-5pt}
+\addtolength{\marginparwidth}{-10pt}
+\RequirePackage{url}
+\RequirePackage{hyperref}
+\hypersetup{%
+ breaklinks,
+ baseurl = http://,%
+ pdfborder = 0 0 0,%
+ pdfpagemode = UseNone,%
+ pdfstartpage = 1}
+\AtEndOfClass{%
+ \AtBeginDocument{%
+ \hypersetup{%
+ pdfauthor = \@firstname~\@familyname,%
+ pdftitle = \@title,%
+ pdfsubject = \@firstname~\@familyname,%
+ pdfkeywords = \@resumename~\@firstname~\@familyname}}}
+\urlstyle{tt}
+\RequirePackage{fancyhdr}
+\fancypagestyle{plain}{%
+ \renewcommand{\headrulewidth}{0pt}
+ \renewcommand{\footrulewidth}{0pt}
+ \fancyhf{}}
+\pagestyle{plain}
+\setlength\lineskip{1\p@}
+\setlength\normallineskip{1\p@}
+\renewcommand\baselinestretch{}
+\setlength{\parindent}{0pt}
+\setlength{\parskip}{0pt}
+\setlength\columnsep{10\p@}
+\setlength\columnseprule{0\p@}
+\pagestyle{empty}
+\pagenumbering{arabic}
+\raggedbottom
+\onecolumn
+\providecommand*{\listitemsymbol}{\textbullet}
+\providecommand*{\addresssymbol}{}
+\providecommand*{\mobilesymbol}{\Mobilefone}
+\providecommand*{\phonesymbol}{\Telefon}
+\providecommand*{\faxsymbol}{\FAX}
+\providecommand*{\emailsymbol}{\Letter}
+\def\firstnamecolour#1{\gdef\@firstnamecolour{\addfontfeature{Color=#1}}}
+\def\familynamecolour#1{\gdef\@familynamecolour{\addfontfeature{Color=#1}}}
+\def\titlecolour#1{\gdef\@titlecolour{\addfontfeature{Color=#1}}}
+\def\addresscolour#1{\gdef\@addresscolour{\addfontfeature{Color=#1}}}
+\def\quotecolour#1{\gdef\@quotecolour{\addfontfeature{Color=#1}}}
+\def\sectiontitlecolour#1{\gdef\@sectiontitlecolour{\addfontfeature{Color=#1}}}
+\def\subsectioncolour#1{\gdef\@subsectioncolour{\addfontfeature{Color=#1}}}
+\def\hintcolour#1{\gdef\@hintcolour{\addfontfeature{Color=#1}}}
+\providecommand*{\firstnamefont}{}
+\providecommand*{\familynamefont}{}
+\providecommand*{\titlefont}{}
+\providecommand*{\addressfont}{}
+\providecommand*{\quotefont}{}
+\providecommand*{\sectionfont}{}
+\providecommand*{\subsectionfont}{}
+\providecommand*{\hintfont}{\small}
+\providecommand*{\firstnamestyle}[1]{{\firstnamefont\@firstnamecolour#1}}
+\providecommand*{\familynamestyle}[1]{{\familynamefont\@familynamecolour#1}}
+\providecommand*{\titlestyle}[1]{{\titlefont\@titlecolour#1}}
+\providecommand*{\addresstyle}[1]{{\addressfont\@addresscolour#1}}
+\providecommand*{\quotestyle}[1]{{\quotefont\@quotecolour#1}}
+\providecommand*{\sectionstyle}[1]{{\sectionfont\@sectiontitlecolour#1}}
+\providecommand*{\subsectionstyle}[1]{{\subsectionfont\@subsectioncolour#1}}
+\providecommand*{\hintstyle}[1]{{\hintfont\@hintcolour#1}}
+\newcommand*{\cvtheme}[2][]{
+ \def\@cvtheme{#2}
+ \def\@cvthemeoptions{#1}}
+\cvtheme{bidi-casual}
+\AtBeginDocument{\RequirePackage[\@cvthemeoptions]{cvtheme\@cvtheme}}
+\newcommand*{\resumename}[1]{\def\@resumename{#1}}
+\newcommand*{\firstname}[1]{\def\@firstname{#1}}
+\newcommand*{\familyname}[1]{\def\@familyname{#1}}
+\renewcommand*{\title}[1]{\def\@title{#1}}
+\newcommand*{\address}[1]{\def\@address{#1}}
+\newcommand*{\mobile}[1]{\def\@mobile{#1}}
+\newcommand*{\phone}[1]{\def\@phone{#1}}
+\renewcommand*{\fax}[1]{\def\@fax{#1}}
+\newcommand*{\email}[1]{\def\@email{#1}}
+\newcommand*{\extrainfo}[1]{\def\@extrainfo{#1}}
+\def\@photowidth{0pt}
+\newcommand*{\photo}[2][64pt]{\def\@photowidth{#1}\def\@photo{#2}}
+\newcommand*{\quote}[1]{\def\@quote{#1}}
+\newlength{\quotewidth}
+\newlength{\hintscolumnwidth}
+\newlength{\separatorcolumnwidth}
+\setlength{\separatorcolumnwidth}{0.025\textwidth}
+\newlength{\maincolumnwidth}
+\newlength{\doubleitemmaincolumnwidth}
+\newlength{\listitemsymbolwidth}
+\settowidth{\listitemsymbolwidth}{\listitemsymbol{}~}
+\newlength{\listitemmaincolumnwidth}
+\newlength{\listdoubleitemmaincolumnwidth}
+\newcommand*{\recomputethemelengths}{}
+\newcommand*{\recomputelengths}{%
+\setlength{\quotewidth}{0.65\textwidth}%
+\setlength{\maincolumnwidth}{\textwidth}%
+\addtolength{\maincolumnwidth}{-\separatorcolumnwidth}%
+\addtolength{\maincolumnwidth}{-\hintscolumnwidth}%
+\setlength{\listitemmaincolumnwidth}{\maincolumnwidth}%
+\addtolength{\listitemmaincolumnwidth}{-\listitemsymbolwidth}%
+\setlength{\doubleitemmaincolumnwidth}{\maincolumnwidth}%
+\addtolength{\doubleitemmaincolumnwidth}{-\hintscolumnwidth}%
+\addtolength{\doubleitemmaincolumnwidth}{-\separatorcolumnwidth}%
+\setlength{\doubleitemmaincolumnwidth}{0.5\doubleitemmaincolumnwidth}%
+\setlength{\listdoubleitemmaincolumnwidth}{\maincolumnwidth}%
+\addtolength{\listdoubleitemmaincolumnwidth}{-\listitemsymbolwidth}%
+\setlength{\listdoubleitemmaincolumnwidth}{0.475\listdoubleitemmaincolumnwidth}%
+\renewcommand{\headwidth}{\textwidth}%
+\recomputethemelengths}
+\setlength{\hintscolumnwidth}{0.15\textwidth}
+\recomputelengths
+\title{}
+\renewcommand*{\maketitle}{}
+\newcommand*{\section}[1]{%
+\vspace*{2.5ex \@plus 1ex \@minus .2ex}%
+ \phantomsection{}%
+ \addcontentsline{toc}{part}{#1}%
+ \parbox[m]{\hintscolumnwidth}{\raggedleft\hintfont{\beginL\psline[linecolor=sectionrectanglecolour,linewidth=4pt](-2.5,0)(0,0)\endL}}%
+ \hspace{\separatorcolumnwidth}%
+ \parbox[m]{\maincolumnwidth}{\sectionstyle{#1}}\\[1ex]}
+\newcommand*{\subsection}[1]{%
+ \cvline[0.45em]{}{\subsectionstyle{#1}}}
+\newcommand*{\cvline}[3][.25em]{%
+ \begin{tabular}{@{}p{\hintscolumnwidth}@{\hspace{\separatorcolumnwidth}}p{\maincolumnwidth}@{}}%
+ \raggedleft\hintfont{#2} &{#3}%
+ \end{tabular}\\[#1]}
+\newcommand*{\cvdoubleitem}[4]{%
+ \cvline{#1}{\begin{minipage}[t]{\doubleitemmaincolumnwidth}#2\end{minipage}%
+ \hfill%
+ \begin{minipage}[t]{\hintscolumnwidth}\raggedleft\hintfont{#3}\end{minipage}\hspace*{\separatorcolumnwidth}\begin{minipage}[t]{\doubleitemmaincolumnwidth}#4\end{minipage}}}
+\newcommand*{\cvlistitem}[2][\listitemsymbol{}]{%
+ \cvline[0pt]{}{#1~\begin{minipage}[t]{\listitemmaincolumnwidth}#2\end{minipage}}}
+\newcommand*{\cvlistdoubleitem}[3][\listitemsymbol{}]{%
+ \cvline[0pt]{}{#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#2\end{minipage}%
+ \hfill%
+ \ifthenelse{\equal{#3}{}}%
+ {}%
+ {#1~\begin{minipage}[t]{\listdoubleitemmaincolumnwidth}#3\end{minipage}}}}
+\newcommand*{\cventry}[6]{%
+ \cvline{#1}{%
+ {\bfseries#2}%
+ \ifx#3\else{, {\slshape#3}}\fi%
+ \ifx#4\else{, #4}\fi%
+ \ifx#5\else{, #5}\fi%
+ .%
+ \ifx#6\else{\newline{}\begin{minipage}[t]{\linewidth}\small#6\end{minipage}}\fi
+ }}%
+\newcommand*{\cvlanguage}[3]{%
+ \cvline{#1}{\begin{minipage}[t]{.225\maincolumnwidth}\textbf{#2}\end{minipage}\hfill\begin{minipage}[t]{0.725\maincolumnwidth}\raggedleft\footnotesize\itshape #3\end{minipage}}}
+\newcommand*{\cvcomputer}[4]{%
+ \cvdoubleitem{#1}{\small#2}{#3}{\small#4}}
+\newcommand*{\link}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {\beginL\href{#2}{\beginR#2\endR}\endL}%
+ {\beginL\href{#2}{\beginR#1\endR}\endL}}
+\newcommand*{\httplink}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {\beginL\href{http://#2}{\beginR#2\endR}\endL}%
+ {\beginL\href{http://#2}{\beginR#1\endR}\endL}}
+\newcommand*{\emaillink}[2][]{%
+ \ifthenelse{\equal{#1}{}}%
+ {\beginL\href{mailto:#2}{\beginR#2\endR}\endL}%
+ {\beginL\href{mailto:#2}{\beginR#1\endR}\endL}}
+\newif\if@displaypagenumbers\@displaypagenumberstrue
+\newcommand*{\nopagenumbers}{\@displaypagenumbersfalse}
+\AtBeginDocument{%
+ \if@displaypagenumbers%
+ \@ifundefined{r@lastpage}{}{%
+ \ifthenelse{\pageref{lastpage} > 1}{%
+ \fancypagestyle{plain}{%
+ \fancyfoot[r]{\beginL\addressfont\@quotecolour\footnotesize\thepage\beginL/\endL\pageref{lastpage}\endL}}%
+ \pagestyle{plain}}{}}%
+ \AtEndDocument{\label{lastpage}}%
+ \fi}
+\newlength{\bibindent}
+\setlength{\bibindent}{1.5em}
+\newcommand*{\bibliographyitemlabel}{\includegraphics{bibitem.pdf}}
+\newenvironment{thebibliography}[1]%
+ {%
+ \section{\refname}%
+ \small%
+ \begin{list}{\bibliographyitemlabel}%
+ {%
+ \setlength{\topsep}{0pt}%
+ \setlength{\labelwidth}{\hintscolumnwidth}%
+ \setlength{\labelsep}{\separatorcolumnwidth}%
+ \leftmargin\labelwidth%
+ \advance\leftmargin\labelsep%
+ \@openbib@code%
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty%
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy\clubpenalty4000\widowpenalty4000%
+ }%
+ {%
+ \def\@noitemerr{\@latex@warning{Empty `thebibliography' environment}}%
+ \end{list}%
+ }
+\newcommand\newblock{\hskip .11em\@plus.33em\@minus.07em}
+\let\@openbib@code\@empty
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidimoderncv.cls'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bidipresentation.cls b/Master/texmf-dist/tex/xelatex/bidi/bidipresentation.cls
new file mode 100644
index 00000000000..8d74f9d211c
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bidipresentation.cls
@@ -0,0 +1,102 @@
+%%
+%% This is file `bidipresentation.cls',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bidipresentation.cls')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesClass{bidipresentation}
+\DeclareOption*{\PassOptionsToClass{\CurrentOption}{article}}
+\ProcessOptions\relax
+\LoadClass{article}
+
+\RequirePackage[foot=10.2pt,head=0pt,paperwidth=128mm,paperheight=96mm,left=5mm,top=5mm,right=7mm,bottom=8mm]{geometry}
+
+\RequirePackage{fancyhdr}
+\renewcommand{\headrulewidth}{0mm}
+
+\renewcommand{\maketitle}%
+ {\ClassError{bidipresentation}{Caution: ``maketitle'' command not supported}%
+ {Please use ``titlepage'' environment instead}%
+}
+
+\fancypagestyle{pres}{%
+\fancyhf{}%
+\fancyfoot[RO,LE]{\footnotesize \thepage}%
+}
+
+\pagestyle{pres}
+
+\newcommand{\distance}[1]{\vspace*{\stretch{#1}}}
+\newcommand{\abstand}[1]{\vspace*{\stretch{#1}}}
+
+\setlength{\parskip}{0.6ex}
+\setlength{\parindent}{0mm}
+
+\newenvironment{plainslide}[1][]%
+ {{\raggedleft \large\bfseries #1\par}\par\vspace*{\stretch{1}}}%
+ {\par\vspace*{\stretch{1}}\newpage}
+
+\newenvironment{rawslide}{}{\newpage}%
+
+\def\itemize{%
+ \ifnum \@itemdepth >\thr@@\@toodeep\else
+ \advance\@itemdepth\@ne
+ \edef\@itemitem{labelitem\romannumeral\the\@itemdepth}%
+ \expandafter
+ \list
+ \csname\@itemitem\endcsname
+ {\def\makelabel##1{\hss\llap{##1}}}%
+ \fi
+ \setlength{\itemsep}{0ex}%
+ \setlength{\parskip}{0.1ex}%
+ \setlength{\parsep}{0ex}%
+ }%
+\let\enditemize =\endlist
+
+\def\enumerate{%
+ \ifnum \@enumdepth >\thr@@\@toodeep\else
+ \advance\@enumdepth\@ne
+ \edef\@enumctr{enum\romannumeral\the\@enumdepth}%
+ \expandafter
+ \list
+ \csname label\@enumctr\endcsname
+ {\usecounter\@enumctr\def\makelabel##1{\hss\llap{##1}}}%
+ \fi
+ \setlength{\itemsep}{0ex}%
+ \setlength{\parskip}{0.1ex}%
+ \setlength{\parsep}{0ex}%
+ }%
+\let\endenumerate =\endlist
+
+\renewenvironment{description}
+ {\list{}{\labelwidth\z@ \itemindent-\leftmargin
+ \let\makelabel\descriptionlabel}
+ \setlength{\itemsep}{0ex}%
+ \setlength{\parskip}{0.1ex}%
+ \setlength{\parsep}{0ex}}
+ {\endlist}
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bidipresentation.cls'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/book-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/book-bidi.def
new file mode 100644
index 00000000000..4cc8f7dfefb
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/book-bidi.def
@@ -0,0 +1,149 @@
+%%
+%% This is file `book-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `book-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\renewcommand\backmatter{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \@mainmatterfalse}
+
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter.\,\,\endR%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}{}}%
+ \def\ps@plain{\ps@empty
+\def\@oddfoot{\hfil\thepage\hfil}%
+\let\@evenfoot\@oddfoot
+}
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+\beginR\thesection\endR\,
+ \ifnum \c@secnumdepth >\z@
+ \beginR##1\endR \ %
+ \fi
+ }}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter. \endR %
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}}}
+
+\fi
+\pagestyle{headings}
+\def\@idxitem{\par\hangindent -40\p@}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `book-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/bookest-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/bookest-bidi.def
new file mode 100644
index 00000000000..7b993f8a0bd
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/bookest-bidi.def
@@ -0,0 +1,93 @@
+%%
+%% This is file `bookest-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `bookest-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\AtBeginDocument{
+\def\@makechapterhead#1{%
+ \vspace*{20\p@}
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ {\colorA\huge\scshape \@chapapp\space \thechapter}
+ \par\nobreak
+ \vskip 10\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ {\colorB\hrule}
+ \vskip 15\p@
+ \begin{flushleft}
+ {\colorA\Huge \bfseries #1}\par\nobreak
+ \end{flushleft}
+ \vskip 5\p@
+ {\colorB\hrule}
+ \vskip 30\p@
+ }}
+\def\@makeschapterhead#1{%
+ \vspace*{20\p@}
+ {\parindent \z@ \raggedright \normalfont
+ {\colorB\hrule}
+ \vskip 15\p@
+ \begin{center}
+ {\colorA\Huge \bfseries #1}\par\nobreak
+ \end{center}
+ \vskip 5\p@
+ {\colorB\hrule}
+ \vskip 30\p@
+ }}
+\renewcommand{\setevenhead}[1]{\def\@evenhead{#1}}
+\renewcommand{\setoddhead}[1]{\def\@oddhead{#1}}
+\renewcommand{\setevenfoot}[1]{\def\@evenfoot{#1}}
+\renewcommand{\setoddfoot}[1]{\def\@oddfoot{#1}}
+\renewcommand{\oddheadtext}{{\colorA{\slshape\rightmark}\hfill\thepage}}
+\renewcommand{\setoddheadtext}[1]{\renewcommand{\oddheadtext}{#1}}
+\renewcommand{\evenheadtext}{\oddheadtext}
+\renewcommand{\setevenheadtext}[1]{\renewcommand{\evenheadtext}{#1}}
+\renewcommand{\evenfoottext}{}
+\renewcommand{\setevenfoottext}[1]{\renewcommand{\evenfoottext}{#1}}
+\renewcommand{\oddfoottext}{}
+\renewcommand{\setoddfoottext}[1]{\renewcommand{\oddfoottext}{#1}}
+\renewcommand{\setleftmark}[1]{\renewcommand{\leftmark}{#1}}
+\renewcommand{\setrightmark}[1]{\renewcommand{\rightmark}{#1}}
+\renewcommand{\makeheadrule}{{\colorB\hrule\@width\textwidth \@height 0.4pt \vskip-0.4pt}}
+\renewcommand{\makefootrule}{\makeheadrule}
+\if@twoside
+ \setevenheadtext{{\colorA\thepage\hfill\slshape\leftmark}}
+\fi
+\setevenhead{\vbox{\evenheadtext \vskip 5\p@ \makeheadrule}}
+\setoddhead{\vbox{\oddheadtext \vskip 5\p@ \makeheadrule}}
+\let\UCase\MakeUppercase
+\renewcommand{\MakeUppercase}{}
+\def\ps@plain{%
+ \def\@oddfoot{{\hfil\colorA\thepage\hfil}}
+ \def\@evenfoot{{\hfil\colorA\thepage\hfil}}
+ \let\@oddhead\@empty
+ \let\@evenhead\@empty
+}
+}
+\NoHyper
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `bookest-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/cvthemebidicasual.sty b/Master/texmf-dist/tex/xelatex/bidi/cvthemebidicasual.sty
new file mode 100644
index 00000000000..f9e1cc3d68b
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/cvthemebidicasual.sty
@@ -0,0 +1,118 @@
+%%
+%% This is file `cvthemebidicasual.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `cvthemebidicasual.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cvthemebidicasual}
+\DeclareOption{blue}{}
+\newif\if@colourorange\@colourorangefalse
+\DeclareOption{orange}{\@colourorangetrue}
+\newif\if@colourgreen\@colourgreenfalse
+\DeclareOption{green}{\@colourgreentrue}
+\newif\if@colourred\@colourredfalse
+\DeclareOption{red}{\@colourredtrue}
+\newif\if@colourgrey\@colourgreyfalse
+\DeclareOption{grey}{\@colourgreytrue}
+\DeclareOption*{
+ \PackageWarning{cvthemebidicasual}{Unknown option ‘\CurrentOption’}}
+\ExecuteOptions{colour}
+\ProcessOptions\relax
+\renewcommand*{\listitemsymbol}{\textbullet}
+\familynamecolour{808080}
+\firstnamecolour{A9A9A9}
+\quotecolour{696969}
+\addresscolour{696969}
+\definecolor{sectionrectanglecolour}{rgb}{0.25,0.50,0.75}
+\sectiontitlecolour{1E90FF}
+\subsectioncolour{4682B4}
+\definecolor{rulecolour}{gray}{0.6}
+\definecolor{footersymbolcolour}{rgb}{0.25,0.50,0.75}
+\if@colourorange
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.65,0.20}
+ \sectiontitlecolour{FF8C00}
+ \subsectioncolour{FF8C00}
+ \definecolor{footersymbolcolour}{rgb}{0.95,0.55,0.15}\fi
+\if@colourgreen
+ \definecolor{sectionrectanglecolour}{rgb}{0.55,0.85,0.35}
+ \sectiontitlecolour{008000}
+ \subsectioncolour{008000}
+ \definecolor{footersymbolcolour}{rgb}{0.30,0.65,0.15}\fi
+\if@colourred
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.30,0.30}
+ \sectiontitlecolour{FF0000}
+ \subsectioncolour{FF0000}
+ \definecolor{footersymbolcolour}{rgb}{0.95,0.20,0.20}\fi
+\if@colourgrey
+ \definecolor{sectionrectanglecolour}{rgb}{0.75,0.75,0.75}
+ \sectiontitlecolour{808080}
+ \subsectioncolour{808080}
+ \definecolor{footersymbolcolour}{rgb}{0.35,0.35,0.35}\fi
+\renewcommand*{\ttdefault}{pcr}
+\renewcommand*{\firstnamefont}{\fontsize{38}{40}\mdseries\upshape}
+\renewcommand*{\familynamefont}{\firstnamefont}
+\renewcommand*{\addressfont}{\normalsize\mdseries\slshape}
+\renewcommand*{\quotefont}{\large\slshape}
+\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
+\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
+\renewcommand*{\maketitle}{%
+ {\beginL%
+ \ifthenelse{\isundefined{\@photo}}%
+ {}%
+ {{\framebox{\includegraphics[width=\@photowidth]{\@photo}}}}%
+ \hfill%
+ \raggedleft{\beginR\firstnamestyle{\@firstname}~\familynamestyle{\@familyname}\endR}\endL\\[-.35em]}%
+ {\beginL\psline[linewidth=2pt,linecolor=rulecolour](-11.2,-0.2)(5.6,-0.2)\endL\\[2.5em]}%
+ \ifthenelse{\isundefined{\@quote}}%
+ {}%
+ {\centering{\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}}\\[2.5em]}%
+ }%
+\newif\if@firstfooterelement\@firstfooterelementtrue
+\providecommand*{\footersymbol}{}
+\renewcommand*{\footersymbol}{%
+ \if@firstfooterelement%
+ \else%
+ { ~~\beginL\psdot[linecolor=footersymbolcolour](0,0.1)\endL~~~}\fi}
+\providecommand*{\makefooter}{}
+\renewcommand*{\makefooter}{%
+ \fancypagestyle{plain}{%
+ \fancyfoot[c]{%
+ \parbox{0.8\textwidth}{%
+ \centering%
+ \addressfont\@addresscolour%
+ \ifthenelse{\isundefined{\@address}}{}{%
+ \beginR\addresssymbol~\@address\endR\\%
+ \@firstfooterelementfalse}%
+ \beginR\ifthenelse{\isundefined{\@mobile}}{}{\beginR\mobilesymbol~\@mobile\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@phone}}{}{\footersymbol\beginR\phonesymbol~\@phone\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@fax}}{}{\footersymbol\beginR\faxsymbol~\@fax\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@email}}{}{\footersymbol\beginR\emailsymbol~\emaillink{\@email}\endR\@firstfooterelementfalse}%
+ \ifthenelse{\isundefined{\@extrainfo}}{}{\beginR\footersymbol\@extrainfo\endR\@firstfooterelementfalse}\endR}}%
+ }%
+ \pagestyle{plain}}
+\AtBeginDocument{\makefooter}
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `cvthemebidicasual.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/cvthemebidiclassic.sty b/Master/texmf-dist/tex/xelatex/bidi/cvthemebidiclassic.sty
new file mode 100644
index 00000000000..e297fc97e0c
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/cvthemebidiclassic.sty
@@ -0,0 +1,130 @@
+%%
+%% This is file `cvthemebidiclassic.sty',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `cvthemebidiclassic.sty')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\NeedsTeXFormat{LaTeX2e}
+\ProvidesPackage{cvthemebidiclassic}
+\DeclareOption{blue}{}
+\newif\if@colourorange\@colourorangefalse
+\DeclareOption{orange}{\@colourorangetrue}
+\newif\if@colourgreen\@colourgreenfalse
+\DeclareOption{green}{\@colourgreentrue}
+\newif\if@colourred\@colourredfalse
+\DeclareOption{red}{\@colourredtrue}
+\newif\if@colourgrey\@colourgreyfalse
+\DeclareOption{grey}{\@colourgreytrue}
+\DeclareOption*{
+ \PackageWarning{cvthemebidiclassic}{Unknown option ‘\CurrentOption’}}
+\ExecuteOptions{colour}
+\ProcessOptions\relax
+\renewcommand*{\listitemsymbol}{\textbullet}
+\firstnamecolour{}
+\familynamecolour{}
+\titlecolour{808080}
+\quotecolour{696969}
+\addresscolour{696969}
+\definecolor{sectionrectanglecolour}{rgb}{0.25,0.50,0.75}
+\sectiontitlecolour{1E90FF}
+\subsectioncolour{4682B4}
+\if@colourorange
+ \addresscolour{FF8C00}
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.65,0.20}
+ \sectiontitlecolour{FF8C00}
+ \subsectioncolour{FF8C00}\fi
+\if@colourgreen
+ \addresscolour{008000}
+ \definecolor{sectionrectanglecolour}{rgb}{0.55,0.85,0.35}
+ \sectiontitlecolour{008000}
+ \subsectioncolour{008000}\fi
+\if@colourred
+ \addresscolour{FF0000}
+ \definecolor{sectionrectanglecolour}{rgb}{1.00,0.30,0.30}
+ \sectiontitlecolour{FF0000}
+ \subsectioncolour{FF0000}\fi
+\if@colourgrey
+ \addresscolour{808080}
+ \definecolor{sectionrectanglecolour}{rgb}{0.75,0.75,0.75}
+ \sectiontitlecolour{808080}
+ \subsectioncolour{808080}\fi
+\renewcommand*{\ttdefault}{pcr}
+\renewcommand*{\firstnamefont}{\fontsize{34}{36}\mdseries\upshape}
+\renewcommand*{\titlefont}{\LARGE\mdseries\slshape}
+\renewcommand*{\addressfont}{\normalsize\mdseries\slshape}
+\renewcommand*{\familynamefont}{\firstnamefont}
+\renewcommand*{\quotefont}{\large\slshape}
+\renewcommand*{\sectionfont}{\Large\mdseries\upshape}
+\renewcommand*{\subsectionfont}{\large\mdseries\upshape}
+\newlength{\maketitlenamemaxwidth}
+\setlength{\maketitlenamemaxwidth}{.525\textwidth}
+\newlength{\maketitlenamefullwidth}
+\settowidth{\maketitlenamefullwidth}{\firstnamestyle{\@firstname~}\familynamestyle{\@familyname}}
+\newlength{\maketitlenamewidth}
+\ifnum\maketitlenamemaxwidth<\maketitlenamefullwidth\setlength{\maketitlenamewidth}{\maketitlenamemaxwidth}\else\setlength{\maketitlenamewidth}{\maketitlenamefullwidth}\fi
+\newlength{\maketitlepicturewidth}
+\setlength{\maketitlepicturewidth}{\@photowidth}
+\newlength{\maketitledetailswidth}
+\renewcommand*{\recomputethemelengths}{%
+ \setlength{\maketitledetailswidth}{\textwidth}%
+ \addtolength{\maketitledetailswidth}{-\maketitlenamewidth}%
+ \addtolength{\maketitledetailswidth}{-\separatorcolumnwidth}%
+ \addtolength{\maketitledetailswidth}{-\maketitlepicturewidth}}
+\recomputethemelengths
+\newif\if@firstdetailselement\@firstdetailselementtrue
+\newcommand*{\maketitledetailsnewline}{
+ \if@firstdetailselement%
+ \@firstdetailselementfalse%
+ \else%
+ \\[.2em]\fi}
+\renewcommand*{\maketitle}{%
+ % name and title
+ \begin{minipage}[b]{\maketitlenamewidth}%
+ \firstnamestyle{\@firstname~}\familynamestyle{\@familyname}%
+ \ifthenelse{\equal{\@title}{}}{}{\\[1.25em]\titlestyle{\@title}}%
+ \end{minipage}%
+ % optional data
+ \begin{minipage}[b]{\maketitledetailswidth}%
+ \raggedleft\addressfont\@addresscolour%
+ \ifthenelse{\isundefined{\@address}}{}{%
+ \maketitledetailsnewline%
+ \addresssymbol~\\\@address}%
+ \ifthenelse{\isundefined{\@mobile}}{}{\maketitledetailsnewline\mobilesymbol~\@mobile}%
+ \ifthenelse{\isundefined{\@phone}}{}{\maketitledetailsnewline\phonesymbol~\@phone}%
+ \ifthenelse{\isundefined{\@fax}}{}{\maketitledetailsnewline\faxsymbol~\@fax}%
+ \ifthenelse{\isundefined{\@email}}{}{\maketitledetailsnewline\emailsymbol~\emaillink{\@email}}%
+ \ifthenelse{\isundefined{\@extrainfo}}{}{\maketitledetailsnewline\@extrainfo}%
+ \end{minipage}%
+ % optional photo
+ \ifthenelse{\isundefined{\@photo}}%
+ {}%
+ {\hspace*{\separatorcolumnwidth}\framebox{\includegraphics[width=\maketitlepicturewidth]{\@photo}}}\\[3em]%
+ % optional quote
+ \ifthenelse{\isundefined{\@quote}}%
+ {}%
+ {\centering{\begin{minipage}{\quotewidth}\centering\quotestyle{\@quote}\end{minipage}}\\[2.5em]}%
+ }
+
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `cvthemebidiclassic.sty'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/draftwatermark-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/draftwatermark-bidi.def
new file mode 100644
index 00000000000..6238ed1db95
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/draftwatermark-bidi.def
@@ -0,0 +1,31 @@
+%%
+%% This is file `draftwatermark-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `draftwatermark-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand\SetWatermarkText[1]{%
+ \def\sc@wm@text{\if@RTL\beginR\fi#1\if@RTL\endR\fi}}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `draftwatermark-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/extbook-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/extbook-bidi.def
new file mode 100644
index 00000000000..daaf4374160
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/extbook-bidi.def
@@ -0,0 +1,148 @@
+%%
+%% This is file `extbook-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `extbook-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+
+\def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\renewcommand\backmatter{%
+ \if@openright
+ \cleardoublepage
+ \else
+ \clearpage
+ \fi
+ \@mainmatterfalse}
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \def\@oddhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter.\,\,\endR%
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}{}}%
+ \def\ps@plain{\ps@empty
+\def\@oddfoot{\hfil\thepage\hfil}%
+\let\@evenfoot\@oddfoot
+}
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+\beginR\thesection\endR\,
+ \ifnum \c@secnumdepth >\z@
+ \beginR##1\endR \ %
+ \fi
+ }}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\thepage\hfil\beginR\rightmark\endR}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright {\MakeUppercase{%
+ \beginR\@chapapp\ \thechapter. \endR %
+ \ifnum \c@secnumdepth >\m@ne
+ \if@mainmatter
+ \beginR##1\endR
+ \fi
+ \fi
+ }}}}
+
+\fi
+\pagestyle{headings}
+\def\@idxitem{\par\hangindent -40\p@}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `extbook-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/fancyhdr-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/fancyhdr-bidi.def
new file mode 100644
index 00000000000..29dcd17192b
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/fancyhdr-bidi.def
@@ -0,0 +1,39 @@
+%%
+%% This is file `fancyhdr-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `fancyhdr-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@fancyhead#1#2#3#4#5{\beginR#1\endR\hbox to\headwidth{\fancy@reset
+ \@fancyvbox\headheight{\hbox
+ {\rlap{\parbox[b]{\headwidth}{\raggedright\beginR#2\endR}}\hfill
+ \parbox[b]{\headwidth}{\centering\beginR#3\endR}\hfill
+ \llap{\parbox[b]{\headwidth}{\raggedleft\beginR#4\endR}}}\headrule}}\beginR#5\endR}
+\def\@fancyfoot#1#2#3#4#5{\beginR#1\endR\hbox to\headwidth{\fancy@reset
+ \@fancyvbox\footskip{\footrule
+ \hbox{\rlap{\parbox[t]{\headwidth}{\raggedright\beginR#2\endR}}\hfill
+ \parbox[t]{\headwidth}{\centering\beginR#3\endR}\hfill
+ \llap{\parbox[t]{\headwidth}{\raggedleft\beginR#4\endR}}}}}\beginR#5\endR}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `fancyhdr-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/footnote-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/footnote-bidi.def
new file mode 100644
index 00000000000..64a8b95c430
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/footnote-bidi.def
@@ -0,0 +1,230 @@
+%%
+%% This is file `footnote-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `footnote-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\if@RTLmain\@RTL@footnotetrue\else\@RTL@footnotefalse\fi
+\def\bidi@footnote@output{{%
+ \dimen0=\ht\footins
+ \advance\dimen0 by\dp\footins
+ \def\@elt##1##2{%
+ \ifx\bidi@footnoterule\relax\global\let\bidi@footnoterule##2\fi
+ \advance\dimen0 by -##1\relax
+ \ifdim\dimen0<\z@
+ {%
+ \let\@elt\relax\let\right@footnote\relax\let\left@footnote\relax
+ \dimen0=-\dimen0%
+ \xdef\new@bidi@footnote@list{\new@bidi@footnote@list\noexpand\@elt{\the\dimen0}{##2}}%
+}%
+ \fi
+ \ifdim\dimen0>\z@\else
+\let\right@footnote\relax\let\left@footnote\relax
+\def\@elt####1####2{%
+ {\let\@elt\relax
+ \xdef\new@bidi@footnote@list{\new@bidi@footnote@list\noexpand\@elt{####1}{####2}}}%
+}%
+ \fi
+ }%
+ \def\new@bidi@footnote@list{}%
+ \bidi@footnote@list
+ \global\let\bidi@footnote@list\new@bidi@footnote@list
+ }}
+\def\right@footnote{%
+ \hbox to \columnwidth
+ {\beginR \vbox{\kern -3\p@
+ \hrule width .4\columnwidth \kern2.6\p@}\hfil\endR}}
+\def\left@footnote{%
+ \hrule width .4\columnwidth\kern 2.6\p@}
+\def\textwidth@footnote{\kern-3\p@
+ \hrule \@width \textwidth \kern 2.6\p@}
+\def\right@footnoterule{\bidi@footnote@output\right@footnote\global\let\bidi@footnoterule\relax}
+\def\left@footnoterule{\bidi@footnote@output\left@footnote\global\let\bidi@footnoterule\relax}
+\def\textwidth@footnoterule{\bidi@footnote@output\textwidth@footnote\global\let\bidi@footnoterule\relax}
+\def\auto@footnoterule{\bidi@footnote@output
+ \ifx\bidi@footnoterule\relax\if@RTL\right@footnote\else\left@footnote\fi\else\bidi@footnoterule\fi
+ \global\let\bidi@footnoterule\relax}
+\def\leftfootnoterule{\def\footnoterule{\left@footnoterule}}
+\let\LRfootnoterule=\leftfootnoterule
+\def\rightfootnoterule{\def\footnoterule{\right@footnoterule}}
+\def\textwidthfootnoterule{\def\footnoterule{\textwidth@footnoterule}}
+\def\autofootnoterule{\def\footnoterule{\auto@footnoterule}}
+\def\@makefnmark{\hbox{$^{\hbox{\scriptsize\@thefnmark}}\m@th$}}
+\def\bidi@footnote@list{}
+\let\bidi@footnoterule\relax
+\def\RTLfootnote{\@ifnextchar[\@xRTLfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}
+ \@footnotemark\@RTLfootnotetext}}
+\def\@xRTLfootnote[#1]{
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}
+ \endgroup
+ \@footnotemark\@RTLfootnotetext}
+\def\LTRfootnote{\@ifnextchar[\@xLTRfootnote{\stepcounter\@mpfn
+ \protected@xdef\@thefnmark{\thempfn}
+ \@footnotemark\@LTRfootnotetext}}
+\def\@xLTRfootnote[#1]{
+ \begingroup
+ \csname c@\@mpfn\endcsname #1\relax
+ \unrestored@protected@xdef\@thefnmark{\thempfn}
+ \endgroup
+ \@footnotemark\@LTRfootnotetext}
+\def\insertRTL{\bgroup\beginR\@RTLtrue}
+\def\endinsertRTL{\endR\egroup}
+\def\insertLTR{\bgroup\beginL\@RTLfalse}
+\def\endinsertLTR{\endL\egroup}
+\DeclareRobustCommand\InLTR{\insertLTR}
+\DeclareRobustCommand\EInLTR{\endinsertLTR}
+\DeclareRobustCommand\InRTL{\insertRTL}
+\DeclareRobustCommand\EInRTL{\endinsertRTL}
+\def\parse@lsent#1#2\EInLTR#3#4#5\parse@end{\@sentdirfalse
+\def\@tempa{\InLTR}\def\@tempb{\EInLTR}\def\@tempc{#1}\def\@tempd{#4}%
+\ifx\@tempa\@tempc\ifx\@tempb\@tempd\@sentdirtrue\fi\fi}
+\def\parse@rsent#1#2\EInRTL#3#4#5\parse@end{\@sentdirfalse
+\def\@tempa{\InRTL}\def\@tempb{\EInRTL}\def\@tempc{#1}\def\@tempd{#4}%
+\ifx\@tempa\@tempc\ifx\@tempb\@tempd\@sentdirtrue\fi\fi}
+\def\iflsentence#1{\parse@lsent#1\EInLTR123\parse@end\if@sentdir}
+\def\ifrsentence#1{\parse@rsent#1\EInRTL123\parse@end\if@sentdir}
+\def\bidi@footnotetext@dir#1{%
+ \@tempswatrue
+ \ifrsentence{#1}\rtl\@tempswafalse\fi
+ \iflsentence{#1}\ltr\@tempswafalse\fi
+ \if@tempswa\if@RTL\rtl\else\ltr\fi\fi
+ \xdef\bidi@this@footnote{\if@RTL\noexpand\right@footnote\else\noexpand\left@footnote\fi}%
+}
+\def\bidi@footnotetext@after{%
+ {%
+ \let\@elt\relax\let\right@footnote\relax\let\left@footnote\relax
+ \dimen0=\ht\footins
+ \advance\dimen0 by\dp\footins
+ \xdef\bidi@footnote@list{\bidi@footnote@list\@elt{\the\dimen0}{\bidi@this@footnote}}%
+ }%
+}
+\def\setfootnoteRL{\@RTL@footnotetrue}
+\def\unsetfootnoteRL{\@RTL@footnotefalse}
+\def\setfootnoteLR{\unsetfootnoteRL}
+\long\def\@footnotetext#1{%
+ \begingroup
+ \setbox\footins
+ \vbox{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi\reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \bidi@footnotetext@dir{#1}%
+ \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
+ {\rule{\z@}{\footnotesep}\ignorespaces\if@RTL@footnote#1\else\rmfamily#1\fi\strut}}%
+ \bidi@footnotetext@after
+ \insert\footins{\unvbox\footins}%
+ \endgroup}
+\long\def\@RTLfootnotetext#1{%
+ \begingroup
+ \setbox\footins
+ \vbox{\@RTLtrue\reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \bidi@footnotetext@dir{#1}%
+ \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
+ {\rule{\z@}{\footnotesep}\ignorespaces #1\strut}}%
+ \bidi@footnotetext@after
+ \insert\footins{\unvbox\footins}%
+ \endgroup}
+\long\def\@LTRfootnotetext#1{%
+ \begingroup
+ \setbox\footins
+ \vbox{\@RTLfalse\reset@font\footnotesize
+ \interlinepenalty\interfootnotelinepenalty
+ \splittopskip\footnotesep
+ \splitmaxdepth \dp\strutbox \floatingpenalty \@MM
+ \hsize\columnwidth \@parboxrestore
+ \bidi@footnotetext@dir{#1}%
+ \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}\@makefntext
+ {\rule{\z@}{\footnotesep}\ignorespaces\rmfamily #1\strut}}%
+ \bidi@footnotetext@after
+ \insert\footins{\unvbox\footins}%
+ \endgroup}
+\long\def\@mpRTLfootnotetext#1{
+ \global\setbox\@mpfootins\vbox{\@RTLtrue
+ \unvbox\@mpfootins
+ \reset@font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel
+ {\csname p@mpfootnote\endcsname\@thefnmark}
+ \color@begingroup
+ \bidi@footnotetext@dir{#1}
+ \if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi
+ \@makefntext{
+ \rule\z@\footnotesep\ignorespaces#1\@finalstrut\strutbox}
+ \color@endgroup}}
+\long\def\@mpLTRfootnotetext#1{
+ \global\setbox\@mpfootins\vbox{\@RTLfalse
+ \unvbox\@mpfootins
+ \reset@font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel
+ {\csname p@mpfootnote\endcsname\@thefnmark}
+ \color@begingroup
+ \bidi@footnotetext@dir{#1}
+ \if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi
+ \@makefntext{
+ \rule\z@\footnotesep\ignorespaces\rmfamily#1\@finalstrut\strutbox}
+ \color@endgroup}}
+\long\def\@mpfootnotetext#1{
+ \global\setbox\@mpfootins\vbox{\if@RTL@footnote\@RTLtrue\else\@RTLfalse\fi
+ \unvbox\@mpfootins
+ \reset@font\footnotesize
+ \hsize\columnwidth
+ \@parboxrestore
+ \protected@edef\@currentlabel
+ {\csname p@mpfootnote\endcsname\@thefnmark}
+ \color@begingroup
+ \bidi@footnotetext@dir{#1}
+ \if@RTL\global\let\bidi@footnoterule\right@footnote\else\global\let\bidi@footnoterule\left@footnote\fi
+ \@makefntext{
+ \rule\z@\footnotesep\ignorespaces\if@RTL@footnote#1\else\rmfamily#1\fi\@finalstrut\strutbox}
+ \color@endgroup}}
+\def\@iiiminipage#1#2[#3]#4{%
+ \leavevmode
+ \@pboxswfalse
+ \setlength\@tempdima{#4}%
+ \def\@mpargs{{#1}{#2}[#3]{#4}}%
+ \setbox\@tempboxa\vbox\bgroup
+ \color@begingroup
+ \hsize\@tempdima
+ \textwidth\hsize \columnwidth\hsize
+ \@parboxrestore
+ \def\@mpfn{mpfootnote}\def\thempfn{\thempfootnote}\c@mpfootnote\z@
+ \let\@footnotetext\@mpfootnotetext
+ \let\@LTRfootnotetext\@mpLTRfootnotetext
+ \let\@RTLfootnotetext\@mpRTLfootnotetext
+ \let\@listdepth\@mplistdepth \@mplistdepth\z@
+ \@minipagerestore
+ \@setminipage}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `footnote-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def
new file mode 100644
index 00000000000..c46d3570e88
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/graphicx-bidi.def
@@ -0,0 +1,43 @@
+%%
+%% This is file `graphicx-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `graphicx-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\Gin@ii[#1]#2{%
+ \def\@tempa{[}\def\@tempb{#2}%
+ \ifx\@tempa\@tempb
+ \def\@tempa{\Gin@iii[#1][}%
+ \expandafter\@tempa
+ \else
+ \begingroup
+ \@tempswafalse
+ \toks@{\beginL\Ginclude@graphics{#2}\endL}%
+ \setkeys{Gin}{#1}%
+ \Gin@esetsize
+ \the\toks@
+ \endgroup
+ \fi}%
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `graphicx-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/listings-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/listings-bidi.def
new file mode 100644
index 00000000000..0ce06b2a7e4
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/listings-bidi.def
@@ -0,0 +1,37 @@
+%%
+%% This is file `listings-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `listings-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\long\def\@makecaption#1#2{%
+ \vskip 10pt%
+ \setbox\@tempboxa\hbox{#1: #2}%
+ \ifdim \wd\@tempboxa >\hsize \beginR#1: #2\par%
+ \else \hbox
+to\hsize{\beginR\hfil\box\@tempboxa\hfil%
+\endR}%
+ \fi}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `listings-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/longtable-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/longtable-bidi.def
new file mode 100644
index 00000000000..9f674499acf
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/longtable-bidi.def
@@ -0,0 +1,138 @@
+%%
+%% This is file `longtable-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `longtable-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\LT@makecaption#1#2#3{%
+ \LT@mcol\LT@cols c{\hbox to\z@{\hss\parbox[t]\LTcapwidth{%
+ \sbox\@tempboxa{\if@RTL\beginR\fi#1{#2: }#3\if@RTL\endR\fi}%
+ \ifdim\wd\@tempboxa>\hsize
+ #1{#2: }#3%
+ \else
+ \hbox to\hsize{\hfil\box\@tempboxa\hfil}%
+ \fi
+ \endgraf\vskip\baselineskip}%
+ \hss}}}
+
+\def\longtable{\if@RTL\global\@RTLtabtrue\fi%
+ \par
+ \ifx\multicols\@undefined
+ \else
+ \ifnum\col@number>\@ne
+ \@twocolumntrue
+ \fi
+ \fi
+ \if@twocolumn
+ \LT@err{longtable not in 1-column mode}\@ehc
+ \fi
+ \begingroup \if@RTLtab\beginR \fi
+ \@ifnextchar[\LT@array{\LT@array[x]}}
+
+\def\LT@array[#1]#2{%
+ \refstepcounter{table}\stepcounter{LT@tables}%
+ \if l#1%
+ \LTleft\z@ \LTright\fill
+ \else\if r#1%
+ \LTleft\fill \LTright\z@
+ \else\if c#1%
+ \LTleft\fill \LTright\fill
+ \fi\fi\fi
+ \let\LT@mcol\multicolumn
+ \let\LT@@tabarray\@tabarray
+ \let\LT@@hl\hline
+ \def\@tabarray{%
+ \let\hline\LT@@hl
+ \LT@@tabarray}%
+ \let\\\LT@tabularcr\let\tabularnewline\\%
+ \def\newpage{\noalign{\break}}%
+ \def\pagebreak{\noalign{\ifnum`}=0\fi\@testopt{\LT@no@pgbk-}4}%
+ \def\nopagebreak{\noalign{\ifnum`}=0\fi\@testopt\LT@no@pgbk4}%
+ \let\hline\LT@hline \let\kill\LT@kill\let\caption\LT@caption
+ \@tempdima\ht\strutbox
+ \let\@endpbox\LT@endpbox
+ \ifx\extrarowheight\@undefined
+ \let\@acol\@tabacol
+ \let\@classz\@tabclassz \let\@classiv\@tabclassiv
+ \def\@startpbox{\vtop\LT@startpbox}%
+ \let\@@startpbox\@startpbox
+ \let\@@endpbox\@endpbox
+ \let\LT@LL@FM@cr\@tabularcr
+ \else
+ \advance\@tempdima\extrarowheight
+ \col@sep\tabcolsep
+ \let\@startpbox\LT@startpbox\let\LT@LL@FM@cr\@arraycr
+ \fi
+ \setbox\@arstrutbox\hbox{\vrule
+ \@height \arraystretch \@tempdima
+ \@depth \arraystretch \dp \strutbox
+ \@width \z@}%
+ \let\@sharp##\let\protect\relax
+ \begingroup
+ \@mkpream{#2}%
+ \xdef\LT@bchunk{%
+ \global\advance\c@LT@chunks\@ne
+ \global\LT@rows\z@\setbox\z@\vbox\bgroup
+ \LT@setprevdepth
+ \tabskip\LTleft \noexpand\halign to\hsize\bgroup
+ \tabskip\z@ \@arstrut \@preamble \tabskip\LTright \cr}%
+ \endgroup
+ \expandafter\LT@nofcols\LT@bchunk&\LT@nofcols
+ \LT@make@row
+ \m@th\let\par\@empty
+ \everycr{}\lineskip\z@\baselineskip\z@
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \LT@bchunk}
+
+\def\endlongtable{%
+ \crcr
+ \noalign{%
+ \let\LT@entry\LT@entry@chop
+ \xdef\LT@save@row{\LT@save@row}}%
+ \LT@echunk
+ \LT@start
+ \unvbox\z@
+ \LT@get@widths
+ \if@filesw
+ {\let\LT@entry\LT@entry@write\immediate\write\@auxout{%
+ \gdef\expandafter\noexpand
+ \csname LT@\romannumeral\c@LT@tables\endcsname
+ {\LT@save@row}}}%
+ \fi
+ \ifx\LT@save@row\LT@@save@row
+ \else
+ \LT@warn{Column \@width s have changed\MessageBreak
+ in table \thetable}%
+ \LT@final@warn
+ \fi
+ \endgraf\penalty -\LT@end@pen
+ \if@RTLtab\egroup\endR\egroup\fi
+ \if@RTLtab\endR\fi \endgroup
+ \global\@mparbottom\z@
+ \pagegoal\vsize
+ \endgraf\penalty\z@\addvspace\LTpost
+ \ifvoid\footins\else\insert\footins{}\fi
+ \global\@RTLtabfalse}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `longtable-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/minitoc-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/minitoc-bidi.def
new file mode 100644
index 00000000000..f0166ce23bf
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/minitoc-bidi.def
@@ -0,0 +1,66 @@
+%%
+%% This is file `minitoc-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `minitoc-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@undottedtocline#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth\relax \else
+ \vskip \z@ plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \hbox{}%
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ #4\nobreak\hfill \nobreak
+ \null\par}%
+ \fi}
+\def\@Undottedtocline#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth\relax \else
+ \vskip \z@ \@plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\coffeefont #4}\nobreak \nobreak\null
+ \par}%
+ \fi}
+\def\@Undottedtoclinep#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth\relax \else
+ \vskip \z@ \@plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {#4}\nobreak \hfill \nobreak\null
+ \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor #5}%
+ \par}%
+ \fi}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `minitoc-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/pdfpages-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/pdfpages-bidi.def
new file mode 100644
index 00000000000..ff5a928b915
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/pdfpages-bidi.def
@@ -0,0 +1,76 @@
+%%
+%% This is file `pdfpages-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `pdfpages-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*{\includepdf}[2][]{%
+ \begingroup
+ \@RTLfalse
+ \let\AM@threadname\relax
+ \AM@split@options{pdfpages}{#1}%
+ \edef\AM@temp{{pdfpages}{\the\@temptokena}}%
+ \expandafter\setkeys\AM@temp
+ \ifthenelse{\boolean{AM@pkg@draft} \and \boolean{AM@survey}}{%
+ \let\AM@currentdocname\relax
+ \renewcommand\includegraphics[2][]{Survey in draft-mode}%
+ \def\AM@pagecount{0}%
+ }{%
+ \AM@findfile{#2}%
+ \if\AM@threadname\relax
+ \def\AM@threadname{\AM@currentdocname}%
+ \fi
+ }%
+ \ifAM@survey
+ \def\AM@pagestemp{}%
+ \@tempcnta=0
+ \def\foo{%
+ \@ifundefined{r@\AM@xrprefix pdfpages@page\the\@tempcnta}%
+ {\let\foo\relax}
+ {\expandafter\ifx\expandafter\\\AM@pagestemp\\
+ \edef\AM@pagestemp{%
+ \AM@pageref{\AM@xrprefix pdfpages@page\the\@tempcnta}}%
+ \else
+ \edef\AM@pagestemp{\AM@pagestemp,%
+ \AM@pageref{\AM@xrprefix pdfpages@page\the\@tempcnta}}%
+ \fi
+ \advance\@tempcnta 1\relax
+ }%
+ \foo
+ }%
+ \foo
+ \expandafter\ifx\expandafter\\\AM@pagestemp\\
+ \def\AM@pagestemp{1}%
+ \fi
+ \fi
+ \ifAM@output
+ \expandafter\AM@readlist\expandafter{\AM@pagestemp}%
+ \AM@output{#1}%
+ \fi
+ \AM@CheckAtEnd
+ \endgroup
+ \AM@ClearShipoutPicture
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `pdfpages-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/pstricks-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/pstricks-bidi.def
new file mode 100644
index 00000000000..1b74ae9d0ca
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/pstricks-bidi.def
@@ -0,0 +1,30 @@
+%%
+%% This is file `pstricks-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `pstricks-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\pspicture{\begingroup\@RTLfalse\pst@ifstar\pst@picture}%
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `pstricks-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/ragged2e-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/ragged2e-bidi.def
new file mode 100644
index 00000000000..48feca2db03
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/ragged2e-bidi.def
@@ -0,0 +1,114 @@
+%%
+%% This is file `ragged2e-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `ragged2e-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand{\Centering}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\CenteringLeftskip
+ \@rightskip\CenteringRightskip
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\CenteringParfillskip
+ \parindent\CenteringParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand{\RaggedLeft}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\RaggedLeftLeftskip
+ \@rightskip\RaggedLeftRightskip
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\RaggedLeftParfillskip
+ \parindent\RaggedLeftParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand{\RaggedRight}{%
+ \ifx\\\@raggedtwoe@savedcr
+ \let\\\@centercr
+ \fi
+ \let\@gnewline\@raggedtwoe@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\RaggedRightLeftskip
+ \@rightskip\RaggedRightRightskip
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\RaggedRightParfillskip
+ \parindent\RaggedRightParindent
+ \@raggedtwoe@spaceskiptrue
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand{\justifying}{%
+ \let\\\@raggedtwoe@savedcr
+ \let\@gnewline\@raggedtwoe@saved@gnewline
+ \if@RTL\rightskip\else\leftskip\fi\z@
+ \@rightskip\z@
+ \if@RTL\leftskip\else\rightskip\fi\@rightskip
+ \parfillskip\JustifyingParfillskip
+ \parindent\JustifyingParindent
+ \@raggedtwoe@spaceskipfalse
+ \@raggedtwoe@everyselectfont
+ }
+\renewcommand*{\@raggedtwoe@raggedrightboxes@opt}{
+ \CheckCommand*{\@arrayparboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parindent\z@ \parskip\z@skip
+ \everypar{}%
+ \linewidth\hsize
+ \@totalleftmargin\z@
+ \if@RTL\rightskip\else\leftskip\fi\z@skip \if@RTL\leftskip\else\rightskip\fi\z@skip \@rightskip\z@skip
+ \parfillskip\@flushglue \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy}%
+ \renewcommand{\@arrayparboxrestore}{%
+ \let\if@nobreak\iffalse
+ \let\if@noskipsec\iffalse
+ \let\par\@@par
+ \let\-\@dischyph
+ \let\'\@acci\let\`\@accii\let\=\@acciii
+ \parskip\z@skip
+ \everypar{}%
+ \linewidth\hsize
+ \@totalleftmargin\z@
+ \RaggedRight
+ \lineskip\normallineskip
+ \baselineskip\normalbaselineskip
+ \sloppy}%
+ \let\@raggedtwoe@raggedrightboxes@opt\relax
+ }
+\let\origin@RaggedLeft=\RaggedLeft
+\let\origin@RaggedRight=\RaggedRight
+\def\RaggedLeft{\if@RTL\origin@RaggedRight\else\origin@RaggedLeft\fi}
+\def\RaggedRight{\if@RTL\origin@RaggedLeft\else\origin@RaggedRight\fi}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `ragged2e-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/rapport3-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/rapport3-bidi.def
new file mode 100644
index 00000000000..cde23698756
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/rapport3-bidi.def
@@ -0,0 +1,119 @@
+%%
+%% This is file `rapport3-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `rapport3-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\@regtocline[3]{%
+ \ifnum #1>\c@tocdepth
+ \else
+ \vskip\z@\@plus.2\p@
+ {\hangindent\z@ \@afterindenttrue \interlinepenalty\@M
+ \if@RTL\rightskip\else\leftskip\fi\unitindent
+ \if@RTL\leftskip\else\rightskip\fi\unitindent\@plus 1fil
+ \parfillskip\z@
+ \@tempdima\unitindent
+ \parindent\z@
+ \leavevmode
+ \hbox{}\hskip -\if@RTL\rightskip\else\leftskip\fi\relax#2\nobreak
+ \hskip 1em \nobreak{\slshape #3}\par
+ }%
+ \fi}
+\if@oldtoc
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \setlength\@tempdima{3em}%
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\else
+ \renewcommand*\l@part{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus \p@}%
+ \@regtocline{0}%
+ \fi}
+\fi
+\if@oldtoc
+\renewcommand*\l@chapter[2]{%
+ \addpenalty{-\@highpenalty}%
+ \vskip 1.0em \@plus\p@
+ \setlength\@tempdima{1.5em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode \bfseries
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ #1\nobreak\hfil \nobreak\hb@xt@\@pnumwidth{\hss #2}\par
+ \penalty\@highpenalty
+ \endgroup}
+\else
+ \renewcommand*\l@chapter{\@regtocline{0}}
+\fi
+\renewcommand*\head@style{%
+ \interlinepenalty \@M
+ \hyphenpenalty=\@M \exhyphenpenalty=\@M
+ \if@RTL\leftskip\else\rightskip\fi=0cm plus .7\hsize\relax}
+\if@titlepage
+ \renewenvironment{abstract}{%
+ \titlepage
+ \null\vfil
+ \hbox{\SectFont \abstractname}
+ \noindent\ignorespaces}
+ {\par\vfil\null\endtitlepage}
+\else
+ \renewenvironment{abstract}{%
+ \if@twocolumn
+ \section*{\abstractname}%
+ \else
+ \small
+ \bgroup\if@RTL\leftskip\else\rightskip\fi=\unitindent
+ \hbox{\SectFont \abstractname}%
+ \noindent\ignorespaces
+ \fi}
+ {\if@twocolumn\else\par\egroup\fi}
+\fi
+\renewcommand*\thesection{\thechapter\@SepMark\@arabic\c@section}
+\renewcommand*\thesubsection{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*\thesubsubsection{\thesubsection\@SepMark\@arabic\c@subsubsection}
+\renewcommand*\theparagraph{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*\thesubparagraph{\theparagraph\@SepMark\@arabic\c@subparagraph}
+\renewcommand*\thefigure{%
+ \ifnum\c@chapter>\z@\thechapter\@SepMark\fi\@arabic\c@figure}
+\renewcommand*\thetable{%
+ \ifnum\c@chapter>\z@\thechapter\@SepMark\fi\@arabic\c@table}
+\renewcommand*\theequation{%
+ \ifnum \c@chapter>\z@ \thechapter\@SepMark\fi\@arabic\c@equation}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `rapport3-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/refrep-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/refrep-bidi.def
new file mode 100644
index 00000000000..609a6a46819
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/refrep-bidi.def
@@ -0,0 +1,54 @@
+%%
+%% This is file `refrep-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `refrep-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hbox to\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+{\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand\thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand\thetable%
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand\thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection {\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `refrep-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/report-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/report-bidi.def
new file mode 100644
index 00000000000..f833c54b770
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/report-bidi.def
@@ -0,0 +1,134 @@
+%%
+%% This is file `report-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `report-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength\@tempdima{3em}%
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ {\leavevmode
+ \large \bfseries #1\hfil \hb@xt@\@pnumwidth{\hss #2}}\par
+ \nobreak
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \endgroup
+ \fi}
+\renewcommand\theequation
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@equation}
+\renewcommand \thefigure
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@figure}
+\renewcommand \thetable
+ {\ifnum \c@chapter>\z@ \thechapter\@SepMark\fi \@arabic\c@table}
+\renewcommand \thechapter {\@arabic\c@chapter}
+\renewcommand \thesection {\thechapter\@SepMark\@arabic\c@section}
+\renewcommand\thesubsection {\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection \@SepMark\@arabic\c@subsubsection}
+\renewcommand\theparagraph {\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@SepMark\@arabic\c@subparagraph}
+\def\@makechapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft \normalfont
+ \ifnum \c@secnumdepth >\m@ne
+ \huge\bfseries \@chapapp\space \thechapter
+ \par\nobreak
+ \vskip 20\p@
+ \fi
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\def\@makeschapterhead#1{%
+ \vspace*{50\p@}%
+ {\parindent \z@ \raggedleft
+ \normalfont
+ \interlinepenalty\@M
+ \Huge \bfseries #1\par\nobreak
+ \vskip 40\p@
+ }}
+\renewenvironment{thebibliography}[1]
+ {\chapter*{\bibname}%
+ \@mkboth{\MakeUppercase\bibname}{\MakeUppercase\bibname}%
+ \list{\@biblabel{\@arabic\c@enumiv}}%
+ {\settowidth\labelwidth{\@biblabel{#1}}%
+ \rightmargin\labelwidth
+ \advance\rightmargin\labelsep
+ \@openbib@code
+ \usecounter{enumiv}%
+ \let\p@enumiv\@empty
+ \renewcommand\theenumiv{\@arabic\c@enumiv}}%
+ \sloppy
+ \clubpenalty4000
+ \@clubpenalty \clubpenalty
+ \widowpenalty4000%
+ \sfcode`\.\@m}
+ {\def\@noitemerr
+ {\@latex@warning{Empty `thebibliography' environment}}%
+ \endlist}
+\if@twoside
+ \def\ps@headings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markboth {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \beginR\@chapapp\ \thechapter. \ \endR%
+ \fi
+ \beginR##1\endR}}{}}%
+ \def\sectionmark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\z@
+ \beginR\thesection. \ \endR%
+ \fi
+ \beginR##1\endR}}}}
+\else
+ \def\ps@headings{%
+ \let\@oddfoot\@empty
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\markboth
+ \def\chaptermark##1{%
+ \markright {\MakeUppercase{%
+ \ifnum \c@secnumdepth >\m@ne
+ \beginR\@chapapp\ \thechapter. \ \endR%
+ \fi
+ \beginR##1\endR}}}}
+\fi
+\def\ps@myheadings{%
+ \let\@oddfoot\@empty\let\@evenfoot\@empty
+ \def\@evenhead{\sl\thepage\hfil\beginR\leftmark\endR}%
+ \def\@oddhead{\sl\beginR\rightmark\endR\hfil\thepage}%
+ \let\@mkboth\@gobbletwo
+ \let\chaptermark\@gobble
+ \let\sectionmark\@gobble
+ }
+\pagestyle{plain}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `report-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/scrartcl-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/scrartcl-bidi.def
new file mode 100644
index 00000000000..92e79307189
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/scrartcl-bidi.def
@@ -0,0 +1,102 @@
+%%
+%% This is file `scrartcl-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `scrartcl-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >\m@ne\relax
+ \addpenalty{\@secpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}%
+ \else
+ \penalty\@highpenalty
+ \fi
+ \endgroup
+ \fi
+ \fi
+}
+\renewcommand*\l@section[2]{%
+ \ifnum \c@tocdepth >\z@
+ \ifnum \lastpenalty<20009
+ \addpenalty{\@secpenalty}%
+ \fi
+ \addvspace{1.0em \@plus\p@}%
+ \setlength\@tempdima{1.5em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \raggedsectionentry
+ \parindent \z@ \advance\if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{sectionentry}{#1\nobreak
+ \usekomafont{sectionentrypagenumber}{%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \endgroup
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \penalty20008
+ \fi
+ \fi
+}
+\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
+\def\raggedpart{\if@RTL\raggedleft\else\raggedright\fi}
+\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
+\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection
+}
+\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `scrartcl-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/scrbook-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/scrbook-bidi.def
new file mode 100644
index 00000000000..740469b9f3c
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/scrbook-bidi.def
@@ -0,0 +1,158 @@
+%%
+%% This is file `scrbook-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `scrbook-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\renewcommand*\l@chapter[2]{%
+ \ifnum \c@tocdepth >\m@ne
+ \ifnum \lastpenalty<20010
+ \addpenalty{-\@highpenalty}%
+ \fi
+ \vskip 1.0em \@plus\p@
+ \setlength\@tempdima{1.5em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \raggedchapterentry
+ \parindent \z@ \advance\if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{chapterentry}{#1\nobreak
+ \usekomafont{chapterentrypagenumber}{%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20009
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
+\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
+\renewcommand*\thesection{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@section
+}
+\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection
+}
+\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph
+}
+\renewcommand*\thefigure{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@figure
+}
+\renewcommand*\thetable{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@table
+}
+\renewcommand*\theequation{%
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.97d}\relax
+ \if@mainmatter\thechapter\@SepMark\fi
+ \else
+ \thechapter\@SepMark%
+ \fi
+ \@arabic\c@equation
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `scrbook-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/scrreprt-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/scrreprt-bidi.def
new file mode 100644
index 00000000000..338d43229d2
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/scrreprt-bidi.def
@@ -0,0 +1,115 @@
+%%
+%% This is file `scrreprt-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `scrreprt-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*\l@part[2]{%
+ \ifnum \c@tocdepth >-2\relax
+ \addpenalty{-\@highpenalty}%
+ \addvspace{2.25em \@plus\p@}%
+ \setlength{\@tempdima}{2em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \parindent \z@ \if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{partentry}{#1\nobreak
+ \usekomafont{partentrypagenumber}{\hfil\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20010
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\renewcommand*\l@chapter[2]{%
+ \ifnum \c@tocdepth >\m@ne
+ \ifnum \lastpenalty<20010
+ \addpenalty{-\@highpenalty}%
+ \fi
+ \vskip 1.0em \@plus\p@
+ \setlength\@tempdima{1.5em}%
+ \if@tocleft
+ \ifx\toc@l@number\@empty\else
+ \setlength\@tempdima{0\toc@l@number}%
+ \fi
+ \fi
+ \begingroup
+ \raggedchapterentry
+ \parindent \z@ \advance\if@RTL\leftskip\else\rightskip\fi \@pnumwidth
+ \parfillskip -\@pnumwidth
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ \usekomafont{chapterentry}{#1\nobreak
+ \usekomafont{chapterentrypagenumber}{%
+ \hfill\nobreak
+ \hb@xt@\@pnumwidth{\hss#2}}}\par
+ \ifnum \scr@compatibility>\@nameuse{scr@v@2.96}\relax
+ \endgroup
+ \penalty20009
+ \else
+ \penalty\@highpenalty
+ \endgroup
+ \fi
+ \fi
+}
+\def\raggedsection{\if@RTL\raggedleft\else\raggedright\fi}
+\renewcommand*\autodot{\if@altsecnumformat\@SepMark\fi}
+\renewcommand*\thesection{%
+ \thechapter\@SepMark%
+ \@arabic\c@section
+}
+\renewcommand*{\thesubsection}{\thesection\@SepMark\@arabic\c@subsection}
+\renewcommand*{\thesubsubsection}{%
+ \thesubsection\@SepMark\@arabic\c@subsubsection
+}
+\renewcommand*{\theparagraph}{\thesubsubsection\@SepMark\@arabic\c@paragraph}
+\renewcommand*{\thesubparagraph}{%
+ \theparagraph\@SepMark\@arabic\c@subparagraph
+}
+\renewcommand*\thefigure{%
+ \thechapter\@SepMark%
+ \@arabic\c@figure
+}
+\renewcommand*\thetable{%
+ \thechapter\@SepMark%
+ \@arabic\c@table
+}
+\renewcommand*\theequation{%
+ \thechapter\@SepMark%
+ \@arabic\c@equation
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `scrreprt-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/stabular-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/stabular-bidi.def
new file mode 100644
index 00000000000..2a3dcf43115
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/stabular-bidi.def
@@ -0,0 +1,55 @@
+%%
+%% This is file `stabular-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `stabular-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\@stabular{\if@RTL\global\@RTLtabtrue\fi
+ \leavevmode \bgroup \if@RTLtab\beginR \fi
+ \let\@acol\@tabacol
+ \let\@classz\@tabclassz
+ \let\@classiv\@tabclassiv \let\\\@tabularcr\@stabarray}
+\def\endstabular{\crcr\egroup\if@RTLtab\egroup\endR\egroup\fi
+ \egroup \if@RTLtab\endR\fi\egroup
+ \global\@RTLtabfalse}
+\expandafter \let \csname endstabular*\endcsname = \endstabular
+\def\@sarray[#1]#2{%
+ \bgroup
+ \setbox\@arstrutbox\hbox{%
+ \vrule \@height\arraystretch\ht\strutbox
+ \@depth\arraystretch \dp\strutbox
+ \@width\z@}%
+ \@mkpream{#2}%
+ \edef\@preamble{%
+ \ialign \noexpand\@halignto
+ \bgroup \@arstrut \@preamble \tabskip\z@skip \cr}%
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \let\tabularnewline\\%
+ \let\@sharp##%
+ \set@typeset@protect
+ \lineskip\z@skip\baselineskip\z@skip
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `stabular-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/tabls-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/tabls-bidi.def
new file mode 100644
index 00000000000..63a4bf2d15f
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/tabls-bidi.def
@@ -0,0 +1,63 @@
+%%
+%% This is file `tabls-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `tabls-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\def\endtabular{\endarray $\if@RTLtab\endR\fi\egroup
+ \global\@RTLtabfalse}
+
+\expandafter\let\csname endtabular*\endcsname=\endtabular
+
+\def\endarray{\ifvmode\csname crcr\endcsname % just do \crcr if \\ given
+ \else \\[\z@ \global\advance\@arstdepth-\@otarlinesep]%
+ \fi\egroup\if@RTLtab\egroup\endR\egroup\fi\@unrecurse\egroup}
+
+\def\@array[#1]#2{% remember global variables to allow recursion:
+ \edef\@unrecurse{\global\@skip@bove\the\@skip@bove
+ \global\@arstheight\the\@arstheight\global\@arstdepth\the\@arstdepth}%
+ \let\@otarlinesep\@tarlinesep \global\@skip@bove-\@otarlinesep
+ \ifx\@classz\@arrayclassz \let\@tarlinesep\arraylinesep
+ \else \let\@tarlinesep\tablinesep \fi
+ \divide\@tarlinesep\tw@ % half sep is applied to height & depth
+ \let\@seesize\relax \let\@rememsize\relax \@mkpream{#2}%
+ \@tempdima\arraystretch\ht\strutbox \@tempdimb\arraystretch\dp\strutbox
+ \ifdim\@tarlinesep>\z@ % (need \protect for \multicolumn)
+ \def\@rememsize{\protect\@r@m@msize}\let\@seesize\@s@@size
+ \advance\@tempdima-\@tarlinesep \advance\@tempdimb-\@tarlinesep
+ \fi \setbox\@arstrutbox\hbox{% set up smaller strut
+ \vrule \@height\@tempdima \@depth\@tempdimb \@width\z@}%
+ \let\protect\noexpand
+ \edef\@preamble{\ialign \noexpand\@halignto \bgroup
+ \unhcopy\@arstrutbox \@preamble \tabskip\z@skip &\@sharp \cr}%
+ \let\@startpbox\@@startpbox \let\@endpbox\@@endpbox
+ \if#1t\vtop \else \if#1b\vbox \else \vcenter \fi\fi
+ \bgroup \let\par\@empty
+ \global\@arstheight\ht\@arstrutbox \global\@arstdepth\dp\@arstrutbox
+ \advance\extrarulesep.5\arrayrulewidth
+ \let\@sharp##\let\protect\relax \lineskip\z@skip \baselineskip\z@skip
+ \if@RTLtab\hbox\bgroup\beginR\vbox\bgroup\fi
+ \@preamble}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tabls-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/tikz-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/tikz-bidi.def
new file mode 100644
index 00000000000..47cf45e4839
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/tikz-bidi.def
@@ -0,0 +1,33 @@
+%%
+%% This is file `tikz-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `tikz-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\let\origin@tikzpicture=\tikzpicture
+\let\origin@endtikzpicture=\endtikzpicture
+\def\tikzpicture{\LTR\origin@tikzpicture}
+\def\endtikzpicture{\origin@endtikzpicture\endLTR}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tikz-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/tocloft-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/tocloft-bidi.def
new file mode 100644
index 00000000000..4d9801e230c
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/tocloft-bidi.def
@@ -0,0 +1,335 @@
+%%
+%% This is file `tocloft-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `tocloft-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\if@cfthaspart
+\renewcommand*{\l@part}[2]{
+ \@cftdopartfalse
+ \ifnum \c@tocdepth >-2\relax
+ \if@cfthaschapter
+ \@cftdoparttrue
+ \fi
+ \ifnum \c@tocdepth >\m@ne
+ \if@cfthaschapter\else
+ \@cftdoparttrue
+ \fi
+ \fi
+ \fi
+ \if@cftdopart
+ \if@cfthaschapter
+ \addpenalty{-\@highpenalty}
+ \else
+ \addpenalty\@secpenalty
+ \fi
+ \addvspace{\cftbeforepartskip}
+ \begingroup
+ {\if@RTL\rightskip\else\leftskip\fi \cftpartindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftpartindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftpartnumwidth\relax
+ \let\@cftbsnum \cftpartpresnum
+ \let\@cftasnum \cftpartaftersnum
+ \let\@cftasnumb \cftpartaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftpartfont \cftpartpresnum #1}
+ \cftpartfillnum{#2}}
+ \nobreak
+ \if@cfthaschapter
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}
+ \else
+ \if@compatibility
+ \global\@nobreaktrue
+ \everypar{\global\@nobreakfalse\everypar{}}
+ \fi
+ \fi
+ \endgroup
+ \fi}
+\fi
+\if@cfthaschapter
+\renewcommand*{\l@chapter}[2]{
+ \ifnum \c@tocdepth >\m@ne
+ \addpenalty{-\@highpenalty}
+ \vskip \cftbeforechapskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftchapindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftchapindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftchapnumwidth\relax
+ \let\@cftbsnum \cftchappresnum
+ \let\@cftasnum \cftchapaftersnum
+ \let\@cftasnumb \cftchapaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftchapfont #1}\nobreak
+ \cftchapfillnum{#2}}
+ \fi}
+\fi
+\renewcommand*{\l@section}[2]{%
+ \ifnum \c@tocdepth >\z@
+ \if@cfthaschapter
+ \vskip \cftbeforesecskip
+ \else
+ \addpenalty\@secpenalty
+ \addvspace{\cftbeforesecskip}
+ \fi
+ {\if@RTL\rightskip\else\leftskip\fi \cftsecindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsecindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsecnumwidth\relax
+ \let\@cftbsnum \cftsecpresnum
+ \let\@cftasnum \cftsecaftersnum
+ \let\@cftasnumb \cftsecaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsecfont #1}\nobreak
+ \cftsecfillnum{#2}}
+ \fi}
+\renewcommand*{\l@subsection}[2]{%
+ \ifnum \c@tocdepth >\@ne
+ \vskip \cftbeforesubsecskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubsecindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubsecindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubsecnumwidth\relax
+ \let\@cftbsnum \cftsubsecpresnum
+ \let\@cftasnum \cftsubsecaftersnum
+ \let\@cftasnumb \cftsubsecaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubsecfont #1}\nobreak
+ \cftsubsecfillnum{#2}}
+ \fi}
+\renewcommand*{\l@subsubsection}[2]{%
+ \ifnum \c@tocdepth >\tw@
+ \vskip \cftbeforesubsubsecskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubsubsecindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubsubsecindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubsubsecnumwidth\relax
+ \let\@cftbsnum \cftsubsubsecpresnum
+ \let\@cftasnum \cftsubsubsecaftersnum
+ \let\@cftasnumb \cftsubsubsecaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubsubsecfont #1}\nobreak
+ \cftsubsubsecfillnum{#2}}
+ \fi}
+\renewcommand*{\l@paragraph}[2]{%
+ \ifnum \c@tocdepth >3\relax
+ \vskip \cftbeforeparaskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftparaindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftparaindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftparanumwidth\relax
+ \let\@cftbsnum \cftparapresnum
+ \let\@cftasnum \cftparaaftersnum
+ \let\@cftasnumb \cftparaaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftparafont #1}\nobreak
+ \cftparafillnum{#2}}
+ \fi}
+\renewcommand*{\l@subparagraph}[2]{%
+ \ifnum \c@tocdepth >4\relax
+ \vskip \cftbeforesubparaskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubparaindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubparaindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubparanumwidth\relax
+ \let\@cftbsnum \cftsubparapresnum
+ \let\@cftasnum \cftsubparaaftersnum
+ \let\@cftasnumb \cftsubparaaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubparafont #1}\nobreak
+ \cftsubparafillnum{#2}}
+ \fi}
+\renewcommand*{\l@figure}[2]{%
+ \ifnum \c@lofdepth >\z@
+ \vskip \cftbeforefigskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftfigindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftfignumwidth\relax
+ \let\@cftbsnum \cftfigpresnum
+ \let\@cftasnum \cftfigaftersnum
+ \let\@cftasnumb \cftfigaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftfigfont #1}\nobreak
+ \cftfigfillnum{#2}}
+ \fi
+ }
+\renewcommand*{\l@table}[2]{%
+ \ifnum\c@lotdepth >\z@
+ \vskip \cftbeforetabskip
+ {\if@RTL\rightskip\else\leftskip\fi \cfttabindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cfttabindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cfttabnumwidth\relax
+ \let\@cftbsnum \cfttabpresnum
+ \let\@cftasnum \cfttabaftersnum
+ \let\@cftasnumb \cfttabaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cfttabfont #1}\nobreak
+ \cfttabfillnum{#2}}
+ \fi
+ }
+\renewcommand{\@cftl@subfig}{
+\renewcommand*{\l@subfigure}[2]{%
+ \ifnum \c@lofdepth > \toclevel@subfigure
+ \vskip \cftbeforesubfigskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubfigindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubfigindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubfignumwidth\relax
+ \let\@cftbsnum \cftsubfigpresnum
+ \let\@cftasnum \cftsubfigaftersnum
+ \let\@cftasnumb \cftsubfigaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubfigfont ##1}\nobreak
+ \cftsubfigfillnum{##2}}
+ \fi
+ }
+}
+\renewcommand{\@cftl@subtab}{
+\renewcommand*{\l@subtable}[2]{%
+ \ifnum \c@lotdepth > \toclevel@subtable
+ \vskip \cftbeforesubtabskip
+ {\if@RTL\rightskip\else\leftskip\fi \cftsubtabindent\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \cftsubtabindent\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \cftsubtabnumwidth\relax
+ \let\@cftbsnum \cftsubtabpresnum
+ \let\@cftasnum \cftsubtabaftersnum
+ \let\@cftasnumb \cftsubtabaftersnumb
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\cftsubtabfont ##1}\nobreak
+ \cftsubtabfillnum{##2}}
+ \fi
+ }
+}
+\renewcommand{\newlistentry}[4][\@empty]{%
+ \@ifundefined{c@#2}{% check & set the counter
+ \ifx \@empty#1\relax
+ \newcounter{#2}
+ \else
+ \@ifundefined{c@#1}{\PackageWarning{tocloft}%
+ {#1 has no counter for use as a `within'}
+ \newcounter{#2}}%
+ {\newcounter{#2}[#1]%
+ \expandafter\edef\csname the#2\endcsname{%
+ \expandafter\noexpand\csname the#1\endcsname.\noexpand\arabic{#2}}}
+ \fi
+ \setcounter{#2}{0}
+ }
+ {\PackageError{tocloft}{#2 has been previously defined}{\@eha}}
+
+ \@namedef{l@#2}##1##2{%
+ \ifnum \@nameuse{c@#3depth} > #4\relax
+ \vskip \@nameuse{cftbefore#2skip}
+ {\if@RTL\rightskip\else\leftskip\fi \@nameuse{cft#2indent}\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent \@nameuse{cft#2indent}\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima \@nameuse{cft#2numwidth}\relax
+ \expandafter\let\expandafter\@cftbsnum\csname cft#2presnum\endcsname
+ \expandafter\let\expandafter\@cftasnum\csname cft#2aftersnum\endcsname
+ \expandafter\let\expandafter\@cftasnumb\csname cft#2aftersnumb\endcsname
+ \advance\if@RTL\rightskip\else\leftskip\fi\@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {\@nameuse{cft#2font}##1}\nobreak
+ \@nameuse{cft#2fillnum}{##2}}
+ \fi
+ } % end of \l@#2
+
+ \expandafter\newlength\csname cftbefore#2skip\endcsname
+ \setlength{\@nameuse{cftbefore#2skip}}{\z@ \@plus .2\p@}
+ \expandafter\newlength\csname cft#2indent\endcsname
+ \expandafter\newlength\csname cft#2numwidth\endcsname
+ \ifcase #4\relax % 0
+ \setlength{\@nameuse{cft#2indent}}{0em}
+ \setlength{\@nameuse{cft#2numwidth}}{1.5em}
+ \or % 1
+ \setlength{\@nameuse{cft#2indent}}{1.5em}
+ \setlength{\@nameuse{cft#2numwidth}}{2.3em}
+ \or % 2
+ \setlength{\@nameuse{cft#2indent}}{3.8em}
+ \setlength{\@nameuse{cft#2numwidth}}{3.2em}
+ \or % 3
+ \setlength{\@nameuse{cft#2indent}}{7.0em}
+ \setlength{\@nameuse{cft#2numwidth}}{4.1em}
+ \else % anything else
+ \setlength{\@nameuse{cft#2indent}}{10.0em}
+ \setlength{\@nameuse{cft#2numwidth}}{5.0em}
+ \fi
+ \@namedef{cft#2font}{\normalfont}
+ \@namedef{cft#2presnum}{}
+ \@namedef{cft#2aftersnum}{}
+ \@namedef{cft#2aftersnumb}{}
+ \@namedef{cft#2dotsep}{\cftdotsep}
+ \@namedef{cft#2leader}{\normalfont\cftdotfill{\@nameuse{cft#2dotsep}}}
+ \@namedef{cft#2pagefont}{\normalfont}
+ \@namedef{cft#2afterpnum}{}
+ \@namedef{toclevel@#2}{#4}
+ \@namedef{cft#2fillnum}##1{%
+ {\@nameuse{cft#2leader}}\nobreak
+ \hb@xt@\@pnumwidth{\hfil\@nameuse{cft#2pagefont}##1}\@nameuse{cft#2afterpnum}\par}
+} % end \newlistentry
+\renewcommand{\cftchapterprecistoc}[1]{\addtocontents{toc}{%
+ {\if@RTL\rightskip\else\leftskip\fi \cftchapindent\relax
+ \advance\if@RTL\righskip\else\leftskip\fi \cftchapnumwidth\relax
+ \if@RTL\leftskip\else\rightskip\fi \@tocrmarg\relax
+ \textit{#1}\protect\par}}}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tocloft-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/tocstyle-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/tocstyle-bidi.def
new file mode 100644
index 00000000000..b83aaa7c0eb
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/tocstyle-bidi.def
@@ -0,0 +1,274 @@
+%%
+%% This is file `tocstyle-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `tocstyle-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\renewcommand*{\tocstyle@dottedtocline}[5]{%
+ \let\numberline\tocstyle@numberline
+ \ifnum #1>\c@tocdepth \else
+ \if@tocstyle@penalties
+ \begingroup
+ \@tempcnta 20010
+ \advance \@tempcnta by -#1
+ \ifnum \@tempcnta>\lastpenalty
+ \aftergroup\penalty\aftergroup\@lowpenalty
+ \fi
+ \endgroup
+ \fi
+ \edef\tocstyledepth{#1}%
+ \tocstyle@activate@features
+ \ifx\tocstyle@feature@entryvskip\relax
+ \vskip \z@ \@plus.2\p@
+ \else
+ \addvspace{\tocstyle@feature@entryvskip}%
+ \fi
+ {%
+ \parskip \z@ \parindent \z@ \if@RTL\rightskip\else\leftskip\fi \z@ \if@RTL\leftskip\else\rightskip\fi \z@
+ \tocstyle@feature@raggedhook
+ \@tempdima #3\relax
+ \@tempdimb #2\relax
+ \typeout{m (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+ \ifnum #1>\z@\relax
+ \@tempcnta #1\relax \advance\@tempcnta \m@ne
+ \ifcsname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \ifcsname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \@tempdimb
+ \csname tocstyle@skipwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \advance\@tempdimb
+ \csname tocstyle@numwidth@\tocstyleTOC @\the\@tempcnta\endcsname
+ \fi
+ \fi
+ \fi
+ \typeout{C (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \ifcsname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname
+ \ifdim \@tempdimb>
+ \csname tocstyle@skipwidth@\tocstyleTOC @#1\endcsname\relax
+ \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
+ @#1\endcsname{\the\@tempdimb}%
+ \fi
+ \else
+ \expandafter\xdef\csname tocstyle@skipwidth@\tocstyleTOC
+ @#1\endcsname{\the\@tempdimb}%
+ \fi
+ \iftocstyle@autolength
+ \ifcsname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
+ \@tempdimb \csname tocstyle@maxskipwidth@\tocstyleTOC @#1\endcsname
+ \relax
+ \fi
+ \ifcsname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
+ \@tempdima \csname tocstyle@maxnumwidth@\tocstyleTOC @#1\endcsname
+ \relax
+ \fi
+ \typeout{a (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+ \typeout{A (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \else
+ \@tempdimb #2\relax
+ \typeout{M (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \fi
+ \ifcsname tocstyle@unumwidth@\tocstyleTOC @\endcsname
+ \ifdim \@tempdima>
+ \csname tocstyle@unumwidth@\tocstyleTOC @\endcsname\relax
+ \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
+ @\endcsname{\the\@tempdima}%
+ \fi
+ \else
+ \expandafter\xdef\csname tocstyle@unumwidth@\tocstyleTOC
+ @\endcsname{\the\@tempdima}%
+ \fi
+ \ifcase\tocstyle@indentstyle\relax\else
+ \@tempdimb \z@
+ \ifcsname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
+ \@tempdima \csname tocstyle@maxunumwidth@\tocstyleTOC @\endcsname
+ \relax
+ \fi
+ \typeout{s (\tocstyleTOC, \tocstyledepth): \the\@tempdima}%
+ \typeout{S (\tocstyleTOC, \tocstyledepth): \the\@tempdimb}%
+ \fi
+ \advance\parindent \@tempdimb\@afterindenttrue
+ \advance\if@RTL\rightskip\else\leftskip\fi \parindent
+ \advance\if@RTL\leftskip\else\rightskip\fi \@tocrmarg
+ \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \ifx\tocstyle@feature@parfillskip\relax\else
+ \advance\parfillskip \tocstyle@feature@parfillskip\relax
+ \fi
+ \interlinepenalty\@M
+ \leavevmode
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima
+ \null\nobreak
+ \iftocstyle@indentnotnumbered\else
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \fi
+ \tocstyle@feature@entryhook
+ {#4}\nobreak
+ \ifx\tocstyle@feature@leaders\relax
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{\tocstyle@feature@dothook .}%
+ \mkern \@dotsep mu$}\hfill
+ \else
+ \tocstyle@feature@leaders
+ \fi
+ \nobreak
+ \ifx\tocstyle@feature@pagenumberbox\relax
+ \hb@xt@\@pnumwidth{\hfil\tocstyle@feature@pagenumberhook #5}%
+ \else
+ \tocstyle@feature@pagenumberbox{\tocstyle@feature@pagenumberhook #5}%
+ \fi
+ \par
+ }%
+ \if@tocstyle@penalties
+ \bgroup
+ \@tempcnta 20009
+ \advance\@tempcnta by -#1
+ \edef\reserved@a{\egroup\penalty\the\@tempcnta\relax}%
+ \reserved@a
+ \fi
+ \fi}
+\renewcommand*{\tocstyle@numberline}[1]{%
+ \begingroup
+ \ifx\tocstyle@feature@spaceafternumber\relax
+ \settowidth\@tempdima{\tocstyle@@numberline{#1}\enskip}%
+ \else
+ \settowidth\@tempdima{\tocstyle@@numberline{#1}}%
+ \advance \@tempdima \tocstyle@feature@spaceafternumber\relax
+ \fi
+ \ifcsname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname
+ \ifdim \@tempdima >
+ \csname tocstyle@numwidth@\tocstyleTOC @\tocstyledepth\endcsname\relax
+ \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
+ @\tocstyledepth\endcsname{\the\@tempdima}%
+ \fi
+ \else
+ \expandafter\xdef\csname tocstyle@numwidth@\tocstyleTOC
+ @\tocstyledepth\endcsname{\the\@tempdima}%
+ \fi
+ \endgroup
+ \iftocstyle@indentnotnumbered
+ \hskip -\if@RTL\rightskip\else\leftskip\fi
+ \fi
+ \ifcase \tocstyle@indentstyle
+ \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
+ \or
+ \hb@xt@\@tempdima{\tocstyle@@numberline{#1}\hfil}%
+ \else
+ \ifx\tocstyle@feature@spaceafternumber\relax
+ \hbox{\tocstyle@@numberline{#1}\enskip}%
+ \else
+ \hbox{\tocstyle@@numberline{#1}\hskip
+ \tocstyle@feature@spaceafternumber\relax}%
+ \fi
+ \fi
+}
+\AtBeginDocument{%
+ \ifcsname l@part\endcsname
+ \ifcsname l@chapter\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@part{\tocstyle@l@define{part}{-1}}{}}%
+ \else
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@part{\tocstyle@l@define{part}{0}}{}}%
+ \fi
+ \fi
+ \ifcsname l@chapter\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@chapter{\tocstyle@l@define{chapter}{0}}{}}%
+ \fi
+ \ifcsname l@section\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@section{\tocstyle@l@define{section}{1}}{}}%
+ \fi
+ \ifcsname l@subsection\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@subsection{\tocstyle@l@define{subsection}{2}}{}}%
+ \fi
+ \ifcsname l@subsubsection\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@subsubsection{\tocstyle@l@define{subsubsection}{3}}{}}%
+ \fi
+ \ifcsname l@paragraph\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@paragraph{\tocstyle@l@define{paragraph}{4}}{}}%
+ \fi
+ \ifcsname l@subparagraph\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@subparagraph{\tocstyle@l@define{subparagraph}{5}}{}}%
+ \fi
+ \ifcsname l@table\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@table{\tocstyle@l@define{table}{1}}{}}%
+ \fi
+ \ifcsname l@figure\endcsname
+ \setbox\@tempboxa\vbox{\hsize\maxdimen
+ \l@figure{\tocstyle@l@define{figure}{1}}{}}%
+ \fi
+ \def\@tempa#1#2#3#4#5{%
+ \ifnum #1>\c@tocdepth \else
+ \vskip \z@ \@plus.2\p@
+ {\if@RTL\rightskip\else\leftskip\fi #2\relax \if@RTL\leftskip\else\rightskip\fi \@tocrmarg \parfillskip -\if@RTL\leftskip\else\rightskip\fi
+ \parindent #2\relax\@afterindenttrue
+ \interlinepenalty\@M
+ \leavevmode
+ \@tempdima #3\relax
+ \advance\if@RTL\rightskip\else\leftskip\fi \@tempdima \null\nobreak\hskip -\if@RTL\rightskip\else\leftskip\fi
+ {#4}\nobreak
+ \leaders\hbox{$\m@th
+ \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
+ mu$}\hfill
+ \nobreak
+ \hb@xt@\@pnumwidth{\hfil \normalfont \normalcolor #5}%
+ \par}%
+ \fi}%
+ \ifx\@dottedtocline\@tempa\else
+ \tocstyle@macrochangewarning\@dottedtocline
+ \fi
+ \let\tocstyle@saved@dottedtocline\@dottedtocline
+ \def\@tempa#1{\hb@xt@\@tempdima{#1\autodot\hfil}}%
+ \ifx\numberline\@tempa\else
+ \def\@tempa#1{\hb@xt@\@tempdima{#1\hfil}}%
+ \ifx\numberline@tempa\else
+ \tocstyle@macrochangewarning\numberline
+ \fi
+ \fi
+ \let\tocstyle@saved@numberline\numberline
+}
+\renewcommand*{\tocstyle@l@define}[2]{%
+ \advance\if@RTL\rightskip\else\leftskip\fi-\@tempdima
+ \edef\@tempa{%
+ \noexpand\global\noexpand\let
+ \expandafter\noexpand\csname tocstyle@saved@l@#1\endcsname
+ \expandafter\noexpand\csname l@#1\endcsname
+ \noexpand\gdef
+ \expandafter\noexpand\csname tocstyle@l@#1\endcsname{%
+ \noexpand\@dottedtocline{#2}{\the\if@RTL\rightskip\else\leftskip\fi}{\the\@tempdima}}%
+ \noexpand\g@addto@macro\noexpand\tocstyle@activate@all@l{%
+ \noexpand\let\expandafter\noexpand\csname l@#1\endcsname
+ \expandafter\noexpand\csname tocstyle@l@#1\endcsname
+ }%
+ }%
+ \PackageInfo{tocstyle}{prepare \expandafter\string
+ \csname l@#1\endcsname\space for redefinition}%
+ \@tempa
+}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `tocstyle-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/wrapfig-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/wrapfig-bidi.def
new file mode 100644
index 00000000000..8ee58c0a467
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/wrapfig-bidi.def
@@ -0,0 +1,104 @@
+%%
+%% This is file `wrapfig-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `wrapfig-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\let\WF@@everypar\n@everypar
+\def\WF@putfigmaybe{%
+\ifinner
+ \vskip-\parskip \global\WF@floatfalse
+ \let\pagetotal\maxdimen % kludge flag for "not top of page"
+\else % outer page
+ \@tempdima\pagedepth % save page depth
+ {\advance\parskip\if@RTL\@tempdimb\else\@tempdima\fi\vskip-\parskip}% back up to baseline
+ \penalty\interlinepenalty % update pg. parameters
+ \@tempdimb\pagegoal \advance\@tempdimb-\pagetotal % room left on page
+ \ifdim\@tempdimb<\z@ % \WF@info{Page overfull already;}%
+ \global\WF@floatfalse
+ \ifdim-\@tempdimb>\pageshrink \else \pagebreak \fi
+ \else
+ \ifdim\WF@size>\@tempdimb
+ \ifWF@float \dimen@.5\baselineskip \else \dimen@ 2\baselineskip\fi
+ \ifdim\pagestretch>\dimen@ \dimen@\pagestretch \fi
+ \ifdim\pagefilstretch>\z@ \dimen@\@tempdimb \fi
+ \ifdim\pagefillstretch>\z@ \dimen@\@tempdimb \fi
+ \advance\dimen@.5\baselineskip
+ \ifdim\dimen@>\@tempdimb % \WF@info{Page nearly full; can stretch}%
+ \global\WF@floatfalse \pagebreak
+ \fi
+ \else % \WF@info{Fits in \the\@tempdimb;}%
+ \global\WF@floatfalse
+ \fi\fi
+ \vskip\@tempdima\relax % (return erased page depth)
+\fi
+\noindent
+\ifWF@float
+ \WF@fltmes
+\else % putting here;
+ \WF@info{Put \WF@wfname here:}%
+ {\ifodd\if@twoside\c@page\else\@ne\fi % assign l/r to i/o placement
+ \lccode`i`l\lccode`o`r\else \lccode`i`r\lccode`o`l\fi
+ \xdef\WF@place{\the\lccode\lccode\WF@place}}% twice to get only l or r
+ \hbox to\z@{% llap or rlap depending on {l} or {r}; calc effective width
+ \@tempdima\wd\WF@box \@tempdimb\WF@ovh
+ \advance\@tempdima-\@tempdimb \advance\@tempdima\columnsep
+ \@tempdimb\hsize \advance\@tempdimb-\@tempdima
+ \xdef\WF@adjlw{\the\@tempdima}%
+ \ifnum `l=\WF@place % fig on left
+ \if@RTL%
+ \kern\@tempdimb \kern\columnsep
+ \def\@tempa{\hss}% position to left of the gap
+ \else%
+ \hss % figure overlaps space to the left
+ \def\@tempa{\kern\columnsep}% position to left of the gap
+ \fi%
+ \else % fig on right
+ \if@RTL%
+ \hss
+ \@tempdima\z@
+ \def\@tempa{\kern\columnsep}
+ \else%
+ \@tempdima\z@ % no left indentation
+ \kern\@tempdimb \kern\columnsep
+ \def\@tempa{\hss}% figure overlaps space to the right
+ \fi%
+ \fi
+ \ifdim\@tempdimb<\hsize
+ \xdef\WF@wrapil{\the\@tempdima \the\@tempdimb}% indentation and length
+ \xdef\WF@adjtlm{\the\@tempdima}%
+ \else
+ \xdef\WF@wrapil{\z@ \the\hsize}%
+ \xdef\WF@adjlw{\z@}\xdef\WF@adjtlm{\z@}%
+ \fi
+ \ifdim\pagetotal=\z@ % \WF@info{Put \WF@wfname at top of p.\thepage}%
+ \global\advance\WF@size-\intextsep
+ \else % \WF@info{Putting \WF@wfname in middle of page}%
+ \setbox\WF@box\hbox{\lower\intextsep\box\WF@box}%
+ \fi \dp\WF@box\z@ \box\WF@box \@tempa
+ }% end \hbox to 0pt
+ \aftergroup\WF@startwrapping % after the \endgroup which immediately follows
+\fi}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `wrapfig-bidi.def'.
diff --git a/Master/texmf-dist/tex/xelatex/bidi/xltxtra-bidi.def b/Master/texmf-dist/tex/xelatex/bidi/xltxtra-bidi.def
new file mode 100644
index 00000000000..0f7ac55e696
--- /dev/null
+++ b/Master/texmf-dist/tex/xelatex/bidi/xltxtra-bidi.def
@@ -0,0 +1,33 @@
+%%
+%% This is file `xltxtra-bidi.def',
+%% generated with the docstrip utility.
+%%
+%% The original source files were:
+%%
+%% bidi.dtx (with options: `xltxtra-bidi.def')
+%%
+%% __________________________________
+%% Copyright © 2009 Vafa Khalighi
+%%
+%% License information appended.
+%%
+%%
+\let\@@XeTeX\XeTeX
+\def\XeTeX{\@ensure@LTR{\@@XeTeX}}
+\let\@@XeLaTeX\XeLaTeX
+\def\XeLaTeX{\@ensure@LTR{\@@XeLaTeX}}
+%%
+%% Copyright © 2009 by Vafa Khalighi <vafa@users.berlios.de>
+%%
+%% Distributable under the LaTeX Project Public License,
+%% version 1.3c or higher (your choice). The latest version of
+%% this license is at: http://www.latex-project.org/lppl.txt
+%%
+%% This work is "maintained" (as per LPPL maintenance status)
+%% by Vafa Khalighi.
+%%
+%%
+%%
+%%
+%%
+%% End of file `xltxtra-bidi.def'.