%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Project:     Documentation Tools
%% Descr:       Latex -->  MAN-page (groff -man), LaTeX package
%% Author:      Dr. Jürgen Vollmer, Juergen.Vollmer@acm.org
%% $Id: latex2man.sty,v 1.1.1.1 2006/10/18 16:57:05 jacka Exp $
%% VERSION: 1.19
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `latex2man' package to use with LaTeX2e.
%%
%% Latex2man is a tool to translate UNIX manual pages written with LaTeX into a
%% format understood by the UNIX man(1)-command.
%% Alternatively HTML or TexInfo code can be produced too.
%% Output of parts of the text may be supressed using the conditional text
%% feature.
%%
%% There is LaTeX package (latex2man.sty) used for writing the Man-page
%% and a PERL script (latex2man) doing the actual translation.
%%
%% Copyright (C) 1998, Dr. Juergen Vollmer
%%                     Viktoriastrasse 15, D-76133 Karlsruhe, Germany
%%                     Juergen.Vollmer@acm.org
%% License:
%%   This program can be redistributed and/or modified under the terms
%%   of the LaTeX Project Public License Distributed from CTAN
%%   archives in directory macros/latex/base/lppl.txt; either
%%   version 1 of the License, or any later version.
%%
%% If you find this software useful, please send me a postcard.
%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

\NeedsTeXFormat{LaTeX2e}
\ProvidesPackage{latex2man}[2005/09/12 v1.19]
\usepackage{ifthen}

\newif\if@LM@UseFancy@
\newif\if@LM@UseFancyHdr@

\DeclareOption{fancy}{
  \@LM@UseFancy@true
  \@LM@UseFancyHdr@false
}
\DeclareOption{fancyhdr}{
  \@LM@UseFancyHdr@true
  \@LM@UseFancy@false
}
\DeclareOption{nofancy}{
  \@LM@UseFancy@false
  \@LM@UseFancyHdr@false
}

\input{latex2man.cfg}
\ProcessOptions
\if@LM@UseFancy@
    \RequirePackage{fancyheadings}
\fi
\if@LM@UseFancyHdr@
    \RequirePackage{fancyhdr}
\fi

\newcommand{\@LM@Arg}[1]{\textit{#1}}
\newcommand{\@LM@Opt}[1]{\textbf{#1}}

\newcommand{\Opt}[1]{\@LM@Opt{#1}}                      % Option
\newcommand{\Arg}[1]{\@LM@Arg{#1}}                      % Argument
\newcommand{\OptArg}[2]{\Opt{#1}\Arg{#2}}               % Option with Argument
\newcommand{\OptoArg}[2]{\Opt{#1}[\Arg{#2}]}            % Option with optinal
                                                        % Argument

\newcommand{\oArg}[1]{[\Arg{#1}]}                       % optional Argument
\newcommand{\oOpt}[1]{[\Opt{#1}]}                       % optional Option
\newcommand{\oOptArg}[2]{[\OptArg{#1}{#2}]}             % optional Option with Argument
\newcommand{\oOptoArg}[2]{[\OptoArg{#1}{#2}]}           % optional Option with
                                                        % optional Argument

\newcommand{\Prog}[1]{\textit{#1}}                      % Program name
\newcommand{\Cmd}[2]{\textit{#1}(#2)}                   % Command with number

\newcommand{\@LM@File}[1]{\texttt{#1}}
\newcommand{\File}[1]{\@LM@File{#1}}                    % File name

\newcommand{\Bs}{$\mathtt{\backslash}$}
\newcommand{\Bar}{$\mathtt{|}$}
\newcommand{\Tilde}{\ensuremath{\mathtt{\sim}}}
\newcommand{\Dots}{$\dots$}
\newcommand{\Circum}{\^{}}
\newcommand{\Lbr}{[}
\newcommand{\Rbr}{]}
\newcommand{\LBr}{\{}
\newcommand{\RBr}{\}}
\newcommand{\Dollar}{\$}
\newcommand{\Percent}{\%}
\newcommand{\Bullet}{$\bullet$}
\newcommand{\TEXbr}{~\\}
\newcommand{\MANbr}{}
\newcommand{\HTMLbr}{}
\newcommand{\TEXIbr}{}
\newcommand{\SP}{\hspace*{0.5em}}

\def\@LM@Date{}
\newcommand{\setDate}[1]{\def\@LM@Date{#1}}
\newcommand{\Date}{\@LM@Date}

\def\@LM@VersionWord{Version:}
\newcommand{\setVersionWord}[1]{\def\@LM@VersionWord{#1}}

\def\@LM@Version{}
\newcommand{\setVersion}[1]{\def\@LM@Version{#1}}
\newcommand{\Version}{\@LM@Version}

\newcommand{\Email}[1]{\texttt{#1}}
\newcommand{\URL}[1]{\texttt{#1}}
\newcommand{\LatexManEnd}{}

\newenvironment{Name}[5]{
% #1 Chapter
% #2 Name
% #3 Author
% #4 Tool
\if@LM@UseFancy@
\gdef\@LM@Foot{\emph{\@LM@VersionWord\ \@LM@Version, \@LM@Date}}
\rfoot[\fancyplain{#2 (#1)}{#2 (#1)}]{\fancyplain{\@LM@Foot}{\@LM@Foot}}
\lfoot[\fancyplain{\@LM@Foot}{\@LM@Foot}]{\fancyplain{#2 (#1)}{#2 (#1)}}
\fi
\if@LM@UseFancyHdr@
\gdef\@LM@Foot{\emph{\@LM@VersionWord\ \@LM@Version, \@LM@Date}}
\rfoot[\fancyplain{#2 (#1)}{#2 (#1)}]{\fancyplain{\@LM@Foot}{\@LM@Foot}}
\lfoot[\fancyplain{\@LM@Foot}{\@LM@Foot}]{\fancyplain{#2 (#1)}{#2 (#1)}}
\fi
\title{#5}
\author{#3}
\date{\@LM@Date\\{\small Version \@LM@Version}}
\maketitle
\begin{abstract}
}{
\end{abstract}
}

\newenvironment{Table}[1]{
\par
\begin{tabular}{*#1{l}}
}{
\end{tabular}
\par
}

\newenvironment{Description}[1][]{
\begin{list}{}{
 \ifthenelse{\equal{#1}{}}{
   % optional argument not given
     \labelwidth\z@ \itemindent-\leftmargin
     \let\makelabel\descriptionlabel
     \renewcommand{\makelabel}[1]{\hspace\labelsep\normalfont\bfseries##1}
  }{
   % optional argument given
   \settowidth{\labelwidth}{\normalfont\bfseries#1}
   \setlength{\leftmargin}{\labelwidth}
   \addtolength{\leftmargin}{\labelsep}
   \renewcommand{\makelabel}[1]{\normalfont\bfseries##1\hfil}
  }}
}{
\end{list}
}

\AtBeginDocument{
\if@LM@UseFancy@
  \pagestyle{fancyplain}
\fi
\if@LM@UseFancyHdr@
  \pagestyle{fancyplain}
\fi
\setDate{\today}
}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\endinput
