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