fpc.sty 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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{xspace}
  24. \RequirePackage{ifthen}
  25. \RequirePackage{listings}
  26. \RequirePackage{makeidx}
  27. \RequirePackage{a4}
  28. \RequirePackage{fancyhdr}
  29. \ExecuteOptions{titlepage}
  30. % Some style elements
  31. \parindent 0pt%
  32. \parskip 0.35\baselineskip%
  33. % First, all definitions for latex only.
  34. \newcommand{\docdescription}[1]{\def\@FPCDescription{#1}}
  35. \gdef\@FPCDescription{}%
  36. \newcommand{\docversion}[1]{\def\@FPCVersion{#1}}
  37. \gdef\@FPCVersion{}%
  38. % For backwards compatibility
  39. \newcommand{\unitdescription}[1]{\def\@FPCDescription{#1}}
  40. \newcommand{\unitversion}[1]{\def\@FPCVersion{#1}}
  41. \renewcommand\maketitle{\begin{titlepage}%
  42. \let\footnotesize\small
  43. \let\footnoterule\relax
  44. \null\vfil
  45. \vskip 4cm%
  46. {\noindent\raggedright\Large\@title\\}%
  47. \noindent \rule{\linewidth}{1.5mm}\\%
  48. {\raggedleft\large%
  49. \begin{tabular}[t]{r}%
  50. \@FPCDescription \\
  51. \@FPCVersion \\
  52. \@date
  53. \end{tabular}\par}%
  54. \vskip 5cm%
  55. {\noindent \large \textsf{\@author} \\%
  56. \rule{\linewidth}{0.5mm}}
  57. \@thanks
  58. \vfil\null
  59. \end{titlepage}%
  60. \setcounter{footnote}{0}%
  61. \let\thanks\relax\let\maketitle\relax
  62. \gdef\@thanks{}\gdef\@author{}\gdef\@title{}}
  63. % end of \maketitle
  64. % For the \procedure and \function commands, we don't want heading numbers.
  65. \setcounter{secnumdepth}{1}
  66. % redefine the subsection command to leave less space,
  67. %and to use sans serif
  68. \renewcommand\subsection{\@startsection%
  69. {subsection}%
  70. {2}%
  71. {\z@}%
  72. {-4.25ex\@plus -1ex \@minus -.2ex}%
  73. {1pt}%
  74. {\normalfont\large\sffamily\bfseries}}
  75. % Now, Let's define the \procedure and \function commands.
  76. \newcommand{\FPClabel}[1]{%
  77. \raggedleft\makebox[0pt][r]{\textsf{#1:}}
  78. }
  79. %
  80. % FPC environments
  81. %
  82. % Lists
  83. \newenvironment{FPCList}
  84. {\begin{list}{}{%
  85. \renewcommand{\makelabel}[1]{\FPClabel{##1}\hfil\relax}
  86. \setlength{\labelwidth}{0pt}%
  87. \setlength{\leftmargin}{0pt}}%
  88. \setlength{\labelsep}{0pt}%
  89. }
  90. {\end{list}}
  91. %
  92. % remarks
  93. %
  94. \newenvironment{remark}{\par\makebox[0pt][r]{\bfseries{}Remark:\hspace{.25em}}}{\par}
  95. % For Tables.
  96. \newenvironment{FPCtable}[2]{\begin{table}\caption{#2}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  97. % The same, but with label in third argument (tab:#3)
  98. \newenvironment{FPCltable}[3]{\begin{table}\caption{#2}\label{tab:#3}\begin{center}\begin{tabular}{#1}}{\end{tabular}\end{center}\end{table}}
  99. %
  100. % Refs
  101. %
  102. \newcommand{\seefl}[2]{\textsf{#1} (\pageref{fu:#2})}
  103. \newcommand{\seepl}[2]{\textsf{#1} (\pageref{pro:#2})}
  104. \newcommand{\seetypel}[2]{\textsf{#1} (\pageref{ty:#2})}
  105. \newcommand{\seeconstl}[2]{\textsf{#1} (\pageref{co:#2})}
  106. \newcommand{\seevarl}[2]{\textsf{#1} (\pageref{var:#2})}
  107. \newcommand{\seec}[1]{chapter \ref{ch:#1}, page \pageref{ch:#1}\xspace}
  108. \newcommand{\sees}[1]{section \ref{se:#1}, page \pageref{se:#1}\xspace}
  109. \newcommand{\seeo}[1]{See \ref{option:#1}\xspace}
  110. \newcommand{\seet}[1]{table (\ref{tab:#1})\xspace}
  111. %
  112. % Function/procedure environments
  113. %
  114. \newenvironment{functionl}[2]{\subsection{#1}\index{#1}\label{fu:#2}\begin{FPCList}}{\end{FPCList}}
  115. \newenvironment{procedurel}[2]{\subsection{#1}\index{#1}\label{pro:#2}\begin{FPCList}}{\end{FPCList}}
  116. \newenvironment{function}[1]{\begin{functionl}{#1}{#1}}{\end{functionl}}
  117. \newenvironment{procedure}[1]{\begin{procedurel}{#1}{#1}}{\end{procedurel}}
  118. \newenvironment{typel}[2]{\subsection{#1}\index{#1}\label{ty:#2}\begin{FPCList}}{\end{FPCList}}
  119. \newenvironment{type}[1]{\begin{typel}{#1}{#1}}{\end{typel}}
  120. \newenvironment{constantl}[2]{\subsection{#1}\index{#1}\label{co:#2}\begin{FPCList}}{\end{FPCList}}
  121. \newenvironment{constant}[1]{\begin{constantl}{#1}{#1}}{\end{constantl}}
  122. \newenvironment{variablel}[2]{\subsection{#1}\index{#1}\label{var:#2}\begin{FPCList}}{\end{FPCList}}
  123. \newenvironment{variable}[1]{\begin{variablel}{#1}{#1}}{\end{variablel}}
  124. \newcommand{\Declaration}{\item[Declaration]\ttfamily}
  125. \newcommand{\Description}{\item[Description]\rmfamily}
  126. \newcommand{\Errors}{\item[Errors]\rmfamily}
  127. \newcommand{\SeeAlso}{\item[See also]\rmfamily}
  128. %
  129. % Ref without labels
  130. %
  131. \newcommand{\seef}[1]{\seefl{#1}{#1}}
  132. \newcommand{\seep}[1]{\seepl{#1}{#1}}
  133. \newcommand{\seetype}[1]{\seetypel{#1}{#1}}
  134. \newcommand{\seevar}[1]{\seevarl{#1}{#1}}
  135. \newcommand{\seeconst}[1]{\seeconstl{#1}{#1}}
  136. %
  137. % man page references don't need labels.
  138. %
  139. \newcommand{\seem}[2]{\texttt{#1} (#2) }
  140. %
  141. % for easy typesetting of variables.
  142. %
  143. \newcommand{\var}[1]{\texttt {#1}}
  144. \newcommand{\file}[1]{\textsf {#1}}
  145. %
  146. % Useful references.
  147. %
  148. \newcommand{\progref}{\htmladdnormallink{Programmers' guide}{../prog/prog.html}\xspace}
  149. \newcommand{\refref}{\htmladdnormallink{Reference guide}{../ref/ref.html}\xspace}
  150. \newcommand{\userref}{\htmladdnormallink{Users' guide}{../user/user.html}\xspace}
  151. \newcommand{\unitsref}{\htmladdnormallink{Unit reference}{../units/units.html}\xspace}
  152. \newcommand{\seecrt}{\htmladdnormallink{CRT}{../crt/crt.html}\xspace}
  153. \newcommand{\seelinux}{\htmladdnormallink{Linux}{../linux/linux.html}\xspace}
  154. \newcommand{\seestrings}{\htmladdnormallink{strings}{../strings/strings.html}\xspace}
  155. \newcommand{\seedos}{\htmladdnormallink{DOS}{../dos/dos.html}\xspace}
  156. \newcommand{\seegetopts}{\htmladdnormallink{getopts}{../getopts/getopts.html}\xspace}
  157. \newcommand{\seeobjects}{\htmladdnormallink{objects}{../objects/objects.html}\xspace}
  158. \newcommand{\seegraph}{\htmladdnormallink{graph}{../graph/graph.html}\xspace}
  159. \newcommand{\seeprinter}{\htmladdnormallink{printer}{../printer/printer.html}\xspace}
  160. \newcommand{\seego}{\htmladdnormallink{GO32}{../go32/go32.html}\xspace}
  161. %
  162. % Commands to reference these things.
  163. %
  164. \newcommand{\olabel}[1]{\label{option:#1}}
  165. %
  166. % some OSes
  167. %
  168. \newcommand{\linux}{\textsc{linux}\xspace}
  169. \newcommand{\dos} {\textsc{dos}\xspace}
  170. \newcommand{\msdos}{\textsc{ms-dos}\xspace}
  171. \newcommand{\ostwo}{\textsc{os/2}\xspace}
  172. \newcommand{\windows}{\textsc{Windows}\xspace}
  173. \newcommand{\windowsnt}{\textsc{Windows NT}\xspace}
  174. \newcommand{\fpc}{Free Pascal\xspace}
  175. \newcommand{\gnu}{\textsc{gnu}\xspace}
  176. \newcommand{\atari}{\textsc{Atari}\xspace}
  177. \newcommand{\amiga}{\textsc{Amiga}\xspace}
  178. \newcommand{\win}{\textsc{Win32}\xspace}
  179. \newcommand{\freebsd}{\textsc{FreeBSD}\xspace}
  180. %
  181. % Some versions
  182. %
  183. \newcommand{\fpcversion}{0.99.14}
  184. %
  185. % PDF support
  186. %
  187. \latex{%
  188. \newif\ifpdf
  189. \ifx\pdfoutput\undefined
  190. \pdffalse
  191. \else
  192. \pdfoutput=1
  193. \pdftrue
  194. \fi
  195. }
  196. %
  197. % For examples
  198. %
  199. \newcommand{\FPCexample}[1]{%
  200. \latex{\lstinputlisting{\exampledir/#1.pp}}\html{\input{\exampledir/#1.tex}}}
  201. \newcommand{\exampledir}{.}
  202. \newcommand{\FPCexampledir}[1]{\renewcommand{\exampledir}{#1}}
  203. %
  204. % Set some listings options.
  205. %
  206. \usepackage{listings}%
  207. \lstset{language=Delphi}%
  208. \lstset{pre=\sffamily\small}%
  209. \lstset{keywordstyle=\bfseries}%
  210. \lstset{blankstring=true}%
  211. %
  212. % Page settings
  213. \setlength{\oddsidemargin}{20pt}
  214. \addtolength{\textwidth}{39pt}
  215. %
  216. % FancyHeader settings.
  217. %
  218. \pagestyle{fancy}
  219. \fancyhead[LO,RE]{}
  220. \addtolength{\headwidth}{\marginparsep}
  221. \addtolength{\headwidth}{\marginparwidth}
  222. \addtolength{\headwidth}{-59pt}
  223. %
  224. % PDF stuff
  225. %
  226. \ifpdf
  227. % \usepackage[pdftex,bookmarks=true]{hyperref}
  228. \usepackage{times}
  229. \usepackage[T1]{fontenc}
  230. \pdfcompresslevel=9
  231. \pdfpagewidth=210mm
  232. \pdfpageheight=297mm
  233. \fi
  234. %
  235. % end of fpc.sty