source: trunk/GDE/SINA/builddir/tools/latex2man.sty

Last change on this file was 19170, checked in by westram, 2 years ago
  • sina source
    • unpack + remove tarball
    • no longer ignore sina builddir.
File size: 5.6 KB
Line 
1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
2%% Project:     Documentation Tools
3%% Descr:       Latex -->  MAN-page (groff -man), LaTeX package
4%% Author:      Dr. Jürgen Vollmer, Juergen.Vollmer@informatik-vollmer.de
5%% $Id: latex2man.sty,v 1.85 2010/12/22 09:33:29 vollmer Exp $
6%% VERSION: 1.24
7%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
8%%
9%% `latex2man' package to use with LaTeX2e.
10%%
11%% Latex2man is a tool to translate UNIX manual pages written with LaTeX into a
12%% format understood by the UNIX man(1)-command.
13%% Alternatively HTML or TexInfo code can be produced too.
14%% Output of parts of the text may be supressed using the conditional text
15%% feature.
16%%
17%% There is LaTeX package (latex2man.sty) used for writing the Man-page
18%% and a PERL script (latex2man) doing the actual translation.
19%%
20%% Copyright (C) 1998, Dr. Juergen Vollmer
21%%                     Viktoriastrasse 15, D-76133 Karlsruhe, Germany
22%%                     Juergen.Vollmer@informatik-vollmer.de
23%% License:
24%%   This program can be redistributed and/or modified under the terms
25%%   of the LaTeX Project Public License Distributed from CTAN
26%%   archives in directory macros/latex/base/lppl.txt; either
27%%   version 1 of the License, or any later version.
28%%
29%% If you find this software useful, please send me a postcard.
30%%
31%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
32
33\NeedsTeXFormat{LaTeX2e}
34\ProvidesPackage{latex2man}[2010/12/22 v1.24]
35\usepackage{ifthen}
36
37\newif\if@LM@UseFancy@
38\newif\if@LM@UseFancyHdr@
39
40\DeclareOption{fancy}{
41  \@LM@UseFancy@true
42  \@LM@UseFancyHdr@false
43}
44\DeclareOption{fancyhdr}{
45  \@LM@UseFancyHdr@true
46  \@LM@UseFancy@false
47}
48\DeclareOption{nofancy}{
49  \@LM@UseFancy@false
50  \@LM@UseFancyHdr@false
51}
52
53\input{latex2man.cfg}
54\ProcessOptions
55\if@LM@UseFancy@
56    \RequirePackage{fancyheadings}
57\fi
58\if@LM@UseFancyHdr@
59    \RequirePackage{fancyhdr}
60\fi
61
62\newcommand{\@LM@Arg}[1]{\textit{#1}}
63\newcommand{\@LM@Opt}[1]{\textbf{#1}}
64
65\newcommand{\Opt}[1]{\@LM@Opt{#1}}                      % Option
66\newcommand{\Arg}[1]{\@LM@Arg{#1}}                      % Argument
67\newcommand{\OptArg}[2]{\Opt{#1}\Arg{#2}}               % Option with Argument
68\newcommand{\OptoArg}[2]{\Opt{#1}[\Arg{#2}]}            % Option with optinal
69                                                        % Argument
70
71\newcommand{\oArg}[1]{[\Arg{#1}]}                       % optional Argument
72\newcommand{\oOpt}[1]{[\Opt{#1}]}                       % optional Option
73\newcommand{\oOptArg}[2]{[\OptArg{#1}{#2}]}             % optional Option with Argument
74\newcommand{\oOptoArg}[2]{[\OptoArg{#1}{#2}]}           % optional Option with
75                                                        % optional Argument
76
77\newcommand{\Prog}[1]{\textit{#1}}                      % Program name
78\newcommand{\Cmd}[2]{\textit{#1}(#2)}                   % Command with number
79
80\newcommand{\@LM@File}[1]{\texttt{#1}}
81\newcommand{\File}[1]{\@LM@File{#1}}                    % File name
82
83\newcommand{\Bs}{$\mathtt{\backslash}$}
84\newcommand{\Bar}{$\mathtt{|}$}
85\newcommand{\Tilde}{\ensuremath{\mathtt{\sim}}}
86\newcommand{\Dots}{$\dots$}
87\newcommand{\Circum}{\^{}}
88\newcommand{\Lbr}{[}
89\newcommand{\Rbr}{]}
90\newcommand{\LBr}{\{}
91\newcommand{\RBr}{\}}
92\newcommand{\Dollar}{\$}
93\newcommand{\Percent}{\%}
94\newcommand{\Bullet}{$\bullet$}
95\newcommand{\TEXbr}{~\\}
96\newcommand{\MANbr}{}
97\newcommand{\HTMLbr}{}
98\newcommand{\TEXIbr}{}
99\newcommand{\SP}{\hspace*{0.5em}}
100
101\def\@LM@Date{}
102\newcommand{\setDate}[1]{\def\@LM@Date{#1}}
103\newcommand{\Date}{\@LM@Date}
104
105\def\@LM@VersionWord{Version:}
106\newcommand{\setVersionWord}[1]{\def\@LM@VersionWord{#1}}
107
108\def\@LM@Version{}
109\newcommand{\setVersion}[1]{\def\@LM@Version{#1}}
110\newcommand{\Version}{\@LM@Version}
111
112\newcommand{\Email}[1]{\texttt{#1}}
113\newcommand{\URL}[1]{\texttt{#1}}
114\newcommand{\LatexManEnd}{}
115
116\newenvironment{Name}[5]{
117% #1 Chapter
118% #2 Name
119% #3 Author
120% #4 Tool
121\if@LM@UseFancy@
122\gdef\@LM@Foot{\emph{\@LM@VersionWord\ \@LM@Version, \@LM@Date}}
123\rfoot[\fancyplain{#2 (#1)}{#2 (#1)}]{\fancyplain{\@LM@Foot}{\@LM@Foot}}
124\lfoot[\fancyplain{\@LM@Foot}{\@LM@Foot}]{\fancyplain{#2 (#1)}{#2 (#1)}}
125\fi
126\if@LM@UseFancyHdr@
127\gdef\@LM@Foot{\emph{\@LM@VersionWord\ \@LM@Version, \@LM@Date}}
128\rfoot[\fancyplain{#2 (#1)}{#2 (#1)}]{\fancyplain{\@LM@Foot}{\@LM@Foot}}
129\lfoot[\fancyplain{\@LM@Foot}{\@LM@Foot}]{\fancyplain{#2 (#1)}{#2 (#1)}}
130\fi
131\title{#5}
132\author{#3}
133\date{\@LM@Date\\{\small Version \@LM@Version}}
134\maketitle
135\begin{abstract}
136}{
137\end{abstract}
138}
139
140% first optional argument specifies width of last column
141% second argrtment specifies number of columns
142\newenvironment{Table}[2][]{
143\def\OPTARG{#1}
144\def\COLUMNS{#2}
145\def\LASTCOL{}
146\def\EMPTY{}
147\ifx\OPTARG\EMPTY\else%
148 \def\COLUMNS{%
149  \ifcase#2 1\or 1\or 1\or 2\or 3\or 4\or 5\or 6\or 7\or 8\or 9\else 10\fi%
150 }
151 \def\LASTCOL{p{#1}}
152\fi%
153\par
154\begin{tabular}{*\COLUMNS{l}\LASTCOL}
155}{
156\end{tabular}
157\par
158}
159
160\newenvironment{Description}[1][]{
161\begin{list}{}{
162 \ifthenelse{\equal{#1}{}}{
163   % optional argument not given
164     \labelwidth\z@ \itemindent-\leftmargin
165     \let\makelabel\descriptionlabel
166     \renewcommand{\makelabel}[1]{\hspace\labelsep\normalfont\bfseries##1}
167  }{
168   % optional argument given
169   \settowidth{\labelwidth}{\normalfont\bfseries#1}
170   \setlength{\leftmargin}{\labelwidth}
171   \addtolength{\leftmargin}{\labelsep}
172   \renewcommand{\makelabel}[1]{\normalfont\bfseries##1\hfil}
173  }}
174}{
175\end{list}
176}
177
178\AtBeginDocument{
179\if@LM@UseFancy@
180  \pagestyle{fancyplain}
181\fi
182\if@LM@UseFancyHdr@
183  \pagestyle{fancyplain}
184\fi
185\setDate{\today}
186}
187
188%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
189\endinput
Note: See TracBrowser for help on using the repository browser.