summaryrefslogtreecommitdiff
path: root/macros/luatex/optex/basics-macros.opm
diff options
context:
space:
mode:
Diffstat (limited to 'macros/luatex/optex/basics-macros.opm')
-rw-r--r--macros/luatex/optex/basics-macros.opm80
1 files changed, 51 insertions, 29 deletions
diff --git a/macros/luatex/optex/basics-macros.opm b/macros/luatex/optex/basics-macros.opm
index 9f87f27c83..23b6a6a43c 100644
--- a/macros/luatex/optex/basics-macros.opm
+++ b/macros/luatex/optex/basics-macros.opm
@@ -2,25 +2,74 @@
\_codedecl \sdef {Basic macros for OpTeX <2020-02-14>}
-\let\_bgroup={ \let\_egroup=}
+ \_doc ------------------------------
+ `\bgroup`, `\egroup`, `\empty`, `\space`, `\null` and `\wlog` are classical
+ macros from plain \TeX/.
+ \_cod ------------------------------
+\let\_bgroup={ \let\_egroup=}
\_def \_empty {}
\_def \_space { }
\_def \_null {\_hbox{}}
\_def \_wlog {\_immediate\_write-1 } % write on log file (only)
+ \_doc ------------------------------
+ `\bslash` is \"normal backslash" with category code 12.
+ `\nbb` and `\pcent` are double backslash and normal `%`, they should
+ be used in lua codes, for example.
+ \_cod ------------------------------
+
\_edef\_bslash {\_csstring\\}
\_edef \_nbb {\_bslash\_bslash}
\_edef \_pcent{\_csstring\%}
+ \_doc ------------------------------
+ `\sdef{<text>}` is equivalent to `\def\<text>`, where `\<text>` is a control
+ sequence. You can use arbitrary parameter mask after `\sdef{<text>}`, don't
+ put the (unwanted) space immediately after closing brace \code{\}}.
+
+ `\sxdef{<text>}` is equivalent to `\xdef\<text>`.
+
+ `\slet{<textA>}{<textB>}` is equivalent to `\let \<textA> = \<textB>`.
+ \_cod ------------------------------
+
\_def \_sdef #1{\_ea\_def \_csname#1\_endcsname}
\_def \_sxdef #1{\_ea\_xdef \_csname#1\_endcsname}
\_def \_slet #1#2{\_ea\_let \_csname#1\_ea\_endcsname \_csname#2\_endcsname}
-\_def \_adef #1{\_catcode`#1=13 \_begingroup \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}}
+
+ \_doc ------------------------------
+ `\adef{<char>}{<body>}` puts the <char> as active character and defines it
+ as {<body>}. You can use parameter mask too, for example
+ `\adef @#1{...$1...}`
+ \_cod ------------------------------
+
+\_def \_adef #1{\_catcode`#1=13 \_begingroup
+ \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}}
+
+ \_doc ------------------------------
+ `\cs{<text>}` is only a shortcut to `\csname <text>\endcsname`, but you need
+ one more `\ea` if you need to get the real control sequence `\<text>`.
+ \_cod ------------------------------
+
\_def \_cs #1{\_csname#1\_endcsname}
+
+ \_doc ------------------------------
+ `\addto\macro{<text>}` adds <text> to your `\macro`, which must be defined.
+ \_cod ------------------------------
+
\_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}}
+
+ \_doc ------------------------------
+ `\opwarning{<text>}` prints warning on the terminal and to the log file.
+ \_cod ------------------------------
+
\_def \_opwarning #1{\_wterm{WARNING: #1.}}
+ \_doc ------------------------------
+ `\loggingall` and `\tracingall` is similar as in plain \TeX/, but prints
+ more logging information to the log file and to the terminal.
+ \_cod ------------------------------
+
\_def\_loggingall{\_tracingcommands=3 \_tracingstats=2 \_tracingpages=1
\_tracingoutput=1 \_tracinglostchars=1 \_tracingmacros=2
\_tracingparagraphs=1 \_tracingrestores=1 \_tracingscantokens=1
@@ -36,31 +85,4 @@
\_endcode % -------------------------------------
-`\bgroup`, `\egroup`, `\empty`, `\space`, `\null` and `\wlog` are classical
-macros from plain \TeX/.
-
-`\bslash` is \"normal backslash" with category code 12.
-`\nbb` and `\pcent` are double backslash and normal `%`, they should
-be used in lua codes, for example.
-
-`\sdef{<text>}` is equivalent to `\def\<text>`, where `\<text>` is a control
-sequence. You can use arbitrary parameter mask after `\sdef{<text>}`, don't
-put the (unwanted) space immediately after closing brace \code{\}}.
-
-`\sxdef{<text>}` is equivalent to `\xdef\<text>`.
-
-`\slet{<textA>}{<textB>}` is equivalent to `\let \<textA> = \<textB>`.
-
-`\adef{<char>}{<body>}` puts the <char> as active character and defines it
-as {<body>}. You can use parameter mask too.
-
-`\cs{<text>}` is only a shortcut to `\csname <text>\endcsname`, but you need
-one more `\ea` if you need to ger the real control sequence `\<text>`.
-
-`\addto\macro{<text>}` adds <text> to your `\macro`, which must be defined.
-
-`\opwarning{<text>}` prints warning on the terminal and to the log file.
-
-`\loggingall` and `\tracingall` is similar as in plain \TeX/, but prints
-more logging information to the log file and to the terminal.