]> granicus.if.org Git - re2c/commitdiff
Added first part of TDFA paper v2.
authorUlya Trofimovich <skvadrik@gmail.com>
Thu, 24 May 2018 22:44:23 +0000 (23:44 +0100)
committerUlya Trofimovich <skvadrik@gmail.com>
Thu, 24 May 2018 22:44:23 +0000 (23:44 +0100)
re2c/doc/tdfa_v2/Makefile [new file with mode: 0644]
re2c/doc/tdfa_v2/NJDnatbib.sty [new file with mode: 0644]
re2c/doc/tdfa_v2/TODO [new file with mode: 0644]
re2c/doc/tdfa_v2/WileyNJD-AMA.bst [new file with mode: 0644]
re2c/doc/tdfa_v2/WileyNJD-v2.cls [new file with mode: 0644]
re2c/doc/tdfa_v2/img/Makefile [new file with mode: 0644]
re2c/doc/tdfa_v2/img/gor1.tex [new file with mode: 0644]
re2c/doc/tdfa_v2/img/tnfa.tex [new file with mode: 0644]
re2c/doc/tdfa_v2/img/trees.tex [new file with mode: 0644]
re2c/doc/tdfa_v2/part_1_tnfa.tex [new file with mode: 0644]

diff --git a/re2c/doc/tdfa_v2/Makefile b/re2c/doc/tdfa_v2/Makefile
new file mode 100644 (file)
index 0000000..05b79dc
--- /dev/null
@@ -0,0 +1,10 @@
+%.pdf : %.tex
+       pdflatex -shell-escape $< </dev/null > $<.log
+#      bibtex $paper
+#      pdflatex -shell-escape $< </dev/null > $<.log
+#      pdflatex -shell-escape $< </dev/null > $<.log
+
+all : part_1_tnfa.pdf
+
+clean:
+       rm *.log *.aux *.pdf *.pag
diff --git a/re2c/doc/tdfa_v2/NJDnatbib.sty b/re2c/doc/tdfa_v2/NJDnatbib.sty
new file mode 100644 (file)
index 0000000..57b2ff6
--- /dev/null
@@ -0,0 +1,1262 @@
+%%\r
+%% This is file `NJDnatbib.sty',\r
+%% generated with the docstrip utility.\r
+%%\r
+%% The original source files were:\r
+%%\r
+%% natbib.dtx  (with options: `package,all')\r
+%% =============================================\r
+%% IMPORTANT NOTICE:\r
+%% \r
+%% This program can be redistributed and/or modified under the terms\r
+%% of the LaTeX Project Public License Distributed from CTAN\r
+%% archives in directory macros/latex/base/lppl.txt; either\r
+%% version 1 of the License, or any later version.\r
+%% \r
+%% This is a generated file.\r
+%% It may not be distributed without the original source file natbib.dtx.\r
+%% \r
+%% Full documentation can be obtained by LaTeXing that original file.\r
+%% Only a few abbreviated comments remain here to describe the usage.\r
+%% =============================================\r
+%% Copyright 1993-2010 Patrick W Daly\r
+%% Max-Planck-Institut f\"ur Sonnensystemforschung\r
+%% Max-Planck-Str. 2\r
+%% D-37191 Katlenburg-Lindau\r
+%% Germany\r
+%% E-mail: daly@mps.mpg.de\r
+\NeedsTeXFormat{LaTeX2e}[1995/06/01]\r
+\ProvidesPackage{NJDnatbib}\r
+        [2010/09/13 8.31b (PWD, AO)]\r
+\r
+ % This package reimplements the LaTeX \cite command to be used for various\r
+ % citation styles, both author-year and numerical. It accepts BibTeX\r
+ % output intended for many other packages, and therefore acts as a\r
+ % general, all-purpose citation-style interface.\r
+ %\r
+ % With standard numerical .bst files, only numerical citations are\r
+ % possible. With an author-year .bst file, both numerical and\r
+ % author-year citations are possible.\r
+ %\r
+ % If author-year citations are selected, \bibitem must have one of the\r
+ %   following forms:\r
+ %   \bibitem[Jones et al.(1990)]{key}...\r
+ %   \bibitem[Jones et al.(1990)Jones, Baker, and Williams]{key}...\r
+ %   \bibitem[Jones et al., 1990]{key}...\r
+ %   \bibitem[\protect\citeauthoryear{Jones, Baker, and Williams}{Jones\r
+ %       et al.}{1990}]{key}...\r
+ %   \bibitem[\protect\citeauthoryear{Jones et al.}{1990}]{key}...\r
+ %   \bibitem[\protect\astroncite{Jones et al.}{1990}]{key}...\r
+ %   \bibitem[\protect\citename{Jones et al., }1990]{key}...\r
+ %   \harvarditem[Jones et al.]{Jones, Baker, and Williams}{1990}{key}...\r
+ %\r
+ % This is either to be made up manually, or to be generated by an\r
+ % appropriate .bst file with BibTeX.\r
+ %                            Author-year mode     ||   Numerical mode\r
+ % Then, \citet{key}  ==>>  Jones et al. (1990)    ||   Jones et al. [21]\r
+ %       \citep{key}  ==>> (Jones et al., 1990)    ||   [21]\r
+ % Multiple citations as normal:\r
+ % \citep{key1,key2}  ==>> (Jones et al., 1990; Smith, 1989) || [21,24]\r
+ %                           or  (Jones et al., 1990, 1991)  || [21,24]\r
+ %                           or  (Jones et al., 1990a,b)     || [21,24]\r
+ % \cite{key} is the equivalent of \citet{key} in author-year mode\r
+ %                         and  of \citep{key} in numerical mode\r
+ % Full author lists may be forced with \citet* or \citep*, e.g.\r
+ %       \citep*{key}      ==>> (Jones, Baker, and Williams, 1990)\r
+ % Optional notes as:\r
+ %   \citep[chap. 2]{key}    ==>> (Jones et al., 1990, chap. 2)\r
+ %   \citep[e.g.,][]{key}    ==>> (e.g., Jones et al., 1990)\r
+ %   \citep[see][pg. 34]{key}==>> (see Jones et al., 1990, pg. 34)\r
+ %  (Note: in standard LaTeX, only one note is allowed, after the ref.\r
+ %   Here, one note is like the standard, two make pre- and post-notes.)\r
+ %   \citealt{key}          ==>> Jones et al. 1990\r
+ %   \citealt*{key}         ==>> Jones, Baker, and Williams 1990\r
+ %   \citealp{key}          ==>> Jones et al., 1990\r
+ %   \citealp*{key}         ==>> Jones, Baker, and Williams, 1990\r
+ % Additional citation possibilities (both author-year and numerical modes)\r
+ %   \citeauthor{key}       ==>> Jones et al.\r
+ %   \citeauthor*{key}      ==>> Jones, Baker, and Williams\r
+ %   \citeyear{key}         ==>> 1990\r
+ %   \citeyearpar{key}      ==>> (1990)\r
+ %   \citetext{priv. comm.} ==>> (priv. comm.)\r
+ %   \citenum{key}          ==>> 11 [non-superscripted]\r
+ % Note: full author lists depends on whether the bib style supports them;\r
+ %       if not, the abbreviated list is printed even when full requested.\r
+ %\r
+ % For names like della Robbia at the start of a sentence, use\r
+ %   \Citet{dRob98}         ==>> Della Robbia (1998)\r
+ %   \Citep{dRob98}         ==>> (Della Robbia, 1998)\r
+ %   \Citeauthor{dRob98}    ==>> Della Robbia\r
+ %\r
+ %\r
+ % Citation aliasing is achieved with\r
+ %   \defcitealias{key}{text}\r
+ %   \citetalias{key}  ==>> text\r
+ %   \citepalias{key}  ==>> (text)\r
+ %\r
+ % Defining the citation mode and punctual (citation style)\r
+ %   \setcitestyle{<comma-separated list of keywords, same\r
+ %     as the package options>}\r
+ % Example: \setcitestyle{square,semicolon}\r
+ % Alternatively:\r
+ % Use \bibpunct with 6 mandatory arguments:\r
+ %    1. opening bracket for citation\r
+ %    2. closing bracket\r
+ %    3. citation separator (for multiple citations in one \cite)\r
+ %    4. the letter n for numerical styles, s for superscripts\r
+ %        else anything for author-year\r
+ %    5. punctuation between authors and date\r
+ %    6. punctuation between years (or numbers) when common authors missing\r
+ % One optional argument is the character coming before post-notes. It\r
+ %   appears in square braces before all other arguments. May be left off.\r
+ % Example (and default) \bibpunct[, ]{(}{)}{;}{a}{,}{,}\r
+ %\r
+ % To make this automatic for a given bib style, named newbib, say, make\r
+ % a local configuration file, natbib.cfg, with the definition\r
+ %   \newcommand{\bibstyle@newbib}{\bibpunct...}\r
+ % Then the \bibliographystyle{newbib} will cause \bibstyle@newbib to\r
+ % be called on THE NEXT LATEX RUN (via the aux file).\r
+ %\r
+ % Such preprogrammed definitions may be invoked anywhere in the text\r
+ %  by calling \citestyle{newbib}. This is only useful if the style specified\r
+ %  differs from that in \bibliographystyle.\r
+ %\r
+ % With \citeindextrue and \citeindexfalse, one can control whether the\r
+ % \cite commands make an automatic entry of the citation in the .idx\r
+ % indexing file. For this, \makeindex must also be given in the preamble.\r
+ %\r
+ % Package Options: (for selecting punctuation)\r
+ %   round  -  round parentheses are used (default)\r
+ %   square -  square brackets are used   [option]\r
+ %   curly  -  curly braces are used      {option}\r
+ %   angle  -  angle brackets are used    <option>\r
+ %   semicolon  -  multiple citations separated by semi-colon (default)\r
+ %   colon  - same as semicolon, an earlier confusion\r
+ %   comma  -  separated by comma\r
+ %   authoryear - selects author-year citations (default)\r
+ %   numbers-  selects numerical citations\r
+ %   super  -  numerical citations as superscripts\r
+ %   sort   -  sorts multiple citations according to order in ref. list\r
+ %   sort&compress   -  like sort, but also compresses numerical citations\r
+ %   compress - compresses without sorting\r
+ %   longnamesfirst  -  makes first citation full author list\r
+ %   sectionbib - puts bibliography in a \section* instead of \chapter*\r
+ %   merge - allows the citation key to have a * prefix,\r
+ %           signifying to merge its reference with that of the previous citation.\r
+ %   elide - if references are merged, repeated portions of later ones may be removed.\r
+ %   mcite - recognizes and ignores the * prefix for merging.\r
+ % Punctuation so selected dominates over any predefined ones.\r
+ % Package options are called as, e.g.\r
+ %        \usepackage[square,comma]{natbib}\r
+ % LaTeX the source file natbib.dtx to obtain more details\r
+ % or the file natnotes.tex for a brief reference sheet.\r
+ %-----------------------------------------------------------\r
+\providecommand\@ifxundefined[1]{%\r
+ \ifx#1\@undefined\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi\r
+}%\r
+\providecommand\@ifnum[1]{%\r
+ \ifnum#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi\r
+}%\r
+\providecommand\@ifx[1]{%\r
+ \ifx#1\expandafter\@firstoftwo\else\expandafter\@secondoftwo\fi\r
+}%\r
+\providecommand\appdef[2]{%\r
+ \toks@\expandafter{#1}\@temptokena{#2}%\r
+ \edef#1{\the\toks@\the\@temptokena}%\r
+}%\r
+\@ifclassloaded{agu2001}{\PackageError{natbib}\r
+  {The agu2001 class already includes natbib coding,\MessageBreak\r
+   so you should not add it explicitly}\r
+  {Type <Return> for now, but then later remove\MessageBreak\r
+   the command \protect\usepackage{natbib} from the document}\r
+  \endinput}{}\r
+\@ifclassloaded{agutex}{\PackageError{natbib}\r
+  {The AGUTeX class already includes natbib coding,\MessageBreak\r
+   so you should not add it explicitly}\r
+  {Type <Return> for now, but then later remove\MessageBreak\r
+   the command \protect\usepackage{natbib} from the document}\r
+  \endinput}{}\r
+\@ifclassloaded{aguplus}{\PackageError{natbib}\r
+  {The aguplus class already includes natbib coding,\MessageBreak\r
+   so you should not add it explicitly}\r
+  {Type <Return> for now, but then later remove\MessageBreak\r
+   the command \protect\usepackage{natbib} from the document}\r
+  \endinput}{}\r
+\@ifclassloaded{nlinproc}{\PackageError{natbib}\r
+  {The nlinproc class already includes natbib coding,\MessageBreak\r
+   so you should not add it explicitly}\r
+  {Type <Return> for now, but then later remove\MessageBreak\r
+   the command \protect\usepackage{natbib} from the document}\r
+  \endinput}{}\r
+\@ifclassloaded{egs}{\PackageError{natbib}\r
+  {The egs class already includes natbib coding,\MessageBreak\r
+   so you should not add it explicitly}\r
+  {Type <Return> for now, but then later remove\MessageBreak\r
+   the command \protect\usepackage{natbib} from the document}\r
+  \endinput}{}\r
+\@ifclassloaded{egu}{\PackageError{natbib}\r
+  {The egu class already includes natbib coding,\MessageBreak\r
+   so you should not add it explicitly}\r
+  {Type <Return> for now, but then later remove\MessageBreak\r
+   the command \protect\usepackage{natbib} from the document}\r
+  \endinput}{}\r
+ % Define citation punctuation for some author-year styles\r
+ % One may add and delete at this point\r
+ % Or put additions into local configuration file natbib.cfg\r
+\newcommand\bibstyle@chicago{\bibpunct{(}{)}{;}{a}{,}{,}}\r
+\newcommand\bibstyle@named{\bibpunct{[}{]}{;}{a}{,}{,}}\r
+\newcommand\bibstyle@agu{\bibpunct{[}{]}{;}{a}{,}{,~}}%Amer. Geophys. Union\r
+\newcommand\bibstyle@copernicus{\bibpunct{(}{)}{;}{a}{,}{,}}%Copernicus Publications\r
+\let\bibstyle@egu=\bibstyle@copernicus\r
+\let\bibstyle@egs=\bibstyle@copernicus\r
+\newcommand\bibstyle@agsm{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}\r
+\newcommand\bibstyle@kluwer{\bibpunct{(}{)}{,}{a}{}{,}\gdef\harvardand{\&}}\r
+\newcommand\bibstyle@dcu{\bibpunct{(}{)}{;}{a}{;}{,}\gdef\harvardand{and}}\r
+\newcommand\bibstyle@aa{\bibpunct{(}{)}{;}{a}{}{,}} %Astronomy & Astrophysics\r
+\newcommand\bibstyle@pass{\bibpunct{(}{)}{;}{a}{,}{,}}%Planet. & Space Sci\r
+\newcommand\bibstyle@anngeo{\bibpunct{(}{)}{;}{a}{,}{,}}%Annales Geophysicae\r
+\newcommand\bibstyle@nlinproc{\bibpunct{(}{)}{;}{a}{,}{,}}%Nonlin.Proc.Geophys.\r
+ % Define citation punctuation for some numerical styles\r
+\newcommand\bibstyle@cospar{\bibpunct{/}{/}{,}{n}{}{}%\r
+     \gdef\bibnumfmt##1{##1.}}\r
+\newcommand\bibstyle@esa{\bibpunct{(Ref.~}{)}{,}{n}{}{}%\r
+     \gdef\bibnumfmt##1{##1.\hspace{1em}}}\r
+\newcommand\bibstyle@nature{\bibpunct{}{}{,}{s}{}{\textsuperscript{,}}%\r
+     \gdef\bibnumfmt##1{##1.}}\r
+ % The standard LaTeX styles\r
+\newcommand\bibstyle@plain{\bibpunct{[}{]}{,}{n}{}{,}}\r
+\let\bibstyle@alpha=\bibstyle@plain\r
+\let\bibstyle@abbrv=\bibstyle@plain\r
+\let\bibstyle@unsrt=\bibstyle@plain\r
+ % The author-year modifications of the standard styles\r
+\newcommand\bibstyle@plainnat{\bibpunct{[}{]}{,}{a}{,}{,}}\r
+\let\bibstyle@abbrvnat=\bibstyle@plainnat\r
+\let\bibstyle@unsrtnat=\bibstyle@plainnat\r
+\newif\ifNAT@numbers \NAT@numbersfalse\r
+\newif\ifNAT@super \NAT@superfalse\r
+\let\NAT@merge\z@\r
+\DeclareOption{numbers}{\NAT@numberstrue\r
+   \ExecuteOptions{square,comma,nobibstyle}}\r
+\DeclareOption{super}{\NAT@supertrue\NAT@numberstrue\r
+   \renewcommand\NAT@open{}\renewcommand\NAT@close{}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{authoryear}{\NAT@numbersfalse\r
+   \ExecuteOptions{round,semicolon,bibstyle}}\r
+\DeclareOption{round}{%\r
+      \renewcommand\NAT@open{(} \renewcommand\NAT@close{)}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{square}{%\r
+      \renewcommand\NAT@open{[} \renewcommand\NAT@close{]}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{angle}{%\r
+      \renewcommand\NAT@open{$<$} \renewcommand\NAT@close{$>$}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{curly}{%\r
+      \renewcommand\NAT@open{\{} \renewcommand\NAT@close{\}}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{comma}{\renewcommand\NAT@sep{,}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{semicolon}{\renewcommand\NAT@sep{;}\r
+   \ExecuteOptions{nobibstyle}}\r
+\DeclareOption{colon}{\ExecuteOptions{semicolon}}\r
+\DeclareOption{nobibstyle}{\let\bibstyle=\@gobble}\r
+\DeclareOption{bibstyle}{\let\bibstyle=\@citestyle}\r
+\newif\ifNAT@openbib \NAT@openbibfalse\r
+\DeclareOption{openbib}{\NAT@openbibtrue}\r
+\DeclareOption{sectionbib}{\def\NAT@sectionbib{on}}\r
+\def\NAT@sort{\z@}\r
+\def\NAT@cmprs{\z@}\r
+\DeclareOption{sort}{\def\NAT@sort{\@ne}}\r
+\DeclareOption{compress}{\def\NAT@cmprs{\@ne}}\r
+\DeclareOption{sort&compress}{\def\NAT@sort{\@ne}\def\NAT@cmprs{\@ne}}\r
+\DeclareOption{mcite}{\let\NAT@merge\@ne}\r
+\DeclareOption{merge}{\@ifnum{\NAT@merge<\tw@}{\let\NAT@merge\tw@}{}}\r
+\DeclareOption{elide}{\@ifnum{\NAT@merge<\thr@@}{\let\NAT@merge\thr@@}{}}\r
+\@ifpackageloaded{cite}{\PackageWarningNoLine{natbib}\r
+  {The `cite' package should not be used\MessageBreak\r
+   with natbib. Use option `sort' instead}\ExecuteOptions{sort}}{}\r
+\@ifpackageloaded{mcite}{\PackageWarningNoLine{natbib}\r
+  {The `mcite' package should not be used\MessageBreak\r
+   with natbib. Use option `merge' instead}\ExecuteOptions{merge}}{}\r
+\@ifpackageloaded{citeref}{\PackageError{natbib}\r
+  {The `citeref' package must be loaded after natbib}%\r
+  {Move \protect\usepackage{citeref} to after \string\usepackage{natbib}}}{}\r
+\newif\ifNAT@longnames\NAT@longnamesfalse\r
+\DeclareOption{longnamesfirst}{\NAT@longnamestrue}\r
+\DeclareOption{nonamebreak}{\def\NAT@nmfmt#1{\mbox{\NAT@up#1}}}\r
+\def\NAT@nmfmt#1{{\NAT@up#1}}\r
+\renewcommand\bibstyle[1]{\csname bibstyle@#1\endcsname}\r
+\AtBeginDocument{\global\let\bibstyle=\@gobble}\r
+\let\@citestyle\bibstyle\r
+\newcommand\citestyle[1]{\@citestyle{#1}\let\bibstyle\@gobble}\r
+\newcommand\bibpunct[7][, ]%\r
+  {\gdef\NAT@open{#2}\gdef\NAT@close{#3}\gdef\r
+   \NAT@sep{#4}\global\NAT@numbersfalse\r
+     \ifx #5n\global\NAT@numberstrue\global\NAT@superfalse\r
+   \else\r
+     \ifx #5s\global\NAT@numberstrue\global\NAT@supertrue\r
+   \fi\fi\r
+   \gdef\NAT@aysep{#6}\gdef\NAT@yrsep{#7}%\r
+   \gdef\NAT@cmt{#1}%\r
+   \NAT@@setcites\r
+  }\r
+\newcommand\setcitestyle[1]{\r
+ \@for\@tempa:=#1\do\r
+ {\def\@tempb{round}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@open{(}\renewcommand\NAT@close{)}\fi\r
+  \def\@tempb{square}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@open{[}\renewcommand\NAT@close{]}\fi\r
+  \def\@tempb{angle}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@open{$<$}\renewcommand\NAT@close{$>$}\fi\r
+  \def\@tempb{curly}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@open{\{}\renewcommand\NAT@close{\}}\fi\r
+  \def\@tempb{semicolon}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@sep{;}\fi\r
+  \def\@tempb{colon}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@sep{;}\fi\r
+  \def\@tempb{comma}\ifx\@tempa\@tempb\r
+    \renewcommand\NAT@sep{,}\fi\r
+  \def\@tempb{authoryear}\ifx\@tempa\@tempb\r
+    \NAT@numbersfalse\fi\r
+  \def\@tempb{numbers}\ifx\@tempa\@tempb\r
+    \NAT@numberstrue\NAT@superfalse\fi\r
+  \def\@tempb{super}\ifx\@tempa\@tempb\r
+    \NAT@numberstrue\NAT@supertrue\fi\r
+  \expandafter\NAT@find@eq\@tempa=\relax\@nil\r
+  \if\@tempc\relax\else\r
+    \expandafter\NAT@rem@eq\@tempc\r
+    \def\@tempb{open}\ifx\@tempa\@tempb\r
+     \xdef\NAT@open{\@tempc}\fi\r
+    \def\@tempb{close}\ifx\@tempa\@tempb\r
+     \xdef\NAT@close{\@tempc}\fi\r
+    \def\@tempb{aysep}\ifx\@tempa\@tempb\r
+     \xdef\NAT@aysep{\@tempc}\fi\r
+    \def\@tempb{yysep}\ifx\@tempa\@tempb\r
+     \xdef\NAT@yrsep{\@tempc}\fi\r
+    \def\@tempb{notesep}\ifx\@tempa\@tempb\r
+     \xdef\NAT@cmt{\@tempc}\fi\r
+    \def\@tempb{citesep}\ifx\@tempa\@tempb\r
+     \xdef\NAT@sep{\@tempc}\fi\r
+  \fi\r
+ }%\r
+ \NAT@@setcites\r
+}\r
+ \def\NAT@find@eq#1=#2\@nil{\def\@tempa{#1}\def\@tempc{#2}}\r
+ \def\NAT@rem@eq#1={\def\@tempc{#1}}\r
+ \def\NAT@@setcites{\global\let\bibstyle\@gobble}\r
+\AtBeginDocument{\let\NAT@@setcites\NAT@set@cites}\r
+\newcommand\NAT@open{(} \newcommand\NAT@close{)}\r
+\newcommand\NAT@sep{;}\r
+\ProcessOptions\r
+\newcommand\NAT@aysep{,} \newcommand\NAT@yrsep{,}\r
+\newcommand\NAT@cmt{, }\r
+\newcommand\NAT@cite%\r
+    [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi\r
+        #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}\r
+\newcommand\NAT@citenum%\r
+    [3]{\ifNAT@swa\NAT@@open\if*#2*\else#2\NAT@spacechar\fi\r
+        #1\if*#3*\else\NAT@cmt#3\fi\NAT@@close\else#1\fi\endgroup}\r
+%\newcommand\NAT@citesuper[3]{\ifNAT@swa\r
+%\if*#2*\else#2\NAT@spacechar\fi\r
+%\unskip\kern\p@\textsuperscript{\NAT@@open#1\NAT@@close}%\r
+%   \if*#3*\else\NAT@spacechar#3\fi\else #1\fi\endgroup}\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+\newcommand\NAT@citesuper[3]{\ifNAT@swa\r
+\if*#2*\else#2\NAT@spacechar\fi\r
+\unskip\kern\p@\textsuperscript{\NAT@@open#1\if*#3*\else,\NAT@spacechar#3\fi\NAT@@close}%\r
+   \else #1\fi\endgroup}\r
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\r
+\providecommand\textsuperscript[1]{\mbox{$^{\mbox{\scriptsize#1}}$}}\r
+\begingroup \catcode`\_=8\r
+\gdef\NAT@ifcat@num#1{%\r
+ \ifcat_\ifnum\z@<0#1_\else A\fi\r
+  \expandafter\@firstoftwo\r
+ \else\r
+  \expandafter\@secondoftwo\r
+ \fi\r
+}%\r
+\endgroup\r
+\providecommand\@firstofone[1]{#1}\r
+\newcommand\NAT@citexnum{}\r
+\def\NAT@citexnum[#1][#2]#3{%\r
+  \NAT@reset@parser\r
+  \NAT@sort@cites{#3}%\r
+  \NAT@reset@citea\r
+  \@cite{\def\NAT@num{-1}\let\NAT@last@yr\relax\let\NAT@nm\@empty\r
+    \@for\@citeb:=\NAT@cite@list\do\r
+    {\@safe@activestrue\r
+     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%\r
+     \@safe@activesfalse\r
+     \@ifundefined{b@\@citeb\@extra@b@citeb}{%\r
+       {\reset@font\bfseries?}\r
+        \NAT@citeundefined\PackageWarning{natbib}%\r
+       {Citation `\@citeb' on page \thepage \space undefined}}%\r
+     {\let\NAT@last@num\NAT@num\let\NAT@last@nm\NAT@nm\r
+      \NAT@parse{\@citeb}%\r
+      \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%\r
+        \let\NAT@name=\NAT@all@names\r
+        \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%\r
+      \fi\r
+      \ifNAT@full\let\NAT@nm\NAT@all@names\else\r
+        \let\NAT@nm\NAT@name\fi\r
+      \ifNAT@swa\r
+       \@ifnum{\NAT@ctype>\@ne}{%\r
+        \@citea\r
+        \NAT@hyper@{\@ifnum{\NAT@ctype=\tw@}{\NAT@test{\NAT@ctype}}{\NAT@alias}}%\r
+       }{%\r
+        \@ifnum{\NAT@cmprs>\z@}{%\r
+         \NAT@ifcat@num\NAT@num\r
+          {\let\NAT@nm=\NAT@num}%\r
+          {\def\NAT@nm{-2}}%\r
+         \NAT@ifcat@num\NAT@last@num\r
+          {\@tempcnta=\NAT@last@num\relax}%\r
+          {\@tempcnta\m@ne}%\r
+         \@ifnum{\NAT@nm=\@tempcnta}{%\r
+          \@ifnum{\NAT@merge>\@ne}{}{\NAT@last@yr@mbox}%\r
+         }{%\r
+           \advance\@tempcnta by\@ne\r
+           \@ifnum{\NAT@nm=\@tempcnta}{%\r
+             \ifx\NAT@last@yr\relax\r
+               \def@NAT@last@yr{\@citea}%\r
+             \else\r
+               \def@NAT@last@yr{--\NAT@penalty}%\r
+             \fi\r
+           }{%\r
+             \NAT@last@yr@mbox\r
+           }%\r
+         }%\r
+        }{%\r
+         \@tempswatrue\r
+         \@ifnum{\NAT@merge>\@ne}{\@ifnum{\NAT@last@num=\NAT@num\relax}{\@tempswafalse}{}}{}%\r
+         \if@tempswa\NAT@citea@mbox\fi\r
+        }%\r
+       }%\r
+       \NAT@def@citea\r
+      \else\r
+        \ifcase\NAT@ctype\r
+          \ifx\NAT@last@nm\NAT@nm \NAT@yrsep\NAT@penalty\NAT@space\else\r
+            \@citea \NAT@test{\@ne}\NAT@spacechar\NAT@mbox{\NAT@super@kern\NAT@@open}%\r
+          \fi\r
+          \if*#1*\else#1\NAT@spacechar\fi\r
+          \NAT@mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%\r
+          \NAT@def@citea@box\r
+        \or\r
+          \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%\r
+        \or\r
+          \NAT@hyper@citea@space{\NAT@test{\NAT@ctype}}%\r
+        \or\r
+          \NAT@hyper@citea@space\NAT@alias\r
+        \fi\r
+      \fi\r
+     }%\r
+    }%\r
+      \@ifnum{\NAT@cmprs>\z@}{\NAT@last@yr}{}%\r
+      \ifNAT@swa\else\r
+        \@ifnum{\NAT@ctype=\z@}{%\r
+          \if*#2*\else\NAT@cmt#2\fi\r
+        }{}%\r
+        \NAT@mbox{\NAT@@close}%\r
+      \fi\r
+  }{#1}{#2}%\r
+}%\r
+\def\NAT@citea@mbox{%\r
+ \@citea\mbox{\NAT@hyper@{{\citenumfont{\NAT@num}}}}%\r
+}%\r
+\def\NAT@hyper@#1{%\r
+ \hyper@natlinkstart{\@citeb\@extra@b@citeb}#1\hyper@natlinkend\r
+}%\r
+\def\NAT@hyper@citea#1{%\r
+ \@citea\r
+ \NAT@hyper@{#1}%\r
+ \NAT@def@citea\r
+}%\r
+\def\NAT@hyper@citea@space#1{%\r
+ \@citea\r
+ \NAT@hyper@{#1}%\r
+ \NAT@def@citea@space\r
+}%\r
+\def\def@NAT@last@yr#1{%\r
+ \protected@edef\NAT@last@yr{%\r
+  #1%\r
+  \noexpand\mbox{%\r
+   \noexpand\hyper@natlinkstart{\@citeb\@extra@b@citeb}%\r
+   {\noexpand\citenumfont{\NAT@num}}%\r
+   \noexpand\hyper@natlinkend\r
+  }%\r
+ }%\r
+}%\r
+\def\NAT@last@yr@mbox{%\r
+ \NAT@last@yr\let\NAT@last@yr\relax\r
+ \NAT@citea@mbox\r
+}%\r
+\newcommand\NAT@test[1]{%\r
+ \@ifnum{#1=\@ne}{%\r
+  \ifx\NAT@nm\NAT@noname\r
+   \begingroup\reset@font\bfseries(author?)\endgroup\r
+   \PackageWarning{natbib}{%\r
+    Author undefined for citation`\@citeb' \MessageBreak on page \thepage%\r
+   }%\r
+  \else \NAT@nm\r
+  \fi\r
+ }{%\r
+  \if\relax\NAT@date\relax\r
+   \begingroup\reset@font\bfseries(year?)\endgroup\r
+   \PackageWarning{natbib}{%\r
+    Year undefined for citation`\@citeb' \MessageBreak on page \thepage%\r
+   }%\r
+  \else \NAT@date\r
+  \fi\r
+ }%\r
+}%\r
+\let\citenumfont=\@empty\r
+\newcommand\NAT@citex{}\r
+\def\NAT@citex%\r
+  [#1][#2]#3{%\r
+  \NAT@reset@parser\r
+  \NAT@sort@cites{#3}%\r
+  \NAT@reset@citea\r
+  \@cite{\let\NAT@nm\@empty\let\NAT@year\@empty\r
+    \@for\@citeb:=\NAT@cite@list\do\r
+    {\@safe@activestrue\r
+     \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%\r
+     \@safe@activesfalse\r
+     \@ifundefined{b@\@citeb\@extra@b@citeb}{\@citea%\r
+       {\reset@font\bfseries ?}\NAT@citeundefined\r
+                 \PackageWarning{natbib}%\r
+       {Citation `\@citeb' on page \thepage \space undefined}\def\NAT@date{}}%\r
+     {\let\NAT@last@nm=\NAT@nm\let\NAT@last@yr=\NAT@year\r
+      \NAT@parse{\@citeb}%\r
+      \ifNAT@longnames\@ifundefined{bv@\@citeb\@extra@b@citeb}{%\r
+        \let\NAT@name=\NAT@all@names\r
+        \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}{}%\r
+      \fi\r
+     \ifNAT@full\let\NAT@nm\NAT@all@names\else\r
+       \let\NAT@nm\NAT@name\fi\r
+     \ifNAT@swa\ifcase\NAT@ctype\r
+       \if\relax\NAT@date\relax\r
+         \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}\NAT@date}%\r
+       \else\r
+         \ifx\NAT@last@nm\NAT@nm\NAT@yrsep\r
+            \ifx\NAT@last@yr\NAT@year\r
+              \def\NAT@temp{{?}}%\r
+              \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%\r
+               {Multiple citation on page \thepage: same authors and\r
+               year\MessageBreak without distinguishing extra\r
+               letter,\MessageBreak appears as question mark}\fi\r
+              \NAT@hyper@{\NAT@exlab}%\r
+            \else\unskip\NAT@spacechar\r
+              \NAT@hyper@{\NAT@date}%\r
+            \fi\r
+         \else\r
+           \@citea\NAT@hyper@{%\r
+             \NAT@nmfmt{\NAT@nm}%\r
+             \hyper@natlinkbreak{%\r
+               \NAT@aysep\NAT@spacechar}{\@citeb\@extra@b@citeb\r
+             }%\r
+             \NAT@date\r
+           }%\r
+         \fi\r
+       \fi\r
+     \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%\r
+     \or\@citea\NAT@hyper@{\NAT@date}%\r
+     \or\@citea\NAT@hyper@{\NAT@alias}%\r
+     \fi \NAT@def@citea\r
+     \else\r
+       \ifcase\NAT@ctype\r
+        \if\relax\NAT@date\relax\r
+          \@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%\r
+        \else\r
+         \ifx\NAT@last@nm\NAT@nm\NAT@yrsep\r
+            \ifx\NAT@last@yr\NAT@year\r
+              \def\NAT@temp{{?}}%\r
+              \ifx\NAT@temp\NAT@exlab\PackageWarningNoLine{natbib}%\r
+               {Multiple citation on page \thepage: same authors and\r
+               year\MessageBreak without distinguishing extra\r
+               letter,\MessageBreak appears as question mark}\fi\r
+              \NAT@hyper@{\NAT@exlab}%\r
+            \else\r
+              \unskip\NAT@spacechar\r
+              \NAT@hyper@{\NAT@date}%\r
+            \fi\r
+         \else\r
+           \@citea\NAT@hyper@{%\r
+             \NAT@nmfmt{\NAT@nm}%\r
+             \hyper@natlinkbreak{\NAT@spacechar\NAT@@open\if*#1*\else#1\NAT@spacechar\fi}%\r
+               {\@citeb\@extra@b@citeb}%\r
+             \NAT@date\r
+           }%\r
+         \fi\r
+        \fi\r
+       \or\@citea\NAT@hyper@{\NAT@nmfmt{\NAT@nm}}%\r
+       \or\@citea\NAT@hyper@{\NAT@date}%\r
+       \or\@citea\NAT@hyper@{\NAT@alias}%\r
+       \fi\r
+       \if\relax\NAT@date\relax\r
+         \NAT@def@citea\r
+       \else\r
+         \NAT@def@citea@close\r
+       \fi\r
+     \fi\r
+     }}\ifNAT@swa\else\if*#2*\else\NAT@cmt#2\fi\r
+     \if\relax\NAT@date\relax\else\NAT@@close\fi\fi}{#1}{#2}}\r
+\def\NAT@spacechar{\ }%\r
+\def\NAT@separator{\NAT@sep\NAT@penalty}%\r
+\def\NAT@reset@citea{\c@NAT@ctr\@ne\let\@citea\@empty}%\r
+\def\NAT@def@citea{\def\@citea{\NAT@separator\NAT@space}}%\r
+\def\NAT@def@citea@space{\def\@citea{\NAT@separator\NAT@spacechar}}%\r
+\def\NAT@def@citea@close{\def\@citea{\NAT@@close\NAT@separator\NAT@space}}%\r
+\def\NAT@def@citea@box{\def\@citea{\NAT@mbox{\NAT@@close}\NAT@separator\NAT@spacechar}}%\r
+\newif\ifNAT@par \NAT@partrue\r
+\newcommand\NAT@@open{\ifNAT@par\NAT@open\fi}\r
+\newcommand\NAT@@close{\ifNAT@par\NAT@close\fi}\r
+\newcommand\NAT@alias{\@ifundefined{al@\@citeb\@extra@b@citeb}{%\r
+  {\reset@font\bfseries(alias?)}\PackageWarning{natbib}\r
+  {Alias undefined for citation `\@citeb'\r
+  \MessageBreak on page \thepage}}{\@nameuse{al@\@citeb\@extra@b@citeb}}}\r
+\let\NAT@up\relax\r
+\newcommand\NAT@Up[1]{{\let\protect\@unexpandable@protect\let~\relax\r
+  \expandafter\NAT@deftemp#1}\expandafter\NAT@UP\NAT@temp}\r
+\newcommand\NAT@deftemp[1]{\xdef\NAT@temp{#1}}\r
+\newcommand\NAT@UP[1]{\let\@tempa\NAT@UP\ifcat a#1\MakeUppercase{#1}%\r
+  \let\@tempa\relax\else#1\fi\@tempa}\r
+\newcommand\shortcites[1]{%\r
+  \@bsphack\@for\@citeb:=#1\do\r
+  {\@safe@activestrue\r
+   \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%\r
+   \@safe@activesfalse\r
+   \global\@namedef{bv@\@citeb\@extra@b@citeb}{}}\@esphack}\r
+\newcommand\NAT@biblabel[1]{\hfill}\r
+\newcommand\NAT@biblabelnum[1]{\bibnumfmt{#1}}\r
+\let\bibnumfmt\@empty\r
+\providecommand\@biblabel[1]{[#1]}\r
+\AtBeginDocument{\ifx\bibnumfmt\@empty\let\bibnumfmt\@biblabel\fi}\r
+\newcommand\NAT@bibsetnum[1]{\settowidth\labelwidth{\@biblabel{#1}}%\r
+   \setlength{\leftmargin}{\labelwidth}\addtolength{\leftmargin}{\labelsep}%\r
+   \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}%\r
+   \ifNAT@openbib\r
+     \addtolength{\leftmargin}{\bibindent}%\r
+     \setlength{\itemindent}{-\bibindent}%\r
+     \setlength{\listparindent}{\itemindent}%\r
+     \setlength{\parsep}{0pt}%\r
+   \fi\r
+}\r
+\newlength{\bibhang}\r
+\setlength{\bibhang}{1em}\r
+\newlength{\bibsep}\r
+ {\@listi \global\bibsep\itemsep \global\advance\bibsep by\parsep}\r
+\r
+\newcommand\NAT@bibsetup%\r
+   [1]{\setlength{\leftmargin}{\bibhang}\setlength{\itemindent}{-\leftmargin}%\r
+       \setlength{\itemsep}{\bibsep}\setlength{\parsep}{\z@}}\r
+\newcommand\NAT@set@cites{%\r
+  \ifNAT@numbers\r
+    \ifNAT@super \let\@cite\NAT@citesuper\r
+       \def\NAT@mbox##1{\unskip\nobreak\textsuperscript{##1}}%\r
+       \let\citeyearpar=\citeyear\r
+       \let\NAT@space\relax\r
+       \def\NAT@super@kern{\kern\p@}%\r
+    \else\r
+       \let\NAT@mbox=\mbox\r
+       \let\@cite\NAT@citenum\r
+       \let\NAT@space\NAT@spacechar\r
+       \let\NAT@super@kern\relax\r
+    \fi\r
+    \let\@citex\NAT@citexnum\r
+    \let\@biblabel\NAT@biblabelnum\r
+    \let\@bibsetup\NAT@bibsetnum\r
+    \renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@num\NAT@close}%\r
+    \def\natexlab##1{}%\r
+    \def\NAT@penalty{\penalty\@m}%\r
+  \else\r
+    \let\@cite\NAT@cite\r
+    \let\@citex\NAT@citex\r
+    \let\@biblabel\NAT@biblabel\r
+    \let\@bibsetup\NAT@bibsetup\r
+    \let\NAT@space\NAT@spacechar\r
+    \let\NAT@penalty\@empty\r
+    \renewcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close}%\r
+    \def\natexlab##1{##1}%\r
+  \fi}\r
+\AtBeginDocument{\NAT@set@cites}\r
+\AtBeginDocument{\ifx\SK@def\@undefined\else\r
+\ifx\SK@cite\@empty\else\r
+  \SK@def\@citex[#1][#2]#3{\SK@\SK@@ref{#3}\SK@@citex[#1][#2]{#3}}\fi\r
+\ifx\SK@citeauthor\@undefined\def\HAR@checkdef{}\else\r
+  \let\citeauthor\SK@citeauthor\r
+  \let\citefullauthor\SK@citefullauthor\r
+  \let\citeyear\SK@citeyear\fi\r
+\fi}\r
+\newif\ifNAT@full\NAT@fullfalse\r
+\newif\ifNAT@swa\r
+\DeclareRobustCommand\citet\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@partrue\r
+     \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\newcommand\NAT@citetp{\@ifnextchar[{\NAT@@citetp}{\NAT@@citetp[]}}\r
+\newcommand\NAT@@citetp{}\r
+\def\NAT@@citetp[#1]{\@ifnextchar[{\@citex[#1]}{\@citex[][#1]}}\r
+\DeclareRobustCommand\citep\r
+   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@partrue\r
+         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\cite\r
+    {\begingroup\let\NAT@ctype\z@\NAT@partrue\NAT@swatrue\r
+      \@ifstar{\NAT@fulltrue\NAT@cites}{\NAT@fullfalse\NAT@cites}}\r
+\newcommand\NAT@cites{\@ifnextchar [{\NAT@@citetp}{%\r
+     \ifNAT@numbers\else\r
+     \NAT@swafalse\r
+     \fi\r
+    \NAT@@citetp[]}}\r
+\DeclareRobustCommand\citealt\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@parfalse\r
+         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\citealp\r
+   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\r
+         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\citenum\r
+   {\begingroup\r
+     \NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\let\textsuperscript\NAT@spacechar\r
+     \NAT@citexnum[][]}\r
+\DeclareRobustCommand\citeauthor\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse\r
+    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\Citet\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@partrue\r
+     \let\NAT@up\NAT@Up\r
+     \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\Citep\r
+   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@partrue\r
+     \let\NAT@up\NAT@Up\r
+         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\Citealt\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\z@\NAT@parfalse\r
+     \let\NAT@up\NAT@Up\r
+         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\Citealp\r
+   {\begingroup\NAT@swatrue\let\NAT@ctype\z@\NAT@parfalse\r
+     \let\NAT@up\NAT@Up\r
+         \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\Citeauthor\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\@ne\NAT@parfalse\r
+     \let\NAT@up\NAT@Up\r
+    \@ifstar{\NAT@fulltrue\NAT@citetp}{\NAT@fullfalse\NAT@citetp}}\r
+\DeclareRobustCommand\citeyear\r
+   {\begingroup\NAT@swafalse\let\NAT@ctype\tw@\NAT@parfalse\NAT@citetp}\r
+\DeclareRobustCommand\citeyearpar\r
+   {\begingroup\NAT@swatrue\let\NAT@ctype\tw@\NAT@partrue\NAT@citetp}\r
+\newcommand\citetext[1]{\NAT@open#1\NAT@close}\r
+\DeclareRobustCommand\citefullauthor\r
+   {\citeauthor*}\r
+\newcommand\defcitealias[2]{%\r
+   \@ifundefined{al@#1\@extra@b@citeb}{}\r
+   {\PackageWarning{natbib}{Overwriting existing alias for citation #1}}\r
+   \@namedef{al@#1\@extra@b@citeb}{#2}}\r
+\DeclareRobustCommand\citetalias{\begingroup\r
+   \NAT@swafalse\let\NAT@ctype\thr@@\NAT@parfalse\NAT@citetp}\r
+\DeclareRobustCommand\citepalias{\begingroup\r
+   \NAT@swatrue\let\NAT@ctype\thr@@\NAT@partrue\NAT@citetp}\r
+\renewcommand\nocite[1]{\@bsphack\r
+  \@for\@citeb:=#1\do{%\r
+    \@safe@activestrue\r
+    \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%\r
+    \@safe@activesfalse\r
+    \if@filesw\immediate\write\@auxout{\string\citation{\@citeb}}\fi\r
+    \if*\@citeb\else\r
+    \@ifundefined{b@\@citeb\@extra@b@citeb}{%\r
+       \NAT@citeundefined \PackageWarning{natbib}%\r
+       {Citation `\@citeb' undefined}}{}\fi}%\r
+  \@esphack}\r
+\newcommand\NAT@parse[1]{%\r
+  \begingroup\r
+   \let\protect=\@unexpandable@protect\r
+   \let~\relax\r
+   \let\active@prefix=\@gobble\r
+   \edef\NAT@temp{\csname b@#1\@extra@b@citeb\endcsname}%\r
+   \aftergroup\NAT@split\r
+   \expandafter\r
+  \endgroup\r
+  \NAT@temp{}{}{}{}{}@@%\r
+  \expandafter\NAT@parse@date\NAT@date??????@@%\r
+  \ifciteindex\NAT@index\fi\r
+}%\r
+\def\NAT@split#1#2#3#4#5@@{%\r
+  \gdef\NAT@num{#1}\gdef\NAT@name{#3}\gdef\NAT@date{#2}%\r
+  \gdef\NAT@all@names{#4}%\r
+  \ifx\NAT@num\@empty\gdef\NAT@num{0}\fi\r
+  \ifx\NAT@noname\NAT@all@names \gdef\NAT@all@names{#3}\fi\r
+}%\r
+\def\NAT@reset@parser{%\r
+  \global\let\NAT@num\@empty\r
+  \global\let\NAT@name\@empty\r
+  \global\let\NAT@date\@empty\r
+  \global\let\NAT@all@names\@empty\r
+}%\r
+\newcommand\NAT@parse@date{}\r
+\def\NAT@parse@date#1#2#3#4#5#6@@{%\r
+  \ifnum\the\catcode`#1=11\def\NAT@year{}\def\NAT@exlab{#1}\else\r
+  \ifnum\the\catcode`#2=11\def\NAT@year{#1}\def\NAT@exlab{#2}\else\r
+  \ifnum\the\catcode`#3=11\def\NAT@year{#1#2}\def\NAT@exlab{#3}\else\r
+  \ifnum\the\catcode`#4=11\def\NAT@year{#1#2#3}\def\NAT@exlab{#4}\else\r
+    \def\NAT@year{#1#2#3#4}\def\NAT@exlab{{#5}}\fi\fi\fi\fi}\r
+\newcommand\NAT@index{}\r
+\let\NAT@makeindex=\makeindex\r
+\renewcommand\makeindex{\NAT@makeindex\r
+  \renewcommand\NAT@index{\@bsphack\begingroup\r
+     \def~{\string~}\@wrindex{\NAT@idxtxt}}}\r
+\newcommand\NAT@idxtxt{\NAT@name\NAT@spacechar\NAT@open\NAT@date\NAT@close}\r
+\@ifxundefined\@indexfile{}{\let\NAT@makeindex\relax\makeindex}\r
+\newif\ifciteindex \citeindexfalse\r
+\newcommand\citeindextype{default}\r
+\newcommand\NAT@index@alt{{\let\protect=\noexpand\let~\relax\r
+  \xdef\NAT@temp{\NAT@idxtxt}}\expandafter\NAT@exp\NAT@temp\@nil}\r
+\newcommand\NAT@exp{}\r
+\def\NAT@exp#1\@nil{\index[\citeindextype]{#1}}\r
+\r
+\AtBeginDocument{%\r
+\@ifpackageloaded{index}{\let\NAT@index=\NAT@index@alt}{}}\r
+\newcommand\NAT@ifcmd{\futurelet\NAT@temp\NAT@ifxcmd}\r
+\newcommand\NAT@ifxcmd{\ifx\NAT@temp\relax\else\expandafter\NAT@bare\fi}\r
+\def\NAT@bare#1(#2)#3(@)#4\@nil#5{%\r
+  \if @#2\r
+    \expandafter\NAT@apalk#1, , \@nil{#5}%\r
+  \else\r
+  \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{#3}{#5}%\r
+\fi\r
+}\r
+\newcommand\NAT@wrout[5]{%\r
+\if@filesw\r
+      {\let\protect\noexpand\let~\relax\r
+       \immediate\r
+       \write\@auxout{\string\bibcite{#5}{{#1}{#2}{{#3}}{{#4}}}}}\fi\r
+\ignorespaces}\r
+\def\NAT@noname{{}}\r
+\renewcommand\bibitem{\@ifnextchar[{\@lbibitem}{\@lbibitem[]}}%\r
+\let\NAT@bibitem@first@sw\@secondoftwo\r
+\def\@lbibitem[#1]#2{%\r
+  \if\relax\@extra@b@citeb\relax\else\r
+    \@ifundefined{br@#2\@extra@b@citeb}{}{%\r
+     \@namedef{br@#2}{\@nameuse{br@#2\@extra@b@citeb}}%\r
+    }%\r
+  \fi\r
+  \@ifundefined{b@#2\@extra@b@citeb}{%\r
+   \def\NAT@num{}%\r
+  }{%\r
+   \NAT@parse{#2}%\r
+  }%\r
+  \def\NAT@tmp{#1}%\r
+  \expandafter\let\expandafter\bibitemOpen\csname NAT@b@open@#2\endcsname\r
+  \expandafter\let\expandafter\bibitemShut\csname NAT@b@shut@#2\endcsname\r
+  \@ifnum{\NAT@merge>\@ne}{%\r
+   \NAT@bibitem@first@sw{%\r
+    \@firstoftwo\r
+   }{%\r
+    \@ifundefined{NAT@b*@#2}{%\r
+     \@firstoftwo\r
+    }{%\r
+     \expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%\r
+     \@secondoftwo\r
+    }%\r
+   }%\r
+  }{%\r
+   \@firstoftwo\r
+  }%\r
+  {%\r
+   \global\advance\c@NAT@ctr\@ne\r
+   \@ifx{\NAT@tmp\@empty}{\@firstoftwo}{%\r
+    \@secondoftwo\r
+   }%\r
+   {%\r
+    \expandafter\def\expandafter\NAT@num\expandafter{\the\c@NAT@ctr}%\r
+    \global\NAT@stdbsttrue\r
+   }{}%\r
+   \bibitem@fin\r
+   \item[\hfil\NAT@anchor{#2}{\NAT@num}]%\r
+   \global\let\NAT@bibitem@first@sw\@secondoftwo\r
+   \NAT@bibitem@init\r
+  }%\r
+  {%\r
+   \NAT@anchor{#2}{}%\r
+   \NAT@bibitem@cont\r
+   \bibitem@fin\r
+  }%\r
+  \@ifx{\NAT@tmp\@empty}{%\r
+    \NAT@wrout{\the\c@NAT@ctr}{}{}{}{#2}%\r
+  }{%\r
+    \expandafter\NAT@ifcmd\NAT@tmp(@)(@)\@nil{#2}%\r
+  }%\r
+}%\r
+\def\bibitem@fin{%\r
+ \@ifxundefined\@bibstop{}{\csname bibitem@\@bibstop\endcsname}%\r
+}%\r
+\def\NAT@bibitem@init{%\r
+ \let\@bibstop\@undefined\r
+}%\r
+\def\NAT@bibitem@cont{%\r
+ \let\bibitem@Stop\bibitemContinue\r
+ \let\bibitem@NoStop\bibitemContinue\r
+}%\r
+\def\BibitemOpen{%\r
+ \bibitemOpen\r
+}%\r
+\def\BibitemShut#1{%\r
+ \def\@bibstop{#1}%\r
+ \let\bibitem@Stop\bibitemStop\r
+ \let\bibitem@NoStop\bibitemNoStop\r
+ \@ifx{\bibitemShut\relax}{\let\@bibitemShut\@empty}{%\r
+  \expandafter\def\expandafter\@bibitemShut\expandafter{\bibitemShut}%\r
+ }%\r
+}%\r
+\def\@bibitemShut{}%\r
+\def\bibitemStop{\@bibitemShut}%\r
+\def\bibitemNoStop{%\r
+ \@ifx{\@empty\@bibitemShut}{.\spacefactor\@mmm\space}{\@bibitemShut}%\r
+}%\r
+\def\bibitemContinue{%\r
+ \@ifx{\@empty\@bibitemShut}{;\spacefactor\@mmm\space}{\@bibitemShut}%\r
+}%\r
+\mathchardef\@mmm=3000 %\r
+\let\bibitemOpen\relax\r
+\let\bibitemShut\relax\r
+\@ifnum{\NAT@merge>\@ne}{%\r
+\providecommand{\bibAnnote}[3]{%\r
+  \BibitemShut{#1}%\r
+  \def\@tempa{#3}\@ifx{\@tempa\@empty}{}{%\r
+   \begin{quotation}\noindent\r
+    \textsc{Key:}\ #2\\\textsc{Annotation:}\ \@tempa\r
+   \end{quotation}%\r
+  }%\r
+  \ignorespaces\r
+}%\r
+\providecommand{\bibAnnoteFile}[2]{%\r
+  \IfFileExists{#2}{%\r
+    \bibAnnote{#1}{#2}{\input{#2}}%\r
+  }{%\r
+    \bibAnnote{#1}{#2}{}%\r
+  }%\r
+}%\r
+}{}%\r
+\def\bibfield{\@ifnum{\NAT@merge>\tw@}{\@bibfield}{\@secondoftwo}}%\r
+\def\@bibfield#1#2{%\r
+ \begingroup\r
+  \let\Doi\@gobble\r
+  \let\bibinfo\relax\r
+  \let\restore@protect\@empty\r
+  \protected@edef\@tempa{#2}%\r
+  \aftergroup\def\aftergroup\@tempa\r
+ \expandafter\endgroup\expandafter{\@tempa}%\r
+ \expandafter\@ifx\expandafter{\csname @bib#1\endcsname\@tempa}{%\r
+  \expandafter\let\expandafter\@tempa\csname @bib@X#1\endcsname\r
+ }{%\r
+  \expandafter\let\csname @bib#1\endcsname\@tempa\r
+  \expandafter\let\expandafter\@tempa\csname @bib@Y#1\endcsname\r
+ }%\r
+ \@ifx{\@tempa\relax}{\let\@tempa\@firstofone}{}%\r
+ \@tempa{#2}%\r
+}%\r
+\def\bibinfo#1{%\r
+ \expandafter\let\expandafter\@tempa\csname bibinfo@X@#1\endcsname\r
+ \@ifx{\@tempa\relax}{\@firstofone}{\@tempa}%\r
+}%\r
+\def\@bib@Xauthor#1{\let\@bib@Xjournal\@gobble}%\r
+\def\@bib@Xjournal#1{\begingroup\let\bibinfo@X@journal\@bib@Z@journal#1\endgroup}%\r
+\def\@bibibid@#1{\textit{ibid}.}%\r
+\appdef\NAT@bibitem@init{%\r
+ \let\@bibauthor  \@empty\r
+ \let\@bibjournal \@empty\r
+ \let\@bib@Z@journal\@bibibid@\r
+}%\r
+\ifx\SK@lbibitem\@undefined\else\r
+   \let\SK@lbibitem\@lbibitem\r
+   \def\@lbibitem[#1]#2{%\r
+     \SK@lbibitem[#1]{#2}\SK@\SK@@label{#2}\ignorespaces}\fi\r
+\newif\ifNAT@stdbst \NAT@stdbstfalse\r
+\r
+\AtEndDocument{%\r
+  \ifNAT@stdbst\if@filesw\r
+   \immediate\write\@auxout{%\r
+    \string\providecommand\string\NAT@force@numbers{}%\r
+    \string\NAT@force@numbers\r
+   }%\r
+  \fi\fi\r
+ }\r
+\newcommand\NAT@force@numbers{%\r
+  \ifNAT@numbers\else\r
+  \PackageError{natbib}{Bibliography not compatible with author-year\r
+  citations.\MessageBreak\r
+  Press <return> to continue in numerical citation style}\r
+  {Check the bibliography entries for non-compliant syntax,\MessageBreak\r
+   or select author-year BibTeX style, e.g. plainnat}%\r
+  \global\NAT@numberstrue\fi}\r
+\r
+\providecommand\bibcite{}\r
+\renewcommand\bibcite[2]{%\r
+ \@ifundefined{b@#1\@extra@binfo}{\relax}{%\r
+   \NAT@citemultiple\r
+   \PackageWarningNoLine{natbib}{Citation `#1' multiply defined}%\r
+ }%\r
+ \global\@namedef{b@#1\@extra@binfo}{#2}%\r
+}%\r
+\AtEndDocument{\NAT@swatrue\let\bibcite\NAT@testdef}\r
+\newcommand\NAT@testdef[2]{%\r
+  \def\NAT@temp{#2}%\r
+  \expandafter \ifx \csname b@#1\@extra@binfo\endcsname\NAT@temp\r
+  \else\r
+    \ifNAT@swa \NAT@swafalse\r
+      \PackageWarningNoLine{natbib}{%\r
+        Citation(s) may have changed.\MessageBreak\r
+        Rerun to get citations correct%\r
+      }%\r
+    \fi\r
+  \fi\r
+}%\r
+\newcommand\NAT@apalk{}\r
+\def\NAT@apalk#1, #2, #3\@nil#4{%\r
+  \if\relax#2\relax\r
+    \global\NAT@stdbsttrue\r
+    \NAT@wrout{#1}{}{}{}{#4}%\r
+  \else\r
+    \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#4}%\r
+  \fi\r
+}%\r
+\newcommand\citeauthoryear{}\r
+\def\citeauthoryear#1#2#3(@)(@)\@nil#4{%\r
+  \if\relax#3\relax\r
+    \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#4}%\r
+  \else\r
+    \NAT@wrout{\the\c@NAT@ctr}{#3}{#2}{#1}{#4}%\r
+  \fi\r
+}%\r
+\newcommand\citestarts{\NAT@open}%\r
+\newcommand\citeends{\NAT@close}%\r
+\newcommand\betweenauthors{and}%\r
+\newcommand\astroncite{}\r
+\def\astroncite#1#2(@)(@)\@nil#3{%\r
+ \NAT@wrout{\the\c@NAT@ctr}{#2}{#1}{}{#3}%\r
+}%\r
+\newcommand\citename{}\r
+\def\citename#1#2(@)(@)\@nil#3{\expandafter\NAT@apalk#1#2, \@nil{#3}}\r
+\newcommand\harvarditem[4][]{%\r
+ \if\relax#1\relax\r
+   \bibitem[#2(#3)]{#4}%\r
+ \else\r
+   \bibitem[#1(#3)#2]{#4}%\r
+ \fi\r
+}%\r
+\newcommand\harvardleft{\NAT@open}\r
+\newcommand\harvardright{\NAT@close}\r
+\newcommand\harvardyearleft{\NAT@open}\r
+\newcommand\harvardyearright{\NAT@close}\r
+\AtBeginDocument{\providecommand{\harvardand}{and}}\r
+\newcommand\harvardurl[1]{\textbf{URL:} \textit{#1}}\r
+\providecommand\bibsection{}\r
+\@ifundefined{chapter}{%\r
+  \renewcommand\bibsection{%\r
+   \section*{\refname\@mkboth{\MakeUppercase{\refname}}{\MakeUppercase{\refname}}}%\r
+  }%\r
+}{%\r
+  \@ifxundefined\NAT@sectionbib{%\r
+    \renewcommand\bibsection{%\r
+      \chapter*{\bibname\@mkboth{\MakeUppercase{\bibname}}{\MakeUppercase{\bibname}}}%\r
+    }%\r
+  }{%\r
+    \renewcommand\bibsection{%\r
+      \section*{\bibname\ifx\@mkboth\@gobbletwo\else\markright{\MakeUppercase{\bibname}}\fi}%\r
+    }%\r
+  }%\r
+}%\r
+\@ifclassloaded{amsart}{\renewcommand\bibsection{\section*{\refname}}}{}%\r
+\@ifclassloaded{amsbook}{\renewcommand\bibsection{\chapter*{\bibname}}}{}%\r
+\@ifxundefined\bib@heading{}{\let\bibsection\bib@heading}%\r
+\newcounter{NAT@ctr}\r
+\renewenvironment{thebibliography}[1]{%\r
+ \bibsection\r
+ \parindent\z@\r
+ \bibpreamble\r
+ \bibfont\r
+ \list{\@biblabel{\the\c@NAT@ctr}}{\@bibsetup{#1}\global\c@NAT@ctr\z@}%\r
+ \ifNAT@openbib\r
+   \renewcommand\newblock{\par}%\r
+ \else\r
+   \renewcommand\newblock{\hskip .11em \@plus.33em \@minus.07em}%\r
+ \fi\r
+ \sloppy\clubpenalty4000\widowpenalty4000\r
+ \sfcode`\.\@m\r
+ \let\NAT@bibitem@first@sw\@firstoftwo\r
+    \let\citeN\cite \let\shortcite\cite\r
+    \let\citeasnoun\cite\r
+}{%\r
+ \bibitem@fin\r
+ \bibpostamble\r
+ \def\@noitemerr{%\r
+  \PackageWarning{natbib}{Empty `thebibliography' environment}%\r
+ }%\r
+ \endlist\r
+ \bibcleanup\r
+}%\r
+\let\bibfont\@empty\r
+\let\bibpreamble\@empty\r
+\let\bibpostamble\@empty\r
+\def\bibcleanup{\vskip-\lastskip}%\r
+\providecommand\reset@font{\relax}\r
+\providecommand\bibname{Bibliography}\r
+\providecommand\refname{References}\r
+\newcommand\NAT@citeundefined{\gdef \NAT@undefined {%\r
+    \PackageWarningNoLine{natbib}{There were undefined citations}}}\r
+\let \NAT@undefined \relax\r
+\newcommand\NAT@citemultiple{\gdef \NAT@multiple {%\r
+    \PackageWarningNoLine{natbib}{There were multiply defined citations}}}\r
+\let \NAT@multiple \relax\r
+\AtEndDocument{\NAT@undefined\NAT@multiple}\r
+\providecommand\@mkboth[2]{}\r
+\providecommand\MakeUppercase{\uppercase}\r
+\providecommand{\@extra@b@citeb}{}\r
+\gdef\@extra@binfo{}\r
+\def\NAT@anchor#1#2{%\r
+ \hyper@natanchorstart{#1\@extra@b@citeb}%\r
+  \def\@tempa{#2}\@ifx{\@tempa\@empty}{}{\@biblabel{#2}}%\r
+ \hyper@natanchorend\r
+}%\r
+\providecommand\hyper@natanchorstart[1]{}%\r
+\providecommand\hyper@natanchorend{}%\r
+\providecommand\hyper@natlinkstart[1]{}%\r
+\providecommand\hyper@natlinkend{}%\r
+\providecommand\hyper@natlinkbreak[2]{#1}%\r
+\AtBeginDocument{%\r
+  \@ifpackageloaded{babel}{%\r
+     \let\org@@citex\@citex}{}}\r
+\providecommand\@safe@activestrue{}%\r
+\providecommand\@safe@activesfalse{}%\r
+\r
+\newcommand\NAT@sort@cites[1]{%\r
+  \let\NAT@cite@list\@empty\r
+  \@for\@citeb:=#1\do{\expandafter\NAT@star@cite\@citeb\@@}%\r
+  \if@filesw\r
+    \expandafter\immediate\expandafter\write\expandafter\@auxout\r
+      \expandafter{\expandafter\string\expandafter\citation\expandafter{\NAT@cite@list}}%\r
+  \fi\r
+  \@ifnum{\NAT@sort>\z@}{%\r
+    \expandafter\NAT@sort@cites@\expandafter{\NAT@cite@list}%\r
+  }{}%\r
+}%\r
+\def\NAT@star@cite{%\r
+  \let\NAT@star@sw\@secondoftwo\r
+  \@ifnum{\NAT@merge>\z@}{%\r
+   \@ifnextchar*{%\r
+    \let\NAT@star@sw\@firstoftwo\r
+    \NAT@star@cite@star\r
+   }{%\r
+    \NAT@star@cite@nostar\r
+   }%\r
+  }{%\r
+   \NAT@star@cite@noextension\r
+  }%\r
+}%\r
+\def\NAT@star@cite@star*{%\r
+ \NAT@star@cite@nostar\r
+}%\r
+\def\NAT@star@cite@nostar{%\r
+ \let\nat@keyopt@open\@empty\r
+ \let\nat@keyopt@shut\@empty\r
+ \@ifnextchar[{\NAT@star@cite@pre}{\NAT@star@cite@pre[]}%\r
+}%\r
+\def\NAT@star@cite@pre[#1]{%\r
+ \def\nat@keyopt@open{#1}%\r
+ \@ifnextchar[{\NAT@star@cite@post}{\NAT@star@cite@post[]}%\r
+}%\r
+\def\NAT@star@cite@post[#1]#2\@@{%\r
+ \def\nat@keyopt@shut{#1}%\r
+ \NAT@star@sw{\expandafter\global\expandafter\let\csname NAT@b*@#2\endcsname\@empty}{}%\r
+ \NAT@cite@list@append{#2}%\r
+}%\r
+\def\NAT@star@cite@noextension#1\@@{%\r
+  \let\nat@keyopt@open\@empty\r
+  \let\nat@keyopt@shut\@empty\r
+  \NAT@cite@list@append{#1}%\r
+}%\r
+\def\NAT@cite@list@append#1{%\r
+  \edef\@citeb{\@firstofone#1\@empty}%\r
+  \if@filesw\@ifxundefined\@cprwrite{}{\expandafter\@cprwrite\@citeb=}\fi\r
+  \if\relax\nat@keyopt@open\relax\else\r
+   \global\expandafter\let\csname NAT@b@open@\@citeb\endcsname\nat@keyopt@open\r
+  \fi\r
+  \if\relax\nat@keyopt@shut\relax\else\r
+   \global\expandafter\let\csname NAT@b@shut@\@citeb\endcsname\nat@keyopt@shut\r
+  \fi\r
+  \toks@\expandafter{\NAT@cite@list}%\r
+  \ifx\NAT@cite@list\@empty\r
+    \@temptokena\expandafter{\@citeb}%\r
+  \else\r
+    \@temptokena\expandafter{\expandafter,\@citeb}%\r
+  \fi\r
+  \edef\NAT@cite@list{\the\toks@\the\@temptokena}%\r
+}%\r
+\newcommand\NAT@sort@cites@[1]{%\r
+  \count@\z@\r
+  \@tempcntb\m@ne\r
+  \let\@celt\delimiter\r
+  \def\NAT@num@list{}%\r
+  \let\NAT@cite@list\@empty\r
+  \let\NAT@nonsort@list\@empty\r
+  \@for \@citeb:=#1\do{\NAT@make@cite@list}%\r
+  \ifx\NAT@nonsort@list\@empty\else\r
+   \protected@edef\NAT@cite@list{\NAT@cite@list\NAT@nonsort@list}%\r
+  \fi\r
+  \ifx\NAT@cite@list\@empty\else\r
+   \protected@edef\NAT@cite@list{\expandafter\NAT@xcom\NAT@cite@list @@}%\r
+  \fi\r
+}%\r
+\def\NAT@make@cite@list{%\r
+  \advance\count@\@ne\r
+  \@safe@activestrue\r
+  \edef\@citeb{\expandafter\@firstofone\@citeb\@empty}%\r
+  \@safe@activesfalse\r
+  \@ifundefined{b@\@citeb\@extra@b@citeb}%\r
+   {\def\NAT@num{A}}%\r
+   {\NAT@parse{\@citeb}}%\r
+  \NAT@ifcat@num\NAT@num\r
+   {\@tempcnta\NAT@num \relax\r
+    \@ifnum{\@tempcnta<\@tempcntb}{%\r
+      \let\NAT@@cite@list=\NAT@cite@list\r
+      \let\NAT@cite@list\@empty\r
+      \begingroup\let\@celt=\NAT@celt\NAT@num@list\endgroup\r
+      \protected@edef\NAT@num@list{%\r
+       \expandafter\NAT@num@celt \NAT@num@list \@gobble @%\r
+      }%\r
+    }{%\r
+      \protected@edef\NAT@num@list{\NAT@num@list \@celt{\NAT@num}}%\r
+      \protected@edef\NAT@cite@list{\NAT@cite@list\@citeb,}%\r
+      \@tempcntb\@tempcnta\r
+    }%\r
+   }%\r
+   {\protected@edef\NAT@nonsort@list{\NAT@nonsort@list\@citeb,}}%\r
+}%\r
+\def\NAT@celt#1{%\r
+  \@ifnum{#1>\@tempcnta}{%\r
+    \xdef\NAT@cite@list{\NAT@cite@list\@citeb,\NAT@@cite@list}%\r
+    \let\@celt\@gobble\r
+  }{%\r
+    \expandafter\def@NAT@cite@lists\NAT@@cite@list\@@\r
+  }%\r
+}%\r
+\def\NAT@num@celt#1#2{%\r
+ \ifx#1\@celt\r
+  \@ifnum{#2>\@tempcnta}{%\r
+    \@celt{\number\@tempcnta}%\r
+    \@celt{#2}%\r
+  }{%\r
+    \@celt{#2}%\r
+    \expandafter\NAT@num@celt\r
+  }%\r
+ \fi\r
+}%\r
+\def\def@NAT@cite@lists#1,#2\@@{%\r
+  \xdef\NAT@cite@list{\NAT@cite@list#1,}%\r
+  \xdef\NAT@@cite@list{#2}%\r
+}%\r
+\def\NAT@nextc#1,#2@@{#1,}\r
+\def\NAT@restc#1,#2{#2}\r
+\def\NAT@xcom#1,@@{#1}\r
+\InputIfFileExists{natbib.cfg}\r
+       {\typeout{Local config file natbib.cfg used}}{}\r
+%% \r
+%% <<<<< End of generated file <<<<<<\r
+%%\r
+%% End of file `natbib.sty'.\r
diff --git a/re2c/doc/tdfa_v2/TODO b/re2c/doc/tdfa_v2/TODO
new file mode 100644 (file)
index 0000000..639902d
--- /dev/null
@@ -0,0 +1,6 @@
+- synthesize rathar than inherit
+- examples for how mark + enum work
+- more examples
+- root position always has nonzero explicit submatch index
+- double explicit submatch group that maps to the same implicit submatch group: ((...)) is collapsed in mark() and enum ()
+- example of tracing mark() and enum()
diff --git a/re2c/doc/tdfa_v2/WileyNJD-AMA.bst b/re2c/doc/tdfa_v2/WileyNJD-AMA.bst
new file mode 100644 (file)
index 0000000..c7570f0
--- /dev/null
@@ -0,0 +1,1094 @@
+% 
+% THIS IS AN ALPHA VERSION!!! 
+%
+% USE AT YOUR OWN RISK
+%
+% This should work for articles...I don't know if it works well for
+% books, etc (give it a try and see!).
+%
+% PLEASE COMPARE RESULTS WITH THE INSTRUCTIONS FOR AUTHORS FOR THE
+% JOURNAL YOU ARE SUBMITTING FOR...I CANNOT ACCEPT RESPONSIBILITY
+% FOR REJECTED MANUSCRIPTS (but I will try to fix it if you point out
+% a bug)
+%
+% AMA Manual of Style (JAMA, Cancer, many others..)
+%    -Up to 6 authors, otherwise 3 authors et al.
+%    -Title in italics
+%    -numeric labels
+%    -order-of-reference.
+%    
+%    Author L, Author S, Author D, et al. Title. Journal. 
+%    YYYY;VOL(NUM):PPP-PPP.
+%
+%
+%   History
+%    9/30/85    (HWT)   IEETR Original version, by Howard Trickey.
+%    1/29/88    (OP&HWT) Updated for BibTeX version 0.99a, Oren Patashnik;
+%    3/27/02    IEETR style used as framework.  Formats heavily changed by
+%               Eric Kort (eric.kort@vai.org)
+%
+%           THIS VERSION DOES NOT WORK WITH BIBTEX 0.98i.
+%
+
+ENTRY
+  { address
+    author
+    booktitle
+    chapter
+    edition
+    editor
+    howpublished
+    institution
+    journal
+    key
+    month
+    note
+    number
+    organization
+    pages
+    publisher
+    school
+    series
+    title
+    type
+    volume
+    year
+  }
+  {}
+  { label }
+
+INTEGERS { output.state before.all mid.sentence after.quote after.sentence
+        after.quoted.block after.block }
+
+FUNCTION {init.state.consts}
+{ #0 'before.all :=
+  #1 'mid.sentence :=
+  #2 'after.quote :=
+  #3 'after.sentence :=
+  #4 'after.quoted.block :=
+  #5 'after.block :=
+}
+
+STRINGS { s t }
+
+FUNCTION {output.nonnull}
+{ 's :=
+  output.state mid.sentence =
+    { "" * write$ }
+    { output.state after.quote =
+    { " " * write$ }
+    { output.state after.block =
+        { add.period$ write$
+          newline$
+          "\newblock " write$
+        }
+        { output.state before.all =
+        'write$
+        { output.state after.quoted.block =
+            { write$
+              newline$
+              "\newblock " write$
+            }
+            { add.period$ " " * write$ }
+          if$
+        }
+          if$
+        }
+      if$
+    }
+      if$
+      mid.sentence 'output.state :=
+    }
+  if$
+  s
+}
+
+FUNCTION {output}
+{ duplicate$ empty$
+    'pop$
+    'output.nonnull
+  if$
+}
+
+FUNCTION {output.check}
+{ 't :=
+  duplicate$ empty$
+    { pop$ "empty " t * " in " * cite$ * warning$ }
+    'output.nonnull
+  if$
+}
+
+FUNCTION {output.bibitem}
+{ newline$
+  "\bibitem{" write$
+  cite$ write$
+  "}" write$
+  newline$
+  ""
+  before.all 'output.state :=
+}
+
+FUNCTION {blank.sep}
+{ after.quote 'output.state :=
+}
+
+FUNCTION {fin.entry}
+{ output.state after.quoted.block =
+    'skip$
+    'add.period$
+  if$
+  write$
+  newline$
+}
+
+FUNCTION {new.block}
+{ output.state before.all =
+    'skip$
+    { output.state after.quote =
+    { after.quoted.block 'output.state := }
+    { after.block 'output.state := }
+      if$
+    }
+  if$
+}
+
+FUNCTION {new.sentence}
+{ output.state after.block =
+    'skip$
+    { output.state before.all =
+    'skip$
+    { after.sentence 'output.state := }
+      if$
+    }
+  if$
+}
+
+FUNCTION {not}
+{   { #0 }
+    { #1 }
+  if$
+}
+
+FUNCTION {and}
+{   'skip$
+    { pop$ #0 }
+  if$
+}
+
+FUNCTION {or}
+{   { pop$ #1 }
+    'skip$
+  if$
+}
+
+FUNCTION {new.block.checka}
+{ empty$
+    'skip$
+    'new.block
+  if$
+}
+
+FUNCTION {new.block.checkb}
+{ empty$
+  swap$ empty$
+  and
+    'skip$
+    'new.block
+  if$
+}
+
+FUNCTION {new.sentence.checka}
+{ empty$
+    'skip$
+    'new.sentence
+  if$
+}
+
+FUNCTION {field.or.null}
+{ duplicate$ empty$
+    { pop$ "" }
+    'skip$
+  if$
+}
+
+FUNCTION {emphasize}
+{ duplicate$ empty$
+    { pop$ "" }
+    { "{\it " swap$ * "}" * }
+  if$
+}
+
+INTEGERS { nameptr namesleft numnames etal}
+
+FUNCTION {format.names}
+{ 's :=  % push the name s, pop s and author (already on stack), assign author to s
+  #1 'nameptr := 
+  #0 'etal :=
+
+  s num.names$ 'numnames :=
+  
+  numnames #6 >
+    {#3 'numnames :=
+     #1 'etal :=
+    }
+    {}
+    %end if 
+  if$
+  
+  numnames 'namesleft :=
+  { namesleft #0 > }
+
+  {s nameptr "{ll~}{ff}" format.name$ 't :=
+    namesleft #1 >
+    {t * ", " * }
+    {t}
+    %end if 
+    if$
+    nameptr #1 + 'nameptr :=
+    namesleft #1 - 'namesleft :=
+  }
+  while$
+
+  etal
+    {", et al. "}
+    {". "}
+  if$
+  *
+}
+
+FUNCTION {format.editors.names}
+{ 's :=  % push the name s, pop s and author (already on stack), assign author to s
+  #1 'nameptr := 
+  #0 'etal :=
+
+  s num.names$ 'numnames :=
+  
+  numnames #6 >
+    {#3 'numnames :=
+     #1 'etal :=
+    }
+    {}
+    %end if 
+  if$
+  
+  numnames 'namesleft :=
+  { namesleft #0 > }
+
+  {s nameptr "{ll~}{ff}" format.name$ 't :=
+    namesleft #1 >
+    {t * ", " * }
+    {t}
+    %end if 
+    if$
+    nameptr #1 + 'nameptr :=
+    namesleft #1 - 'namesleft :=
+  }
+  while$
+
+  etal
+    {", et al. "}
+    {""}
+  if$
+  *
+}
+
+FUNCTION {format.authors}
+{ author empty$
+    { "" }
+    { author format.names }
+  if$
+}
+
+FUNCTION {format.editors}
+{ editor empty$
+    { "" }
+    { editor format.editors.names
+      editor num.names$ #1 >
+    { ", eds." * }
+    { ", ed." * }
+      if$
+    }
+  if$
+}
+
+FUNCTION {format.title}
+{ title empty$
+    { "" }
+    { title ". " *}% modified by SPi-Global on 12Jun2017
+  if$
+}
+
+FUNCTION {format.journal}
+{ journal empty$
+    { "" }
+    { journal ". " *}
+  if$
+}
+
+FUNCTION {format.title.p}
+{ title empty$
+    { "" }
+    { title " " *}
+  if$
+}
+
+FUNCTION {n.dashify}
+{ 't :=
+  ""
+    { t empty$ not }
+    { t #1 #1 substring$ "-" =
+    { t #1 #2 substring$ "--" = not
+        { "--" *
+          t #2 global.max$ substring$ 't :=
+        }
+        {   { t #1 #1 substring$ "-" = }
+        { "-" *
+          t #2 global.max$ substring$ 't :=
+        }
+          while$
+        }
+      if$
+    }
+    { t #1 #1 substring$ *
+      t #2 global.max$ substring$ 't :=
+    }
+      if$
+    }
+  while$
+}
+
+FUNCTION {format.date}
+{ year empty$
+    { "" }
+    { "" * year }
+  if$
+}
+
+FUNCTION {inproformat.date}
+{ year empty$
+    { "" }
+    { "; " * year }
+  if$
+}
+
+FUNCTION {format.btitle}
+%%{ title emphasize
+{ title % modified by SPi-Global on 12Jun2017
+}
+
+FUNCTION {tie.or.space.connect}
+{ duplicate$ text.length$ #3 <
+    { "~" }
+    { " " }
+  if$
+  swap$ * *
+}
+
+FUNCTION {either.or.check}
+{ empty$
+    'pop$
+    { "can't use both " swap$ * " fields in " * cite$ * warning$ }
+  if$
+}
+
+FUNCTION {format.bvolume}
+{ volume empty$
+    { "" }
+    { series empty$
+    'skip$
+    { " " * series * ", vol. " volume * ": " *}
+      if$
+      "volume and number" number either.or.check
+    }
+  if$
+}
+
+FUNCTION {format.number.series}
+{ volume empty$
+    { number empty$
+    { series field.or.null }
+    { output.state mid.sentence =
+        { "no.~" }
+        { "No.~" }
+      if$
+      number *
+      series empty$
+        { "there's a number but no series in " cite$ * warning$ }
+        { " in " * series * }
+      if$
+    }
+      if$
+    }
+    { "" }
+  if$
+}
+
+FUNCTION {format.edition}
+{ edition empty$
+    { "" }
+    { edition "l" change.case$ "~ed." * }
+  if$
+}
+
+INTEGERS { multiresult }
+
+FUNCTION {multi.page.check}
+{ 't :=
+  #0 'multiresult :=
+    { multiresult not
+      t empty$ not
+      and
+    }
+    { t #1 #1 substring$
+      duplicate$ "-" =
+      swap$ duplicate$ "," =
+      swap$ "+" =
+      or or
+    { #1 'multiresult := }
+    { t #2 global.max$ substring$ 't := }
+      if$
+    }
+  while$
+  multiresult
+}
+
+FUNCTION {format.pages}
+{ pages empty$
+    { "" }
+    {":" pages *}
+  if$
+}
+
+FUNCTION {incollecformat.pages}
+{ pages empty$
+    { "" }
+    {" (pp. " pages * ")" *}
+  if$
+}
+
+FUNCTION {format.volume}
+{ volume empty$
+    { "" }
+    { "" volume * }
+  if$
+}
+
+FUNCTION {format.number}
+{ number empty$
+    { "" }
+    { "(" number * ")" *}
+  if$
+}
+
+FUNCTION {format.chapter.pages}
+{ chapter empty$
+    'format.pages
+    { type empty$
+    { "ch.~" chapter * }
+    { type "l" change.case$ chapter tie.or.space.connect }
+      if$
+      pages empty$
+    'skip$
+    { ", " * format.pages * }
+      if$
+    }
+  if$
+}
+
+FUNCTION {format.in.ed.booktitle}
+{ booktitle empty$
+    { "In: " }
+    { "In: " 
+      editor empty$
+    'skip$
+    { " " * format.editors * " " * booktitle emphasize * ", " * }
+      if$
+    }
+  if$
+}
+
+FUNCTION {format.thesis.type}
+{ type empty$
+    'skip$
+    { pop$
+      output.state after.block =
+    { type "t" change.case$ }
+    { type "l" change.case$ }
+      if$
+    }
+  if$
+}
+
+FUNCTION {empty.misc.check}
+{ author empty$ title empty$ howpublished empty$
+  month empty$ year empty$ note empty$
+  and and and and and
+    { "all relevant fields are empty in " cite$ * warning$ }
+    'skip$
+  if$
+}
+
+FUNCTION {format.tr.number}
+{ type empty$
+    %%{ "Tech. Rep." }% modified by SPi-Global - 16Jun2017
+    { "" }
+    'type
+  if$
+  number empty$
+    { "l" change.case$ }
+    { number tie.or.space.connect }
+  if$
+}
+
+FUNCTION {format.addr.pub}
+{ publisher empty$
+    { "" }
+    { address empty$
+    { "" }
+    { address ": " * }
+      if$
+      publisher * " " *
+    }
+  if$
+}
+
+FUNCTION {format.book.addr.pub}
+{ publisher empty$
+    { "" }
+    { address empty$
+    { "" }
+    { address ": " * }
+      if$
+      publisher * "; " *
+    }
+  if$
+}
+
+FUNCTION {format.paddress}
+{ address empty$
+    { "" }
+    { "(" address * ")" * }
+  if$
+}
+
+FUNCTION {format.ppaddress}
+{ address empty$
+    { "" }
+    { "; " address * "" * }
+  if$
+}
+
+FUNCTION {format.article.crossref}
+{ key empty$
+    { journal empty$
+    { "need key or journal for " cite$ * " to crossref " * crossref *
+      warning$
+      ""
+    }
+    { "in {\em " journal * "\/}" * }
+      if$
+    }
+    { "in " key * }
+  if$
+  " \cite{" * crossref * "}" *
+}
+
+FUNCTION {format.crossref.editor}
+{ editor #1 "{vv~}{ll}" format.name$
+  editor num.names$ duplicate$
+  #2 >
+    { pop$ " {\em et~al.}" * }
+    { #2 <
+    'skip$
+    { editor #2 "{ff }{vv }{ll}{ jj}" format.name$ "others" =
+        { " {\em et~al.}" * }
+        { " and " * editor #2 "{vv~}{ll}" format.name$ * }
+      if$
+    }
+      if$
+    }
+  if$
+}
+
+FUNCTION {format.book.crossref}
+{ volume empty$
+    { "empty volume in " cite$ * "'s crossref of " * crossref * warning$
+      "In "
+    }
+    { "Vol.~" volume *
+      " of " *
+    }
+  if$
+  editor empty$
+  editor field.or.null author field.or.null =
+  or
+    { key empty$
+    { series empty$
+        { "need editor, key, or series for " cite$ * " to crossref " *
+          crossref * warning$
+          "" *
+        }
+        { "{\em " * series * "\/}" * }
+      if$
+    }
+    { key * }
+      if$
+    }
+    { format.crossref.editor * }
+  if$
+  " \cite{" * crossref * "}" *
+}
+
+FUNCTION {format.incoll.inproc.crossref}
+{ editor empty$
+  editor field.or.null author field.or.null =
+  or
+    { key empty$
+    { booktitle empty$
+        { "need editor, key, or booktitle for " cite$ * " to crossref " *
+          crossref * warning$
+          ""
+        }
+        { "in {\em " booktitle * "\/}" * }
+      if$
+    }
+    { "in " key * }
+      if$
+    }
+    { "in " format.crossref.editor * }
+  if$
+  " \cite{" * crossref * "}" *
+}
+
+FUNCTION {no.blank.or.punct}
+{  "" * before.all 'output.state :=
+}
+
+FUNCTION {add.semicolon}
+{
+  ";" *
+  no.blank.or.punct
+}
+
+FUNCTION {add.colon}
+{
+  ": " *
+  no.blank.or.punct
+}
+
+FUNCTION {add.space}
+{
+  " " *
+  no.blank.or.punct
+}
+
+FUNCTION {article}
+{ output.bibitem
+  format.authors "author" output.check
+  format.title "title" output.check
+  blank.sep
+  crossref missing$
+    { format.journal emphasize "journal" output.check
+      format.date add.semicolon "year" output.check
+      format.volume output
+      format.number output
+      format.pages output
+    }
+    { format.article.crossref output.nonnull
+      format.pages output
+    }
+  if$
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {book}
+{ output.bibitem
+  author empty$
+    { format.editors "author and editor" output.check }
+    { format.authors output.nonnull
+      crossref missing$
+    { "author and editor" editor either.or.check }
+    'skip$
+      if$
+    }
+  if$
+  format.btitle emphasize "title"  output.check
+  crossref missing$
+    { format.bvolume output
+      new.block
+      format.number.series output
+      format.book.addr.pub "publisher" output.check
+    }
+    { new.block
+      format.book.crossref output.nonnull
+    }
+  if$
+  format.edition output
+  format.date "year" output.check
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {booklet}
+{ output.bibitem
+  format.authors output
+  title empty$
+    { "empty title in " cite$ * warning$
+      howpublished new.sentence.checka
+    }
+    { howpublished empty$ not
+      address empty$ month empty$ year empty$ and and
+      or
+    { format.title.p output.nonnull }
+    { format.title output.nonnull }
+      if$
+      blank.sep
+    }
+  if$
+  howpublished output
+  address output
+  format.date output
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {inbook}
+{ output.bibitem
+  author empty$
+    { format.editors "author and editor" output.check }
+    { format.authors output.nonnull
+      crossref missing$
+    { "author and editor" editor either.or.check }
+    'skip$
+      if$
+    }
+  if$
+  format.btitle "title" output.check
+  crossref missing$
+    { format.bvolume output
+      format.chapter.pages "chapter and pages" output.check
+      new.block
+      format.number.series output
+      format.addr.pub "publisher" output.check
+    }
+    { format.chapter.pages "chapter and pages" output.check
+      new.block
+      format.book.crossref output.nonnull
+    }
+  if$
+  format.edition output
+  format.date "year" output.check
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {incollection}
+{ output.bibitem
+  format.authors "author" output.check
+  format.title "title" output.check
+  blank.sep
+  crossref missing$
+    { format.in.ed.booktitle "booktitle" output.check
+      format.number.series add.period$ add.space output
+      format.bvolume output
+      format.addr.pub "publisher" output.check
+      format.edition output
+      format.date "year" output.check
+      %%format.chapter.pages output
+      incollecformat.pages output
+    }
+    { format.incoll.inproc.crossref output.nonnull
+      format.chapter.pages output
+    }
+  if$
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {inproceedings}
+{ output.bibitem
+  format.authors "author" output.check
+  format.title "title" output.check
+  blank.sep
+  crossref missing$
+    { format.in.ed.booktitle "booktitle" output.check
+      format.bvolume output
+      format.number.series output
+      format.pages output
+      organization output
+      publisher output
+      inproformat.date "year" output.check
+      format.ppaddress output
+    }
+    { format.incoll.inproc.crossref output.nonnull
+      format.pages output
+    }
+  if$
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {conference} { inproceedings }
+
+FUNCTION {manual}
+{ output.bibitem
+  author empty$
+    { organization empty$
+    'skip$
+    { organization output.nonnull
+      address output
+    }
+      if$
+    }
+    { format.authors output.nonnull }
+  if$
+  format.btitle "title" output.check
+  author empty$
+    { organization empty$
+    { address new.block.checka
+      address output
+    }
+    'skip$
+      if$
+    }
+    { organization address new.block.checkb
+      organization output
+      address output
+    }
+  if$
+  format.edition output
+  format.date output
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {mastersthesis}
+{ output.bibitem
+  format.authors "author" output.check
+  format.title "title" output.check
+  blank.sep
+  "Master's thesis" format.thesis.type output.nonnull
+  school "school" output.check
+  address output
+  format.date "year" output.check
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {format.note}
+{ note empty$
+    { "" }
+    { note "; " *}
+  if$
+}
+
+FUNCTION {misc}
+{ output.bibitem
+  format.authors output
+  title empty$
+    { howpublished new.sentence.checka }
+    { howpublished empty$ not
+      month empty$ year empty$ and
+      or
+    { format.title.p output.nonnull }
+    { format.title emphasize output.nonnull }
+      if$
+      blank.sep
+    }
+  if$
+  howpublished output
+  format.note output 
+  %%new.block
+  format.date output
+  fin.entry
+  empty.misc.check
+}
+
+FUNCTION {phdthesis}
+{ output.bibitem
+  format.authors "author" output.check
+  format.btitle "title" output.check
+  new.block
+  "PhD thesis" format.thesis.type output.nonnull
+  school "school" output.check
+  address output
+  format.date "year" output.check
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {proceedings}
+{ output.bibitem
+  editor empty$
+    { organization output }
+    { format.editors output.nonnull }
+  if$
+  format.btitle "title" output.check
+  format.bvolume output
+  format.number.series output
+  format.paddress output
+  editor empty$
+    'skip$
+    { organization output }
+  if$
+  publisher output
+  format.date "year" output.check
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {add.spperiod}
+{
+  ". " *
+  no.blank.or.punct
+}
+
+FUNCTION {techreport}
+{ output.bibitem
+  format.authors "author" output.check
+  format.title emphasize "title" output.check
+  blank.sep
+  format.tr.number add.colon output.nonnull
+  institution "institution" output.check
+  address output
+  add.semicolon add.space format.date "year" output.check
+  new.block
+  note output
+  fin.entry
+}
+
+FUNCTION {unpublished}
+{ output.bibitem
+  format.authors "author" output.check
+  format.title.p "title" output.check
+  blank.sep
+  note "note" output.check
+  format.date output
+  fin.entry
+}
+
+FUNCTION {default.type} { misc }
+
+MACRO {jan} {"Jan."}
+
+MACRO {feb} {"Feb."}
+
+MACRO {mar} {"Mar."}
+
+MACRO {apr} {"Apr."}
+
+MACRO {may} {"May"}
+
+MACRO {jun} {"June"}
+
+MACRO {jul} {"July"}
+
+MACRO {aug} {"Aug."}
+
+MACRO {sep} {"Sept."}
+
+MACRO {oct} {"Oct."}
+
+MACRO {nov} {"Nov."}
+
+MACRO {dec} {"Dec."}
+
+MACRO {acmcs} {"ACM Computing Surveys"}
+
+MACRO {acta} {"Acta Informatica"}
+
+MACRO {cacm} {"Communications ACM"}
+
+MACRO {ibmjrd} {"IBM J. Research and Development"}
+
+MACRO {ibmsj} {"IBM Systems~J."}
+
+MACRO {ieeese} {"IEEE Trans. Software Engineering"}
+
+MACRO {ieeetc} {"IEEE Trans. Computers"}
+
+MACRO {ieeetcad}
+ {"IEEE Trans. Computer-Aided Design"}
+
+MACRO {ipl} {"Information Processing Letters"}
+
+MACRO {jacm} {"J.~ACM"}
+
+MACRO {jcss} {"J.~Computer and System Sciences"}
+
+MACRO {scp} {"Science of Computer Programming"}
+
+MACRO {sicomp} {"SIAM J. Computing"}
+
+MACRO {tocs} {"ACM Trans. Computer Systems"}
+
+MACRO {tods} {"ACM Trans. Database Systems"}
+
+MACRO {tog} {"ACM Trans. Graphics"}
+
+MACRO {toms} {"ACM Trans. Mathematical Software"}
+
+MACRO {toois} {"ACM Trans. Office Information Systems"}
+
+MACRO {toplas} {"ACM Trans. Programming Languages and Systems"}
+
+MACRO {tcs} {"Theoretical Computer Science"}
+
+READ
+
+STRINGS { longest.label }
+
+INTEGERS { number.label longest.label.width }
+
+FUNCTION {initialize.longest.label}
+{ "" 'longest.label :=
+  #1 'number.label :=
+  #0 'longest.label.width :=
+}
+
+FUNCTION {longest.label.pass}
+{ number.label int.to.str$ 'label :=
+  number.label #1 + 'number.label :=
+  label width$ longest.label.width >
+    { label 'longest.label :=
+      label width$ 'longest.label.width :=
+    }
+    'skip$
+  if$
+}
+
+EXECUTE {initialize.longest.label}
+
+ITERATE {longest.label.pass}
+
+FUNCTION {begin.bib}
+{ preamble$ empty$
+    'skip$
+    { preamble$ write$ newline$ }
+  if$
+  "\begin{thebibliography}{"  longest.label  * "}" * write$ newline$
+}
+
+EXECUTE {begin.bib}
+
+EXECUTE {init.state.consts}
+
+ITERATE {call.type$}
+
+FUNCTION {end.bib}
+{ newline$
+  "\end{thebibliography}" write$ newline$
+}
+
+EXECUTE {end.bib}
diff --git a/re2c/doc/tdfa_v2/WileyNJD-v2.cls b/re2c/doc/tdfa_v2/WileyNJD-v2.cls
new file mode 100644 (file)
index 0000000..894d14b
--- /dev/null
@@ -0,0 +1,3458 @@
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+%% This file is copyright by SPi Technologies Ltd. All rights reserved.
+%%
+%% Author:       SPi, LaTeX Development Team, Chennai (India)
+%% Created On: 
+%% Last Modified By:
+%% Last Modified On:
+%% Description:  Class file to support authoring template in LaTeX typesetting 
+%%               for Wiley Journals
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\NeedsTeXFormat{LaTeX2e}[2009/09/24]
+\ProvidesClass{WileyNJD-v2}
+              [2017/06/23 v0.2 Standard LaTeX document class for Journal]
+
+\newif\if@cropmarkson\@cropmarksonfalse
+\newif\if@croppage\@croppagefalse
+\newif\if@draftruleson\@draftrulesonfalse
+\newif\if@exactptsize\@exactptsizefalse
+\newif\if@pagenum   \@pagenumfalse%
+\newif\if@purexml\global\@purexmlfalse
+\newif\if@xml\global\@xmlfalse
+\newif\if@hyperrefon  \@hyperrefonfalse%
+\newif\ifbibunnumbered\global\bibunnumberedtrue%
+\newif\ifproof\global\prooffalse%
+\newif\ifEqnSpan\global\EqnSpantrue% 
+\newif\if@dblspace\global\@dblspacefalse% 
+
+\newif\if@font@stix\global\@font@stixfalse%
+\newif\if@large@design\global\@large@designtrue%
+\newif\if@small@design\global\@small@designfalse%
+
+
+\newif\if@APArefstyle\global\@APArefstylefalse%
+\newif\if@AMSrefstyle\global\@AMSrefstylefalse%
+\newif\if@AMArefstyle\global\@AMArefstylefalse%
+\newif\if@Vancouverrefstyle\global\@Vancouverrefstylefalse%
+\newif\if@Chemistryrefstyle\global\@Chemistryrefstylefalse%
+
+\newif\if@STIXLargeOneCol\global\@STIXLargeOneColfalse%
+\newif\if@STIXSmall\global\@STIXSmallfalse%
+\newif\if@STIXLargeTwoCol\global\@STIXLargeTwoColfalse%
+
+\newif\if@LATOLargeOneCol\global\@LATOLargeOneColfalse%
+\newif\if@LATOSmall\global\@LATOSmallfalse%
+\newif\if@LATOLargeTwoCol\global\@LATOLargeTwoColfalse%
+
+\def\dummyalphabet{\vphantom{abcdefghijklmnopqrstuvwxyz0123456789}}
+
+\DeclareOption{STIX1COL}{\global\@STIXLargeOneColtrue\global\@font@stixtrue}
+\DeclareOption{STIX2COL}{\global\@STIXLargeTwoColtrue\global\@font@stixtrue}
+\DeclareOption{STIXSMALL}{\global\@STIXSmalltrue \global\@font@stixtrue}
+\DeclareOption{LATO1COL}{\global\@LATOLargeOneColtrue\global\@font@stixfalse}
+\DeclareOption{LATO2COL}{\global\@LATOLargeTwoColtrue\global\@font@stixfalse}
+\DeclareOption{LATOSMALL}{\global\@LATOSmalltrue\global\@font@stixfalse}
+
+
+\DeclareOption{APA}{\global\@APArefstyletrue}
+\DeclareOption{AMS}{\global\@AMSrefstyletrue}
+\DeclareOption{ACS}{\global\@Chemistryrefstyletrue}
+\DeclareOption{AMA}{\global\@AMArefstyletrue}
+\DeclareOption{VANCOUVER}{\global\@Vancouverrefstyletrue}
+
+\DeclareOption{doublespace}{\global\@dblspacetrue}
+
+\DeclareOption{draftrules}{\global\@draftrulesontrue}
+\DeclareOption{exactsize}{\global\@exactptsizetrue}%
+\DeclareOption{noexactsize}{\global\@exactptsizefalse}%
+\DeclareOption{croppage}{\global\@croppagetrue\global\@cropmarksontrue}%
+\DeclareOption{number}{\xdef\@biboptions{numbers}}
+\DeclareOption{numbers}{\xdef\@biboptions{numbers}}
+\DeclareOption{EqnSpan}{\global\EqnSpantrue}%%
+
+\DeclareOption{proof}{%
+\global\prooftrue%
+\global\@hyperrefontrue%
+}%
+
+\DeclareOption{final}{%
+\global\prooffalse%
+\global\@hyperrefontrue% links and bookmarks are removed through PDF action list post PDF creation
+}%
+
+\def\@JrnlID{}%
+\gdef\JrnlID#1{\gdef\@JrnlID{#1}}%
+
+\def\@YES{YES}%
+\def\@NO{NO}%
+
+%
+%%%%%%%%% From Boolean Package %%%%%%%%%
+%
+
+\newcommand {\TRUE}[2]{#1}
+\newcommand {\FALSE}[2]{#2}
+
+%% Public commands are also given inner hidden names
+
+\let \bln@true \TRUE
+\let \bln@false \FALSE
+
+\newcommand {\AND}[2]{#1{#2}{\bln@false}}
+\newcommand {\OR}[2]{#1{\bln@true}{#2}}
+\newcommand {\NOT}[1]{#1{\bln@false}{\bln@true}}
+\newcommand {\IF}[3]{#1{#2}{#3}}
+
+\let \bln@and \AND
+\let \bln@or  \OR
+\let \bln@not \NOT
+\let \bln@if  \IF
+
+
+%% To convert if.. macros into Booleans:
+
+\newcommand {\texbool}[1]
+    {#1\let \bln@do \bln@true \else \let \bln@do \bln@false\fi \bln@do}
+%% Does not work
+\let \bln@tex \texbool
+
+\newcommand {\ifxbool}[2]
+    {\ifx #1#2\let \bln@do \bln@true \else \let \bln@do \bln@false \fi \bln@do}
+\let \bln@ifx \ifxbool
+
+\newcommand {\ifybool}[2]
+    {\def \bln@testa{#1}\ifxbool{\bln@testa}{#2}}
+\let \bln@ify \ifybool
+
+\newcommand {\ifequalbool}[2]
+    {\def \bln@testa{#1}\def \bln@testb{#2}\ifxbool{\bln@testa}{\bln@testb}}
+\let \bln@ifequal \ifequalbool
+
+\def \bln@empty {}
+\newcommand {\ifemptybool}[1]
+    {\ifybool{#1}{\bln@empty}}
+\let \bln@ifempty \ifemptybool
+
+%% To force evaluation, e.g. if a blnlean expression is to be used several
+%% times. This takes a Boolean expression and returns a Boolean value, i.e.
+%% \True or \False.
+
+\newcommand* {\letboolval}[2]
+        {#2{\let #1\bln@true}{\let #1\bln@false}}
+\newcommand* {\newboolval}[2]
+        {\@ifdefinable #1{\letboolval{#1}{#2}}}
+
+%% We provide list versions of And and Or
+
+\def \bln@scan #1,#2\bln@to#3#4{%
+    \bln@ifempty{#2}{#3{#4}{#1}}
+          {\bln@scan #2\bln@to {#3}{#3{#4}{#1}}}%
+}
+\def \bln@eval #1#2#3{%
+    \bln@ifempty{#1}{#3}%
+          {\bln@scan #1,\bln@to {#2}{#3}}%
+}
+
+\newcommand*{\ANDL}[1]{\bln@eval {#1}{\bln@and}{\bln@true}}
+\newcommand*{\ORL} [1]{\bln@eval {#1}{\bln@or}{\bln@false}}
+
+%% In some contexts, shorter names may be more convenient
+
+\newcommand*{\ShorterBooleanNames}{%
+  \let \true  \bln@true
+  \let \false \bln@true
+  \let \or    \bln@or
+  \let \and   \bln@and
+  \let \not   \bln@not
+  \let \orl   \bln@orl
+  \let \andl  \bln@andl
+}
+
+%% Comparisson between strings
+
+\newcommand {\stringmatch}[3]{%
+   \def \@match ##1#2##2\str@sep ##3\str@sep ##4\str@end
+        {#1{##1}{##2}{\ifequalbool{#2}{##3}}}%
+   \@match #3\str@sep #2\str@sep \str@sep \str@end
+}
+\let \str@match \stringmatch
+
+%% The following commands takes in order Prefix Infix Suffix Left
+
+\def \str@infix  #1#2#3{#3}
+\def \str@prefix #1#2#3{\AND{#3}{\ifemptybool{#1}}}
+\def \str@suffix #1#2#3{\AND{#3}{\ifemptybool{#2}}}
+
+\newcommand {\ifstringinfix} {\str@match {\str@infix}}
+\newcommand {\ifstringsuffix}{\str@match {\str@suffix}}
+\newcommand {\ifstringprefix}{\str@match {\str@prefix}}
+
+%%%%%%%%%%% From ifjobname Package %%%%%%%%%%%%%
+
+\edef \@jobname {\jobname}
+
+%% Simple equality
+\def \job@eattwo #1#2{}
+\def \ifjobname #1{%
+   \edef \job@tmp {\expandafter \string \csname x#1\endcsname}%
+   \edef \job@name {\expandafter \job@eattwo \job@tmp}%
+   \ifxbool{\@jobname}{\job@name}%
+}
+
+%%
+
+\newtoks \job@temptoken
+
+\def \ifjob@iffix #1#2{%
+   \edef \@tmp {\expandafter \string \csname x#2\endcsname}%
+   \edef \job@name {\expandafter \job@eattwo \@tmp}%
+   \job@temptoken{\def \@match ##1}%
+   \@temptokena={##2\relax ##3\relax
+           {\def \tmp@prefix {##1}\def \tmp@suffix {##2}\def \tmp@left
+           {##3}}}%
+   \let \arg@one \job@name%
+   \edef \@tmp{\the \job@temptoken\job@name\the \@temptokena}\@tmp
+   \edef \@tmp{\noexpand\@match \@jobname \relax \job@name \relax \relax}\@tmp
+   #1}
+
+\def \job@infix {\ifxbool{\tmp@left}{\arg@one}}
+\def \job@suffix
+     {\AND{\ifxbool{\tmp@left}{\arg@one}}{\ifxbool{\empty}{\tmp@suffix}}}
+\def \job@prefix
+     {\AND{\ifxbool{\tmp@left}{\arg@one}}{\ifxbool{\empty}{\tmp@prefix}}}
+
+\newcommand {\ifjobinfix} {\ifjob@iffix {\job@infix}}
+\newcommand {\ifjobsuffix}{\ifjob@iffix {\job@suffix}}
+\newcommand {\ifjobprefix}{\ifjob@iffix {\job@prefix}}
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+%\ExecuteOptions{twosidecrop,crop,centre,noinfo,a3paper,exactsize,croppage}%
+\ProcessOptions
+\LoadClass[twoside,fleqn,onecolumn]{article}%
+
+%\usepackage{etex}%
+%\reserveinserts{28}% included etex package and \reserveinserts{...} to avoid no room for \newinserts, \newcounts or \newskips etc.
+\RequirePackage{graphicx,multicol}%
+\RequirePackage{multirow}%
+\RequirePackage{cuted}%
+\RequirePackage{ifpdf}%
+\RequirePackage{url}\def\UrlFont{}%\urlstyle{sf}
+\RequirePackage[strict]{changepage}%
+\RequirePackage{calc}%
+\RequirePackage{xcolor}%
+\RequirePackage{float}%
+\RequirePackage{floatpag}%
+\floatpagestyle{headings}%
+\rotfloatpagestyle{headings}%modified from plain to headings to get header and footer for sidewaystable%
+\RequirePackage{dblfloatfix}%
+\RequirePackage[figuresright]{rotating}%
+\RequirePackage{longtable}%
+%%\RequirePackage{threeparttable}%
+\RequirePackage{ulem}%
+\RequirePackage{enumerate}%
+\RequirePackage{soul}
+\usepackage{caption}
+%%
+%\if@hyperrefon%
+%  \if@xml%
+     \RequirePackage{hyperref}%
+%  \else%
+%     \RequirePackage{hyperref}%
+%  \fi%
+%  \RequirePackage{breakurl}%
+  \hypersetup{bookmarksopen=true,%
+              bookmarksdepth=3}%
+  \RequirePackage{bookmark}% if bookmark package is commented bookmarks are getting printed at the beginning of the file in the output
+%\else%
+%  \RequirePackage{hyperref}%
+%  \RequirePackage{breakurl}%
+%  \hypersetup{bookmarksopen=true,%
+%              bookmarksdepth=3}%
+%  \RequirePackage{bookmark}% if bookmark package is commented bookmarks are getting printed at the beginning of the file in the output
+%\fi%
+\IfFileExists{subfigure.sty}{}{\RequirePackage[labelformat=empty]{subfig}}%
+
+\RequirePackage{twoopt}%
+\RequirePackage[bottom]{footmisc}% to place footnotes below floats
+
+%\if@xml%
+%\else%
+%%%%%%% For pagenumbering automations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%\usepackage{alphalph}%
+%\usepackage[pagecontinue=true,alphMult=ab,AlphMulti=AB,fnsymbolmult=true,romanMult=true,RomanMulti=true]{pageslts}
+%\AtBeginDocument{\pagenumbering{arabic}}%% for pagesLTS package
+%%%%%%% end pagenumbering automations %%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%\fi%
+
+\AtBeginDocument{\if@dblspace\usepackage{setspace}\doublespacing\fi}%
+
+\RequirePackage{tabularx}%%  COMPULSARILY HAS TO BE INPUTTED TO USE \tabpara% XMT: Update
+
+
+%\newcounter{boxcnt}%
+%\newcommand\boxsection[1]{\begingroup\vskip2pt%
+%\refstepcounter{boxcnt}%
+%\vbox{{\textcolor{black!75}{\bfseries BOX \theboxcnt.}}\quad {\bfseries#1}}\par%
+%\removelastskip\vskip4pt%
+%\endgroup}
+
+
+%\usepackage{mdframed}
+%\mdfsetup{linewidth=1pt,topline=true,bottomline=true,skipabove=\topskip,skipbelow=\topskip}
+%\newenvironment{boxtext}{\begingroup\begin{fcolorbox}{black}{white}%
+%}{\par\end{fcolorbox}\endgroup}
+
+%%%%%%%%%%%%%%%%%%%%%boxtext%%%%%%%%%%%%%%%%%%%%%
+\def\ColorDefns{%
+\definecolor{boxrulecol}{cmyk}{0,0,0,0}%
+\definecolor{boxbodycol}{cmyk}{0,0,0,0}}%
+
+\newdimen\tfboxrule%
+\newdimen\bfboxrule%
+
+\def\@spframeb@x#1{%
+  \@tempdima\fboxrule
+  \advance\@tempdima\fboxsep
+  \advance\@tempdima\dp\@tempboxa
+  \leavevmode
+  \hbox{%
+    \lower\@tempdima\hbox{%
+      \vbox{%
+        \hrule\@height\tfboxrule
+        \hbox{%
+          \vrule\@width\fboxrule
+          #1%
+          \vbox{%
+            \vskip\fboxsep
+            \box\@tempboxa
+            \vskip\fboxsep}%
+          #1%
+          \vrule\@width\fboxrule}%
+        \hrule\@height\bfboxrule}%
+                          }%
+        }%
+}%
+
+
+
+\newdimen\BXRuleThickness%
+\BXRuleThickness=0.25pt%
+
+\newdimen\BXleftrightskipdimen%
+\BXleftrightskipdimen=8pt%
+
+\newdimen\BXhsize%
+
+\advance\BXhsize by -2\BXRuleThickness%(rule thickness)
+\advance\BXhsize by -2\BXleftrightskipdimen%(rule thickness)
+
+\newdimen\FreePageSpace%To find out the FreeSpace
+\newdimen\ovsize%
+
+\newskip\adjustskip%
+\adjustskip=0pt plus10pt minus1pt%
+
+\gdef\ComputeFreeSpaceOnPage{%
+\par%
+\ifdim\pagetotal=0pt%
+   \global\FreePageSpace=\vsize%
+   \global\advance\FreePageSpace by -\adjustskip%
+\else%
+   \FreePageSpace=\pagegoal%
+  \ifvoid\footins%
+     \global\advance\FreePageSpace by -\pagetotal%
+     \global\advance\FreePageSpace by -\adjustskip%
+  \else%
+    \setbox3=\vbox{\unvbox\footins}%
+    \htftbox=\ht3%
+    \advance\htftbox by \dp3%
+    \global\advance\FreePageSpace by -\pagetotal%
+    \global\advance\FreePageSpace by -\htftbox%
+    \global\advance\FreePageSpace by -\adjustskip%
+  \fi%
+\fi%
+}%
+
+\newbox\BXbox%
+
+\gdef\overprinton{\special{ps:gsave
+true setoverprint}}
+
+\gdef\overprintoff{\special{ps:grestore
+false setoverprint}}
+
+\long\def\BXboxfirst#1{\begingroup%\undefined%
+\fboxsep=\BXleftrightskipdimen%
+\fboxrule=\BXRuleThickness\tfboxrule=\BXRuleThickness\bfboxrule=\BXRuleThickness%
+\setbox\BXbox=\vbox{\hsize=\BXhsize\hsize=\BXhsize\fbox{\vbox{#1}}}%
+\box\BXbox%
+\endgroup}%
+
+\long\def\BXboxmid#1{\begingroup%\undefined%
+\fboxsep=\BXleftrightskipdimen%
+\fboxrule=\BXRuleThickness\tfboxrule=\BXRuleThickness\bfboxrule=\BXRuleThickness%
+\setbox\BXbox=\vbox{\hsize=\BXhsize\hsize=\BXhsize\fbox{\vbox{#1}}}%
+\box\BXbox%
+\endgroup}%
+
+\long\def\BXboxlast#1{\begingroup%\undefined%
+\fboxsep=\BXleftrightskipdimen%
+\fboxrule=\BXRuleThickness\tfboxrule=\BXRuleThickness\bfboxrule=\BXRuleThickness%
+\setbox\BXbox=\vbox{\hsize=\BXhsize\hsize=\BXhsize\fbox{\vbox{#1}}}%
+\box\BXbox%
+\endgroup}%
+       
+\long\def\BXboxfull#1{\begingroup%
+\fboxsep=\BXleftrightskipdimen%
+\fboxrule=\BXRuleThickness\tfboxrule=\BXRuleThickness\bfboxrule=\BXRuleThickness%
+\setbox\BXbox=\vbox{\hsize=\BXhsize\hsize=\BXhsize\fbox{\vbox{#1}}}%
+\box\BXbox%
+\endgroup}%
+
+\newskip\xxptspaceamount%
+\xxptspaceamount=20pt plus10pt minus5pt%
+
+\newskip\BXboxoutbnewskip%
+\BXboxoutbnewskip=\xxptspaceamount%
+
+\def\BXboxoutbskip{\removelastskip\vskip\BXboxoutbnewskip}%
+
+\newdimen\BXdim%
+
+\def\boxejectdefns{\vfill\eject}%
+
+\long\def\BX#1{\begingroup%
+\ComputeFreeSpaceOnPage%
+\BXdim=\ht#1\advance\BXdim by \dp#1%
+\ifdim\BXdim>\FreePageSpace%
+\advance\FreePageSpace by -\BXboxoutbnewskip%outside space before definition
+\advance\FreePageSpace by -\BXleftrightskipdimen%bottom space in the first box
+  \setbox8=\vbox{\unvbox#1}%
+  \setbox1=\vsplit8to\FreePageSpace%
+  \setbox1=\vbox{\unvbox1}%
+  \setbox2=\vbox{\unvbox8}%
+  \BXboxfirst{\unvbox1}\boxejectdefns%
+\loop\ifdim\ht2>\vsize%
+  \ovsize=\vsize%
+  \advance\ovsize by -2\BXleftrightskipdimen%
+  \setbox1=\vsplit2to\ovsize%
+  \setbox1=\vbox{\unvbox1}%
+  \BXboxmid{\unvbox1}\boxejectdefns%
+\repeat%
+  \BXboxlast{\unvbox2}%
+\else%
+\BXboxfull{\unvbox#1}%
+\fi%
+\endgroup}%
+
+
+
+
+\newbox\BXgraybox%
+\newenvironment{boxtext}{\begingroup\parskip=0pt\parindent=0pt%
+%\let\section=\boxhead%
+\let\@frameb@x\@spframeb@x%
+\fboxsep=5pt\hsize=\BXhsize\parindent=0pt%
+\setbox\BXgraybox=\vbox\bgroup%\leftskip=1pt%
+\nointerlineskip\vskip0pt%%
+%\reset@font\tabbodyfont%
+\removelastskip\noindent}%
+{\egroup\hsize=\hsize\BXboxoutbskip\BX{\BXgraybox}\endgroup}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+
+
+%% ========================================================= %%
+%% If array package is included before dcolumn package,      %%
+%% array environment inside eqnarray throw errors            %%
+%% array package is included in dcolumn package; do not      %%
+%% include array.sty again in Wileyarticle.cls anywhere;     %%
+%% ========================================================= %%
+\RequirePackage{varwidth}%
+\RequirePackage{dcolumn}% 
+%
+%% Fonts Used
+%
+\if@STIXLargeOneCol%
+\RequirePackage[not1,notextcomp,lcgreekalpha]{stix}%
+\usepackage[T1]{fontenc}
+\BXhsize=170mm%
+\else%
+\if@STIXLargeTwoCol%
+\RequirePackage[not1,notextcomp,lcgreekalpha]{stix}%
+\usepackage[T1]{fontenc}
+\BXhsize=19pc%
+\else%
+\if@STIXSmall%
+\RequirePackage[not1,notextcomp,lcgreekalpha]{stix}%
+\usepackage[T1]{fontenc}
+\BXhsize=170mm%
+\else%
+\if@LATOLargeTwoCol%
+\usepackage[default]{lato}
+\usepackage[T1]{fontenc}
+  \fontfamily{fla}%
+ \renewcommand{\rmdefault}{fla}%
+  \renewcommand{\sfdefault}{fla}%
+\BXhsize=19pc%
+\else%
+\if@LATOLargeOneCol%
+\usepackage[default]{lato}
+\usepackage[T1]{fontenc}
+  \fontfamily{fla}%
+ \renewcommand{\rmdefault}{fla}%
+  \renewcommand{\sfdefault}{fla}%
+\everymath{\sf}%  \renewcommand*{\mathsf}{fla}%
+\BXhsize=170mm%
+\else%
+\if@LATOSmall%
+\usepackage[default]{lato}
+\usepackage[T1]{fontenc}
+  \fontfamily{fla}%
+ \renewcommand{\rmdefault}{fla}%
+  \renewcommand{\sfdefault}{fla}%
+\BXhsize=170mm%
+\else%
+\fi\fi\fi\fi\fi\fi%
+
+%\RequirePackage[not1,notextcomp,lcgreekalpha]{stix}%
+
+\captionsetup[figure]{labelformat=simple, labelsep=none, skip=10pt, labelfont=bf}
+\captionsetup[table]{labelformat=simple, labelsep=none, skip=10pt, labelfont=bf}
+\renewcommand{\thefigure}{\arabic{figure}\enspace }
+
+\renewcommand{\thetable}{\arabic{table}\enspace }
+
+\renewcommand\figurename{\textbf{FIGURE}}%%
+\renewcommand\tablename{\textbf{TABLE}} %%
+
+\def\fnum@figure{\figurenumfont{\figurename}\space\relax\textbf{\thefigure\hskip9pt}} %%LN
+
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Layout Settings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+\newlength\trimwidth
+\newlength\trimheight
+\newlength\typewidth
+\newlength\typeheight
+\newlength\normaltextheight
+\newlength\blindfoliodrop
+\newlength\figheight
+\newlength\figwidth
+\newlength\tabledim
+
+\if@STIXLargeOneCol%
+\setlength\paperwidth{210mm}%
+\setlength\paperheight{276mm}%
+
+\setlength\typeheight{62\baselineskip}
+\setlength\textheight{53\baselineskip}%
+\addtolength\textheight{-6.9\p@}%
+
+\setlength\typewidth{177.8mm}
+\setlength\textwidth{177.8mm}
+
+%%\addtolength\textwidth{1.8\p@}
+\setlength\normaltextheight{\textheight}
+%
+\setlength\headheight{12.5\p@}%
+\setlength\headsep   {15.2pt}%
+\setlength\topskip   {6\p@}%
+\setlength\splittopskip   {\topskip}
+%
+\setlength\columnsep{1pc}%
+\addtolength\columnsep{6\p@}%
+\setlength\columnseprule{0\p@}
+%
+\newdimen\columnhsizevalue%
+\columnhsizevalue=\textwidth%
+\advance\columnhsizevalue by -\columnsep%
+\divide\columnhsizevalue by 2%
+%
+\setlength\topmargin{2pc}%
+\addtolength\topmargin{5\p@}%
+\setlength\oddsidemargin{45\p@}%
+\setlength\evensidemargin{45\p@}%
+
+\setlength\footskip{51\p@}
+\setlength\maxdepth{4\p@}
+
+\setlength{\marginparsep}{18\p@}%
+\setlength{\marginparwidth}{5mm}%
+
+\setlength\footnotesep{5.75\p@}
+%\setlength{\skip\footins}{12pt plus2pt minus2pt}%
+\setlength{\skip\footins}{18pt plus2pt minus2pt}%
+
+\newskip\abs@coli@hsize\abs@coli@hsize12pc%
+\newskip\abs@colii@hsize\abs@colii@hsize29pc%
+
+\RequirePackage[paperwidth=210mm,
+    paperheight=276mm,
+%%  top={26pt+21pt+11pt},
+    top={25.5pt+21pt+11pt},
+    headheight={21pt},% incl. rule
+    headsep={11pt},
+    left={\oddsidemargin},
+    right={\evensidemargin},
+%    text={176.5mm,666.5pt}, %%(60 x 11 + 9 (point size) = 669pt)
+    marginparsep=0pt,
+    columnsep=0pt,
+    marginparwidth=0pc,
+    bindingoffset=0mm,
+    footskip=48.5pt,
+    bottom={10.5pt+48.5pt},
+    centering]{geometry}
+\else%
+\if@STIXLargeTwoCol%
+\setlength\paperwidth{210mm}%
+\setlength\paperheight{276mm}%
+
+\setlength\typeheight{62\baselineskip}
+\setlength\textheight{53\baselineskip}%
+\addtolength\textheight{-6.9\p@}%
+
+\setlength\typewidth{177.8mm}
+\setlength\textwidth{177.8mm}
+
+%%\addtolength\textwidth{1.8\p@}
+\setlength\normaltextheight{\textheight}
+%
+\setlength\headheight{12.5\p@}%
+\setlength\headsep   {15.2pt}%
+\setlength\topskip   {6\p@}%
+\setlength\splittopskip   {\topskip}
+%
+\setlength\columnsep{1pc}%
+\addtolength\columnsep{6\p@}%
+\setlength\columnseprule{0\p@}
+%
+\newdimen\columnhsizevalue%
+\columnhsizevalue=\textwidth%
+\advance\columnhsizevalue by -\columnsep%
+\divide\columnhsizevalue by 2%
+%
+\setlength\topmargin{2pc}%
+\addtolength\topmargin{5\p@}%
+\setlength\oddsidemargin{45\p@}%
+\setlength\evensidemargin{45\p@}%
+
+\setlength\footskip{51\p@}
+\setlength\maxdepth{4\p@}
+
+\setlength{\marginparsep}{18\p@}%
+\setlength{\marginparwidth}{5mm}%
+
+\setlength\footnotesep{5.75\p@}
+%\setlength{\skip\footins}{12pt plus2pt minus2pt}%
+\setlength{\skip\footins}{18pt plus2pt minus2pt}%
+
+\newskip\abs@coli@hsize\abs@coli@hsize12pc%
+\newskip\abs@colii@hsize\abs@colii@hsize29pc%
+
+\RequirePackage[paperwidth=210mm,
+    paperheight=276mm,
+%%  top={26pt+21pt+11pt},
+    top={25.5pt+21pt+11pt},
+    headheight={21pt},% incl. rule
+    headsep={11pt},
+    left={\oddsidemargin},
+    right={\evensidemargin},
+%    text={176.5mm,666.5pt}, %%(60 x 11 + 9 (point size) = 669pt)
+    marginparsep=0pt,
+    columnsep=0pt,
+    marginparwidth=0pc,
+    bindingoffset=0mm,
+    footskip=48.5pt,twocolumn,columnsep=1pc,
+    bottom={10.5pt+48.5pt},
+    centering]{geometry}
+\else%
+\if@STIXSmall%
+\setlength\paperwidth{171mm}%
+\setlength\paperheight{246mm}%
+
+\setlength\typeheight{56\baselineskip}
+\setlength\typewidth{177mm}
+%
+\setlength\textheight{47\baselineskip}%
+\addtolength\textheight{-5.1\p@}%
+\setlength\textwidth{33.8pc}
+%\addtolength\textwidth{2\p@}
+\setlength\normaltextheight{\textheight}
+%
+\setlength\headheight{12.5\p@}%
+\setlength\headsep   {21.2pt}%
+\setlength\topskip   {6\p@}%
+\setlength\splittopskip   {\topskip}
+%
+\setlength\columnsep{1pc}%
+\addtolength\columnsep{6\p@}%
+\setlength\columnseprule{0\p@}
+%
+\newdimen\columnhsizevalue%
+\columnhsizevalue=\textwidth%
+\advance\columnhsizevalue by -\columnsep%
+\divide\columnhsizevalue by 2%
+%
+\setlength\topmargin{2pc}%
+%\addtolength\topmargin{4\p@}%
+\setlength\oddsidemargin{40.5\p@}%
+\setlength\evensidemargin{40.5\p@}%
+
+\setlength\footskip{22\p@}
+\setlength\maxdepth{4\p@}
+
+\setlength{\marginparsep}{18\p@}%
+\setlength{\marginparwidth}{5mm}%
+
+\setlength\footnotesep{5.75\p@}
+\setlength{\skip\footins}{12pt plus2pt minus2pt}%
+%\setlength{\skip\footins}{22pt plus2pt minus2pt}%
+
+\setlength\parindent{15pt}% \z@
+
+\setlength\lineskip{1\p@}
+\setlength\normallineskip{1\p@}
+\renewcommand\baselinestretch{}
+\parskip=0pt%
+\newskip\abs@coli@hsize\abs@coli@hsize11pc%
+\newskip\abs@colii@hsize\abs@colii@hsize21.7pc%
+
+\RequirePackage[paperwidth=171mm,
+    paperheight=246mm,
+%%  top={26pt+21pt+11pt},
+    top={25.5pt+21pt+11pt},
+    headheight={21pt},% incl. rule
+    headsep={11pt},
+    left={\oddsidemargin},
+    right={\evensidemargin},
+ %   text={176.5mm,666.5pt}, %%(60 x 11 + 9 (point size) = 669pt)
+    marginparsep=0pt,
+    columnsep=0pt,
+    marginparwidth=0pc,
+    bindingoffset=0mm,
+    footskip=48.5pt,
+    bottom={10.5pt+48.5pt},
+    centering]{geometry}
+\else%
+\if@LATOLargeTwoCol%
+\setlength\paperwidth{210mm}%
+\setlength\paperheight{276mm}%
+
+\setlength\typeheight{62\baselineskip}
+\setlength\textheight{53\baselineskip}%
+\addtolength\textheight{-6.9\p@}%
+
+\setlength\typewidth{177.8mm}
+\setlength\textwidth{177.8mm}
+
+%%\addtolength\textwidth{1.8\p@}
+\setlength\normaltextheight{\textheight}
+%
+\setlength\headheight{12.5\p@}%
+\setlength\headsep   {15.2pt}%
+\setlength\topskip   {6\p@}%
+\setlength\splittopskip   {\topskip}
+%
+\setlength\columnsep{1pc}%
+\addtolength\columnsep{6\p@}%
+\setlength\columnseprule{0\p@}
+%
+\newdimen\columnhsizevalue%
+\columnhsizevalue=\textwidth%
+\advance\columnhsizevalue by -\columnsep%
+\divide\columnhsizevalue by 2%
+%
+\setlength\topmargin{2pc}%
+\addtolength\topmargin{5\p@}%
+\setlength\oddsidemargin{45\p@}%
+\setlength\evensidemargin{45\p@}%
+
+\setlength\footskip{51\p@}
+\setlength\maxdepth{4\p@}
+
+\setlength{\marginparsep}{18\p@}%
+\setlength{\marginparwidth}{5mm}%
+
+\setlength\footnotesep{5.75\p@}
+%\setlength{\skip\footins}{12pt plus2pt minus2pt}%
+\setlength{\skip\footins}{18pt plus2pt minus2pt}%
+
+
+\newskip\abs@coli@hsize\abs@coli@hsize12pc%
+\newskip\abs@colii@hsize\abs@colii@hsize29pc%
+
+\RequirePackage[paperwidth=210mm,
+    paperheight=276mm,
+%%  top={26pt+21pt+11pt},
+    top={25.5pt+21pt+11pt},
+    headheight={21pt},% incl. rule
+    headsep={11pt},
+    left={\oddsidemargin},
+    right={\evensidemargin},
+ %   text={176.5mm,666.5pt}, %%(60 x 11 + 9 (point size) = 669pt)
+    marginparsep=0pt,
+    columnsep=0pt,
+    marginparwidth=0pc,
+    bindingoffset=0mm,
+    footskip=48.5pt,twocolumn,columnsep=1pc,
+    bottom={10.5pt+48.5pt},
+    centering]{geometry}
+\else%
+\if@LATOLargeOneCol%
+\setlength\paperwidth{210mm}%
+\setlength\paperheight{276mm}%
+
+\setlength\typeheight{62\baselineskip}
+\setlength\textheight{53\baselineskip}%
+\addtolength\textheight{-6.9\p@}%
+
+\setlength\typewidth{177.8mm}
+\setlength\textwidth{177.8mm}
+
+%%\addtolength\textwidth{1.8\p@}
+\setlength\normaltextheight{\textheight}
+%
+\setlength\headheight{12.5\p@}%
+\setlength\headsep   {15.2pt}%
+\setlength\topskip   {6\p@}%
+\setlength\splittopskip   {\topskip}
+%
+\setlength\columnsep{1pc}%
+\addtolength\columnsep{6\p@}%
+\setlength\columnseprule{0\p@}
+%
+\newdimen\columnhsizevalue%
+\columnhsizevalue=\textwidth%
+\advance\columnhsizevalue by -\columnsep%
+\divide\columnhsizevalue by 2%
+%
+\setlength\topmargin{2pc}%
+\addtolength\topmargin{5\p@}%
+\setlength\oddsidemargin{45\p@}%
+\setlength\evensidemargin{45\p@}%
+
+\setlength\footskip{51\p@}
+\setlength\maxdepth{4\p@}
+
+\setlength{\marginparsep}{18\p@}%
+\setlength{\marginparwidth}{5mm}%
+
+\setlength\footnotesep{5.75\p@}
+%\setlength{\skip\footins}{12pt plus2pt minus2pt}%
+\setlength{\skip\footins}{18pt plus2pt minus2pt}%
+
+\newskip\abs@coli@hsize\abs@coli@hsize12pc%
+\newskip\abs@colii@hsize\abs@colii@hsize29pc%
+
+
+\RequirePackage[paperwidth=210mm,
+    paperheight=276mm,
+%%  top={26pt+21pt+11pt},
+    top={25.5pt+21pt+11pt},
+    headheight={21pt},% incl. rule
+    headsep={11pt},
+    left={\oddsidemargin},
+    right={\evensidemargin},
+   % text={176.5mm,666.5pt}, %%(60 x 11 + 9 (point size) = 669pt)
+    marginparsep=0pt,
+    columnsep=0pt,
+    marginparwidth=0pc,
+    bindingoffset=0mm,
+    footskip=48.5pt,
+    bottom={10.5pt+48.5pt},
+    centering]{geometry}
+\else%
+\if@LATOSmall%
+\setlength\paperwidth{171mm}%
+\setlength\paperheight{246mm}%
+
+\setlength\typeheight{56\baselineskip}
+\setlength\typewidth{177mm}
+%
+\setlength\textheight{47\baselineskip}%
+\addtolength\textheight{-5.1\p@}%
+\setlength\textwidth{33.8pc}
+%\addtolength\textwidth{2\p@}
+\setlength\normaltextheight{\textheight}
+%
+\setlength\headheight{12.5\p@}%
+\setlength\headsep   {21.2pt}%
+\setlength\topskip   {6\p@}%
+\setlength\splittopskip   {\topskip}
+%
+\setlength\columnsep{1pc}%
+\addtolength\columnsep{6\p@}%
+\setlength\columnseprule{0\p@}
+%
+\newdimen\columnhsizevalue%
+\columnhsizevalue=\textwidth%
+\advance\columnhsizevalue by -\columnsep%
+\divide\columnhsizevalue by 2%
+%
+\setlength\topmargin{2pc}%
+%\addtolength\topmargin{4\p@}%
+\setlength\oddsidemargin{40.5\p@}%
+\setlength\evensidemargin{40.5\p@}%
+
+\setlength\footskip{22\p@}
+\setlength\maxdepth{4\p@}
+
+\setlength{\marginparsep}{18\p@}%
+\setlength{\marginparwidth}{5mm}%
+
+\setlength\footnotesep{5.75\p@}
+\setlength{\skip\footins}{12pt plus2pt minus2pt}%
+%\setlength{\skip\footins}{22pt plus2pt minus2pt}%
+
+\setlength\parindent{15pt}% \z@
+
+\setlength\lineskip{1\p@}
+\setlength\normallineskip{1\p@}
+\renewcommand\baselinestretch{}
+\parskip=0pt%
+
+\newskip\abs@coli@hsize\abs@coli@hsize11pc%
+\newskip\abs@colii@hsize\abs@colii@hsize21.7pc%
+
+\RequirePackage[paperwidth=171mm,
+    paperheight=246mm,
+%%  top={26pt+21pt+11pt},
+    top={25.5pt+21pt+11pt},
+    headheight={21pt},% incl. rule
+    headsep={11pt},
+    left={\oddsidemargin},
+    right={\evensidemargin},
+ %   text={176.5mm,666.5pt}, %%(60 x 11 + 9 (point size) = 669pt)
+    marginparsep=0pt,
+    columnsep=0pt,
+    marginparwidth=0pc,
+    bindingoffset=0mm,
+    footskip=48.5pt,
+    bottom={10.5pt+48.5pt},
+    centering]{geometry}
+\else%
+\fi\fi\fi\fi\fi\fi%
+
+
+%
+\newdimen\parindentvalue%
+\parindentvalue=1em%
+%
+\setlength\parindent{\parindentvalue}%
+%
+\ifpdf%
+    \global\@cropmarksonfalse%
+\else%
+    \if@cropmarkson%
+        \RequirePackage{crop}%
+        \if@croppage%
+            \CROP@size{\paperwidth}{\paperheight}%
+        \fi%
+    \fi%
+\fi%
+
+%
+% Footnotes
+%
+%%\renewcommand\thefootnote{\@fnsymbol\c@footnote}%
+
+
+%
+
+
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%% Pagination Settings %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% Line spacing
+\setlength\lineskip{0\p@}%
+\setlength\normallineskip{0\p@}%
+\renewcommand\baselinestretch{}%
+\parskip=\z@%
+
+\pagenumbering{arabic}%
+\sloppy%
+\frenchspacing%
+%%\flushbottom
+
+%%% special parameters for TeX
+\adjdemerits=100
+\linepenalty=100
+
+
+% Page break penalties
+\@lowpenalty   51
+\@medpenalty  151
+\@highpenalty 301
+
+% Disallow widows and orphans
+\clubpenalty 10000
+\widowpenalty 10000
+
+% Disable page breaks before equations, allow pagebreaks after
+% equations and discourage widow lines before equations.
+\displaywidowpenalty 100
+\predisplaypenalty   10000
+\postdisplaypenalty  0
+
+% Set these global demerits
+\doublehyphendemerits 1000000% corresponds to badness 800
+\finalhyphendemerits  1000000% corresponds to badness 1000
+
+% Allow loose lines rather than overfull lines
+\vbadness=9999%
+\tolerance=9999%
+
+
+% Allow breaking the page in the middle of a paragraph
+\interlinepenalty 0%
+
+% Disallow breaking the page after a hyphenated line
+\brokenpenalty 10000%
+
+% Hyphenation; don't split words into less than three characters
+\lefthyphenmin=3%
+\righthyphenmin=3%
+
+% Float placement parameters
+
+% The total number of floats that can be allowed on a page.
+\setcounter{totalnumber}{10}%
+
+% The maximum number of floats at the top and bottom of a page.
+\setcounter{topnumber}{3}%
+\setcounter{bottomnumber}{3}%
+
+% The maximum part of the top or bottom of a text page that can be
+% occupied by floats. This is set so that at least four lines of text
+% fit on the page.
+\renewcommand\topfraction{.921}%
+\renewcommand\bottomfraction{.921}%
+
+% The minimum amount of a text page that must be occupied by text.
+% This should accomodate four lines of text.
+%%\renewcommand\textfraction{.13}%
+\renewcommand\textfraction{.1}%
+
+% The minimum amount of a float page that must be occupied by floats.
+%%\renewcommand\floatpagefraction{.887}%
+\renewcommand\floatpagefraction{.95}%
+
+% The same parameters repeated for double column output
+%%\renewcommand\dbltopfraction{.88}%
+%%\renewcommand\dblfloatpagefraction{.88}%
+\renewcommand\dbltopfraction{.95}%
+\renewcommand\dblfloatpagefraction{.95}%
+
+% Space between floats
+\setlength\floatsep{24\p@ \@plus 2.875\p@ \@minus 1.4375\p@}%
+
+% Space between floats and text
+\setlength\textfloatsep{24\p@ \@plus 2.875\p@ \@minus 1.4375\p@}%
+%
+%%\def\resettextfloatsep{\makeatletter\setlength\textfloatsep{13.5\p@ \@plus 2.875\p@ \@minus 1.4375\p@}\makeatother}%
+%
+% Space above and below an inline figure
+\setlength\intextsep{24\p@ \@plus 2.875\p@ \@minus 1.4375\p@}%
+
+% For double column floats
+\setlength\dblfloatsep{24\p@ \@plus 2.875\p@ \@minus 1.4375\p@}%
+\setlength\dbltextfloatsep{24\p@ \@plus 2.875\p@ \@minus 1.4375\p@}%
+
+\hyphenation{Figure Figures Table Tables Equation Equations Section Sections Appendix Theorem Lemma Proposition Corollary}% 
+\hyphenation{Claim Conjecture Property Remark Problem Example Definition Algorithm Assumption Axiom Case Hypotheses Note Proof}% 
+
+%%% miscellaneous macros %%%
+\def\zz#1{\vphantom{#1}}%
+\def\nobreaktie{\penalty\@M\hbox{\ }} % tie
+
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Draftrules %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%%% To print grid lines on all pages
+\newdimen\pageheight\global\pageheight=\textheight%
+\newcount\rulecount\rulecount=1%
+%
+\newdimen\leftcolrulepos
+\newdimen\rightcolrulepos
+%
+\edef\slugtoday{\two@digits{\the\day}/\two@digits{\the\month}/\the\year}%
+%
+\def\PrintGridLines{%
+{\color{black!10}%
+    {%
+    \loop%
+    \ifdim\pageheight>0pt%
+        \ifnum\rulecount=1%
+            \advance\pageheight by -1.5pt%
+        \fi%
+        \AtTextUpperLeft{%x
+          \put(0,\LenToUnit{-\pageheight}){%
+            \line(1,0){\LenToUnit{\leftcolrulepos}}}}%
+%%14Mar16%%
+        \AtTextUpperLeft{%
+        \put(\LenToUnit{\rightcolrulepos},\LenToUnit{-\pageheight}){%
+           \line(1,0){\LenToUnit{\leftcolrulepos}}}}%
+        \advance\pageheight-11.5pt%baseline
+        \advance\rulecount\@ne%
+    \repeat%
+}}}%
+%
+\RequirePackage{showframe}
+\if@draftruleson%
+%
+\renewcommand\ShowFramePicture{%
+\leftcolrulepos\columnwidth%
+\rightcolrulepos\columnwidth%
+\advance\rightcolrulepos by \columnsep%
+  \begingroup
+    \normalcolor\thinlines%
+    \put(0,0){
+%    \if@watermarkon\AtTextUpperLeft{%
+%      \put(\LenToUnit{\textwidth},41){\llap{\fontsize{8}{10}\selectfont {\rm JrnlID\ \@JrnlID\_ArtID \@artid\_Proof\#1 - \slugtoday}}}}\fi%
+    \AtTextLowerLeft{%
+      \framebox(\LenToUnit{\textwidth},\LenToUnit{\textheight}){}}%
+      \linethickness{.1pt}%
+      \PrintGridLines%
+    \AtTextLowerLeft{%
+      \put(0,\LenToUnit{-\footskip}){%
+        \line(1,0){\LenToUnit{\textwidth}}}}%
+        \AtTextLowerLeft{%
+          \put(\LenToUnit{\columnwidth},0){%
+            \line(0,1){\LenToUnit{\textheight}}}}%
+            %%For marginpar
+%%14Mar16%%
+        \AtTextLowerLeft{%
+          \put(\LenToUnit{\rightcolrulepos},0){%
+            \line(0,1){\LenToUnit{\textheight}}}}%
+    \AtTextLowerLeft{%
+      \@tempdima=\textwidth\advance\@tempdima\marginparsep%
+      \if@twoside%
+        \ifodd\c@page
+          \if@mparswitch
+            \@tempdima=-\marginparsep\advance\@tempdima-\marginparwidth%
+          \fi
+        \else%
+          \@mparswitchfalse
+          \if@mparswitch
+            \@tempdima=-\marginparsep\advance\@tempdima-\marginparwidth%
+          \fi
+        \fi%
+      \fi%
+    }}%
+  \endgroup
+}%
+\else
+\renewcommand\ShowFramePicture{%
+\leftcolrulepos\columnwidth%
+\rightcolrulepos\columnwidth%
+\advance\rightcolrulepos by \columnsep%
+  \begingroup
+    \normalcolor\thinlines%
+    \put(0,0){
+%    \if@watermarkon\AtTextUpperLeft{%
+%      \put(\LenToUnit{\textwidth},41){\llap{\fontsize{8}{10}\selectfont {\rm JrnlID\ \@JrnlID\_ArtID \@artid\_Proof\#1 - \slugtoday}}}}\fi%
+    }%
+  \endgroup
+}%
+\fi%
+
+%% Miscellaneous macros %%
+
+\newdimen\artopleftskipdim%
+\artopleftskipdim=36.25pt%
+
+\def\hb{\hfill\break}%
+\def\uns{\ifmmode\,\else$\,$\fi}%
+\def\raggedcenter{\leftskip=0pt plus 0.5fil\rightskip=0pt plus 0.5fil\parfillskip=0pt}%
+\def\artopraggedright{\leftskip=\artopleftskipdim\rightskip=0pt plus 1fil\parfillskip=0pt\relax}%
+
+%% Metadata Info %%
+
+\def\@artid{xx}% pub-id
+\def\@jname{xxx}%
+\def\@jvol{\emph{xxx}}%
+\def\@eissn{xx}%
+\def\@pissn{xx}%
+%%\def\@copyyear{xxxx}%
+\def\copyyr{xxxx}%
+\def\@jnlyear{xxxx}%
+\def\@doi{}%
+\def\@pubname{ }%
+\def\@arteditor{}%
+
+\def\artid#1{\gdef\@artid{#1}}%
+\def\@jid{}%
+\def\jid#1{\gdef\@jid{#1}}%
+\def\jname#1{\gdef\@jname{#1}}%
+\def\jvol#1{\gdef\@jvol{#1}}%
+\def\eissn#1{\gdef\@eissn{#1}}%
+\def\pissn#1{\gdef\@pissn{#1}}%
+\def\copyyear#1{\gdef\copyyr{#1}}%
+\def\jyear#1{%%\gdef\copyyear{#1}
+\gdef\@jnlyear{#1}}%
+\def\doi#1{\gdef\@doi{#1}}%
+\def\pubname#1{\gdef\@pubname{#1}}%
+%%\def\arteditor#1{\gdef\@arteditor{\acadeditorfont Academic Editor:\ #1}}%
+%%\def\aceditor#1{\gdef\@arteditor{\acadeditorfont Academic Editor:\ #1}}%
+
+\def\jmonth#1{\gdef\@jmonth{#1}}%
+
+
+\def\@copyeditor{}%
+\def\copyeditor#1{\gdef\@copyeditor{#1}}%
+
+\def\orcid[#1]#2#3{}%
+\newcommand{\orgdiv}[1]{#1}%
+\newcommand{\orgname}[1]{#1}%
+\newcommand{\orgaddress}[1]{#1}%
+\newcommand{\street}[1]{#1}%
+\newcommand{\postcode}[1]{#1}%
+\newcommand{\city}[1]{#1}%
+\newcommand{\state}[1]{#1}%
+\newcommand{\country}[1]{#1}%
+
+%%\def\PI#1{{#1}}%
+%%\def\licenseVal#1{}%
+
+\def\@copyname{}%
+\newcommand\copyrightinfo[2][]{\if!#2!\gdef\@copyname{}\else\gdef\@copyname{\copyrightfont#2\ \@licenseVal}\fi}%
+
+%% Macros for firstpage %%
+
+\def\startpage#1{%
+  \gdef\temp{#1}%
+  \ifx\temp\@empty%
+    \def\@firstpage{1}%
+  \else%
+    \def\@firstpage{#1}%
+    \setcounter{page}{#1}%
+    \setcounter{spagecounter}{#1}%
+  \fi%
+}%
+\def\@firstpage{}
+
+\def\endpage#1{\gdef\@endpage{#1}}
+\def\@endpage{}
+
+%
+%% Cross Link for Author & Address
+%
+\def\jmkLabel#1{\@bsphack\protected@write\@auxout{}{\string\Newlabel{#1}{\@currentlabel}}\@esphack}%
+\def\Newlabel#1#2{\expandafter\xdef\csname X@#1\endcsname{#2}}%
+\def\jmkRef#1{\@ifundefined{X@#1}{0}{\csname X@#1\endcsname}}%
+
+%
+%%%%%%%%%%%%%%%%%% Updation for xml conversion
+%
+\gdef\@FirstPg{}%
+\gdef\@LastPg{}%
+%
+\def\FirstPg#1{\if!#1!\else\gdef\@FirstPg{#1}\fi}%
+\def\LastPg#1{\if!#1!\else\gdef\@LastPg{#1}\fi}%
+
+%\newcount\LastAQCnt%
+
+\newwrite\@xmlpage
+\openout\@xmlpage=\jobname.pag
+\newcounter{spagecounter}
+\newcounter{lpagecounter}
+%%\AtBeginDocument{\setcounter{spagecounter}{\c@page}}
+\AtEndDocument{\setcounter{lpagecounter}{\c@page}%
+\addtocounter{lpagecounter}{-1}%
+\immediate\write\@xmlpage{\string\FirstPg{\thespagecounter}\string\LastPg{\thelpagecounter}}%
+\immediate\write\@auxout{\string\FirstPg{\thespagecounter}\string\LastPg{\thelpagecounter}}%
+\immediate\closeout\@xmlpage%
+}%
+
+%% Fonts definitions %%
+
+\if@font@stix%
+  \def\footnotetextfont{\rmfamily\fontsize{8bp}{10bp}\selectfont}\else%
+  %%
+  \def\footnotetextfont{\rmfamily\fontsize{6bp}{8bp}\selectfont}
+\fi%
+%
+
+
+%\usepackage{microtype}
+%\DisableLigatures[f]{encoding = *, family = * }
+
+\newcommand{\sbdefault}{sb}
+\DeclareRobustCommand\sbseries{\not@math@alphabet\sbseries\mathbf\fontseries\sbdefault\selectfont}
+\DeclareTextFontCommand{\textsb}{\sbseries}
+\DeclareRobustCommand\sfitseries{\not@math@alphabet\sfitseries\normalfont\fontseries{m}\fontshape{it}\selectfont}
+\DeclareTextFontCommand{\textsfi}{\sfitseries}
+\DeclareOldFontCommand{\rm}{\normalfont\rmfamily}{\mathrm}
+\DeclareOldFontCommand{\sf}{\normalfont\sffamily}{\mathsf}
+\DeclareOldFontCommand{\tt}{\normalfont\ttfamily}{\mathtt}
+\DeclareOldFontCommand{\bf}{\normalfont\bfseries}{\mathbf}
+\DeclareOldFontCommand{\it}{\normalfont\itshape}{\mathit}
+\DeclareOldFontCommand{\sl}{\normalfont\slshape}{\@nomath\sl}
+\DeclareOldFontCommand{\sc}{\normalfont\scshape}{\@nomath\sc}
+\DeclareRobustCommand*\cal{\@fontswitch\relax\mathcal}
+\DeclareRobustCommand*\mit{\@fontswitch\relax\mathnormal}
+\if@exactptsize%
+  \def\set@fontsize#1#2#3{%
+    \@defaultunits\@tempdimb#2bp\relax\@nnil%
+    \edef\f@size{\strip@pt\@tempdimb}%
+    \@defaultunits\@tempskipa#3bp\relax\@nnil%
+    \edef\f@baselineskip{\the\@tempskipa}%
+    \edef\f@linespread{#1}%
+    \let\baselinestretch\f@linespread%
+    \def\size@update{%
+      \baselineskip\f@baselineskip\relax%
+      \baselineskip\f@linespread\baselineskip%
+      \normalbaselineskip\baselineskip%
+      \setbox\strutbox\hbox{\vrule\@height.7\baselineskip\@depth.3\baselineskip\@width\z@}%
+      \let\size@update\relax%
+    }%
+  }%
+\fi%
+\renewcommand\normalsize{%
+  \if@font@stix%
+    \@setfontsize\normalsize{10bp}{13bp}%
+  \else%
+    \@setfontsize\normalsize{8bp}{13bp}%
+  \fi%
+  \abovedisplayskip 5.5\p@ \@plus2\p@ \@minus0\p@
+  \abovedisplayshortskip \z@ \@plus3\p@%
+  \belowdisplayshortskip 3\p@ \@plus3\p@ \@minus3\p@%
+  \belowdisplayskip \abovedisplayskip%
+  \let\@listi\@listI}%
+\newcommand{\textbaselineskip}{\baselineskip13bp}%
+\normalsize\baselineskip13bp%
+\newcommand\medsize{%
+  \@setfontsize\small\@viipt{9}%
+  \abovedisplayskip 5\p@ \@plus3\p@ \@minus4\p@
+  \abovedisplayshortskip \z@ \@plus2\p@
+  \belowdisplayshortskip 3\p@ \@plus2\p@ \@minus2\p@
+  \def\@listi{%
+    \leftmargin\leftmargini
+    \topsep 4\p@ \@plus2\p@ \@minus2\p@
+    \parsep 2\p@ \@plus\p@ \@minus\p@
+    \itemsep \parsep}%
+  \belowdisplayskip\abovedisplayskip}
+\renewcommand\small{%
+  \@setfontsize\small\@vpt{7}%
+  \abovedisplayskip 5\p@ \@plus3\p@ \@minus4\p@
+  \abovedisplayshortskip \z@ \@plus2\p@
+  \belowdisplayshortskip 3\p@ \@plus2\p@ \@minus2\p@
+  \def\@listi{%
+    \leftmargin\leftmargini
+    \topsep 4\p@ \@plus2\p@ \@minus2\p@
+    \parsep 2\p@ \@plus\p@ \@minus\p@
+    \itemsep \parsep}%
+  \belowdisplayskip \abovedisplayskip}
+\renewcommand\footnotesize{%
+  \@setfontsize\footnotesize{7.5}{9}%
+  \abovedisplayskip 5\p@ \@plus2\p@ \@minus4\p@
+  \abovedisplayshortskip \z@ \@plus\p@
+  \belowdisplayshortskip 3\p@ \@plus\p@ \@minus2\p@
+  \def\@listi{%
+    \leftmargin\leftmargini
+    \topsep 3\p@ \@plus\p@ \@minus\p@
+    \parsep 2\p@ \@plus\p@ \@minus\p@
+    \itemsep \parsep}%
+  \belowdisplayskip \abovedisplayskip}
+\renewcommand\scriptsize{\@setfontsize\scriptsize\@ixpt\@ixpt}
+\newcommand\scrisize{\@setfontsize\scrisize{9.3}{9}}
+\renewcommand\tiny{\@setfontsize\tiny\@vpt\@vipt}
+\renewcommand\large{\@setfontsize\large{12}{14}}
+\newcommand\larg{\@setfontsize\larg{11}{13}}
+\renewcommand\Large{\@setfontsize\Large{16}{18}}
+\newcommand\fpe{\@setfontsize\fpe{19}{21}}
+\renewcommand\LARGE{\@setfontsize\LARGE\@xviipt{22}}
+\newcommand\rke{\@setfontsize\rke{10}{10}}
+\newcommand\ke{\@setfontsize\ke{9}{10}}
+\newcommand\lke{\@setfontsize\lke{8.4}{8.25}}
+\newcommand\ffe{\@setfontsize\ffe{9}{12}}
+\newcommand\adf{\@setfontsize\adf{10.3}{12}}
+\newcommand\kes{\@setfontsize\kes{8}{9.5}}
+\newcommand\bis{\@setfontsize\bis{9}{10}}
+\newcommand\tdf{\@setfontsize\tdf{14}{16}}
+\newcommand\svo{\@setfontsize\svo{14.5}{16}}
+\renewcommand\huge{\@setfontsize\huge\@xxpt{25}}
+\renewcommand\Huge{\@setfontsize\Huge\@xxvpt{30}}
+%
+%\DeclareMathSizes{24bp}{24}{16.06}{10}%
+%\DeclareMathSizes{15bp}{15}{10}{5}%
+%\DeclareMathSizes{9bp}{9}{6.02}{5.5}
+%\DeclareMathSizes{8bp}{8}{5.35}{4.1}%
+%\DeclareMathSizes{7.5bp}{7.5}{5.35}{4.1}%
+%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% FONT DECLARATION Ends %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% FONTS / COLOR DECLARATION Starts %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%
+\def\dummyalphabet{\vphantom{abcdefghijklmnopqrstuvwxyz0123456789}}
+%
+\sodef\letterspacetwty{}{.2em}{.4em plus1em}{.5em plus 1em minus1em }
+%
+\definecolor{Black}{gray}{0}
+\definecolor{White}{cmyk}{0.0,0.0,0.0,0.0}
+\definecolor{Tcolor}{cmyk}{1,0.8,0.0,0.0}%
+\definecolor{Jcolor}{cmyk}{0.0,0.85,1,0.0}%
+\definecolor{rgray}{cmyk}{0.0,0.0,0.0,0.4}%
+\definecolor{lightgray}{cmyk}{0.0,0.0,0.0,0.2}
+\definecolor{Blue}{cmyk}{1,0.77,0.0,0.0}
+%
+\gdef\@stix@font@defn{%
+  %
+  \def\infoboxfont{\fontfamily{tim}\fontsize{8}{8}\selectfont}%
+  %
+  \def\watermarkfont{\reset@font\fontfamily{\ffdefault}\fontsize{45}{45}\bfseries\selectfont}
+  %
+  \def\pagenumfont{\rmfamily\fontsize{7}{9}\bfseries\selectfont}%
+  \def\cnmpagenumfont{\rmfamily\fontsize{7}{9}\selectfont\bfseries}%
+%%%  \def\runningheadfont{\rmfamily\fontsize{7}{9}\scshape\selectfont}%
+  \def\runningheadfont{\rmfamily\fontsize{7}{9}\selectfont}%New updations 19aug2016
+  \def\runningfootfont{\rmfamily\fontsize{7}{9}\selectfont}%
+  \def\titlepageheadfont{\rmfamily\fontsize{7}{9}\selectfont}%
+  %
+  \def\BRarttypefont{\reset@font\rmfamily\fontsize{18}{18}\fontseries{b}\selectfont}%
+  \def\pubheadfont{\reset@font\rmfamily\fontsize{7}{9}\fontseries{b}\selectfont}%
+  \def\arttypefont{\rmfamily\fontsize{9}{9}\fontseries{b}\selectfont}%
+  \def\SParttypefont{\rmfamily\fontsize{9}{12}\fontseries{b}\selectfont}%
+  \def\titlefont{\rmfamily\fontsize{18}{23}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil\let\mathbcal\titmathbcal}%
+  \def\subtitlefont{\rmfamily\fontsize{16}{21}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\Authorfont{\rmfamily\fontsize{12}{18}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\absheadfont{\hsize\abs@colii@hsize\rmfamily\fontsize{10}{10}\fontseries{b}\selectfont\bfseries\leftskip7\p@\rightskip\leftskip}% LN20FEB2016
+  \def\legalstatementfont{\rmfamily\fontsize{7}{10}\selectfont\leftskip0\p@\rightskip\leftskip}%
+    \def\BRsectionfont{\rmfamily\fontsize{10}{16}\fontseries{b}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\sectionfont{\rmfamily\fontsize{12}{13}\fontseries{b}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\subsectionfont{\rmfamily\fontsize{12}{13}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\subsubsectionfont{\rmfamily\fontsize{12}{13}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\paragraphfont{\rmfamily\fontsize{10.5}{13}\fontseries{b}\selectfont}%
+  \def\subparagraphfont{\rmfamily\fontsize{10}{13}\fontseries{b}\selectfont}%
+  \def\appsectionfont{\rmfamily\fontsize{10}{13}\fontseries{b}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  %
+  \def\boxheadfont{\rmfamily\fontsize{10}{13}\fontseries{b}\selectfont}
+  \def\boxtitlefont{\rmfamily\fontsize{10}{13}\bfseries\selectfont}
+  %
+  \def\GnSabsfont{\rmfamily\fontsize{9}{15}\selectfont}%
+  \def\GnSabsfootfont{\reset@font\rmfamily\fontsize{14}{0}\bfseries\selectfont}%
+  %
+  \def\suppinfofont{\noindent\rmfamily}%
+  \def\suppinfoheadfont{\noindent\fontsize{10}{13}\fontseries{b}\selectfont}%
+  \def\suppinfocaptionfont{\noindent\rmfamily}%
+  %
+  \def\figurenumfont{\rmfamily\fontsize{9bp}{12}\fontseries{b}\selectfont}%
+  \def\figurecaptionfont{\rmfamily\fontsize{8.5bp}{12}\selectfont}
+  \def\bwfiginfofont{\fontfamily{tim}\fontsize{10bp}{10bp}\selectfont}%
+  %
+  \def\tablenumfont{\rmfamily\fontsize{9bp}{11.5bp}\fontseries{b}\selectfont}%
+  \def\keypointheadfont{\reset@font\rmfamily\fontsize{10bp}{13bp}\fontseries{b}\selectfont}%
+  \def\tablecaptionfont{\rmfamily\fontsize{8.5bp}{12bp}\selectfont}
+  \def\tablebodyfont{\rmfamily\fontsize{8.5bp}{11.5bp}\selectfont}
+  \def\tablecolheadfont{\rmfamily\fontsize{8.5bp}{11.5bp}\selectfont\bfseries}
+  \def\tablefootnotefont{\rmfamily\fontsize{7.5bp}{10.5bp}\selectfont}
+  %
+%%  \def\footnotetextfont{\rmfamily\fontsize{8bp}{10bp}\selectfont}
+  %
+  \def\listfont{\normalsize}%
+  %
+  \def\refheadfont{\fontsize{10}{13}\fontseries{b}\selectfont}
+  \def\reflistfont{\fontsize{8.5}{11.5}\selectfont}
+  %
+  \def\biographyheadfont{\fontsize{10}{13}\fontseries{b}\selectfont}
+  %
+  \def\ackheadfont{\fontsize{10}{13}\selectfont\fontseries{b}\selectfont}
+  \def\addressfont{\hsize\abs@coli@hsize\rmfamily\fontsize{8}{11}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\corresfont{\hsize\abs@coli@hsize\rmfamily\fontsize{8}{11}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\FIfont{\hsize\abs@coli@hsize\rmfamily\fontsize{8}{11}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\JELfont{\hsize\abs@coli@hsize\rmfamily\fontsize{8}{11}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\keywordsheadfont{\hsize\abs@colii@hsize\rmfamily\fontsize{8}{8}\selectfont\ifAbstractexist\leftskip7\p@\rightskip\leftskip\fi}%
+  \def\abstractfont{\hsize\abs@colii@hsize\rmfamily\fontsize{10}{15}\selectfont\leftskip7\p@\rightskip\leftskip}%
+  \def\keywordsfont{\rmfamily\fontsize{8}{13}\selectfont\ifAbstractexist\leftskip7\p@\rightskip\leftskip\fi}%
+  %
+}%
+\gdef\@lato@font@defn{%
+  %
+  \def\infoboxfont{\fontfamily{tim}\fontsize{8}{8}\selectfont}%
+  %
+  \def\watermarkfont{\reset@font\fontfamily{\ffdefault}\fontsize{45}{45}\bfseries\selectfont}
+  %
+  \def\pagenumfont{\rmfamily\fontsize{7}{9}\bfseries\selectfont}%
+  \def\cnmpagenumfont{\rmfamily\fontsize{7}{9}\selectfont\bfseries}%
+%%%  \def\runningheadfont{\rmfamily\fontsize{7}{9}\scshape\selectfont}%
+  \def\runningheadfont{\rmfamily\fontsize{7}{9}\selectfont}%New updations 19aug2016
+  \def\runningfootfont{\rmfamily\fontsize{7}{9}\selectfont}%
+  \def\titlepageheadfont{\rmfamily\fontsize{7}{9}\selectfont}%
+  %
+  \def\BRarttypefont{\reset@font\rmfamily\fontsize{18}{18}\fontseries{b}\selectfont}%
+  \def\pubheadfont{\reset@font\rmfamily\fontsize{7}{9}\fontseries{b}\selectfont}%
+  \def\arttypefont{\rmfamily\fontsize{9}{9}\fontseries{b}\selectfont}%
+  \def\SParttypefont{\rmfamily\fontsize{9}{12}\fontseries{b}\selectfont}%
+  \def\titlefont{\rmfamily\fontsize{18}{23}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil\let\mathbcal\titmathbcal}%
+  \def\subtitlefont{\rmfamily\fontsize{16}{21}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\Authorfont{\rmfamily\fontsize{12}{18}\selectfont\bfseries\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\addressfont{\hsize\abs@coli@hsize\rmfamily\fontsize{7}{10}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\corresfont{\hsize\abs@coli@hsize\rmfamily\fontsize{7}{10}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  %
+  \def\FIfont{\hsize\abs@coli@hsize\rmfamily\fontsize{7}{10}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\JELfont{\hsize\abs@coli@hsize\rmfamily\fontsize{7}{10}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\abstractfont{\hsize\abs@colii@hsize\rmfamily\fontsize{8}{13}\selectfont\leftskip7\p@\rightskip\leftskip}%
+  \def\keywordsheadfont{\hsize\abs@colii@hsize\rmfamily\fontsize{7}{7}\selectfont\ifAbstractexist\leftskip7\p@\rightskip\leftskip\fi}%
+  \def\absheadfont{\hsize\abs@colii@hsize\rmfamily\fontsize{10}{10}\fontseries{b}\selectfont\bfseries\leftskip7\p@\rightskip\leftskip}% LN20FEB2016
+  \def\keywordsfont{\rmfamily\fontsize{8}{13}\selectfont\ifAbstractexist\leftskip7\p@\rightskip\leftskip\fi}%
+  \def\legalstatementfont{\rmfamily\fontsize{7}{10}\selectfont\leftskip0\p@\rightskip\leftskip}%
+  %
+  \def\BRsectionfont{\rmfamily\fontsize{10}{16}\fontseries{b}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\sectionfont{\rmfamily\fontsize{10}{13}\fontseries{b}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\subsectionfont{\rmfamily\fontsize{10}{14}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\subsubsectionfont{\rmfamily\fontsize{9}{12.5}\bfseries\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  \def\paragraphfont{\rmfamily\fontsize{8.5}{13}\fontseries{b}\selectfont}%
+  \def\subparagraphfont{\rmfamily\fontsize{8.5}{13}\fontseries{b}\selectfont}%
+  \def\appsectionfont{\rmfamily\fontsize{8}{11}\fontseries{b}\selectfont\leftskip\z@\rightskip\z@ plus1fil}%
+  %
+  \def\boxheadfont{\rmfamily\fontsize{8}{10}\fontseries{b}\selectfont}
+  \def\boxtitlefont{\rmfamily\fontsize{8}{10}\bfseries\selectfont}
+  %
+  \def\GnSabsfont{\rmfamily\fontsize{9}{15}\selectfont}%
+  \def\GnSabsfootfont{\reset@font\rmfamily\fontsize{14}{0}\bfseries\selectfont}%
+  %
+  \def\suppinfofont{\noindent\rmfamily}%
+  \def\suppinfoheadfont{\noindent\fontsize{8}{13}\fontseries{b}\selectfont}%
+  \def\suppinfocaptionfont{\noindent\rmfamily}%
+  %
+  \def\figurenumfont{\rmfamily\fontsize{7bp}{9}\fontseries{b}\selectfont}%
+  \def\figurecaptionfont{\rmfamily\fontsize{8bp}{11}\selectfont}
+  \def\bwfiginfofont{\fontfamily{tim}\fontsize{10bp}{10bp}\selectfont}%
+  %
+  \def\tablenumfont{\rmfamily\fontsize{7bp}{9bp}\fontseries{b}\selectfont}%
+  \def\keypointheadfont{\reset@font\rmfamily\fontsize{9bp}{11bp}\fontseries{b}\selectfont}%
+  \def\tablecaptionfont{\rmfamily\fontsize{8bp}{9bp}\selectfont}
+  \def\tablebodyfont{\rmfamily\fontsize{7.5bp}{9bp}\selectfont}
+  \def\tablecolheadfont{\rmfamily\fontsize{7.5bp}{9bp}\selectfont\bfseries}
+  \def\tablefootnotefont{\rmfamily\fontsize{7.5bp}{9bp}\selectfont}
+  %
+%%  \def\footnotetextfont{\rmfamily\fontsize{8bp}{10bp}\selectfont}
+  %
+  \def\listfont{\normalsize}%
+  %
+  \def\refheadfont{\fontsize{8}{10}\fontseries{b}\selectfont}
+  \def\reflistfont{\fontsize{7.5}{10}\selectfont}
+  %
+  \def\biographyheadfont{\fontsize{8}{10}\fontseries{b}\selectfont}
+  %
+  \def\ackheadfont{\fontsize{8}{9}\selectfont\fontseries{b}\selectfont}
+  %
+}%
+%%
+\gdef\largedesign@lato@font{\@lato@font@defn}%
+%%
+\gdef\largedesign@stix@font{\@stix@font@defn%
+}%
+%%
+\gdef\smalldesign@lato@font{\@lato@font@defn}%
+%%
+\gdef\smalldesign@stix@font{\@stix@font@defn}%
+
+
+\if@large@design%
+  \if@font@stix%
+    \largedesign@stix@font%
+  \else%
+    \largedesign@lato@font%
+  \fi%
+\else%
+  \if@font@stix%
+    \smalldesign@stix@font%
+  \else%
+    \smalldesign@lato@font%
+  \fi%
+\fi%
+%
+\def\listfont{\reset@font\fontfamily{\rmdefault}\normalsize}%
+\def\tablistfont{\tablebodyfont}% 
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% article front matter elements %%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%% article opening Running headers %%
+
+\def\artoprunningheaders{\vbox{\OPRHfont\raggedright%
+\@pubname\par%
+\@jname\par%
+Volume\ \@jvol, Article ID\ \@artid, \thepage~pages\par%
+%%\if@hyperrefon\urlstyle{same}\burlalt{http://dx.doi.org/\@doi}{http://dx.doi.org/\@doi}\else{http://dx.doi.org/\@doi}\fi% this line is not required in the output
+}}
+
+\def\nullartoprunningheaders{\vbox{\OPRHfont\raggedright%
+\phantom{\@pubname}\par%
+\phantom{\@jname}\par%
+\phantom{Volume\ \@jvol, Article ID\ \@artid, \thepage pages}\par%
+%%\if@hyperrefon\urlstyle{same}\burlalt{http://dx.doi.org/\@doi}{http://dx.doi.org/\@doi}\else{http://dx.doi.org/\@doi}\fi%
+}}
+
+%% article category %%
+
+\def\@DocHead{}%
+\def\articletype#1{\gdef\@DocHead{\hsize=\textwidth\arttypefont\bfseries\uline{\uppercase{#1}}}}%
+
+%% article title %%
+
+\def\titlemark#1{\gdef\@titlemark{#1}}%
+\gdef\@titlemark{}%
+
+%%\def\titlefootnotemark#1{\textsuperscript{\hbox{\reset@font\fontsize{12.5}{0}\selectfont$\@fnsymbol{#1}$}}}%
+\def\titlefootnotemark#1{\textsuperscript{$\@fnsymbol{#1}$}}%
+
+\def\title#1{\gdef\@title{\hsize=\textwidth%
+\titlefont#1\addcontentsline{toc}{chapter}{#1}% for bookmarks
+}}%
+\def\shrttitle#1{\gdef\@shrttitle{#1}}\shrttitle{}%
+
+%% article authors %%
+
+\let\sep\@empty%
+\let\authorsep\@empty%
+\let\emailsep\@empty%
+
+\newcount\aucount%
+\newcount\corrauthcount%
+
+%%\def\au@and{\unskip\advance\punctcount by -1, }%
+\def\au@and{\ifnum\punctcount=1\else\ifnum\punctcount=2\ and\advance\punctcount by -1\else\advance\punctcount by -1 \fi \fi}%
+\def\artauthors{}
+
+\newif\if@auemail%
+
+\newcommand{\thecorrauthcount}{\the\corrauthcount}%
+\newcommand{\theaucount}{\the\aucount}%
+\newcommand{\thefnmCnt}{\the\fnmCnt}%
+
+\newcount\authfncnt%
+\authfncnt=0%
+
+\newcount\authfnTmpCnt%
+\authfnTmpCnt=1%
+%
+\gdef\StoreAuthFnText#1#2{%
+\edef\GetRoman{\romannumeral#1}%
+\expandafter\gdef\csname\GetRoman StoreAuthFnTxt\endcsname{#2}%
+}%
+%
+\def\authfndefns{%
+\loop\ifnum\authfncnt>0%
+   \csname\romannumeral\authfnTmpCnt StoreAuthFnTxt\endcsname\par%
+   \StepDownCounter{\authfncnt}%
+   \StepUpCounter{\authfnTmpCnt}%
+\repeat}%
+
+
+\def\author{\advance\aucount\@ne%
+%%\let\footnotetext\authfootnotetext%
+\@ifstar\@@corrauthor\@@author}%
+
+\newcommand{\@@corrauthor}[2][]{\g@addto@macro\artauthors{\undefined%
+\renewcommand{\email}[1]{}%
+\hsize=\textwidth\raggedright%
+\global\advance\aucount\@ne%%
+\global\advance\corrauthcount\@ne%%
+\def\@currentlabel{#2}
+\jmkLabel{corrauth\thecorrauthcount}%
+\Authorfont%
+\def\baselinestretch{1}%
+\authorsep{#2\ifnum\aucount=2\else\ifnum\punctcount=2,\else\ifnum\punctcount=1\relax\else\ifnum\punctcount=0\relax\else,\fi\fi\fi\fi}%
+\unskip\ifx#1\empty\else\textsuperscript{\smash{{%
+\@for\@@affmark:=#1\do{\edef\affnum{\@ifundefined{X@\@@affmark}{1}{\jmkRef{\@@affmark}}}%
+\unskip\sep\affnum\let\sep=,}}}}\fi%
+\def\authorsep{\au@and~}%
+\global\let\sep\@empty%
+}}%
+
+\newcommand\fnm[1]{{\StepUpCounter{\fnmCnt}#1\addtocontents{aq}{\protect{\bfseries Author\ \thefnmCnt}\hfill\protect\break Given Names: #1\hfill\protect\break}}}%
+\newcommand\sur[1]{{#1\addtocontents{aq}{Last Name: #1\protect\par}}}%
+
+\newbox\aufootnotemark%
+
+\newbox\authmarkbox%
+\newif\ifGApresent%
+
+\def\@filtername#1#2\@nil{#1.\ }%
+\def\filtername#1 #2\@nil{%
+\@filtername#1\@nil #2}%
+\newcommand{\@@author}[2][]{%
+\def\temp{#1}\g@addto@macro\artauthors{%
+\def\footnotemark##1{%
+\affilmarkdefns%
+\global\setbox\authmarkbox\hbox{\reset@font\fontfamily{\rmdefault}\fontsize{8.75pt}{0}\selectfont{##1}}}%
+\ifnum\aucount=1%
+    \global\@auemailtrue%
+    \else%
+    \global\@auemailfalse%
+    \fi%
+    \Authorfont%\baselineskip=12pt%
+    \def\baselinestretch{1}%
+   \authorsep{#2}\unskip\ifx\temp\@empty%
+      \@ifundefined{Xname@0}%
+        {\expandafter\xdef\csname Xname@0\endcsname{\filtername#2\@nil}}%
+        {\expandafter\protected@xdef\csname Xname@0\endcsname%
+             {\csname Xname@0\endcsname,\ \filtername#2\@nil}}%
+   \else%
+   \textsuperscript{\smash{{%
+      \@for\@@affmark:=#1\do{\edef\affnum{\@ifundefined{X@\@@affmark}{1}{\jmkRef{\@@affmark}}}%
+      \@ifundefined{Xname@\@@affmark}%
+        {\expandafter\xdef\csname Xname@\@@affmark\endcsname{\filtername#2\@nil}}%
+        {\expandafter\protected@xdef\csname Xname@\@@affmark\endcsname%
+             {\csname Xname@\@@affmark\endcsname,\ \filtername#2\@nil}}%
+     \unskip\sep\ifnum\addcount=1\else\affnum\fi\let\sep=,}}}\unhbox\authmarkbox}\fi%
+    \gdef\authorsep{\enspace|\enspace}%%% 
+    \global\let\sep\@empty\global\let\@corref\@empty%
+}}%
+
+%%\if@purexml\else%
+%
+\newcounter{affn}%
+\renewcommand\theaffn{\arabic{affn}}%
+%
+\def\jmkaddress{}%
+\def\miscjmkaddress{}%
+\def\addsep{\par\vskip0pt}%
+%
+\newcount\addcount% To check the count of address
+%
+\def\address{\advance\addcount\@ne\@ifstar\@@corraddress\@@address}%
+%
+\newcommand{\@@corraddress}[2][]{\gdef\@corresinfo{#2}}%
+%
+\newcommand{\@@address}[2][]{\def\temp{#1}%
+\g@addto@macro\jmkaddress{\hsize=\textwidth%
+\def\baselinestretch{1}%
+\stepcounter{affn}%
+\xdef\@currentlabel{\theaffn}%
+\jmkLabel{#1}%
+\addressfont\ifx#1\empty\else\@hangfrom{\textsuperscript{\smash{\theaffn}}}\fi%
+#2\vphantom{Thy}\par%
+}}%
+%%\fi%
+
+%% email details %%
+
+\newcount\emailcount%
+\newcount\punctcount%
+
+%\def\jmkemail{}%
+%\def\emailand{\ and\ }%
+%\def\@emailsep{\unskip\advance\emailcount by -1\emailand}%
+
+%\newcommand{\email}[1]{%%\global\advance\emailcount\@ne%
+%\let\emailcount\corrauthcount%
+%\g@addto@macro\jmkemail{%
+%\def\emailau{\jmkRef{corrauth\thecorrauthcount};}%
+%\emailsep{\emailau\ #1}\def\emailsep{\@emailsep}}}%
+
+\newcommand{\email}[1]{Email: #1}%
+
+%
+%% Correspondence details
+%
+
+%\def\corresinfotext{Correspondence should be addressed to }%
+%\newcommand{\corresinfo}{{\hsize=\textwidth\corresfont\corresinfotext\jmkemail\par}}%
+
+\gdef\@corresinfo{}%
+\def\corres#1{\gdef\@corresinfo{#1}}%
+
+\newcommand{\corresinfo}{{\corresfont\baselineskip11pt\textbf{Correspondence}\par \@corresinfo\par}}%
+
+\gdef\@presentaddress{}%
+\def\presentaddress#1{\gdef\@presentaddress{\hsize=\textwidth\corresfont\baselineskip11pt\textbf{Present Address}\par #1}}%
+
+%
+\def\received#1{\gdef\@received{Received #1;}}\gdef\@received{}%
+\def\revised#1{\gdef\@revised{Revised #1;}}\gdef\@revised{}%
+\def\accepted#1{\gdef\@accepted{Accepted #1}}\gdef\@accepted{}%
+\def\published#1{\gdef\@published{Published #1}}\gdef\@published{}%
+   \def\xmlreceived{\gdef\@received{\ifnum\artActypcnt=1\relax Received:\ref{MSSreceiveddate}\ReceivedMONTH\nobreakspace{}\kern.5pt\ReceivedYEAR,\else Received:\ref{MSSreceiveddate}\nobreakspace{}\kern.5pt\ReceivedDATE\nobreakspace{}\kern.5pt\ReceivedMONTH\nobreakspace{}\kern.5pt\ReceivedYEAR\fi}}\gdef\@received{}%
+   \def\xmlrevised{\gdef\@revised{Revised:\ref{MSSrevised}\nobreakspace{}\kern.5pt\RevisedDATE\nobreakspace{}\kern.5pt\RevisedMONTH\nobreakspace{}\kern.5pt\RevisedYEAR}}\gdef\@revised{}%
+   \def\xmlaccepted{\gdef\@accepted{\ifnum\artActypcnt=1\relax in final form\ref{ACCdate}\AccMONTH\nobreakspace{}\kern.5pt\AccYEAR\else Accepted:\ref{ACCdate}\nobreakspace{}\kern.5pt\AccDATE\nobreakspace{}\kern.5pt\AccMONTH\nobreakspace{}\kern.5pt\AccYEAR\fi}}\gdef\@accepted{}%
+   \def\xmlacceptedonline{\gdef\@acceptedonline{Accepted article online\ref{PUBaccptdate}\nobreakspace{}\kern.5pt\AccDATEi\nobreakspace{}\kern.5pt\AccMONTHi\nobreakspace{}\kern.5pt\AccYEARi}}\gdef\@acceptedonline{}%
+   \def\xmlpubdate{\gdef\@pubdate{Published on:\ref{PUBEVdate}\nobreakspace{}\kern.5pt\PubDATE\nobreakspace{}\kern.5pt\PubMONTH\nobreakspace{}\kern.5pt\PubYEAR}}\gdef\@pubdate{}%
+
+\newif\ifarticletype\global\articletypefalse
+
+\def\pagenumberalign#1{\hbox to 22.5\p@{#1}}%
+\def\rhvertbar{\smash{\raisebox{-2\p@}{\rule{.5\p@}{10\p@}}}}%
+\def\historydatesvertbar{\hspace*{7\p@}\smash{\raisebox{-4\p@}{\rule{.5\p@}{12\p@}}}\hspace*{7\p@}}%
+\def\foot@pagenumber@align#1{\hbox to 15.75\p@{#1}}%
+\def\foot@vertbar{\hspace*{7\p@}\smash{\raisebox{0\p@}{\rule{.5\p@}{9.25\p@}}}\hspace*{7\p@}}%
+\def\authorseprule#1{\gdef\author@seprule{\hspace*{7\p@}#1\hspace*{7\p@}}}\authorseprule{\smash{\raisebox{.1\p@}{\hbox{\rule{.5\p@}{8.5\p@}}}}}%
+%
+\def\thepagedef{{\pagenumfont\thepage}}%
+
+\def\headfootrule#1{\gdef\@headfootrule{#1}}\headfootrule{{\rule{\textwidth}{.5\p@}}}%
+
+\def\historykern#1{\gdef\history@kern{#1}}\historykern{\nobreakspace{}\kern.5pt}
+\def\@dummy@received{\textcolor{red}{Received:\history@kern{}00\history@kern{}Month\history@kern{}0000}}%
+\def\@dummy@revised{\textcolor{red}{Revised:\history@kern{}00\history@kern{}Month\history@kern{}0000}}%
+\def\@dummy@accepted{\textcolor{red}{Accepted:\history@kern{}00\history@kern{}Month\history@kern{}0000}}%
+\def\@dummy@pubdate{\textcolor{red}{Published\history@kern{}on:\history@kern{}00\history@kern{}Month\history@kern{}0000}}%
+\def\historydates#1{\gdef\@history@dates{#1}}%
+\historydates{{\titlepageheadfont%
+  \ifx\@received\@empty\@dummy@received\else\@received\fi\historydatesvertbar%
+  \ifx\@revised\@empty\@dummy@revised\else\@revised\fi\historydatesvertbar%
+  \ifx\@accepted\@empty\@dummy@accepted\else\@accepted\fi%\historydatesvertbar%
+%  \ifx\@pubdate\@empty\@dummy@pubdate\else\@pubdate\fi%
+}}%
+%
+\def\doiheadtext#1{\gdef\@DOI@text{#1}}\doiheadtext{DOI: xxx/xxxx\nobreakspace{}}%
+\def\head@titlepage@def#1#2{\vbox{%
+  \hbox to \textwidth{#1\dummyalphabet}\par\vspace*{2.5\p@}%
+  \@headfootrule\par\vspace*{9\p@}%
+  \smash{{\titlepageheadfont\@DOI@text#2}}\par\vspace*{9\p@}%
+  \vspace*{-2.5\p@}%
+%  \smash{\hbox to \textwidth{\hfill\rhlogo}}\par%
+}}%
+%
+\newskip\foot@titlepage@raise@skip\global\foot@titlepage@raise@skip23\p@%
+
+\def\oddhead@titlepage@info{\head@titlepage@def{\@history@dates\hfill}{\@doi}}%
+\def\evenhead@titlepage@info{\oddhead@titlepage@info}%
+%
+%\def\oddfoot@titlepage@info{\foot@titlepage@def{\runningfooter}}%
+%\def\evenfoot@titlepage@info{\oddfoot@titlepage@info}%
+%
+\def\ps@titlepage{%
+%  \def\@oddfoot{\oddfoot@titlepage@info}%
+ % \def\@evenfoot{\evenfoot@titlepage@info}%
+  \def\@oddhead{\oddhead@titlepage@info}%
+  \def\@evenhead{\evenhead@titlepage@info}%
+  \let\@mkboth\markboth%
+}%
+
+
+%% Abstract %%
+
+%% Article Abstract
+%% Author name in Running Head
+
+\newcount\lastauthorcnt
+
+\newif\if@suppimage \global\@suppimagefalse
+\newif\ifAbstractexist%
+\global\Abstractexistfalse%
+%% Article Abstract
+\renewcommand\abstract[2][]{\global\Abstractexisttrue%
+  \gdef\@abstract{%
+    \setlength{\parindent}{\z@}%
+    \vspace*{8.5\p@}%
+    \rightskip0pt\raggedright\hspace*{7\p@}\hbox{\reset@font\abstractfont{\absheadfont#1}}\par\vskip3pt% LN20feb2016
+    {\abstractfont\baselineskip15pt\ifFWabstract\hsize\textwidth\fi#2\par\vspace*{0\p@}}%
+    \addcontentsline{toc}{section}{\abstractname}%
+}}%\abstract{}%
+
+%% Correspondence
+\def\correspondencename{Correspondence}
+\def\correspondence#1{%
+  \gdef\@correspondence{%
+    \par\vspace*{3\p@}%
+    {\corresfont\correspondencename\par}%
+    {\corresfont#1\par}%
+  }%
+}\correspondence{}%
+
+%% Funding Information
+\def\fundingNumber#1{#1.}%
+\def\fundingAgency#1{#1,\space}%
+%
+\newcount\fundinginfocount\fundinginfocount0%
+\newcount\commafundinginfocount\commafundinginfocount0%
+\newcount\fundinginfotempcount\fundinginfotempcount0%
+\newcount\tempfundinginfocount\tempfundinginfocount0%
+%
+\def\fundingInfo#1{%
+  \expandafter\protected@xdef\csname fundinginfo\the\fundinginfocount\endcsname{#1}%
+  \global\advance\fundinginfocount1%
+}%
+%
+\def\fundinginfohead#1{\gdef\@fundinginfo@head{#1}}\fundinginfohead{Funding Information}%
+\def\fundinginfoheadtext#1{\gdef\@fundinginfo@head@text{#1}}\fundinginfoheadtext{This research was supported by the }%
+\gdef\@fundinginfo{{%
+  \reset@font\FIfont%
+  \ifnum\fundinginfocount<1\else%
+  \par\vspace*{3\p@}%
+  \@fundinginfo@head\par%
+  \@fundinginfo@head@text%
+  \global\tempfundinginfocount\fundinginfocount%
+  \global\advance\tempfundinginfocount-1%
+  \global\commafundinginfocount\tempfundinginfocount%
+  \global\advance\commafundinginfocount-1%
+  \ifnum\fundinginfocount=1%
+    \ignorespaces\csname fundinginfo0\endcsname%
+  \else%
+    \@whilenum\fundinginfotempcount<\tempfundinginfocount\do{%
+      \ignorespaces\csname fundinginfo\the\fundinginfotempcount\endcsname\ %
+      \global\advance\fundinginfotempcount1%
+    }%
+    \csname fundinginfo\the\fundinginfotempcount\endcsname\par%
+  \fi%
+  \fi%
+\vfill}}%
+
+%% JEL Classification
+\newcount\JELinfocount\JELinfocount0%
+\newcount\commaJELinfocount\commaJELinfocount0%
+\newcount\JELinfotempcount\JELinfotempcount0%
+\newcount\tempJELinfocount\tempJELinfocount0%
+%
+\def\JELinfo#1{%
+  \expandafter\protected@xdef\csname JELinfo\the\JELinfocount\endcsname{#1}%
+  \global\advance\JELinfocount1%
+}%
+%
+\def\JELinfohead#1{\gdef\@JELinfo@head{#1}}\JELinfohead{JEL Classification:\nobreakspace{}}%
+\gdef\@JELinfo{{%
+  \ifnum\JELinfocount<1\else%
+  \reset@font\JELfont%
+  \par\vspace*{3\p@}%
+  \@JELinfo@head%
+  \global\tempJELinfocount\JELinfocount%
+  \global\advance\tempJELinfocount-1%
+  \global\commaJELinfocount\tempJELinfocount%
+  \global\advance\commaJELinfocount-1%
+  \ifnum\JELinfocount=1%
+    \ignorespaces\csname JELinfo0\endcsname%
+  \else%
+    \@whilenum\JELinfotempcount<\tempJELinfocount\do{%
+      \ignorespaces\csname JELinfo\the\JELinfotempcount\endcsname\ %
+      \global\advance\JELinfotempcount1%
+    }%
+    \csname JELinfo\the\JELinfotempcount\endcsname\par\vspace*{-\baselineskip}%
+  \fi%
+  \fi%
+\vfill}}%
+
+%%
+\newbox\htftbox%
+\newdimen\ovsize%
+\newdimen\oovsize%
+\newdimen\FreePageSpace%
+\newdimen\FreePageSpaceTest%
+\newskip\fadjskip\fadjskip=0pt%
+\newskip\adjustskip\adjustskip=0pc%
+\newskip\titleskip%
+
+\gdef\ComputeFreeSpaceOnPage{%
+\par%
+\ifdim\pagetotal=0pt%
+   \global\FreePageSpace=\vsize%
+   \global\advance\FreePageSpace by -\adjustskip%
+\else%
+   \FreePageSpace=\pagegoal%
+  \ifvoid\footins%
+     \global\advance\FreePageSpace by -\pagetotal%
+     \global\advance\FreePageSpace by -\adjustskip%
+  \else%
+    \setbox3=\vbox{\unvbox\footins}%
+    \htftbox=\ht3%
+    \advance\htftbox by \dp3%
+    \global\advance\FreePageSpace by -\pagetotal%
+    \global\advance\FreePageSpace by -\htftbox%
+    \global\advance\FreePageSpace by -\adjustskip%
+  \fi%
+\fi%
+}%
+%%
+
+\definecolor{tenpercent}{cmyk}{0,0,0,0.10}
+\definecolor{thirtyfivepercent}{cmyk}{0,0,0,0.35}
+\definecolor{sixtyfivepercent}{cmyk}{0,0,0,0.65}
+\definecolor{seventyfivepercent}{cmyk}{0,0,0,0.75}
+%
+
+%\newskip\abs@coli@hsize\abs@coli@hsize12pc%
+%\newskip\abs@colii@hsize\abs@colii@hsize29pc%
+
+
+%
+\newbox\abs@boxa%
+\newbox\abs@boxb%
+\newbox\abs@boxc%
+%
+\newdimen\abs@dima%
+\newdimen\abs@dimb%
+\newdimen\abs@dimc%
+%
+\def\absCOvrule{\vrule width0.5pt}%
+\def\authCOvrule{{\color{tenpercent}\vrule width\abs@colii@hsize}}%
+
+\def\FWauthCOvrule{{\color{tenpercent}\vrule width\textwidth}}%
+
+%
+\long\def\absworkarea#1#2{%
+  \setbox\abs@boxa\vbox{\hsize\abs@coli@hsize#1\dummyalphabet}%
+  \abs@dima=\ht\abs@boxa%
+  \advance\abs@dima by \dp\abs@boxa%
+  \advance\abs@dima by -4.5\p@%
+  \setbox\abs@boxb\vbox{\hsize\abs@colii@hsize#2\dummyalphabet}%
+  \abs@dimb=\ht\abs@boxb%
+  \advance\abs@dimb by \dp\abs@boxb%
+  \ComputeFreeSpaceOnPage%
+  \stripsep\z@%
+  \ifdim\abs@dimb>\FreePageSpace%
+    \setbox8=\vbox{\unvbox\abs@boxb}%
+    \advance\FreePageSpace by -\@firstpage@foot@height%
+    %\advance\FreePageSpace by \baselineskip%
+    \setbox1=\vsplit8 to \FreePageSpace%
+    \setbox1=\vbox{\unvbox1}%
+    \setbox2=\vbox{\unvbox8}%
+    \ifdim\abs@dima>\FreePageSpace%
+      \setbox7=\vbox{\unvbox\abs@boxa}%
+      %\advance\FreePageSpace by -\@firstpage@foot@height%
+      %\advance\FreePageSpace by \baselineskip%
+      \setbox3=\vsplit7 to \FreePageSpace%
+      \setbox3=\vbox{\unvbox3}%
+      \setbox4=\vbox{\unvbox7}%
+    \fi%
+    \gdef\abs@dimchk{\ifdim\ht3>\ht1\ht3\else\ht1\fi}%
+    \parbox{\textwidth}{%
+      \begin{minipage}[t]{\abs@coli@hsize}%
+      \leavevmode\vbox to \abs@dimchk{\ifdim\abs@dima>\FreePageSpace\copy3\else\unvbox\abs@boxa\fi\vfill}%
+      \end{minipage}\hfill%
+      \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+      \begin{minipage}[t]{\abs@colii@hsize}%
+      \leavevmode\hspace*{-\textwidth}\vbox to \abs@dimchk{\unvbox1\vfill}%
+      \end{minipage}%
+      \vspace*{\@firstpage@foot@height}%
+    }%\end{strip}%
+    \clearpage%\vfill\eject%
+    \loop%
+    \ifdim\ht2>\textheight%
+    \ovsize=\vsize%
+    \setbox1=\vsplit2 to \ovsize%
+    \setbox1=\vbox{\unvbox1}%
+    \setbox3=\vsplit4 to \ovsize%
+    \setbox3=\vbox{\unvbox3}%
+    %\ifdim\ht4>\textheight%
+    %\oovsize=\vsize%
+    %\setbox3=\vsplit4 to \oovsize%
+    %\setbox3=\vbox{\unvbox3}%
+     \parbox{\textwidth}{%
+      \begin{minipage}[t]{\abs@coli@hsize}%
+      \leavevmode\vbox{\unvbox3\vfill}%
+      \end{minipage}\hfill%
+      \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+      \begin{minipage}[t]{\abs@colii@hsize}%
+      \leavevmode\hspace*{-\textwidth}\vbox{\vspace*{7\p@}\unvbox1\vspace*{7\p@}}%
+      \end{minipage}%
+   }%
+    \clearpage%
+    \repeat%
+    \gdef\abs@dimchk{\ifdim\ht4>\ht2\ht4\else\ht2\fi}%
+     \parbox{\textwidth}{%
+      \begin{minipage}[t]{\abs@coli@hsize}%
+      \leavevmode\vbox to \abs@dimchk{\copy4\vfill}%
+      \end{minipage}
+      \hfill%
+      \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+      \begin{minipage}[t]{\abs@colii@hsize}%
+      \leavevmode\hspace*{-\textwidth}\vbox to \abs@dimchk{\unvbox2\vfill}%
+      \end{minipage}%
+      \vspace*{2pc}%
+      \vskip\titleskip%
+    }%
+  \else%
+    \ifdim\abs@dima>\FreePageSpace%
+      \setbox8=\vbox{\unvbox\abs@boxa}%
+      \advance\FreePageSpace by -\@firstpage@foot@height%
+      %\advance\FreePageSpace by \baselineskip%
+      \setbox1=\vsplit8 to \FreePageSpace%
+      \setbox1=\vbox{\unvbox1}%
+      \setbox2=\vbox{\unvbox8}%
+       \parbox{\textwidth}{%%
+        \begin{minipage}[t]{\abs@coli@hsize}%
+        \leavevmode\vbox{\copy1\vfill}%
+        \end{minipage}\hfill%
+        \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\abs@colii@hsize}%
+        \leavevmode\hspace*{-\textwidth}\vbox to \ht1{\unvbox\abs@boxb\vfill}%
+        \end{minipage}%
+        \vspace*{\@firstpage@foot@height}%
+      }%
+      \clearpage%\vfill\eject%
+      \loop\ifdim\ht2>\textheight%
+      \ovsize=\vsize%
+      \setbox1=\vsplit2 to \ovsize%
+      \setbox1=\vbox{\unvbox1}%
+       \parbox{\textwidth}{%%
+        \begin{minipage}[t]{\abs@coli@hsize}%
+        \leavevmode\vbox{\unvbox1\vfill}%
+        \end{minipage}\hfill%
+        \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\abs@colii@hsize}%
+        \leavevmode\hspace*{-\textwidth}\vbox{\vspace*{7\p@}\unvbox1\vspace*{7\p@}}%
+        \end{minipage}%
+      }%
+      \clearpage%
+      \repeat%
+       \parbox{\textwidth}{%
+        \begin{minipage}[t]{\abs@coli@hsize}%
+        \leavevmode\vbox{\unvbox2\vfill}%
+        \end{minipage}
+        \hfill%
+        \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\abs@colii@hsize}%
+        \leavevmode\hspace*{-\textwidth}\vbox{\vspace*{7\p@}\unvbox2\vspace*{-7\p@}}%
+        \end{minipage}%
+        \vspace*{2pc}%
+        \vskip\titleskip%
+      }%
+    \else%
+      \gdef\abs@dimchk{\ifdim\abs@dima>\abs@dimb\abs@dima\else\abs@dimb\fi}%
+       \parbox{\textwidth}{%%
+        \begin{minipage}[t]{\abs@coli@hsize}%
+        \leavevmode\vbox to \abs@dimchk{\copy\abs@boxa\vfill}%
+        \end{minipage}\hfill%
+        \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\abs@colii@hsize}%
+        \leavevmode\hspace*{-\textwidth}\vbox to \abs@dimchk{\unvbox\abs@boxb\vfill}%
+        \end{minipage}%
+        \vspace*{2pc}%
+        \vskip\titleskip%
+      }%
+    \fi%
+  \fi%
+%%%  \ifx\@titlenotes\@empty\else\global\thankstrue\footnotetext{\@titlenotes\par\vspace*{-\baselineskip}}\fi%
+}%
+
+\long\def\FWabsworkarea#1#2{%
+%  \setbox\abs@boxa\vbox{\hsize\abs@coli@hsize#1\dummyalphabet}%
+%  \abs@dima=\ht\abs@boxa%
+%  \advance\abs@dima by \dp\abs@boxa%
+%  \advance\abs@dima by -4.5\p@%
+  \setbox\abs@boxb\vbox{\hsize\textwidth#2\dummyalphabet}%
+  \abs@dimb=\ht\abs@boxb%
+  \advance\abs@dimb by \dp\abs@boxb%
+  \ComputeFreeSpaceOnPage%
+  \stripsep\z@%
+  %\ifx\@titlenotes\@empty\else\footnotetext{\textsuperscript{1}\@titlenotes\par\vspace*{-2\baselineskip}}\par\vspace*{-2\baselineskip}\fi%
+%%  \ifx\@fundinginfo\@empty\else\footnotetext{\textsuperscript{1}\@fundinginfo\par\vspace*{-2\baselineskip}}\par\vspace*{-2\baselineskip}\fi%
+  \ifdim\abs@dimb>\FreePageSpace%
+    \setbox8=\vbox{\unvbox\abs@boxb}%
+    \advance\FreePageSpace by -\@firstpage@foot@height%
+    %\advance\FreePageSpace by \baselineskip%
+    \setbox1=\vsplit8 to \FreePageSpace%
+    \setbox1=\vbox{\unvbox1}%
+    \setbox2=\vbox{\unvbox8}%
+    \ifdim\abs@dima>\FreePageSpace%
+%      \setbox7=\vbox{\unvbox\abs@boxa}%
+      %\advance\FreePageSpace by -\@firstpage@foot@height%
+      %\advance\FreePageSpace by \baselineskip%
+      \setbox3=\vsplit7 to \FreePageSpace%
+      \setbox3=\vbox{\unvbox3}%
+      \setbox4=\vbox{\unvbox7}%
+    \fi%
+    \gdef\abs@dimchk{\ifdim\ht3>\ht1\ht3\else\ht1\fi}%
+   \parbox{\textwidth}{%
+%      \begin{minipage}[t]{\abs@coli@hsize}%
+%      \leavevmode\vbox to \abs@dimchk{\ifdim\abs@dima>\FreePageSpace\copy3\else\unvbox\abs@boxa\fi\vfill}%
+%      \end{minipage}\hfill%
+\FWauthCOvrule %     \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+      \begin{minipage}[t]{\textwidth}%
+      \leavevmode\hspace*{-\textwidth}\vbox to \abs@dimchk{\unvbox1\vfill}%
+      \end{minipage}%
+      \vspace*{\@firstpage@foot@height}%
+   }% \end{strip}%
+    \vfill\eject%
+    \loop%
+    \ifdim\ht2>\textheight%
+    \ovsize=\vsize%
+    \setbox1=\vsplit2 to \ovsize%
+    \setbox1=\vbox{\unvbox1}%
+    \setbox3=\vsplit4 to \ovsize%
+    \setbox3=\vbox{\unvbox3}%
+    %\ifdim\ht4>\textheight%
+    %\oovsize=\vsize%
+    %\setbox3=\vsplit4 to \oovsize%
+    %\setbox3=\vbox{\unvbox3}%
+    \parbox{\textwidth}{%\begin{strip}%
+    %  \begin{minipage}[t]{\abs@coli@hsize}%
+     % \leavevmode\vbox{\unvbox3\vfill}%
+     % \end{minipage}\hfill%
+      \FWauthCOvrule%
+      \begin{minipage}[t]{\textwidth}%
+      \leavevmode\hspace*{-\textwidth}\vbox{\vspace*{7\p@}\unvbox1\vspace*{7\p@}}%
+      \end{minipage}%
+    }%\end{strip}%
+    \clearpage%
+    \repeat%
+    \gdef\abs@dimchk{\ifdim\ht4>\ht2\ht4\else\ht2\fi}%
+    \parbox{\textwidth}{%\begin{strip}
+     % \begin{minipage}[t]{\abs@coli@hsize}%
+     % \leavevmode\vbox to \abs@dimchk{\copy4\vfill}%
+     % \end{minipage}
+     % \hfill%
+     \FWauthCOvrule% \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+      \begin{minipage}[t]{\textwidth}%
+      \leavevmode\hspace*{-\textwidth}\vbox to \abs@dimchk{\unvbox2\vfill}%
+      \end{minipage}%
+      \vspace*{2pc}%
+      \vskip\titleskip%
+    }%\end{strip}
+  \else%
+    \ifdim\abs@dima>\FreePageSpace%
+%      \setbox8=\vbox{\unvbox\abs@boxa}%
+      \advance\FreePageSpace by -\@firstpage@foot@height%
+      %\advance\FreePageSpace by \baselineskip%
+%      \setbox1=\vsplit8 to \FreePageSpace%
+    %  \setbox1=\vbox{\unvbox1}%
+%      \setbox2=\vbox{\unvbox8}%
+      \parbox{\textwidth}{%\begin{strip}%
+%        \begin{minipage}[t]{\abs@coli@hsize}%
+ %       \leavevmode\vbox{\copy1\vfill}%
+  %      \end{minipage}\hfill%
+   %     \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\textwidth}%
+        \leavevmode\hspace*{-\textwidth}\vbox to \ht1{\unvbox\abs@boxb\vfill}%
+        \end{minipage}%
+        \vspace*{\@firstpage@foot@height}%
+      }%\end{strip}%
+      \vfill\eject%
+      \loop\ifdim\ht2>\textheight%
+      \ovsize=\vsize%
+      \setbox1=\vsplit2 to \ovsize%
+      \setbox1=\vbox{\unvbox1}%
+      \parbox{\textwidth}{%\begin{strip}%
+%        \begin{minipage}[t]{\abs@coli@hsize}%
+ %       \leavevmode\vbox{\unvbox1\vfill}%
+  %      \end{minipage}\hfill%
+   \FWauthCOvrule%     \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\textwidth}%
+        \leavevmode\hspace*{-\textwidth}\vbox{\vspace*{7\p@}\unvbox1\vspace*{7\p@}}%
+        \end{minipage}%
+      }%\end{strip}%
+      \clearpage%
+      \repeat%
+      \parbox{\textwidth}{%\begin{strip}
+   %     \begin{minipage}[t]{\abs@coli@hsize}%
+   %     \leavevmode\vbox{\unvbox2\vfill}%
+   %     \end{minipage}
+   %     \hfill%
+   \FWauthCOvrule%     \hspace*{7\p@}\absCOvrule\hspace*{7\p@}\authCOvrule%
+        \begin{minipage}[t]{\textwidth}%
+        \leavevmode\hspace*{-\textwidth}\vbox{\vspace*{7\p@}\unvbox2\vspace*{-7\p@}}%
+        \end{minipage}%
+        \vspace*{2pc}%
+        \vskip\titleskip%
+      }%\end{strip}
+    \else%
+      \gdef\abs@dimchk{\ifdim\abs@dima>\abs@dimb\abs@dima\else\abs@dimb\fi}%
+     \parbox{\textwidth}{%\begin{strip}%
+       % \begin{minipage}[t]{\abs@coli@hsize}%
+       % \leavevmode\vbox to \abs@dimchk{\copy\abs@boxa\vfill}%
+       % \end{minipage}\hfill%
+        \FWauthCOvrule%
+        \begin{minipage}[t]{\textwidth}%
+        \leavevmode\hspace*{-\textwidth}\vbox to \abs@dimchk{\unvbox\abs@boxb\vfill}%
+        \end{minipage}%
+        \vspace*{2pc}%
+        \vskip\titleskip%
+      }%\end{strip}%
+    \fi%
+  \fi%
+  \ifx\@titlenotes\@empty\else\global\thankstrue\footnotetext{\@titlenotes\par\vspace*{-\baselineskip}}\fi%
+}%
+
+
+\newif\ifabstract\global\abstractfalse%
+\newif\ifFWabstract%
+%
+\gdef\printabstractpart{%
+  \absworkarea{%
+    \noindent{\reset@font\addressfont\jmkaddress\par}%\movedauaddress\@movedauaddress%\@corres%
+   % \noindent\ifx\movedauaddress\@empty\else{\addressfont\@movedauaddress\par}\fi%
+ \removelastskip\vskip8pt%
+   \ifx\@corresinfo\empty\else{\corresinfo\par}\fi%
+   \removelastskip\vskip8pt%
+   \ifx\@presentaddress\empty\else\@presentaddress\fi%
+   \removelastskip\vskip8pt%
+    \ifx\@fundinginfo\@empty\else\par\@fundinginfo\fi%
+    \ifx\@JELinfo\@empty\else\par\@JELinfo\fi%
+  }{%
+    \global\abstracttrue%
+    \ifx\@abstract\@empty\else\@abstract\fi%
+\removelastskip\vskip15pt%
+    \ifx\@keywords\@empty\else\@keywords\fi%
+    \global\abstractfalse%
+  }
+}
+
+%% Printing Abstract
+%% Printing Abstract
+\long\def\printabstract{%
+  \bgroup%
+    \setlength{\parindent}{\z@}%
+    \printabstractpart%
+  \egroup%
+}%
+
+%% Legal Statement
+\def\legalstatement#1{%
+  \gdef\@temp{#1}%
+  \ifx\@temp\@empty%
+    \gdef\@legalstatement{}%
+  \else%
+    \gdef\@legalstatement{%
+      \smash{{\color{thirtyfivepercent}\@headfootrule}}\par\vspace*{-.45\baselineskip}%
+      \parbox[t]{\textwidth}{{\color{seventyfivepercent}\legalstatementfont#1\dummyalphabet\par}}\par\vspace*{4.75\p@}%
+    }%
+  \fi%
+}\legalstatement{}%
+
+
+%% Keywords %%
+
+\def\keywords#1{\def\@keywords{{\keywordsheadfont\textbf{KEYWORDS:}\par\removelastskip\nointerlineskip\vskip6pt \keywordsfont#1\par}}}\def\@keywords{}%
+
+\def\@fnsymbol#1{\ifcase#1\or \dagger\or \ddagger\or
+   \S\or \P\or \#\or \|\or **\or \dagger\dagger
+   \or \ddagger\ddagger\or \S\S\or \P\P\or \#\#\or \|\|\else\@ctrerr\fi\relax}
+
+\renewcommand{\maketitle}{\par%
+  \@afterindentfalse%
+  \begingroup
+    \renewcommand{\thefootnote}{\fnsymbol{footnote}}%
+    \def\@makefnmark{\hbox to\z@{$\m@th^{\@thefnmark}$\hss}}%
+    \long\def\@makefntext##1{\parindent 1em\noindent
+            \hbox to1.8em{\hss$\m@th^{\@thefnmark}$}##1}%
+    \if@twocolumn
+      \ifnum \col@number=\@ne
+         \twocolumn[\@maketitle]%
+      \else
+         \twocolumn[\@maketitle]%
+      \fi
+    \else
+      \newpage
+      \global\@topnum\z@   % Prevents figures from going at top of page.
+      \@maketitle
+    \fi
+    \thispagestyle{titlepage}\@thanks%
+    \insert\footins{\authfndefns}\par%
+  \endgroup
+%  \let\footnotetext\oldfootnotetext%
+  \setcounter{footnote}{0}%
+  \let\thanks\relax
+  \let\maketitle\relax\let\@maketitle\relax
+  \gdef\@thanks{}\gdef\@author{}\gdef\@title{}
+  \@afterheading%
+}
+
+\newskip\adjtitleskip%
+
+\adjtitleskip=10pt plus4pt minus2pt
+
+\renewcommand{\@maketitle}{{\unskip%
+\hsize=\textwidth\parindent=0pt%
+\thispagestyle{empty}%
+%%\let\footnote\thanks%
+%\removelastskip\vskip-21.13pt%
+%\ifproof\artoprunningheaders\else\nullartoprunningheaders\fi\par%
+\removelastskip\vspace*{5pt}%
+\ifx\@DocHead\empty%
+  \zz{\@DocHead\par}%
+\else%
+  {\@DocHead\par}%
+\fi%
+\removelastskip\vskip4pt%
+\ifx\@title\empty\else{\@title\par}\fi%
+\removelastskip\vskip18pt%
+\ifnum\aucount>0%
+   \global\punctcount\aucount%
+   {\artauthors\par}%
+   \removelastskip\vskip8.25pt%
+%   {\jmkaddress\par}%
+\fi%
+ %  \removelastskip\vskip9pt%
+  % \ifx\@corresinfo\empty\else{\corresinfo\par}\fi%
+   %\removelastskip\vskip8pt%
+   %\ifx\@presentaddress\empty\else\@presentaddress\fi%
+   %\removelastskip\vskip8pt%
+   %{\history\par}%
+   %\removelastskip\vskip12pt%
+%   \ifx\@abstract\empty\else{\@abstract\par}\fi%
+   \removelastskip\vskip19pt%
+%   \ifx\@keywords\empty\else{\@keywords\par}\fi%
+   \printabstract
+%%   \vspace*{10pt plus4pt minus2pt}%
+   \removelastskip\vskip\adjtitleskip%
+}}%
+
+%\renewcommand\thefootnote{\@arabic\c@footnote}%
+
+%
+%%
+
+%%%%%%%%%%%%%%%%%%%%%%%section defn%%%%%%%%%%%%%%%%%%%%%%
+
+%\setcounter{secnumdepth}{3}
+\newcounter {chapter}[part]% for bookmarks
+\renewcommand\thepart         {\@Roman\c@part}
+\renewcommand\thesection      {\@arabic\c@section}
+\renewcommand\thesubsection   {\thesection.\@arabic\c@subsection}
+\renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}
+\renewcommand\theparagraph    {\thesubsubsection.\@arabic\c@paragraph}
+\renewcommand\thesubparagraph {\theparagraph\@arabic\c@subparagraph}
+%%
+\renewcommand\part{\par
+   \addvspace{4ex}%
+   \@afterindentfalse
+   \secdef\@part\@spart}
+%%
+\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@ \raggedright
+     \interlinepenalty \@M
+     \normalfont
+     \ifnum \c@secnumdepth >\m@ne
+       \Large\bfseries \partname~\thepart
+       \par\nobreak
+     \fi
+     \huge \bfseries #2%
+     \markboth{}{}\par}%
+    \nobreak
+    \vskip 3ex
+    \@afterheading}
+
+\def\@spart#1{%
+    {\parindent \z@ \raggedright
+     \interlinepenalty \@M
+     \normalfont
+     \huge \bfseries #1\par}%
+     \nobreak
+     \vskip 3ex
+     \@afterheading}
+
+\renewcommand\section{\@startsection{section}{1}{\z@}{-27pt \@plus -2pt \@minus -2pt}{12\p@}{\sectionfont}}%
+\renewcommand\subsection{\@startsection{subsection}{2}{\z@}{-23pt \@plus -2pt \@minus -2pt}{5\p@}{\subsectionfont}}%
+\renewcommand\subsubsection{\@startsection{subsubsection}{3}{\z@}{-20pt \@plus -2pt \@minus -2pt}{2\p@}{\subsubsectionfont}}%
+%
+\newskip\secruleskip\secruleskip8.5\p@%
+%\def\secrule{\color{sixtyfivepercent}\hspace*{\secruleskip}\raisebox{0pt}{\rule{.5\p@}{7.5\p@}}\hspace*{\secruleskip}}%
+%\def\subsecrule{\color{sixtyfivepercent}\secrule}%
+%\def\subsubsecrule{\color{sixtyfivepercent}\hspace*{\secruleskip}\raisebox{0pt}{\rule{.5\p@}{6.5\p@}}\hspace*{\secruleskip}}%
+
+\def\secrule{\hspace*{\secruleskip}\raisebox{0pt}{\rule{.5\p@}{7.5\p@}}\hspace*{\secruleskip}}%
+\def\subsecrule{\secrule}%
+\def\subsubsecrule{\hspace*{\secruleskip}\raisebox{0pt}{\rule{.5\p@}{6.5\p@}}\hspace*{\secruleskip}}%
+
+
+\def\@sectioncntformat#1{{\ifappendixsec\csname the#1\endcsname\ \else\csname the#1\endcsname\secrule\fi}}%
+\def\@subsectioncntformat#1{{\ifappendixsec\csname the#1\endcsname\ \else\csname the#1\endcsname\subsecrule\fi}}%
+\def\@subsubsectioncntformat#1{{\ifappendixsec\csname the#1\endcsname\ \else\csname the#1\endcsname\subsubsecrule\fi}}%
+
+\def\@paragraphcntformat#1{{\ifappendixsec\csname the#1\endcsname\ \else\csname the#1\endcsname.\ \fi}}%
+\def\@subparagraphcntformat#1{#1}
+%
+\if@font@stix\relax%
+\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-10pt \@plus -2pt \@minus -2pt}{2\p@}{\paragraphfont}}%
+\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}{-10pt \@plus -2pt \@minus -2pt}{-12\p@}{\subparagraphfont}}%
+\def\@sect#1#2#3#4#5#6[#7]#8{%
+   \ifnum #2>\c@secnumdepth%
+      \edef\@svsec{\noindent}%
+   \else%
+      \refstepcounter{#1}%
+      \let\@@protect\protect%
+      \def\protect{\noexpand\protect\noexpand}%
+      \edef\@svsec{\csname @#1cntformat\endcsname{#1}}%
+      \let\protect\@@protect%
+   \fi%
+   \@tempskipa #5\relax%
+   \ifdim \@tempskipa>\z@%
+      \ifnum#2=1%
+         \begingroup #6\relax%\@hangfrom%
+            {\noindent\hskip #3\relax{\@svsec}}%
+            {\interlinepenalty\@M{\uppercase{#8}}\par}%
+         \endgroup%
+      \else%
+         \ifnum#2=2%
+            \begingroup #6\relax%\@hangfrom%
+               {\noindent\hskip #3\relax\@svsec}%
+               {\interlinepenalty\@M{#8}\par}%
+            \endgroup%
+         \else%
+      \ifnum#2=3%
+            \begingroup #6\relax%\@hangfrom%
+               {\noindent\hskip #3\relax\@svsec}%
+               {\interlinepenalty\@M{#8}\par}%
+            \endgroup%
+         \else%
+      \ifnum#2=4%
+            \begingroup #6\relax%\@hangfrom%
+               {\noindent\hskip #3\relax\@svsec}%
+               {\interlinepenalty\@M{\textcolor{black!75}{#8}}\par}%
+            \endgroup%
+         \else%
+            \begingroup #6\relax%\@hangfrom
+               {\noindent\hskip #3\relax\@svsec}%
+               {\interlinepenalty\@M#8\par}%
+            \endgroup%
+         \fi%
+     \fi%
+     \fi%
+      \fi%
+      \csname #1mark\endcsname{#7}%
+      \addcontentsline{toc}{#1}{%
+        \ifnum #2>\c@secnumdepth \else%
+          \protect\numberline{\csname the#1\endcsname}%
+        \fi%
+        #7}%
+   \else%
+      \def\@svsechd{%
+         #6{\hskip #3\relax%
+         \@svsec \textcolor{black!75}{#8}\hspace*{4pt}}%
+      }%
+   \fi%
+   \@xsect{#5}%
+}%
+\else%
+\renewcommand\paragraph{\@startsection{paragraph}{4}{\z@}{-20pt \@plus -2pt \@minus -2pt}{2\p@}{\paragraphfont}}%
+\renewcommand\subparagraph{\@startsection{subparagraph}{5}{\z@}{-20pt \@plus -2pt \@minus -2pt}{-12\p@}{\subparagraphfont}}%
+\def\@sect#1#2#3#4#5#6[#7]#8{%
+   \ifnum #2>\c@secnumdepth%
+      \edef\@svsec{\noindent}%
+   \else%
+      \refstepcounter{#1}%
+      \let\@@protect\protect%
+      \def\protect{\noexpand\protect\noexpand}%
+      \edef\@svsec{\csname @#1cntformat\endcsname{#1}}%
+      \let\protect\@@protect%
+   \fi%
+   \@tempskipa #5\relax%
+   \ifdim \@tempskipa>\z@%
+      \ifnum#2=1%
+         \begingroup #6\relax%\@hangfrom%
+            {\noindent\hskip #3\relax{\@svsec}}%
+            {\interlinepenalty\@M{\uppercase{#8}}\par}%
+         \endgroup%
+      \else%
+         \ifnum#2=2%
+            \begingroup #6\relax%\@hangfrom%
+               {\noindent\hskip #3\relax\@svsec}%
+               {\interlinepenalty\@M{#8}\par}%
+            \endgroup%
+         \else%
+            \begingroup #6\relax%\@hangfrom
+               {\noindent\hskip #3\relax\@svsec}%
+               {\interlinepenalty\@M{#8}\par}%
+            \endgroup%
+         \fi%
+      \fi%
+      \csname #1mark\endcsname{#7}%
+      \addcontentsline{toc}{#1}{%
+        \ifnum #2>\c@secnumdepth \else%
+          \protect\numberline{\csname the#1\endcsname}%
+        \fi%
+        #7}%
+   \else%
+      \def\@svsechd{%
+         #6{\hskip #3\relax%
+         \@svsec #8.\hspace*{6pt}}%
+      }%
+   \fi%
+   \@xsect{#5}%
+}%
+\fi%
+
+\def\@ssect#1#2#3#4#5#6{%
+   %#1#2#3#4#5#6
+   \@tempskipa #4\relax%
+   \ifdim\@tempskipa>\z@%
+      \ifnum#1=1%
+         \begingroup%
+            #5{\@hangfrom{\hskip #2}%
+            \interlinepenalty \@M\uppercase{#6}\@@par}%
+         \endgroup%
+         \addcontentsline{toc}{section}{#6}%
+      \else%
+         \begingroup%
+            #5{\@hangfrom{\hskip #2}%
+            \interlinepenalty \@M#6\@@par}%
+         \endgroup%
+      \fi%
+   \else%
+      \def\@svsechd{#5{\hskip #2\relax #6}}%
+   \fi%
+   \@xsect{#4}%
+}%
+%
+\def\@startsection#1#2#3#4#5#6{%
+   \if@noskipsec\leavevmode\fi%
+   \par%
+   \@tempskipa #4\relax%
+   \@afterindenttrue%
+   \ifdim \@tempskipa <\z@%
+      \@tempskipa-\@tempskipa%
+      \@afterindentfalse%
+   \fi
+   \if@nobreak
+      %\ifnum#2=2%
+      %   \vspace*{-2.4\p@}%
+      %\fi%
+      \everypar{}%
+   \else%
+      \addpenalty\@secpenalty%
+      \addvspace\@tempskipa%
+   \fi%
+   \@ifstar%
+      {\@ssect{#2}{#3}{#4}{#5}{#6}}%
+      {\@dblarg{\@sect{#1}{#2}{#3}{#4}{#5}{#6}}}}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%% Regular pagestyle %%
+%
+
+\def\@authormark{}% 
+\def\authormark#1{%
+\markboth{{{#1}}}{{{#1}}}\gdef\@authormark{\def\etal{\textit{ET AL.}}\let\AQ\AHAQ#1}\gdef\@authormarkforcite{\undefined\def\etal{\textit{et al.}}#1}}%
+\def\etal{\textit{et al.}}%
+
+\newskip\rhverticalsep\rhverticalsep11.5\p@%
+\def\oddpage@headings@def{\hspace*{\rhverticalsep}\rhvertbar\pagenumberalign{\hss\thepagedef}}%
+\def\evenpage@headings@def{\pagenumberalign{\thepagedef\hss}\rhvertbar\hspace*{\rhverticalsep}}%
+
+\def\leftmarkdef{{\runningheadfont\@authormark}}%
+\def\rightmarkdef{{\runningheadfont\@authormark}}%
+%
+\def\headfootrule#1{\gdef\@headfootrule{#1}}\headfootrule{{\rule{\textwidth}{.5\p@}}}%
+%
+\def\head@headings@def#1{\vbox{%
+  \strut\par\vspace*{-5pt}%
+\vspace*{2\p@}%\fi%
+  \@headfootrule\par%\vspace*{-8.25\p@}%
+\vspace*{-11\p@}%\fi%
+  \hbox to \textwidth{#1\dummyalphabet}\par\vspace*{\p@}%
+  }%
+}%
+%
+
+\def\oddhead@headings@info{\head@headings@def{\rightmarkdef\hfill\oddpage@headings@def}}%
+\def\evenhead@headings@info{\head@headings@def{\evenpage@headings@def\hfill\leftmarkdef}}%
+
+\def\ps@headings{%
+\let\@oddfoot\@empty\let\@evenfoot\@empty%
+  \def\@oddhead{\oddhead@headings@info}%
+  \def\@evenhead{\evenhead@headings@info}%
+\let\@mkboth\markboth%
+}%
+\pagestyle{headings}%
+%
+
+%% Macros for Section headings %%
+
+\setcounter{secnumdepth}{3}% 
+%
+
+\newif\if@FTSection%
+\global\@FTSectionfalse%
+
+\newif\if@unnumsection%
+\@unnumsectionfalse%
+
+
+%% Macros for Bibliography %%
+
+%\newif\ifbackmatter\newcommand{\backmatter}{\par\global\backmattertrue}%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Bibliography %%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+
+\if@Vancouverrefstyle%
+   \IfFileExists{NJDnatbib.sty}{\usepackage[numbers,super,sort&compress]{NJDnatbib}}{\usepackage[numbers,super,sort&compress]{natbib}}%
+   \bibliographystyle{WileyNJD-VANCOUVER}%
+   \bibpunct{}{}{, }{s}{}{}%
+\renewcommand\@biblabel[1]{#1.} 
+%   \renewcommand{\bibfont}{\reset@font\fontfamily{\rmdefault}\fontsize{8bp}{10}\selectfont\baselineskip=10\p@}%
+\else%
+\if@AMArefstyle%
+   \IfFileExists{NJDnatbib.sty}{\usepackage[numbers,super]{NJDnatbib}}{\usepackage[numbers,super]{natbib}}%
+   \bibliographystyle{WileyNJD-AMA}%
+\renewcommand\@biblabel[1]{#1.} 
+%   \bibpunct{(}{)}{,}{n}{}{}%
+%   \renewcommand{\bibfont}{\reset@font\fontfamily{\rmdefault}\fontsize{8bp}{10}\selectfont\baselineskip=10\p@}%
+\else%
+\if@Chemistryrefstyle%
+   \IfFileExists{NJDnatbib.sty}{\usepackage[numbers,super,sort&compress]{NJDnatbib}}{\usepackage[numbers,super,sort&compress]{natbib}}%
+   \bibliographystyle{WileyNJD-ACS}%
+   \bibpunct{[}{]}{,}{n}{}{}%
+\setcitestyle{super,open={[},close={]}}
+%%  \renewcommand{\bibfont}{\reset@font\fontfamily{\rmdefault}\fontsize{8bp}{10}\selectfont\baselineskip=10\p@}%
+\else%
+\if@AMSrefstyle%
+   \usepackage[numbers]{natbib}%
+   \bibliographystyle{WileyNJD-AMS}%
+   \bibpunct{(}{)}{,}{}{}{}%
+\setcitestyle{numbers,square}
+ %  \renewcommand{\bibfont}{\reset@font\fontfamily{\rmdefault}\fontsize{8bp}{10}\selectfont\baselineskip=10\p@}%
+\else%
+\if@APArefstyle
+   \usepackage[natbibapa]{NJDapacite}%
+   \bibliographystyle{WileyNJD-APA}%
+   \renewcommand{\APACrefbtitle}[2]{\textit{#2}}
+   \bibpunct{(}{)}{; }{}{}{}%
+   %%
+ %  \renewcommand{\bibfont}{\reset@font\fontfamily{\rmdefault}\fontsize{8bp}{10}\selectfont\baselineskip=10\p@}%
+   %%
+   \renewcommand{\APACrefnote}[1]{%
+     \ifx\@empty#1\@empty
+     \else
+       {#1.}%
+     \fi}%
+   %%
+   \renewcommand{\BTR}{}%%
+   \renewcommand{\BNUM}{}% number (of a technical report)
+   %%
+   \renewcommand{\APACjournalVolNumPages}[4]{%
+     \textit{#1}%             journal
+     \ifx\@empty#2\@empty
+     \else
+       \unskip, \textit{#2}%  volume
+     \fi
+     \ifx\@empty#3\@empty
+     \else
+       \unskip({#3})%      issue number
+     \fi
+     \ifx\@empty#4\@empty
+     \else
+       \unskip, {#4}%      pages
+     \fi}
+   %%
+\fi\fi\fi\fi\fi%
+
+
+%
+%% Macros for Scheme %%
+%
+\def\ftype@scheme{1}%
+\def\ext@scheme{los}%
+\def\fps@scheme{tbp}%
+\newcounter{scheme}%
+\setcounter{scheme}{0}%
+\renewcommand{\thescheme}{\@arabic\c@scheme}%
+\newenvironment{scheme}%
+               {\@float{scheme}}%
+               {\end@float}
+\newenvironment{scheme*}%
+               {\@dblfloat{scheme}}%
+               {\end@dblfloat}
+%
+%% Macros for display equations %%
+
+\let\SplitEq\relax%
+
+\setlength\arraycolsep{2\p@}%
+\setlength\tabcolsep{6\p@}%
+\setlength\arrayrulewidth{.4\p@}%
+\setlength\doublerulesep{4\p@}%
+\setlength\tabbingsep{\labelsep}%
+
+\def\eqnarray{%%\initialset%%%introduced on 31Oct15%
+   \stepcounter{equation}%
+   \def\@currentlabel{\p@equation\theequation}%
+   \global\@eqnswtrue
+   \m@th
+   \global\@eqcnt\z@
+   \tabskip\@centering%
+   \let\\\@eqncr
+   $$\everycr{}\halign to\displaywidth\bgroup
+       \hskip\@centering$\displaystyle\tabskip\z@skip{##}$\@eqnsel% for centered equations
+%%     \hskip\z@skip\hfil$\displaystyle\tabskip\z@skip{##}$\@eqnsel% for left aligned equations
+      &\global\@eqcnt\@ne\hskip \tw@\arraycolsep \hfil${##}$\hfil
+      &\global\@eqcnt\tw@ \hskip \tw@\arraycolsep
+         $\displaystyle{##}$\hfil\tabskip\@centering
+      &\global\@eqcnt\thr@@ \hb@xt@\z@\bgroup\hss##\egroup
+       \tabskip\z@skip
+      \cr
+}
+\def\endeqnarray{%
+      \@@eqncr
+      \egroup
+      \global\advance\c@equation\m@ne
+   $$\@ignoretrue
+}
+%
+
+%
+
+%% Macros for Tables %%
+
+\RequirePackage{booktabs}%
+
+%%%%table notes%%%%
+\newenvironment{tablenotes}{\list{}{\setlength{\labelsep}{0pt}% 
+\setlength{\labelwidth}{0pt}%
+\setlength{\leftmargin}{0pt}%
+\setlength{\rightmargin}{0pt}%
+\setlength{\topsep}{2pt}%
+\setlength{\itemsep}{0pt}%
+\setlength{\partopsep}{0pt}%
+\setlength{\listparindent}{0em}%
+\setlength{\parsep}{0pt}}%
+\item\relax%
+}{\endlist}%
+
+\def\tnote#1{#1}%%
+
+%
+
+%
+%\renewenvironment{sidewaystable*}
+%               {\@rotdblfloat{table}}
+%               {\thisfloatpagestyle{headings}\end@rotdblfloat}%
+
+%\renewenvironment{sidewaysfigure*}
+%               {\@rotdblfloat{figure}}
+%               {\thisfloatpagestyle{headings}\end@rotdblfloat}
+
+%% Macros for Quote %%
+
+\renewenvironment{quote}{\list{}{\setlength{\labelsep}{0pt}% 
+\setlength{\labelwidth}{0pt}%
+\setlength{\leftmargin}{\parindentvalue}%
+\setlength{\rightmargin}{\parindentvalue}%
+\setlength{\topsep}{12.5pt \@plus2pt \@minus1pt}% 
+\setlength{\itemsep}{0pt}%
+\setlength{\partopsep}{0pt}%
+\setlength{\listparindent}{0em}%
+\setlength{\parsep}{0pt}}%
+\def\rightline##1{\undefined\vspace*{6pt}\@@line{\hss##1}}%
+\item\relax%
+}{\endlist}%
+
+%%
+%%%% Enunciations: Theorem-like styles %%
+%%
+
+\let\iint\undefined%
+\let\iiint\undefined%
+\let\iiiint\undefined%
+\let\dddot\undefined%
+\let\ddddot\undefined%
+\let\overleftrightarrow\undefined%
+\let\underrightarrow\undefined%
+\let\underleftarrow\undefined%
+\let\underleftrightarrow\undefined%
+
+\RequirePackage[intlimits,sumlimits,namelimits,centertags]{amsmath}%
+
+\RequirePackage{amsthm}
+
+\newif\ifeproof%
+
+%%introduced to make number in italics
+%\def\thmhead@plain#1#2#3{%
+%  \thmname{#1}\ifeproof\else\thmnumber{\@ifnotempty{#1}{ }\textit{#2}}%
+%  \thmnote{ {\the\thm@notefont\textit{(#3)}}}\fi}
+
+%\newtheorem{theorem}{Theorem}
+%\newtheorem{lemma}{Lemma}
+%\newtheorem{proposition}{Proposition}
+%\newtheorem{definition}{Definition}
+%\newtheorem{corollary}{Corollary}
+%\newtheorem{conjecture}{Conjecture}
+%\newtheorem{eremark}{Remark}
+%\newtheorem{case}{Case}
+%\newtheorem{eexample}{Example}
+%\newtheorem{estep}{Step}
+%\newtheorem{eproof}{Proof}
+\def\thm@space@setup{%
+  \thm@preskip=7\p@ \thm@postskip=7\p@
+}
+\thm@headpunct{}
+
+\def\thmsep{9pt}%
+
+\newif\ifOldenunciation%
+\newif\ifEnunciation%
+
+\newtheoremstyle{plain}% Numbered
+{8pt}% Space above
+{8pt}% Space below
+{\normalfont}% Body font
+{}% Indent amount
+{\itshape}% Theorem head font
+{}% Punctuation after theorem head
+{\newline}% Space after theorem headi
+{}% Theorem head spec (can be left empty, meaning `normal')
+
+%\renewenvironment{proof}[1][\proofname]{\par%
+%\pushQED{\qed}%
+%  \pushQED{\fontsize{9}{0}\selectfont{\qed}}%
+%\pushQED{\hfill\fontsize{9}{0}\selectfont{$\square$}}%
+%  \normalfont \topsep8\p@\@plus6\p@\relax
+%  \noindent\ignorespaces{\itshape#1}\newline%\itshape
+%}{%
+%\popQED\endtrivlist\@endpefalse
+%}
+%
+
+\newtheoremstyle{WBstyleone}
+  {6\p@} % Space above
+  {6\p@} % Space below
+  {\normalfont} % Body font
+  {\z@} % Indent amount
+  {\bfseries} % Theorem head font
+  {.} % Punctuation after theorem head
+  {5\p@} % Space after theorem head
+  {} % Theorem head spec (can be left empty, meaning `normal')
+
+%\renewenvironment{proof}[1][\proofname]{\par%%%%%%%%%%%%%commented as per author request
+ % \pushQED{\qed}%
+%  \normalfont \topsep6\p@\@plus6\p@\relax
+%  \trivlist
+%  \item[\hskip\labelsep
+%      %  \itshape
+%    #1\@addpunct{.}]\ignorespaces\Enunciationtrue%
+%\itshape}{%\vspace*{-\baselineskip}%
+%  \popQED\endtrivlist\@endpefalse
+%}
+
+
+\newtheoremstyle{WBstyletwo}
+  {6\p@} % Space above
+  {6\p@} % Space below
+  {\normalfont} % Body font
+  {\z@} % Indent amount
+  {\itshape} % Theorem head font
+  {.} % Punctuation after theorem head
+  {5\p@} % Space after theorem head
+  {\thmname{#1}\thmnumber{ #2}\thmnote{. #3}} % Theorem head spec (can be left empty, meaning `normal')
+  
+\newtheoremstyle{WBstylethree}
+  {6\p@} % Space above
+  {6\p@} % Space below
+  {\normalfont} % Body font
+  {\z@} % Indent amount
+  {\bfseries} % Theorem head font
+  {.} % Punctuation after theorem head
+  {5\p@} % Space after theorem head
+  {} % Theorem head spec (can be left empty, meaning `normal')
+
+\theoremstyle{WBstyleone}
+\newtheorem{theorem}{Theorem}
+\newtheorem{construction}{Construction}
+\newtheorem{estimate}{Estimate}
+\newtheorem{lemma}{Lemma}
+\newtheorem{corollary}{Corollary}
+\newtheorem{result}{Result}
+\newtheorem{algth}{Algorithm}
+\newtheorem{proposition}{Proposition}
+\newtheorem{hypothesis}{Hypothesis}
+\newtheorem{experiment}{Experiment}
+\newtheorem{LWrule}{Rule}
+\newtheorem{procedure}{Procedure}
+
+\newtheorem{assertion}{Assertion}
+\newtheorem{axiom}{Axiom}
+\newtheorem{conjecture}{Conjecture}
+\newtheorem{criterion}{Criterion}
+\newtheorem{reduction}{Reduction}
+\newtheorem{sublemma}{Sublemma}
+
+
+\theoremstyle{WBstyletwo}
+\newtheorem{case}{Case}
+\newtheorem{remark}{Remark}
+\newtheorem{notation}{Notation}
+
+\newtheorem{answer}{Answer}
+\newtheorem{base}{Base}
+\newtheorem{claim}{Claim}
+\newtheorem{ccomment}{Comment}
+\newtheorem{subproof}{Subproof}
+\newtheorem{conclusion}{Conclusion}
+\newtheorem{observation}{Observation}
+\newtheorem{subcase}{Subcase}
+\newtheorem{step}{Step}
+\newtheorem{summary}{Summary}
+
+
+
+\theoremstyle{WBstylethree}
+\newtheorem{definition}{Definition}
+\newtheorem{condition}{Condition}
+\newtheorem{property}{Property}
+\newtheorem{problem}{Problem}
+\newtheorem{fact}{Fact}
+\newtheorem{assumption}{Assumption}
+\newtheorem{eexample}{Example}
+\newtheorem{model}{Model}
+
+\newtheorem{affirmation}{Affirmation}
+\newtheorem{application}{Application}
+\newtheorem{convention}{Convention}
+\newtheorem{discussion}{Discussion}
+\newtheorem{exercise}{Exercise}
+\newtheorem{question}{Question}
+\newtheorem{scholium}{Scholium}
+\newtheorem{terminology}{Terminology}
+
+%
+%% Macros for Appendix %%
+%
+\newif\ifappendixsec%
+
+\newcounter{printcitcnt}
+
+%\newcounter{appcnt}
+%\newcounter{appseccnt}
+%\newcounter{appsubseccnt}
+%\newcounter{appsubsubseccnt}
+
+%\def\sappendix{\global\appendixsectrue\printjnlcitation%
+%  \setcounter{figure}{0}%
+%  \setcounter{table}{0}%
+%  \setcounter{equation}{0}%
+%  \renewcommand\thesection{\protect\refstepcounter{appcnt}\protect\refstepcounter{appseccnt}APPENDIX\ \protect\Alph{appcnt}\protect\arabic{appseccnt}:}%
+%  \renewcommand\thesubsection{\protect\refstepcounter{appsubseccnt}\Alph{appseccnt}.\arabic{appsubseccnt}}%
+%  \renewcommand\thesubsubsection{\thesubsection.\@arabic\c@subsubsection}%
+%  \renewcommand\thefigure{\@Alph\c@section\arabic{figure}\enspace }%
+%  \renewcommand\thetable{\@Alph\c@section\arabic{table}\enspace }%
+%  \renewcommand\theequation{\@Alph\c@section\arabic{equation}}%
+%}%
+%
+
+%%%%%%%%%%%%%%%%%%%%appendix%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+\newif\if@chapter@pp\@chapter@ppfalse
+\newif\if@knownclass@pp\@knownclass@ppfalse
+\@ifundefined{chapter}{%
+  \@ifundefined{section}{}{\@knownclass@pptrue}}{%
+  \@chapter@pptrue\@knownclass@pptrue}
+\providecommand{\phantomsection}{}
+\newcounter{@pps}
+  \renewcommand{\the@pps}{\alph{@pps}}
+\newif\if@pphyper
+  \@pphyperfalse
+\AtBeginDocument{%
+  \@ifpackageloaded{hyperref}{\@pphypertrue}{}}
+
+\newif\if@dotoc@pp\@dotoc@ppfalse
+\newif\if@dotitle@pp\@dotitle@ppfalse
+\newif\if@dotitletoc@pp\@dotitletoc@ppfalse
+\newif\if@dohead@pp\@dohead@ppfalse
+\newif\if@dopage@pp\@dopage@ppfalse
+\DeclareOption{toc}{\@dotoc@pptrue}
+\DeclareOption{title}{\@dotitle@pptrue}
+\DeclareOption{titletoc}{\@dotitletoc@pptrue}
+\DeclareOption{header}{\@dohead@pptrue}
+\DeclareOption{page}{\@dopage@pptrue}
+\ProcessOptions\relax
+\newcommand{\@ppendinput}{}
+\if@knownclass@pp\else
+  \PackageWarningNoLine{appendix}%
+    {There is no \protect\chapter\space or \protect\section\space command.\MessageBreak
+     The appendix package will not be used}
+  \renewcommand{\@ppendinput}{\endinput}
+\fi
+\@ppendinput
+
+\newcommand{\appendixtocon}{\@dotoc@pptrue}
+\newcommand{\appendixtocoff}{\@dotoc@ppfalse}
+\newcommand{\appendixpageon}{\@dopage@pptrue}
+\newcommand{\appendixpageoff}{\@dopage@ppfalse}
+\newcommand{\appendixtitleon}{\@dotitle@pptrue}
+\newcommand{\appendixtitleoff}{\@dotitle@ppfalse}
+\newcommand{\appendixtitletocon}{\@dotitletoc@pptrue}
+\newcommand{\appendixtitletocoff}{\@dotitletoc@ppfalse}
+\newcommand{\appendixheaderon}{\@dohead@pptrue}
+\newcommand{\appendixheaderoff}{\@dohead@ppfalse}
+\newcounter{@ppsavesec}
+\newcounter{@ppsaveapp}
+\setcounter{@ppsaveapp}{0}
+\newcommand{\@ppsavesec}{%
+  \if@chapter@pp \setcounter{@ppsavesec}{\value{chapter}} \else
+                 \setcounter{@ppsavesec}{\value{section}} \fi}
+\newcommand{\@pprestoresec}{%
+  \if@chapter@pp \setcounter{chapter}{\value{@ppsavesec}} \else
+                 \setcounter{section}{\value{@ppsavesec}} \fi}
+\newcommand{\@ppsaveapp}{%
+  \if@chapter@pp \setcounter{@ppsaveapp}{\value{chapter}} \else
+                 \setcounter{@ppsaveapp}{\value{section}} \fi}
+\newcommand{\restoreapp}{%
+  \if@chapter@pp \setcounter{chapter}{\value{@ppsaveapp}} \else
+                 \setcounter{section}{\value{@ppsaveapp}} \fi}
+\providecommand{\appendixname}{Appendix}
+\newcommand{\appendixtocname}{Appendices}
+\newcommand{\appendixpagename}{Appendices}
+\newcommand{\appendixpage}{%
+  \if@chapter@pp \@chap@pppage \else \@sec@pppage \fi
+}
+\newcommand{\clear@ppage}{%
+  \if@openright\cleardoublepage\else\clearpage\fi}
+
+\newcommand{\@chap@pppage}{%
+  \clear@ppage
+  \thispagestyle{plain}%
+  \if@twocolumn\onecolumn\@tempswatrue\else\@tempswafalse\fi
+  \null\vfil
+  \markboth{}{}%
+  {\centering
+   \interlinepenalty \@M
+   \normalfont
+   \Huge \bfseries \appendixpagename\par}%
+  \if@dotoc@pp
+    \addappheadtotoc
+  \fi
+  \vfil\newpage
+  \if@twoside
+    \if@openright
+      \null
+      \thispagestyle{empty}%
+      \newpage
+    \fi
+  \fi
+  \if@tempswa
+    \twocolumn
+  \fi
+}
+
+\newcommand{\@sec@pppage}{%
+  \par
+  \addvspace{4ex}%
+  \@afterindentfalse
+  {\parindent \z@ \raggedright
+   \interlinepenalty \@M
+   \normalfont
+   \huge \bfseries \appendixpagename%
+   \markboth{}{}\par}%
+  \if@dotoc@pp
+    \addappheadtotoc
+  \fi
+  \nobreak
+  \vskip 3ex
+  \@afterheading
+}
+
+\newif\if@pptocpage
+  \@pptocpagetrue
+\newcommand{\noappendicestocpagenum}{\@pptocpagefalse}
+\newcommand{\appendicestocpagenum}{\@pptocpagetrue}
+\newcommand{\addappheadtotoc}{%
+  \phantomsection
+  \if@chapter@pp
+    \if@pptocpage
+      \addcontentsline{toc}{chapter}{\appendixtocname}%
+    \else
+      \if@pphyper
+        \addtocontents{toc}%
+          {\protect\contentsline{chapter}{\appendixtocname}{}{\@currentHref}}%
+      \else
+        \addtocontents{toc}%
+          {\protect\contentsline{chapter}{\appendixtocname}{}}%
+      \fi
+    \fi
+  \else
+    \if@pptocpage
+      \addcontentsline{toc}{section}{\appendixtocname}%
+    \else
+      \if@pphyper
+        \addtocontents{toc}%
+          {\protect\contentsline{section}{\appendixtocname}{}{\@currentHref}}%
+      \else
+        \addtocontents{toc}%
+          {\protect\contentsline{section}{\appendixtocname}{}}%
+      \fi
+    \fi
+  \fi
+}
+
+\providecommand{\theH@pps}{\alph{@pps}}
+
+\newcommand{\@resets@pp}{\par
+  \@ppsavesec
+  \stepcounter{@pps}
+  \setcounter{section}{0}%
+  \if@chapter@pp
+    \setcounter{chapter}{0}%
+    \renewcommand\@chapapp{\appendixname}%
+    \renewcommand\thechapter{\@Alph\c@chapter}%
+  \else
+    \setcounter{subsection}{0}%
+\ifnum\c@secnumdepth=1
+    \renewcommand\thesection{Appendix\@Alph\c@section}%
+\else
+  \renewcommand\thesection{\@Alph\c@section}%
+\fi
+  \fi
+  \if@pphyper
+    \if@chapter@pp
+      \renewcommand{\theHchapter}{\theH@pps.\Alph{chapter}}%
+    \else
+      \renewcommand{\theHsection}{\theH@pps.\Alph{section}}%
+    \fi
+    \def\Hy@chapapp{\appendixname}%
+  \fi
+  \restoreapp
+}
+
+\renewenvironment{appendix}{\printjnlcitation\section*{Appendix}\global\appendixsectrue%
+  \setcounter{figure}{0}%
+  \setcounter{table}{0}%
+  \setcounter{equation}{0}%
+  \@resets@pp
+  \if@dotoc@pp
+    \if@dopage@pp              % both page and toc
+      \if@chapter@pp           % chapters
+        \clear@ppage
+      \fi
+      \appendixpage
+    \else                      % toc only
+       \if@chapter@pp          % chapters
+         \clear@ppage
+       \fi
+      \addappheadtotoc
+    \fi
+  \else
+    \if@dopage@pp              % page only
+      \appendixpage
+    \fi
+  \fi
+  \if@chapter@pp
+    \if@dotitletoc@pp \@redotocentry@pp{chapter} \fi
+  \else
+    \if@dotitletoc@pp \@redotocentry@pp{section} \fi
+    \if@dohead@pp
+      \def\sectionmark##1{%
+        \if@twoside
+          \markboth{\@formatsecmark@pp{##1}}{}
+        \else
+          \markright{\@formatsecmark@pp{##1}}{}
+        \fi}
+    \fi
+    \if@dotitle@pp
+      \def\sectionname{\appendixname}
+      \def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }%
+        \csname the##1\endcsname\quad}
+    \fi
+  \fi%
+  \renewcommand\thefigure{\@Alph\c@section\arabic{figure}\enspace }%
+  \renewcommand\thetable{\@Alph\c@section\arabic{table}\enspace }%
+  \renewcommand\theequation{\@Alph\c@section\arabic{equation}}%
+}{%
+  \@ppsaveapp\@pprestoresec}
+
+\newcommand{\setthesection}{\thechapter.\Alph{section}}
+\newcommand{\setthesubsection}{\thesection.\Alph{subsection}}
+
+\newcommand{\@resets@ppsub}{\par
+  \stepcounter{@pps}
+  \if@chapter@pp
+    \setcounter{section}{0}
+    \renewcommand{\thesection}{\setthesection}
+  \else
+    \setcounter{subsection}{0}
+    \renewcommand{\thesubsection}{\setthesubsection}
+  \fi
+  \if@pphyper
+    \if@chapter@pp
+      \renewcommand{\theHsection}{\theH@pps.\setthesection}%
+    \else
+      \renewcommand{\theHsubsection}{\theH@pps.\setthesubsection}%
+    \fi
+    \def\Hy@chapapp{\appendixname}%
+  \fi
+}
+
+\newenvironment{subappendices}{%
+  \@resets@ppsub
+  \if@chapter@pp
+    \if@dotitletoc@pp \@redotocentry@pp{section} \fi
+    \if@dotitle@pp
+      \def\sectionname{\appendixname}
+      \def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }%
+        \csname the##1\endcsname\quad}
+    \fi
+  \else
+    \if@dotitletoc@pp \@redotocentry@pp{subsection} \fi
+    \if@dotitle@pp
+      \def\subsectionname{\appendixname}
+      \def\@seccntformat##1{\@ifundefined{##1name}{}{\csname ##1name\endcsname\ }%
+        \csname the##1\endcsname\quad}
+    \fi
+  \fi}{}
+
+\newcommand{\@formatsecmark@pp}[1]{%
+  \MakeUppercase{\appendixname\space
+    \ifnum \c@secnumdepth >\z@
+      \thesection\quad
+    \fi
+    #1}}
+\newcommand{\@redotocentry@pp}[1]{%
+  \let\oldacl@pp=\addcontentsline
+  \def\addcontentsline##1##2##3{%
+    \def\@pptempa{##1}\def\@pptempb{toc}%
+    \ifx\@pptempa\@pptempb
+      \def\@pptempa{##2}\def\@pptempb{#1}%
+      \ifx\@pptempa\@pptempb
+\oldacl@pp{##1}{##2}{\appendixname\space ##3}%
+      \else
+        \oldacl@pp{##1}{##2}{##3}%
+      \fi
+    \else
+      \oldacl@pp{##1}{##2}{##3}%
+    \fi}
+}
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+\renewcommand\footnoterule{%%LN
+  \kern-3\p@%
+  \hrule height0.5pt%
+  \kern4.4\p@%
+}%
+
+%
+%%% Macros for float algorithm %%%
+
+%\usepackage[plain]{algorithm} %% wrapper
+%\usepackage{varwidth}%
+%\usepackage{algorithmicx}%
+%\usepackage{algpseudocode}%
+%\usepackage{algorithm, algorithmicx, algpseudocode}
+
+\usepackage{listings}%
+\usepackage{alltt}%
+
+
+%%% Macros for upright lowercase greek characters %%%
+
+
+%% since small triangle symbol is not found used \triangleright and rotated to 90 degrees %%
+
+
+\def\@jissue{}%
+\def\jissue#1{\gdef\@jissue{#1}}%
+
+\def\@licenseVal{}%
+\def\licenseVal#1{\gdef\@licenseVal{#1}}%
+
+\def\@supplinks{}%
+\def\supplinks#1{\gdef\@supplinks{#1}}%
+
+\def\@coninterest{}%
+\def\coninterest#1{\gdef\@coninterest{#1}}%
+
+\def\@confinfo{}%
+\def\confinfo#1{\def\@confinfo{#1}}%
+
+\def\@cdate{}%
+\def\cdate#1{\gdef\@cdate{#1}}%
+
+\def\@cname{}%
+\def\cname#1{\gdef\@cname{#1}}%
+
+\def\@cloc{}%
+\def\cloc#1{\gdef\@cloc{#1}}%
+
+\def\tabheadfont{}%
+
+\let\fullpagewidth\textwidth%
+
+\def\jargon#1{#1}%
+
+\newenvironment{bm}[1][]{\begingroup%
+\if!#1!\else\section*{#1}\fi%
+}{\endgroup}
+
+\let\glosslist\description%
+\let\endglosslist\enddescription%
+
+\newenvironment{ack}[1][]{\begingroup%
+\if!#1!\else\section*{#1}\fi%
+}{\endgroup}
+
+\def\APLrightarrowbox{}% Use \usepackage{wasysym} to get this symbol
+\def\boxcircle{}%
+
+%% Macros for \citation tag %%
+
+\newbox\jnlcitationbox%
+
+\def\cname#1{\gdef\author##1{##1}#1}%
+\def\cyear#1{#1}%
+\def\ctitle#1{#1}%
+\def\cjournal#1{\textit{#1}}%
+\def\cvol#1{\textit{#1}}%
+
+\gdef\@jnlcitation{}%
+\def\jnlcitation#1{\gdef\@jnlcitation{\textbf{How to cite this article: }#1}}%
+
+\newdimen\jnlcithsize%
+%\jnlcithsize=\hsize%
+\advance\jnlcithsize-12pt% fbox sep x 2
+\advance\jnlcithsize-1pt% fbox rule x 2
+
+\gdef\printjnlcitation{\removelastskip\vskip18pt\fboxsep=6pt\fboxrule=0.5pt%
+\hskip-\parindentvalue\fbox{\vbox{\noindent\@jnlcitation}}}%
+
+\AtEndDocument{\ifappendixsec\else\printjnlcitation\fi}%
+
+%% Misc math macros %%
+
+\newcommand{\xleftrightarrow}[2][]{\ext@arrow 3399\leftrightarrowfill@{#1}{#2}}%
+
+%
+%%% Macros for Biography %%%
+%
+\RequirePackage{wrapfig}%
+%
+%  \begin{wrapfigure}[12]{r}[34pt]{5cm} <figure> \end{wrapfigure}
+%                     --  -  ----  ---
+%  [number of narrow lines] {placement} [overhang] {width of figure}
+\newcount\wraplines%
+\wraplines=5%
+%
+\newbox\@authorfigbox%
+\newskip\@authorfigboxdim%
+%
+
+\newskip\biofigadjskip%
+\biofigadjskip=0pt%
+%
+\newenvironment{biography}[2]{\par\addvspace{10.5pt plus3.375pt minus1.6875pt}%\lineno@off%
+\def\author##1{\textbf{##1}}%
+\def\@authorfig{{#1}}%
+\setbox\@authorfigbox=\hbox{#1}%%10Nov16%%
+\@authorfigboxdim=\wd\@authorfigbox%
+\advance\@authorfigboxdim by 10pt
+\if@dblspace\else\wraplines=7\fi%
+%14pt%
+\noindent{%
+\ifx\@authorfig\@empty\else\unskip%
+\begin{wrapfigure}[\wraplines]{l}[0pt]{\@authorfigboxdim}%{38.25mm}%
+\vskip-25pt\vskip\biofigadjskip%
+\@authorfig%
+\end{wrapfigure}%
+\fi%
+#2%
+\par%
+}}{\par\addvspace{10.5pt plus3.375pt minus1.6875pt}}
+
+\def\emph#1{\textit{#1}}
+
+%%% Macros for Bibliography %%%
+
+
+\endinput
+
+
diff --git a/re2c/doc/tdfa_v2/img/Makefile b/re2c/doc/tdfa_v2/img/Makefile
new file mode 100644 (file)
index 0000000..0057640
--- /dev/null
@@ -0,0 +1,7 @@
+%.pdf : %.tex
+       lualatex -shell-escape $< </dev/null > $<.build_log
+
+all : trees.pdf tnfa.pdf gor1.pdf
+
+clean:
+       rm *.log *.build_log *.aux *.pdf *.pag
diff --git a/re2c/doc/tdfa_v2/img/gor1.tex b/re2c/doc/tdfa_v2/img/gor1.tex
new file mode 100644 (file)
index 0000000..6a35716
--- /dev/null
@@ -0,0 +1,334 @@
+
+\documentclass[tikz,border=10pt]{standalone}
+
+
+\RequirePackage{luatex85}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath, amssymb, amsfonts, accents}
+\usetikzlibrary{graphdrawing, graphs, arrows, shapes, automata, calc, decorations.pathmorphing}
+\usegdlibrary{trees, layered}
+\usepackage{stix}
+
+
+\newcommand{\Xund}{\rule{.4em}{.4pt}}
+\newcommand{\Xl}{\langle}
+\newcommand{\Xr}{\rangle}
+\newcommand{\Xm}{\langle\!\rangle}
+
+
+\begin{document}
+
+\begin{tikzpicture}[
+    >=stealth,
+    ->,
+    auto,
+    node distance=0.7in,
+    decoration = snake
+    ]
+
+\tikzstyle{every node}=[draw=none]
+\tikzstyle{every state}=[rectangle, rounded corners = 5, minimum size=0.18in, inner sep = 3pt]
+
+\def\offsac{-0.35in}
+\def\offsad{-0.45in}
+\def\widc{1.1in}
+\def\widd{0.8in}
+
+
+
+\begin{scope}[xshift=1.7in, yshift=3.6in]
+
+    \node (a0) {};
+    \node[state, above right of = a0, xshift=-0.3in, yshift=-0.3in] (a) {$z_0$};
+
+    \node[state, above right of = a] (d0) {$x_0$};
+    \node[state, above right of = d0, xshift = 0.2in, yshift = -0.25in] (d01) {$z_1$};
+    \node[state, below right of = d0, xshift = 0.2in, yshift = +0.25in] (d02) {$z_2$};
+    \node[state, above right of = d01] (d1) {$x_1$};
+    \node[state, above right of = d02] (d2) {$x_2$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = d1] (d11) {$f_1$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = d2] (d22) {$f_2$};
+    \node[state, xshift = \offsad, right of = d11] (d3) {$y_1$};
+    \node[state, xshift = \offsad, right of = d22] (d4) {$y_2$};
+    \node[state, below right of = d3] (d33) {$w_1$};
+    \node[state, below right of = d4] (d44) {$w_2$};
+    \node[state, below right of = d33, xshift = 0.2in, yshift = +0.25in] (d5) {$y_0$};
+
+    \node[state, accepting, below right of = d5] (e) {$w_0$};
+    \node[below right of = e, xshift=-0.3in, yshift=0.3in] (e0) {};
+
+    \path [draw]
+        (a0) edge node {} (a)
+        (a) edge node {$ 2i-1 $} (d0)
+        %
+        (d0) edge [bend left = 20] node {$ \epsilon $} (d01)
+        (d0) edge [below left, near end, bend right = 20] node {$ -(2i_1-1) $} (d02)
+        (d3) edge [above right, near end] node {$ 2i_1 $} (d33)
+        (d4) edge [above right, near end] node {$ 2i_2 $} (d44)
+        (d01) edge [above left, near start] node {$ 2i_1-1 $} (d1)
+        (d02) edge [above left, near start] node {$ 2i_2-1 $} (d2)
+        (d33) edge [bend left = 20] node {$ -(2i_2-1) $} (d5)
+        (d44) edge [below right, bend right = 20] node {$ \epsilon $} (d5)
+        %
+        (d5) edge node {$ 2i $} (e)
+        (e) edge node {} (e0)
+        %
+    ;
+    \path (a) edge [draw=none] node [below=0.2in, midway] {
+    (a) \quad $F \big( (i, \Xund, (i_1, \Xund, r_1) \mid (i_2, \Xund, r_2)) \big)$ where
+    $f_i = F(0,0,r_i) \; \forall i = \overline{1,2}$
+    } (e);
+\end{scope}
+
+
+
+\begin{scope}[xshift=1.7in, yshift=1.8in]
+
+    \node (a0) {};
+    \node[state, above right of = a0, xshift=-0.3in, yshift=-0.3in] (a) {$z_0$};
+
+    \node[state, above right of = a] (b1) {$x_0$};
+    \node[state, above right of = b1] (b2) {$x_1$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = b2] (b) {$f_1$};
+    \node[state, xshift = \offsad, right of = b] (b3) {$y_1$};
+    \node[state, below right of = b3] (c1) {$w_1$};
+
+    \node[state, above right of = c1] (c2) {$x_2$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = c2] (c) {$f_2$};
+    \node[state, xshift = \offsad, right of = c] (c3) {$y_2$};
+    \node[state, below right of = c3] (c4) {$y_0$};
+
+    \node[state, accepting, below right of = c4] (e) {$w_0$};
+    \node[below right of = e, xshift=-0.3in, yshift=0.3in] (e0) {};
+
+    \path [draw]
+        (a0) edge node {} (a)
+        (a) edge node {$ 2i-1 $} (b1)
+        %
+        (b1) edge node {$ 2i_1-1 $} (b2)
+        (b3) edge [below left] node {$ 2i_1 $} (c1)
+        %
+        (c1) edge node {$ 2i_2-1 $} (c2)
+        (c3) edge [below left] node {$ 2i_2 $} (c4)
+        %
+        (c4) edge [below left] node {$ 2i $} (e)
+        (e) edge node {} (e0)
+        %
+    ;
+    \path (a) edge [draw=none] node [below=0.2in, midway] {
+    (b) \quad $F \big( (i, \Xund, (i_1, \Xund, r_1) \cdot (i_2, \Xund, r_2)) \big)$ where
+    $f_i = F(0,0,r_i) \; \forall i = \overline{1,2}$
+    } (e);
+\end{scope}
+
+
+
+
+\begin{scope}[xshift=0.7in, yshift=-0in]
+
+    \node (a0) {};
+    \node[state, above right of = a0, xshift=-0.3in, yshift=-0.3in] (a) {$z_0$};
+
+    \node[state, above right of = a] (c0) {$x_0$};
+    \node[state, right of = c0] (c1) {$z_{1}$};
+    \node[state, above right of = c1] (c2) {$x_1$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = c2] (c) {$f_1$};
+    \node[state, xshift = \offsad, right of = c] (c3) {$y_1$};
+    \node[state, below right of = c3] (c4) {$w_{1}$};
+    \node[state, right of = c4] (c5) {$z_{2}$};
+
+    \node[state, right of = c5] (d1) {$z_{m}$};
+    \node[state, above right of = d1] (d2) {$x_m$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = d2] (d) {$f_m$};
+    \node[state, xshift = \offsad, right of = d] (d3) {$y_m$};
+    \node[state, below right of = d3] (d4) {$y_0$};
+
+    \node[state, accepting, below right of = d4] (e) {$w_0$};
+    \node[below right of = e, xshift=-0.3in, yshift=0.3in] (e0) {};
+
+    \path [draw, decorate] (c5) -- node {} (d1);
+    \path [draw]
+        (a0) edge node {} (a)
+        (a) edge node {$ 2i-1 $} (c0)
+        %
+        (c0) edge node {$ \epsilon $} (c1)
+        (c1) edge node {$ 2i_1-1 $} (c2)
+        (c3) edge [below left] node {$ 2i_1 $} (c4)
+        (c4) edge node {$ \epsilon $} (c5)
+        %
+        (d1) edge node {$ 2i_1-1 $} (d2)
+        (d3) edge [below left] node {$ 2i_1 $} (d4)
+        %
+        (d4) edge [below left] node {$ 2i $} (e)
+        (e) edge node {} (e0)
+        %
+    ;
+    \draw (c4) .. controls ($ (c4) + (1.5, -1.0) $) and ($ (d4) + (-1.5, -1.0) $) .. node {$ \epsilon $} (d4);
+    \draw (c0) .. controls ($ (c0) + (1.5, -1.5) $) and ($ (d4) + (-1.5, -1.5) $) .. node [above] {$ -(2i_1-1) $} (d4);
+    \path (a) edge [draw=none] node [below, midway] {
+    (c) \quad $F \big( (i, \Xund, (i_1, \Xund, r_1)^{0, m}) \big)$ where
+    $0 < m < \infty$,
+    $f_i = F(0,0,r_1) \; \forall i = \overline{1,m}$
+    } (e);
+\end{scope}
+
+
+
+\begin{scope}[xshift=0in, yshift=-1.6in]
+
+    \node (a0) {};
+    \node[state, above right of = a0, xshift=-0.3in, yshift=-0.3in] (a) {$z_0$};
+
+    \node[state, above right of = a] (b1) {$x_0$};
+    \node[state, above right of = b1] (b2) {$x_1$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = b2] (b) {$f_{1}$};
+    \node[state, xshift = \offsad, right of = b] (b3) {$y_1$};
+    \node[state, below right of = b3] (b4) {$w_1$};
+
+    \node[state, right of = b4] (c1) {$w_{n-1}$};
+    \node[state, above right of = c1] (c2) {$x_n$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = c2] (c) {$f_{n}$};
+    \node[state, xshift = \offsad, right of = c] (c3) {$y_n$};
+    \node[state, below right of = c3] (c4) {$w_{n}$};
+    \node[state, right of = c4] (c5) {$z_{n+1}$};
+
+    \node[state, right of = c5] (d1) {$z_m$};
+    \node[state, above right of = d1] (d2) {$x_m$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = d2] (d) {$f_m$};
+    \node[state, xshift = \offsad, right of = d] (d3) {$y_m$};
+    \node[state, below right of = d3] (d4) {$y_0$};
+
+    \node[state, accepting, below right of = d4] (e) {$w_0$};
+    \node[below right of = e, xshift=-0.3in, yshift=0.3in] (e0) {};
+
+    \path [draw, decorate] (b4) -- node {} (c1);
+    \path [draw, decorate] (c5) -- node {} (d1);
+    \path [draw]
+        (a0) edge node {} (a)
+        (a) edge node {$ 2i-1 $} (b1)
+        %
+        (b1) edge node {$ 2i_1-1 $} (b2)
+        (b3) edge [below left] node {$ 2i_1 $} (b4)
+        %
+        (c1) edge node {$ 2i_1-1 $} (c2)
+        (c3) edge [below left] node {$ 2i_1 $} (c4)
+        (c4) edge node {$ \epsilon $} (c5)
+        %
+        (d1) edge node {$ 2i_1-1 $} (d2)
+        (d3) edge [below left] node {$ 2i_1 $} (d4)
+        (d4) edge [below left] node {$ 2i $} (e)
+        %
+        (e) edge node {} (e0)
+        %
+    ;
+    \draw (c4) .. controls ($ (c4) + (1.5, -1.0) $) and ($ (d4) + (-1.5, -1.0) $) .. node {$ \epsilon $} (d4);
+    \path (a) edge [draw=none] node [below=-0.1in, midway] {
+    (d) \quad $F \big( (i, \Xund, (i_1, \Xund, r_1)^{n, m}) \big)$ where
+    $0 < n \leq m < \infty$,
+    $f_i = F(0,0,r_1) \; \forall i = \overline{1,n}$
+    } (e);
+\end{scope}
+
+
+
+\begin{scope}[xshift=1.7in, yshift=-3.1in]
+
+    \node (a0) {};
+    \node[state, above right of = a0, xshift=-0.3in, yshift=-0.3in] (a) {$z_0$};
+
+    \node[state, above right of = a] (d0) {$x_0$};
+    \node[state, right of = d0] (d1) {$z_{1}$};
+    \node[state, above right of = d1] (d2) {$x_1$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = d2] (d) {$f_1$};
+    \node[state, xshift = \offsad, right of = d] (d3) {$y_1$};
+    \node[state, below right of = d3] (d4) {$w_{1}$};
+    \node[state, right of = d4] (d5) {$y_0$};
+
+    \node[state, accepting, below right of = d5] (e) {$w_0$};
+    \node[below right of = e, xshift=-0.3in, yshift=0.3in] (e0) {};
+
+    \path [draw]
+        (a0) edge node {} (a)
+        (a) edge node {$ 2i-1 $} (d0)
+        %
+        (d0) edge node {$ \epsilon $} (d1)
+        (d1) edge node {$ 2i_1-1 $} (d2)
+        (d3) edge [below left] node {$ 2i_1 $} (d4)
+        (d4) edge node {$ \epsilon $} (d5)
+        %
+        (d5) edge [below left] node {$ 2i $} (e)
+        (e) edge node {} (e0)
+        %
+    ;
+    \draw (d4) .. controls ($ (d4) + (-1, -0.3) $) and ($ (d1) + (1, -0.3) $) .. node [above] {$ \epsilon $} (d1);
+    \draw (d0) .. controls ($ (d0) + (1.5, -1) $) and ($ (d5) + (-1.5, -1) $) .. node [above] {$ -(2i_1-1) $} (d5);
+    \path (a) edge [draw=none] node [below=0.1in, midway] {
+    (e) \quad $F \big( (i, \Xund, (i_1, \Xund, r_1)^{0, \infty}) \big)$ where
+    $f_1 = F(0,0,r_1)$
+    } (e);
+\end{scope}
+
+
+
+\begin{scope}[xshift=0.2in, yshift=-4.8in]
+
+    \node (a0) {};
+    \node[state, above right of = a0, xshift=-0.3in, yshift=-0.3in] (a) {$z_0$};
+
+    \node[state, above right of = a] (b1) {$x_0$};
+    \node[state, above right of = b1] (b2) {$x_1$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = b2] (b) {$f_{1}$};
+    \node[state, xshift = \offsad, right of = b] (b3) {$y_1$};
+    \node[state, below right of = b3] (b4) {$w_1$};
+
+    \node[state, right of = b4] (c1) {$w_{n-2}$};
+    \node[state, above right of = c1] (c2) {$x_{n-1}$};
+    \node[state, rounded corners = 10, minimum width = \widc, minimum height = 0.3in, xshift = \offsac, right of = c2] (c) {$f_{n-1}$};
+    \node[state, xshift = \offsac, right of = c] (c3) {$y_{n-1}$};
+    \node[state, below right of = c3] (d1) {$w_{n-1}$};
+
+    \node[state, above right of = d1] (d2) {$x_n$};
+    \node[state, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offsad, right of = d2] (d) {$f_n$};
+    \node[state, xshift = \offsad, right of = d] (d3) {$y_n$};
+    \node[state, below right of = d3] (d4) {$w_{n}$};
+    \node[state, right of = d4] (d5) {$y_0$};
+
+    \node[state, accepting, below right of = d5] (e) {$w_0$};
+    \node[below right of = e, xshift=-0.3in, yshift=0.3in] (e0) {};
+
+    \path [draw, decorate] (b4) -- node {} (c1);
+    \path [draw]
+        (a0) edge node {} (a)
+        (a) edge node {$ 2i-1 $} (b1)
+        %
+        (b1) edge node {$ 2i_1-1 $} (b2)
+        (b3) edge [below left] node {$ 2i_1 $} (b4)
+        %
+        (c1) edge node {$ 2i_1-1 $} (c2)
+        (c3) edge [below left] node {$ 2i_1 $} (d1)
+        %
+        (d1) edge node {$ 2i_1-1 $} (d2)
+        (d3) edge [below left] node {$ 2i_1 $} (d4)
+        (d4) edge node {$ \epsilon $} (d5)
+%        (d4) edge node [below=0.05in] {$\epsilon $} (d1)
+        %
+        (d5) edge [below left] node {$ 2i $} (e)
+        (e) edge node {} (e0)
+        %
+    ;
+    \draw (d4) .. controls ($ (d4) + (-1, -0.3) $) and ($ (d1) + (1, -0.3) $) .. node [above] {$ \epsilon $} (d1);
+    \path (a) edge [draw=none] node [below=-0.1in, midway] {
+    (f) \quad $F \big( (i, \Xund, (i_1, \Xund, r_1)^{n, \infty}) \big)$ where
+    $0 < n < \infty$,
+    $f_i = F(0,0,r_1) \; \forall i = \overline{1,n}$
+    } (e);
+\end{scope}
+
+
+
+
+\end{tikzpicture}
+
+
+\end{document}
+
diff --git a/re2c/doc/tdfa_v2/img/tnfa.tex b/re2c/doc/tdfa_v2/img/tnfa.tex
new file mode 100644 (file)
index 0000000..6a8ebb0
--- /dev/null
@@ -0,0 +1,258 @@
+
+\documentclass[tikz,border=10pt]{standalone}
+
+
+\RequirePackage{luatex85}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath, amssymb, amsfonts, accents}
+\usetikzlibrary{graphdrawing, graphs, arrows, shapes, automata, calc}
+\usegdlibrary{trees, layered}
+\usepackage{stix}
+
+
+\newcommand{\Xund}{\rule{.4em}{.4pt}}
+
+
+\begin{document}
+
+\def\offs{-0.65in}
+\def\widd{1in}
+\def\dist{1in}
+
+\begin{tikzpicture}[>=stealth, ->, auto, node distance=\dist]
+
+\tikzstyle{every node}=[draw=none]
+\tikzstyle{every state}=[rectangle, rounded corners = 5, minimum size=0.18in, inner sep = 2pt]
+
+\tikzset{style1/.style={draw, rectangle, rounded corners = 10, minimum width = \widd, minimum height = 0.3in, xshift = \offs}}
+\tikzset{style2/.style={state, accepting, xshift = \offs}}
+
+\begin{scope}[xshift=0in]
+    \def\offs{-0.5in}
+    \def\widd{1.3in}
+
+    \node[state] (a) {$x$};
+    \node[state, accepting, right of=a] (b1) {$x_1$};
+    \node[style1, right of = b1] (b) {$F \big( (0, 0, r) \big)$};
+    \node[style2, right of = b] (b2) {$y_1$};
+    \node[state, accepting, right of=b2] (d) {$y$};
+    \path
+        (a) edge node {$\epsilon / otag(r)$} (b1)
+        (b2) edge node {$\epsilon / ctag(r)$} (d)
+    ;
+    \path (a) edge [draw=none] node [below=0.15in, midway] {
+    $\begin{aligned}
+    F \big( (i, j, r) \big) \mid i \neq 0 &= (\Sigma, Q, x, \{y\}, \Delta) \\
+        \text{where }
+            F \big( (0, 0, r) \big) &= (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1) \\
+            Q &= Q_1 \cup \{ x, y \}\\
+            \Delta &= \Delta_1 \cup
+                \big\{ (x, \epsilon, otag(r), x_1), (y_1, \epsilon, ctag(r), y) \big\}
+    \end{aligned}$
+    } (d);
+\end{scope}
+
+\begin{scope}[xshift=0.5in, yshift=-1.4in]
+    \node[state] (a) {$x$};
+    \node[state, accepting, right of=a] (b) {$y$};
+    \path (a) edge node {$\epsilon / \epsilon$} (b);
+    \path (a) edge [draw=none] node [below=0.15in, midway] {
+    $F \big( (0, 0, \epsilon) \big) = \big(
+        \Sigma,
+        \{x, y\},
+        x,
+        \{y\},
+        \{ (x, \epsilon, \epsilon, y) \}
+    \big)$
+    } (b);
+\end{scope}
+
+\begin{scope}[xshift=0.5in, yshift=-2.2in]
+    \node[state] (a) {$x$};
+    \node[state, accepting, right of=a] (b) {$y$};
+    \path (a) edge node {$\alpha / \epsilon$} (b);
+    \path (a) edge [draw=none] node [below=0.15in, midway] {
+    $F \big( (0, 0, \alpha) \big) = \big(
+        \Sigma,
+        \{x, y\},
+        x,
+        \{y\},
+        \{ (x, \alpha, \epsilon, y) \}
+    \big)$
+    } (b);
+\end{scope}
+
+\begin{scope}[xshift=0.5in, yshift=-3in]
+    \def\offs{-0.65in}
+    \def\widd{1in}
+
+    \node[state] (a1) {$x_1$};
+    \node[style1, right of = a1] (a) {$F(r_1)$};
+    \node[style2, right of = a] (a2) {$y_1$};
+    \node[style1, right of = a2] (b) {$F(r_2)$};
+    \node[style2, right of = b] (b2) {$y_2$};
+    \path (a1) edge [draw=none] node [below=0.25in, midway] {
+    $\begin{aligned}
+    F \big( (0, 0, r_1 \cdot r_2) \big) &= (\Sigma, Q, x_1, \{y_2\}, \Delta) \\
+        \text{where }
+            F(r_i) &= (\Sigma, Q_i, x_i, \{y_i\}, \Delta_i) \; \forall i = \overline{1,2} \\
+            Q &= Q_1 \cup Q_2 \setminus \{ x_2 \}\\
+            \Delta &= \Delta_1 \cup
+                \big\{ (y_1, \alpha, \beta, z) \mid (x_2, \alpha, \beta, z) \in \Delta_2 \big\}
+    \end{aligned}$} (b2);
+\end{scope}
+
+\begin{scope}[xshift=0in, yshift=-5in]
+    \node[state] (a) {$x$};
+    \node[state, above right of=a, yshift = -0.4in] (b1) {$x_1$};
+    \node[style1, right of = b1] (b) {$F \big( r_1 \big)$};
+    \node[style2, right of = b] (b2) {$y_1$};
+
+    \node[state, below right of=a, yshift = 0.4in] (c1) {$x_2$};
+    \node[style1, right of = c1] (c) {$F \big( r_2 \big)$};
+    \node[style2, right of = c] (c2) {$y_2$};
+
+%    \node[draw, rectangle, rounded corners = 6, minimum width = 0.17in, minimum height = 0.67in, right of = b, xshift = \offs, yshift = -0.25in] (ab) {};
+    \node[state, accepting] (d) [below right of = b2, yshift = 0.4in] {$y$};
+    \path
+        (a)  edge [bend left]  node {$\epsilon / \epsilon$} (b1)
+        (a)  edge [bend right] node [below left] {$\epsilon / ntag(r_1) $} (c1)
+        (b2) edge [bend left] node {$\epsilon / ntag(r_2) $} (d)
+        (c2) edge [bend right] node [below right] {$\epsilon / \epsilon$} (d)
+    ;
+%    \path (a) edge [draw=none] node [below=0.6in, midway] {$F \big( (0, 0, (i_1, j_1, r_1) \mid (i_2, j_2, r_2)) \big)$} (d);
+    \path (a) edge [draw=none] node [below=0.6in, midway] {
+    $\begin{aligned}
+    F \big( (0, 0, r_1 \mid r_2) \big) &= (\Sigma, Q, x, \{y\}, \Delta) \\
+        \text{where }
+            F(r_i) &= (\Sigma, Q_i, x_i, \{y_i\}, \Delta_i) \; \forall i = \overline{1,2} \\
+            Q &= Q_1 \cup Q_2 \cup \{ x, y \} \\
+            \Delta &= \Delta_1 \cup \Delta_2 \cup
+                \big\{ (x, \epsilon, \epsilon, x_1), (y_2, \epsilon, \epsilon, y), \\
+                    & (y_1, \epsilon, ntag(r_2), y), (x, \epsilon, ntag(r_1), x_2)
+            \big\}
+    \end{aligned}$} (d);
+\end{scope}
+
+\begin{scope}[xshift=4in, yshift=0in]
+    \def\offs{-0.65in}
+    \def\widd{1in}
+
+    \node[state] (a1) {};
+    \node[style1, right of = a1] (a) {$F(r)$};
+    \node[style2, right of = a] (a2) {};
+    \node[style1, right of = a2, minimum width = 1.8in, xshift = 0.4in] (b) {$F \big( (0, 0, r^{n-1, m-1}) \big)$};
+    \node[style2, right of = b, xshift = 0.4in] (b2) {};
+    \path (a1) edge [draw=none] node [below=0.25in, midway] {
+    $\begin{aligned}
+    F \big( (0, 0, r^{n, m}) \big) \mid n > 1 &= F \big( (0, 0, r \cdot (0, 0, r^{n-1, m-1})) \big)
+    \end{aligned}$} (b2);
+\end{scope}
+
+\begin{scope}[xshift=4in, yshift=-1.5in]
+    \def\offs{-0.25in}
+    \def\widd{1.4in}
+    \def\dist{0.8in}
+
+    \node[state] (a) {$x$};
+
+    \node[state, right of=a] (b1) {$x_1$};
+    \node[style1, right of = b1] (b) {$F \big( (0, 0, r^{1,m} \big)$};
+    \node[style2, right of = b] (b2) {$y_1$};
+
+    \path
+        (a) edge node {$\epsilon / \epsilon$} (b1)
+    ;
+    \draw (a) .. controls ($ (a) + (0, 1.5) $) and ($ (b2) + (-1, 1) $) .. node [above] {$\epsilon / ntag(r)$} (b2);
+    \path (a) edge [draw=none] node [below=0.3in, midway] {
+    $\begin{aligned}
+    F \big( (0, 0, r^{0, m}) \big) &= (\Sigma, Q, x, \{y_1\}, \Delta) \\
+        \text{where }
+            F \big( (0, 0, r^{1, m}) \big) &= (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1) \\
+            Q &= Q_1 \cup \{ x \} \\
+            \Delta &= \Delta_1 \cup
+                \big\{ (x, \epsilon, \epsilon, x_1), (x, \epsilon, ntag(r), y_1) \big\}
+    \end{aligned}$} (b2);
+\end{scope}
+
+\begin{scope}[xshift=4.5in, yshift=-3.5in]
+    \def\offs{-0.45in}
+    \def\widd{1in}
+    \def\dist{0.8in}
+
+    \node[state] (b1) {$x_1$};
+    \node[style1, right of = b1] (b) {$F(r)$};
+    \node[style2, right of = b] (b2) {$y_1$};
+
+    \node[state, accepting, right of = b2] (c) {$y$};
+
+    \path
+        (b2) edge node {$\epsilon / \epsilon$} (c)
+    ;
+    \draw (b2) .. controls ($ (b2) + (1, 1.5) $) and ($ (b1) + (-1, 1.5) $) .. node [above] {$\epsilon / \epsilon$} (b1);
+    \path (b1) edge [draw=none] node [below=0.3in, midway] {
+    $\begin{aligned}
+    F \big( (0, 0, r^{1, \infty}) \big) &= (\Sigma, Q, x_1, \{y\}, \Delta) \\
+        \text{where }
+            F(r) &= (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1) \\
+            Q &= Q_1 \cup \{ y \} \\
+            \Delta &= \Delta_1 \cup
+                \big\{ (y_1, \epsilon, \epsilon, x_1), (y_1, \epsilon, \epsilon, y) \big\}
+    \end{aligned}$} (c);
+\end{scope}
+
+\begin{scope}[xshift=3.2in, yshift=-5.5in]
+    \def\offs{-0.55in}
+    \def\widd{0.8in}
+    \def\dist{0.8in}
+
+    \node[state] (b1) {$x_1$};
+    \node[style1, right of = b1] (b) {$f_1$};
+    \node[style2, right of = b] (b2) {$y_1$};
+
+    \node[state, right of = b2] (c1) {$x_2$};
+    \node[style1, right of = c1] (c) {$f_2$};
+    \node[style2, right of = c] (c2) {$y_2$};
+    %
+    \node[state, right of = c2, draw = none] (cd) {\Large{$\dots$}};
+    %
+    \node[state, right of = cd] (d1) {$x_m$};
+    \node[style1, right of = d1] (d) {$f_m$};
+    \node[style2, right of = d] (d2) {$y_m$};
+
+    \path
+        (c2) edge node {$\epsilon / \epsilon$} (cd)
+        (cd) edge node {$\epsilon / \epsilon$} (d1)
+        (b2) edge node {$\epsilon / \epsilon$} (c1)
+    ;
+    \draw (b2) .. controls ($ (b2) + (0, 2) $) and ($ (d2) + (-2, 2) $) .. node [very near start] {$\epsilon / \epsilon$} (d2);
+    \draw (c2) .. controls ($ (c2) + (0, 1) $) and ($ (d2) + (-2, 1) $) .. node [very near start] {$\epsilon / \epsilon$} (d2);
+    \path (b1) edge [draw=none] node [below=0.3in, midway] {
+    $\begin{aligned}
+    F \big( (0, 0, r^{1, m}) \big) \mid m \neq \infty &= (\Sigma, Q, x_1, \{y_m\}, \Delta) \\
+        \text{where }
+            f_i &= F(r) = (\Sigma, Q_i, \{y_i\}, x_i, \Delta_i) \; \forall i = \overline{1, m} \\
+            Q &= Q_1 \cup \hdots \cup Q_m \\
+            \Delta &= \Delta_1 \cup \hdots \cup \Delta_m
+                \cup \big\{ (y_i, \epsilon, \epsilon, x_{i+1}), (y_i, \epsilon, \epsilon, y_m) \big\}_{i=1}^{m-1}
+    \end{aligned}$} (d2);
+\end{scope}
+
+\end{tikzpicture}
+
+
+\iffalse
+    \begin{align*}
+    \\
+    \\
+    F \big( (0, 0, r^{n, m}) \big) \mid n > 1 &= F \big( (0, 0, r \cdot r^{n - 1, m - 1})
+    \\
+    \\
+    \\
+    \\
+    \end{align*}
+\fi
+
+
+\end{document}
+
diff --git a/re2c/doc/tdfa_v2/img/trees.tex b/re2c/doc/tdfa_v2/img/trees.tex
new file mode 100644 (file)
index 0000000..c26a9cd
--- /dev/null
@@ -0,0 +1,149 @@
+
+\documentclass[tikz,border=10pt]{standalone}
+
+
+\RequirePackage{luatex85}
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath, amssymb, amsfonts, accents}
+\usetikzlibrary{graphdrawing, graphs, shapes, arrows}
+\usegdlibrary{trees}
+\usepackage{stix}
+
+
+\begin{document}
+
+%\begin{tikzpicture}[>=stealth, every node/.style={rectangle, rounded corners, draw, minimum size=0.1in}]
+\begin{tikzpicture}[>=stealth, every node/.style={draw=none, minimum size=0.1}]
+
+\begin{scope}[xshift=2in]
+%    \node [rectangle, rounded corners, draw, minimum width=3.7in, minimum height=1.9in, yshift=-0.7in] {};
+%    \node[yshift=0.3in, draw=none] {$t_1: T(T(\varnothing, T(a)), T(\varnothing))$};
+    \graph [tree layout, grow=down, fresh nodes] {
+        "${(1, 1, \cdot)}_{\Lambda}$" -- {
+            "${(2, 2, |)}_{1}$" -- {
+                "${(0, 0, \epsilon)}_{1.1}$"[draw=none],
+                "${(0, 0, \{0,\infty\})}_{1.2}$"[draw=none] -- {
+                    "${(0, 0, a)}_{1.2.1}$"[draw=none]
+                }
+            },
+            "${(3, 0, \{0,\infty\})}_{2}$" -- {
+                "${(4, 3, |)}_{2.1}$" -- {
+                    "${(0, 0, a)}_{2.1.1}$"[draw=none],
+                    "${(0, 0, \epsilon)}_{2.1.2}$"[draw=none]
+                }
+            }
+        }
+    };
+    \node[xshift=0in, yshift=-1.5in, draw=none]
+    {\small{$
+    \Big(1, 1,
+        \big(2, 2,
+            (0, 0, \epsilon ) \mid
+            (0, 0,
+                (0, 0, a)^{0, \infty}
+            )
+        \big) \cdot
+        \big(3, 0,
+            (4, 3,
+                (0, 0, a) \mid
+                (0, 0, \epsilon)
+            )^{0, \infty}
+        \big)
+    \Big)$}};
+%    \node[xshift=0in, yshift=-1.7in, draw=none] {$(\epsilon | a^{0,\infty})(a | \epsilon)^{0,\infty}$};
+\end{scope}
+
+\begin{scope}[xshift=0in, yshift=-2in]
+    \node[xshift=-0.3in, draw=none] {$s:$};
+    \graph [tree layout, grow=down, fresh nodes] {
+        "${T}^{1}_{\Lambda}$" -- {
+            "${T}^{2}_{1}$" -- {
+                "${\varnothing}^{0}_{1.1}$"[draw=none],
+                "${T}^{0}_{1.2}$"[draw=none] -- {
+                    "${a}^{0}_{1.2.1}$"[draw=none]
+                }
+            },
+            "${T}^{3}_{2}$" -- {
+                "${\varnothing}^{4}_{2.1}$"
+            }
+        }
+    };
+    \node[yshift=-1.5in, draw=none]
+    {\small{${T}^{1} \big(
+        {T}^{2} \big(
+            {\varnothing}^{0},
+            {T}^{0}({a}^{0})
+        \big),
+        {T}^{3}(
+            {\varnothing}^{4}
+        )
+    \big)$}};
+\end{scope}
+
+\begin{scope}[xshift=2in, yshift=-2in]
+    \node[xshift=-0.3in, draw=none] {$t:$};
+    \graph [tree layout, grow=down, fresh nodes] {
+        "${T}^{1}_{\Lambda}$" -- {
+            "${T}^{2}_{1}$" -- {
+                "${\varnothing}^{0}_{1.1}$"[draw=none],
+                "${T}^{0}_{1.2}$"[draw=none] -- {
+                    "${\varnothing}^{0}_{1.2.1}$"[draw=none]
+                }
+            },
+            "${T}^{3}_{2}$" -- {
+                "${T}^{4}_{2.1}$" -- {
+                    "${a}^{0}_{2.1.1}$"[draw=none],
+                    "${\varnothing}^{0}_{2.1.2}$"[draw=none]
+                }
+            }
+        }
+    };
+    \node[yshift=-1.5in, draw=none]
+    {\small{${T}^{1}\big(
+        {T}^{2}(
+            {\varnothing}^{0},
+            {T}^{0}({\varnothing}^{0})
+        ),
+        {T}^{3}\big(
+            {T}^{4}({a}^{0},{\varnothing}^{0})
+        \big)
+    \big)$}};
+\end{scope}
+
+\begin{scope}[xshift=4.2in, yshift=-2in]
+    \node[xshift=-0.3in, draw=none] {$u:$};
+    \graph [tree layout, grow=down, fresh nodes] {
+        "${T}^{1}_{\Lambda}$" -- {
+            "${T}^{2}_{1}$" -- {
+                "${\epsilon}^{0}_{1.1}$"[draw=none],
+                "${\varnothing}^{0}_{1.2}$"[draw=none]
+            },
+            "${T}^{3}_{2}$" -- {
+                "${T}^{4}_{2.1}$" -- {
+                    "${a}^{0}_{2.1.1}$"[draw=none],
+                    "${\varnothing}^{0}_{2.1.2}$"[draw=none]
+                },
+                "${T}^{4}_{2.2}$" -- {
+                    "${\varnothing}^{0}_{2.2.1}$"[draw=none],
+                    "${\epsilon}^{0}_{2.2.2}$"[draw=none]
+                }
+            }
+        }
+    };
+    \node[xshift=0.2in, yshift=-1.5in, draw=none]
+    {\small{${T}^{1}\big(
+        {T}^{2}(
+            {\epsilon}^{0},
+            {\varnothing}^{0}
+        ),
+        {T}^{3}\big(
+            {T}^{4}({a}^{0},{\varnothing}^{0}),
+            {T}^{4}({\varnothing}^{0}, {\epsilon}^{0})
+        \big)
+    \big)$}};
+\end{scope}
+
+\end{tikzpicture}
+
+\end{document}
+
diff --git a/re2c/doc/tdfa_v2/part_1_tnfa.tex b/re2c/doc/tdfa_v2/part_1_tnfa.tex
new file mode 100644 (file)
index 0000000..fd94d46
--- /dev/null
@@ -0,0 +1,1680 @@
+\documentclass[AMA,STIX1COL]{WileyNJD-v2}
+
+\articletype{Research Article}
+
+\received{26 April 2016}
+\revised{6 June 2016}
+\accepted{6 June 2016}
+
+%\raggedbottom
+
+%\usepackage{booktabs}
+
+\let\procedure\relax
+\let\endprocedure\relax
+
+%\usepackage[ruled]{algorithm2e} % For algorithms
+\usepackage[noline, noend, nofillcomment]{algorithm2e}
+%\usepackage[noline, noend, nofillcomment, linesnumbered]{algorithm2e}
+%    \setlength{\algomargin}{0em}
+    \SetArgSty{textnormal}
+%    \SetNoFillComment
+%    \newcommand{\Xcmfont}[1]{\texttt{\footnotesize{#1}}}\SetCommentSty{Xcmfont}
+\renewcommand{\algorithmcfname}{ALGORITHM}
+%\SetAlFnt{\small}
+%\SetAlCapFnt{\small}
+%\SetAlCapNameFnt{\small}
+%\SetAlCapHSkip{0pt}
+\IncMargin{-\parindent}
+
+\usepackage[utf8]{inputenc}
+\usepackage{amsmath,amssymb,amsfonts}
+\usepackage{accents}
+\usepackage{mathtools}
+\usepackage{graphicx}
+\usepackage{enumitem}
+\usepackage[justification=centering]{caption}
+\usepackage{url}
+
+\newcommand{\Xl}{\langle}
+\newcommand{\Xr}{\rangle}
+\newcommand{\Xm}{\langle\!\rangle}
+\newcommand{\Xset}{\!\leftarrow\!}
+\newcommand{\Xund}{\rule{.4em}{.4pt}}
+\newcommand{\Xlb}{[\![}
+\newcommand{\Xrb}{]\!]}
+\newcommand{\Xmap}{\!\mapsto\!}
+\newcommand{\XB}{\mathcal{B}}
+\newcommand{\XD}{\mathcal{D}}
+\newcommand{\XE}{\mathcal{E}}
+\newcommand{\XF}{\mathcal{F}}
+\newcommand{\XI}{\mathcal{I}}
+\newcommand{\XL}{\mathcal{L}}
+\newcommand{\XN}{\mathcal{N}}
+\newcommand{\XM}{\mathcal{M}}
+\newcommand{\XO}{\mathcal{O}}
+\newcommand{\XP}{\mathcal{P}}
+\newcommand{\XR}{\mathcal{R}}
+\newcommand{\XS}{\mathcal{S}}
+\newcommand{\XT}{\mathcal{T}}
+\newcommand{\XX}{\mathcal{X}}
+\newcommand{\YB}{\mathbb{B}}
+\newcommand{\YF}{\mathbb{F}}
+\newcommand{\YN}{\mathbb{N}}
+\newcommand{\YT}{\mathbb{T}}
+\newcommand{\YQ}{\mathbb{Q}}
+\newcommand{\YZ}{\mathbb{Z}}
+
+\newcommand{\Xstirling}[2]{\genfrac{\{}{\}}{0pt}{}{#1}{#2}}
+\newcommand*{\Xbar}[1]{\overline{#1\vphantom{\bar{#1}}}}
+
+\setlist{nosep}
+%\setlength{\parskip}{0.5em}
+
+\newenvironment{Xfig}
+    {\par\medskip\noindent\minipage{\linewidth}\begin{center}}
+    {\end{center}\endminipage\par\medskip}
+\newenvironment{Xtab}
+    {\par\medskip\noindent\minipage{\linewidth}\begin{center}}
+    {\end{center}\endminipage\par\medskip}
+
+%\setlength{\parindent}{0pt}
+
+%\theoremstyle{definition}
+\newtheorem{Xdef}{Definition}
+\newtheorem{XThe}{Theorem}
+\newtheorem{XLem}{Lemma}
+\newtheorem{Xobs}{Observation}
+
+
+\begin{document}
+
+\title{POSIX Disambiguation on Tagged NFA}
+
+\author[1]{Angelo Borsotti}
+\author[2]{Ulya Trofimovich}
+
+\address[1]{\email{angelo.borsotti@mail.polimi.it}}
+\address[2]{\email{skvadrik@gmail.com}}
+
+\abstract[Summary]{
+We give an algorithm for POSIX submatch extraction in regular expressions.
+Our work is based on the prior work of Okui and Suzuki, with a number of improvements.
+First, the new algorithm can handle bounded repetition.
+Second, it explores only a part of the regular expression structure
+necessary to disambiguate submatch extraction,
+which reduces the overhead for expressions with few submatch groups.
+Third, we use Thompson automaton instead of position automaton
+and give an efficient algorithm for $\epsilon$-closure construction,
+which allows us to skip the pre-processing step of Okui-Suzuki algorithm.
+%based on the Goldberg-Radzik shortest path finding algorithm.
+The complexity of our algorithm is $O(nv^2e)$ in general and $O(nve)$ for regular expression without $\epsilon$-loops,
+where $n$ is the input length, $v$ is the number of states and $e$ is the number of transitions in the automaton.
+}
+
+\keywords{Lexical Analysis, Regular Expressions, Submatch Extraction, POSIX}
+
+%\jnlcitation{\cname{
+%\author{U. Trofimovich},
+%(\cyear{2017}),
+%\ctitle{Fast Submatch Extraction in Lexer Generators},
+%\cjournal{Q.J.R. Meteorol. Soc.},
+%\cvol{2017;00:1--6}.}
+
+\maketitle
+
+\section*{Introduction}
+
+\iffalse
+
+     Yes, I know --- you've always been after building full parse trees,
+
+
+This is true, but the issue here is different. It is a matter of RE syntax and its interpretation.
+As you know, there are two views of REs: the one of Kleene (the theoretical computer science one), and the
+one of RE libraries. The first  (see Kleene, Stephen C. (1951). Shannon, Claude E.; McCarthy, John, eds.
+Representation of Events in Nerve Nets and Finite Automata (PDF). Automata Studies. Princeton University
+Press. pp. 3–42) has no notion of submatches and capturing parentheses. Indeed, parentheses in it
+are seen as in math, i.e. having no other significance than a means of changing the precedence of
+operators. In it then, r* and (r)* are the same.
+In the RE libraries view, this could be different. E.g. in the POSIX standard (the first, Chapter 9) the definition
+of "matching" (9.4.6) refers always to "ERE matching a single character or an ERE enclosed in parentheses"
+making thus no distiction between r* and (r)*. What makes the distinction is the POSIX standard for regex().
+Actually, tagged automata depart from regex() since they allow to get the match of any part of a string be it
+derived from a capturing group or not.
+I think that we can do what we want since we are not presenting a paper that describes an implementation of
+regex(). I have no problems in making the distinction; it is a valid choice much the same as the other one.
+After all, since we are not describing an implementation of regex(), this distinction does not make much
+a difference (apart perhaps a level in the pictures of trees, and some tweaks in the proofs).
+
+\fi
+
+Description of Okui algorithm.
+\\ \\
+Contributions.
+%\begin{itemize}
+%    \item
+%    \item
+%\end{itemize}
+\\ \\
+The rest of this paper is arranged as follows.
+
+\section{Regular Expressions as Parse Trees}
+
+We define regular expressions as follows\footnote{
+Regular expressions originate in the work of Kleene\cite{Kle51}.
+A rigorous definition of regular expressions is given in terms of Kleene algebra\cite{Koz94}.}:
+
+    \begin{Xdef}
+    \emph{Regular expressions (RE)} over finite alphabet $\Sigma$, denoted $\XE_\Sigma$, are:
+    \begin{enumerate}
+        \item Atomic RE:
+%          \emph{empty set} $\emptyset \in \XE_\Sigma$,
+          \emph{empty word} $\epsilon \in \XE_\Sigma$ and
+          \emph{unit word} $\alpha \in \XE_\Sigma$, where $\alpha \in \Sigma$.
+        \item Compound RE: if $e_1, e_2 \in \XE_\Sigma$, then
+          \emph{union} $e_1 | e_2 \in \XE_\Sigma$,
+          \emph{product} $e_1 e_2 \in \XE_\Sigma$,
+          \emph{repetition} $e_1^{n, m} \in \XE_\Sigma$ (where $0 \leq n \leq m \leq \infty$), and
+          \emph{submatch group} $(e_1) \in \XE_\Sigma$.
+    \end{enumerate}
+    \end{Xdef}
+
+This definition is somewhat different from the usual definition\cite{HU90}\cite{SS88};
+it is adapted to the POSIX standard.
+First, we consider parentheses as a distinct construct: in POSIX $(e)$ is semantically different from $e$.
+Second, we use generalized repetition $e^{n, m}$ instead of iteration $e^*$:
+expressing repetition in terms of iteration and product requires duplication of the subexpression,
+which may change semantics: e.g. in POSIX $(e)(e)$ is not the same as $(e)^{2,2}$.
+As usual, we assume that repetition has precedence over product and product over union,
+and parentheses may be used to override it (all parentheses are capturing).
+%Additionally, we use the following shortcut notation:
+%$e^*$ for $e^{0,\infty}$,
+%$e^+$ for $e^{1,\infty}$,
+%$e^?$ for $e^{0,1}$,
+%and $e^n$ for $e^{n,n}$.
+% %\\
+% %
+% %One possible interpretation of RE is the \emph{tree} interpretation,
+% %in which every RE denotes a set of \emph{parse trees}.
+\\
+
+First of all, we rewrite RE in a form where, instead of submatch groups,
+every subexpression has a pair of integer indices indicating its significance for submatch extraction.
+Second index indicates \emph{explicit} submatch groups:
+its value is equal to the number of submatch group, otherwize zero.
+First index is like the second one, but it also accounts for \emph{implicit} submatch groups:
+subexpressions that are not themselves parenthesized, but have nested or sibling parenthesized subexpressions.
+If both indices are zero, it means that the subexpression is ignored from submatch extraction perspective.
+If only the second index is zero, it means that the subexpression itself is not interesting,
+but some other submatch groups depend on it.
+Explicit indices are convenient because they allow us to consider individual subexpressions
+without loosing submatch context of the whole RE.
+We call this representation \emph{regular expression trees}.
+An example of RT can be seen on figure \ref{fig_parse_trees}.
+
+    \begin{Xdef}
+    \emph{Regular expression trees (RT)} over finite alphabet $\Sigma$, denoted $\XR_\Sigma$, are:
+    \begin{enumerate}
+        \item Atomic RT:
+          \emph{empty tree} $(i, j, \epsilon) \in \XR_\Sigma$ and
+          \emph{unit tree} $(i, j, \alpha) \in \XR_\Sigma$, where $\alpha \in \Sigma$ and $i, j \in \YZ$.
+
+        \item Compound RT: if $r_1, r_2 \in \XR_\Sigma$ and $i, j \in \YZ$, then
+          \emph{union} $(i, j, r_1 \mid r_2) \in \XR_\Sigma$,
+          \emph{product} $(i, j, r_1 \cdot r_2) \in \XR_\Sigma$ and
+          \emph{repetition} $(i, j, r_1^{n, m}) \in \XR_\Sigma$ (where $0 \leq n \leq m \leq \infty$).
+    \end{enumerate}
+    \end{Xdef}
+
+Function $RT : \XE_\Sigma \rightarrow \XR_\Sigma$ transforms RE into RT.
+It is defined via a composition of two functions,
+$mark$ that transforms RE into RT with submatch indices in the boolean range $\{0, 1\}$
+(indicating if the given subexpression is an implicit/explicit submatch group),
+and $enum$ that substitutes boolean indices with the actual numbers:
+$RT(e) = r$ where $(\Xund, \Xund, r) = enum(1, 1, mark(e))$.
+%
+    \begin{align*}
+    &\begin{aligned}
+        mark &: \XE_\Sigma \longrightarrow \XR_\Sigma \\
+        mark &(x) = (0, 0, x) \\
+            &\text{where } x \in \{\epsilon, \alpha\}
+        \\
+        %
+        mark &(e_1 \circ e_2) = (i, 0,
+            (i, j_1, r_1) \circ
+            (i, j_2, r_2)
+            ) \\
+            &\text{where } \circ \in \{|,\cdot\} \\
+            &\space{\hphantom{where }}(i_1, j_1, r_1) = mark(e_1) \\
+            &\space{\hphantom{where }}(i_2, j_2, r_1) = mark(e_2) \\
+            &\space{\hphantom{where }}i = i_1 \vee i_2 \\
+        %
+        mark &(e^{n, m}) = (i, 0, (i, j, r)^{n, m}) \\
+            &\text{where } (i, j, r) = mark(e) \\
+        %
+        mark &((e)) = (1, 1, r) \\
+            &\text{where } (\Xund, \Xund, r) = mark(e)
+    \end{aligned}
+    %
+    &&\begin{aligned}
+        enum &: \YZ \times \YZ \times \XR_\Sigma \longrightarrow \YZ \times \YZ \times \XR_\Sigma \\
+        enum &(\bar{i}, \bar{j}, (i, j, x)) = (\bar{i} + i, \bar{j} + j, (\bar{i} \times i, \bar{j} \times j, x)) \\
+            &\text{where } x \in \{\epsilon, \alpha\}
+        \\
+        enum &(\bar{i}, \bar{j}, (i, j, r_1 \circ r_2)) = (i_2, j_2, (\bar{i} \times i, \bar{j} \times j, \bar{r}_1 \circ \bar{r}_2)) \\
+            &\text{where } \circ \in \{|,\cdot\} \\
+            &\space{\hphantom{where }}(i_1, j_1, \bar{r}_1) = enum(\bar{i} + i, \bar{j} + j, r_1) \\
+            &\space{\hphantom{where }}(i_2, j_2, \bar{r}_2) = enum(i_1, j_1, r_2)
+        \\
+        enum &(\bar{i}, \bar{j}, (i, j, r^{n,m})) = (i_1, j_1, (\bar{i} \times i, \bar{j} \times j, \bar{r}^{n,m})) \\
+            &\text{where }
+                (i_1, j_1, \bar{r}) = enum(\bar{i} + i, \bar{j} + j, r)
+    \end{aligned}
+    \end{align*}
+
+RE and RT are equivalent representations
+(we can transform RT back to RE
+by erasing all submatch indices
+and adding parentheses around subexpressions with nonzero explicit submatch index).
+Each RT (and the corresponding RE) denotes a set of \emph{parse trees}.
+Tree nodes inherit implicit submatch index from RT nodes
+(we mark it with superscript).
+Explicit submatch index is dropped, as there is no use for it in the context of parse trees (in the current paper).
+
+    \begin{Xdef}
+    \emph{Parse trees (PT)} over finite alphabet $\Sigma$, denoted $\XT_\Sigma$, are:
+    \begin{enumerate}
+        \item Atomic PT:
+          \emph{nil tree} ${\varnothing}^i \in \XT_\Sigma$,
+          \emph{empty tree} ${\epsilon}^i \in \XT_\Sigma$ and
+          \emph{unit tree} ${\alpha}^i \in \XT_\Sigma$, where $\alpha \in \Sigma$ and $i \in \YZ$.
+        \item Compound PT: if $t_1, \dots, t_n \in \XT_\Sigma$, where $n \geq 1$, and $i \in \YZ$, then
+          ${T}^i(t_1, \dots, t_n) \in \XT_\Sigma$.
+    \end{enumerate}
+    \end{Xdef}
+
+Note that our parse trees are different from \ref{OS13}:
+we have a \emph{nil} tree (a placeholder for absent alternative and zero repetitions)
+and do not differentiate between various kinds of compound trees.
+Tree interpretation of RT is given by operator $PT: \XR_\Sigma \rightarrow 2^{\XT_\Sigma}$:
+    \begin{align*}
+        PT\big((i, \Xund, \epsilon)\big) &= \{ {\epsilon}^{i} \}
+        \\
+        PT\big((i, \Xund, \alpha)\big) &= \{ {\alpha}^{i} \}
+        \\
+        PT\big((i, \Xund, (i_1, j_1, r_1) \mid (i_2, j_2, r_2))\big) &=
+            \big\{ {T}^{i}(t, \varnothing^{i_2}) \mid t \in PT\big((i_1, j_1, r_1)\big) \big\} \cup
+            \big\{ {T}^{i}(\varnothing^{i_1}, t) \mid t \in PT\big((i_2, j_2, r_2)\big) \big\}
+        \\
+        PT\big((i, \Xund, (i_1, j_1, r_1) \cdot (i_2, j_2, r_2))\big) &=
+            \big\{ {T}^{i}(t_1, t_2) \mid
+                t_1 \in PT\big((i_1, j_1, r_1)\big),
+                t_2 \in PT\big((i_2, j_2, r_2)\big)
+            \big\} \\
+        PT\big((i, \Xund, (i_1, j_1, r_1)^{n, m})\big) &=
+            \begin{cases}
+                \big\{ {T}^{i}(t_1, \dots, t_m) \mid t_i \in PT\big((i_1, j_1, r_1)\big) \;
+                    \forall i = \overline{1, m} \big\} \cup \{ {T}^{i}(\varnothing^{i_1}) \} &\text{if } n = 0 \\
+                \big\{ {T}^{i}(t_n, \dots, t_m) \mid t_i \in PT\big((i_1, j_1, r_1)\big) \;
+                    \forall i = \overline{n, m} \big\} &\text{if } n > 0
+            \end{cases}
+    \end{align*}
+
+The \emph{string} induced by a tree $t$, denoted $str(t)$, is the concatenation of all alphabet symbols in the left-to-right traversal of $t$.
+For an RT $r$ and a string $w$, we write $PT(r, w)$ to denote the set $\{ t \in PT(r) \mid str(t) = w \}$
+(note that this set is potentially infinite).
+\\
+
+Following \cite{OS13}, we assign \emph{positions} to the nodes of RT and PT.
+The root position is $\Lambda$, and position of the $i$-th subtree of a tree with position $p$ is $p.i$.
+The \emph{length} of position $p$, denoted $|p|$, is defined as $0$ for $\Lambda$ and $|p| + i$ for $p.i$.
+%The set of all positions is denoted $\XP$.
+The subtree of a tree $t$ at position $p$ is denoted $t|_p$.
+Position $p$ is a \emph{prefix} of position $q$ iff $q = p.p'$ for some $p'$,
+and a \emph{proper prefix} if additionaly $p \neq q$.
+Position $p$ is a \emph{sibling} of position $q$ iff $q = q'.i, p = q'.j$ for some $q'$ and $i,j \in \YN$.
+Positions are ordered lexicographically, as in \ref{OS13}.
+The set of all positions of a tree $t$ is denoted $Pos(t)$.
+The set of \emph{submatch positions} of a tree $t$
+is the subset of $Pos(t)$ containing positions of subtrees with nonzero submatch index:
+$Sub(t) = \{ p \mid \exists i \neq 0, s: t|_p = s^i \}$.
+Examples of parse trees can be seen on figure \ref{fig_parse_trees}.
+
+\begin{figure}\label{fig_parse_trees}
+\includegraphics[width=\linewidth]{img/trees.pdf}
+\caption{
+RT and examples of PT for RE $(\epsilon|a^{0,\infty})(a|\epsilon)^{0,\infty}$ and string $a$.\\
+Order:
+$s <_1 t$,
+$s <_1 u$,
+$u <_{2.2} t$.
+Okui-Suzuki order:
+$s <^{os}_1 t$,
+$s <^{os}_1 u$,
+$t <^{os}_{1.1} u$.
+}
+\end{figure}
+
+%    \begin{Xdef}
+%    \emph{Lexicographic order on positions.}
+%    Given positions $p = p_1. \dots .p_n$ and $q = q_1. \dots q_m$, we say that $p < q$ iff either
+%    $\exists k < min(n,m) : p_k < q_k$,
+%    or $n < m \wedge p_i = q_i \; \forall i = \overline{1, n}$.
+%    \end{Xdef}
+
+    \begin{Xdef}\label{norm_of_parse_tree}
+    The \emph{norm} of PT $t$ at position $p$ is:
+    $$
+    \|t\|_p =
+        \begin{cases}
+            -1          &\text{if } \exists i \neq 0, s = \varnothing: t|_p = s^i \\
+            |str(t|_p)| &\text{if } \exists i \neq 0, s \neq \varnothing: t|_p = s^i \\
+            \infty      &\text{otherwise}
+        \end{cases}
+    $$
+    \end{Xdef}
+
+In other words, the norm is infinite for all positions not in $Sub(t)$,
+and for positions in $Sub(t)$ it depends on the form of subtree:
+for nil subtrees it equals $-1$,
+and for other subtrees it equals the number of symbols.
+We shorten $\|t\|_\Lambda$ as $\|t\|$.
+
+    \begin{Xdef}\label{order_on_parse_trees}
+    \emph{Order on parse trees.}
+    Given parse trees $t, s \in PT(e, w)$, we say that $t <_p s$ w.r.t. \emph{desision position} $p$ % $p \in Sub(t) \cup Sub(s)$
+    iff $\|t\|_p > \|s\|_p$ and $\|t\|_q = \|s\|_q \; \forall q < p$.
+    (Note that we do not explicitly demand that $p, q \in Sub(t) \cup Sub(s)$:
+    if this is not the case, the norms of both subtrees are $\infty$ and thus equal.)
+    We say that $t < s$ iff $t <_p s$ for some $p$.
+    If neither $t < s$, nor $s < t$, we say that $t$ and $s$ are \emph{incomparable}: $t \sim s$.
+    \end{Xdef}
+
+    \begin{XLem}\label{lemma_ptorder_antisymmetry}
+    Order on parse trees is antisymmetric: if $t < s$, then $s \not< t$.
+    \\
+    Proof.
+    Suppose, on the contrary, that $t <_p s$ and $s <_q t$ for some $p$, $q$.
+    Without loss of generality let $p \leq q$.
+    On one hand $t <_p s$ implies $\|t\|_p > \|s\|_p$.
+    On the other hand $s <_q t$ implies $\|t\|_p \leq \|s\|_p$.
+    Contradiction.
+    $\square$
+    \end{XLem}
+
+    \begin{XLem}\label{lemma_ptorder_transitivity}
+    Order on parse trees is transitive: if $t < s$ and $s < u$, then $t < u$.
+    \\
+    Proof.
+    Let $t <_p s$ and $s <_q u$ for some positions $p$, $q$, and let $r = min (p, q)$.
+
+    \medskip
+
+    First, we show that $\|t\|_r > \|u\|_r$.
+    If $p \leq q$, we have $\|t\|_p > \|s\|_p$ (implied by $t <_p s$)
+    and $\|s\|_p \geq \|u\|_p$ (implied by conjunction $s <_q u \wedge p \leq q$),
+    therefore $\|t\|_p > \|u\|_p$.
+    Otherwise $p > q$, we have $\|s\|_q > \|u\|_q$ (implied by $s <_q u$)
+    and $\|t\|_q = \|s\|_q$ (implied by conjunction $t <_p s \wedge q < p$),
+    therefore $\|t\|_q > \|u\|_q$.
+
+    \medskip
+
+    Second, we show that $\forall r' < r$ it holds that $\|t\|_{r'} = \|u\|_{r'}$.
+    We have $\|t\|_{r'} = \|s\|_{r'}$ (implied by conjunction $t <_p s \wedge r' < p$)
+    and $\|s\|_{r'} = \|u\|_{r'}$ (implied by conjunction $s <_q u \wedge r' < q$),
+    therefore $\|t\|_{r'} = \|u\|_{r'}$.
+    $\square$
+    \end{XLem}
+
+    \begin{XLem}\label{incomparability_equivdef}
+    $t \sim s \Leftrightarrow \; \forall p : \|t\|_p = \|s\|_p$.
+    \\
+    Proof.
+
+    $\Rightarrow$. %First, we show $t \sim s \Rightarrow \forall p : \|t\|_p = \|s\|_p$.
+    Suppose, on the contrary, that $\exists p = min \{ q \mid \|t\|_q \neq \|s\|_q \}$,
+    then either $t <_p s$ (if $\|t\|_p > \|s\|_p$), or $s <_p t$ (if $\|t\|_p < \|s\|_p$).
+    Both cases contradict $t \sim s$.
+
+    \medskip
+
+    $\Leftarrow$.
+    $\forall p : \|t\|_p = \|s\|_p$ implies
+    $\nexists p : t <_p s$ and $\nexists q : s <_q t$,
+    which implies $t \sim s$.
+    $\square$
+    \end{XLem}
+
+    \begin{XLem}\label{lemma_ptorder_transitivity_of_incomparability}
+    Incomparability relation on parse trees is transitive: if $t \sim s$ and $s \sim u$, then $t \sim u$.
+    \\
+    Proof.
+    By lemma \ref{incomparability_equivdef} we have
+    $t \sim s \Rightarrow \forall p : \|t\|_p = \|s\|_p$ and
+    $s \sim u \Rightarrow \forall p : \|s\|_p = \|u\|_p$,
+    therefore by lemma \ref{incomparability_equivdef} $\forall p : \|t\|_p = \|u\|_p \Rightarrow t \sim u$.
+    $\square$
+    \end{XLem}
+
+    \begin{XThe}
+    Relation $<$ is strict weak order on parse trees.
+    \\
+    \medskip
+    Proof.
+    Follows from
+    lemma \ref{lemma_ptorder_antisymmetry},
+    lemma \ref{lemma_ptorder_transitivity} and
+    lemma \ref{lemma_ptorder_transitivity_of_incomparability}.
+    $\square$
+    \end{XThe}
+
+If in Definition \ref{norm_of_parse_tree} and Definition \ref{order_on_parse_trees}
+we use $Pos(t)$ instead of $Sub(t)$, then our strict weak order $<$
+coincides with Okui-Suzuki strict total order on parse trees \cite{OS13} (we denote the latter with $<^{os}$).
+%TODO: the existense of minimal element remains to be shown, as we don't have CPT.
+While it is not true in general that $<^{os}$ is an extension of $<$
+(see the counterexample on figure \ref{fig_parse_trees}),
+the two orders are compatible in the sense that the $<^{os}$-minimal tree
+is included in the class of $<$-minimal trees.
+Intuitively, this means that if we keep ``refining'' submatch detalization
+by adding parentheses in subexpressions,
+we will gradually narrow down the class of $<$-minimal trees,
+until we are left with a single $<^{os}$-minimal tree.
+Theorem \ref{lemma_order_compat} shows this,
+and lemma \ref{lemma_subtrees} shows that comparison of subtrees is justified
+if the norms of all preceding submatch positions are equal.
+
+    \begin{XLem}\label{lemma_subtrees}
+    If $t, s \in PT(r, w)$ and $\exists p \in Sub(t) \cup Sub(s)$ such that $\|t\|_q = \|s\|_q \; \forall q \leq p$,
+    then $\exists \widetilde{r}, \widetilde{w} : t|_p, s|_p \in PT(\widetilde{r}, \widetilde{w})$.
+    \\
+    Proof.
+    By induction on position $p$.
+
+    \medskip
+
+    Induction basis: the case of $p = \Lambda$ is trivial: let $\widetilde{r} = r$, $\widetilde{w} = w$.
+
+    \medskip
+
+    Induction step: we have $|p| > 0$, let $p = p'.i$, where $i \in \YN$.
+    Let $t' = t|_{p'} = P(t_1, \dots, t_n)$,
+        $s' = s|_{p'} = P(s_1, \dots, s_m)$.
+    By induction hypothesis $\exists r', w' : t', s' \in PT(r', w')$,
+    where $w' = str(t_1) \dots str(t_n) = str(s_1) \dots str(s_m)$.
+
+    \medskip
+
+    Next, we show that $str(t_i) = str(s_i)$.
+    It must be that $i \in Sub(s') \cap Sub(t')$,
+    otherwise only one of $\|t'\|_i$, $\|s'\|_i$ is $\infty$,
+    which contradicts lemma condiiton $\|t\|_p = \|s\|_p$.
+    Consider position $j \leq i$.
+    Because the set of submatch positions contains siblings, we have $j \in Sub(s') \cap Sub(t')$.
+    Consequently, $\|t'\|_j = |str(t_j)|$ and $\|s\|_j = |str(s_j)|$.
+    By lemma condition we have $\|t\|_{p'.j} = \|s\|_{p'.j}$,
+    therefore $\|t'\|_j = \|s'\|_j$,
+    therefore $|str(t_j)| = |str(s_j)|$.
+    Because $str(t_1) \dots str(t_n) = str(s_1) \dots str(s_m)$,
+    we have $str(t_i) = str(s_i)$.
+
+    \medskip
+
+    Now, let $\widetilde{w} = str(t_i)$.
+    If $r' = r_1|r_2$ or $r' = r_1 r_2$, let $\widetilde{r} = r_i$.
+    Otherwise, $r' = r_1^{k,l}$, let $\widetilde{r} = r_1$.
+    $\square$
+    \end{XLem}
+
+    \begin{XThe}\label{lemma_order_compat}
+    For a set of parse trees $P = PT(r, w)$,
+    let $s$ be the $<^{os}$-minimal tree,
+    and $P_{min} = \{ t \in P \mid \forall u \in P : t = u \vee t < u \}$ the class of $<$-minimal trees.
+    Then $s \in P_{min}$.
+%    let $s$ be the $\prec$-minimal tree: $s = min_{<^{os}} P$,
+%    and $t$ one of the $<$-minimal trees: $t \in \{ u \in P \mid \forall u' \in P : u = u' \vee u < u' \}$.
+%    Then $s \sim t$.
+    \\
+    Proof.
+
+    Consider any $t \in P_{min}$.
+    For each position $p \in Sub(t)$ which is not itself a prefix of another position in $Sub(t)$,
+    consider subtree $t' = t|_p$.
+    It is a parse tree for some subexpression $r'$ and substring $w'$: $t' \in PT(r', w')$.
+    Let $t''$ be the $<^{os}$-minimal tree in $PT(r', w')$ and substitute $t'$ with $t''$ in $t$.
+    (Note that substitutions are independent and can be performed in any order.)
+    Let $u$ be the tree resulting from all such substitutions.
+    By lemma \ref{incomparability_equivdef} we have $u \sim t$
+    (substitutions preserve the norm of subtrees at positions in $Sub(t)$),
+    and so $u \in P_{min}$.
+
+    \medskip
+
+    Next, we show that $u = s$.
+    Suppose, on the contrary, that $u \neq s$.
+    Then, on one hand, $u <_q s$ for some $q \in Sub(s) \cup Sub(u)$ (because $u \in P_{min}$).
+    On the other hand, $s <^{os}_p u$ for some $p \in Pos(s) \cup Pos(u)$, such that $p < q$ (because $s$ is $<^{os}$-minimal).
+    Let $p = p'.p''$, where $p'$ is the longest prefix of $p$ in $Sub(s) \cup Sub(u)$.
+    It must be $\|u\|_{q'} = \|s\|_{q'} \forall q' \leq p'$ (because $p' < q$ and $u <_q s$),
+    and $p' \in Sub(u)$ (otherwise $\|u\|_{p'} = \infty \neq \|s\|_{p'}$).
+    Now, by lemma \ref{lemma_subtrees} we have $\exists r', w' : u|_{p'}, s|_{p'} \in PT(r', w')$,
+    therefore $s <^{os}_{p'.p''} u$ implies $s|_{p'} <^{os}_{p''} u|_{p'}$.
+    But $p' \in Sub(u)$ and $p'$ is not itself a prefix of another position in $Sub(u)$,
+    therefore $u|_{p'}$ is $<^{os}$-minimal by construction of $u$.
+    Contradiction.
+    $\square$
+    \end{XThe}
+
+\section{Parenthezised expressions}
+
+In this section we introduce linearised representation of parse trees: \emph{parenthesized expressions}.
+%The structure of the section follows \cite{OS13},
+%however there are subtle, but important differences in some of the definitions and proofs.
+
+    \begin{Xdef}
+    \emph{Parenthesized expressions (PE)} over finite alphabet $\Sigma$, denoted $\XP_\Sigma$, are:
+    \begin{enumerate}
+        \item Atomic PE:
+          \emph{nil expression} $\Xm \in \XP_\Sigma$,
+          \emph{empty expression} $\epsilon \in \XP_\Sigma$ and
+          \emph{unit expression} $a \in \XP_\Sigma$, where $\alpha \in \Sigma$.
+        \item Compound PE: if $e_1, e_2 \in \XP_\Sigma$, then
+            $e_1 e_2 \in \XP_\Sigma$ and
+            $\Xl e_1 \Xr \in \XP_\Sigma$.
+    \end{enumerate}
+    \end{Xdef}
+
+Parenthesis $\Xl$ is called \emph{opening} and
+parenthesis $\Xr$ is called \emph{closing};
+the \emph{nil}-parenthesis $\Xm$ is both opening and closing.
+The \emph{height} of parenthesis in a PE is the number of preceding opening parentheses (including this one)
+minus the number of preceding closing parentheses (including this one).
+For convenience we sometimes explicitly denote height with subscript:
+this allows us to consider (not necessarily correctly nested) fragments of the given PE in isolation,
+without losing the context of the whole PE.
+However, height is not a part of parenthesis itself
+and is not taken into account when comparing the elements of PE.
+Function $\Phi : \YZ \times \XT_\Sigma \rightarrow \XP_\Sigma$ transforms PT into PE:
+    $$
+    \Phi_{h}(t^{i}) = \begin{cases}
+        str(t^{i})                                            &\text{if } i = 0 \\
+        \Xm_h                                                 &\text{if } i \neq 0 \wedge t = \varnothing \\
+        \Xl_{h+1} \Xr_h                                       &\text{if } i \neq 0 \wedge t = \epsilon \\
+        \Xl_{h+1} a \Xr_h                                     &\text{if } i \neq 0 \wedge t = a \in \Sigma \\
+        \Xl_{h+1} \Phi_{h+1}(t_1) \dots \Phi_{h+1}(t_n) \Xr_h &\text{if } i \neq 0 \wedge t = T(t_1, \dots, t_n)
+    \end{cases}
+    $$
+
+For a given RT $r$ and string $w$, the set $\big\{ \Phi_{0}(t) \mid t \in PT(r, w) \big\}$ is denoted $PE(r, w)$.
+If $\alpha, \beta \in PE(r, w)$ for some $r$ and $w$, we say that $\alpha$ and $\beta$ are \emph{comparable}.
+%
+For PE $\alpha$, $\beta$,
+$\alpha \sqcap \beta$ denotes the longest common prefix of $\alpha$ and $\beta$,
+$\alpha \backslash \beta$ denotes the suffix of $\alpha$ after removing $\alpha \sqcap \beta$,
+$lastht(\alpha)$ denotes the height of the last parenthesis in $\alpha$ or $\infty$ if $\alpha$ is empty or begins with a letter,
+$minht(\alpha)$ denotes the minimal height of parenthesis in $\alpha$ or $\infty$ if $\alpha$ is empty or begins with a letter,
+$first(\alpha)$ denotes the first parenthesis in $\alpha$ or $\bot$ if $\alpha$ is empty or begins with a letter.
+Each PE $\alpha$ can be represented as $\alpha_0 a_1 \alpha_1 \dots a_n \alpha_n$,
+where $\alpha_i$ is the $i$-th \emph{frame} --- the possibly empty sequence of parentheses between
+subsequent alphabet symbols $a_i$ and $a_{i+1}$ or the beginning or end of $\alpha$.
+Note that comparable PE have the same number of frames.
+For distinct comparable PE $\alpha$, $\beta$
+the index of the first distinct pair of frames is called \emph{fork}.
+
+    \begin{Xdef}
+    Let $\alpha$, $\beta$ be distinct comparable PE, such that
+    $\alpha = \alpha_0 a_1 \alpha_1 \dots a_n \alpha_n$,
+    $\beta = \beta_0 a_1 \beta_1 \dots a_n \beta_n$ and $k$ is the fork.
+    We define $trace (\alpha, \beta)$ as the sequence $(\rho_0, \dots, \rho_n)$, where:
+    $$
+    \rho_i = \begin{cases}
+        -1 &\text{if } i < k \\
+        min (lastht (\alpha_i \sqcap \beta_i), minht(\alpha_i \backslash \beta_i)) &\text{if } i = k \\
+        min (\rho_{i-1}, minht(\alpha_i)) &\text{if } i > k
+    \end{cases}
+    $$
+    We write $traces(\alpha, \beta)$ to denote $\big( trace (\alpha, \beta), trace (\beta, \alpha) \big)$.
+    $\square$
+    \end{Xdef}
+
+    \begin{Xdef}\label{prec1}
+    Let $\alpha$, $\beta$ be comparable PE and
+    $traces(\alpha, \beta) = \big( (\rho_0, \dots, \rho_n), (\rho'_0, \dots, \rho'_n) \big)$.
+    The \emph{longest-precedence} relation $\sqsubset$ is defined as
+    $\alpha \sqsubset \beta \Leftrightarrow \exists i \leq n:
+        \big( \rho_i > \rho'_i \big) \wedge
+        \big( \rho_j = \rho'_j \; \forall j > i \big)$.
+%    $$
+%        \alpha \sqsubset \beta \quad \Leftrightarrow \quad \exists i \leq n:
+%        \prescript{}{\wedge}{\left[
+%            \begin{aligned}
+%                &\rho_i > \rho'_i \\
+%                &\forall j > i: \rho_j = \rho'_j
+%            \end{aligned}
+%        \right.}
+%    $$
+    If neither $\alpha \sqsubset \beta$, nor $\beta \sqsubset \alpha$,
+    then $\alpha$, $\beta$ are \emph{longest-equivalent}: $\alpha \sim \beta$
+    (note that in this case $\rho_i > \rho'_i \; \forall i = \overline {1, n}$).
+    \end{Xdef}
+
+    \begin{Xdef}\label{prec2}
+    Let $\alpha$, $\beta$ be comparable PE, and let
+    $x = first (\alpha \backslash \beta)$,
+    $y = first (\beta \backslash \alpha)$.
+    The \emph{leftmost-precedence} relation $\subset$ is defined as
+    $\alpha \subset \beta \Leftrightarrow x < y$, where
+    the set of possible values of $x$ and $y$ is ordered as follows:
+    $\bot < \Xr < \Xl < \Xm$.
+%    Let $\alpha$, $\beta$ be comparable PE, and let
+%    $x = first (\alpha \backslash \beta)$,
+%    $y = first (\beta \backslash \alpha)$.
+%    The \emph{leftmost-precedence} relation $\subset$ is defined as follows:
+%    $\alpha \subset \beta \Leftrightarrow
+%    \big(x = \bot \wedge y \not= \bot \big) \vee
+%    \big(x = \Xr \wedge y \not= \bot \big) \vee
+%    \big(x = \Xl \wedge y = \bar{\Xl} \big)$.
+%
+%    $$
+%        \alpha \subset \beta \quad \Leftrightarrow \quad
+%        \prescript{}{\vee \;}{\left[
+%            \begin{aligned}
+%                &x = \bot   &&\wedge && y \not= \bot \\
+%                &x = \Xr    &&\wedge && y \not= \bot \\
+%                &x = \Xl    &&\wedge && y = \bar{\Xl}
+%            \end{aligned}
+%        \right.}
+%    $$
+    \end{Xdef}
+
+    \begin{Xdef}\label{pe_order}
+    The \emph{longest-leftmost-precedence} relation $<$ on comparable PE is defined as
+    $\alpha < \beta \Leftrightarrow
+        \big( \alpha \sqsubset \beta \big) \vee
+        \big( \alpha \sim \beta \wedge \alpha \subset \beta \big)$.
+%    \begin{align*}
+%        \alpha < \beta \quad \Leftrightarrow \quad
+%        \prescript{}{\vee}{\left[
+%            \begin{aligned}
+%                &\alpha \sqsubset \beta \\
+%                &\alpha \sim \beta \wedge \alpha \subset \beta
+%            \end{aligned}
+%        \right.}
+%    \end{align*}
+    \end{Xdef}
+
+    \begin{XLem}\label{lemma_pe_order_antisymm}
+    The longest-leftmost-precedence relation $<$ is antisymmetric:
+    if $\alpha < \beta$, then $\beta \not< \alpha$.
+    \\
+    Proof.
+    Suppose, on the contrary, that $\alpha < \beta$ and $\beta < \alpha$.
+    Let $\big( (\rho_0, \dots, \rho_n), (\rho'_0, \dots, \rho'_n) \big) = traces(\alpha, \beta)$.
+
+    \medskip
+
+    If $\exists i = max \{j \mid \rho_j \neq \rho'_j \}$, then
+    $\alpha < \beta \implies \alpha \sqsubset \beta \implies \rho_i > \rho'_i$, but
+    $\beta < \alpha \implies \beta \sqsubset \alpha \implies \rho'_i > \rho_i$. Contradiction.
+
+    \medskip
+
+    Otherwise $\rho_i = \rho'_i \; \forall i$, then
+    $\alpha < \beta \implies \alpha \sim \beta \wedge \alpha \subset \beta$ and
+    $\beta < \alpha \implies \beta \sim \alpha \wedge \beta \subset \alpha$.
+    Let
+    $x = first (\alpha \backslash \beta)$,
+    $y = first (\beta \backslash \alpha)$, then
+    $\alpha \subset \beta \implies x < y$, but
+    $\beta \subset \alpha \implies y < x$. Contradiction.
+    $\square$
+    \end{XLem}
+
+
+    \begin{XLem}\label{lemma_pe_equiv}
+    Let $s, t \in PT(r, w)$.
+    If $s \sim t$, then $\Phi_{h}(h, s) = \Phi_{h}(t) \; \forall h$.
+    \\
+    Proof.
+    By induction on the height of $r$.
+
+    \medskip
+
+    Induction basis.
+    For RT of height $1$ we have
+    $| PT(r, w) | \leq 1 \; \forall w$,
+    therefore $s = t$ and $\Phi_{h}(s) = \Phi_{h}(t)$.
+
+    \medskip
+
+    Induction step.
+    We have
+    $s = T^{d} (s_1, \dots, s_n)$ and
+    $t = T^{d} (t_1, \dots, t_m)$.
+    If $d = 0$, then $\Phi_{h}(s) = str(s) = w = str(t) = \Phi_{h}(t)$.
+    Otherwise $d \neq 0$.
+    By lemma \ref{incomparability_equivdef} we have $s \sim t \Rightarrow \forall p: \|s\|_p = \|t\|_p$.
+    This implies $n = m$ (otherwise the norm of subtree at position $min(n,m)+1$ is $\infty$ for only one of $s$, $t$).
+    Therefore
+    $\Phi_{h}(s) = \Xl_{h+1} \Phi_{h+1}(s_1), \dots, \Phi_{h+1}(s_n) \Xr_h$ and
+    $\Phi_{h}(t) = \Xl_{h+1} \Phi_{h+1}(t_1), \dots, \Phi_{h+1}(t_n) \Xr_h$.
+%    Consider any $i \leq n$.
+    It suffices to show that $\forall i \leq n: \Phi_{h+1}(s_i) = \Phi_{h+1}(t_i)$.
+    We have $\forall p: \|s_i\|_p = \|t_i\|_p$ (implied by $\forall p: \|s\|_p = \|t\|_p$),
+    therefore by lemma \ref{incomparability_equivdef} we have $s_i \sim t_i$,
+    and by lemma \ref{lemma_subtrees} $\exists r', w': s_i, t_i \in PT(r', w')$,
+    where the height of $r'$ is less than the height of $r$.
+    By induction hypothesis $\Phi_{h+1}(s_i) = \Phi_{h+1}(t_i)$.
+    $\square$
+    \end{XLem}
+
+
+    \begin{XLem}\label{lemma_pe_less_1}
+    Let $s, t \in PT(r, w)$.
+    If $s <_p t$ and $|p| = 1$, then $\Phi_{h}(s) < \Phi_{h}(t) \; \forall h$.
+    \\
+    Proof.
+
+    By lemma conditions $|p| = 1$, which implies that $s$ and $t$ are compound PT
+    $s = T^{d} (s_1, \dots, s_n)$ and 
+    $t = T^{d} (t_1, \dots, t_m)$, where
+    $d \neq 0$
+    (because $\Lambda$ is a prefix of decision position $p$).
+    Therefore $\Phi_{h}(s)$, $\Phi_{h}(t)$ can be represented as follows,
+    where $k$ is the number of frames and $j$ is the fork:
+    \begin{alignat*}{7}
+        \Phi_{h}(s) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(s_1) &&\dots &&\Phi_{h+1}(s_n) \Xr_h
+            &&\;=\; \beta_0 a_1 \dots a_j \beta_j &&\;\big|\; && \gamma_j a_{j + 1} \dots a_k \gamma_k \\[-0.5em]
+        \Phi_{h}(t) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(t_1) &&\dots &&\Phi_{h+1}(t_m) \Xr_h
+            &&\;=\; \beta_0 a_1 \dots a_j \beta_j &&\;\big|\; && \delta_j a_{j + 1} \dots a_k \delta_k
+    \end{alignat*}
+%
+    By lemma conditions $|p| = 1$, therefore $p \in \YN$.
+    Consider any $i \in \YN$ such that $i < p$.
+    By lemma conditions $s <_p t$, which means
+    $\|s\|_p > \|t\|_p \wedge \|s\|_q = \|t\|_q \;\forall q < p$.
+    In particular $\|s_i\|_q = \|t_i\|_q \;\forall q$,
+    therefore by lemma \ref{incomparability_equivdef} $s_i \sim t_i$
+    and by lemma \ref{lemma_pe_equiv} we have $\Phi(s_i) = \Phi(t_i)$.
+    Let $traces (\Phi_{h}(s), \Phi_{h}(t)) = \big( (\rho_0, \dots, \rho_k), (\rho'_0, \dots, \rho'_k) \big)$
+    and consider the following cases.
+
+    \medskip
+
+    First case:
+    $\infty = \|s_p\| > \|t_p\|$.
+    In this case $s|_p$ does not exist
+    (because $p$ corresponds to a submatch position in $r$,
+    therefore $p \in Pos(s)$ implies $p \in Sub(s)$,
+    which contradicts $\|s_p\| = \infty$).
+    Fork happens immediately after $\Phi_{h+1}(s_{p-1})$, $\Phi_{h+1}(t_{p-1})$:
+    \begin{alignat*}{7}
+        \Phi_{h}(s) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(s_1) &&\dots &&\Phi_{h+1}(s_{p-1})
+            &&\;\big|\; \Xr_{h}         &&      && \\[-0.5em]
+        \Phi_{h}(t) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(t_1) &&\dots &&\Phi_{h+1}(t_{p-1})
+            &&\;\big|\; \Phi_{h+1}(t_p) &&\dots &&\Phi_{h+1}(t_m) \Xr_{h}
+    \end{alignat*}
+    %
+    In this case fork frame is the last frame: $j = k$, and therefore $\rho_j = \rho'_j = h$
+    (because $\gamma_j$ and $\delta_j$ contain the closing parenthesis $\Xr_{h}$).
+    For all $i < j$ we have $\rho_i = \rho'_i = -1$, therefore $\Phi_{h}(s) \sim \Phi_{h}(t)$.
+    Furthermore, $first(\gamma_j)$ is $\Xr$ and $first(\delta_j)$ is one of $\Xl$ and $\Xm$,
+    therefore $\Phi_{h}(s) \subset \Phi_{h}(t)$.
+    Consequently $\Phi_{h}(s) < \Phi_{h}(t)$.
+
+    \medskip
+
+    Second case: $\infty > \|s_p\| > \|t_p\| = -1$.
+    In this case both $s_p$ and $t_p$ exist,
+    $s_p$ is not $\varnothing$ and $t_p$ is $\varnothing$,
+    and fork happens immediately after $\Phi_{h+1}(s_{p-1})$, $\Phi_{h+1}(t_{p-1})$:
+    \begin{alignat*}{8}
+        \Phi_{h}(s) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(s_1) &&\dots &&\Phi_{h+1}(s_{p-1})
+            &&\;\big|\; \Xl_{h+1} \; x \; \Xr_{h+1} \; &&\Phi_{h+1}(s_{p+1}) &&\dots &&\Phi_{h+1}(s_n) \Xr_{h} \\[-0.5em]
+        \Phi_{h}(t) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(t_1) &&\dots &&\Phi_{h+1}(t_{p-1})
+            &&\;\big|\; \Xm_{h+1} \;\;\;\;\;\;         &&\Phi_{h+1}(t_{p+1}) &&\dots &&\Phi_{h+1}(t_m) \Xr_{h}
+    \end{alignat*}
+    %
+    If $j$-th frame is the last, we have $\rho_j = \rho'_j = h$ like in the first case.
+    Otherwise we have $\rho_j = \rho'_j = h + 1$,
+    because $minht(\gamma_j)$, $minht(\delta_j) \geq h + 1$
+    and $lastht (\beta_j) = h + 1$
+    (because if $p = 1$ then $\beta_j = \Xl_{h+1}$, otherwise
+    $s_{p-1}$ exists and the last parenthesis in $\beta_j$
+    is last parenthesis of $\Phi_{h+1}(s_{p-1})$, which is either $\Xr_{h+1}$ or $\Xm_{h+1}$).
+    For subsequent frames $i$ such that $j < i < k$ we have $\rho_i = \rho'_i = h + 1$
+    (because $minht(\gamma_j)$, $minht(\delta_j) \geq h + 1$),
+    and for the last pair of frames we have $\rho_k = \rho'_k = h$.
+    So in this case again $\Phi_{h}(s) \sim \Phi_{h}(t)$.
+    Furthermore, $first (\gamma_j) = \Xl < \Xm = first (\delta_j)$, therefore $\Phi_{h}(s) \subset \Phi_{h}(t)$
+    and $\Phi_{h}(s) < \Phi_{h}(t)$.
+
+    \medskip
+
+    Third case: $\infty > \|s_p\| > \|t_p\| \geq 0$.
+    In this case both $s_p$ and $t_p$ exist and none of them is $\varnothing$,
+    and fork happens somewhere after the opening parenthesis $\Xl$
+    and before the closing parenthesis $\Xr$ in $\Phi_{h}(s_p)$, $\Phi_{h}(t_p)$:
+    \begin{alignat*}{9}
+        \Phi_{h}(s) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(s_1) &&\dots &&\Phi_{h+1}(s_{p-1}) &&\; \Xl_{h+2} \; x
+            &&\;\big|\; y \; \Xr_{h+1} \; &&\Phi_{h+1}(s_{p+1}) &&\dots &&\Phi_{h+1}(s_n) \Xr_{h} \\[-0.5em]
+        \Phi_{h}(t) &\;=\; \Xl_{h+1} &&\Phi_{h+1}(t_1) &&\dots &&\Phi_{h+1}(t_{p-1}) &&\; \Xl_{h+2} \; x
+            &&\;\big|\; z \; \Xr_{h+1} \; &&\Phi_{h+1}(t_{p+1}) &&\dots &&\Phi_{h+1}(t_m) \Xr_{h}
+    \end{alignat*}
+    %
+    Let $\delta_l$ be the frame containing the closing parenthesis $\Xr_{h+1}$ of $\Phi_{h+1}(t_p)$.
+    Because $\|s_p\| > \|t_p\|$,
+    the closing parenthesis $\Xr_{h+1}$ of $\Phi_{h+1}(s_p)$ is not contained in $\gamma_{l}$,
+    and $l$-th frame is not the last one.
+    Therefore $minht (\gamma_l) \geq h+2$ and $minht (\delta_l) = h+1$.
+    Furthermore, $minht(x)$, $minht(y)$, $minht(z) \geq h + 2$,
+    therefore $lastht(\beta_j) = lastht(\Xl_{h+2} \; x) \geq h+2$ and we have
+    $\rho_i, \rho'_i \geq h+2$ for all frames $j \leq i < l$
+    (note that it might be $\rho_i < \rho'_i$),
+    and for the $l$-th frame $\rho_l \geq h+2 > h+1 = \rho'_l$.
+    For subsequent frames $\gamma_i$, $\delta_i$ such that $l < i < k$ we have
+    $minht(\gamma_i)$, $minht(\delta_i) \geq h + 1$,
+    therefore $\rho_i \geq h+1 = \rho'_i$.
+    For the last pair of frames $\rho_k = \rho'_k = h$.
+    Therefore in this case $\Phi_{h}(s) \sqsubset \Phi_{h}(t)$,
+    which implies $\Phi_{h}(s) < \Phi_{h}(t)$.
+    $\square$
+    \end{XLem}
+
+
+    \begin{XLem}\label{lemma_pe_less}
+    Let $s, t \in PT(r, w)$.
+    If $s <_p t$, then $\Phi_{h}(s) < \Phi_{h}(t) \; \forall h$.
+    \\
+    Proof.
+    By induction on the length of $p$.
+
+    \medskip
+
+    Induction basis for $|p| = 1$ is given by lemma \ref{lemma_pe_less_1}.
+
+    \medskip
+
+    Induction step.
+    Let $|p| \geq 2$, then $s$ and $t$ are compound PT
+    $s = T^{d} (s_1, \dots, s_n)$ and
+    $t = T^{d} (t_1, \dots, t_m)$, where
+    $d \neq 0$ (because $\Lambda$ is a prefix of decision position $p$).
+    %
+    Furthermore, let $p = p'.p''$, where $p' \in \YN$.
+    Subtrees $s' = s_{p'}$ and $t' = t_{p'}$ exist, because $p'$ a proper prefix of decision position $p$,
+    and they also must be compount PT
+    $s' = T^{d'} (s'_1, \dots, s'_{n'})$ and
+    $t' = T^{d'} (t'_1, \dots, t'_{m'})$,
+    because $|p''| > 0$, and it must be
+    $d' \neq 0$ (because $p'$ is a prefix of decision position $p$).
+    %
+    For subtrees $s_i$ and $t_i$ where $i < p'$ we have
+    $\|s_i\|_q = \|t_i\|_q \;\forall q$ (implied by $s <_p t$),
+    therefore by lemma \ref{incomparability_equivdef}
+    $s_i \sim t_i$, and by lemma \ref{lemma_pe_equiv} we have $\Phi_{h+1}(s_i) = \Phi_{h+1}(t_i)$.
+    %
+    Therefore $\Phi_{h}(s)$, $\Phi_{h}(t)$ can be represented as follows:
+    \begin{alignat*}{9}
+        \Phi_{h}(s)
+            \;&=
+                \;&& \Xl_{h+1} \Phi_{h+1}(s_1) \dots \Phi_{h+1}(s_{p'-1})
+                \;&& \overbrace {\Xl_{h+2} \Phi_{h+2}(s'_1) \dots \Phi_{h+2}(s'_{n'}) \Xr_{h+1}}^{\Phi_{h+1}(s')}
+                \;&& \Phi_{h+1}(s_{p'+1}) \Phi_{h+1}(s_n) \Xr_{h}
+                \\
+        \Phi_{h}(t)
+            \;&=
+                \;&& \Xl_{h+1} \Phi_{h+1}(t_1) \dots \Phi_{h+1}(t_{p'-1})
+                \;&& \underbrace {\Xl_{h+2} \Phi_{h+2}(t'_1) \dots \Phi_{h+2}(t'_{m'}) \Xr_{h+1}}_{\Phi_{h+1}(t')}
+                \;&& \Phi_{h+1}(t_{p'+1}) \Phi_{h+1}(t_m) \Xr_{h}
+    \end{alignat*}
+
+    We have $\|s\|_q = \|t\|_q \;\forall q < p'$ (implied by $s <_p t$),
+    therefore by lemma \ref{lemma_subtrees} $\exists r', w' : s', t' \in PT(r', w')$.
+    Moreover, $s' <_{p''} t'$ and $|p''| < |p|$, therefore by induction hypothesis $\Phi_{p+1}(s') < \Phi_{p+1}(t')$.
+    %
+    On the other hand, if $j$ is the fork and $f \leq j \leq k$ then
+    $\Phi_{h}(s)$, $\Phi_{h}(t)$ can be represented as:
+    \begin{alignat*}{9}
+        \Phi_{h}(s)
+            \;&=
+                \;&& \beta_0 a_1 \dots a_f \beta_f^1
+                \;&& \overbrace {\beta_f^2  a_{f+1} \dots a_j \beta_j \;\big|\; \gamma_j a_{j+1} \dots a_k \gamma_k^1}^{\Phi_{h+1}(s')}
+                \;&& \gamma_k^2 a_{k+1} \dots a_l \gamma_l
+                \\[-0.5em]
+        \Phi_{h}(t)
+            \;&=
+                \;&& \beta_0 a_1 \dots a_f \beta_f^1
+                \;&& \underbrace {\beta_f^2  a_{f+1} \dots a_j \beta_j \;\big|\; \delta_j a_{j+1} \dots a_k \delta_k^1}_{\Phi_{h+1}(t')}
+                \;&& \delta_k^2 a_{k+1} \dots a_l \delta_l
+    \end{alignat*}
+
+%    \begin{alignat*}{9}
+%        \Phi_{h}(s)
+%            \;&=
+%                \;&&\overbrace  {\Xl_{h+1} \Phi_{h+1}(s_1) \dots \Phi_{h+1}(s_{p'-1})}
+%                    ^{\beta_0 a_1 \dots a_i \beta_i^1}
+%                \;&&\overbrace  {\Xl_{h+2} \Phi_{h+2}(s'_1) \dots \Phi_{h+2}(s'_{n'}) \Xr_{h+1}}
+%                    ^{\beta_i^2  a_{i+1} \dots a_j \beta_j \;\big|\; \gamma_j a_{j+1} \dots a_k \gamma_k^1}
+%                \;&&\overbrace  {\Phi_{h+1}(s_{p'+1}) \Phi_{h+1}(s_n) \Xr_{h}}
+%                    ^{\gamma_k^2 a_{k+1} \dots a_l \gamma_l}
+%                \\
+%        \Phi_{h}(t)
+%            \;&=
+%                \;&&\underbrace {\Xl_{h+1} \Phi_{h+1}(t_1) \dots \Phi_{h+1}(t_{p'-1})}
+%                    _{\beta_0 a_1 \dots a_i \beta_i^1}
+%                \;&&\underbrace {\Xl_{h+2} \Phi_{h+2}(t'_1) \dots \Phi_{h+2}(t'_{m'}) \Xr_{h+1}}
+%                    _{\beta_i^2  a_{i+1} \dots a_j \beta_j \;\big|\; \delta_j a_{j+1} \dots a_k \delta_k^1}
+%                \;&&\underbrace {\Phi_{h+1}(t_{p'+1}) \Phi_{h+1}(t_m) \Xr_{h}}
+%                    _{\delta_k^2 a_{k+1} \dots a_l \delta_l}
+%    \end{alignat*}
+
+    Let $traces (\Phi_{h}(s), \Phi_{h}(t)) = \big( (\rho_0, \dots, \rho_l), (\rho'_0, \dots, \rho'_l) \big)$
+    and $traces (\Phi_{h+1}(s'), \Phi_{h+1}(t')) = \big( (\sigma_h, \dots, \sigma_k), (\sigma'_h, \dots, \sigma'_k) \big)$.
+    %
+    We show that for frames $i$ such that $j \leq i < k$ we have
+    $\rho_i = \sigma_i \wedge \rho'_i = \sigma'_i$,
+    and for subsequent frames $k \leq i \leq l$ we have $\rho_i = \rho'_i$.
+
+    \medskip
+
+    First case: $i = j \leq k \leq l$ (the fork frame).
+    Because $\Phi_{h+1}(s')$ and $\Phi_{h+1}(t')$ have nonempty common prefix $\Xl_{h+2}$,
+    we have $lasht (\Phi_{h}(s) \sqcap \Phi_{h}(t)) = lastht (\Phi_{h+1}(s') \sqcap \Phi_{h+1}(t')) \geq h + 2$.
+    %
+    If $j < k$ then $minht (\gamma_j)$, $minht (\delta_j)$ are not affected by appending
+    $\gamma^2_k$, $\delta^2_k$ and therefore $\rho_j = \sigma_j \wedge \rho'_j = \sigma'_j$.
+    %
+    Else if $j = k < l$ then we have $minht (\gamma^1_k) = minht (\delta^1_k) = h + 1$ and
+    $minht (\gamma^2_k) = minht (\delta^2_k) \geq h + 1$, and
+    therefore $\rho_j = \rho'_j = h + 1$.
+    %
+    Finally, if $j = l$ then $minht (\gamma_j) = minht (\delta_j) = h$ and $\rho_j = \rho'_j = h$.
+
+    \medskip
+
+    Second case: $j < i < k$.
+    In this case the calculation of $\rho_i$, $\rho'_i$ depends on $\rho_j$, $\rho'_j$
+    (for which we have shown $\rho_j = \sigma_j \wedge \rho'_j = \sigma'_j$) and
+    is not affected by the appended $\gamma^2_k$, $\delta^2_k$, therefore
+    $\rho_i = \sigma_i \wedge \rho'_i = \sigma'_i$.
+
+    \medskip
+
+    Third case: $j < i = k < l$. We have
+    $minht (\gamma^1_k) = minht (\delta^1_k) = h + 1$ and
+    $minht (\gamma^2_k) = minht (\delta^2_k) \geq h + 1$,
+    and none of the preceding frames after the fork contain parentheses with height less than $h + 1$,
+    therefore $\rho_k = \rho'_k = h + 1$.
+
+    \medskip
+
+    Fourth case: $k < i < l$.
+    We have $\rho_i = \rho'_i = h + 1$,
+    because $\rho_k = \rho'_k = h + 1$ and $minht(\gamma_i)$, $minht(\delta_i) \geq h + 1$.
+
+    \medskip
+
+    Fifth case: $i = l$.
+    We have $\rho_l = \rho'_l = h$.
+
+    \medskip
+
+    So, we have shown that $\rho_i = \sigma_i \wedge \rho'_i = \sigma'_i$ for $j \leq i < k$
+    and $\rho_i = \rho'_i$ for $k \leq i \leq l$.
+    It trivially follows that $\Phi_{h+1}(s') \sqsubset \Phi_{h+1}(t')$ implies $\Phi_{h}(s) \sqsubset \Phi_{h}(t)$, and
+    $\Phi_{h+1}(s') \sim \Phi_{h+1}(t')$ implies $\Phi_{h}(s) \sim \Phi_{h}(t)$.
+    Because none of $\Phi_{h+1}(s')$, $\Phi_{h+1}(t')$ is a proper prefix of another,
+    $\Phi_{h+1}(s') \subset \Phi_{h+1}(t')$ implies $\Phi_{h}(s) \subset \Phi_{h}(t)$.
+    Therefore $\Phi_{h+1}(s') < \Phi_{h+1}(t')$ implies $\Phi_{h}(s) < \Phi_{h}(t)$.
+    $\square$
+    \end{XLem}
+
+
+    \begin{XThe}
+    Let $s, t \in PT(r, w)$, then
+    $s <_p t \Leftrightarrow \Phi_{h}(s) < \Phi_{h}(t) \; \forall h$.
+    \\
+    Proof.
+
+    \medskip
+
+    $\Rightarrow$. Given by lemma \ref{lemma_pe_less}.
+
+    \medskip
+
+    $\Leftarrow$.
+    We have $\Phi_{h}(s) < \Phi_{h}(t) \; \forall h$.
+    Suppose that $\nexists p: s <_p t$.
+    By lemma \ref{lemma_pe_order_antisymm} either $s = t$
+    (in which case $\Phi_{h}(s) = \Phi_{h}(t)$, contradiction)
+    or $t <_q s$ for some $q$
+    (in which case $\Phi_{h}(t) < \Phi_{h}(s)$ by lemma \ref{lemma_pe_less}, contradiction).
+    Therefore $\exists p: s <_p t$.
+    $\square$
+    \end{XThe}
+
+
+\section{Tagged NFA}
+
+    \begin{Xdef}
+    \emph{Tagged Nondeterministic Finite Automaton (TNFA)}
+    is a structure $(\Sigma, Q, F, q_0, \Delta)$, where:
+    \begin{itemize}
+        \item[] $\Sigma$ is a finite set of symbols (\emph{alphabet})
+%        \item[] $T$ is a finite set of \emph{tags}
+%        \item[] $P$ is a finite set of \emph{priorities}
+        \item[] $Q$ is a finite set of \emph{states}
+        \item[] $F \subseteq Q$ is the set of \emph{final} states
+        \item[] $q_0 \in Q$ is the \emph{initial} state
+
+        \item[] $\Delta = \Delta^\Sigma \sqcup \Delta^\epsilon$ is the \emph{transition} relation, where:
+        \begin{itemize}
+            \item[] $\Delta^\Sigma \subseteq Q \times \Sigma \times \{\epsilon\} \times Q$
+            \item[] $\Delta^\epsilon \subseteq Q \times \{\epsilon\} \times \big( (\YZ \times \YZ) \cup \{\epsilon\} \big) \times Q$
+        \end{itemize}
+%        and all $\epsilon$-transitions from the same state have different priorities:
+%        $\forall (x, r, \epsilon, y), (\widetilde{x}, \widetilde{r}, \epsilon, \widetilde{y}) \in \Delta^\epsilon:
+%        x = \widetilde{x} \wedge y = \widetilde{y} \Rightarrow r \!\neq\! \widetilde{r}$.
+    \end{itemize}
+    \end{Xdef}
+
+TNFA construction is given by the $F$ function defined on figure \ref{fig_tnfa}.
+
+    \begin{align*}
+    otag \big( (i, j, r) \big) &=
+        \begin{cases}
+            \epsilon         &\text{if } i = 0 \\[-0.5em]
+            (2i - 1, 2j - 1) &\text{if } i \neq 0
+        \end{cases}
+    \\
+    ctag \big( (i, j, r) \big) &=
+        \begin{cases}
+            \epsilon &\text{if } i = 0 \\[-0.5em]
+            (2i, 2j) \hphantom{{} - 1 {} - 1} &\text{if } i \neq 0
+        \end{cases}
+    \\
+    ntag \big( (i, j, r) \big) &=
+        \begin{cases}
+            \epsilon         &\text{if } i = 0 \\[-0.5em]
+            (1 - 2i, 1 - 2j) &\text{if } i \neq 0
+        \end{cases}
+    \end{align*}
+
+%    \begin{align*}
+%    F \big( (0, 0, r_1 \mid r_2) \big) &= (\Sigma, Q_1 \cup Q_2 \cup \{ x, y \}, x, \{y\}, \Delta) \\
+%        \text{where }
+%            & F(r_1) = (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1), \;
+%              F(r_2) = (\Sigma, Q_2, x_2, \{y_2\}, \Delta_2) \\
+%            & \Delta = \Delta_1 \cup \Delta_2 \cup \big\{
+%                (x, \epsilon, \epsilon, x_1), (y_1, \epsilon, ntag(r_2), y),
+%                (x, \epsilon, ntag(r_1), x_2), (y_2, \epsilon, \epsilon, y)
+%            \big\}
+%    \\
+%    F \big( (0, 0, r_1 \cdot r_2) \big) &= (\Sigma, Q_1 \cup Q_2 \setminus \{ x_2 \}, x_1, \{y_2\}, \Delta) \\
+%        \text{where }
+%            & F(r_1) = (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1), \;
+%              F(r_2) = (\Sigma, Q_2, x_2, \{y_2\}, \Delta_2) \\
+%            & \Delta = \Delta_1 \cup
+%                \big\{ (y_1, \alpha, \beta, z) \mid (x_2, \alpha, \beta, z) \in \Delta_2 \big\}
+%    \\
+%    F \big( (0, 0, r^{n, m}) \big) \mid n > 1 &= F \big( (0, 0, r \cdot r^{n - 1, m - 1})
+%    \\
+%    F \big( (0, 0, r^{0, m}) \big) &= (\Sigma, Q_1 \cup \{ x, y \}, x, \{y\}, \Delta) \\
+%        \text{where }
+%            & F \big( (0, 0, r^{1, m}) \big) = (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1) \\
+%            & \Delta = \Delta_1 \cup
+%                \big\{ (x, \epsilon, \epsilon, x_1), (y_1, \epsilon, ntag(r_2), y), (x, \epsilon, ntag(r), y) \big\}
+%    \\
+%    F \big( (0, 0, r^{1, \infty}) \big) &= (\Sigma, Q_1 \cup \{ y \}, x_1, \{y\}, \Delta) \\
+%        \text{where }
+%            & F(r) = (\Sigma, Q_1, x_1, \{y_1\}, \Delta_1) \\
+%            & \Delta = \Delta_1 \cup
+%                \big\{ (y_1, \epsilon, \epsilon, x_1), (y_1, \epsilon, \epsilon, y) \big\}
+%    \\
+%    F \big( (0, 0, r^{1, m}) \big) \mid m \neq \infty &= (\Sigma, Q_1 \cup \hdots \cup Q_m, x_1, \{y_m\}, \Delta) \\
+%        \text{where }
+%            & f_i = F(r) = (\Sigma, Q_i, \{y_i\}, x_i, \Delta_i) \; \forall i = \overline{1, m} \\
+%            & \Delta = \Delta_1 \cup \hdots \cup \Delta_m
+%                \cup \{ (y_i, \epsilon, \epsilon, x_{i+1}), (y_i, \epsilon, \epsilon, y_m) \}_{i=1}^{m-1}
+%    \\
+%    \end{align*}
+
+\begin{figure}\label{fig_tnfa}
+\includegraphics[width=\linewidth]{img/tnfa.pdf}
+\caption{
+TNFA construction.
+}
+\end{figure}
+
+
+
+
+\begin{figure*}
+\begin{multicols}{2}
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{match (\XN, \alpha_1 \dots \alpha_n)} \smallskip$} {
+        $(\Sigma, T, P, Q, F, q_0, T, \Delta) = \XN$ \;
+        $X = closure(\{ (\bot, q_0, \epsilon, t_0) \}, F, \Delta)$ \;
+        $(X, B, D) = step(0, X, B, D)$ \;
+
+        \BlankLine
+        \For {$i = \overline{1,n}$} {
+            $X = reach(X, \Delta, \alpha_i)$ \;
+            $X = closure(X, B, D)$ \;
+            $(X, B, D) = step(i, X, B, D)$ \;
+        }
+
+        \BlankLine
+        \lIf {$\exists (\Xund, p, \Xund, t) \in X \mid p \in F$} {
+            \Return $t$
+        } \lElse {
+            \Return $\bot$
+        }
+    }
+    \end{algorithm}
+
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{reach (X, \alpha)} \smallskip$} {
+        \Return $\{ (p, p', \epsilon, t) \mid$ \;
+        $\qquad (\Xund, p, \Xund, t) \in X \wedge
+            (p, \alpha, \epsilon, p') \in \Delta^\Sigma \}$
+    }
+    \end{algorithm}
+
+
+\iffalse
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{closure(k, X, B, D)} \smallskip$} {
+
+        $Y = \emptyset$ \;
+        \For {$x \in X$} {
+            Y = $rclosure (x, Y, B, D)$
+        }
+
+        \Return $Y$ \;
+    }
+    \end{algorithm}
+
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{rclosure(x, Y, B, D)} \smallskip$} {
+        $(q, p, u, t) = x$ \;
+        \If {unmarked $p$} {
+        mark $p$ \;
+
+        \If {$p \in F \vee \exists (p, \alpha, \Xund, \Xund) \in \Delta^\Sigma$} {
+            \If {$\nexists y = (\Xund, p, \Xund, \Xund) \in Y$} {
+                $Y = Y \cup \{ x \}$
+            } \ElseIf { $less (x, y, B, D)$} {
+                $Y = Y \cup \{ x \} \setminus \{ y \}$
+            }
+        }
+
+        \BlankLine
+        \ForEach {$(p, \epsilon, w, p') \in \Delta^\epsilon$} {
+            Y = $rclosure ((q, p', u w, t), Y, B, D)$ \;
+        }
+
+        unmark $p$ \;
+        }
+        \Return $Y$ \;
+    }
+    \end{algorithm}
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{}
+    \Fn {$\underline {less (x, y, B, D)} \smallskip$} {
+        $(\Xund, \Xund, l) = precedence (x, y, B, D)$ \;
+        \Return $l$ \;
+    }
+    \end{algorithm}
+\fi
+
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{step(k, X, B, D)} \smallskip$} {
+        let $\{ x_i \}_{i=1}^{n} = \{(q_i, p_i, u_i, t_i) \}_{i=1}^{n} = X$
+
+        \BlankLine
+        \tcc {update tag values in $X$}
+        \For {$i = \overline {1, n}$} {
+            $b_1 \dots b_m = u_i$ \;
+            \lFor {$j = \overline{1, m}$} {
+                $t_i[b_j] = k$
+            }
+        }
+
+        \BlankLine
+        \tcc {update $B$ and $D$ matrices}
+        \For {$i = \overline {1, n}$} {
+            \For {$j = \overline {1, n}$} {
+                $(h_1, h_2, l) = precedence (x_i, x_j, B, D)$ \;
+                $B' [p_i] [p_j] = h_1, \; D' [p_i] [p_j] = l$ \;
+                $B' [p_j] [p_i] = h_2, \; D' [p_j] [p_i] = -l$ \;
+            }
+        }
+
+        \BlankLine
+        \Return $(X, B', D')$ \;
+    }
+    \end{algorithm}
+
+    \columnbreak
+
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{}
+    \Fn {$\underline {precedence (x_1, x_2, B, D)} \smallskip$} {
+        $(q_1, \Xund, a_1 \dots a_n, \Xund) = x_1$ \;
+        $(q_2, \Xund, b_1 \dots b_m, \Xund) = x_2$ \;
+        $k = 1, \; h_1 = h_2 = \infty, \; l = 0$ \;
+
+        \BlankLine
+        \tcc {if fork frame, find fork}
+        \If { $q_1 = q_2$ } {
+            \While {$k < min (n, m)$ and $a_k = b_k$} {
+              $k = k + 1$
+            }
+        }
+
+        \BlankLine
+        \tcc {longest-precedence}
+        \If { $q_1 = q_2$ } {
+            $h_1 = h_2 = height (a_{k-1})$
+        } \ElseIf {$k > 1$} {
+            $h_1 = B [q_1] [q_2], \; h_2 = B [q_2] [q_1]$
+        }
+        \lFor {$i = \overline{k, n}$} {
+            $h_1 = min (h_1, height (a_i))$
+        }
+        \lFor {$i = \overline{k, m}$} {
+            $h_2 = min (h_2, height (b_i))$
+        }
+        \lIf {$h_1 > h_2$} {\Return $(h_1, h_2, -1)$}
+        \lIf {$h_1 < h_2$} {\Return $(h_1, h_2, 1)$}
+
+        \BlankLine
+        \tcc {leftmost-precedence}
+        \If { $q_1 = q_2$ } {
+            \lIf {$k = n = m$} { $l = 0$ }
+            \lElseIf {$k = n$} { $l = -1$ }
+            \lElseIf {$k = m$} { $l = 1$ }
+            \lElseIf {$a_k mod 2 \equiv 0$} { $l = -1$ }
+            \lElseIf {$b_k mod 2 \equiv 0$} { $l = 1$ }
+            \lElseIf {$a_k > b_k$} { $l = -1$ }
+            \lElseIf {$a_k < b_k$} { $l = 1$ }
+        } \Else {
+            $l = D [q_1] [q_2]$
+        }
+        \Return $(h_1, h_2, l)$
+    }
+    \end{algorithm}
+
+\end{multicols}
+\begin{center}
+\caption{Matching algorithm.}
+\end{center}
+\end{figure*}
+
+
+\begin{figure*}
+\begin{multicols}{2}
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{closure \Xund goldberg \Xund radzik(X, F, \Delta)} \smallskip$} {
+        empty stacks $topsort$, $newpass$ \;
+        $result(q) \equiv \bot$ \;
+        $status(q) \equiv \mathit{OFFSTACK}$ \;
+        \For {$(q, x) \in X$} {
+            $relax(q, x, result, topsort)$ \;
+        }
+        \While {$topsort$ is not empty} {
+            \While {$topsort$ is not empty} {
+                $q = pop(topsort)$ \;
+
+                \If {$status(q) = \mathit{TOPSORT}$} {
+                    $push(newpass, n)$ \;
+                } \ElseIf {$status(q) = \mathit{NEWPASS}$} {
+                    $status(q) = \mathit{TOPSORT}$ \;
+                    $push(topsort, q)$ \;
+                    $scan(q, result, topsort)$ \;
+                }
+            }
+            \While {$newpass$ is not empty} {
+                $q = pop(newpass)$ \;
+                $scan(q, result, topsort)$ \;
+                $status(q) = \mathit{OFFSTACK}$ \;
+            }
+        }
+        \Return $\big\{ (q, x) \mid x = result(q) \; \wedge$ \;
+        $\hspace{6em} \big(q \in F \vee \exists (p, \alpha, \Xund, \Xund) \in \Delta^\Sigma \big) \big\}$ \;
+    }
+    \end{algorithm}
+
+    \columnbreak
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{scan(q, result, topsort)} \smallskip$} {
+        \ForEach {outgoing arc $(q, \epsilon, \chi, p) \in \Delta$} {
+            $x = result(q) \chi$ \;
+            $relax(p, x, result, topsort)$ \;
+        }
+    }
+    \end{algorithm}
+
+
+    \begin{algorithm}[H] \DontPrintSemicolon \SetKwProg{Fn}{}{}{} \SetAlgoInsideSkip{medskip}
+    \Fn {$\underline{relax(q, x, result, topsort, B, D)} \smallskip$} {
+        $(\Xund, \Xund, l) = precedence (x, result(q), B, D)$ \;
+        \If {$l = -1$} {
+            $result(q) = x$ \;
+            \If {$status(q) \neq \mathit{TOPSORT}$} {
+                $push(topsort, q)$ \;
+                $status(q) = \mathit{NEWPASS}$ \;
+            }
+        }
+    }
+    \end{algorithm}
+
+\end{multicols}
+\begin{center}
+\caption{GOR1.}
+\end{center}
+\end{figure*}
+
+
+\clearpage
+\pagebreak
+
+\section{GOR1 correcness proof}
+
+For a given RT $r$,
+we say that PE $\alpha$ is \emph{minimal} if $\alpha = PE(t)$ for some minimal $t \in PT(r)$,
+and we say that path $\pi$ in TNFA $F(r)$ is \emph{minimal} if $\pi$ induces a minimal PE.
+
+GOR1 correctness proof consists of two parts.
+First, we get rid of $\epsilon$-loops by showing that,
+on one hand, minmal paths do not contain $\epsilon$-loops,
+and on the other hand, GOR1 cancels all paths which contain $\epsilon$-loops.
+Second, for paths without $\epsilon$-loops we show right distributivity of path comparison over path concatenation.
+The proofs make use of the TNFA nested structure
+and the fact that each sub-TNFA is has a unique entry and exit states.
+TNFA construct for all possible types of RT are shown on the fugure below.
+
+
+
+\begin{figure}\label{fig_gor1}
+\includegraphics[width=\linewidth]{img/gor1.pdf}
+\caption{
+Sub-TNFA for individual sub-RT with submatch groups: \\
+(a) -- union, (b) -- product, (c), (d) -- bounded repetition, (e), (f) -- unbounded repetition.
+}
+\end{figure}
+
+    \begin{XLem}\label{gor1_path_containment}
+    Let $r$ be a RE, $\pi = q_1 \overset {\alpha} {\rightsquigarrow} q_2$ a tagged path in TNFA $F(r)$,
+    where $\alpha \neq \epsilon$,
+    and $h = minht (\alpha)$ the minimal tag height on path $\pi$.
+    The following statements are true:
+    \begin{enumerate}
+        \item There is a position $p$ of length $|p| = h$
+            such that $\pi$ fully lies inside of subautomaton $F(r|_p)$.
+
+        \item There no position $p$ of length $|p| > h$
+            such that $\pi$ fully lies inside of subautomaton $F(r|_p)$.
+    \end{enumerate}
+    Proof.
+    Obvious from TNFA construction.
+    $\square$
+    \end{XLem}
+
+
+
+
+    \begin{XLem}\label{gor1_minpaths}
+    Minimal paths do not contain tagged $\epsilon$-loops.
+    \\
+    Proof.
+
+    Suppose, on the contrary, that $\pi$ is a minimal path in TNFA $F(r)$, and that $\pi$ contains at least one $\epsilon$-loop.
+    Consider the \emph{last} $\epsilon$-loop in $\pi$:
+    it can only come from sub-TNFA of the form $F\big( (i, \Xund, (i_1, \Xund, r_1)^{n,\infty}) \big)$ where $n \geq 0$,
+    as this is the only looping TNFA construct.
+    Let $w_n$ be the final state of sub-TNFA $F\big( (i_1, \Xund, r_1) \big)$
+    as shown on figure \ref{fig_gor1} (e) -- (f).
+    Then $\pi$ can be represented as
+    $\pi = \pi_1 \pi_2 \pi_3$, where $\pi_2$ is the $\epsilon$-loop:
+    $\pi_1 = q_0 \overset {u | \alpha} {\rightsquigarrow} w_n$ and
+    $\pi_2 = w_n \overset {\epsilon | \beta} {\rightsquigarrow} w_n$ and
+    $\pi_3 = w_n \overset {v | \gamma} {\rightsquigarrow} q_f$.
+    Consider path $\pi' = \pi_1 \pi_3$ that is obtained from $\pi$ by removing $\pi_2$.
+    It consumes the same input string $uv$ as $\pi$,
+    therefore PE transduced by $\pi$ and $\pi'$ are comparable: $\alpha \beta \gamma, \alpha \gamma \in PE(r, uv)$.
+    Let $j$ be the total number of repetitions through $F\big( (i_1, \Xund, r_1) \big)$,
+    and let $i$ be the index of the $\epsilon$-loop repetition.
+
+    First case: $i = j$.
+    In this case fork of $\alpha \beta \gamma$ and $\alpha \gamma$ happens immediately after $(i-1)$-th repetition:
+    %
+    \begin{alignat*}{10}
+        \alpha \beta \gamma &= x_0 \Xl_{h-1} \;&&\; \Xl_h x_1 \Xr_h \hdots \Xl_h x_{i-1} \Xr_h \;&&\big|\; \Xl_h x_{i} \Xr_h \;&&\; \Xr_{h-1} x_{j+1} \\[-0.5em]
+        \alpha \gamma       &= x_0 \Xl_{h-1} \;&&\; \Xl_h x_1 \Xr_h \hdots \Xl_h x_{i-1} \Xr_h \;&&\big|\;                   \;&&\; \Xr_{h-1} x_{j+1}
+    \end{alignat*}
+    %
+    It must be $\alpha \beta \gamma \sim \alpha \gamma$,
+    because $minht (\beta) = h > h - 1 = minht (first (\gamma))$,
+    so at the fork frame $k$ we have $\rho_k = \rho'_k \leq h - 1$.
+    %
+    Furthermore, it must be $\alpha \gamma \subset \alpha \beta \gamma$,
+    because $first (\gamma) = \Xr < \Xl = first (\beta)$.
+
+    Second case: $i < j$.
+    In this case $(i + 1)$-th repetition cannot be an $\epsilon$-loop
+    (because we assumed that $i$-th repetition is the \emph{last} $\epsilon$-loop),
+    therefore
+    fork of $\alpha \beta \gamma$ and $\alpha \gamma$ happens
+    inside of $i$-th repetition of $\alpha \beta \gamma$
+    and $(i + 1)$-th repetition of $\alpha \gamma$:
+    %
+    \begin{alignat*}{10}
+        \alpha \beta \gamma &= x_0 \Xl_{h-1} \;&&\; \Xl_h x_1 \Xr_h \hdots \Xl_h x_{i-1} \Xr_h \Xl_h y_1 \;&&\big|\; y_2 \Xr_h \Xl_h x_{i+1} \Xr_h && \Xl_h x_{i+2} \Xr_h \hdots \Xl_h x_j \Xr_h \;&&\; \Xr_{h-1} x_{j+1} \\[-0.5em]
+        \alpha \gamma       &= x_0 \Xl_{h-1} \;&&\; \Xl_h x_1 \Xr_h \hdots \Xl_h x_{i-1} \Xr_h \Xl_h y_1 \;&&\big|\; y_3 \Xr_h                     && \Xl_h x_{i+2} \Xr_h \hdots \Xl_h x_j \Xr_h \;&&\; \Xr_{h-1} x_{j+1}
+    \end{alignat*}
+    %
+    In this case
+    fork frame of $\alpha \beta \gamma$ contains $y_2 \Xr_h \Xl_h$ fragment, because $y_2$ is part of the $\epsilon$-loop.
+    But the fork frame of $\alpha \gamma$ ends inside of $y_3$, because $(i+1)$-th repetiton is not an $\epsilon$-loop and must contain alphabet symbols.
+    Therefore at the fork frame $k$ we have $\rho_k = h$ and $\rho'_k > h$.
+    All subsequent frames $l > k$ are identical,
+    so either $\rho_l = \rho'_l = h'$ (if $l$-th frame contains parentheses of height $h' \leq h$),
+    or else $\rho_l = \rho_k$ and $\rho'_l = \rho'_k$.
+    Consequently $\alpha \gamma \sqsubset \alpha \beta \gamma$.
+
+    In both cases $\alpha \gamma < \alpha \beta \gamma$,
+    which contradicts the fact that $\pi$ is a minimal path.
+    $\square$
+    \end{XLem}
+
+
+
+    \begin{XLem}\label{gor1_loops}
+    GOR1 discards paths with tagged $\epsilon$-loops.
+    \\
+    Proof.
+
+    GOR1 finds non-looping paths before their looping counterparts,
+    as it uses depth-first search to explore new paths and prunes ambiguous paths
+    immediately after exploring transitions to the join state.
+    So for each TNFA state, the first path to be found is a path without $\epsilon$-loops.
+    We will show that once GOR1 has found a path without $\epsilon$-loops,
+    it will never prefer a path with an $\epsilon$-loop
+    (though of course it might prefer some other path without $\epsilon$-loops).
+
+    The only TNFA construct that has a loop is unbounded repetition
+    $F\big( (i, \Xund, (i_1, \Xund, r_1)^{n,\infty}) \big)$ where $n \geq 0$,
+    shown on figure \ref{fig_gor1} (e) -- (f).
+    Consider arbitrary path $\pi$ that contains
+    $\epsilon$-loop through sub-TNFA $F\big( (i_1, \Xund, r_1) \big)$.
+    %
+    Let $q_1$ be the first state on $\pi$ that belongs to the $\epsilon$-loop.
+    %
+    Path $\pi$ can be represented as $\pi = \pi_1 \pi_2 \pi_3$, where
+    $\pi_1 = q_0 \overset {u | \alpha} {\rightsquigarrow} q_1$ and
+    $\pi_2 = q_1 \overset {\epsilon | \beta} {\rightsquigarrow} q_1$ and
+    $\pi_3 = q_1 \overset {v | \gamma} {\rightsquigarrow} q_f$.
+    %
+    By the time GOR1 finds path $\pi_1 \pi_2$,
+    it must have already found some other path $\pi'_1 = q_0 \overset {u | \alpha'} {\rightsquigarrow} q_1$ without $\epsilon$-loops.
+    There are two possible cases: either $\alpha' = \alpha$, or $\alpha' < \alpha$.
+    We will show that in both cases $\alpha' < \alpha \gamma$
+    and consequently, GOR1 prefers the path without the $\epsilon$-loop.
+    Let $k$ be the index of the last frame
+    and $\big( (\rho_1, \hdots, \rho_k), (\rho'_1, \hdots, \rho'_k) \big) = traces (\alpha', \alpha \gamma)$.
+
+    First case: $\alpha' = \alpha$.
+    Because $\alpha$ is a proper prefix of $\alpha \gamma$,
+    fork happens at the last frame and we have
+    $\rho_k = lastht(\alpha)$ and
+    $\rho'_k = min (lastht(\alpha), minht(\gamma))$.
+    If $lastht(\alpha) > minht(\gamma)$, then $\rho_k > \rho'_k$ and $\alpha \sqsubset \alpha \gamma$.
+    Otherwise $\rho_k = \rho'_k$ and $\alpha \sim \alpha \gamma$,
+    and we have $first(\alpha \backslash \alpha \gamma) = \bot$ and $first(\alpha \gamma \backslash \alpha) \neq \bot$,
+    therefore $\alpha \subset \alpha \gamma$.
+    In both cases $\alpha < \alpha \gamma$.
+
+    Second case: $\alpha' < \alpha$.
+    Let $\big( (\sigma_1, \hdots, \sigma_k), (\sigma'_1, \hdots, \sigma'_k) \big) = traces (\alpha', \alpha)$.
+    We have $\rho_k = \sigma_k$ and $\rho'_k = min (\sigma'_k, minht(\gamma)) \leq \sigma_k$.
+    If $minht(\gamma) < \sigma'_k$ then $\rho_k > \rho'_k$ and $\alpha' \sqsubset \alpha \gamma$.
+    Otherwise $\rho'_k = \sigma'_k$.
+    If $\alpha' \sqsubset \alpha$ then $\alpha' \sqsubset \alpha \gamma$.
+    Otherwise $\alpha' \sim \alpha$ and $\alpha' \subset \alpha$.
+    None of $\alpha$ and $\alpha'$ is a proper prefix of the other,
+    because otherwise the longer path has an $\epsilon$-loop through $q_1$, which contradicts our assumption about $\pi_1$ and $\pi'_1$.
+    Therefore $first (\alpha' \backslash \alpha) = first (\alpha' \backslash \alpha \gamma)$
+    and $first (\alpha \backslash \alpha') = first (\alpha \gamma \backslash \alpha')$.
+    Consequently $\alpha' \subset \alpha \implies \alpha' \subset \alpha \gamma$.
+    Thus $\alpha' < \alpha \gamma$.
+    $\square$
+    \end{XLem}
+
+
+
+
+
+    \begin{XLem} \emph{(Right distributivity of path comparison over path concatenation for $\epsilon$-loop free paths.)}
+    Let
+    $\pi_\alpha = q_0 \overset {u | \alpha} {\rightsquigarrow} q_1$ and
+    $\pi_\beta  = q_0 \overset {u | \beta}  {\rightsquigarrow} q_1$
+    be ambiguous paths in TNFA $F(r)$
+    and $\pi_\gamma = q_1 \overset {\epsilon | \gamma} {\rightsquigarrow} q_2$
+    their common $\epsilon$-suffix,
+    such that paths $\pi_\alpha$, $\pi_\beta$
+    and the extended paths $\pi_\alpha \pi_\gamma$, $\pi_\beta \pi_\gamma$
+    are all free from $\epsilon$-loops.
+    Then $\alpha < \beta \implies \alpha \gamma < \beta \gamma$.
+    \\
+    Proof.
+
+    Let $k = |u|$ be the number of frames in $\alpha$ and $\beta$.
+    Let
+    $\big( (\rho_1, \hdots, \rho_k),$ $(\rho'_1, \hdots, \rho'_k) \big) = traces (\alpha, \beta)$ and
+    $\big( (\sigma_1, \hdots, \sigma_k),$ $(\sigma'_1, \hdots, \sigma'_k) \big) = traces (\alpha \gamma, \beta \gamma)$.
+    Obviously for frames $i < k$ we have $\rho_i = \sigma_i$ and $\rho'_i = \sigma'_i$,
+    and for the last frame $k$ we have
+    $\sigma_k = min (\rho_k, minht (\gamma))$ and
+    $\sigma'_k = min (\rho'_k, minht (\gamma))$.
+    Consider two possible cases.
+
+    First case: $\alpha \sim \beta \wedge \alpha \subset \beta$.
+    %
+    We show that $\alpha \gamma \sim \beta \gamma \wedge \alpha \gamma \subset \beta \gamma$.
+    %
+    We have $\rho_i = \rho'_i \; \forall i$, therefore
+    $\sigma_i = \sigma'_i \; \forall i$ and consequently $\alpha \gamma \sim \beta \gamma$.
+    Let
+    $x = first (\alpha \backslash \beta)$,
+    $y = first (\beta \backslash \alpha)$,
+    $x' = first (\alpha \backslash \beta \gamma)$ and
+    $y' = first (\beta \backslash \alpha \gamma)$.
+    None of $\pi_\alpha$ and $\pi_\beta$ is a proper prefix of another,
+    otherwise the longer path must contain $\epsilon$-loop through $q_1$
+    (because $\alpha$ and $\beta$ have the same number of frames).
+    Consequently $x = x'$ and $y = y'$, and we have
+    $\alpha \subset \beta$
+    $\implies$
+    $x < y$
+    $\implies$
+    $x' < y'$
+    $\implies$
+    $\alpha \gamma \subset \beta \gamma$.
+
+    Second case: $\alpha \sqsubset \beta$.
+    We show that $\alpha \gamma \sqsubset \beta \gamma$.
+    %
+    If $\rho_k = \rho'_k$ then $\sigma_k = \sigma'_k$
+    and obviously $\alpha \gamma \sqsubset \beta \gamma$.
+    Else it must be $\rho_k > \rho'_k$.
+    In this case, if $minht (\gamma) > \rho'_k$, then $\sigma_k > \sigma'_k$ and again $\alpha \gamma \sqsubset \beta \gamma$.
+    Else $minht (\gamma) \leq \rho'_k$ and $\sigma_k = \sigma'_k$.
+    In this case, if $k > 1$ and $\rho_{k-1} > \rho'_{k-1}$ then again $\alpha \gamma \sqsubset \beta \gamma$.
+    %
+    In other words, the only possible case when $\gamma$ can change comparison result is
+    when at the last frame we have $\rho_k > \rho'_k$,
+    the appended suffix $\gamma$ contains parentheses with low height $minht (\gamma) \leq \rho'_k$
+    (so that $\sigma_k = \sigma'_k$),
+    and the previous frame doesn't exist
+    or compares differently from the last frame: $k = 1$ or $\rho_{k-1} \leq \rho'_{k-1}$.
+    We show that in this case the extended path $\pi_\beta \pi_\gamma$ must contain $\epsilon$-loop,
+    which contradicts to the lemma condiitons.
+
+    Consider the fragments of paths $\pi_\alpha$ and $\pi_\beta$ from fork to join,
+    including (if it exists) the $\epsilon$-transition to the fork state:
+    $\pi_\alpha' = q_2 \overset {u | \alpha'} {\rightsquigarrow} q_1$ and
+    $\pi_\beta' = q_2 \overset {u | \beta'} {\rightsquigarrow} q_1$.
+    We know that $minht (\alpha') = \rho_k$.
+%    (because $\rho_k$ is set to the minimal parenthesis height on the path from fork to join).
+    Therefore by lemma \ref{gor1_path_containment}
+    we know that $\pi_\alpha'$ is contained in a subautomaton $f$ of height $\rho_k$.
+    Likewise we know that $\pi_\beta'$ is not contained in $f$, because $minht (\beta') = \rho'_k < \rho_k$.
+    %
+    Let $\pi_\beta''$ be the part of $\pi_\beta'$ containing the last $k$-th frame,
+    and note the following:
+    \begin{enumerate}
+        \item[(a)] the start state of $\pi_\beta''$ must be contained in $f$
+            (because by our assumption
+            either $k = 1$ and then start state of $\pi_\beta''$ is the fork state,
+            or $\rho_{k-1} \leq \rho'_{k-1}$ which implies $\rho'_{k-1} \geq \rho_k$
+            and then all but the last frames of $\pi_\beta'$ must be contained in $f$)
+        \item[(b)] $\pi$ cannot be contained in $f$
+            (because by our assumption $\rho_k > \rho'_k$)
+        \item[(c)] the end state of $\pi_\beta''$ is contained in $f$
+            (because it's the join state $q_1$ of $\pi_\alpha'$ and $\pi_\beta'$)
+        \item[(d)] $\pi_\gamma$ is not contained in $f$
+            (because by our assumption $minht (\gamma) \leq \rho'_k$ and consequently $minht (\gamma) < \rho_k$)
+    \end{enumerate}
+    %
+    Put together, items (a) - (d) mean that the $\epsilon$-path $\pi_\beta'' \pi_\gamma$
+    first leaves subautomaton $f$, then re-enters $f$, and then leaves $f$ second time.
+    Because $f$ has a unique exit state, this means that $\pi_\beta'' \pi_\gamma$ contains $\epsilon$-loop
+    through the exit state of $f$, which contradicts lemma conditions.
+    (Effectively it means that $\pi_\beta \pi_\gamma$ is non-minimal and would be discarded by GOR1 anyway.)
+%   Note that $\pi_\beta'$ itself does not necessarily contain $\epsilon$-loop.
+    %
+    $\square$
+    \end{XLem}
+
+
+
+
+\section{Matching algorithm}
+
+The final algorithm, complexity estimates.
+
+\section{Conclusions}
+
+\end{document}
+