From 4c66716999f280a14d912809075d31a7868bf251 Mon Sep 17 00:00:00 2001 From: Burkhart Wolff Date: Wed, 3 May 2023 10:55:37 +0200 Subject: [PATCH] experiments with boxes --- Isabelle_DOF-Example-I/IsaDofApplications.thy | 67 ++++++++++++++++++- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/Isabelle_DOF-Example-I/IsaDofApplications.thy b/Isabelle_DOF-Example-I/IsaDofApplications.thy index df209d8..6e54702 100644 --- a/Isabelle_DOF-Example-I/IsaDofApplications.thy +++ b/Isabelle_DOF-Example-I/IsaDofApplications.thy @@ -31,6 +31,60 @@ define_shortcut* isadof \ \\isadof\ (* slanted text in contrast to italics *) define_macro* slanted_text \ \\textsl{\ _ \}\ +ML\ + +fun boxed_text_antiquotation name (* redefined in these more abstract terms *) = + DOF_lib.gen_text_antiquotation name DOF_lib.report_text + (fn ctxt => DOF_lib.string_2_text_antiquotation ctxt + #> DOF_lib.enclose_env false ctxt "isarbox") + +val neant = K(Latex.text("",\<^here>)) + +fun boxed_theory_text_antiquotation name (* redefined in these more abstract terms *) = + DOF_lib.gen_text_antiquotation name DOF_lib.report_theory_text + (fn ctxt => DOF_lib.string_2_theory_text_antiquotation ctxt + #> DOF_lib.enclose_env false ctxt "isar" + (* #> neant *)) (*debugging *) + +fun boxed_sml_text_antiquotation name = + DOF_lib.gen_text_antiquotation name (K(K())) + (fn ctxt => Input.source_content + #> Latex.text + #> DOF_lib.enclose_env true ctxt "sml") + (* the simplest conversion possible *) + +fun boxed_pdf_antiquotation name = + DOF_lib.gen_text_antiquotation name (K(K())) + (fn ctxt => Input.source_content + #> Latex.text + #> DOF_lib.enclose_env true ctxt "out") + (* the simplest conversion possible *) + +fun boxed_latex_antiquotation name = + DOF_lib.gen_text_antiquotation name (K(K())) + (fn ctxt => Input.source_content + #> Latex.text + #> DOF_lib.enclose_env true ctxt "ltx") + (* the simplest conversion possible *) + +fun boxed_bash_antiquotation name = + DOF_lib.gen_text_antiquotation name (K(K())) + (fn ctxt => Input.source_content + #> Latex.text + #> DOF_lib.enclose_env true ctxt "bash") + (* the simplest conversion possible *) +\ + +setup\boxed_text_antiquotation \<^binding>\boxed_text\ #> + boxed_text_antiquotation \<^binding>\boxed_cartouche\ #> + boxed_theory_text_antiquotation \<^binding>\boxed_theory_text\ #> + + boxed_sml_text_antiquotation \<^binding>\boxed_sml\ #> + boxed_pdf_antiquotation \<^binding>\boxed_pdf\ #> + boxed_latex_antiquotation \<^binding>\boxed_latex\#> + boxed_bash_antiquotation \<^binding>\boxed_bash\ + \ + (*>*) title*[tit::title] \Using the Isabelle Ontology Framework\ @@ -175,20 +229,27 @@ text\ We would like to detail the documentation generation of the architec which is based on literate specification commands such as \<^theory_text>\section\ \<^dots>, \<^theory_text>\subsection\ \<^dots>, \<^theory_text>\text\ \<^dots>, etc. Thus, a user can add a simple text: -\begin{isar} - text\This is a description.\ -\end{isar} + @{boxed_theory_text [display]\ +text\ This is a description.\\} These text-commands can be arbitrarily mixed with other commands stating definitions, proofs, code, etc., and will result in the corresponding output in generated \<^LaTeX> or HTML documents. Now, \<^emph>\inside\ the textual content, it is possible to embed a \<^emph>\text-antiquotation\: +@{boxed_theory_text [display]\ + text\ According to the \<^emph>\reflexivity\ axiom @{thm refl}, + we obtain in \ for @{term "fac 5"} the result @{value "fac 5"}.\\} \begin{isar} text\According to the reflexivity axiom \at{thm refl}, we obtain in \ for \at{term "fac 5"} the result \at{value "fac 5"}.\ \end{isar} which is represented in the generated output by: +@{boxed_pdf [display] +\According to the $\emph{reflexivity}$ axiom $\mathrm{x = x}$, we obtain in $\Gamma$ +for $\operatorname{fac} \text{\textrm{5}}$ the result $\text{\textrm{120}}$.\ + } \begin{out} According to the reflexivity axiom $x = x$, we obtain in $\Gamma$ for $\operatorname{fac} 5$ the result $120$. \end{out} + where \<^theory_text>\refl\ is actually the reference to the axiom of reflexivity in HOL. For the antiquotation \<^theory_text>\@{value "''fac 5''"}\ we assume the usual definition for \<^theory_text>\fac\ in HOL.