fpc.sty 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341
  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. Document version \@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}{1}
  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}[ht!]\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}[ht]\caption{#2}\label{tab:#3}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  101. %
  102. % Refs
  103. %
  104. \newcommand{\seefig}[1]{figure (\ref{fig:#1})\xspace}
  105. \newcommand{\seefl}[2]{\textsf{#1} (\pageref{fu:#2})}
  106. \newcommand{\seepl}[2]{\textsf{#1} (\pageref{pro:#2})}
  107. \newcommand{\seetypel}[2]{\textsf{#1} (\pageref{ty:#2})}
  108. \newcommand{\seeconstl}[2]{\textsf{#1} (\pageref{co:#2})}
  109. \newcommand{\seevarl}[2]{\textsf{#1} (\pageref{var:#2})}
  110. \newcommand{\seec}[1]{chapter \ref{ch:#1}, page \pageref{ch:#1}\xspace}
  111. \newcommand{\sees}[1]{section \ref{se:#1}, page \pageref{se:#1}\xspace}
  112. \newcommand{\seeo}[1]{\var{-#1}, (see page \ref{option:#1})\xspace}
  113. \newcommand{\seet}[1]{table (\ref{tab:#1})\xspace}
  114. %
  115. % Function/procedure environments
  116. %
  117. \newenvironment{functionl}[2]{\subsection{#1}\index{#1}\label{fu:#2}\begin{FPCList}}{\end{FPCList}}
  118. \newenvironment{procedurel}[2]{\subsection{#1}\index{#1}\label{pro:#2}\begin{FPCList}}{\end{FPCList}}
  119. \newenvironment{method}[2]{\subsection{#1}\index{#1}\label{#2}\begin{FPCList}}{\end{FPCList}}
  120. \newenvironment{property}[2]{\subsection{#1}\index{#1}\label{#2}\begin{FPCList}}{\end{FPCList}}
  121. \newenvironment{function}[1]{\begin{functionl}{#1}{#1}}{\end{functionl}}
  122. \newenvironment{procedure}[1]{\begin{procedurel}{#1}{#1}}{\end{procedurel}}
  123. \newenvironment{typel}[2]{\subsection{#1}\index{#1}\label{ty:#2}\begin{FPCList}}{\end{FPCList}}
  124. \newenvironment{type}[1]{\begin{typel}{#1}{#1}}{\end{typel}}
  125. \newenvironment{constantl}[2]{\subsection{#1}\index{#1}\label{co:#2}\begin{FPCList}}{\end{FPCList}}
  126. \newenvironment{constant}[1]{\begin{constantl}{#1}{#1}}{\end{constantl}}
  127. \newenvironment{variablel}[2]{\subsection{#1}\index{#1}\label{var:#2}\begin{FPCList}}{\end{FPCList}}
  128. \newenvironment{variable}[1]{\begin{variablel}{#1}{#1}}{\end{variablel}}
  129. \newenvironment{ver2}{\par\textbf{version 2.0 only:}}{\par}
  130. \newcommand{\Declaration}{\item[Declaration]\ttfamily}
  131. \newcommand{\Description}{\item[Description]\rmfamily}
  132. \newcommand{\Portability}{\item[Portability]\rmfamily}
  133. \newcommand{\Errors}{\item[Errors]\rmfamily}
  134. \newcommand{\Visibility}{\item[Visibility]\rmfamily}
  135. \newcommand{\Access}{\item[Access]\rmfamily}
  136. \newcommand{\Synopsis}{\item[Synopsis]\rmfamily}
  137. \newcommand{\Arguments}{\item[Arguments]\rmfamily}
  138. \newcommand{\SeeAlso}{\item[See also]\rmfamily}
  139. %
  140. % Ref without labels
  141. %
  142. \newcommand{\seef}[1]{\seefl{#1}{#1}}
  143. \newcommand{\seep}[1]{\seepl{#1}{#1}}
  144. \newcommand{\seetype}[1]{\seetypel{#1}{#1}}
  145. \newcommand{\seevar}[1]{\seevarl{#1}{#1}}
  146. \newcommand{\seeconst}[1]{\seeconstl{#1}{#1}}
  147. %
  148. % man page references don't need labels.
  149. %
  150. \newcommand{\seem}[2]{\texttt{#1} (#2) }
  151. %
  152. % HTML references
  153. %
  154. \newcommand{\seeurl}[2]{\htmladdnormallink{#1}{#2}}
  155. %
  156. % for easy typesetting of variables.
  157. %
  158. \newcommand{\var}[1]{\texttt {#1}}
  159. \newcommand{\file}[1]{\textsf {#1}}
  160. \newcommand{\key}[1]{\textsc{#1}}
  161. \newcommand{\menu}[1]{\textbf{"#1"}}
  162. %
  163. % Useful references.
  164. %
  165. \newcommand{\progref}{\htmladdnormallink{Programmers guide}{../prog/prog.html}\xspace}
  166. \newcommand{\fpdocref}{\htmladdnormallink{FPDoc reference guide}{../fpdoc/fpfoc.html}\xspace}
  167. \newcommand{\refref}{\htmladdnormallink{Reference guide}{../ref/ref.html}\xspace}
  168. \newcommand{\userref}{\htmladdnormallink{Users guide}{../user/user.html}\xspace}
  169. \newcommand{\unitsref}{\htmladdnormallink{Unit reference}{../units/units.html}\xspace}
  170. \newcommand{\seecrt}{\htmladdnormallink{CRT}{../crt/crt.html}\xspace}
  171. \newcommand{\seelinux}{\htmladdnormallink{Linux}{../linux/linux.html}\xspace}
  172. \newcommand{\seestrings}{\htmladdnormallink{strings}{../strings/strings.html}\xspace}
  173. \newcommand{\seedos}{\htmladdnormallink{DOS}{../dos/dos.html}\xspace}
  174. \newcommand{\seegetopts}{\htmladdnormallink{getopts}{../getopts/getopts.html}\xspace}
  175. \newcommand{\seeobjects}{\htmladdnormallink{objects}{../objects/objects.html}\xspace}
  176. \newcommand{\seegraph}{\htmladdnormallink{graph}{../graph/graph.html}\xspace}
  177. \newcommand{\seeprinter}{\htmladdnormallink{printer}{../printer/printer.html}\xspace}
  178. \newcommand{\seego}{\htmladdnormallink{GO32}{../go32/go32.html}\xspace}
  179. %
  180. % Commands to reference these things.
  181. %
  182. \newcommand{\olabel}[1]{\label{option:#1}}
  183. %
  184. % some OSes
  185. %
  186. \newcommand{\linux}{\textsc{linux}\xspace}
  187. \newcommand{\unix}{\textsc{unix}\xspace}
  188. \newcommand{\dos} {\textsc{dos}\xspace}
  189. \newcommand{\msdos}{\textsc{ms-dos}\xspace}
  190. \newcommand{\ostwo}{\textsc{os/2}\xspace}
  191. \newcommand{\windows}{\textsc{Windows}\xspace}
  192. \newcommand{\windowsnt}{\textsc{Windows NT}\xspace}
  193. \newcommand{\macos}{{Mac OS}\xspace}
  194. \newcommand{\fpc}{Free Pascal\xspace}
  195. \newcommand{\gnu}{\textsc{gnu}\xspace}
  196. \newcommand{\atari}{\textsc{Atari}\xspace}
  197. \newcommand{\amiga}{\textsc{Amiga}\xspace}
  198. \newcommand{\solaris}{\textsc{Solaris}\xspace}
  199. \newcommand{\netware}{\textsc{Netware}\xspace}
  200. \newcommand{\qnx}{\textsc{QNX Realtime platform}\xspace}
  201. \newcommand{\beos}{\textsc{BeOS}\xspace}
  202. \newcommand{\palmos}{\textsc{PalmOS}\xspace}
  203. \newcommand{\netbsd}{\textsc{NetBSD}\xspace}
  204. \newcommand{\openbsd}{\textsc{OpenBSD}\xspace}
  205. \newcommand{\win}{\textsc{Win32}\xspace}
  206. \newcommand{\freebsd}{\textsc{FreeBSD}\xspace}
  207. \newcommand{\tp}{Turbo Pascal\xspace}
  208. \newcommand{\delphi}{Delphi}
  209. %
  210. % Some versions
  211. %
  212. \newcommand{\fpcversion}{1.9.6}
  213. %
  214. % PDF support
  215. %
  216. \newif\ifpdf
  217. \ifx\pdfoutput\undefined
  218. \pdffalse
  219. \else
  220. \pdfoutput=1
  221. \pdftrue
  222. \fi
  223. %
  224. % PDF stuff
  225. %
  226. \ifpdf
  227. \usepackage[pdftex,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  228. \usepackage{times}
  229. \usepackage[T1]{fontenc}
  230. \setcounter{secnumdepth}{1}
  231. \setcounter{tocdepth}{3}
  232. \pdfcompresslevel=9
  233. \pdfpagewidth=210mm
  234. \pdfpageheight=297mm
  235. \else
  236. \makeatletter
  237. \@ifpackageloaded{tex4ht}{%
  238. \usepackage[tex4ht,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  239. }{%
  240. \usepackage[dvips,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  241. }%
  242. \makeatother
  243. \fi
  244. %
  245. % Fake Latex2Html support, so latex2html is not required
  246. %
  247. \RequirePackage{fakehtml}
  248. %
  249. % For examples
  250. %
  251. \makeatletter
  252. \@ifpackageloaded{tex4ht}{%
  253. \newcommand{\FPCexample}[1]{
  254. \par \file{\textbf{Listing:} \exampledir/#1.pp}%
  255. \HCode{<HR/>}%
  256. \listinginput[9999]{5000}{\exampledir/#1.pp}%
  257. \HCode{<HR/>}%
  258. }%
  259. \newcommand{\Cexample}[1]{
  260. \par \file{\textbf{Listing:} \exampledir/#1.pp}%
  261. \listinginput[9999]{5000}{\exampledir/#1.c}%
  262. }
  263. }{% else ifpackageloaded
  264. \newcommand{\FPCexample}[1]{%
  265. \par \file{\textbf{Listing:} \exampledir/#1.pp}%
  266. \lstinputlisting{\exampledir/#1.pp}%
  267. }% End of FPCExample
  268. \newcommand{\Cexample}[1]{%
  269. \par \file{\textbf{Listing:} \exampledir/#1.c}%
  270. \lstinputlisting[language=c]{\exampledir/#1.c}%
  271. }% End of CExample
  272. }% End of ifpackageloaded.
  273. \makeatother
  274. \newcommand{\exampledir}{.}
  275. \newcommand{\FPCexampledir}[1]{\renewcommand{\exampledir}{#1}}
  276. %
  277. % Picture including
  278. %
  279. \newcommand{\FPCpic}[3]{%
  280. \begin{figure}[ht]%
  281. \begin{center}
  282. \caption{#1}%
  283. \label{fig:#3}%
  284. \ifpdf%
  285. \epsfig{file=pics/#2/#3.png,width=\textwidth}%
  286. \else%
  287. \epsfig{file=pics/#2/#3.eps,width=\textwidth}%
  288. \fi%
  289. \end{center}
  290. \end{figure}%
  291. }
  292. %
  293. % Categorical Function/procedure overviews
  294. %
  295. \newenvironment{funclist}{%
  296. \par
  297. \raisebox{-1em}{\makebox[\textwidth]{Name\hfill Description \hfill Page}}\\
  298. \rule{\textwidth}{1pt}
  299. \html{Name\hfill Description \hfill Page}
  300. \begin{list}{}{%
  301. \setlength{\rightmargin}{0pt}\setlength{\topsep}{0cm}\setlength{\partopsep}{0pt}%
  302. \setlength{\itemsep}{0pt}\setlength{\labelwidth}{3.5cm}%
  303. \setlength{\leftmargin}{4cm}%
  304. \renewcommand{\makelabel}[1]{\textsf{##1\hfil}}%
  305. }}%
  306. {\end{list}}
  307. \newcommand{\funcrefl}[3]{\item[#1] #3 \hfill\pageref{fu:#2}}
  308. \newcommand{\funcref}[2]{\item[#1] #2 \hfill\pageref{fu:#1}}
  309. \newcommand{\procrefl}[3]{\item[#1] #3 \hfill\pageref{pro:#2}}
  310. \newcommand{\procref}[2]{\item[#1] #2 \hfill\pageref{pro:#1}}
  311. %
  312. % Set some listings options.
  313. %
  314. \makeatletter
  315. \@ifpackageloaded{tex4ht}{%
  316. \usepackage{moreverb}
  317. }{%
  318. \usepackage{listings}%
  319. \lstset{language=Delphi}%
  320. \lstset{basicstyle=\sffamily\small}%
  321. \lstset{commentstyle=\itshape}%
  322. \lstset{keywordstyle=\bfseries}%
  323. \lstset{frame=tb}%
  324. \lstset{showstringspaces=false}%
  325. }
  326. \makeatother
  327. %
  328. % Page settings
  329. \setlength{\oddsidemargin}{20pt}
  330. \addtolength{\textwidth}{39pt}
  331. %
  332. % FancyHeader settings.
  333. %
  334. \pagestyle{fancy}
  335. \fancyhead[LO,RE]{}
  336. \addtolength{\headwidth}{\marginparsep}
  337. \addtolength{\headwidth}{\marginparwidth}
  338. \addtolength{\headwidth}{-59pt}
  339. %
  340. % end of fpc.sty