doc-src/IsarTut/Tutorial/document/isabelle.sty
changeset 15901 3def24755c37
parent 15900 d6156cb8dc2e
child 15902 0fce3f919aec
equal deleted inserted replaced
15900:d6156cb8dc2e 15901:3def24755c37
     1 %%
       
     2 %% Author: Markus Wenzel, TU Muenchen
       
     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}{\small\tt\slshape}
       
    14 \newcommand{\isastyleminor}{\small\tt\slshape}
       
    15 \newcommand{\isastylescript}{\footnotesize\tt\slshape}
       
    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{\isactrlbold}[1]{{\bfseries\upshape\boldmath#1}}
       
    27 
       
    28 \newdimen\isa@parindent\newdimen\isa@parskip
       
    29 
       
    30 \newenvironment{isabellebody}{%
       
    31 \isamarkuptrue\par%
       
    32 \isa@parindent\parindent\parindent0pt%
       
    33 \isa@parskip\parskip\parskip0pt%
       
    34 \isastyle}{\par}
       
    35 
       
    36 \newenvironment{isabelle}
       
    37 {\begin{trivlist}\begin{isabellebody}\item\relax}
       
    38 {\end{isabellebody}\end{trivlist}}
       
    39 
       
    40 \newcommand{\isa}[1]{\emph{\isastyleminor #1}}
       
    41 
       
    42 \newcommand{\isaindent}[1]{\hphantom{#1}}
       
    43 \newcommand{\isanewline}{\mbox{}\\\mbox{}}
       
    44 \newcommand{\isadigit}[1]{#1}
       
    45 
       
    46 \chardef\isacharbang=`\!
       
    47 \chardef\isachardoublequote=`\"
       
    48 \chardef\isacharhash=`\#
       
    49 \chardef\isachardollar=`\$
       
    50 \chardef\isacharpercent=`\%
       
    51 \chardef\isacharampersand=`\&
       
    52 \chardef\isacharprime=`\'
       
    53 \chardef\isacharparenleft=`\(
       
    54 \chardef\isacharparenright=`\)
       
    55 \chardef\isacharasterisk=`\*
       
    56 \chardef\isacharplus=`\+
       
    57 \chardef\isacharcomma=`\,
       
    58 \chardef\isacharminus=`\-
       
    59 \chardef\isachardot=`\.
       
    60 \chardef\isacharslash=`\/
       
    61 \chardef\isacharcolon=`\:
       
    62 \chardef\isacharsemicolon=`\;
       
    63 \chardef\isacharless=`\<
       
    64 \chardef\isacharequal=`\=
       
    65 \chardef\isachargreater=`\>
       
    66 \chardef\isacharquery=`\?
       
    67 \chardef\isacharat=`\@
       
    68 \chardef\isacharbrackleft=`\[
       
    69 \chardef\isacharbackslash=`\\
       
    70 \chardef\isacharbrackright=`\]
       
    71 \chardef\isacharcircum=`\^
       
    72 \chardef\isacharunderscore=`\_
       
    73 \chardef\isacharbackquote=`\`
       
    74 \chardef\isacharbraceleft=`\{
       
    75 \chardef\isacharbar=`\|
       
    76 \chardef\isacharbraceright=`\}
       
    77 \chardef\isachartilde=`\~
       
    78 
       
    79 
       
    80 % keyword and section markup
       
    81 
       
    82 \newcommand{\isakeywordcharunderscore}{\_}
       
    83 \newcommand{\isakeyword}[1]
       
    84 {\emph{\bf\def\isachardot{.}\def\isacharunderscore{\isakeywordcharunderscore}%
       
    85 \def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}}
       
    86 \newcommand{\isacommand}[1]{\isakeyword{#1}}
       
    87 
       
    88 \newcommand{\isamarkupheader}[1]{\section{#1}}
       
    89 \newcommand{\isamarkupchapter}[1]{\chapter{#1}}
       
    90 \newcommand{\isamarkupsection}[1]{\section{#1}}
       
    91 \newcommand{\isamarkupsubsection}[1]{\subsection{#1}}
       
    92 \newcommand{\isamarkupsubsubsection}[1]{\subsubsection{#1}}
       
    93 \newcommand{\isamarkupsect}[1]{\section{#1}}
       
    94 \newcommand{\isamarkupsubsect}[1]{\subsection{#1}}
       
    95 \newcommand{\isamarkupsubsubsect}[1]{\subsubsection{#1}}
       
    96 
       
    97 \newif\ifisamarkup
       
    98 \newcommand{\isabeginpar}{\par\ifisamarkup\relax\else\medskip\fi}
       
    99 \newcommand{\isaendpar}{\par\medskip}
       
   100 \newenvironment{isapar}{\parindent\isa@parindent\parskip\isa@parskip\isabeginpar}{\isaendpar}
       
   101 \newenvironment{isamarkuptext}{\isastyletext\begin{isapar}}{\end{isapar}}
       
   102 \newenvironment{isamarkuptxt}{\isastyletxt\begin{isapar}}{\end{isapar}}
       
   103 \newcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}}
       
   104 
       
   105 
       
   106 % alternative styles
       
   107 
       
   108 \newcommand{\isabellestyle}{}
       
   109 \def\isabellestyle#1{\csname isabellestyle#1\endcsname}
       
   110 
       
   111 \newcommand{\isabellestylett}{%
       
   112 \renewcommand{\isastyle}{\small\tt}%
       
   113 \renewcommand{\isastyleminor}{\small\tt}%
       
   114 \renewcommand{\isastylescript}{\footnotesize\tt}%
       
   115 }
       
   116 \newcommand{\isabellestyleit}{%
       
   117 \renewcommand{\isastyle}{\small\it}%
       
   118 \renewcommand{\isastyleminor}{\it}%
       
   119 \renewcommand{\isastylescript}{\footnotesize\it}%
       
   120 \renewcommand{\isakeywordcharunderscore}{\mbox{-}}%
       
   121 \renewcommand{\isacharbang}{\isamath{!}}%
       
   122 \renewcommand{\isachardoublequote}{}%
       
   123 \renewcommand{\isacharhash}{\isamath{\#}}%
       
   124 \renewcommand{\isachardollar}{\isamath{\$}}%
       
   125 \renewcommand{\isacharpercent}{\isamath{\%}}%
       
   126 \renewcommand{\isacharampersand}{\isamath{\&}}%
       
   127 \renewcommand{\isacharprime}{\isamath{\mskip2mu{'}\mskip-2mu}}%
       
   128 \renewcommand{\isacharparenleft}{\isamath{(}}%
       
   129 \renewcommand{\isacharparenright}{\isamath{)}}%
       
   130 \renewcommand{\isacharasterisk}{\isamath{*}}%
       
   131 \renewcommand{\isacharplus}{\isamath{+}}%
       
   132 \renewcommand{\isacharcomma}{\isamath{\mathord,}}%
       
   133 \renewcommand{\isacharminus}{\isamath{-}}%
       
   134 \renewcommand{\isachardot}{\isamath{\mathord.}}%
       
   135 \renewcommand{\isacharslash}{\isamath{/}}%
       
   136 \renewcommand{\isacharcolon}{\isamath{\mathord:}}%
       
   137 \renewcommand{\isacharsemicolon}{\isamath{\mathord;}}%
       
   138 \renewcommand{\isacharless}{\isamath{<}}%
       
   139 \renewcommand{\isacharequal}{\isamath{=}}%
       
   140 \renewcommand{\isachargreater}{\isamath{>}}%
       
   141 \renewcommand{\isacharat}{\isamath{@}}%
       
   142 \renewcommand{\isacharbrackleft}{\isamath{[}}%
       
   143 \renewcommand{\isacharbrackright}{\isamath{]}}%
       
   144 \renewcommand{\isacharunderscore}{\mbox{-}}%
       
   145 \renewcommand{\isacharbraceleft}{\isamath{\{}}%
       
   146 \renewcommand{\isacharbar}{\isamath{\mid}}%
       
   147 \renewcommand{\isacharbraceright}{\isamath{\}}}%
       
   148 \renewcommand{\isachartilde}{\isamath{{}\sp{\sim}}}%
       
   149 }
       
   150 
       
   151 \newcommand{\isabellestylesl}{%
       
   152 \isabellestyleit%
       
   153 \renewcommand{\isastyle}{\small\sl}%
       
   154 \renewcommand{\isastyleminor}{\sl}%
       
   155 \renewcommand{\isastylescript}{\footnotesize\sl}%
       
   156 }