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