fpc.sty 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294
  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}{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. % for easy typesetting of variables.
  153. %
  154. \newcommand{\var}[1]{\texttt {#1}}
  155. \newcommand{\file}[1]{\textsf {#1}}
  156. \newcommand{\key}[1]{\textsc{#1}}
  157. \newcommand{\menu}[1]{\textbf{"#1"}}
  158. %
  159. % Useful references.
  160. %
  161. \newcommand{\progref}{\htmladdnormallink{Programmers guide}{../prog/prog.html}\xspace}
  162. \newcommand{\refref}{\htmladdnormallink{Reference guide}{../ref/ref.html}\xspace}
  163. \newcommand{\userref}{\htmladdnormallink{Users guide}{../user/user.html}\xspace}
  164. \newcommand{\unitsref}{\htmladdnormallink{Unit reference}{../units/units.html}\xspace}
  165. \newcommand{\seecrt}{\htmladdnormallink{CRT}{../crt/crt.html}\xspace}
  166. \newcommand{\seelinux}{\htmladdnormallink{Linux}{../linux/linux.html}\xspace}
  167. \newcommand{\seestrings}{\htmladdnormallink{strings}{../strings/strings.html}\xspace}
  168. \newcommand{\seedos}{\htmladdnormallink{DOS}{../dos/dos.html}\xspace}
  169. \newcommand{\seegetopts}{\htmladdnormallink{getopts}{../getopts/getopts.html}\xspace}
  170. \newcommand{\seeobjects}{\htmladdnormallink{objects}{../objects/objects.html}\xspace}
  171. \newcommand{\seegraph}{\htmladdnormallink{graph}{../graph/graph.html}\xspace}
  172. \newcommand{\seeprinter}{\htmladdnormallink{printer}{../printer/printer.html}\xspace}
  173. \newcommand{\seego}{\htmladdnormallink{GO32}{../go32/go32.html}\xspace}
  174. %
  175. % Commands to reference these things.
  176. %
  177. \newcommand{\olabel}[1]{\label{option:#1}}
  178. %
  179. % some OSes
  180. %
  181. \newcommand{\linux}{\textsc{linux}\xspace}
  182. \newcommand{\unix}{\textsc{unix}\xspace}
  183. \newcommand{\dos} {\textsc{dos}\xspace}
  184. \newcommand{\msdos}{\textsc{ms-dos}\xspace}
  185. \newcommand{\ostwo}{\textsc{os/2}\xspace}
  186. \newcommand{\windows}{\textsc{Windows}\xspace}
  187. \newcommand{\windowsnt}{\textsc{Windows NT}\xspace}
  188. \newcommand{\fpc}{Free Pascal\xspace}
  189. \newcommand{\gnu}{\textsc{gnu}\xspace}
  190. \newcommand{\atari}{\textsc{Atari}\xspace}
  191. \newcommand{\amiga}{\textsc{Amiga}\xspace}
  192. \newcommand{\solaris}{\textsc{Solaris}\xspace}
  193. \newcommand{\qnx}{\textsc{QNX Realtime platform}\xspace}
  194. \newcommand{\beos}{\textsc{BeOS}\xspace}
  195. \newcommand{\palmos}{\textsc{PalmOS}\xspace}
  196. \newcommand{\netbsd}{\textsc{NetBSD}\xspace}
  197. \newcommand{\win}{\textsc{Win32}\xspace}
  198. \newcommand{\freebsd}{\textsc{FreeBSD}\xspace}
  199. \newcommand{\tp}{Turbo Pascal\xspace}
  200. \newcommand{\delphi}{Delphi}
  201. %
  202. % Some versions
  203. %
  204. \newcommand{\fpcversion}{1.0.6}
  205. %
  206. % PDF support
  207. %
  208. \newif\ifpdf
  209. \ifx\pdfoutput\undefined
  210. \pdffalse
  211. \else
  212. \pdfoutput=1
  213. \pdftrue
  214. \fi
  215. %
  216. % PDF stuff
  217. %
  218. \ifpdf
  219. \usepackage[pdftex,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  220. \usepackage{times}
  221. \usepackage[T1]{fontenc}
  222. \setcounter{secnumdepth}{1}
  223. \setcounter{tocdepth}{3}
  224. \pdfcompresslevel=9
  225. \pdfpagewidth=210mm
  226. \pdfpageheight=297mm
  227. \else
  228. \usepackage[dvips,bookmarks=true,colorlinks=true,linkcolor=blue]{hyperref}
  229. \fi
  230. %
  231. % Fake Latex2Html support, so latex2html is not required
  232. %
  233. \RequirePackage{fakehtml}
  234. %
  235. % For examples
  236. %
  237. \latex{%
  238. \newcommand{\FPCexample}[1]{%
  239. \par \file{\textbf{Listing:} \exampledir/#1.pp}%
  240. \lstinputlisting{\exampledir/#1.pp}%
  241. }
  242. \newcommand{\Cexample}[1]{%
  243. \par \file{\textbf{Listing:} \exampledir/#1.c}%
  244. \lstinputlisting[language=c]{\exampledir/#1.c}%
  245. }
  246. }
  247. \newcommand{\exampledir}{.}
  248. \newcommand{\FPCexampledir}[1]{\renewcommand{\exampledir}{#1}}
  249. %
  250. % Categorical Function/procedure overviews
  251. %
  252. \newenvironment{funclist}{%
  253. \par
  254. \raisebox{-1em}{\makebox[\textwidth]{Name\hfill Description \hfill Page}}\\
  255. \rule{\textwidth}{1pt}
  256. \html{Name\hfill Description \hfill Page}
  257. \begin{list}{}{%
  258. \setlength{\rightmargin}{0pt}\setlength{\topsep}{0cm}\setlength{\partopsep}{0pt}%
  259. \setlength{\itemsep}{0pt}\setlength{\labelwidth}{3.5cm}%
  260. \setlength{\leftmargin}{4cm}%
  261. \renewcommand{\makelabel}[1]{\textsf{##1\hfil}}%
  262. }}%
  263. {\end{list}}
  264. \newcommand{\funcrefl}[3]{\item[#1] #3 \hfill\pageref{fu:#2}}
  265. \newcommand{\funcref}[2]{\item[#1] #2 \hfill\pageref{fu:#1}}
  266. \newcommand{\procrefl}[3]{\item[#1] #3 \hfill\pageref{pro:#2}}
  267. \newcommand{\procref}[2]{\item[#1] #2 \hfill\pageref{pro:#1}}
  268. %
  269. % Set some listings options.
  270. %
  271. \latex{%
  272. \usepackage{listings}%
  273. \lstset{language=Delphi}%
  274. \lstset{basicstyle=\sffamily\small}%
  275. \lstset{commentstyle=\itshape}%
  276. \lstset{keywordstyle=\bfseries}%
  277. \lstset{frame=tb}%
  278. % \lstset{stringspaces=false}%
  279. }
  280. %
  281. % Page settings
  282. \setlength{\oddsidemargin}{20pt}
  283. \addtolength{\textwidth}{39pt}
  284. %
  285. % FancyHeader settings.
  286. %
  287. \pagestyle{fancy}
  288. \fancyhead[LO,RE]{}
  289. \addtolength{\headwidth}{\marginparsep}
  290. \addtolength{\headwidth}{\marginparwidth}
  291. \addtolength{\headwidth}{-59pt}
  292. %
  293. % end of fpc.sty