author | wenzelm |
Thu, 22 Oct 2015 21:34:28 +0200 | |
changeset 61504 | a7ae3ef886a9 |
parent 61503 | 28e788ca2c5d |
child 61575 | f18f6e51e901 |
permissions | -rw-r--r-- |
28221 | 1 |
theory Presentation |
43564
9864182c6bad
document antiquotations are managed as theory data, with proper name space and entity markup;
wenzelm
parents:
42009
diff
changeset
|
2 |
imports Base |
28221 | 3 |
begin |
4 |
||
58618 | 5 |
chapter \<open>Presenting theories \label{ch:present}\<close> |
28221 | 6 |
|
58618 | 7 |
text \<open>Isabelle provides several ways to present the outcome of |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
8 |
formal developments, including WWW-based browsable libraries or |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
9 |
actual printable documents. Presentation is centered around the |
61477 | 10 |
concept of \<^emph>\<open>sessions\<close> (\chref{ch:session}). The global session |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
11 |
structure is that of a tree, with Isabelle Pure at its root, further |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
12 |
object-logics derived (e.g.\ HOLCF from HOL, and HOL from Pure), and |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
13 |
application sessions further on in the hierarchy. |
28221 | 14 |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
15 |
The tools @{tool_ref mkroot} and @{tool_ref build} provide the |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
16 |
primary means for managing Isabelle sessions, including proper setup |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
17 |
for presentation; @{tool build} takes care to have @{executable_ref |
56439
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
wenzelm
parents:
54936
diff
changeset
|
18 |
"isabelle_process"} run any additional stages required for document |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
19 |
preparation, notably the @{tool_ref document} and @{tool_ref latex}. |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
20 |
The complete tool chain for managing batch-mode Isabelle sessions is |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
21 |
illustrated in \figref{fig:session-tools}. |
28221 | 22 |
|
23 |
\begin{figure}[htbp] |
|
24 |
\begin{center} |
|
25 |
\begin{tabular}{lp{0.6\textwidth}} |
|
26 |
||
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
27 |
@{tool_ref mkroot} & invoked once by the user to initialize the |
61503 | 28 |
session \<^verbatim>\<open>ROOT\<close> with optional \<^verbatim>\<open>document\<close> |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
29 |
directory; \\ |
28221 | 30 |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
31 |
@{tool_ref build} & invoked repeatedly by the user to keep |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
32 |
session output up-to-date (HTML, documents etc.); \\ |
28221 | 33 |
|
56439
95e2656b3b23
renamed "isabelle-process" to "isabelle_process", with shell function to avoid dynamic path lookups;
wenzelm
parents:
54936
diff
changeset
|
34 |
@{executable "isabelle_process"} & run through @{tool_ref |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
35 |
build}; \\ |
28221 | 36 |
|
48602 | 37 |
@{tool_ref document} & run by the Isabelle process if document |
38 |
preparation is enabled; \\ |
|
28221 | 39 |
|
48602 | 40 |
@{tool_ref latex} & universal {\LaTeX} tool wrapper invoked |
41 |
multiple times by @{tool_ref document}; also useful for manual |
|
42 |
experiments; \\ |
|
28221 | 43 |
|
44 |
\end{tabular} |
|
45 |
\caption{The tool chain of Isabelle session presentation} \label{fig:session-tools} |
|
46 |
\end{center} |
|
47 |
\end{figure} |
|
58618 | 48 |
\<close> |
28221 | 49 |
|
50 |
||
58618 | 51 |
section \<open>Generating theory browser information \label{sec:info}\<close> |
28221 | 52 |
|
58618 | 53 |
text \<open> |
28221 | 54 |
\index{theory browsing information|bold} |
55 |
||
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
56 |
As a side-effect of building sessions, Isabelle is able to generate |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
57 |
theory browsing information, including HTML documents that show the |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
58 |
theory sources and the relationship with its ancestors and |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
59 |
descendants. Besides the HTML file that is generated for every |
51417 | 60 |
theory, Isabelle stores links to all theories of a session in an |
61 |
index file. As a second hierarchy, groups of sessions are organized |
|
61477 | 62 |
as \<^emph>\<open>chapters\<close>, with a separate index. Note that the implicit |
63 |
tree structure of the session build hierarchy is \<^emph>\<open>not\<close> relevant |
|
51417 | 64 |
for the presentation. |
28221 | 65 |
|
66 |
Isabelle also generates graph files that represent the theory |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
67 |
dependencies within a session. There is a graph browser Java applet |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
68 |
embedded in the generated HTML pages, and also a stand-alone |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
69 |
application that allows browsing theory graphs without having to |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
70 |
start a WWW client first. The latter version also includes features |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
71 |
such as generating Postscript files, which are not available in the |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
72 |
applet version. See \secref{sec:browse} for further information. |
28221 | 73 |
|
61406 | 74 |
\<^medskip> |
28221 | 75 |
The easiest way to let Isabelle generate theory browsing information |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
76 |
for existing sessions is to invoke @{tool build} with suitable |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
77 |
options: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
78 |
@{verbatim [display] \<open>isabelle build -o browser_info -v -c FOL\<close>} |
28221 | 79 |
|
61503 | 80 |
The presentation output will appear in \<^verbatim>\<open>$ISABELLE_BROWSER_INFO/FOL/FOL\<close> |
81 |
as reported by the above verbose invocation of the build process. |
|
28221 | 82 |
|
61503 | 83 |
Many Isabelle sessions (such as \<^verbatim>\<open>HOL-Library\<close> in @{file |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
84 |
"~~/src/HOL/Library"}) also provide actual printable documents. |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
85 |
These are prepared automatically as well if enabled like this: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
86 |
@{verbatim [display] \<open>isabelle build -o browser_info -o document=pdf -v -c HOL-Library\<close>} |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
87 |
|
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
88 |
Enabling both browser info and document preparation simultaneously |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
89 |
causes an appropriate ``document'' link to be included in the HTML |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
90 |
index. Documents may be generated independently of browser |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
91 |
information as well, see \secref{sec:tool-document} for further |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
92 |
details. |
28221 | 93 |
|
61406 | 94 |
\<^bigskip> |
95 |
The theory browsing information is stored in a |
|
28221 | 96 |
sub-directory directory determined by the @{setting_ref |
97 |
ISABELLE_BROWSER_INFO} setting plus a prefix corresponding to the |
|
51417 | 98 |
session chapter and identifier. In order to present Isabelle |
99 |
applications on the web, the corresponding subdirectory from |
|
58618 | 100 |
@{setting ISABELLE_BROWSER_INFO} can be put on a WWW server.\<close> |
28221 | 101 |
|
61406 | 102 |
|
58618 | 103 |
section \<open>Preparing session root directories \label{sec:tool-mkroot}\<close> |
28221 | 104 |
|
58618 | 105 |
text \<open>The @{tool_def mkroot} tool configures a given directory as |
61503 | 106 |
session root, with some \<^verbatim>\<open>ROOT\<close> file and optional document |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
107 |
source directory. Its usage is: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
108 |
@{verbatim [display] |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
109 |
\<open>Usage: isabelle mkroot [OPTIONS] [DIR] |
28221 | 110 |
|
111 |
Options are: |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
112 |
-d enable document preparation |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
113 |
-n NAME alternative session name (default: DIR base name) |
28221 | 114 |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
115 |
Prepare session root DIR (default: current directory).\<close>} |
28221 | 116 |
|
61493 | 117 |
The results are placed in the given directory \<open>dir\<close>, which |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
118 |
refers to the current directory by default. The @{tool mkroot} tool |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
119 |
is conservative in the sense that it does not overwrite existing |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
120 |
files or directories. Earlier attempts to generate a session root |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
121 |
need to be deleted manually. |
28221 | 122 |
|
61406 | 123 |
\<^medskip> |
61503 | 124 |
Option \<^verbatim>\<open>-d\<close> indicates that the session shall be |
125 |
accompanied by a formal document, with \<open>DIR\<close>\<^verbatim>\<open>/document/root.tex\<close> |
|
126 |
as its {\LaTeX} entry point (see also \chref{ch:present}). |
|
28221 | 127 |
|
61503 | 128 |
Option \<^verbatim>\<open>-n\<close> allows to specify an alternative session |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
129 |
name; otherwise the base name of the given directory is used. |
28221 | 130 |
|
61406 | 131 |
\<^medskip> |
132 |
The implicit Isabelle settings variable @{setting |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
133 |
ISABELLE_LOGIC} specifies the parent session, and @{setting |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
134 |
ISABELLE_DOCUMENT_FORMAT} the document format to be filled filled |
61503 | 135 |
into the generated \<^verbatim>\<open>ROOT\<close> file. |
136 |
\<close> |
|
28221 | 137 |
|
138 |
||
58618 | 139 |
subsubsection \<open>Examples\<close> |
28221 | 140 |
|
61503 | 141 |
text \<open>Produce session \<^verbatim>\<open>Test\<close> (with document preparation) |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
142 |
within a separate directory of the same name: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
143 |
@{verbatim [display] \<open>isabelle mkroot -d Test && isabelle build -D Test\<close>} |
28221 | 144 |
|
61406 | 145 |
\<^medskip> |
146 |
Upgrade the current directory into a session ROOT with |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
147 |
document preparation, and build it: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
148 |
@{verbatim [display] \<open>isabelle mkroot -d && isabelle build -D .\<close>} |
58618 | 149 |
\<close> |
28221 | 150 |
|
151 |
||
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
152 |
section \<open>Preparing Isabelle session documents \label{sec:tool-document}\<close> |
28221 | 153 |
|
58618 | 154 |
text \<open>The @{tool_def document} tool prepares logic session |
51054 | 155 |
documents, processing the sources as provided by the user and |
48602 | 156 |
generated by Isabelle. Its usage is: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
157 |
@{verbatim [display] |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
158 |
\<open>Usage: isabelle document [OPTIONS] [DIR] |
28221 | 159 |
|
160 |
Options are: |
|
161 |
-c cleanup -- be aggressive in removing old stuff |
|
162 |
-n NAME specify document name (default 'document') |
|
52746 | 163 |
-o FORMAT specify output format: pdf (default), dvi |
28221 | 164 |
-t TAGS specify tagged region markup |
165 |
||
166 |
Prepare the theory session document in DIR (default 'document') |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
167 |
producing the specified output format.\<close>} |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
168 |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
169 |
This tool is usually run automatically as part of the Isabelle build |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
170 |
process, provided document preparation has been enabled via suitable |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
171 |
options. It may be manually invoked on the generated browser |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
172 |
information document output as well, e.g.\ in case of errors |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
173 |
encountered in the batch run. |
28221 | 174 |
|
61406 | 175 |
\<^medskip> |
61503 | 176 |
The \<^verbatim>\<open>-c\<close> option tells @{tool document} to |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
177 |
dispose the document sources after successful operation! This is |
28221 | 178 |
the right thing to do for sources generated by an Isabelle process, |
179 |
but take care of your files in manual document preparation! |
|
180 |
||
61406 | 181 |
\<^medskip> |
61503 | 182 |
The \<^verbatim>\<open>-n\<close> and \<^verbatim>\<open>-o\<close> option specify |
183 |
the final output file name and format, the default is ``\<^verbatim>\<open>document.dvi\<close>''. |
|
184 |
Note that the result will appear in the parent of the target \<^verbatim>\<open>DIR\<close>. |
|
28221 | 185 |
|
61406 | 186 |
\<^medskip> |
61503 | 187 |
The \<^verbatim>\<open>-t\<close> option tells {\LaTeX} how to interpret |
28221 | 188 |
tagged Isabelle command regions. Tags are specified as a comma |
61503 | 189 |
separated list of modifier/name pairs: ``\<^verbatim>\<open>+\<close>\<open>foo\<close>'' (or just ``\<open>foo\<close>'') |
190 |
means to keep, ``\<^verbatim>\<open>-\<close>\<open>foo\<close>'' to drop, and ``\<^verbatim>\<open>/\<close>\<open>foo\<close>'' to |
|
61493 | 191 |
fold text tagged as \<open>foo\<close>. The builtin default is equivalent |
61503 | 192 |
to the tag specification ``\<^verbatim>\<open>+theory,+proof,+ML,+visible,-invisible\<close>''; |
193 |
see also the {\LaTeX} macros \<^verbatim>\<open>\isakeeptag\<close>, \<^verbatim>\<open>\isadroptag\<close>, and |
|
194 |
\<^verbatim>\<open>\isafoldtag\<close>, in @{file "~~/lib/texinputs/isabelle.sty"}. |
|
28221 | 195 |
|
61406 | 196 |
\<^medskip> |
61503 | 197 |
Document preparation requires a \<^verbatim>\<open>document\<close> |
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
198 |
directory within the session sources. This directory is supposed to |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
199 |
contain all the files needed to produce the final document --- apart |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
200 |
from the actual theories which are generated by Isabelle. |
28221 | 201 |
|
61406 | 202 |
\<^medskip> |
203 |
For most practical purposes, @{tool document} is smart |
|
48602 | 204 |
enough to create any of the specified output formats, taking |
61503 | 205 |
\<^verbatim>\<open>root.tex\<close> supplied by the user as a starting point. This |
28221 | 206 |
even includes multiple runs of {\LaTeX} to accommodate references |
61503 | 207 |
and bibliographies (the latter assumes \<^verbatim>\<open>root.bib\<close> within |
28221 | 208 |
the same directory). |
209 |
||
61503 | 210 |
In more complex situations, a separate \<^verbatim>\<open>build\<close> script for |
48657
63ef2f0cf8bb
simplified custom document/build script, instead of old-style document/IsaMakefile;
wenzelm
parents:
48616
diff
changeset
|
211 |
the document sources may be given. It is invoked with command-line |
63ef2f0cf8bb
simplified custom document/build script, instead of old-style document/IsaMakefile;
wenzelm
parents:
48616
diff
changeset
|
212 |
arguments for the document format and the document variant name. |
63ef2f0cf8bb
simplified custom document/build script, instead of old-style document/IsaMakefile;
wenzelm
parents:
48616
diff
changeset
|
213 |
The script needs to produce corresponding output files, e.g.\ |
61503 | 214 |
\<^verbatim>\<open>root.pdf\<close> for target format \<^verbatim>\<open>pdf\<close> (and default |
51054 | 215 |
variants). The main work can be again delegated to @{tool latex}, |
216 |
but it is also possible to harvest generated {\LaTeX} sources and |
|
217 |
copy them elsewhere. |
|
28221 | 218 |
|
61406 | 219 |
\<^medskip> |
220 |
When running the session, Isabelle copies the content of |
|
61503 | 221 |
the original \<^verbatim>\<open>document\<close> directory into its proper place |
42009
b008525c4399
parallel preparation of document variants, within separate directories;
wenzelm
parents:
42004
diff
changeset
|
222 |
within @{setting ISABELLE_BROWSER_INFO}, according to the session |
61493 | 223 |
path and document variant. Then, for any processed theory \<open>A\<close> |
61503 | 224 |
some {\LaTeX} source is generated and put there as \<open>A\<close>\<^verbatim>\<open>.tex\<close>. |
225 |
Furthermore, a list of all generated theory |
|
226 |
files is put into \<^verbatim>\<open>session.tex\<close>. Typically, the root |
|
227 |
{\LaTeX} file provided by the user would include \<^verbatim>\<open>session.tex\<close> |
|
228 |
to get a document containing all the theories. |
|
28221 | 229 |
|
230 |
The {\LaTeX} versions of the theories require some macros defined in |
|
61503 | 231 |
@{file "~~/lib/texinputs/isabelle.sty"}. Doing \<^verbatim>\<open>\usepackage{isabelle}\<close> |
232 |
in \<^verbatim>\<open>root.tex\<close> should be fine; the underlying @{tool latex} already |
|
233 |
includes an appropriate path specification for {\TeX} inputs. |
|
28221 | 234 |
|
235 |
If the text contains any references to Isabelle symbols (such as |
|
61504 | 236 |
\<^verbatim>\<open>\<forall>\<close>) then \<^verbatim>\<open>isabellesym.sty\<close> should be included as well. |
61503 | 237 |
This package contains a standard set of {\LaTeX} macro definitions |
238 |
\<^verbatim>\<open>\isasym\<close>\<open>foo\<close> corresponding to \<^verbatim>\<open>\\<close>\<^verbatim>\<open><\<close>\<open>foo\<close>\<^verbatim>\<open>>\<close>, |
|
239 |
see @{cite "isabelle-implementation"} for a |
|
28838
d5db6dfcb34a
moved table of standard Isabelle symbols to isar-ref manual;
wenzelm
parents:
28504
diff
changeset
|
240 |
complete list of predefined Isabelle symbols. Users may invent |
28221 | 241 |
further symbols as well, just by providing {\LaTeX} macros in a |
40800
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
wenzelm
parents:
40387
diff
changeset
|
242 |
similar fashion as in @{file "~~/lib/texinputs/isabellesym.sty"} of |
51054 | 243 |
the Isabelle distribution. |
28221 | 244 |
|
245 |
For proper setup of DVI and PDF documents (with hyperlinks and |
|
40800
330eb65c9469
Parse.liberal_name for document antiquotations and attributes;
wenzelm
parents:
40387
diff
changeset
|
246 |
bookmarks), we recommend to include @{file |
28238 | 247 |
"~~/lib/texinputs/pdfsetup.sty"} as well. |
28221 | 248 |
|
61406 | 249 |
\<^medskip> |
250 |
As a final step of Isabelle document preparation, @{tool |
|
61503 | 251 |
document}~\<^verbatim>\<open>-c\<close> is run on the resulting copy of the |
252 |
\<^verbatim>\<open>document\<close> directory. Thus the actual output document is |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
253 |
built and installed in its proper place. The generated sources are |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
254 |
deleted after successful run of {\LaTeX} and friends. |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
255 |
|
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
256 |
Some care is needed if the document output location is configured |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
257 |
differently, say within a directory whose content is still required |
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
258 |
afterwards! |
58618 | 259 |
\<close> |
28221 | 260 |
|
261 |
||
58618 | 262 |
section \<open>Running {\LaTeX} within the Isabelle environment |
263 |
\label{sec:tool-latex}\<close> |
|
28221 | 264 |
|
58618 | 265 |
text \<open>The @{tool_def latex} tool provides the basic interface for |
28221 | 266 |
Isabelle document preparation. Its usage is: |
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
267 |
@{verbatim [display] |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
268 |
\<open>Usage: isabelle latex [OPTIONS] [FILE] |
28221 | 269 |
|
270 |
Options are: |
|
52746 | 271 |
-o FORMAT specify output format: pdf (default), dvi, |
272 |
bbl, idx, sty, syms |
|
28221 | 273 |
|
274 |
Run LaTeX (and related tools) on FILE (default root.tex), |
|
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
275 |
producing the specified output format.\<close>} |
28221 | 276 |
|
277 |
Appropriate {\LaTeX}-related programs are run on the input file, |
|
278 |
according to the given output format: @{executable latex}, |
|
279 |
@{executable pdflatex}, @{executable dvips}, @{executable bibtex} |
|
61503 | 280 |
(for \<^verbatim>\<open>bbl\<close>), and @{executable makeindex} (for \<^verbatim>\<open>idx\<close>). |
281 |
The actual commands are determined from the settings |
|
52744 | 282 |
environment (@{setting ISABELLE_PDFLATEX} etc.). |
28221 | 283 |
|
61503 | 284 |
The \<^verbatim>\<open>sty\<close> output format causes the Isabelle style files to |
28221 | 285 |
be updated from the distribution. This is useful in special |
286 |
situations where the document sources are to be processed another |
|
48814
d488a5f25bf6
some updates of "Presenting theories", using mkroot/build instead of former mkdir/make/usedir (which are still present in "Misc");
wenzelm
parents:
48722
diff
changeset
|
287 |
time by separate tools. |
28221 | 288 |
|
61503 | 289 |
The \<^verbatim>\<open>syms\<close> output is for internal use; it generates lists |
28221 | 290 |
of symbols that are available without loading additional {\LaTeX} |
291 |
packages. |
|
58618 | 292 |
\<close> |
28221 | 293 |
|
294 |
||
58618 | 295 |
subsubsection \<open>Examples\<close> |
28221 | 296 |
|
58618 | 297 |
text \<open>Invoking @{tool latex} by hand may be occasionally useful when |
48602 | 298 |
debugging failed attempts of the automatic document preparation |
299 |
stage of batch-mode Isabelle. The abortive process leaves the |
|
300 |
sources at a certain place within @{setting ISABELLE_BROWSER_INFO}, |
|
301 |
see the runtime error message for details. This enables users to |
|
302 |
inspect {\LaTeX} runs in further detail, e.g.\ like this: |
|
303 |
||
61407
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
304 |
@{verbatim [display] |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
305 |
\<open>cd "$(isabelle getenv -b ISABELLE_BROWSER_INFO)/Unsorted/Test/document" |
7ba7b8103565
@{verbatim [display]} supersedes old alltt/ttbox;
wenzelm
parents:
61406
diff
changeset
|
306 |
isabelle latex -o pdf\<close>} |
58618 | 307 |
\<close> |
28221 | 308 |
|
309 |
end |