Debian Codegraph @

tools/coqdoc/coqdoc.sty

raw
1
2 % This is coqdoc.sty, by Jean-Christophe Filliâtre
3 % This LaTeX package is used by coqdoc (http://www.lri.fr/~filliatr/coqdoc)
4 %
5 % You can modify the following macros to customize the appearance
6 % of the document.
7
8 \NeedsTeXFormat{LaTeX2e}
9 \ProvidesPackage{coqdoc}[2002/02/11]
10
11 % % Headings
12 % \usepackage{fancyhdr}
13 % \newcommand{\coqdocleftpageheader}{\thepage\ -- \today}
14 % \newcommand{\coqdocrightpageheader}{\today\ -- \thepage}
15 % \pagestyle{fancyplain}
16
17 % %BEGIN LATEX
18 % \headsep 8mm
19 % \renewcommand{\plainheadrulewidth}{0.4pt}
20 % \renewcommand{\plainfootrulewidth}{0pt}
21 % \lhead[\coqdocleftpageheader]{\leftmark}
22 % \rhead[\leftmark]{\coqdocrightpageheader}
23 % \cfoot{}
24 % %END LATEX
25
26 % Hevea puts to much space with \medskip and \bigskip
27 %HEVEA\renewcommand{\medskip}{}
28 %HEVEA\renewcommand{\bigskip}{}
29
30
31 %HEVEA\newcommand{\lnot}{\coqwkw{not}}
32 %HEVEA\newcommand{\lor}{\coqwkw{or}}
33 %HEVEA\newcommand{\land}{\&}
34
35 % own name
36 \newcommand{\coqdoc}{\textsf{coqdoc}}
37
38 % pretty underscores (the package fontenc causes ugly underscores)
39 %BEGIN LATEX
40 \def\_{\kern.08em\vbox{\hrule width.35em height.6pt}\kern.08em}
41 %END LATEX
42
43 % macro for typesetting keywords
44 \newcommand{\coqdockw}[1]{\texttt{#1}}
45
46 % macro for typesetting variable identifiers
47 \newcommand{\coqdocvar}[1]{\textit{#1}}
48
49 % macro for typesetting constant identifiers
50 \newcommand{\coqdoccst}[1]{\textsf{#1}}
51
52 % macro for typesetting module identifiers
53 \newcommand{\coqdocmod}[1]{\textsc{\textsf{#1}}}
54
55 % macro for typesetting module constant identifiers (e.g. Parameters in
56 % module types)
57 \newcommand{\coqdocax}[1]{\textsl{\textsf{#1}}}
58
59 % macro for typesetting inductive type identifiers
60 \newcommand{\coqdocind}[1]{\textbf{\textsf{#1}}}
61
62 % macro for typesetting constructor identifiers
63 \newcommand{\coqdocconstr}[1]{\textsf{#1}}
64
65 % macro for typesetting tactic identifiers
66 \newcommand{\coqdoctac}[1]{\texttt{#1}}
67
68 % These are the real macros used by coqdoc, their typesetting is
69 % based on the above macros by default.
70
71 \newcommand{\coqdoclibrary}[1]{\coqdoccst{#1}}
72 \newcommand{\coqdocinductive}[1]{\coqdocind{#1}}
73 \newcommand{\coqdocdefinition}[1]{\coqdoccst{#1}}
74 \newcommand{\coqdocvariable}[1]{\coqdocvar{#1}}
75 \newcommand{\coqdocbinder}[1]{\coqdocvar{#1}}
76 \newcommand{\coqdocconstructor}[1]{\coqdocconstr{#1}}
77 \newcommand{\coqdoclemma}[1]{\coqdoccst{#1}}
78 \newcommand{\coqdocclass}[1]{\coqdocind{#1}}
79 \newcommand{\coqdocinstance}[1]{\coqdoccst{#1}}
80 \newcommand{\coqdocmethod}[1]{\coqdoccst{#1}}
81 \newcommand{\coqdocabbreviation}[1]{\coqdoccst{#1}}
82 \newcommand{\coqdocrecord}[1]{\coqdocind{#1}}
83 \newcommand{\coqdocprojection}[1]{\coqdoccst{#1}}
84 \newcommand{\coqdocnotation}[1]{\coqdockw{#1}}
85 \newcommand{\coqdocsection}[1]{\coqdoccst{#1}}
86 \newcommand{\coqdocaxiom}[1]{\coqdocax{#1}}
87 \newcommand{\coqdocmodule}[1]{\coqdocmod{#1}}
88
89 % Environment encompassing code fragments
90 % !!! CAUTION: This environment may have empty contents
91 \newenvironment{coqdoccode}{}{}
92
93 % Environment for comments
94 \newenvironment{coqdoccomment}{\tt(*}{*)}
95
96 % newline and indentation
97 %BEGIN LATEX
98 % Base indentation length
99 \newlength{\coqdocbaseindent}
100 \setlength{\coqdocbaseindent}{0em}
101
102 % Beginning of a line without any Rocq indentation
103 \newcommand{\coqdocnoindent}{\noindent\kern\coqdocbaseindent}
104 % Beginning of a line with a given Rocq indentation
105 \newcommand{\coqdocindent}[1]{\noindent\kern\coqdocbaseindent\noindent\kern#1}
106 % End-of-the-line
107 \newcommand{\coqdoceol}{\hspace*{\fill}\setlength\parskip{0pt}\par}
108 % Empty lines (in code only)
109 \newcommand{\coqdocemptyline}{\vskip 0.4em plus 0.1em minus 0.1em}
110
111 \usepackage{ifpdf}
112 \ifpdf
113 \RequirePackage{hyperref}
114 \hypersetup{raiselinks=true,colorlinks=true,linkcolor=black}
115
116 % To do indexing, use something like:
117 % \usepackage{multind}
118 % \newcommand{\coqdef}[3]{\hypertarget{coq:#1}{\index{coq}{#1@#2|hyperpage}#3}}
119
120 \newcommand{\coqdef}[3]{\phantomsection\hypertarget{coq:#1}{#3}}
121 \newcommand{\coqref}[2]{\hyperlink{coq:#1}{#2}}
122 \newcommand{\coqexternalref}[3]{\href{#1.html\##2}{#3}}
123
124 \newcommand{\identref}[2]{\hyperlink{coq:#1}{\textsf {#2}}}
125 \newcommand{\coqlibrary}[3]{\cleardoublepage\phantomsection
126 \hypertarget{coq:#1}{\chapter{#2\texorpdfstring{\coqdoccst}{}{#3}}}}
127 \else
128 \newcommand{\coqdef}[3]{#3}
129 \newcommand{\coqref}[2]{#2}
130 \newcommand{\coqexternalref}[3]{#3}
131 \newcommand{\texorpdfstring}[2]{#1}
132 \newcommand{\identref}[2]{\textsf{#2}}
133 \newcommand{\coqlibrary}[3]{\cleardoublepage\chapter{#2\coqdoccst{#3}}}
134 \fi
135 \usepackage{xr}
136
137 \newif\if@coqdoccolors
138 \@coqdoccolorsfalse
139
140 \DeclareOption{color}{\@coqdoccolorstrue}
141 \ProcessOptions
142
143 \if@coqdoccolors
144 \RequirePackage{xcolor}
145 \definecolor{varpurple}{rgb}{0.4,0,0.4}
146 \definecolor{constrmaroon}{rgb}{0.6,0,0}
147 \definecolor{defgreen}{rgb}{0,0.4,0}
148 \definecolor{indblue}{rgb}{0,0,0.8}
149 \definecolor{kwred}{rgb}{0.8,0.1,0.1}
150
151 \def\coqdocvarcolor{varpurple}
152 \def\coqdockwcolor{kwred}
153 \def\coqdoccstcolor{defgreen}
154 \def\coqdocindcolor{indblue}
155 \def\coqdocconstrcolor{constrmaroon}
156 \def\coqdocmodcolor{defgreen}
157 \def\coqdocaxcolor{varpurple}
158 \def\coqdoctaccolor{black}
159
160 \def\coqdockw#1{{\color{\coqdockwcolor}{\texttt{#1}}}}
161 \def\coqdocvar#1{{\color{\coqdocvarcolor}{\textit{#1}}}}
162 \def\coqdoccst#1{{\color{\coqdoccstcolor}{\textrm{#1}}}}
163 \def\coqdocind#1{{\color{\coqdocindcolor}{\textsf{#1}}}}
164 \def\coqdocconstr#1{{\color{\coqdocconstrcolor}{\textsf{#1}}}}
165 \def\coqdocmod#1{{{\color{\coqdocmodcolor}{\textsc{\textsf{#1}}}}}}
166 \def\coqdocax#1{{{\color{\coqdocaxcolor}{\textsl{\textrm{#1}}}}}}
167 \def\coqdoctac#1{{\color{\coqdoctaccolor}{\texttt{#1}}}}
168 \fi
169
170 \endinput