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