lib/texinputs/isabelle.sty
author wenzelm
Wed Dec 06 21:30:26 2017 +0100 (9 months ago)
changeset 67151 d1ace598c026
parent 67146 909dcdec2122
child 67374 5a049cf98438
permissions -rw-r--r--
more default tags;
     1 %%
     2 %% macros for Isabelle generated LaTeX output
     3 %%
     4 
     5 %%% Simple document preparation (based on theory token language and symbols)
     6 
     7 % isabelle environments
     8 
     9 \newcommand{\isabellecontext}{UNKNOWN}
    10 \newcommand{\setisabellecontext}[1]{\def\isabellecontext{#1}}
    11 
    12 \newcommand{\isastyle}{\UNDEF}
    13 \newcommand{\isastylett}{\UNDEF}
    14 \newcommand{\isastyleminor}{\UNDEF}
    15 \newcommand{\isastyleminortt}{\UNDEF}
    16 \newcommand{\isastylescript}{\UNDEF}
    17 \newcommand{\isastyletext}{\normalsize\rm}
    18 \newcommand{\isastyletxt}{\rm}
    19 \newcommand{\isastylecmt}{\rm}
    20 
    21 \newcommand{\isaspacing}{%
    22   \sfcode 42 1000 % .
    23   \sfcode 63 1000 % ?
    24   \sfcode 33 1000 % !
    25   \sfcode 58 1000 % :
    26   \sfcode 59 1000 % ;
    27   \sfcode 44 1000 % ,
    28 }
    29 
    30 %symbol markup -- \emph achieves decent spacing via italic corrections
    31 \newcommand{\isamath}[1]{\emph{$#1$}}
    32 \newcommand{\isatext}[1]{\emph{#1}}
    33 \DeclareRobustCommand{\isascriptstyle}{\def\isamath##1{##1}\def\isatext##1{\mbox{\isaspacing\isastylescript##1}}}
    34 \newcommand{\isactrlsub}[1]{\emph{\isascriptstyle${}\sb{#1}$}}
    35 \newcommand{\isactrlsup}[1]{\emph{\isascriptstyle${}\sp{#1}$}}
    36 \DeclareRobustCommand{\isactrlbsub}{\emph\bgroup\math{}\sb\bgroup\mbox\bgroup\isaspacing\isastylescript}
    37 \DeclareRobustCommand{\isactrlesub}{\egroup\egroup\endmath\egroup}
    38 \DeclareRobustCommand{\isactrlbsup}{\emph\bgroup\math{}\sp\bgroup\mbox\bgroup\isaspacing\isastylescript}
    39 \DeclareRobustCommand{\isactrlesup}{\egroup\egroup\endmath\egroup}
    40 \newcommand{\isactrlbold}[1]{{\bfseries\upshape\boldmath#1}}
    41 
    42 \newcommand{\isaantiqcontrol}[1]{\isatt{{\char`\\}{\char`\<}{\char`\^}#1{\char`\>}}}
    43 \newenvironment{isaantiq}{{\isacharat\isacharbraceleft}}{{\isacharbraceright}}
    44 
    45 \newdimen\isa@parindent\newdimen\isa@parskip
    46 
    47 \newenvironment{isabellebody}{%
    48 \isamarkuptrue\par%
    49 \isa@parindent\parindent\parindent0pt%
    50 \isa@parskip\parskip\parskip0pt%
    51 \isaspacing\isastyle}{\par}
    52 
    53 \newenvironment{isabellebodytt}{%
    54 \isamarkuptrue\par%
    55 \isa@parindent\parindent\parindent0pt%
    56 \isa@parskip\parskip\parskip0pt%
    57 \isaspacing\isastylett}{\par}
    58 
    59 \newenvironment{isabelle}
    60 {\begin{trivlist}\begin{isabellebody}\item\relax}
    61 {\end{isabellebody}\end{trivlist}}
    62 
    63 \newenvironment{isabellett}
    64 {\begin{trivlist}\begin{isabellebodytt}\item\relax}
    65 {\end{isabellebodytt}\end{trivlist}}
    66 
    67 \newcommand{\isa}[1]{\emph{\isaspacing\isastyleminor #1}}
    68 \newcommand{\isatt}[1]{\emph{\isaspacing\isastyleminortt #1}}
    69 
    70 \newcommand{\isaindent}[1]{\hphantom{#1}}
    71 \newcommand{\isanewline}{\mbox{}\par\mbox{}}
    72 \newcommand{\isasep}{}
    73 \newcommand{\isadigit}[1]{#1}
    74 
    75 \newcommand{\isachardefaults}{%
    76 \def\isacharbell{\isamath{\bigbox}}%requires stmaryrd
    77 \chardef\isacharbang=`\!%
    78 \chardef\isachardoublequote=`\"%
    79 \chardef\isachardoublequoteopen=`\"%
    80 \chardef\isachardoublequoteclose=`\"%
    81 \chardef\isacharhash=`\#%
    82 \chardef\isachardollar=`\$%
    83 \chardef\isacharpercent=`\%%
    84 \chardef\isacharampersand=`\&%
    85 \chardef\isacharprime=`\'%
    86 \chardef\isacharparenleft=`\(%
    87 \chardef\isacharparenright=`\)%
    88 \chardef\isacharasterisk=`\*%
    89 \chardef\isacharplus=`\+%
    90 \chardef\isacharcomma=`\,%
    91 \chardef\isacharminus=`\-%
    92 \chardef\isachardot=`\.%
    93 \chardef\isacharslash=`\/%
    94 \chardef\isacharcolon=`\:%
    95 \chardef\isacharsemicolon=`\;%
    96 \chardef\isacharless=`\<%
    97 \chardef\isacharequal=`\=%
    98 \chardef\isachargreater=`\>%
    99 \chardef\isacharquery=`\?%
   100 \chardef\isacharat=`\@%
   101 \chardef\isacharbrackleft=`\[%
   102 \chardef\isacharbackslash=`\\%
   103 \chardef\isacharbrackright=`\]%
   104 \chardef\isacharcircum=`\^%
   105 \chardef\isacharunderscore=`\_%
   106 \def\isacharunderscorekeyword{\_}%
   107 \chardef\isacharbackquote=`\`%
   108 \chardef\isacharbackquoteopen=`\`%
   109 \chardef\isacharbackquoteclose=`\`%
   110 \chardef\isacharbraceleft=`\{%
   111 \chardef\isacharbar=`\|%
   112 \chardef\isacharbraceright=`\}%
   113 \chardef\isachartilde=`\~%
   114 \def\isacharverbatimopen{\isacharbraceleft\isacharasterisk}%
   115 \def\isacharverbatimclose{\isacharasterisk\isacharbraceright}%
   116 \def\isacartoucheopen{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\langle$}}}%
   117 \def\isacartoucheclose{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\rangle$}}}%
   118 }
   119 
   120 
   121 % keyword and section markup
   122 
   123 \newcommand{\isakeyword}[1]
   124 {\emph{\bf\def\isachardot{.}\def\isacharunderscore{\isacharunderscorekeyword}%
   125 \def\isacharbraceleft{\{}\def\isacharbraceright{\}}#1}}
   126 \newcommand{\isacommand}[1]{\isakeyword{#1}}
   127 
   128 \newcommand{\isakeywordcontrol}[1]
   129 {\emph{\bf\itshape\def\isacharunderscore{\isacharunderscorekeyword}#1\,}}
   130 
   131 \newcommand{\isamarkupheader}[1]{\section{#1}}
   132 \newcommand{\isamarkupchapter}[1]{\chapter{#1}}
   133 \newcommand{\isamarkupsection}[1]{\section{#1}}
   134 \newcommand{\isamarkupsubsection}[1]{\subsection{#1}}
   135 \newcommand{\isamarkupsubsubsection}[1]{\subsubsection{#1}}
   136 \newcommand{\isamarkupparagraph}[1]{\paragraph{#1}}
   137 \newcommand{\isamarkupsubparagraph}[1]{\subparagraph{#1}}
   138 
   139 \newif\ifisamarkup
   140 \newcommand{\isabeginpar}{\par\ifisamarkup\relax\else\medskip\fi}
   141 \newcommand{\isaendpar}{\par\medskip}
   142 \newenvironment{isapar}{\parindent\isa@parindent\parskip\isa@parskip\isabeginpar}{\isaendpar}
   143 \newenvironment{isamarkuptext}{\par\isastyletext\begin{isapar}}{\end{isapar}}
   144 \newenvironment{isamarkuptxt}{\par\isastyletxt\begin{isapar}}{\end{isapar}}
   145 \newcommand{\isamarkupcmt}[1]{{\isastylecmt--- #1}}
   146 
   147 
   148 % styles
   149 
   150 \def\isabellestyle#1{\csname isabellestyle#1\endcsname}
   151 
   152 \newcommand{\isabellestyledefault}{%
   153 \def\isastyle{\small\tt\slshape}%
   154 \def\isastylett{\small\tt}%
   155 \def\isastyleminor{\small\tt\slshape}%
   156 \def\isastyleminortt{\small\tt}%
   157 \def\isastylescript{\footnotesize\tt\slshape}%
   158 \isachardefaults%
   159 }
   160 \isabellestyledefault
   161 
   162 \newcommand{\isabellestylett}{%
   163 \def\isastyle{\small\tt}%
   164 \def\isastylett{\small\tt}%
   165 \def\isastyleminor{\small\tt}%
   166 \def\isastyleminortt{\small\tt}%
   167 \def\isastylescript{\footnotesize\tt}%
   168 \isachardefaults%
   169 }
   170 
   171 \newcommand{\isabellestyleit}{%
   172 \def\isastyle{\small\it}%
   173 \def\isastylett{\small\tt}%
   174 \def\isastyleminor{\it}%
   175 \def\isastyleminortt{\tt}%
   176 \def\isastylescript{\footnotesize\it}%
   177 \isachardefaults%
   178 \def\isacharunderscorekeyword{\mbox{-}}%
   179 \def\isacharbang{\isamath{!}}%
   180 \def\isachardoublequote{}%
   181 \def\isachardoublequoteopen{}%
   182 \def\isachardoublequoteclose{}%
   183 \def\isacharhash{\isamath{\#}}%
   184 \def\isachardollar{\isamath{\$}}%
   185 \def\isacharpercent{\isamath{\%}}%
   186 \def\isacharampersand{\isamath{\&}}%
   187 \def\isacharprime{\isamath{\mskip2mu{'}\mskip-2mu}}%
   188 \def\isacharparenleft{\isamath{(}}%
   189 \def\isacharparenright{\isamath{)}}%
   190 \def\isacharasterisk{\isamath{*}}%
   191 \def\isacharplus{\isamath{+}}%
   192 \def\isacharcomma{\isamath{\mathord,}}%
   193 \def\isacharminus{\isamath{-}}%
   194 \def\isachardot{\isamath{\mathord.}}%
   195 \def\isacharslash{\isamath{/}}%
   196 \def\isacharcolon{\isamath{\mathord:}}%
   197 \def\isacharsemicolon{\isamath{\mathord;}}%
   198 \def\isacharless{\isamath{<}}%
   199 \def\isacharequal{\isamath{=}}%
   200 \def\isachargreater{\isamath{>}}%
   201 \def\isacharat{\isamath{@}}%
   202 \def\isacharbrackleft{\isamath{[}}%
   203 \def\isacharbackslash{\isamath{\backslash}}%
   204 \def\isacharbrackright{\isamath{]}}%
   205 \def\isacharunderscore{\mbox{-}}%
   206 \def\isacharbraceleft{\isamath{\{}}%
   207 \def\isacharbar{\isamath{\mid}}%
   208 \def\isacharbraceright{\isamath{\}}}%
   209 \def\isachartilde{\isamath{{}\sp{\sim}}}%
   210 \def\isacharbackquoteopen{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\langle$}}}%
   211 \def\isacharbackquoteclose{\isatext{\raise.3ex\hbox{$\scriptscriptstyle\rangle$}}}%
   212 \def\isacharverbatimopen{\isamath{\langle\!\langle}}%
   213 \def\isacharverbatimclose{\isamath{\rangle\!\rangle}}%
   214 }
   215 
   216 \newcommand{\isabellestyleliteral}{%
   217 \isabellestyleit%
   218 \def\isacharunderscore{\_}%
   219 \def\isacharunderscorekeyword{\_}%
   220 \chardef\isacharbackquoteopen=`\`%
   221 \chardef\isacharbackquoteclose=`\`%
   222 }
   223 
   224 \newcommand{\isabellestyleliteralunderscore}{%
   225 \isabellestyleliteral%
   226 \def\isacharunderscore{\textunderscore}%
   227 \def\isacharunderscorekeyword{\textunderscore}%
   228 }
   229 
   230 \newcommand{\isabellestylesl}{%
   231 \isabellestyleit%
   232 \def\isastyle{\small\sl}%
   233 \def\isastylett{\small\tt}%
   234 \def\isastyleminor{\sl}%
   235 \def\isastyleminortt{\tt}%
   236 \def\isastylescript{\footnotesize\sl}%
   237 }
   238 
   239 
   240 % tagged regions
   241 
   242 %plain TeX version of comment package -- much faster!
   243 \let\isafmtname\fmtname\def\fmtname{plain}
   244 \usepackage{comment}
   245 \let\fmtname\isafmtname
   246 
   247 \newcommand{\isafold}[1]{\emph{$\langle\mathord{\mathit{#1}}\rangle$}}
   248 
   249 \newcommand{\isakeeptag}[1]%
   250 {\includecomment{isadelim#1}\includecomment{isatag#1}\csarg\def{isafold#1}{}}
   251 \newcommand{\isadroptag}[1]%
   252 {\excludecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{}}
   253 \newcommand{\isafoldtag}[1]%
   254 {\includecomment{isadelim#1}\excludecomment{isatag#1}\csarg\def{isafold#1}{\isafold{#1}}}
   255 
   256 \isakeeptag{document}
   257 \isakeeptag{theory}
   258 \isakeeptag{proof}
   259 \isakeeptag{ML}
   260 \isakeeptag{visible}
   261 \isadroptag{invisible}
   262 \isakeeptag{important}
   263 \isakeeptag{unimportant}
   264 
   265 \IfFileExists{isabelletags.sty}{\usepackage{isabelletags}}{}