improved macro syntax
This commit is contained in:
parent
5593c22a36
commit
6899c4059e
|
@ -26,7 +26,7 @@ define_shortcut* isadof \<rightleftharpoons> \<open>\isadof\<close>
|
|||
Protege \<rightleftharpoons> \<open>Prot{\'e}g{\'e}\<close>
|
||||
|
||||
(* slanted text in contrast to italics *)
|
||||
define_macro* slanted_text \<rightleftharpoons> \<open>\textsl{\<close> \<open>}\<close>
|
||||
define_macro* slanted_text \<rightleftharpoons> \<open>\textsl{\<close> _ \<open>}\<close>
|
||||
|
||||
(*>*)
|
||||
|
||||
|
|
|
@ -33,8 +33,8 @@ define_shortcut* TeXLive \<rightleftharpoons> \<open>\TeXLive\<close>
|
|||
text\<open>Note that these setups assume that the associated \<^LaTeX> macros
|
||||
are defined, \<^eg>, in the document prelude. \<close>
|
||||
|
||||
define_macro* index \<rightleftharpoons> \<open>\index{\<close> \<open>}\<close>
|
||||
define_macro* bindex \<rightleftharpoons> \<open>\bindex{\<close> \<open>}\<close>
|
||||
define_macro* index \<rightleftharpoons> \<open>\index{\<close> _ \<open>}\<close>
|
||||
define_macro* bindex \<rightleftharpoons> \<open>\bindex{\<close> _ \<open>}\<close>
|
||||
|
||||
|
||||
ML\<open>
|
||||
|
|
|
@ -429,15 +429,21 @@ ML\<open>
|
|||
val parse_literal = Parse.alt_string || Parse.cartouche
|
||||
val parse_define_shortcut = (Parse.binding
|
||||
-- ((\<^keyword>\<open>\<rightleftharpoons>\<close> || \<^keyword>\<open>==\<close>) |-- parse_literal))
|
||||
--|Parse.underscore
|
||||
-- parse_literal
|
||||
-- (Scan.option (\<^keyword>\<open>(\<close> |-- Parse.ML_source --|\<^keyword>\<open>)\<close>))
|
||||
|
||||
fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K()));
|
||||
|
||||
fun define_macro (X,NONE) = (uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K()))
|
||||
|define_macro (X,SOME(src:Input.source)) =
|
||||
let val _ = ()
|
||||
in
|
||||
(uncurry(uncurry(uncurry DOF_lib.define_macro)))(X,K(K()))
|
||||
end;
|
||||
|
||||
val _ = Outer_Syntax.command \<^command_keyword>\<open>define_macro*\<close> "define LaTeX shortcut"
|
||||
(Scan.repeat1 parse_define_shortcut >> (Toplevel.theory o (fold define_macro)));
|
||||
|
||||
Parse.underscore;
|
||||
\<close>
|
||||
|
||||
|
||||
|
|
|
@ -481,13 +481,14 @@ define_shortcut* eg \<rightleftharpoons> \<open>\eg\<close> (* Latin: „exemp
|
|||
|
||||
subsection\<open>Layout Trimming Commands\<close>
|
||||
|
||||
define_macro* hs \<rightleftharpoons> \<open>\hspace{\<close> \<open>}\<close>
|
||||
define_macro* vs \<rightleftharpoons> \<open>\vspace{\<close> \<open>}\<close>
|
||||
define_macro* hs \<rightleftharpoons> \<open>\hspace{\<close> _ \<open>}\<close>
|
||||
define_macro* vs \<rightleftharpoons> \<open>\vspace{\<close> _ \<open>}\<close>
|
||||
|
||||
(* setup\<open> DOF_lib.define_macro \<^binding>\<open>hs\<close> "\\hspace{" "}" (K(K())) \<close> *)
|
||||
ML\<open> Parse.real \<close>
|
||||
|
||||
setup\<open> DOF_lib.define_macro \<^binding>\<open>vs2\<close> "\\vspace{" "}" (fn ctxt => fn src => ()) \<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>
|
||||
*)
|
||||
|
||||
define_shortcut* clearpage \<rightleftharpoons> \<open>\clearpage{}\<close>
|
||||
|
||||
|
|
Loading…
Reference in New Issue