2
% This is coqdoc.sty, by Jean-Christophe Filli�tre
3
% This LaTeX package is used by coqdoc (http://www.lri.fr/~filliatr/coqdoc)
5
% You can modify the following macros to customize the appearance
8
\NeedsTeXFormat{LaTeX2e}
9
\ProvidesPackage{coqdoc}[2002/02/11]
12
% \usepackage{fancyhdr}
13
% \newcommand{\coqdocleftpageheader}{\thepage\ -- \today}
14
% \newcommand{\coqdocrightpageheader}{\today\ -- \thepage}
15
% \pagestyle{fancyplain}
19
% \renewcommand{\plainheadrulewidth}{0.4pt}
20
% \renewcommand{\plainfootrulewidth}{0pt}
21
% \lhead[\coqdocleftpageheader]{\leftmark}
22
% \rhead[\leftmark]{\coqdocrightpageheader}
26
% Hevea puts to much space with \medskip and \bigskip
27
%HEVEA\renewcommand{\medskip}{}
28
%HEVEA\renewcommand{\bigskip}{}
31
%HEVEA\newcommand{\lnot}{\coqwkw{not}}
32
%HEVEA\newcommand{\lor}{\coqwkw{or}}
33
%HEVEA\newcommand{\land}{\&}
36
\newcommand{\coqdoc}{\textsf{coqdoc}}
38
% pretty underscores (the package fontenc causes ugly underscores)
40
\def\_{\kern.08em\vbox{\hrule width.35em height.6pt}\kern.08em}
43
% macro for typesetting keywords
44
\newcommand{\coqdockw}[1]{\texttt{#1}}
46
% macro for typesetting variable identifiers
47
\newcommand{\coqdocvar}[1]{\textit{#1}}
49
% macro for typesetting constant identifiers
50
\newcommand{\coqdoccst}[1]{\textsf{#1}}
52
% macro for typesetting module identifiers
53
\newcommand{\coqdocmod}[1]{\textsc{\textsf{#1}}}
55
% macro for typesetting module constant identifiers (e.g. Parameters in
57
\newcommand{\coqdocax}[1]{\textsl{\textsf{#1}}}
59
% macro for typesetting inductive type identifiers
60
\newcommand{\coqdocind}[1]{\textbf{\textsf{#1}}}
62
% macro for typesetting constructor identifiers
63
\newcommand{\coqdocconstr}[1]{\textsf{#1}}
65
% macro for typesetting tactic identifiers
66
\newcommand{\coqdoctac}[1]{\texttt{#1}}
69
% Environment encompassing code fragments
70
% !!! CAUTION: This environment may have empty contents
71
\newenvironment{coqdoccode}{}{}
73
% Environment for comments
74
\newenvironment{coqdoccomment}{\tt(*}{*)}
76
% newline and indentation
78
% Base indentation length
79
\newlength{\coqdocbaseindent}
80
\setlength{\coqdocbaseindent}{0em}
82
% Beginning of a line without any Coq indentation
83
\newcommand{\coqdocnoindent}{\noindent\kern\coqdocbaseindent}
84
% Beginning of a line with a given Coq indentation
85
\newcommand{\coqdocindent}[1]{\noindent\kern\coqdocbaseindent\noindent\kern#1}
87
\newcommand{\coqdoceol}{\hspace*{\fill}\setlength\parskip{0pt}\par}
88
% Empty lines (in code only)
89
\newcommand{\coqdocemptyline}{\vskip 0.4em plus 0.1em minus 0.1em}
91
% macro for typesetting the title of a module implementation
92
\newcommand{\coqdocmodule}[1]{\chapter{Module #1}\markboth{Module #1}{}
96
\RequirePackage{hyperref}
97
\hypersetup{raiselinks=true,colorlinks=true,linkcolor=black}
99
% To do indexing, use something like:
100
% \usepackage{multind}
101
% \newcommand{\coqdef}[3]{\hypertarget{coq:#1}{\index{coq}{#1@#2|hyperpage}#3}}
103
\newcommand{\coqdef}[3]{\phantomsection\hypertarget{coq:#1}{#3}}
104
\newcommand{\coqref}[2]{\hyperlink{coq:#1}{#2}}
105
\newcommand{\identref}[2]{\hyperlink{coq:#1}{\textsf {#2}}}
106
\newcommand{\coqlibrary}[2]{\cleardoublepage\phantomsection
107
\hypertarget{coq:#1}{\chapter{Library \texorpdfstring{\coqdoccst}{}{#2}}}}
109
\newcommand{\coqdef}[3]{#3}
110
\newcommand{\coqref}[2]{#2}
111
\newcommand{\texorpdfstring}[2]{#1}
112
\newcommand{\identref}[2]{\textsf{#2}}
113
\newcommand{\coqlibrary}[2]{\cleardoublepage\chapter{Library \coqdoccst{#2}}}
117
\newif\if@coqdoccolors
120
\DeclareOption{color}{\@coqdoccolorstrue}
124
\RequirePackage{xcolor}
125
\definecolor{varpurple}{rgb}{0.4,0,0.4}
126
\definecolor{constrmaroon}{rgb}{0.6,0,0}
127
\definecolor{defgreen}{rgb}{0,0.4,0}
128
\definecolor{indblue}{rgb}{0,0,0.8}
129
\definecolor{kwred}{rgb}{0.8,0.1,0.1}
131
\def\coqdocvarcolor{varpurple}
132
\def\coqdockwcolor{kwred}
133
\def\coqdoccstcolor{defgreen}
134
\def\coqdocindcolor{indblue}
135
\def\coqdocconstrcolor{constrmaroon}
136
\def\coqdocmodcolor{defgreen}
137
\def\coqdocaxcolor{varpurple}
138
\def\coqdoctaccolor{black}
140
\def\coqdockw#1{{\color{\coqdockwcolor}{\texttt{#1}}}}
141
\def\coqdocvar#1{{\color{\coqdocvarcolor}{\textit{#1}}}}
142
\def\coqdoccst#1{{\color{\coqdoccstcolor}{\textrm{#1}}}}
143
\def\coqdocind#1{{\color{\coqdocindcolor}{\textsf{#1}}}}
144
\def\coqdocconstr#1{{\color{\coqdocconstrcolor}{\textsf{#1}}}}
145
\def\coqdocmod#1{{{\color{\coqdocmodcolor}{\textsc{\textsf{#1}}}}}}
146
\def\coqdocax#1{{{\color{\coqdocaxcolor}{\textsl{\textrm{#1}}}}}}
147
\def\coqdoctac#1{{\color{\coqdoctaccolor}{\texttt{#1}}}}
150
\newcommand{\coqdefinition}[2]{\coqdef{#1}{#2}{\coqdoccst{#2}}}
151
\newcommand{\coqdefinitionref}[2]{\coqref{#1}{\coqdoccst{#2}}}
153
\newcommand{\coqvariable}[2]{\coqdocvar{#2}}
154
\newcommand{\coqvariableref}[2]{\coqref{#1}{\coqdocvar{#2}}}
156
\newcommand{\coqinductive}[2]{\coqdef{#1}{#2}{\coqdocind{#2}}}
157
\newcommand{\coqinductiveref}[2]{\coqref{#1}{\coqdocind{#2}}}
159
\newcommand{\coqconstructor}[2]{\coqdef{#1}{#2}{\coqdocconstr{#2}}}
160
\newcommand{\coqconstructorref}[2]{\coqref{#1}{\coqdocconstr{#2}}}
162
\newcommand{\coqlemma}[2]{\coqdef{#1}{#2}{\coqdoccst{#2}}}
163
\newcommand{\coqlemmaref}[2]{\coqref{#1}{\coqdoccst{#2}}}
165
\newcommand{\coqclass}[2]{\coqdef{#1}{#2}{\coqdocind{#2}}}
166
\newcommand{\coqclassref}[2]{\coqref{#1}{\coqdocind{#2}}}
168
\newcommand{\coqinstance}[2]{\coqdef{#1}{#2}{\coqdoccst{#2}}}
169
\newcommand{\coqinstanceref}[2]{\coqref{#1}{\coqdoccst{#2}}}
171
\newcommand{\coqmethod}[2]{\coqdef{#1}{#2}{\coqdoccst{#2}}}
172
\newcommand{\coqmethodref}[2]{\coqref{#1}{\coqdoccst{#2}}}
174
\newcommand{\coqabbreviation}[2]{\coqdef{#1}{#2}{\coqdoccst{#2}}}
175
\newcommand{\coqabbreviationref}[2]{\coqref{#1}{\coqdoccst{#2}}}
177
\newcommand{\coqrecord}[2]{\coqdef{#1}{#2}{\coqdocind{#2}}}
178
\newcommand{\coqrecordref}[2]{\coqref{#1}{\coqdocind{#2}}}
180
\newcommand{\coqprojection}[2]{\coqdef{#1}{#2}{\coqdoccst{#2}}}
181
\newcommand{\coqprojectionref}[2]{\coqref{#1}{\coqdoccst{#2}}}
183
\newcommand{\coqnotationref}[2]{\coqref{#1}{\coqdockw{#2}}}
185
\newcommand{\coqsection}[2]{\coqdef{sec:#1}{#2}{\coqdoccst{#2}}}
186
\newcommand{\coqsectionref}[2]{\coqref{sec:#1}{\coqdoccst{#2}}}
188
%\newcommand{\coqlibrary}[2]{\chapter{Library \coqdoccst{#2}}\label{coq:#1}}
190
%\newcommand{\coqlibraryref}[2]{\ref{coq:#1}}
192
\newcommand{\coqlibraryref}[2]{\coqref{#1}{\coqdoccst{#2}}}
194
\newcommand{\coqaxiom}[2]{\coqdef{#1}{#2}{\coqdocax{#2}}}
195
\newcommand{\coqaxiomref}[2]{\coqref{#1}{\coqdocax{#2}}}
197
\newcommand{\coqmodule}[2]{\coqdef{mod:#1}{#2}{\coqdocmod{#2}}}
198
\newcommand{\coqmoduleref}[2]{\coqref{mod:#1}{\coqdocmod{#2}}}