%%
%% This is file `footkmpj.sty',
%% ----------------------------------------------------------------------
%% The footmisc package -- variations of footnote typesetting
%% Copyright (c) 2008 Robin Fairbairns
%% Modified to use the full width of the page for footnotes in multicolumn
%% mode by Michael Paul Johnson Oct, 2015.
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in:
%% http://www.latex-project.org/lppl.txt, and version 1.3c or later is part
%% of all distributions of LaTeX version 2005/12/01 or later.
%% 
%% This work has the LPPL maintenance status `author-maintained'.
%% 
%% This work consists of the files footmisc.dtx, footmisc.ins, and README
%% and the derived files footmisc.sty and footmisc.pdf.
%% -----------------------------------------------------------------------
%% 
%% This is footmisc.dtx, and it's -*-LaTeX-*- text
\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{footkmpj}%
        [2011/06/06 v5.5b
     a miscellany of footnote facilities%
                   ]% $Id: footkmpj.dtx,v 4.25 2011/06/06 14:25:44 rf10 Exp rf10 $
\NeedsTeXFormat{LaTeX2e}[1994/12/01]
\newtoks\FN@temptoken
\providecommand\protected@writeaux{%
  \protected@write\@auxout
}%    \end{macrocode}
\def\l@advance@macro{\@@dvance@macro\edef}
\def\@@dvance@macro#1#2#3{\expandafter\@tempcnta#2\relax
  \advance\@tempcnta#3\relax
  #1#2{\the\@tempcnta}%
}
\let\@advance@macro\l@advance@macro
\newif\ifFN@etex
\ifx\dimexpr\undefined
  \FN@etexfalse
\else
  \FN@etextrue
\fi
\newdimen\footnotemargin
\footnotemargin1.8em\relax
\DeclareOption{symbol}{\renewcommand\thefootnote{\fnsymbol{footnote}}}
\DeclareOption{symbol*}{%
  \renewcommand\thefootnote{\@fnsymbol\c@footnote}%
  \AtEndOfPackage{\setfnsymbol{lamport*-robust}}%
}
\newif\ifFN@para  \FN@parafalse
\DeclareOption{para}{\ifFN@sidefn
    \PackageError{footkmpj}{Option "\CurrentOption" incompatible with
      option "side"}%
      {I shall ignore "\CurrentOption"}%
  \else
    \FN@paratrue
  \fi
}
\newif\ifFN@sidefn  \FN@sidefnfalse
\DeclareOption{side}{\ifFN@para
    \PackageError{footkmpj}{Option "\CurrentOption" incompatible with
      option "para"}%
      {I shall ignore "\CurrentOption"}%
  \else
    \FN@sidefntrue
  \fi
}
\let\footnotelayout\@empty
\DeclareOption{ragged}{%
  \@ifundefined{RaggedRight}%
    {\renewcommand\footnotelayout{\linepenalty50 \raggedright}}%
    {\renewcommand\footnotelayout{\linepenalty50 \RaggedRight}}%
}
\newif\ifFN@perpage
\FN@perpagefalse
\DeclareOption{perpage}{%
  \FN@perpagetrue
}
\newif\ifFN@bottom  \FN@bottomfalse
\DeclareOption{bottom}{%
  \FN@bottomtrue
}
\DeclareOption{marginal}{%
  \footnotemargin-0.8em\relax
}
\DeclareOption{flushmargin}{%
  \footnotemargin0pt\relax
}
\newif\ifFN@hangfoot  \FN@hangfootfalse
\DeclareOption{hang}{%
  \FN@hangfoottrue
}
\newcommand*\hangfootparskip{0.5\baselineskip}
\newcommand*\hangfootparindent{0em}%
\DeclareOption{norule}{%
  \renewcommand\footnoterule{}%
  \advance\skip\footins 4\p@\@plus2\p@\relax
}
\DeclareOption{splitrule}{%
  \gdef\split@prev{0}
  \let\pagefootnoterule\footnoterule
  \let\mpfootnoterule\footnoterule
  \def\splitfootnoterule{\kern-3\p@ \hrule \kern2.6\p@}
  \def\footnoterule{\relax
    \ifx \@listdepth\@mplistdepth
      \mpfootnoterule
    \else
      \ifnum\split@prev=\z@
        \pagefootnoterule
      \else
        \splitfootnoterule
      \fi
      \xdef\split@prev{\the\insertpenalties}%
    \fi
  }%
}
\newif\ifFN@stablefootnote  \FN@stablefootnotefalse
\DeclareOption{stable}{\FN@stablefootnotetrue}
\newif\ifFN@multiplefootnote  \FN@multiplefootnotefalse
\DeclareOption{multiple}{\FN@multiplefootnotetrue}
\ProcessOptions
\let  \if@tempswa  \ifFN@bottom
\ifFN@para    \@tempswatrue \fi
\if@tempswa
  \@ifl@t@r\fmtversion{2005/12/01}{%
    \CheckCommand*\@makecol{\ifvoid \footins
        \setbox\@outputbox \box\@cclv
      \else
        \setbox\@outputbox \vbox{%
          \boxmaxdepth \@maxdepth
          \unvbox\@cclv
          \vskip \skip\footins
          \color@begingroup
            \normalcolor\footnoterule
            \unvbox\footins
          \color@endgroup
        }%
      \fi
      \let \@elt \relax
      \xdef\@freelist{\@freelist\@midlist}%
      \global\let\@midlist\@empty
      \@combinefloats
      \ifvbox\@kludgeins
        \@makespecialcolbox
      \else
        \setbox\@outputbox \vbox to\@colht{%
          \@texttop \dimen@\dp\@outputbox
          \unvbox\@outputbox
          \vskip -\dimen@\@textbottom
        }%
      \fi
      \global\maxdepth\@maxdepth
    }
  }{%
  \@ifl@t@r\fmtversion{2003/12/01}{%
    \CheckCommand*\@makecol{\ifvoid \footins
        \setbox\@outputbox \box\@cclv
      \else
        \setbox\@outputbox \vbox{%
          \boxmaxdepth\@maxdepth
          \@tempdima\dp\@cclv
          \unvbox\@cclv
          \vskip \skip\footins
          \color@begingroup
            \normalcolor
            \footnoterule
            \unvbox\footins
          \color@endgroup
        }%
      \fi
      \let \@elt \relax
      \xdef\@freelist{\@freelist\@midlist}%
      \global\let\@midlist\@empty
      \@combinefloats
      \ifvbox\@kludgeins
        \@makespecialcolbox
      \else
        \setbox\@outputbox \vbox to\@colht{%
          \@texttop
          \dimen@\dp\@outputbox
          \unvbox\@outputbox
          \vskip -\dimen@
          \@textbottom
        }%
      \fi
      \global\maxdepth\@maxdepth
    }%
  }{%
    \@ifl@t@r\fmtversion{1999/12/01}{%
      \CheckCommand*\@makecol{\ifvoid \footins
          \setbox\@outputbox \box\@cclv
        \else
          \setbox\@outputbox \vbox{%
            \boxmaxdepth\@maxdepth
            \@tempdima\dp\@cclv
            \unvbox\@cclv
            \vskip \skip\footins
            \color@begingroup
              \normalcolor\footnoterule
              \unvbox\footins
            \color@endgroup
          }%
        \fi
        \xdef\@freelist{\@freelist\@midlist}%
        \global\let\@midlist\@empty
        \@combinefloats
        \ifvbox\@kludgeins
          \@makespecialcolbox
        \else
          \setbox\@outputbox \vbox to\@colht{%
            \@texttop \dimen@\dp\@outputbox
            \unvbox\@outputbox
            \vskip -\dimen@\@textbottom
          }%
        \fi
        \global\maxdepth\@maxdepth
      }%
    }%
  }{%
      \CheckCommand*\@makecol{\ifvoid \footins
        \setbox\@outputbox \box\@cclv
      \else
        \setbox\@outputbox \vbox{%
          \boxmaxdepth\@maxdepth
          \unvbox\@cclv
          \vskip \skip\footins
          \color@begingroup
            \normalcolor\footnoterule
            \unvbox\footins
          \color@endgroup
        }%
      \fi
      \xdef\@freelist{\@freelist\@midlist}%
      \global\let\@midlist\@empty
      \@combinefloats
      \ifvbox\@kludgeins
        \@makespecialcolbox
      \else
        \setbox\@outputbox \vbox to\@colht{%
          \@texttop \dimen@\dp\@outputbox
          \unvbox\@outputbox
          \vskip -\dimen@\@textbottom
        }%
      \fi
      \global\maxdepth\@maxdepth
    }%
  }%
}
  \ifFN@para
    \FN@temptoken{%
      \toks@\expandafter{\the\toks@
        \vskip\skip\footins
        \color@begingroup
          \normalcolor\footnoterule
          \global\setbox\FN@tempboxc\vbox{\makefootnoteparagraph}%
          \unvbox\FN@tempboxc
        \color@endgroup
      }%
    }%
  \else
    \FN@temptoken{%
      \toks@\expandafter{\the\toks@
        \vskip\skip\footins
        \color@begingroup
          \normalcolor\footnoterule
          \unvbox\footins
        \color@endgroup
      }%
    }%
  \fi
  \ifFN@bottom
    \toks@{\setbox\@outputbox \box\@cclv
      \xdef\@freelist{\@freelist\@midlist}%
      \global\let\@midlist\@empty
      \@combinefloats
      \ifvoid\footins
      \else
        \setbox\@outputbox \vbox\bgroup
          \boxmaxdepth\@maxdepth
          \unvbox\@outputbox
          \vfill\relax
    }
    \the\FN@temptoken
    \toks@\expandafter{\the\toks@\egroup\fi}
  \else
    \toks@{\ifvoid\footins
        \setbox\@outputbox\box\@cclv
      \else
        \setbox\@outputbox \vbox\bgroup
        \boxmaxdepth\@maxdepth
        \unvbox\@cclv
    }
    \the\FN@temptoken
    \toks@\expandafter{\the\toks@
      \egroup
      \fi
      \xdef\@freelist{\@freelist\@midlist}%
      \global\let\@midlist\@empty
      \@combinefloats
    }%
  \fi
  \toks@\expandafter{\the\toks@
    \ifvbox\@kludgeins
      \@makespecialcolbox
    \else
      \setbox\@outputbox \vbox to\@colht{%
        \@texttop \dimen@\dp\@outputbox
        \unvbox\@outputbox
        \vskip -\dimen@\@textbottom
      }%
    \fi
    \global\maxdepth\@maxdepth
  }
  \edef\@makecol{\the\toks@}
\fi
\newif\ifFN@setspace
\@ifpackageloaded{setspace}{%
  \FN@setspacetrue
  \@ifclassloaded{memoir}{%
    \let\FN@baselinestretch\m@m@singlespace
  }{%
    \let\FN@baselinestretch\setspace@singlespace
  }%
}{%
  \FN@setspacefalse
}
\ifFN@para
  \renewcommand\@footnotetext[1]{%
    \insert\footins{%
      \ifFN@setspace
        \let\baselinestretch\FN@baselinestretch
      \fi
      \reset@font\footnotesize
      \interlinepenalty\interfootnotelinepenalty
      \splittopskip\footnotesep
      \splitmaxdepth \dp\strutbox
      \floatingpenalty\@MM
      \hsize\textwidth
      \@parboxrestore
      \protected@edef\@currentlabel{\csname p@footnote\endcsname\@thefnmark}%
      \color@begingroup
        \setbox\FN@tempboxa=\hbox{%
          \@makefntext{\ignorespaces#1\strut
            \penalty-10\relax
            \hskip\footglue
          }% end of \@makefntext parameter
        }% end of \hbox
        \dp\FN@tempboxa=0pt
        \ifFN@etex
          \ht\FN@tempboxa=\dimexpr\wd\FN@tempboxa *
                          \footnotebaselineskip / \textwidth\relax
        \else
          \ht\FN@tempboxa=\fudgefactor\wd\FN@tempboxa
        \fi
        \box\FN@tempboxa
      \color@endgroup
    }%
    \FN@mf@prepare
  }
\else
  \ifFN@sidefn
    \renewcommand\@footnotetext[1]{%
      \marginpar{%
        \ifFN@setspace
          \let\baselinestretch\FN@baselinestretch
        \fi
        \reset@font\footnotesize
        \protected@edef\@currentlabel{%
          \csname p@footnote\endcsname\@thefnmark
        }%
        \color@begingroup
          \@makefntext{%
            \ignorespaces#1%
          }%
        \color@endgroup
      }%
      \FN@mf@prepare
    }%
  \else
    \renewcommand\@footnotetext[1]{%
      \insert\footins{%
        \ifFN@setspace
          \let\baselinestretch\FN@baselinestretch
        \fi
        \reset@font\footnotesize
        \interlinepenalty\interfootnotelinepenalty
        \splittopskip\footnotesep
        \splitmaxdepth \dp\strutbox
        \floatingpenalty\@MM
        \hsize\textwidth
        \@parboxrestore
        \protected@edef\@currentlabel{%
          \csname p@footnote\endcsname\@thefnmark
        }%
        \color@begingroup
          \@makefntext{%
            \rule\z@\footnotesep
            \ignorespaces#1\@finalstrut\strutbox
          }%
        \color@endgroup
      }%
      \FN@mf@prepare
    }%
  \fi
\fi
\ifFN@para
  \let\FN@tempboxa\@tempboxa
  \newbox\FN@tempboxb
  \newbox\FN@tempboxc
  \newskip\footglue \footglue=1em plus.3em minus.3em
  \long\def\@makefntext#1{\leavevmode
    \@makefnmark\nobreak
    \hskip.5em\relax#1%
  }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  \newdimen\footnotebaselineskip
  {%
    \footnotesize
    \global
      \footnotebaselineskip=\normalbaselineskip
  }
  \ifFN@etex
  \else
    \@tempdima=\footnotebaselineskip \multiply\@tempdima by 1024
    \divide \@tempdima by \textwidth \multiply\@tempdima by 64
    \xdef\fudgefactor{\strip@pt\@tempdima }%
  \fi
  \long\def\makefootnoteparagraph{\unvbox\footins \makehboxofhboxes
    \setbox\FN@tempboxa=\hbox{\unhbox\FN@tempboxa \removehboxes}
    \hsize\textwidth
    \@parboxrestore
    \baselineskip=\footnotebaselineskip
    \noindent
    \rule{\z@}{\footnotesep}%
    \unhbox\FN@tempboxa\par
  }
  \def\makehboxofhboxes{\setbox\FN@tempboxa=\hbox{}%
    \loop
      \setbox\FN@tempboxb=\lastbox
      \ifhbox\FN@tempboxb
      \setbox\FN@tempboxa=\hbox{\box\FN@tempboxb\unhbox\FN@tempboxa}%
    \repeat
  }
  \def\removehboxes{\setbox\FN@tempboxa=\lastbox
    \ifhbox
      \FN@tempboxa{\removehboxes}%
      \unhbox\FN@tempboxa
    \fi
  }
\fi
\newif\ifFN@pp@footnotehint
\newcounter{pp@next@reset}%
\newif\ifFN@pp@towrite
\FN@pp@towritefalse
\ifFN@perpage
  \CheckCommand*\footnote{\@ifnextchar [%]
    \@xfootnote
    {%
      \stepcounter\@mpfn \protected@xdef\@thefnmark{\thempfn}%
      \@footnotemark \@footnotetext
    }%
  }
  \renewcommand*\footnote{\@ifnextchar [%]
    \@xfootnote
    {%
      \stepcounter\@mpfn \protected@xdef\@thefnmark{\thempfn}%
      \FN@pp@footnote\@footnotemark
      \ifFN@pp@towrite
        \FN@pp@writetemp
        \FN@pp@towritefalse
      \fi
      \@footnotetext
    }%
  }
  \CheckCommand*\footnotemark{%
    \@ifnextchar [%]
    \@xfootnotemark
    {%
      \stepcounter{footnote}%
      \protected@xdef\@thefnmark{\thefootnote}%
      \@footnotemark
    }%
  }
  \renewcommand*\footnotemark{%
    \@ifnextchar [%]
    \@xfootnotemark
    {%
      \stepcounter{footnote}%
      \protected@xdef\@thefnmark{\thefootnote}%
      \FN@pp@footnote\@footnotemark
      \ifFN@pp@towrite
        \FN@pp@writetemp
        \FN@pp@towritefalse
      \fi
    }%
  }
  \gdef\FN@pp@initial@stab{\@addtoreset{footnote}{page}}
  \AtBeginDocument{\FN@pp@initial@stab}
  \newcounter{@fnserial}
  \def\FN@pp@cpage{0}
  \FN@pp@footnotehinttrue
  \newcommand{\footnotehint}{%
    \setcounter{footnote}{0}%
    \protected@writeaux\relax{\protect\FN@pp@footnotehinttrue}%
    \@tempcnta\c@@fnserial
    \advance\@tempcnta\@ne
    \global\c@pp@next@reset\@tempcnta
  }
  \AtBeginDocument{\protected@writeaux\relax{%
      \protect\providecommand{\protect\FN@pp@footnotehinttrue}{}%
    }%
  }
\def\FN@pp@lastfoot{-1}
  \newcommand{\FN@pp@footnote@aux}[2]{%
    \ifnum\FN@pp@lastfoot<#1
      \ifFN@pp@footnotehint
        \FN@pp@resetfn{#1}{#2}%
        \FN@pp@footnotehintfalse
      \else
        \gdef\@tempa{#2}%
        \ifx\@tempa\FN@pp@cpage
        \else
          \FN@pp@resetfn{#1}{#2}%
        \fi
      \fi
      \def\FN@pp@lastfoot{#1}%
    \fi
    \global\let\FN@pp@initial@stab\relax
  }
  \newcommand{\FN@pp@resetfn}[2]{%
    \gdef\FN@pp@cpage{#2}%
    \expandafter\gdef
      \csname FN@pp@next-\FN@pp@prev@foot\endcsname{#1}%
    \def\FN@pp@prev@foot{#1}%
    \expandafter\xdef
      \csname FN@pp@next-\FN@pp@prev@foot\endcsname{\the\@MM}%
  }
  \newcommand{\FN@pp@prev@foot}{root}
  \AtBeginDocument{\protected@writeaux\relax{%
      \protect\providecommand{\protect\FN@pp@footnote@aux}[2]{}}%
    \c@pp@next@reset\@ne
  }
  \AtEndDocument{\let\FN@pp@footnote@aux\FN@pp@footnote@endaux
    \def\FN@pp@lastfoot{-1}%
    \FN@pp@footnotehintfalse
    \renewcommand{\FN@pp@prev@foot}{root}
  }
  \newcommand{\FN@pp@footnote@endaux}[2]{%
    \ifnum\FN@pp@lastfoot<#1
      \ifFN@pp@footnotehint
        \FN@pp@resetfn@end{#1}{#2}%
        \FN@pp@footnotehintfalse
      \else
        \gdef\@tempa{#2}%
        \ifx\@tempa\FN@pp@cpage
        \else
          \FN@pp@resetfn@end{#1}{#2}%
        \fi
      \fi
      \def\FN@pp@lastfoot{#1}%
    \fi
  }
  \newcommand{\FN@pp@resetfn@end}[2]{%
    \def\@tempa{#1}%
    \expandafter\ifx\csname FN@pp@next-\FN@pp@prev@foot\endcsname\@tempa%
    \else
      \@tempswatrue
    \fi
    \gdef\FN@pp@prev@foot{#1}%
    \gdef\FN@pp@cpage{#2}%
  }
\let\FN@pp@@clearpage\clearpage
\renewcommand{\clearpage}{\footnotehint\FN@pp@@clearpage}
\def\FN@pp@footnote{%
  \if@minipage\else
    \global\advance\c@@fnserial\@ne
    \if@filesw
      \xdef\FN@pp@writetemp{%
        \noexpand\protected@writeaux\relax{%
          \string\FN@pp@footnote@aux
            {\the\c@@fnserial}{\noexpand\thepage}%
        }%
      }%
      \FN@pp@towritetrue
    \fi
    \ifnum\c@pp@next@reset>\c@@fnserial
    \else
      \global\expandafter\csname c@\@mpfn\endcsname\@ne
      \protected@xdef\@thefnmark{\thempfn}%
      \expandafter\let\expandafter\@tempa
        \csname FN@pp@next-\number\c@pp@next@reset\endcsname
      \ifx\@tempa\relax
        \global\c@pp@next@reset\@MM
      \else
        \global\c@pp@next@reset\@tempa
      \fi
    \fi
  \fi
}
\fi
\ifFN@para
\else
  \long\def\@makefntext#1{%
    \ifFN@hangfoot
      \bgroup
      \setbox\@tempboxa\hbox{%
        \ifdim\footnotemargin>0pt
          \hb@xt@\footnotemargin{\@makefnmark\hss}%
        \else
          \@makefnmark
        \fi
      }%
      \leftmargin\wd\@tempboxa
      \rightmargin\z@
      \linewidth \textwidth
      \advance \linewidth -\leftmargin
      \parshape \@ne \leftmargin \linewidth
      \footnotesize
      \@setpar{{\@@par}}%
      \leavevmode
      \llap{\box\@tempboxa}%
      \parskip\hangfootparskip\relax
      \parindent\hangfootparindent\relax
    \else
      \parindent1em
      \noindent
      \ifdim\footnotemargin>\z@
        \hb@xt@ \footnotemargin{\hss\@makefnmark}%
      \else
        \ifdim\footnotemargin=\z@
          \llap{\@makefnmark}%
        \else
          \llap{\hb@xt@ -\footnotemargin{\@makefnmark\hss}}%
        \fi
      \fi
    \fi
    \footnotelayout#1%
    \ifFN@hangfoot
      \par\egroup
    \fi
  }
\fi
\ifFN@multiplefootnote
  \providecommand*{\multiplefootnotemarker}{3sp}
  \providecommand*{\multfootsep}{,}
  \CheckCommand*\@footnotemark{%
    \leavevmode
    \ifhmode\edef\@x@sf{\the\spacefactor}\nobreak\fi
    \@makefnmark
    \ifhmode\spacefactor\@x@sf\fi
    \relax
  }
  \renewcommand*\@footnotemark{%
    \leavevmode
    \ifhmode
      \edef\@x@sf{\the\spacefactor}%
      \FN@mf@check
      \nobreak
    \fi
    \@makefnmark
    \ifFN@pp@towrite
      \FN@pp@writetemp
      \FN@pp@towritefalse
    \fi
    \FN@mf@prepare
    \ifhmode\spacefactor\@x@sf\fi
    \relax
  }
  \def\FN@mf@prepare{%
    \kern-\multiplefootnotemarker
    \kern\multiplefootnotemarker\relax
  }
  \def\FN@mf@check{%
    \ifdim\lastkern=\multiplefootnotemarker\relax
      \edef\@x@sf{\the\spacefactor}%
      \unkern
      \textsuperscript{\multfootsep}%
      \spacefactor\@x@sf\relax
    \fi
  }
\else
  \let\FN@mf@prepare\relax
\fi
\ifFN@stablefootnote
\let\FN@sf@@footnote\footnote
\def\footnote{\ifx\protect\@typeset@protect
    \expandafter\FN@sf@@footnote
  \else
    \expandafter\FN@sf@gobble@opt
  \fi
}
\edef\FN@sf@gobble@opt{\noexpand\protect
  \expandafter\noexpand\csname FN@sf@gobble@opt \endcsname}
\expandafter\def\csname FN@sf@gobble@opt \endcsname{%
  \@ifnextchar[%]
    \FN@sf@gobble@twobracket
    \@gobble
}
\def\FN@sf@gobble@twobracket[#1]#2{}
\let\FN@sf@@footnotemark\footnotemark
\def\footnotemark{\ifx\protect\@typeset@protect
    \expandafter\FN@sf@@footnotemark
  \else
    \expandafter\FN@sf@gobble@optonly
  \fi
}
\edef\FN@sf@gobble@optonly{\noexpand\protect
  \expandafter\noexpand\csname FN@sf@gobble@optonly \endcsname}
\expandafter\def\csname FN@sf@gobble@optonly \endcsname{%
  \@ifnextchar[%]
    \FN@sf@gobble@bracket
    {}%
}
\def\FN@sf@gobble@bracket[#1]{}
\fi
\newcommand\setfnsymbol[1]{%
  \@bsphack
  \@ifundefined{FN@fnsymbol@#1}%
  {%
    \PackageError{footkmpj}{Symbol style "#1" not known}%
    \@eha
  }{%
    \expandafter\let\expandafter\@fnsymbol\csname
                        FN@fnsymbol@#1\endcsname
  }%
  \@esphack
}
\let\FN@fnsymbol@lamport\@fnsymbol
\newif\if@tempswb
\newcommand{\DefineFNsymbols}{%
        \@ifstar{\@tempswbtrue\@DefineFNsymbols}%
                {\@tempswbfalse\@DefineFNsymbols}%
}
\newcommand{\@DefineFNsymbols}[1]{%
  \@ifnextchar[% ]
    {\@DefineFNsymbols@{#1}}{\@DefineFNsymbols@{#1}[text]}%
}
\def\@DefineFNsymbols@#1[#2]#3{%
  \expandafter\ifx\csname FN@fnsymbol@#1\endcsname\relax
    \PackageInfo{footkmpj}{Declaring symbol style #1}%
  \else
    \PackageWarning{footkmpj}{Redeclaring symbol style #1}%
  \fi
  \toks@{}%
  \def\@tempb{\end}%
  \FN@build@symboldef#3\end
  \def\@tempc{math}%
  \def\@tempd{#2}%
  \expandafter\xdef\csname FN@fnsymbol@#1\endcsname##1{%
    \ifx\@tempc\@tempd
      \noexpand\ensuremath
    \else
      \noexpand\nfss@text
    \fi
    {%
      \noexpand\ifcase##1%
      \the\toks@
      \noexpand\else
      \if@tempswb
        \noexpand\@ctrerr
      \else
        \noexpand\@arabic##1\noexpand\FN@orange##1%
      \fi
      \noexpand\fi
    }%
  }%
}
\def\FN@build@symboldef#1{%
  \def\@tempa{#1}%
  \ifx\@tempa\@tempb
  \else
    \toks@\expandafter{\the\toks@\or#1}%
    \expandafter\FN@build@symboldef
  \fi
}
\newcommand{\DefineFNsymbolsTM}{%
        \@ifstar{\@tempswbtrue\@DefineFNsymbolsTM}%
                {\@tempswbfalse\@DefineFNsymbolsTM}}%
\newcommand{\@DefineFNsymbolsTM}[2]{%
  \expandafter\ifx\csname FN@fnsymbol@#1\endcsname\relax
    \PackageInfo{footkmpj}{Declaring symbol style #1}%
  \else
    \PackageWarning{footkmpj}{Redeclaring symbol style #1}%
  \fi
  \toks@{}%
  \def\@tempb{\end}%
  \FN@build@symboldefTM#2\end\@null
  \expandafter\xdef\csname FN@fnsymbol@#1\endcsname##1{%
    \noexpand\ifcase##1%
      \the\toks@
    \noexpand\else
      \if@tempswb
        \noexpand\@ctrerr
      \else
        \noexpand\@arabic##1\noexpand\FN@orange##1%
      \fi
    \noexpand\fi
  }%
}%
\def\FN@build@symboldefTM#1#2{%
  \def\@tempa{#1}%
  \ifx\@tempa\@tempb
  \else
    \toks@\expandafter{\the\toks@\or\TextOrMath{#1}{#2}}%
    \expandafter\FN@build@symboldefTM
  \fi
}
\@ifundefined{TextOrMath}{%
  \@ifundefined{eTeXversion}{%
    \PackageError{footkmpj}{Can't define commands for footnote symbol}%
                           {Use e-LaTeX, or load package fixltx2e before
                             footkmpj}%
  }{%
    \protected\expandafter\def\csname TextOrMath\space\endcsname{%
      \ifmmode \expandafter\@secondoftwo
      \else    \expandafter\@firstoftwo   \fi
    }
    \edef\TextOrMath#1#2{%
      \expandafter\noexpand\csname TextOrMath\space\endcsname
{#1}{#2}%
    }%
  }%
}{}
\def\FN@orange#1{%
  \@bsphack
  \PackageInfo{footkmpj}{Footnote number \number#1 out of range}%
  \protect\@fnsymbol@orange
  \@esphack
}
\global\let\@diagnose@fnsymbol@orange\relax
\AtEndDocument{\@diagnose@fnsymbol@orange}
\def\@fnsymbol@orange{%
  \gdef\@diagnose@fnsymbol@orange{%
    \PackageWarningNoLine{footkmpj}{Some footnote number(s)
      were out of range
      \MessageBreak
      see log for details%
    }%
  }%
}
\@ifundefined{textbardbl}{%
  \DeclareTextSymbol{\textbardbl}{OMS}{107}%
  \DeclareTextSymbolDefault{\textbardbl}{TS1}}{}%
\DefineFNsymbolsTM*{bringhurst}{%
  \textasteriskcentered *
  \textdagger    \dagger
  \textdaggerdbl \ddagger
  \textsection   \mathsection
  \textbardbl    \|%
  \textparagraph \mathparagraph
}%
\DefineFNsymbolsTM*{chicago}{%
  \textasteriskcentered *
  \textdagger    \dagger
  \textdaggerdbl \ddagger
  \textsection   \mathsection
  \textbardbl    \|%
  \#\#%
}%
\DefineFNsymbolsTM*{wiley}{
  \textasteriskcentered *
  {\textasteriskcentered\textasteriskcentered}{**}%
  \textdagger    \dagger
  \textdaggerdbl \ddagger
  \textsection   \mathsection
  \textparagraph \mathparagraph
  \textbardbl    \|%
}%
\DefineFNsymbolsTM{lamport-robust}{
  \textasteriskcentered *
  \textdagger    \dagger
  \textdaggerdbl \ddagger
  \textsection   \mathsection
  \textparagraph \mathparagraph
  \textbardbl    \|%
  {\textasteriskcentered\textasteriskcentered}{**}%
  {\textdagger\textdagger}{\dagger\dagger}%
  {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
}
\DefineFNsymbolsTM*{lamport*}{%
  \textasteriskcentered *
  \textdagger    \dagger
  \textdaggerdbl \ddagger
  \textsection   \mathsection
  \textparagraph \mathparagraph
  \textbardbl    \|%
  {\textasteriskcentered\textasteriskcentered}{**}%
  {\textdagger\textdagger}{\dagger\dagger}%
  {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
  {\textsection\textsection}{\mathsection\mathsection}%
  {\textparagraph\textparagraph}{\mathparagraph\mathparagraph}%
  {\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}%
  {\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}%
  {\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}%
  {\textsection\textsection\textsection}%%
    {\mathsection\mathsection\mathsection}%
  {\textparagraph\textparagraph\textparagraph}%%
    {\mathparagraph\mathparagraph\mathparagraph}%
}
\setfnsymbol{lamport*}
\DefineFNsymbolsTM{lamport*-robust}{%
  \textasteriskcentered *
  \textdagger    \dagger
  \textdaggerdbl \ddagger
  \textsection   \mathsection
  \textparagraph \mathparagraph
  \textbardbl    \|%
  {\textasteriskcentered\textasteriskcentered}{**}%
  {\textdagger\textdagger}{\dagger\dagger}%
  {\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger}%
  {\textsection\textsection}{\mathsection\mathsection}%
  {\textparagraph\textparagraph}{\mathparagraph\mathparagraph}%
  {\textasteriskcentered\textasteriskcentered\textasteriskcentered}{***}%
  {\textdagger\textdagger\textdagger}{\dagger\dagger\dagger}%
  {\textdaggerdbl\textdaggerdbl\textdaggerdbl}{\ddagger\ddagger\ddagger}%
  {\textsection\textsection\textsection}%%
    {\mathsection\mathsection\mathsection}%
  {\textparagraph\textparagraph\textparagraph}%%
    {\mathparagraph\mathparagraph\mathparagraph}%
}
\providecommand*{\footref}[1]{%
  \begingroup
    \unrestored@protected@xdef\@thefnmark{\ref{#1}}%
  \endgroup
  \@footnotemark
}
\newcommand\mpfootnotemark{%
  \@ifnextchar[%
    \@xmpfootnotemark
    {%
      \stepcounter\@mpfn
      \protected@xdef\@thefnmark{\thempfn}%
      \@footnotemark
    }%
}
\def\@xmpfootnotemark[#1]{%
  \begingroup
    \csname c@\@mpfn\endcsname #1\relax
    \unrestored@protected@xdef\@thefnmark{\thempfn}%
  \endgroup
  \@footnotemark
}
\endinput
%%
%% End of file `footkmpj.sty'.
