%% linebyline.sty, v 1.0, 2009/08/28 
%
% Macro for enumerated derivations
% Gregory Wheeler, Lisbon


\RequirePackage{suffix,setspace,mdwtab,latexsym,amsmath,amsfonts,ifthen}

%LBL



%--- Basic spacing parameters

% Line height in proofs
\newlength{\LBLlineht}
\setlength{\LBLlineht}{1.5\baselineskip}

% Line number width
\newlength{\LBLnumwd}
\setlength{\LBLnumwd}{1em}

% Indent for comments
\newlength{\LBLcomind}
\setlength{\LBLcomind}{2em}

% Horizontal indent for nesting proof lines
\newlength{\LBLindent}
\setlength{\LBLindent}{1em}

% Shorter vline; used for start of nested proof
\makeatletter
\newcommand\LBLvline[1][\arrayrulewidth]{%
   \vrule\@height.5\LBLlineht\@width#1\relax
   }%
\makeatother

% Abbreviations for split
\newcommand{\spl}[1]{\begin{split} #1\end{split}}


%--- Environment commands

\newcommand{\ab}{\hspace*{\LBLindent}}

% equal arrays (expression &=& expression) NOT inside derivations:
\makeatletter 
 \newcommand{\be}{% 
 \begingroup 
 % \setlength{\arraycolsep}{2pt} 
 \eqnarray% 
 \@ifstar{\nonumber}{}% 
 } 
 \newcommand{\ee}{\endeqnarray\endgroup} 
 \makeatother
 
 % equal arrays (expression &=& expression) inside derivations:
\makeatletter 
 \newcommand{\bs}{% 
 \begingroup 
 % \setlength{\arraycolsep}{2pt} 
 \split% 
 } 
 \newcommand{\es}{\endspli\endgroup} 
 \makeatother

%--- Decorations

% Line Marker \lmark
\newcommand{\lmark}{%
  \makebox[0pt][r]{${\blacktriangleright}$\,\,}}
% Box around argument, like new variable in ql
%\newcommand{\fw}[1]{\fbox{\footnotesize $#1$}}


%--- Counters

\newcounter{LBLcounter}
\setcounter{LBLcounter}{0}

%To avoid starting from 1, \setboolean{resetLBLcounter}{false}
\newboolean{resetLBLcounter}
\setboolean{resetLBLcounter}{true}

%To avoid increasing numbers, \setboolean{increaseLBLcounter}{false}
\newboolean{increaseLBLcounter}
\setboolean{increaseLBLcounter}{true}

%\formatLBLcounter can be altered if needed, but only once per derivation
\newcommand{\formatLBLcounter}[1]{\arabic{#1})}
%Typeset the counter
\newcommand{\LBLcounter}{%
  \ifthenelse{\boolean{increaseLBLcounter}}{\addtocounter{LBLcounter}{1}}{}
  \formatfitchcounter{LBLcounter}}


%%%%%%%%%%%%%%%%%%%

%--- lbyl environment

% lbyl numbered
\newenvironment{LBLnum}%
{\ifthenelse{\boolean{resetLBLcounter}}{\setcounter{LBLcounter}{0}}{}
  \begin{tabular}{!{\makebox[\LBLnumwd][r]{\LBLcounter }\hspace{\LBLindent}}Ml@{\hspace{\LBLcomind}}l}}%
{\end{tabular}}

% lbyl without numbered lines
\newenvironment{LBLunum}%
{\begin{tabular}{!{\makebox[\LBLnumwd][r]{}\hspace{\LBLindent}}Ml@{\hspace{\LBLcomind}}l}}%
{\end{tabular}}

% lbyl  enivronment, normal and star versions; 1.5 controls vertical line spacing
\newenvironment{linebyline}{\renewcommand{\arraystretch}{1.5}
  \begin{LBLnum}}{\end{LBLnum}}
\newenvironment{linebyline*}{\renewcommand{\arraystretch}{1.5}
  \begin{LBLunum}}{\end{LBLunum}}
  



 