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