fpc.sty 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271
  1. %
  2. % $Id$
  3. % This file is part of the FPC documentation.
  4. % Copyright (C) 1997, by Michael Van Canneyt
  5. %
  6. % The FPC documentation is free text; you can redistribute it and/or
  7. % modify it under the terms of the GNU Library General Public License as
  8. % published by the Free Software Foundation; either version 2 of the
  9. % License, or (at your option) any later version.
  10. %
  11. % The FPC Documentation is distributed in the hope that it will be useful,
  12. % but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. % MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. % Library General Public License for more details.
  15. %
  16. % You should have received a copy of the GNU Library General Public
  17. % License along with the FPC documentation; see the file COPYING.LIB. If not,
  18. % write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. % Boston, MA 02111-1307, USA.
  20. %
  21. \ProvidesPackage{fpc}[1996/12/09]
  22. \NeedsTeXFormat{LaTeX2e}
  23. \RequirePackage{multicol}
  24. \RequirePackage{epsfig}
  25. \RequirePackage{xspace}
  26. \RequirePackage{ifthen}
  27. \RequirePackage{listings}
  28. \RequirePackage{makeidx}
  29. \RequirePackage{a4}
  30. \RequirePackage{fancyhdr}
  31. \ExecuteOptions{titlepage}
  32. % Some style elements
  33. \parindent 0pt%
  34. \parskip 0.35\baselineskip%
  35. % First, all definitions for latex only.
  36. \newcommand{\docdescription}[1]{\def\@FPCDescription{#1}}
  37. \gdef\@FPCDescription{}%
  38. \newcommand{\docversion}[1]{\def\@FPCVersion{#1}}
  39. \gdef\@FPCVersion{}%
  40. % For backwards compatibility
  41. \newcommand{\unitdescription}[1]{\def\@FPCDescription{#1}}
  42. \newcommand{\unitversion}[1]{\def\@FPCVersion{#1}}
  43. \renewcommand\maketitle{\begin{titlepage}%
  44. \let\footnotesize\small
  45. \let\footnoterule\relax
  46. \null\vfil
  47. \vskip 4cm%
  48. {\noindent\raggedright\Large\@title\\}%
  49. \noindent \rule{\linewidth}{1.5mm}\\%
  50. {\raggedleft\large%
  51. \begin{tabular}[t]{r}%
  52. \@FPCDescription \\
  53. \@FPCVersion \\
  54. \@date
  55. \end{tabular}\par}%
  56. \vskip 5cm%
  57. {\noindent \large \textsf{\@author} \\%
  58. \rule{\linewidth}{0.5mm}}
  59. \@thanks
  60. \vfil\null
  61. \end{titlepage}%
  62. \setcounter{footnote}{0}%
  63. \let\thanks\relax\let\maketitle\relax
  64. \gdef\@thanks{}\gdef\@author{}\gdef\@title{}}
  65. % end of \maketitle
  66. % For the \procedure and \function commands, we don't want heading numbers.
  67. \setcounter{secnumdepth}{2}
  68. % redefine the subsection command to leave less space,
  69. %and to use sans serif
  70. \renewcommand\subsection{\@startsection%
  71. {subsection}%
  72. {2}%
  73. {\z@}%
  74. {-4.25ex\@plus -1ex \@minus -.2ex}%
  75. {1pt}%
  76. {\normalfont\large\sffamily\bfseries}}
  77. % Now, Let's define the \procedure and \function commands.
  78. \newcommand{\FPClabel}[1]{%
  79. \raggedleft\makebox[0pt][r]{\textsf{#1:}}
  80. }
  81. %
  82. % FPC environments
  83. %
  84. % Lists
  85. \newenvironment{FPCList}
  86. {\begin{list}{}{%
  87. \renewcommand{\makelabel}[1]{\FPClabel{##1}\hfil\relax}
  88. \setlength{\labelwidth}{0pt}%
  89. \setlength{\leftmargin}{0pt}}%
  90. \setlength{\labelsep}{0pt}%
  91. }
  92. {\end{list}}
  93. %
  94. % remarks
  95. %
  96. \newenvironment{remark}{\par\makebox[0pt][r]{\bfseries{}Remark:\hspace{.25em}}}{\par}
  97. % For Tables.
  98. \newenvironment{FPCtable}[2]{\begin{table}\caption{#2}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  99. % The same, but with label in third argument (tab:#3)
  100. \newenvironment{FPCltable}[3]{\begin{table}\caption{#2}\label{tab:#3}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  101. %
  102. % Refs
  103. %
  104. \newcommand{\seefl}[2]{\textsf{#1} (\pageref{fu:#2})}
  105. \newcommand{\seepl}[2]{\textsf{#1} (\pageref{pro:#2})}
  106. \newcommand{\seetypel}[2]{\textsf{#1} (\pageref{ty:#2})}
  107. \newcommand{\seeconstl}[2]{\textsf{#1} (\pageref{co:#2})}
  108. \newcommand{\seevarl}[2]{\textsf{#1} (\pageref{var:#2})}
  109. \newcommand{\seec}[1]{chapter \ref{ch:#1}, page \pageref{ch:#1}\xspace}
  110. \newcommand{\sees}[1]{section \ref{se:#1}, page \pageref{se:#1}\xspace}
  111. \newcommand{\seeo}[1]{See \ref{option:#1}\xspace}
  112. \newcommand{\seet}[1]{table (\ref{tab:#1})\xspace}
  113. %
  114. % Function/procedure environments
  115. %
  116. \newenvironment{functionl}[2]{\subsection{#1}\index{#1}\label{fu:#2}\begin{FPCList}}{\end{FPCList}}
  117. \newenvironment{procedurel}[2]{\subsection{#1}\index{#1}\label{pro:#2}\begin{FPCList}}{\end{FPCList}}
  118. \newenvironment{function}[1]{\begin{functionl}{#1}{#1}}{\end{functionl}}
  119. \newenvironment{procedure}[1]{\begin{procedurel}{#1}{#1}}{\end{procedurel}}
  120. \newenvironment{typel}[2]{\subsection{#1}\index{#1}\label{ty:#2}\begin{FPCList}}{\end{FPCList}}
  121. \newenvironment{type}[1]{\begin{typel}{#1}{#1}}{\end{typel}}
  122. \newenvironment{constantl}[2]{\subsection{#1}\index{#1}\label{co:#2}\begin{FPCList}}{\end{FPCList}}
  123. \newenvironment{constant}[1]{\begin{constantl}{#1}{#1}}{\end{constantl}}
  124. \newenvironment{variablel}[2]{\subsection{#1}\index{#1}\label{var:#2}\begin{FPCList}}{\end{FPCList}}
  125. \newenvironment{variable}[1]{\begin{variablel}{#1}{#1}}{\end{variablel}}
  126. \newcommand{\Declaration}{\item[Declaration]\ttfamily}
  127. \newcommand{\Description}{\item[Description]\rmfamily}
  128. \newcommand{\Errors}{\item[Errors]\rmfamily}
  129. \newcommand{\SeeAlso}{\item[See also]\rmfamily}
  130. %
  131. % Ref without labels
  132. %
  133. \newcommand{\seef}[1]{\seefl{#1}{#1}}
  134. \newcommand{\seep}[1]{\seepl{#1}{#1}}
  135. \newcommand{\seetype}[1]{\seetypel{#1}{#1}}
  136. \newcommand{\seevar}[1]{\seevarl{#1}{#1}}
  137. \newcommand{\seeconst}[1]{\seeconstl{#1}{#1}}
  138. %
  139. % man page references don't need labels.
  140. %
  141. \newcommand{\seem}[2]{\texttt{#1} (#2) }
  142. %
  143. % for easy typesetting of variables.
  144. %
  145. \newcommand{\var}[1]{\texttt {#1}}
  146. \newcommand{\file}[1]{\textsf {#1}}
  147. %
  148. % Useful references.
  149. %
  150. \newcommand{\progref}{\htmladdnormallink{Programmers' guide}{../prog/prog.html}\xspace}
  151. \newcommand{\refref}{\htmladdnormallink{Reference guide}{../ref/ref.html}\xspace}
  152. \newcommand{\userref}{\htmladdnormallink{Users' guide}{../user/user.html}\xspace}
  153. \newcommand{\unitsref}{\htmladdnormallink{Unit reference}{../units/units.html}\xspace}
  154. \newcommand{\seecrt}{\htmladdnormallink{CRT}{../crt/crt.html}\xspace}
  155. \newcommand{\seelinux}{\htmladdnormallink{Linux}{../linux/linux.html}\xspace}
  156. \newcommand{\seestrings}{\htmladdnormallink{strings}{../strings/strings.html}\xspace}
  157. \newcommand{\seedos}{\htmladdnormallink{DOS}{../dos/dos.html}\xspace}
  158. \newcommand{\seegetopts}{\htmladdnormallink{getopts}{../getopts/getopts.html}\xspace}
  159. \newcommand{\seeobjects}{\htmladdnormallink{objects}{../objects/objects.html}\xspace}
  160. \newcommand{\seegraph}{\htmladdnormallink{graph}{../graph/graph.html}\xspace}
  161. \newcommand{\seeprinter}{\htmladdnormallink{printer}{../printer/printer.html}\xspace}
  162. \newcommand{\seego}{\htmladdnormallink{GO32}{../go32/go32.html}\xspace}
  163. %
  164. % Commands to reference these things.
  165. %
  166. \newcommand{\olabel}[1]{\label{option:#1}}
  167. %
  168. % some OSes
  169. %
  170. \newcommand{\linux}{\textsc{linux}\xspace}
  171. \newcommand{\unix}{\textsc{unix}\xspace}
  172. \newcommand{\dos} {\textsc{dos}\xspace}
  173. \newcommand{\msdos}{\textsc{ms-dos}\xspace}
  174. \newcommand{\ostwo}{\textsc{os/2}\xspace}
  175. \newcommand{\windows}{\textsc{Windows 32-bit}\xspace}
  176. \newcommand{\windowsnt}{\textsc{Windows NT}\xspace}
  177. \newcommand{\fpc}{Free Pascal\xspace}
  178. \newcommand{\gnu}{\textsc{gnu}\xspace}
  179. \newcommand{\atari}{\textsc{Atari}\xspace}
  180. \newcommand{\amiga}{\textsc{Amiga}\xspace}
  181. \newcommand{\win}{\textsc{Win32}\xspace}
  182. \newcommand{\freebsd}{\textsc{FreeBSD}\xspace}
  183. \newcommand{\tp}{Turbo Pascal\xspace}
  184. \newcommand{\delphi}{Delphi}
  185. %
  186. % Some versions
  187. %
  188. \newcommand{\fpcversion}{1.0.2}
  189. %
  190. % PDF support
  191. %
  192. \newif\ifpdf
  193. \ifx\pdfoutput\undefined
  194. \pdffalse
  195. \else
  196. \pdfoutput=1
  197. \pdftrue
  198. \fi
  199. %
  200. % PDF stuff
  201. %
  202. \ifpdf
  203. \usepackage[pdftex,bookmarks=true]{hyperref}
  204. \usepackage{times}
  205. \usepackage[T1]{fontenc}
  206. \setcounter{secnumdepth}{1}
  207. \pdfcompresslevel=9
  208. \pdfpagewidth=210mm
  209. \pdfpageheight=297mm
  210. \fi
  211. \usepackage{html}
  212. \usepackage{htmllist}
  213. %
  214. % For examples
  215. %
  216. \latex{%
  217. \newcommand{\FPCexample}[1]{%
  218. \par \file{\textbf{Listing:} \exampledir/#1.pp}%
  219. \lstinputlisting{\exampledir/#1.pp}%
  220. }
  221. \newcommand{\Cexample}[1]{%
  222. \par \file{\textbf{Listing:} \exampledir/#1.c}%
  223. \lstinputlisting[language=c]{\exampledir/#1.c}%
  224. }
  225. }
  226. \newcommand{\exampledir}{.}
  227. \newcommand{\FPCexampledir}[1]{\renewcommand{\exampledir}{#1}}
  228. %
  229. % Categorical Function/procedure overviews
  230. %
  231. \newenvironment{funclist}{%
  232. \par
  233. \raisebox{-1em}{\makebox[\textwidth]{Name\hfill Description \hfill Page}}\\
  234. \rule{\textwidth}{1pt}
  235. \html{Name\hfill Description \hfill Page}
  236. \begin{list}{}{%
  237. \setlength{\rightmargin}{0pt}\setlength{\topsep}{0cm}\setlength{\partopsep}{0pt}%
  238. \setlength{\itemsep}{0pt}\setlength{\labelwidth}{3.5cm}%
  239. \setlength{\leftmargin}{4cm}%
  240. \renewcommand{\makelabel}[1]{\textsf{##1\hfil}}%
  241. }}%
  242. {\end{list}}
  243. \newcommand{\funcrefl}[3]{\item[#1] #3 \hfill\pageref{fu:#2}}
  244. \newcommand{\funcref}[2]{\item[#1] #2 \hfill\pageref{fu:#1}}
  245. \newcommand{\procrefl}[3]{\item[#1] #3 \hfill\pageref{pro:#2}}
  246. \newcommand{\procref}[2]{\item[#1] #2 \hfill\pageref{pro:#1}}
  247. %
  248. % Set some listings options.
  249. %
  250. \latex{%
  251. \usepackage{listings}%
  252. \lstset{language=Delphi}%
  253. \lstset{basicstyle=\sffamily\small}%
  254. \lstset{commentstyle=\itshape}%
  255. \lstset{keywordstyle=\bfseries}%
  256. \lstset{frame=tb}%
  257. }
  258. %
  259. % Page settings
  260. \setlength{\oddsidemargin}{20pt}
  261. \addtolength{\textwidth}{39pt}
  262. %
  263. % FancyHeader settings.
  264. %
  265. \pagestyle{fancy}
  266. \fancyhead[LO,RE]{}
  267. \addtolength{\headwidth}{\marginparsep}
  268. \addtolength{\headwidth}{\marginparwidth}
  269. \addtolength{\headwidth}{-59pt}
  270. %
  271. % end of fpc.sty