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