doc-src/AxClass/Group/document/isabelle.sty
author wenzelm
Tue Oct 16 17:07:40 2007 +0200 (2007-10-16)
changeset 25056 743f3603ba8b
parent 22649 6cf96b9f7b9e
child 25160 72fcf0832cfe
permissions -rw-r--r--
updated;
     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 \DeclareRobustCommand{\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 \newenvironment{isaantiq}{{\isacharat\isacharbraceleft}}{{\isacharbraceright}}
    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 \newcommand{\isachardefaults}{%
    57 \chardef\isacharbang=`\!%
    58 \chardef\isachardoublequote=`\"%
    59 \chardef\isachardoublequoteopen=`\"%
    60 \chardef\isachardoublequoteclose=`\"%
    61 \chardef\isacharhash=`\#%
    62 \chardef\isachardollar=`\$%
    63 \chardef\isacharpercent=`\%%
    64 \chardef\isacharampersand=`\&%
    65 \chardef\isacharprime=`\'%
    66 \chardef\isacharparenleft=`\(%
    67 \chardef\isacharparenright=`\)%
    68 \chardef\isacharasterisk=`\*%
    69 \chardef\isacharplus=`\+%
    70 \chardef\isacharcomma=`\,%
    71 \chardef\isacharminus=`\-%
    72 \chardef\isachardot=`\.%
    73 \chardef\isacharslash=`\/%
    74 \chardef\isacharcolon=`\:%
    75 \chardef\isacharsemicolon=`\;%
    76 \chardef\isacharless=`\<%
    77 \chardef\isacharequal=`\=%
    78 \chardef\isachargreater=`\>%
    79 \chardef\isacharquery=`\?%
    80 \chardef\isacharat=`\@%
    81 \chardef\isacharbrackleft=`\[%
    82 \chardef\isacharbackslash=`\\%
    83 \chardef\isacharbrackright=`\]%
    84 \chardef\isacharcircum=`\^%
    85 \chardef\isacharunderscore=`\_%
    86 \def\isacharunderscorekeyword{\_}%
    87 \chardef\isacharbackquote=`\`%
    88 \chardef\isacharbackquoteopen=`\`%
    89 \chardef\isacharbackquoteclose=`\`%
    90 \chardef\isacharbraceleft=`\{%
    91 \chardef\isacharbar=`\|%
    92 \chardef\isacharbraceright=`\}%
    93 \chardef\isachartilde=`\~%
    94 \def\isacharverbatimopen{\isacharbraceleft\isacharasterisk}%
    95 \def\isacharverbatimclose{\isacharasterisk\isacharbraceright}%
    96 }
    97 
    98 
    99 % keyword and section markup
   100 
   101 \newcommand{\isakeyword}[1]
   102 {\emph{\bf\def\isachardot{.}\def\isacharunderscore{\isacharunderscorekeyword}%
   103 \def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}}
   104 \newcommand{\isacommand}[1]{\isakeyword{#1}}
   105 
   106 \newcommand{\isamarkupheader}[1]{\section{#1}}
   107 \newcommand{\isamarkupchapter}[1]{\chapter{#1}}
   108 \newcommand{\isamarkupsection}[1]{\section{#1}}
   109 \newcommand{\isamarkupsubsection}[1]{\subsection{#1}}
   110 \newcommand{\isamarkupsubsubsection}[1]{\subsubsection{#1}}
   111 \newcommand{\isamarkupsect}[1]{\section{#1}}
   112 \newcommand{\isamarkupsubsect}[1]{\subsection{#1}}
   113 \newcommand{\isamarkupsubsubsect}[1]{\subsubsection{#1}}
   114 
   115 \newif\ifisamarkup
   116 \newcommand{\isabeginpar}{\par\ifisamarkup\relax\else\medskip\fi}
   117 \newcommand{\isaendpar}{\par\medskip}
   118 \newenvironment{isapar}{\parindent\isa@parindent\parskip\isa@parskip\isabeginpar}{\isaendpar}
   119 \newenvironment{isamarkuptext}{\par\isastyletext\begin{isapar}}{\end{isapar}}
   120 \newenvironment{isamarkuptxt}{\par\isastyletxt\begin{isapar}}{\end{isapar}}
   121 \newcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}}
   122 
   123 
   124 % styles
   125 
   126 \def\isabellestyle#1{\csname isabellestyle#1\endcsname}
   127 
   128 \newcommand{\isabellestyledefault}{%
   129 \renewcommand{\isastyle}{\small\tt\slshape}%
   130 \renewcommand{\isastyleminor}{\small\tt\slshape}%
   131 \renewcommand{\isastylescript}{\footnotesize\tt\slshape}%
   132 \isachardefaults%
   133 }
   134 \isabellestyledefault
   135 
   136 \newcommand{\isabellestylett}{%
   137 \renewcommand{\isastyle}{\small\tt}%
   138 \renewcommand{\isastyleminor}{\small\tt}%
   139 \renewcommand{\isastylescript}{\footnotesize\tt}%
   140 \isachardefaults%
   141 }
   142 
   143 \newcommand{\isabellestyleit}{%
   144 \renewcommand{\isastyle}{\small\it}%
   145 \renewcommand{\isastyleminor}{\it}%
   146 \renewcommand{\isastylescript}{\footnotesize\it}%
   147 \renewcommand{\isacharunderscorekeyword}{\mbox{-}}%
   148 \renewcommand{\isacharbang}{\isamath{!}}%
   149 \renewcommand{\isachardoublequote}{}%
   150 \renewcommand{\isachardoublequoteopen}{}%
   151 \renewcommand{\isachardoublequoteclose}{}%
   152 \renewcommand{\isacharhash}{\isamath{\#}}%
   153 \renewcommand{\isachardollar}{\isamath{\$}}%
   154 \renewcommand{\isacharpercent}{\isamath{\%}}%
   155 \renewcommand{\isacharampersand}{\isamath{\&}}%
   156 \renewcommand{\isacharprime}{\isamath{\mskip2mu{'}\mskip-2mu}}%
   157 \renewcommand{\isacharparenleft}{\isamath{(}}%
   158 \renewcommand{\isacharparenright}{\isamath{)}}%
   159 \renewcommand{\isacharasterisk}{\isamath{*}}%
   160 \renewcommand{\isacharplus}{\isamath{+}}%
   161 \renewcommand{\isacharcomma}{\isamath{\mathord,}}%
   162 \renewcommand{\isacharminus}{\isamath{-}}%
   163 \renewcommand{\isachardot}{\isamath{\mathord.}}%
   164 \renewcommand{\isacharslash}{\isamath{/}}%
   165 \renewcommand{\isacharcolon}{\isamath{\mathord:}}%
   166 \renewcommand{\isacharsemicolon}{\isamath{\mathord;}}%
   167 \renewcommand{\isacharless}{\isamath{<}}%
   168 \renewcommand{\isacharequal}{\isamath{=}}%
   169 \renewcommand{\isachargreater}{\isamath{>}}%
   170 \renewcommand{\isacharat}{\isamath{@}}%
   171 \renewcommand{\isacharbrackleft}{\isamath{[}}%
   172 \renewcommand{\isacharbackslash}{\isamath{\backslash}}%
   173 \renewcommand{\isacharbrackright}{\isamath{]}}%
   174 \renewcommand{\isacharunderscore}{\mbox{-}}%
   175 \renewcommand{\isacharbraceleft}{\isamath{\{}}%
   176 \renewcommand{\isacharbar}{\isamath{\mid}}%
   177 \renewcommand{\isacharbraceright}{\isamath{\}}}%
   178 \renewcommand{\isachartilde}{\isamath{{}\sp{\sim}}}%
   179 \renewcommand{\isacharbackquoteopen}{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\langle$}}}%
   180 \renewcommand{\isacharbackquoteclose}{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\rangle$}}}%
   181 \renewcommand{\isacharverbatimopen}{\isamath{\langle\!\langle}}%
   182 \renewcommand{\isacharverbatimclose}{\isamath{\rangle\!\rangle}}%
   183 }
   184 
   185 \newcommand{\isabellestylesl}{%
   186 \isabellestyleit%
   187 \renewcommand{\isastyle}{\small\sl}%
   188 \renewcommand{\isastyleminor}{\sl}%
   189 \renewcommand{\isastylescript}{\footnotesize\sl}%
   190 }
   191 
   192 
   193 % tagged regions
   194 
   195 %plain TeX version of comment package -- much faster!
   196 \let\isafmtname\fmtname\def\fmtname{plain}
   197 \usepackage{comment}
   198 \let\fmtname\isafmtname
   199 
   200 \newcommand{\isafold}[1]{\emph{$\langle\mathord{\mathit{#1}}\rangle$}}
   201 
   202 \newcommand{\isakeeptag}[1]%
   203 {\includecomment{isadelim#1}\includecomment{isatag#1}\csarg\def{isafold#1}{}}
   204 \newcommand{\isadroptag}[1]%
   205 {\excludecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{}}
   206 \newcommand{\isafoldtag}[1]%
   207 {\includecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{\isafold{#1}}}
   208 
   209 \isakeeptag{theory}
   210 \isakeeptag{proof}
   211 \isakeeptag{ML}
   212 \isakeeptag{visible}
   213 \isadroptag{invisible}
   214 
   215 \IfFileExists{isabelletags.sty}{\usepackage{isabelletags}}{}