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