LATEX2MAN(1) Documentation Tools LATEX2MAN(1) [1mNAME[0m Latex2man is a tool to translate UNIX manual pages written with LaTeX- into a format understood by the UNIX [4mman[24m(1)-command. Alternatively HTML, TexInfo, or LaTeX code can be produced too. Output of parts of the text may be suppressed using the conditional text feature (for this, LaTeX generation may be used). [1mSYNOPSIS[0m latex2man [[1m-t[4m[22mtransfile[24m] [[1m-c[4m[22mCSSfile[24m] [[1m-HMTL[22m] [[1m-h[22m] [[1m-V[22m] [[1m-C[4m[22mname[24m] [[1m-a[4m[22mchar[24m] [4minfile[24m [4moutfile[0m [1mDESCRIPTION[0m Latex2man reads the file [4minfile[24m and writes [4moutfile[24m. The input must be a LaTeX document using the latex2man LaTeXpackage. Latex2man trans- lates that document into the [4mtroff[24m(1) format using the [1m-man [22mmacro pack- age. Using the [1m-H [22moption, HTML code can be produced, instead of [4mtroff[24m(1). With this option you can, optionally, specify a [4mCSSfile[24m as an argument. CSS (Cascading Style Sheets) allows you to control the appearance of the resulting HTML page. See below for the names of CSS classes that are included in the HTML tags as attributes. Using the [1m-T [22moption, TexInfo code can be produced, instead of [4mtroff[24m(1). Using the [1m-M [22moption, [4mtroff[24m(1) input is produced. Using the [1m-L [22moption, LaTeX ouput can be produced, instead of [4mtroff[24m(1). [1mOPTIONS[0m [1m-t[4m[22mtransfile[0m Translation for user defined LaTeX macros. [1m-c[4m[22mCSSfile[0m If you use the [1m-H [22myou can also specify a file that contains CSS style sheets. The link to the CSS file is inserted into the gen- eratedHTML output using the specified [4mCSSfile[24m filename. [1m-M[0m Produce output suitable for the [4mman[24m(1) command (default). [1m-H[0m Instead of producing output suitable for the [4mman[24m(1) command, HTML code is produced (despite the name of the command). [1m-T[0m Instead of producing output suitable for the [4mman[24m(1) command, TexInfo code is produced (despite the name of the command). The generated .texi-file may be processed with [4mmakeinfo[24m(1) (to pro- duce an .info-file) which in turn may be installed using [4minstall-info[24m(1). The Info tags @dircategory and @direntry are provided. [1m-L[0m The LaTeX source is written to the [4moutfile[24m. This is useful in conjunction with the [1m-C[4m[22mname[24m option. [1m-C[4m[22mname[0m Output the conditional text for [4mname[24m. If more than one name should be given use quotes: [1m-C[4m[22m'name1[24m [4mname2[24m [4m...'[0m The following names are defined automatically: [1m* -H [22mdefines HTML [1m* -T [22mdefines TEXI [1m* -M [22mdefines MAN [1m* -L [22mdefines LATEX [1m-a[4m[22mchar[0m Is used only in conjunction with -T. Background: TexInfo ignores all blanks before the first word on a new line. In order to produce some additional space before that word (using \SP) some character has to be printed before the addi- tional space. By default this is a . (dot). The [4mchar[24m specifies an alternative for that first character. Giving a blank to [1m-a[0m supresses the indentation of a line. Note: only for the first \SP of a series that [4mchar[24m is printed. [1m-h[0m Show a help text. [1m-V[0m Show version information. [1mFILES[0m latex2man.tex The LaTeX file containing this Man-page. latex2man.inc A file read with \input{..} . latex2man.sty The LaTeX package defining the environments and commands. latex2man.cfg The configuration file for Latex2man LaTeX-package. latex2man.css File containing example CSS definitions. latex2man.trans File containing example translations of user defined LaTeX macros. fancyheadings.sty A LaTeX package used to typeset head- and foot lines. fancyhdr.sty A LaTeX package used to typeset head- and foot lines. rcsinfo.sty A LaTeX package used to extract and use RCS version control information in LaTeX documents. [1mlatex2man.pdf[0m The PDF version of this document. [1mSEE ALSO[0m LaTeX,TexInfo, [4mtroff[24m(1), [4mgroff[24m(1), [4mmakeinfo[24m(1). [1mLaTeX COMMANDS[0m The LaTeX package latex2man is used to write the Man-pages with LaTeX.Since we translate into other text formats, not all LaTeX stuff can be translated. [1mPACKAGE OPTIONS[0m The latex2man package accepts the following options: fancy use the LaTeX package fancyheadings. fancyhdr use the LaTeX package fancyhdr. nofancy neither the LaTeX package fancyheadings nor fancyhdr are used. The default option may be specified in the file latex2man.cfg. [1mPACKAGE SPECIFIC ENVIRONMENTS[0m The following environments are provided by the package: \begin{Name}{chapter}{name}{author}{info}{title} The Name environment takes five arguments: 1. the Man-page chapter, 2. the name of the Man-page, 3. the author, 4. some short information about the tool printed in the footline of the Man-page, and 5. a text which is used as title, for HTML and LaTeX (it's ignored for output of the Man-page or TeXinfo. The Name environment must be the first environment in the document. Processing starts with this environment. Any text before this is ignored (exception: the setVersion and setDate commands). (Note: all arguments of \begin{Name} must be written on one line). \begin{Table}[width]{columns} The Table environment takes two arguments: the first optional one specifies a width of the last column, the second one gives the number of columns. For example: \begin{Table}[2cm]{3} Here & am & I \\\hline A 1 & A 2 & A 3 1 2 3 4 5 A 3 1 2 3 4 5 \\ B 1 & B 2 & B 3 \\ \end{Table} will be typeset as: Here am I ---------------------- A 1 A 2 A 3 1 2 3 4 5 A 3 1 2 3 4 5 B 1 B 2 B 3 If no optional [4mwidth[24m argument is given, all entries are typeset left justified. The [4mwidth[24m is a length measured absolutly in [4mcm[24m. Processing with LaTeX a p{width} column is typeset as last column. The translation to [4mtroff[24m(1) commands results in a lw(width) column specification. Translating to HTML and TexInfo ignores the [4mwidth[24m parameter. \hline may be used. If the Man-page is formatted with [4mtroff[24m(1) and tables are used, the [4mtbl[24m(1) preprocessor should be called, usually by giving a [1m-t [22mto the call of [4mtroff[24m(1). When viewing the generated manula page using [4mman[24m(1), [4mtbl[24m(1) is called automatically. \begin{Description} is the same as \begin{description} \begin{Description}[label] is similar to \begin{description}, but the item labels have at minimum the size of the (optional) word [4mlabel[24m. The difference is visible only in the DVI and PDF-output, not in the troff, TexInfo or HTML output. a |a \begin{description} ab |ab abc |abc a |a \begin{Description} ab |ab abc |abc a |a \begin{Description}[aa] ab |ab abc |abc [1mACCEPTED LaTeX ENVIRONMENTS[0m The following environments are accepted: [1m* [22mdescription [1m* [22menumerate [1m* [22mitemize [1m* [22mverbatim [1m* [22mcenter They may be nested: [1m* [22mItemize and nested center: A centered line. Another centered line. [1m* [22mAnother item an nested enumerate 1. a 2. b [1mPACKAGE SPECIFIC MACROS[0m The following commands are provided: \Opt{option} Option: \Opt{-o} will be typeset as [1m-o[22m. \Arg{argument} Argument: \Arg{filename} will be typeset as [4mfilename[24m. \OptArg{option}{argument} Option with Argument: \OptArg{-o}{filename} will be typeset as [1m-o[4m[22mfilename[24m. \OptoArg{option}{argument} Option with optional Argument: \OptoArg{-o}{filename} will be typeset as [1m-o[22m[[4mfilename[24m]. \oOpt{option} Optional option, e.g. \oOpt{-o} will be typeset as [[1m-o[22m]. \oArg{argument} Optional argument, e.g. \oArg{filename} will be typeset as [[4mfilename[24m]. \oOptArg{option}{argument} Optional option with argument, e.g. \oOptArg{-o}{filename} will be typeset as [[1m-o[4m[22mfilename[24m]. \oOptoArg{option}{argument} Optional option with optional argument, e.g. \oOptoArg{-o}{filename} will be typeset as [[1m-o[22m[[4mfilename[24m]]. \File{filename} used to typeset filenames, e.g. \File{filename} will be typeset as filename. \Prog{prog} used to typeset program names, e.g. \Prog{latex2man} will be typeset as latex2man. \Cmd{command}{chapter} used to typeset references to other commands, e.g. \Cmd{latex2man}{1} will be typeset as [4mlatex2man[24m(1). \Bar is typeset as |. \Bs (BackSlash) is typeset as \. \Tilde is typeset as a ~. \Dots is typeset as ... \Bullet us typeset as *. \setVersion{..} set .. as version information. \setVersionWord{..} set .. for the word [4mVersion:[24m in the footline. The default is \setVersionWord{Version:}. \Version returns the version information. \setDate{..} sets .. as date information. \Date returns the date information. \Email{..} use to mark an Email address: \Email{Juergen.Vollmer@informatik-vollmer.de} is typeset as: [1mJuergen.Vollmer@informatik-vollmer.de[22m. \URL{..} use to mark an URL: \URL{http://www.foo.de/\Tilde vollmer} is typeset as [1mhttp://www.foo.de/~vollmer[22m. \LatexManEnd the input file is read and processed until reading end-of-file or \LatexManEnd (at the beginning of a line). LaTeXignores this command. \Lbr, \Rbr is typeset as [ and ] (these variants are needed only somtimes like in \item[FooBar\LBr xx \Lbr]. Usually [ ] will work. \LBr, \RBr is typeset as { and } (these variants are needed when using { or } as arguments to macros. \Circum is typeset as ^. \Percent is typeset as %. \TEXbr If processed with LaTeX causes a linebreak (i.e. is equivalent to \\).In the output of latex2man this macro is ignored. \TEXIbr If TexInfo output is generated, causes a linebreak (i.e. is equivalent to \\),otherwise ignored. \MANbr If Man-Page output is generated, causes a linebreak (i.e. is equivalent to \\),otherwise ignored. \HTMLbr If HTML output is generated, causes a linebreak (i.e. is equiv- alent to \\),otherwise ignored. \medskip An empty line. \SP Produces some extra space, works also at the beginning of lines. The code of the second line looks like: \SP abc \SP\SP xx\\: abc xx abc xx abc xx Note: Due to some ``problems'' with TexInfo, the lines starting with \SP have a leading . (dot) in the TexInfo output, see [1m-a[4m[22mchar[24m. [1mACCEPTED MACROS FROM THE RCSINFO PACKAGE[0m \rcsInfo $Id ...$ if the LaTeX package rcsinfo is used, this command is used to extract the date of the Man-page. \rcsInfoLongDate if the LaTeX package rcsinfo is used, this command is used to typeset the date coded in the $Id ..$ string. [1mACCEPTED LaTeX MACROS[0m The following standard LaTeX commands are accepted: \section{..} The section macro takes one argument: the name of the Man-page section. Each Man-page consists of several sections. Usually there are the following sections in a Man-page: [4mName[24m (special handling as environment, c.f. above), [4mSynopsis[24m, [4mDescription[24m, [4mOptions[24m, [4mFiles[24m, [4mSee[24m [4mAlso[24m, [4mDiagnostics[24m, [4mReturn[24m [4mValues[24m, [4mBugs[24m, [4mAuthor[24m, [4mversion[24m, etc. [4mSynopsis[24m must be the first section after the Name environment. Note: Do not use LaTeX-macrosin section names. \subsection{..} works as well as \subsubsection{..} those. \emph{..} \emph{example} is typeset as [4mexample[24m. \textbf{..} \textbf{example} is typeset as [1mexample[22m. \texttt{..} \texttt{example} is typeset as example. \underline{..} \underline{example} is typeset as [4mexample[24m [4mof[24m [4munderline[24m . \date{..} uses .. as date. \verb+..+ but only + is allowed as delimiter. $<$ is typeset as <. $>$ is typeset as >. $<=$ is typeset as <=. $>=$ is typeset as >=. $=$ is typeset as =. $<>$ is typeset as <>. $\ge$ is typeset as $>=$. $\le$ is typeset as $<=$. $\leftarrow$ is typeset as $<--$. $\Leftarrow$ is typeset as $<==$. $\rightarrow$ is typeset as $-->$. $\Rightarrow$ is typeset as $==>$. \{ is typeset as {. \} is typeset as }. \$ is typeset as $. \$ is typeset as $,should be used inside macro arguments. \_ is typeset as _. \& is typeset as &. \# is typeset as #. \% is typeset as %. \, is typeset as smaller blank - - (between the two -) \- is used to mark hyphenation in a word. \\ is typeset as a linebreak or marks the end of a column in the Table environment. \ (a \ followed by a blank) is typeset as a blank, although it cannot be used at the beginning of a line to make indentation (see the \SP command). ~ is typeset as a blank. \copyright is typeset as (C). \noindent \hline inside a Table environment. \item inside a itemize, enumerate, or description environment. \today 25 November 2018(see also the rcsinfo LaTeXpackage). \ss,\"a, ... \ss = ß, \"a= ä, \"o= ö, \"u= ü, \"A= Ä, \"O= Ö, \"U= Ü. It is allowed to surround these macros in { and } in all places, even inside other macros, e.g. \textbf{\"a\"o\"u\"A\"O\"U\ss} \textbf{\"a}{\"o}{\"u}{\"A}{\"O}{\"U}{\ss}} \textbf{äöüÄÖÜß} [1mäöüÄÖÜß äöüÄÖÜß äöüÄÖÜß[0m If these letters are used in their LATIN-1 8-bit coding, they are translated into the equivalent letter of the desired output format. E.g. Ä becomes Ä in HTML and @"A in texinfo. \input{..} Read and process the given filename. Please note: the name of the LaTeX-macrosand its arguments must be con- tained in one line. [1mCONDITIONAL TEXT[0m latex2man preprocesses the LaTeX input to allow text to be used condi- tionally. A special sort of LaTeX comment is used for that purpose. [1m* [22m%@% IF [4mcondition[24m %@% [1m* [22m%@% ELSE %@% [1m* [22m%@% END-IF %@% A line must contain only such a comment and nothing else. [4mcondition[24m is a boolean expression containing ``names'' and operators. The names given with the [1m-C[4m[22mname[24m option have the value ``true'', while all other names occuring in the expression are assumed to be ``false''. If the evaluation of the boolean expression results in the value ``true'', the text in the ``then''-part is used and the text in the optional ``else''-part is skipped (and vice versa). The IF/ELSE/END-IF may be nested. As boolean operators the following are allowed: ( and ) for grouping are allowed. For example: %@% IF abc %@% abc set %@% IF xyz %@% xyz set %@% ELSE %@% xyz NOT set %@% END-IF %@% %@% ELSE %@% abc NOT set %@% IF xyz || !XYZ %@% xyz OR !XYZ set %@% ELSE %@% xyz OR !XYZ NOT set %@% END-IF %@% %@% END-IF %@% Run this manual page through latex2man with e.g. [1m-C[4m[22m'abc[24m [4mXYZ'[24m and have a look to the generated output. (If simply running the LaTeX-document through LaTeX,all lines are shown in the .dvi file). abc NOT set xyz OR !XYZ set To check the conditional text feature, when latex2man is called with [1m-C[4m[22mHTML[0m the lines 1a, 2b, 3b, and 4b; [1m-C[4m[22mTEXI[0m the lines 1b, 2a, 3b, and 4b; [1m-C[4m[22mMAN[0m the lines 1b, 2b, 3a, and 4b; [1m-C[4m[22mLATEX[0m the lines 1b, 2b, 3b, and 4a; calling LaTeX without preprocessing all lines should be shown: 1b. The HTML conditional was not set. 2b. The TEXI conditional was not set. 3a. This text occurs only when viewing the MAN output 4b. The LATEX conditional was not set. [1mTRANSLATION OF USER DEFINED MACROS[0m The user macro translation file (given by the [[1m-t[4m[22mtransfile[24m]) contains Perl commands specifying the translation of LaTeX macros defined by the user. These macros may have none, one or two arguments. The following code is expected: [1m* [22mComments start with a # up to the end of the line. [1m* [22mFor a macro \foo with no arguments, the following code must be specified: Translation to Man-Pages $manMacro{'foo'} = '...'; Translation to HTML $htmlMacro{'foo'} = '...'; Translation to TexInfo $texiMacro{'foo'} = '...'; where ... is the translation. [1m* [22mFor a macro \foo{..} with one argument, the following code must be specified: Translation to Man-Pages $manMacro1a{'foo'} = '...'; $manMacro1b{'foo'} = '...'; Translation to HTML $htmlMacro1a{'foo'} = '...'; $htmlMacro1b{'foo'} = '...'; Translation to TexInfo $texiMacro1a{'foo'} = '...'; $texiMacro1b{'foo'} = '...'; where ... is the translation. The 1a code is used before the argument, while 1b is typeset after the argument is set. [1m* [22mFor a macro \foo{..}{..} with two arguments, the following code must be specified: Translation to Man-Pages $manMacro2a{'foo'} = '...'; $manMacro2b{'foo'} = '...'; $manMacro2c{'foo'} = '...'; Translation to HTML $htmlMacro2a{'foo'} = '...'; $htmlMacro2b{'foo'} = '...'; $htmlMacro2c{'foo'} = '...'; Translation to TexInfo $texiMacro2a{'foo'} = '...'; $texiMacro2b{'foo'} = '...'; $texiMacro2c{'foo'} = '...'; where ... is the translation. The 2a code is used before the first argument, 2b between the two arguments and 2c is typeset after the second argument is set. [1m* [22mThe file latex2man.trans contains some example code. [1mVERBATIM ENVIRONMENT[0m This {is} \texttt{a} $test$ _of_ verbatim and no @* TexInfo command [1mSUBSECTION WORKS[0m This is a \subsection. [1mSubsubsection works[0m This is a \subsubsection. [1mSubsubsection still works[0m This is another \subsubsection. [1mGENERAL REMARKS[0m 1. Empty lines are typeset as paragraph separators. 2. The arguments of the LaTeX commands must not be split over sev- eral lines. 3. Do not nest calls to macros. 4. Except the mentioned environment and macros, the usage of other LaTeX environments or macros are not translated. Their usage will cause garbage in the output. 5. latex2man requires Perl version >= 5.0004_03. 6. If you want to install the system with the distributed Makefile, you need GNU-make. If you don't have it, you should execute the steps shown in the Makefile manually. [1mCSS CLASSNAMES[0m The table below shows the names of CSS classes that will be included in the HTML tags as attributes. You can specify the CSS style properties in the [4mCSSfile[24m for these classes: [1mHTML tag Class Style applies to[0m body the body of the HTML page h1 titlehead the title at the top of the HTML page specified as an argument to the [4mName[24m environment h4 authorhead the author at the top of the HTML page specified as an argument to the [4mName[24m environment h4 datehead the date at the top of the HTML page h4 versionhead the man page version at the top of the HTML page specified as an argument to the [4msetVersion[24m macro h2 sectionname a section title specified as an argument to the [4msection[24m macro h4 subsectionname a subsection title specified as an argument to the [4msubsection[0m macro h5 subsubsectionname a subsubsection title specified as an argument to the [4msubsubsec-[0m [4mtion[24m macro font progname a program name specified as an argument to the [4mProg[24m macro font filename a file name specified as an argu- ment to the [4mFile[24m macro font commandname a command name specified as an argument to the [4mCmd[24m macro font textstyle all text that is not an argument to some LaTeX or latex2man macro font optstyle a name of an option specified as an argument to the [4mOpt[24m, [4moOpt[24m, [4mOptArg[24m, [4moOptArg[24m or [4moOptoArg[0m macros font argstyle a name of an argument specified as an argument to the [4mArg[24m, [4moArg[24m, [4mOptArg[24m, [4moOptArg[24m or [4moOptoArg[0m macros a, font urlstyle a URL specified as an argument to the [4mURL[24m macro a, font urlstyle.link subclass of urlstyle class a, font urlstyle.visited subclass of urlstyle class a, font urlstyle.hover subclass of urlstyle class a, font emailstyle an email specified as an argument to the [4mEmail[24m macro a, font emailstyle.link subclass of emailstyle class a, font emailstyle.visited subclass of emailstyle class a, font emailstyle.hover subclass of emailstyle class table tablestyle a table specified as a [4mTable[0m environment tr rowstyle a row of a table specified as a [4mTable[24m environment td cellstyle a cell of a table specified as a [4mTable[24m environment [1mSOME BUG FIX TESTS[0m Leading . and ' Now leading . and ' in generation troff output should work prop- perly, since a \& is added. Therfore the \Dot macro has been deleted. Thanks to [1mFrank.Schilder@Mathematik.Tu-Ilmenau.De[22m. Testcase 1: '\n' ... Testcase 2: .foobar Testcase 3: ... abc ... abc . efg ' 123 %in verbatim A % in a \verb and verbatim-environment was not emitted cor- rectly. Thanks to Aleksey Nogin [1mnogin@cs.caltech.edu [22mfor the bug report and bug fix. % abc % abc % but ignore comments following this: [1mREQUIREMENTS[0m Perl latex2man requires Perl version >= 5.0004_03. Make If you want to install the system with the distributed Makefile, you need GNU-make. If you don't have it, you should execute the steps shown in the Makefile manually. LaTeX LaTeX2e is required. [1mCHANGES[0m Please check the file [1mlatex2man-CHANGES [22mfor the list of changes and acknowledgment to people contributing bugfixes or enhancements. [1mVERSION[0m Version: 1.29 of 2018/11/25. [1mLICENSE AND COPYRIGHT[0m Copyright (C)1998, Dr. Jürgen Vollmer, Am Rennbuckel 21, D-76185 Karls- ruhe, Germany, [1mJuergen.Vollmer@informatik-vollmer.de[0m The most recent version of Latex2man may be found on my homepage [1mhttp://www.informatik-vollmer.de/software/latex2man.html[22m. 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. Misc If you find this software useful, please send me a postcard from the place where you are living. [1mAUTHOR[0m Dr. Jürgen Vollmer Am Rennbuckel 21 D-76185 Karlsruhe Email: [1mJuergen.Vollmer@informatik-vollmer.de[0m WWW: [1mhttp://www.informatik-vollmer.de[22m. Documentation Tools 2018/11/25 LATEX2MAN(1)