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