From 56bd1f5b8377f54b4af39a114362a7762d27f13c Mon Sep 17 00:00:00 2001 From: Norbert Preining Date: Thu, 7 May 2020 03:01:09 +0000 Subject: CTAN sync 202005070301 --- macros/luatex/optex/base/basic-macros.opm | 97 +++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 macros/luatex/optex/base/basic-macros.opm (limited to 'macros/luatex/optex/base/basic-macros.opm') diff --git a/macros/luatex/optex/base/basic-macros.opm b/macros/luatex/optex/base/basic-macros.opm new file mode 100644 index 0000000000..512678c312 --- /dev/null +++ b/macros/luatex/optex/base/basic-macros.opm @@ -0,0 +1,97 @@ +%% This is part of OpTeX project, see http://petr.olsak.net/optex + +\_codedecl \sdef {Basic macros for OpTeX <2020-02-14>} % loaded in format + + \_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) + +\_public \bgroup \egroup \empty \space \null \wlog ; + + \_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\%} + +\_public \bslash \nbb \pcent ; + + \_doc ------------------------------ + \`\sdef` `{}` is equivalent to `\def\`, where `\` is a control + sequence. You can use arbitrary parameter mask after `\sdef{}`, don't + put the (unwanted) space immediately after closing brace \code{\}}. + \nl + \`\sxdef` `{}` is equivalent to `\xdef\`. + \nl + \`\slet` `{}{}` is equivalent to `\let \ = \`. + \_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} + +\_public \sdef \sxdef \slet ; + + \_doc ------------------------------ + \`\adef` `{}{}` puts the as active character and defines it + as `{}`. You can declare a macro with parameters too. For example + `\adef @#1{...$1...}`. + \_cod ------------------------------ + +\_def \_adef #1{\_catcode`#1=13 \_begingroup \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}} +\_public \adef ; + + \_doc ------------------------------ + \`\cs` `{}` is only a shortcut to `\csname \endcsname`, but you need + one more `\_ea` if you need to get the real control sequence `\`. + \nl + \`\trycs` `{}{}` expands to `\` + if it is defined else to the ``. + \_cod ------------------------------ + +\_def \_cs #1{\_csname#1\_endcsname} +\_def \_trycs#1#2{\_ifcsname #1\_endcsname \_csname #1\_endcsname \_else #2\_fi} +\_public \cs \trycs ; + + \_doc ------------------------------ + \`\addto` `\macro{}` adds `` to your `\macro`, which must be defined. + \_cod ------------------------------ + +\_long\_def \_addto #1#2{\_ea\_def\_ea#1\_ea{#1#2}} +\_public \addto ; + + \_doc ------------------------------ + \`\opwarning` `{}` prints warning on the terminal and to the log file. + \_cod ------------------------------ + +\_def \_opwarning #1{\_wterm{WARNING: #1.}} +\_public \opwarning ; + + \_doc ------------------------------ + \`\loggingall` and \`\tracingall` are defined similarly as in + plain \TeX/, but they print + 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 + \_tracingifs=1 \_tracinggroups=1 \_tracingassigns=1 } +\_def\_tracingall{\_tracingonline=1 \_loggingall} + +\_public \loggingall \tracingall ; + +\_endcode % ------------------------------------- + + -- cgit v1.2.3