|
1 %% |
|
2 %% macros for Isabelle generated LaTeX output |
|
3 %% |
|
4 |
|
5 %%% Simple document preparation (based on theory token language and symbols) |
|
6 |
|
7 % isabelle environments |
|
8 |
|
9 \newcommand{\isabellecontext}{UNKNOWN} |
|
10 |
|
11 \newcommand{\isastyle}{\UNDEF} |
|
12 \newcommand{\isastyleminor}{\UNDEF} |
|
13 \newcommand{\isastylescript}{\UNDEF} |
|
14 \newcommand{\isastyletext}{\normalsize\rm} |
|
15 \newcommand{\isastyletxt}{\rm} |
|
16 \newcommand{\isastylecmt}{\rm} |
|
17 |
|
18 \newcommand{\isaspacing}{% |
|
19 \sfcode 42 1000 % . |
|
20 \sfcode 63 1000 % ? |
|
21 \sfcode 33 1000 % ! |
|
22 \sfcode 58 1000 % : |
|
23 \sfcode 59 1000 % ; |
|
24 \sfcode 44 1000 % , |
|
25 } |
|
26 |
|
27 %symbol markup -- \emph achieves decent spacing via italic corrections |
|
28 \newcommand{\isamath}[1]{\emph{$#1$}} |
|
29 \newcommand{\isatext}[1]{\emph{#1}} |
|
30 \DeclareRobustCommand{\isascriptstyle}{\def\isamath##1{##1}\def\isatext##1{\mbox{\isaspacing\isastylescript##1}}} |
|
31 \newcommand{\isactrlsub}[1]{\emph{\isascriptstyle${}\sb{#1}$}} |
|
32 \newcommand{\isactrlsup}[1]{\emph{\isascriptstyle${}\sp{#1}$}} |
|
33 \newcommand{\isactrlisub}[1]{\emph{\isascriptstyle${}\sb{#1}$}} |
|
34 \newcommand{\isactrlisup}[1]{\emph{\isascriptstyle${}\sp{#1}$}} |
|
35 \DeclareRobustCommand{\isactrlbsub}{\emph\bgroup\math{}\sb\bgroup\mbox\bgroup\isaspacing\isastylescript} |
|
36 \DeclareRobustCommand{\isactrlesub}{\egroup\egroup\endmath\egroup} |
|
37 \DeclareRobustCommand{\isactrlbsup}{\emph\bgroup\math{}\sp\bgroup\mbox\bgroup\isaspacing\isastylescript} |
|
38 \DeclareRobustCommand{\isactrlesup}{\egroup\egroup\endmath\egroup} |
|
39 \newcommand{\isactrlbold}[1]{{\bfseries\upshape\boldmath#1}} |
|
40 |
|
41 \newenvironment{isaantiq}{{\isacharat\isacharbraceleft}}{{\isacharbraceright}} |
|
42 \newcommand{\isaantiqopen}{\isakeyword{\isacharbraceleft}} |
|
43 \newcommand{\isaantiqclose}{\isakeyword{\isacharbraceright}} |
|
44 |
|
45 \newdimen\isa@parindent\newdimen\isa@parskip |
|
46 |
|
47 \newenvironment{isabellebody}{% |
|
48 \isamarkuptrue\par% |
|
49 \isa@parindent\parindent\parindent0pt% |
|
50 \isa@parskip\parskip\parskip0pt% |
|
51 \isaspacing\isastyle}{\par} |
|
52 |
|
53 \newenvironment{isabelle} |
|
54 {\begin{trivlist}\begin{isabellebody}\item\relax} |
|
55 {\end{isabellebody}\end{trivlist}} |
|
56 |
|
57 \newcommand{\isa}[1]{\emph{\isaspacing\isastyleminor #1}} |
|
58 |
|
59 \newcommand{\isaindent}[1]{\hphantom{#1}} |
|
60 \newcommand{\isanewline}{\mbox{}\par\mbox{}} |
|
61 \newcommand{\isasep}{} |
|
62 \newcommand{\isadigit}[1]{#1} |
|
63 |
|
64 \newcommand{\isachardefaults}{% |
|
65 \chardef\isacharbang=`\!% |
|
66 \chardef\isachardoublequote=`\"% |
|
67 \chardef\isachardoublequoteopen=`\"% |
|
68 \chardef\isachardoublequoteclose=`\"% |
|
69 \chardef\isacharhash=`\#% |
|
70 \chardef\isachardollar=`\$% |
|
71 \chardef\isacharpercent=`\%% |
|
72 \chardef\isacharampersand=`\&% |
|
73 \chardef\isacharprime=`\'% |
|
74 \chardef\isacharparenleft=`\(% |
|
75 \chardef\isacharparenright=`\)% |
|
76 \chardef\isacharasterisk=`\*% |
|
77 \chardef\isacharplus=`\+% |
|
78 \chardef\isacharcomma=`\,% |
|
79 \chardef\isacharminus=`\-% |
|
80 \chardef\isachardot=`\.% |
|
81 \chardef\isacharslash=`\/% |
|
82 \chardef\isacharcolon=`\:% |
|
83 \chardef\isacharsemicolon=`\;% |
|
84 \chardef\isacharless=`\<% |
|
85 \chardef\isacharequal=`\=% |
|
86 \chardef\isachargreater=`\>% |
|
87 \chardef\isacharquery=`\?% |
|
88 \chardef\isacharat=`\@% |
|
89 \chardef\isacharbrackleft=`\[% |
|
90 \chardef\isacharbackslash=`\\% |
|
91 \chardef\isacharbrackright=`\]% |
|
92 \chardef\isacharcircum=`\^% |
|
93 \chardef\isacharunderscore=`\_% |
|
94 \def\isacharunderscorekeyword{\_}% |
|
95 \chardef\isacharbackquote=`\`% |
|
96 \chardef\isacharbackquoteopen=`\`% |
|
97 \chardef\isacharbackquoteclose=`\`% |
|
98 \chardef\isacharbraceleft=`\{% |
|
99 \chardef\isacharbar=`\|% |
|
100 \chardef\isacharbraceright=`\}% |
|
101 \chardef\isachartilde=`\~% |
|
102 \def\isacharverbatimopen{\isacharbraceleft\isacharasterisk}% |
|
103 \def\isacharverbatimclose{\isacharasterisk\isacharbraceright}% |
|
104 } |
|
105 |
|
106 \newcommand{\isaliteral}[2]{#2} |
|
107 \newcommand{\isanil}{} |
|
108 |
|
109 |
|
110 % keyword and section markup |
|
111 |
|
112 \newcommand{\isakeyword}[1] |
|
113 {\emph{\bf\def\isachardot{.}\def\isacharunderscore{\isacharunderscorekeyword}% |
|
114 \def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}} |
|
115 \newcommand{\isacommand}[1]{\isakeyword{#1}} |
|
116 |
|
117 \newcommand{\isamarkupheader}[1]{\section{#1}} |
|
118 \newcommand{\isamarkupchapter}[1]{\chapter{#1}} |
|
119 \newcommand{\isamarkupsection}[1]{\section{#1}} |
|
120 \newcommand{\isamarkupsubsection}[1]{\subsection{#1}} |
|
121 \newcommand{\isamarkupsubsubsection}[1]{\subsubsection{#1}} |
|
122 \newcommand{\isamarkupsect}[1]{\section{#1}} |
|
123 \newcommand{\isamarkupsubsect}[1]{\subsection{#1}} |
|
124 \newcommand{\isamarkupsubsubsect}[1]{\subsubsection{#1}} |
|
125 |
|
126 \newif\ifisamarkup |
|
127 \newcommand{\isabeginpar}{\par\ifisamarkup\relax\else\medskip\fi} |
|
128 \newcommand{\isaendpar}{\par\medskip} |
|
129 \newenvironment{isapar}{\parindent\isa@parindent\parskip\isa@parskip\isabeginpar}{\isaendpar} |
|
130 \newenvironment{isamarkuptext}{\par\isastyletext\begin{isapar}}{\end{isapar}} |
|
131 \newenvironment{isamarkuptxt}{\par\isastyletxt\begin{isapar}}{\end{isapar}} |
|
132 \newcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}} |
|
133 |
|
134 |
|
135 % styles |
|
136 |
|
137 \def\isabellestyle#1{\csname isabellestyle#1\endcsname} |
|
138 |
|
139 \newcommand{\isabellestyledefault}{% |
|
140 \def\isastyle{\small\tt\slshape}% |
|
141 \def\isastyleminor{\small\tt\slshape}% |
|
142 \def\isastylescript{\footnotesize\tt\slshape}% |
|
143 \isachardefaults% |
|
144 } |
|
145 \isabellestyledefault |
|
146 |
|
147 \newcommand{\isabellestylett}{% |
|
148 \def\isastyle{\small\tt}% |
|
149 \def\isastyleminor{\small\tt}% |
|
150 \def\isastylescript{\footnotesize\tt}% |
|
151 \isachardefaults% |
|
152 } |
|
153 |
|
154 \newcommand{\isabellestyleit}{% |
|
155 \def\isastyle{\small\it}% |
|
156 \def\isastyleminor{\it}% |
|
157 \def\isastylescript{\footnotesize\it}% |
|
158 \isachardefaults% |
|
159 \def\isacharunderscorekeyword{\mbox{-}}% |
|
160 \def\isacharbang{\isamath{!}}% |
|
161 \def\isachardoublequote{\isanil}% |
|
162 \def\isachardoublequoteopen{\isanil}% |
|
163 \def\isachardoublequoteclose{\isanil}% |
|
164 \def\isacharhash{\isamath{\#}}% |
|
165 \def\isachardollar{\isamath{\$}}% |
|
166 \def\isacharpercent{\isamath{\%}}% |
|
167 \def\isacharampersand{\isamath{\&}}% |
|
168 \def\isacharprime{\isamath{\mskip2mu{'}\mskip-2mu}}% |
|
169 \def\isacharparenleft{\isamath{(}}% |
|
170 \def\isacharparenright{\isamath{)}}% |
|
171 \def\isacharasterisk{\isamath{*}}% |
|
172 \def\isacharplus{\isamath{+}}% |
|
173 \def\isacharcomma{\isamath{\mathord,}}% |
|
174 \def\isacharminus{\isamath{-}}% |
|
175 \def\isachardot{\isamath{\mathord.}}% |
|
176 \def\isacharslash{\isamath{/}}% |
|
177 \def\isacharcolon{\isamath{\mathord:}}% |
|
178 \def\isacharsemicolon{\isamath{\mathord;}}% |
|
179 \def\isacharless{\isamath{<}}% |
|
180 \def\isacharequal{\isamath{=}}% |
|
181 \def\isachargreater{\isamath{>}}% |
|
182 \def\isacharat{\isamath{@}}% |
|
183 \def\isacharbrackleft{\isamath{[}}% |
|
184 \def\isacharbackslash{\isamath{\backslash}}% |
|
185 \def\isacharbrackright{\isamath{]}}% |
|
186 \def\isacharunderscore{\mbox{-}}% |
|
187 \def\isacharbraceleft{\isamath{\{}}% |
|
188 \def\isacharbar{\isamath{\mid}}% |
|
189 \def\isacharbraceright{\isamath{\}}}% |
|
190 \def\isachartilde{\isamath{{}\sp{\sim}}}% |
|
191 \def\isacharbackquoteopen{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\langle$}}}% |
|
192 \def\isacharbackquoteclose{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\rangle$}}}% |
|
193 \def\isacharverbatimopen{\isamath{\langle\!\langle}}% |
|
194 \def\isacharverbatimclose{\isamath{\rangle\!\rangle}}% |
|
195 } |
|
196 |
|
197 \newcommand{\isabellestyleliteral}{% |
|
198 \isabellestyleit% |
|
199 \def\isacharunderscore{\_}% |
|
200 \def\isacharunderscorekeyword{\_}% |
|
201 \chardef\isacharbackquoteopen=`\`% |
|
202 \chardef\isacharbackquoteclose=`\`% |
|
203 } |
|
204 |
|
205 \newcommand{\isabellestylesl}{% |
|
206 \isabellestyleit% |
|
207 \def\isastyle{\small\sl}% |
|
208 \def\isastyleminor{\sl}% |
|
209 \def\isastylescript{\footnotesize\sl}% |
|
210 } |
|
211 |
|
212 |
|
213 % tagged regions |
|
214 |
|
215 %plain TeX version of comment package -- much faster! |
|
216 \let\isafmtname\fmtname\def\fmtname{plain} |
|
217 \usepackage{comment} |
|
218 \let\fmtname\isafmtname |
|
219 |
|
220 \newcommand{\isafold}[1]{\emph{$\langle\mathord{\mathit{#1}}\rangle$}} |
|
221 |
|
222 \newcommand{\isakeeptag}[1]% |
|
223 {\includecomment{isadelim#1}\includecomment{isatag#1}\csarg\def{isafold#1}{}} |
|
224 \newcommand{\isadroptag}[1]% |
|
225 {\excludecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{}} |
|
226 \newcommand{\isafoldtag}[1]% |
|
227 {\includecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{\isafold{#1}}} |
|
228 |
|
229 \isakeeptag{theory} |
|
230 \isakeeptag{proof} |
|
231 \isakeeptag{ML} |
|
232 \isakeeptag{visible} |
|
233 \isadroptag{invisible} |
|
234 |
|
235 \IfFileExists{isabelletags.sty}{\usepackage{isabelletags}}{} |