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