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