forked from Isabelle_DOF/Isabelle_DOF
added Isar-syntax for define_shortcut*
This commit is contained in:
parent
0e64608a58
commit
de5c0fc6e2
|
@ -19,13 +19,11 @@ begin
|
|||
open_monitor*[this::article]
|
||||
declare[[strict_monitor_checking=false]]
|
||||
|
||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>isadof\<close> "\\isadof"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>LaTeX\<close> "\\LaTeX{}"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>Protege\<close> "Prot{\\'e}g{\\'e}"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>dots\<close> "\\ldots"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>isabelle\<close> "Isabelle/HOL"
|
||||
|
||||
\<close>
|
||||
define_shortcut* isadof \<rightleftharpoons> \<open>\isadof\<close>
|
||||
LaTeX \<rightleftharpoons> \<open>\LaTeX{}\<close>
|
||||
dots \<rightleftharpoons> \<open>\ldots\<close>
|
||||
isabelle \<rightleftharpoons> \<open>Isabelle/HOL\<close>
|
||||
Protege \<rightleftharpoons> \<open>Prot{\'e}g{\'e}\<close>
|
||||
|
||||
(* slanted text in contrast to italics *)
|
||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>slanted_text\<close> "\\textsl{" "}" (K(K()))\<close>
|
||||
|
|
|
@ -12,8 +12,8 @@ declare[[ Definition_default_class="definition"]]
|
|||
declare[[ Lemma_default_class="lemma"]]
|
||||
declare[[ Theorem_default_class="theorem"]]
|
||||
|
||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>csp\<close> "CSP"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>isabelle\<close> "Isabelle/HOL"\<close>
|
||||
define_shortcut* csp \<rightleftharpoons> \<open>CSP\<close>
|
||||
isabelle \<rightleftharpoons> \<open>Isabelle/HOL\<close>
|
||||
|
||||
(*>*)
|
||||
|
||||
|
|
|
@ -16,20 +16,21 @@ theory "00_Frontmatter"
|
|||
imports "Isabelle_DOF.technical_report"
|
||||
begin
|
||||
|
||||
text\<open> \<open> \<tau>\<close>\<close>
|
||||
|
||||
section\<open>Document Local Setup.\<close>
|
||||
text\<open>Some internal setup, introducing document specific abbreviations and macros.\<close>
|
||||
|
||||
setup \<open>DOF_lib.define_shortcut \<^binding>\<open>dof\<close> "\\dof"\<close>
|
||||
setup \<open>DOF_lib.define_shortcut \<^binding>\<open>isadof\<close> "\\isadof"\<close>
|
||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>TeXLive\<close>"\\TeXLive"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>BibTeX\<close> "\\BibTeX{}"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>LaTeX\<close> "\\LaTeX{}"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>TeX\<close> "\\TeX{}"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>pdf\<close> "PDF"
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>pdftex\<close> "\\pdftex{}"
|
||||
\<close>
|
||||
|
||||
|
||||
define_shortcut* dof \<rightleftharpoons> \<open>\dof\<close>
|
||||
isadof \<rightleftharpoons> \<open>\isadof\<close>
|
||||
|
||||
define_shortcut* TeXLive \<rightleftharpoons> \<open>\TeXLive\<close>
|
||||
BibTeX \<rightleftharpoons> \<open>\BibTeX{}\<close>
|
||||
LaTeX \<rightleftharpoons> \<open>\LaTeX{}\<close>
|
||||
TeX \<rightleftharpoons> \<open>\TeX{}\<close>
|
||||
pdf \<rightleftharpoons> \<open>PDF\<close>
|
||||
pdftex \<rightleftharpoons> \<open>\pdftex{}\<close>
|
||||
|
||||
text\<open>Note that these setups assume that the associated \<^LaTeX> macros are defined, \<^eg>,
|
||||
in the document prelude. \<close>
|
||||
|
|
|
@ -14,9 +14,10 @@
|
|||
(*<*)
|
||||
theory TR_MyCommentedIsabelle
|
||||
imports "Isabelle_DOF.technical_report"
|
||||
|
||||
begin
|
||||
|
||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>isabelle\<close> "Isabelle/HOL"\<close>
|
||||
define_shortcut* isabelle \<rightleftharpoons> \<open>Isabelle/HOL\<close>
|
||||
|
||||
open_monitor*[this::report]
|
||||
(*>*)
|
||||
|
@ -2311,6 +2312,7 @@ for Unicode Character Denotations as well as many local hints for improvements.\
|
|||
|
||||
section*[bib::bibliography]\<open>Bibliography\<close>
|
||||
|
||||
|
||||
close_monitor*[this]
|
||||
check_doc_global
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ theory Isa_COL
|
|||
and "figure*" "side_by_side_figure*" :: document_body
|
||||
and "assert*" :: thy_decl
|
||||
|
||||
and "define_shortcut*" :: thy_decl
|
||||
|
||||
begin
|
||||
|
||||
|
@ -413,6 +414,17 @@ fun enclose_env verbatim ctxt block_env body =
|
|||
end
|
||||
\<close>
|
||||
|
||||
ML\<open>
|
||||
local
|
||||
val parse_define_shortcut = Parse.binding --
|
||||
((\<^keyword>\<open>\<rightleftharpoons>\<close> || \<^keyword>\<open>==\<close>) |-- (Parse.alt_string || Parse.cartouche))
|
||||
val define_shortcuts = fold(uncurry DOF_lib.define_shortcut)
|
||||
in
|
||||
val _ =
|
||||
Outer_Syntax.command \<^command_keyword>\<open>define_shortcut*\<close> "define LaTeX shortcut"
|
||||
(Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o define_shortcuts));
|
||||
end
|
||||
\<close>
|
||||
|
||||
section\<open>Tables\<close>
|
||||
(* TODO ! ! ! *)
|
||||
|
@ -426,5 +438,4 @@ ML\<open>@{term "side_by_side_figure"};
|
|||
@{typ "doc_class rexp"};
|
||||
DOF_core.SPY;\<close>
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ doc_class F =
|
|||
|
||||
|
||||
doc_class G = C +
|
||||
g :: "thm" <= "@{thm ''HOL.refl''}"
|
||||
g :: "thm" <= "@{thm \<open>HOL.refl\<close>}"
|
||||
|
||||
doc_class M =
|
||||
trace :: "(A + C + D + F) list"
|
||||
|
@ -79,8 +79,8 @@ ML\<open> Thy_Header.get_keywords @{theory};(* this looks to be really theory gl
|
|||
section*[test::A]\<open>Test and Validation\<close>
|
||||
text\<open>Defining some document elements to be referenced in later on in another theory: \<close>
|
||||
text*[sdf]\<open> Lorem ipsum @{thm refl}\<close>
|
||||
text*[ sdfg] \<open> Lorem ipsum @{thm refl}\<close>
|
||||
text*[ xxxy ] \<open> Lorem ipsum @{docitem \<open>sdfg\<close>} rate @{thm refl}\<close>
|
||||
text*[ sdfg :: F] \<open> Lorem ipsum @{thm refl}\<close>
|
||||
text*[ xxxy ] \<open> Lorem ipsum @{F \<open>sdfg\<close>} rate @{thm refl}\<close>
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -470,46 +470,23 @@ setup\<open> let val cidS = ["scholarly_paper.introduction","scholarly_paper.tec
|
|||
in DOF_core.update_class_invariant "scholarly_paper.article" body end\<close>
|
||||
|
||||
|
||||
(* some test code *)
|
||||
ML\<open>
|
||||
(*
|
||||
|
||||
val trace = AttributeAccess.compute_trace_ML (Context.Proof @{context}) "this" @{here} @{here}
|
||||
val groups = partition ( @{context}) cidS trace
|
||||
val _::_::_::_:: _ ::_ ::_ ::a::_ = groups;
|
||||
check;
|
||||
|
||||
fun get_level_raw oid = AttributeAccess.compute_attr_access (Context.Proof @{context}) "level" oid @{here} @{here};
|
||||
fun get_level oid = dest_option (snd o HOLogic.dest_number) (get_level_raw (oid));
|
||||
fun check_level_hd a = case (get_level (snd a)) of
|
||||
NONE => error("Invariant violation: leading section" ^ snd a ^
|
||||
" must have lowest level")
|
||||
| SOME X => X
|
||||
fun check_group_elem level_hd a = case (get_level (snd a)) of
|
||||
NONE => true
|
||||
| SOME y => if y > level_hd then true
|
||||
else error("Invariant violation: subsequent section " ^ snd a ^
|
||||
" must have higher level.");
|
||||
fun check_group a = map (check_group_elem (check_level_hd (hd a))) (tl a) ;
|
||||
*)
|
||||
\<close>
|
||||
|
||||
section\<open>Miscelleous\<close>
|
||||
|
||||
subsection\<open>Common Abbreviations\<close>
|
||||
|
||||
define_shortcut* eg \<rightleftharpoons> \<open>\eg\<close> (* Latin: „exempli gratia“ meaning „for example“. *)
|
||||
ie \<rightleftharpoons> \<open>\ie\<close> (* Latin: „id est“ meaning „that is to say“. *)
|
||||
etc \<rightleftharpoons> \<open>\etc\<close> (* Latin : et cetera *)
|
||||
|
||||
subsection\<open>Layout Trimming Commands\<close>
|
||||
|
||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>hs\<close> "\\hspace{" "}" (K(K())) \<close>
|
||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>vs\<close> "\\vspace{" "}" (K(K())) \<close>
|
||||
setup\<open> DOF_lib.define_shortcut \<^binding>\<open>clearpage\<close> "\\clearpage{}" \<close>
|
||||
|
||||
define_shortcut* clearpage \<rightleftharpoons> \<open>\clearpage{}\<close>
|
||||
|
||||
|
||||
subsection\<open>Common Abbreviations\<close>
|
||||
setup \<open> DOF_lib.define_shortcut \<^binding>\<open>eg\<close> "\\eg"
|
||||
(* Latin: „exempli gratia“ meaning „for example“. *)
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>ie\<close> "\\ie"
|
||||
(* Latin: „id est“ meaning „that is to say“. *)
|
||||
#> DOF_lib.define_shortcut \<^binding>\<open>etc\<close> "\\etc"\<close>
|
||||
|
||||
(* this is an alternative style for macro definitions equivalent to setup ... setup ...*)
|
||||
|
||||
|
||||
end
|
||||
|
|
Reference in New Issue