%
% zpaper.sty:
% a series of formatting commands for writing papers on LaTeX
% (on top of the document class)
% (c) Luis Cabral 2004-2019
% Feel free to use and distribute
%
\usepackage{xparse}
\usepackage{float}
%
% Basic paper style
%
\oddsidemargin=0.25truein \evensidemargin=0.25truein
\topmargin=-0.25truein
\textwidth=6.0truein
\textheight=8.75truein
%
% Tables and figures
%
% Change the way figure and table caption is displayed
%
\makeatletter 
    \long\def\@makecaption#1#2{%
        \vskip.5\baselineskip
        \parbox{\textwidth}{\raggedright\textsf{\textbf{#1}} \\ \textsf{#2}}%
        \vskip.5\baselineskip
    }
%
% Change the font of figure and table content; 
% can be used to change other features of it (e.g., centering)
%
\makeatletter
\let\oldfigure\figure
\def\figure{\@ifnextchar[\figure@i \figure@ii}
\def\figure@i[#1]{\oldfigure[#1]\centering}
\def\figure@ii{\oldfigure\sf}
\makeatother
%
\makeatletter
\let\oldtable\table
\def\table{\@ifnextchar[\table@i \table@ii}
\def\table@i[#1]{\oldtable[#1]\centering}
\def\table@ii{\oldtable\sf}
\makeatother
%
% Title page
%
\makeatletter
    \renewcommand{\@maketitle}{%
    \newpage\parindent0in\null\vskip2em%
    {\LARGE\textbf{\textsf{\@title}}\par\vskip2em}%
    \@author\par\vskip2em%
    \@date%
    \par
    \thispagestyle{empty}\setcounter{page}{0}%\newpage
    }%
\makeatother
\renewenvironment{abstract}% Change the way abstract is presented
{\vskip2em\noindent{\textbf{\textsf{Abstract.}}}\hspace*{1ex}}{}
%
% Section and chapter format
%
\makeatletter % add a period after section number
    \def\@seccntformat#1{\csname the#1\endcsname.\hspace*{1ex}}
\makeatother
\makeatletter % turn section format to sanserif
%\def\chapter{\newpage\thispagestyle{empty}\vspace*{3\baselineskip}%
%			 \@startsection {chapter}{1}{0pt}{-1ex}{22ex}%
%             {\Huge\sf\bfseries\uppercase}}%
\def\@dottedtocline#1#2#3#4#5{%
  \ifnum #1>\c@tocdepth \else
    \vskip \z@ \@plus.2\p@
    {\leftskip #2\relax \rightskip \@tocrmarg \parfillskip -\rightskip
     \parindent #2\relax\@afterindenttrue
     \interlinepenalty\@M
     \leavevmode
     \@tempdima #3\relax
     \advance\leftskip \@tempdima \null\nobreak\hskip -\leftskip
     {#4}\nobreak
     \leaders\hbox{$\m@th
        \mkern \@dotsep mu\hbox{.}\mkern \@dotsep
        mu$}\hfill
     \nobreak
     \hb@xt@\@pnumwidth{\hfil\normalfont \normalcolor \sf#5}%
     \par}%
  \fi}
%
\def\@makechapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright \normalfont
    \ifnum \c@secnumdepth >\m@ne
      \if@mainmatter
        \Huge\bfseries\textsf{\thechapter} $\raisebox{-.3ex}{\rule{2pt}{2ex}}$ \Huge \bfseries \textsf{\uppercase{#1}}%      		\fi
    \fi
    \vskip 80\p@
  }}
\def\@makeschapterhead#1{%
  \vspace*{50\p@}%
  {\parindent \z@ \raggedright
    \normalfont
    \interlinepenalty\@M
    \Huge \bfseries  \textsf{\uppercase{#1}}\par\nobreak
    \vskip 40\p@
  }}
	\def\section{\@startsection {section}{1}{\z@}%
	                                   {-3.5ex \@plus -1ex \@minus -.2ex}%
	                                   {2.3ex \@plus.2ex}%
	                                   {\normalfont\Large\sf\bfseries}}
	\def\subsection{\@startsection{subsection}{2}{\z@}%
	                                     {-3.25ex\@plus -1ex \@minus -.2ex}%
	                                     {1.5ex \@plus .2ex}%
	                                     {\normalfont\large\sf\bfseries}}
\makeatother
%
% Theorems
%
\makeatletter % Change font in newtheorem and add a period after name
\def\@begintheorem#1#2{\trivlist
   \item[\hskip \labelsep{\textsf{\textbf{#1\ #2.}}}]\itshape}
\makeatother
\newtheorem{definition}{Definition}
\newtheorem{assumption}{Assumption}
\newtheorem{theorem}{Theorem}
\newtheorem{corollary}{Corollary}
\newtheorem{lemma}{Lemma}
\newtheorem{proposition}{Proposition}
\newtheorem{conjecture}{Conjecture}
\DeclareDocumentEnvironment{proof}{oo}%
{%
\vspace{.0\baselineskip}\noindent%
\IfNoValueTF{#1}
{{\textbf{\textsf{Proof:}}\ }}
{{\textbf{\textsf{Proof of #1 \ref{#2}:}}\ }}
}
{~\rule{1.5ex}{1.5ex}\\}
%
% Footnotes 
%
\makeatletter % This redefines the way footnotes are displayed
    \newlength{\myfootnotewidth}
    \newlength{\myfootnotelabel}
    \setlength{\myfootnotelabel}{3.5ex}%
    \renewcommand{\@makefntext}[1]{%
        \setlength{\myfootnotewidth}{\columnwidth}%
        \addtolength{\myfootnotewidth}{-\myfootnotelabel}%
        \addtolength{\myfootnotewidth}{-3ex}%
        \noindent\makebox[\myfootnotelabel][r]{\raisebox{-.95ex}{{\normalsize\@makefnmark}}%
        \raisebox{.05ex}{.} }%
        \parbox[t]{\myfootnotewidth}{\raggedright#1}%
    }
\makeatother
%
% First footnote
%
\newfloat{bottomtext}{b}{}
\long\def\firstfootnote#1{\begin{bottomtext}\footnoterule\par\vspace*{.5\footnotesep}\parbox{\textwidth}{\footnotesize\raggedright#1}\end{bottomtext}}
%
% Endnote format: change doanenote, misc formats
%
\def\enoteheading{\section*{{\footnotesize Endnotes}}\mbox{}\par\vskip-1.5\baselineskip}
\def\enotesize{\scriptsize}
\def\endnoteshere{\spacingtwo\parindent70pt\raggedright\def\makeenmark{\noindent\theenmark. }\theendnotes}
\makeatletter
\def\theendnotes{\immediate\closeout\@enotes \global\@enotesopenfalse
	\begingroup
    	\makeatletter
    	\def\@doanenote##1##2>{\def\@theenmark{##1}\par\@theenmark. 
		\edef\@currentlabel{\csname p@endnote\endcsname\@theenmark}
		\begingroup}
    	\def\@endanenote{\par\endgroup}%
    	\enoteheading
    	\enotesize
    	\input{\jobname.ent}%
	\endgroup
}
\makeatother
%
% Miscellaneous commands
%
\renewcommand\topfraction{1}
\renewcommand\bottomfraction{1}

\endinput
