summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/latex2man/latex2man.sty
blob: d69bfbd373468852bef6d874b6522f55203e3919 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Project:     Documentation Tools
%% Descr:       Latex -->  MAN-page (groff -man), LaTeX package
%% Author:      Dr. Jürgen Vollmer, Juergen.Vollmer@informatik-vollmer.de
%% $Id: latex2man.sty,v 1.92 2018/11/22 07:42:26 vollmer Exp $
%% VERSION: 1.28
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
%% `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
%%                     Am Rennbuckel 21, D-76185 Karlsruhe, Germany
%%                     Juergen.Vollmer@informatik-vollmer.de
%% 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}[2018/11/22 v1.28]
\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}
}

% first optional argument specifies width of last column
% second argrtment specifies number of columns
\newenvironment{Table}[2][]{
\def\OPTARG{#1}
\def\COLUMNS{#2}
\def\LASTCOL{}
\def\EMPTY{}
\ifx\OPTARG\EMPTY\else%
 \def\COLUMNS{%
  \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%
 }
 \def\LASTCOL{p{#1}}
\fi%
\par
\begin{tabular}{*\COLUMNS{l}\LASTCOL}
}{
\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