doc-src/TutorialI/tutorial.sty
author nipkow
Tue, 07 May 2002 15:03:50 +0200
changeset 13111 2d6782e71702
parent 12638 812ce0d9fc85
child 14400 6069098854b9
permissions -rw-r--r--
*** empty log message ***
     1 % tutorial.sty : Isabelle Tutorial Page Layout
     2 %
     3 \typeout{Document Style tutorial. Released 9 July 2001}
     4 
     5 \hyphenation{Isa-belle man-u-script man-u-scripts ap-pen-dix mut-u-al-ly}
     6 \hyphenation{data-type data-types co-data-type co-data-types }
     7 
     8 %usage: \iflabelundefined{LABEL}{if not defined}{if defined}
     9 \newcommand{\iflabelundefined}[1]{\@ifundefined{r@#1}}
    10 
    11 
    12 %%%INDEXING  use isa-index to process the index
    13 
    14 \newcommand\seealso[2]{\emph{see also} #1}
    15 \usepackage{makeidx}
    16 
    17 %index, putting page numbers of definitions in boldface
    18 \def\bold#1{\textbf{#1}}
    19 \newcommand\fnote[1]{#1n}
    20 \newcommand\indexbold[1]{\index{#1|bold}}
    21 
    22 % The alternative to \protect\isa in the indexing macros is
    23 % \noexpand\noexpand \noexpand\isa
    24 % need TWO levels of \noexpand to delay the expansion of \isa:
    25 %  the \noexpand\noexpand will leave one \noexpand, to be given to the
    26 %  (still unexpanded) \isa token.  See TeX by Topic, page 122.
    27 
    28 %%%% for indexing constants, symbols, theorems, ...
    29 \newcommand\cdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (constant)}}
    30 \newcommand\sdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (symbol)}}
    31 
    32 \newcommand\tdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (theorem)}}
    33 \newcommand\tdxbold[1]{\isa{#1}\index{#1@\protect\isa{#1} (theorem)|bold}}
    34 
    35 \newcommand\cldx[1]{\isa{#1}\index{#1@\protect\isa{#1} (class)}}
    36 \newcommand\tydx[1]{\isa{#1}\index{#1@\protect\isa{#1} (type)}}
    37 \newcommand\thydx[1]{\isa{#1}\index{#1@\protect\isa{#1} (theory)}}
    38 
    39 \newcommand\attrdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (attribute)}}
    40 \newcommand\cmmdx[1]{\index{#1@\protect\isacommand{#1} (command)}}
    41 \newcommand\commdx[1]{\isacommand{#1}\index{#1@\protect\isacommand{#1} (command)}}
    42 \newcommand\methdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (method)}}
    43 \newcommand\tooldx[1]{\isa{#1}\index{#1@\protect\isa{#1} (tool)}}
    44 \newcommand\settdx[1]{\isa{#1}\index{#1@\protect\isa{#1} (setting)}}
    45 
    46 %set argument in \bf font and index in ROMAN font (for definitions in text!)
    47 \newcommand\bfindex[1]{{\bf#1}\index{#1|bold}\@}
    48 
    49 \newcommand\rmindex[1]{{#1}\index{#1}\@}
    50 \newcommand\ttindex[1]{\texttt{#1}\index{#1@\texttt{#1}}\@}
    51 \newcommand\ttindexbold[1]{\texttt{#1}\index{#1@\texttt{#1}|bold}\@}
    52 
    53 %Commented-out the original versions to see what the index looks like without them.
    54 %   In any event, they need to use \isa or \protect\isa rather than \texttt.
    55 %%\newcommand{\indexboldpos}[2]{#1\index{#2@#1|bold}\@}
    56 %%\newcommand{\ttindexboldpos}[2]{\texttt{#1}\index{#2@\texttt{#1}|bold}\@}
    57 \newcommand{\indexboldpos}[2]{#1\@}
    58 \newcommand{\ttindexboldpos}[2]{\isa{#1}\@}
    59 
    60 %\newtheorem{theorem}{Theorem}[section]
    61 \newtheorem{Exercise}{Exercise}[section]
    62 \newenvironment{exercise}{\begin{Exercise}\rm}{\end{Exercise}}
    63 \newcommand{\ttlbr}{\texttt{[|}}
    64 \newcommand{\ttrbr}{\texttt{|]}}
    65 \newcommand{\ttor}{\texttt{|}}
    66 \newcommand{\ttall}{\texttt{!}}
    67 \newcommand{\ttuniquex}{\texttt{?!}}
    68 \newcommand{\ttEXU}{\texttt{EX!}}
    69 \newcommand{\ttAnd}{\texttt{!!}}
    70 
    71 \newcommand{\isasymignore}{}
    72 \newcommand{\isasymimp}{\isasymlongrightarrow}
    73 \newcommand{\isasymImp}{\isasymLongrightarrow}
    74 \newcommand{\isasymFun}{\isasymRightarrow}
    75 \newcommand{\isasymuniqex}{\isamath{\exists!\,}}
    76 \renewcommand{\S}{Sect.\ts}
    77 
    78 \renewenvironment{isamarkuptxt}{\begin{isamarkuptext}}{\end{isamarkuptext}}
    79 
    80 \newif\ifremarks
    81 \newcommand{\REMARK}[1]{\ifremarks\marginpar{\raggedright\footnotesize#1}\fi}
    82 
    83 %names of Isabelle rules
    84 \newcommand{\rulename}[1]{\hfill(#1)}
    85 \newcommand{\rulenamedx}[1]{\hfill(#1\index{#1@\protect\isa{#1} (theorem)|bold})}
    86 
    87 %%%% meta-logical connectives
    88 
    89 \let\Forall=\bigwedge
    90 \let\Imp=\Longrightarrow
    91 \let\To=\Rightarrow
    92 \newcommand{\Var}[1]{{?\!#1}}
    93 
    94 %%% underscores as ordinary characters, not for subscripting
    95 %%  use @ or \sb for subscripting; use \at for @
    96 %%  only works in \tt font
    97 %%  must not make _ an active char; would make \ttindex fail!
    98 \gdef\underscoreoff{\catcode`\@=8\catcode`\_=\other}
    99 \gdef\underscoreon{\catcode`\_=8\makeatother}
   100 \chardef\other=12
   101 \chardef\at=`\@
   102 
   103 % alternative underscore
   104 \def\_{\leavevmode\kern.06em\vbox{\hrule height.2ex width.3em}\hskip0.1em}
   105 
   106 
   107 %%%% ``WARNING'' environment
   108 \def\dbend{\vtop to 0pt{\vss\hbox{\Huge\bf!}\vss}}
   109 \newenvironment{warn}{\medskip\medbreak\begingroup \clubpenalty=10000 
   110          \small %%WAS\baselineskip=0.9\baselineskip
   111          \noindent \hangindent\parindent \hangafter=-2 
   112          \hbox to0pt{\hskip-\hangindent\dbend\hfill}\ignorespaces}%
   113         {\par\endgroup\medbreak}
   114 
   115 
   116 %%%% Standard logical symbols
   117 \let\turn=\vdash
   118 \let\conj=\wedge
   119 \let\disj=\vee
   120 \let\imp=\rightarrow
   121 \let\bimp=\leftrightarrow
   122 \newcommand\all[1]{\forall#1.}  %quantification
   123 \newcommand\ex[1]{\exists#1.}
   124 \newcommand{\pair}[1]{\langle#1\rangle}
   125 
   126 \newcommand{\lparr}{\mathopen{(\!|}}
   127 \newcommand{\rparr}{\mathclose{|\!)}}
   128 \newcommand{\fs}{\mathpunct{,\,}}
   129 \newcommand{\ty}{\mathrel{::}}
   130 \newcommand{\asn}{\mathrel{:=}}
   131 \newcommand{\more}{\ldots}
   132 \newcommand{\record}[1]{\lparr #1 \rparr}
   133 \newcommand{\dtt}{\mathord.}
   134 
   135 \newcommand\lbrakk{\mathopen{[\![}}
   136 \newcommand\rbrakk{\mathclose{]\!]}}
   137 \newcommand\List[1]{\lbrakk#1\rbrakk}  %was \obj
   138 \newcommand\vpile[1]{\begin{array}{c}#1\end{array}}
   139 \newenvironment{matharray}[1]{\[\begin{array}{#1}}{\end{array}\]}
   140 \newcommand{\Text}[1]{\mbox{#1}}
   141 
   142 \DeclareMathSymbol{\dshsym}{\mathalpha}{letters}{"2D}
   143 \newcommand{\dsh}{\mathit{\dshsym}}
   144 
   145 \let\int=\cap
   146 \let\un=\cup
   147 \let\inter=\bigcap
   148 \let\union=\bigcup
   149 
   150 \def\ML{{\sc ml}}
   151 \def\AST{{\sc ast}}
   152 
   153 %macros to change the treatment of symbols
   154 \def\relsemicolon{\mathcode`\;="303B}   %treat ; like a relation
   155 \def\binperiod{\mathcode`\.="213A}   %treat . like a binary operator
   156 \def\binvert{\mathcode`\|="226A}     %treat | like a binary operator
   157 
   158 %redefinition of \sloppy and \fussy to use \emergencystretch
   159 \def\sloppy{\tolerance2000 \hfuzz.5pt \vfuzz.5pt \emergencystretch=15pt}
   160 \def\fussy{\tolerance200 \hfuzz.1pt \vfuzz.1pt \emergencystretch=0pt}
   161 
   162 %non-bf version of description
   163 \def\descrlabel#1{\hspace\labelsep #1}
   164 \def\descr{\list{}{\labelwidth\z@ \itemindent-\leftmargin\let\makelabel\descrlabel}}
   165 \let\enddescr\endlist
   166 
   167 % The mathcodes for the letters A, ..., Z, a, ..., z are changed to
   168 % generate text italic rather than math italic by default. This makes
   169 % multi-letter identifiers look better. The mathcode for character c
   170 % is set to |"7000| (variable family) + |"400| (text italic) + |c|.
   171 %
   172 \DeclareSymbolFont{italics}{\encodingdefault}{\rmdefault}{m}{it}%
   173 \def\@setmcodes#1#2#3{{\count0=#1 \count1=#3
   174         \loop \global\mathcode\count0=\count1 \ifnum \count0<#2
   175         \advance\count0 by1 \advance\count1 by1 \repeat}}
   176 \@setmcodes{`A}{`Z}{"7\hexnumber@\symitalics41}
   177 \@setmcodes{`a}{`z}{"7\hexnumber@\symitalics61}