summaryrefslogtreecommitdiff
path: root/macros/optex/base/basic-macros.opm
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2023-11-17 03:02:29 +0000
committerNorbert Preining <norbert@preining.info>2023-11-17 03:02:29 +0000
commitd91bb5cad66508ec34d77ea60c0a02c79308edef (patch)
tree69c363099e912a77d55b67d891020bcc1f407d80 /macros/optex/base/basic-macros.opm
parente0db3f0709a737e7258fd40a7cbfe9a461ea0756 (diff)
CTAN sync 202311170302
Diffstat (limited to 'macros/optex/base/basic-macros.opm')
-rw-r--r--macros/optex/base/basic-macros.opm19
1 files changed, 14 insertions, 5 deletions
diff --git a/macros/optex/base/basic-macros.opm b/macros/optex/base/basic-macros.opm
index 9227505678..f2047cadf0 100644
--- a/macros/optex/base/basic-macros.opm
+++ b/macros/optex/base/basic-macros.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \sdef {Basic macros for OpTeX <2023-01-22>} % preloaded in format
+\_codedecl \sdef {Basic macros for OpTeX <2023-11-11>} % preloaded in format
\_doc ------------------------------
\`\bgroup`, \`\egroup`, \`\empty`, \`\space`, and \`\null`
@@ -56,12 +56,20 @@
\_public \sdef \sxdef \slet ;
\_doc ------------------------------
- \`\adef` `{<char>}{<body>}` puts the <char> as active character and defines it
- as `{<body>}`. You can declare a macro with parameters too. For example
- `\adef @#1{...#1...}`.
+ \`\adef` `<char>{<body>}` defines active `<char>` as <body> and then
+ puts the <char> as active character. I.e. the `<body>` can include the
+ <char> as non-active charter (if it is non-active before `\adef`).
+ For example `\adef ?{\,?}`.
+ If the character is special, you can escape it, for example `\adef\%{...}`.
+ The space can be declared by `\adef{ }{<body>}`.
+ You can declare a macro with parameters too, for example
+ `\adef @#1{...#1...}`. You can use prefixes `\protected`, `\global`,
+ `\long` before `\adef`, they behave like prefixes before `\def`.
\_cod ------------------------------
-\_def \_adef #1{\_catcode`#1=13 \_begingroup \_lccode`\~=`#1\_lowercase{\_endgroup\_def~}}
+\_def\_adef#1#2#{\_adefA{#1}{#2}}
+\_def\_adefA#1#2#3{\_ea\_def\_directlua{tex.cprint(13,"\_luaescapestring{\_csstring#1}")}#2{#3}%
+ \_catcode`#1=13 }
\_public \adef ;
\_doc ------------------------------
@@ -142,6 +150,7 @@
\_endcode % -------------------------------------
+2023-11-11: \adef reimplemented, \protected, \long, \global allowed before \adef
2023-01-22: \trycs: afterfi used for second parameter
2022-11-22: \_banner definition moved here
2022-11-18: \ahead introduced