doc-src/LaTeXsugar/Sugar/document/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;
kleing@15893
     1
%%
wenzelm@17536
     2
%% 
kleing@15893
     3
%%
kleing@15893
     4
%% macros for Isabelle generated LaTeX output
kleing@15893
     5
%%
kleing@15893
     6
kleing@15893
     7
%%% Simple document preparation (based on theory token language and symbols)
kleing@15893
     8
kleing@15893
     9
% isabelle environments
kleing@15893
    10
kleing@15893
    11
\newcommand{\isabellecontext}{UNKNOWN}
kleing@15893
    12
wenzelm@18962
    13
\newcommand{\isastyle}{\UNDEF}
wenzelm@18962
    14
\newcommand{\isastyleminor}{\UNDEF}
wenzelm@18962
    15
\newcommand{\isastylescript}{\UNDEF}
kleing@15893
    16
\newcommand{\isastyletext}{\normalsize\rm}
kleing@15893
    17
\newcommand{\isastyletxt}{\rm}
kleing@15893
    18
\newcommand{\isastylecmt}{\rm}
kleing@15893
    19
kleing@15893
    20
%symbol markup -- \emph achieves decent spacing via italic corrections
kleing@15893
    21
\newcommand{\isamath}[1]{\emph{$#1$}}
kleing@15893
    22
\newcommand{\isatext}[1]{\emph{#1}}
wenzelm@25056
    23
\DeclareRobustCommand{\isascriptstyle}{\def\isamath##1{##1}\def\isatext##1{\mbox{\isastylescript##1}}}
wenzelm@17214
    24
\newcommand{\isactrlsub}[1]{\emph{\isascriptstyle${}\sb{#1}$}}
wenzelm@17214
    25
\newcommand{\isactrlsup}[1]{\emph{\isascriptstyle${}\sp{#1}$}}
wenzelm@17214
    26
\newcommand{\isactrlisub}[1]{\emph{\isascriptstyle${}\sb{#1}$}}
wenzelm@17214
    27
\newcommand{\isactrlisup}[1]{\emph{\isascriptstyle${}\sp{#1}$}}
kleing@15893
    28
\newcommand{\isactrlbsub}{\emph\bgroup\begin{math}{}\sb\bgroup\mbox\bgroup\isastylescript}
kleing@15893
    29
\newcommand{\isactrlesub}{\egroup\egroup\end{math}\egroup}
kleing@15893
    30
\newcommand{\isactrlbsup}{\emph\bgroup\begin{math}{}\sp\bgroup\mbox\bgroup\isastylescript}
kleing@15893
    31
\newcommand{\isactrlesup}{\egroup\egroup\end{math}\egroup}
kleing@15893
    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}}
kleing@15893
    35
kleing@15893
    36
kleing@15893
    37
\newdimen\isa@parindent\newdimen\isa@parskip
kleing@15893
    38
kleing@15893
    39
\newenvironment{isabellebody}{%
kleing@15893
    40
\isamarkuptrue\par%
kleing@15893
    41
\isa@parindent\parindent\parindent0pt%
kleing@15893
    42
\isa@parskip\parskip\parskip0pt%
kleing@15893
    43
\isastyle}{\par}
kleing@15893
    44
kleing@15893
    45
\newenvironment{isabelle}
kleing@15893
    46
{\begin{trivlist}\begin{isabellebody}\item\relax}
kleing@15893
    47
{\end{isabellebody}\end{trivlist}}
kleing@15893
    48
kleing@15893
    49
\newcommand{\isa}[1]{\emph{\isastyleminor #1}}
kleing@15893
    50
kleing@15893
    51
\newcommand{\isaindent}[1]{\hphantom{#1}}
kleing@15893
    52
\newcommand{\isanewline}{\mbox{}\par\mbox{}}
wenzelm@17175
    53
\newcommand{\isasep}{}
kleing@15893
    54
\newcommand{\isadigit}[1]{#1}
kleing@15893
    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
}
kleing@15893
    97
kleing@15893
    98
kleing@15893
    99
% keyword and section markup
kleing@15893
   100
kleing@15893
   101
\newcommand{\isakeyword}[1]
wenzelm@18962
   102
{\emph{\bf\def\isachardot{.}\def\isacharunderscore{\isacharunderscorekeyword}%
kleing@15893
   103
\def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}}
kleing@15893
   104
\newcommand{\isacommand}[1]{\isakeyword{#1}}
kleing@15893
   105
kleing@15893
   106
\newcommand{\isamarkupheader}[1]{\section{#1}}
kleing@15893
   107
\newcommand{\isamarkupchapter}[1]{\chapter{#1}}
kleing@15893
   108
\newcommand{\isamarkupsection}[1]{\section{#1}}
kleing@15893
   109
\newcommand{\isamarkupsubsection}[1]{\subsection{#1}}
kleing@15893
   110
\newcommand{\isamarkupsubsubsection}[1]{\subsubsection{#1}}
kleing@15893
   111
\newcommand{\isamarkupsect}[1]{\section{#1}}
kleing@15893
   112
\newcommand{\isamarkupsubsect}[1]{\subsection{#1}}
kleing@15893
   113
\newcommand{\isamarkupsubsubsect}[1]{\subsubsection{#1}}
kleing@15893
   114
kleing@15893
   115
\newif\ifisamarkup
kleing@15893
   116
\newcommand{\isabeginpar}{\par\ifisamarkup\relax\else\medskip\fi}
kleing@15893
   117
\newcommand{\isaendpar}{\par\medskip}
kleing@15893
   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}}
kleing@15893
   121
\newcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}}
kleing@15893
   122
kleing@15893
   123
wenzelm@18962
   124
% styles
wenzelm@18962
   125
wenzelm@18962
   126
\def\isabellestyle#1{\csname isabellestyle#1\endcsname}
kleing@15893
   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
kleing@15893
   135
kleing@15893
   136
\newcommand{\isabellestylett}{%
kleing@15893
   137
\renewcommand{\isastyle}{\small\tt}%
kleing@15893
   138
\renewcommand{\isastyleminor}{\small\tt}%
kleing@15893
   139
\renewcommand{\isastylescript}{\footnotesize\tt}%
wenzelm@18962
   140
\isachardefaults%
kleing@15893
   141
}
wenzelm@18962
   142
kleing@15893
   143
\newcommand{\isabellestyleit}{%
kleing@15893
   144
\renewcommand{\isastyle}{\small\it}%
kleing@15893
   145
\renewcommand{\isastyleminor}{\it}%
kleing@15893
   146
\renewcommand{\isastylescript}{\footnotesize\it}%
wenzelm@18962
   147
\renewcommand{\isacharunderscorekeyword}{\mbox{-}}%
kleing@15893
   148
\renewcommand{\isacharbang}{\isamath{!}}%
kleing@15893
   149
\renewcommand{\isachardoublequote}{}%
wenzelm@17175
   150
\renewcommand{\isachardoublequoteopen}{}%
wenzelm@17175
   151
\renewcommand{\isachardoublequoteclose}{}%
kleing@15893
   152
\renewcommand{\isacharhash}{\isamath{\#}}%
kleing@15893
   153
\renewcommand{\isachardollar}{\isamath{\$}}%
kleing@15893
   154
\renewcommand{\isacharpercent}{\isamath{\%}}%
kleing@15893
   155
\renewcommand{\isacharampersand}{\isamath{\&}}%
kleing@15893
   156
\renewcommand{\isacharprime}{\isamath{\mskip2mu{'}\mskip-2mu}}%
kleing@15893
   157
\renewcommand{\isacharparenleft}{\isamath{(}}%
kleing@15893
   158
\renewcommand{\isacharparenright}{\isamath{)}}%
kleing@15893
   159
\renewcommand{\isacharasterisk}{\isamath{*}}%
kleing@15893
   160
\renewcommand{\isacharplus}{\isamath{+}}%
kleing@15893
   161
\renewcommand{\isacharcomma}{\isamath{\mathord,}}%
kleing@15893
   162
\renewcommand{\isacharminus}{\isamath{-}}%
kleing@15893
   163
\renewcommand{\isachardot}{\isamath{\mathord.}}%
kleing@15893
   164
\renewcommand{\isacharslash}{\isamath{/}}%
kleing@15893
   165
\renewcommand{\isacharcolon}{\isamath{\mathord:}}%
kleing@15893
   166
\renewcommand{\isacharsemicolon}{\isamath{\mathord;}}%
kleing@15893
   167
\renewcommand{\isacharless}{\isamath{<}}%
kleing@15893
   168
\renewcommand{\isacharequal}{\isamath{=}}%
kleing@15893
   169
\renewcommand{\isachargreater}{\isamath{>}}%
kleing@15893
   170
\renewcommand{\isacharat}{\isamath{@}}%
kleing@15893
   171
\renewcommand{\isacharbrackleft}{\isamath{[}}%
wenzelm@17125
   172
\renewcommand{\isacharbackslash}{\isamath{\backslash}}%
kleing@15893
   173
\renewcommand{\isacharbrackright}{\isamath{]}}%
kleing@15893
   174
\renewcommand{\isacharunderscore}{\mbox{-}}%
kleing@15893
   175
\renewcommand{\isacharbraceleft}{\isamath{\{}}%
kleing@15893
   176
\renewcommand{\isacharbar}{\isamath{\mid}}%
kleing@15893
   177
\renewcommand{\isacharbraceright}{\isamath{\}}}%
kleing@15893
   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@17214
   181
\renewcommand{\isacharverbatimopen}{\isamath{\langle\!\langle}}%
wenzelm@17214
   182
\renewcommand{\isacharverbatimclose}{\isamath{\rangle\!\rangle}}%
kleing@15893
   183
}
kleing@15893
   184
kleing@15893
   185
\newcommand{\isabellestylesl}{%
kleing@15893
   186
\isabellestyleit%
kleing@15893
   187
\renewcommand{\isastyle}{\small\sl}%
kleing@15893
   188
\renewcommand{\isastyleminor}{\sl}%
kleing@15893
   189
\renewcommand{\isastylescript}{\footnotesize\sl}%
kleing@15893
   190
}
wenzelm@17125
   191
wenzelm@17125
   192
wenzelm@17125
   193
% tagged regions
wenzelm@17125
   194
wenzelm@17125
   195
%plain TeX version of comment package -- much faster!
wenzelm@17125
   196
\let\isafmtname\fmtname\def\fmtname{plain}
wenzelm@17125
   197
\usepackage{comment}
wenzelm@17125
   198
\let\fmtname\isafmtname
wenzelm@17125
   199
wenzelm@17125
   200
\newcommand{\isafold}[1]{\emph{$\langle\mathord{\mathit{#1}}\rangle$}}
wenzelm@17125
   201
wenzelm@17125
   202
\newcommand{\isakeeptag}[1]%
wenzelm@17125
   203
{\includecomment{isadelim#1}\includecomment{isatag#1}\csarg\def{isafold#1}{}}
wenzelm@17125
   204
\newcommand{\isadroptag}[1]%
wenzelm@17125
   205
{\excludecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{}}
wenzelm@17125
   206
\newcommand{\isafoldtag}[1]%
wenzelm@17125
   207
{\includecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{\isafold{#1}}}
wenzelm@17125
   208
wenzelm@17125
   209
\isakeeptag{theory}
wenzelm@17125
   210
\isakeeptag{proof}
wenzelm@17125
   211
\isakeeptag{ML}
wenzelm@17125
   212
\isakeeptag{visible}
wenzelm@17125
   213
\isadroptag{invisible}
wenzelm@17125
   214
wenzelm@17125
   215
\IfFileExists{isabelletags.sty}{\usepackage{isabelletags}}{}