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