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