Saturday, June 9, 2012

A Proof list enumerated by Arrows

Up until recently i used

\begin{enumerate} 
  \item[``$\RightArrow$"] 
  \item[``$\LeftArrow$"] 
\end{enumerate}

or description instead of enumerate which looks even worse. Both don't exactly look right, are cumbersome to type and threw warnings about missing fonts, because latex tried to set the math in bold, so today i sat down and wrote the solution:  


\def\ProofDirection#1{\expandafter\@ProofDirection\csname c@#1\endcsname}
\def\@ProofDirection#1{\ensuremath{\ifcase#1\or\Leftarrow\or\Rightarrow \else\@ctrerr\fi}}
\def\RevProofDirection#1{\expandafter\@RevProofDirection\csname c@#1\endcsname}
\def\@RevProofDirection#1{\ifcase#1\or {$\Rightarrow$}\or {$\Leftarrow$}\else\@ctrerr\fi}

\newcounter{pcounter} 

\newenvironment{myprooflist}[1][]{% 
  
\ifx\relax#1\relax
        \let\@show@count\ProofDirection
     \else
        \let\@show@count\RevProofDirection
     \fi
  \begin{list}{\hss\llap{\textup{``\@show@count{pcounter}''}}}{\usecounter{pcounter}}
  }{
  \end{list}
}


Not only does it work and is cooler, it looks better and is less work to type. Nice!

No comments:

Post a Comment