lib/texinputs/isabelle.sty
author wenzelm
Mon Aug 27 19:12:48 2018 +0200 (17 months ago)
changeset 68821 877534be1930
parent 67571 f858fe5531ac
child 70142 7efe226c50e4
permissions -rw-r--r--
explicit setup of operations: avoid hardwired stuff;
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@67527
    17
\newcommand{\isastyletext}{\normalsize\normalfont\rmfamily}
wenzelm@67527
    18
\newcommand{\isastyletxt}{\normalfont\rmfamily}
wenzelm@67527
    19
\newcommand{\isastylecmt}{\normalfont\rmfamily}
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@22647
    42
\newenvironment{isaantiq}{{\isacharat\isacharbraceleft}}{{\isacharbraceright}}
kleing@14332
    43
wenzelm@8713
    44
\newdimen\isa@parindent\newdimen\isa@parskip
wenzelm@9657
    45
wenzelm@9702
    46
\newenvironment{isabellebody}{%
wenzelm@11863
    47
\isamarkuptrue\par%
wenzelm@9702
    48
\isa@parindent\parindent\parindent0pt%
wenzelm@8713
    49
\isa@parskip\parskip\parskip0pt%
wenzelm@43325
    50
\isaspacing\isastyle}{\par}
wenzelm@9702
    51
wenzelm@58716
    52
\newenvironment{isabellebodytt}{%
wenzelm@58716
    53
\isamarkuptrue\par%
wenzelm@58716
    54
\isa@parindent\parindent\parindent0pt%
wenzelm@58716
    55
\isa@parskip\parskip\parskip0pt%
wenzelm@58716
    56
\isaspacing\isastylett}{\par}
wenzelm@58716
    57
wenzelm@9702
    58
\newenvironment{isabelle}
wenzelm@10422
    59
{\begin{trivlist}\begin{isabellebody}\item\relax}
wenzelm@10422
    60
{\end{isabellebody}\end{trivlist}}
wenzelm@8713
    61
wenzelm@58716
    62
\newenvironment{isabellett}
wenzelm@58716
    63
{\begin{trivlist}\begin{isabellebodytt}\item\relax}
wenzelm@58716
    64
{\end{isabellebodytt}\end{trivlist}}
wenzelm@58716
    65
wenzelm@43325
    66
\newcommand{\isa}[1]{\emph{\isaspacing\isastyleminor #1}}
wenzelm@58716
    67
\newcommand{\isatt}[1]{\emph{\isaspacing\isastyleminortt #1}}
wenzelm@8714
    68
wenzelm@10949
    69
\newcommand{\isaindent}[1]{\hphantom{#1}}
kleing@13933
    70
\newcommand{\isanewline}{\mbox{}\par\mbox{}}
wenzelm@17158
    71
\newcommand{\isasep}{}
wenzelm@9669
    72
\newcommand{\isadigit}[1]{#1}
wenzelm@7752
    73
wenzelm@18860
    74
\newcommand{\isachardefaults}{%
wenzelm@64525
    75
\def\isacharbell{\isamath{\bigbox}}%requires stmaryrd
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@67527
   123
{\emph{\normalfont\bfseries\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@67146
   127
\newcommand{\isakeywordcontrol}[1]
wenzelm@67527
   128
{\emph{\normalfont\bfseries\itshape\def\isacharunderscore{\isacharunderscorekeyword}#1\,}}
wenzelm@67146
   129
wenzelm@8501
   130
\newcommand{\isamarkupheader}[1]{\section{#1}}
wenzelm@7752
   131
\newcommand{\isamarkupchapter}[1]{\chapter{#1}}
wenzelm@7752
   132
\newcommand{\isamarkupsection}[1]{\section{#1}}
wenzelm@7752
   133
\newcommand{\isamarkupsubsection}[1]{\subsection{#1}}
wenzelm@7752
   134
\newcommand{\isamarkupsubsubsection}[1]{\subsubsection{#1}}
wenzelm@61463
   135
\newcommand{\isamarkupparagraph}[1]{\paragraph{#1}}
wenzelm@61463
   136
\newcommand{\isamarkupsubparagraph}[1]{\subparagraph{#1}}
wenzelm@8662
   137
wenzelm@11863
   138
\newif\ifisamarkup
wenzelm@11863
   139
\newcommand{\isabeginpar}{\par\ifisamarkup\relax\else\medskip\fi}
wenzelm@10586
   140
\newcommand{\isaendpar}{\par\medskip}
wenzelm@10586
   141
\newenvironment{isapar}{\parindent\isa@parindent\parskip\isa@parskip\isabeginpar}{\isaendpar}
wenzelm@17215
   142
\newenvironment{isamarkuptext}{\par\isastyletext\begin{isapar}}{\end{isapar}}
wenzelm@17215
   143
\newenvironment{isamarkuptxt}{\par\isastyletxt\begin{isapar}}{\end{isapar}}
wenzelm@9657
   144
\newcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}}
wenzelm@9657
   145
wenzelm@9657
   146
wenzelm@18860
   147
% styles
wenzelm@18860
   148
wenzelm@18860
   149
\def\isabellestyle#1{\csname isabellestyle#1\endcsname}
wenzelm@9657
   150
wenzelm@18860
   151
\newcommand{\isabellestyledefault}{%
wenzelm@67527
   152
\def\isastyle{\small\normalfont\ttfamily\slshape}%
wenzelm@67527
   153
\def\isastylett{\small\normalfont\ttfamily}%
wenzelm@67527
   154
\def\isastyleminor{\small\normalfont\ttfamily\slshape}%
wenzelm@67527
   155
\def\isastyleminortt{\small\normalfont\ttfamily}%
wenzelm@67527
   156
\def\isastylescript{\footnotesize\normalfont\ttfamily\slshape}%
wenzelm@18860
   157
\isachardefaults%
wenzelm@18860
   158
}
wenzelm@18860
   159
\isabellestyledefault
wenzelm@9657
   160
wenzelm@10024
   161
\newcommand{\isabellestylett}{%
wenzelm@67527
   162
\def\isastyle{\small\normalfont\ttfamily}%
wenzelm@67527
   163
\def\isastylett{\small\normalfont\ttfamily}%
wenzelm@67527
   164
\def\isastyleminor{\small\normalfont\ttfamily}%
wenzelm@67527
   165
\def\isastyleminortt{\small\normalfont\ttfamily}%
wenzelm@67527
   166
\def\isastylescript{\footnotesize\normalfont\ttfamily}%
wenzelm@18860
   167
\isachardefaults%
wenzelm@10024
   168
}
wenzelm@18860
   169
wenzelm@9669
   170
\newcommand{\isabellestyleit}{%
wenzelm@67527
   171
\def\isastyle{\small\normalfont\itshape}%
wenzelm@67527
   172
\def\isastylett{\small\normalfont\ttfamily}%
wenzelm@67527
   173
\def\isastyleminor{\normalfont\itshape}%
wenzelm@67527
   174
\def\isastyleminortt{\normalfont\ttfamily}%
wenzelm@67527
   175
\def\isastylescript{\footnotesize\normalfont\itshape}%
wenzelm@42514
   176
\isachardefaults%
wenzelm@42514
   177
\def\isacharunderscorekeyword{\mbox{-}}%
wenzelm@42514
   178
\def\isacharbang{\isamath{!}}%
wenzelm@49320
   179
\def\isachardoublequote{}%
wenzelm@49320
   180
\def\isachardoublequoteopen{}%
wenzelm@49320
   181
\def\isachardoublequoteclose{}%
wenzelm@42514
   182
\def\isacharhash{\isamath{\#}}%
wenzelm@42514
   183
\def\isachardollar{\isamath{\$}}%
wenzelm@42514
   184
\def\isacharpercent{\isamath{\%}}%
wenzelm@42514
   185
\def\isacharampersand{\isamath{\&}}%
wenzelm@42514
   186
\def\isacharprime{\isamath{\mskip2mu{'}\mskip-2mu}}%
wenzelm@42514
   187
\def\isacharparenleft{\isamath{(}}%
wenzelm@42514
   188
\def\isacharparenright{\isamath{)}}%
wenzelm@42514
   189
\def\isacharasterisk{\isamath{*}}%
wenzelm@42514
   190
\def\isacharplus{\isamath{+}}%
wenzelm@42514
   191
\def\isacharcomma{\isamath{\mathord,}}%
wenzelm@42514
   192
\def\isacharminus{\isamath{-}}%
wenzelm@42514
   193
\def\isachardot{\isamath{\mathord.}}%
wenzelm@42514
   194
\def\isacharslash{\isamath{/}}%
wenzelm@42514
   195
\def\isacharcolon{\isamath{\mathord:}}%
wenzelm@42514
   196
\def\isacharsemicolon{\isamath{\mathord;}}%
wenzelm@42514
   197
\def\isacharless{\isamath{<}}%
wenzelm@42514
   198
\def\isacharequal{\isamath{=}}%
wenzelm@42514
   199
\def\isachargreater{\isamath{>}}%
wenzelm@42514
   200
\def\isacharat{\isamath{@}}%
wenzelm@42514
   201
\def\isacharbrackleft{\isamath{[}}%
wenzelm@42514
   202
\def\isacharbackslash{\isamath{\backslash}}%
wenzelm@42514
   203
\def\isacharbrackright{\isamath{]}}%
wenzelm@42514
   204
\def\isacharunderscore{\mbox{-}}%
wenzelm@42514
   205
\def\isacharbraceleft{\isamath{\{}}%
wenzelm@42514
   206
\def\isacharbar{\isamath{\mid}}%
wenzelm@42514
   207
\def\isacharbraceright{\isamath{\}}}%
wenzelm@42514
   208
\def\isachartilde{\isamath{{}\sp{\sim}}}%
wenzelm@42514
   209
\def\isacharbackquoteopen{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\langle$}}}%
wenzelm@42514
   210
\def\isacharbackquoteclose{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\rangle$}}}%
wenzelm@42514
   211
\def\isacharverbatimopen{\isamath{\langle\!\langle}}%
wenzelm@42514
   212
\def\isacharverbatimclose{\isamath{\rangle\!\rangle}}%
wenzelm@9657
   213
}
wenzelm@9657
   214
wenzelm@45646
   215
\newcommand{\isabellestyleliteral}{%
wenzelm@42663
   216
\isabellestyleit%
wenzelm@42663
   217
\def\isacharunderscore{\_}%
wenzelm@42663
   218
\def\isacharunderscorekeyword{\_}%
wenzelm@45646
   219
\chardef\isacharbackquoteopen=`\`%
wenzelm@45646
   220
\chardef\isacharbackquoteclose=`\`%
wenzelm@42663
   221
}
wenzelm@42663
   222
wenzelm@55365
   223
\newcommand{\isabellestyleliteralunderscore}{%
wenzelm@55365
   224
\isabellestyleliteral%
wenzelm@55365
   225
\def\isacharunderscore{\textunderscore}%
wenzelm@55365
   226
\def\isacharunderscorekeyword{\textunderscore}%
wenzelm@55365
   227
}
wenzelm@55365
   228
wenzelm@9975
   229
\newcommand{\isabellestylesl}{%
wenzelm@9975
   230
\isabellestyleit%
wenzelm@67527
   231
\def\isastyle{\small\normalfont\slshape}%
wenzelm@67527
   232
\def\isastylett{\small\normalfont\ttfamily}%
wenzelm@67527
   233
\def\isastyleminor{\normalfont\slshape}%
wenzelm@67527
   234
\def\isastyleminortt{\normalfont\ttfamily}%
wenzelm@67527
   235
\def\isastylescript{\footnotesize\normalfont\slshape}%
wenzelm@9975
   236
}
wenzelm@17052
   237
wenzelm@17052
   238
wenzelm@67416
   239
% cancel text
wenzelm@67416
   240
wenzelm@67416
   241
\usepackage[normalem]{ulem}
wenzelm@67571
   242
\newcommand{\isamarkupcancel}[1]{\isa{\xout{#1}}}
wenzelm@67416
   243
wenzelm@67416
   244
wenzelm@17052
   245
% tagged regions
wenzelm@17052
   246
wenzelm@17052
   247
%plain TeX version of comment package -- much faster!
wenzelm@17052
   248
\let\isafmtname\fmtname\def\fmtname{plain}
wenzelm@17052
   249
\usepackage{comment}
wenzelm@17052
   250
\let\fmtname\isafmtname
wenzelm@17052
   251
wenzelm@17052
   252
\newcommand{\isafold}[1]{\emph{$\langle\mathord{\mathit{#1}}\rangle$}}
wenzelm@17052
   253
wenzelm@17052
   254
\newcommand{\isakeeptag}[1]%
wenzelm@17052
   255
{\includecomment{isadelim#1}\includecomment{isatag#1}\csarg\def{isafold#1}{}}
wenzelm@17052
   256
\newcommand{\isadroptag}[1]%
wenzelm@17052
   257
{\excludecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{}}
wenzelm@17052
   258
\newcommand{\isafoldtag}[1]%
wenzelm@17052
   259
{\includecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{\isafold{#1}}}
wenzelm@17052
   260
wenzelm@67139
   261
\isakeeptag{document}
wenzelm@17052
   262
\isakeeptag{theory}
wenzelm@17052
   263
\isakeeptag{proof}
wenzelm@17052
   264
\isakeeptag{ML}
wenzelm@17052
   265
\isakeeptag{visible}
wenzelm@17052
   266
\isadroptag{invisible}
wenzelm@67151
   267
\isakeeptag{important}
wenzelm@67151
   268
\isakeeptag{unimportant}
wenzelm@17052
   269
wenzelm@17052
   270
\IfFileExists{isabelletags.sty}{\usepackage{isabelletags}}{}