| 1 |
## Add some extra definitions. |
| 2 |
1a\ |
| 3 |
\\let\\asis=\\relax |
| 4 |
|
| 5 |
## Remove all lines we neither need nor want. |
| 6 |
/^\\input /d |
| 7 |
/^@anchor/d |
| 8 |
/^@bye/d |
| 9 |
/^@documentencoding/d |
| 10 |
/^@node/d |
| 11 |
/^@setfilename/d |
| 12 |
/^@settitle/d |
| 13 |
/^@top/d |
| 14 |
/@menu/,/@end menu/d |
| 15 |
|
| 16 |
## Convert sectioning macros to our own hierarchy. |
| 17 |
s/^@chapter \(.*\)$/\\subsection{\\titlecase{\1}\\label{\1}}/ |
| 18 |
s/^@section \(.*\)$/\\subsubsection{\\titlecase{\1}}\\label{\1}/ |
| 19 |
|
| 20 |
## Make `@asis' list resemble the Texinfo format. |
| 21 |
s/@table @asis/\\begin{list}{}{\\itemindent=-20pt\\leftmargin=20pt}/ |
| 22 |
s/@end table/\\end{list}/ |
| 23 |
|
| 24 |
## We substitute our `widebody' environment for `@display'. |
| 25 |
s/@display/\\begin{widebody}/ |
| 26 |
s/@end display/\\end{widebody}/ |
| 27 |
|
| 28 |
## Translate `@example' environments. |
| 29 |
s/@example/\\begin{quote}\\tt\\obeylines/ |
| 30 |
s/@end example/\\end{quote}\n\n/ |
| 31 |
|
| 32 |
## Indenting by four spaces generates a `verbatim' environment. |
| 33 |
s/@verbatim/\\begin{verbatim}/ |
| 34 |
s/@end verbatim/\\end{verbatim}/ |
| 35 |
|
| 36 |
## The argument format of the URL macro is different. |
| 37 |
s/@url{\([^,]*\), \([^}]*\)}/\\href{\1}{\2}/g |
| 38 |
|
| 39 |
## Use our own markup. |
| 40 |
s/\.\.\./\\dots{}/g |
| 41 |
s/LaTeX/\\LaTeX{}/g |
| 42 |
s/@file/\\emph/g |
| 43 |
s/@strong/\\textbf/g |
| 44 |
s/@var/\\emph/g |
| 45 |
s/[w]{/mbox{/g |
| 46 |
|
| 47 |
## Translate some Texinfo macros. |
| 48 |
s/@backslashchar/\\char`\\\\/g |
| 49 |
s/@lbracechar/\\{/g |
| 50 |
s/@noindent/\\noindent/g |
| 51 |
s/@rbracechar/\\}/g |
| 52 |
|
| 53 |
## Quote some special characters. |
| 54 |
s/%/\\%/g |
| 55 |
s/_/\\_/g |
| 56 |
|
| 57 |
## Add space around alternative-indicators. |
| 58 |
s/[|]/\\,|\\,/g |
| 59 |
|
| 60 |
## Adapt to how a man-page is typeset. |
| 61 |
## En-dashes in front of long options really suck! |
| 62 |
s/--/-\\nolig*-/g |
| 63 |
|
| 64 |
## Converting the at-signs to backslashes is a bit tricky. |
| 65 |
s/^@item/\\item/ |
| 66 |
s/@\([A-Za-z][A-Za-z]*\){/\\\1{/g |
| 67 |
s/@@/@/g |
| 68 |
|
| 69 |
## Convert selected macro names. |
| 70 |
s/\\jobname/\\textbackslash jobname/g |
| 71 |
|
| 72 |
## Make qualified Perl names breakable. |
| 73 |
s/::/::\\breakpoint*/g |