From 9a97a481d53783e2b153148ba331f09e70098d83 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Thu, 25 May 2023 20:36:39 +0000 Subject: tex-nutshell (25may23) git-svn-id: svn://tug.org/texlive/trunk@67213 c570f23f-e606-0410-a88d-b1316a301751 --- .../doc/plain/tex-nutshell/tex-nutshell.pdf | Bin 256523 -> 273211 bytes .../doc/plain/tex-nutshell/tex-nutshell.tex | 165 +++++++++++++++++++-- 2 files changed, 149 insertions(+), 16 deletions(-) (limited to 'Master/texmf-dist/doc') diff --git a/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.pdf b/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.pdf index b8a8da3b937..5f2405138c1 100644 Binary files a/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.pdf and b/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.pdf differ diff --git a/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.tex b/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.tex index 18077c7bf72..dbff5fdc2ce 100644 --- a/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.tex +++ b/Master/texmf-dist/doc/plain/tex-nutshell/tex-nutshell.tex @@ -19,7 +19,6 @@ \def\testAleB #1#2#3\relax #4#5#6\relax{% \ifnum `#2<`#5 \_AleBtrue \else \_AleBfalse \fi } - \catcode`<=13 \def<#1>{{\def\_dsp { }\iindex{:#1}\iis {:#1} {$\langle\hbox{\it#1}\rangle$}}% $\def\,{\hskip1.5pt plus.3pt minus1.2pt}\,\langle\hbox{\it#1}\rangle\,$} @@ -422,7 +421,8 @@ command working only in horizontal mode or a character itself --- then the main processor switches to \ii horizontal/mode,@ {\em horizontal mode}: it opens an unlimited horizontal data row for typesetting material and puts material next to each other. For example -\i hbox `\hbox{a}\hbox{b}\hbox{c}` creates abc in horizontal mode. +\i hbox `a\hbox{b}\hbox{c}` opens horizontal mode due to \"a character +itself" `a` and creates abc in horizontal mode. When an empty line is scanned, the tokenizer creates a \i par `\par` token here and if the main processor is in horizontal mode, the `\par` command finalizes the @@ -801,6 +801,9 @@ The rule \"everything must be balanced" is applied to separated parameters too. It means that `\Test AB{C..DEF G}.. H` from the example above reads `B{C..DEF G}` to the `#2` parameter and the `#3` parameter is empty because the space (the delimiter of `#3` parameter) immediately follows two dots. +If the real parameter is in the form `{...}` then the outer +braces are removed from the parameter. For example `\Test A{C..DEF G}.. H` +reads `C..DEF G` to the `#2`. The separated parameter can bring a potential problem if the user forgets the delimiter or the delimiter is specified incorrectly. Then \TeX/ reports an @@ -823,7 +826,7 @@ then the number of `#` must be doubled for inner declaration. Example: \begtt \def\defmacro#1#2{% - \def#1##1 ##2 {##1 says: #1 ##2.}% + \def#1##1 ##2 {##1 says: #2 ##2.}% } \defmacro \hello {hello} % expands to \def\hello#1 #2 {#1 says: hello #2.} \defmacro \goodbye {good bye} @@ -895,7 +898,8 @@ All typographical traditions of math typesetting were taken into account. There are three chapters about math typesetting in his \TeX/book. Moreover, there is the detailed appendix G containing the exact specification of generating math formulae. This topic is unfortunately out of the scope of this short -text. +text. More about it can be found in +\ulink[http://petr.olsak.net/ftp/olsak/optex/optex-math.pdf]{Typesetting Math with \OpTeX/} There is a good a piece of news: all formats (including \LaTeX/) take the default \TeX/ syntax for ``. So, \LaTeX/ manuals or \LaTeX/ documents @@ -1228,6 +1232,12 @@ detail). These spaces are inserted above and below a formula generated in math display mode. +* \y`\thinmuskip=3mu`, + \y`\medmuskip=4mu plus 2mu minus 4mu`, + \y`\thickmuskip=5mu plus 5mu`. + These spaces are inserted after comma, around binary operators, and around + relations in math mode. The special math unit {\tt 1mu} is $(1/18)${\tt em}. + * \y`\tabskip=0pt` is used by the `\halign` primitive command for creating tables. * \y`\output={\plainoutput}`, \y`\everypar={}`, \y`\everymath={}` @@ -1308,17 +1318,21 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. \endtt * \i expandafter \z`\expandafter|;` does the transformation - \z``. The token processor will expand \z`` - after such a transformation. The \z`` is only the first level of + \z``. Then \TeX/ processes `` followed by + ``. + If `` isn't expandable then `\expandafter` silently does nothing. + The \z`` is only the first level of expansion. For example, a macro is transformed to its `` but without expansion of `` at this time. Or the `\csname...\endcsname` pair creates a control sequence but does not expand it at this time. - If \z`` is not expandable then \x`\expandafter` silently does - nothing. +% If \z`` is not expandable then \x`\expandafter` silently does +% nothing. - The example above (the `\keyval` macro) shows the usage of \x`\expandafter`. + A typical usage: the `` is a macro or a \TeX/ + primitive which needs `` as its parameter. + The example above (the `\keyval` macro) shows this case. We need not define `\csname` by `\def`; we want to define a `\dict:key`. The \x`\expandafter` helps here. @@ -1479,7 +1493,7 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. {\em do something} and it gets a \x`\chardef`-ed control sequence, it prints the character with Unicode (ASCII code) `` to the typesetting output. If it gets a \x`\mathchardef`-ed control sequence, it prints a math object (it works - only in math mode, not documented here). + only in math mode). * \i countdef `\countdef|;=` declares `` as an equivalent to the `\count` which is a register of counter type. @@ -1773,6 +1787,14 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. number type then the result is truncated. * See \*`\numexpr` and \*`\dimexpr`, expandable primitives documented in sections~\ref[reg] and~\ref[expand]. +* \*\*\i pdfuniformdeviate `\pdfuniformdeviate` expands to a random + number uniformly distributed in the range 0 (inclusive) to + `` (exclusive). Normal distribution between $-65536$ and $65536$ + can be reached by \*\*\i pdfnormaldeviate `\pdfnormaldeviate`. + The generator is initialized by time of the compilation, or you can use + \*\*\i pdfsetrandomseed `\pdfsetrandomseed` to do fixed + initialization, `` is an integer less than 1,000,999,999. + Luatex supports the same primitives but without `\pdf` prefix. \enditems \noindent {\bf Internal codes} @@ -2038,13 +2060,16 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. This feature is supported by pdf\TeX/ only. \enditems -\noindent {\bf Commands used in math mode} +\goodbreak\noindent {\bf Commands used in math mode} \begitems * \x`\displaystyle`, \x`\textstyle`, \x`\scriptstyle`, \x`\scriptscriptstyle` - switch to the specified style. + are `}{}` prints only one its + agrument dependent on the current math style. * \x`\mathord`, \x`\mathop`, \x`\mathbin`, \x`\mathrel`, \x`\mathopen`, \x`\mathclose`, - \x`\mathpunct` followed by `{}` create a math object of the given type. + \x`\mathpunct` followed by `{}` create a math object of the given + class. * \i over `{\over}` creates a fraction. The primitive commands \x`\atop` (without fraction rule), \i above `\above` (fraction rule with given thickness) should be used in the same @@ -2069,6 +2094,102 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. \i leqno `$$\leqno$$` puts it to the left margin. \enditems +\noindent {\bf Commands for setting math codes and math-family fonts}\par\nobreak\medskip + +Each character used in math mode must have its {\em math-code}. It includes +{\em class} of the character and how the glyph of the character should be printed. +The class is one of this: 0=Ord, 1=Op, 2=Bin, 3=Rel, 4=Open, 5=Close, 6=Punct, +and it affects spacing between objects, super/sub/script behavior etc. +The glyph for printing the character is saved in a {\em math-family font} at +its {\em slot}. Each math-family font has an assigned number using +`\textfont`, `\scriptfont` and `\scriptscriptfont` primitives. +When old 7bit \TeX/ fonts are +used, then the whole set of math characters is divided to more math-family +fonts, each of them has its own number. When Unicode math is used +then all math characters are stored in a single font and we (almost) never +need to use more than single math-family font with a single number. +The format must specify the math-code (i.e. class, math-family font number +and slot) for all characters used in math mode by following primitives. + +The `` mentioned below is a single 15bit number mostly used in hexadecimal +form with four digits: `"`, where `` is the class, `` is +the math-family font number and `` is the slot. + +\begitems +* \i mathcode `\mathcode =` sets the math-code for the character given + by its ASCII code. The `` is 8bit number. +* \i mathchardef `\mathchardef =` declares math-code for + given ``. When the `` is used in math mode then it behaves + as a single object equal to a real single character with its ``. +* \i textfont `\textfont=` declares math-family font `` as + `` for normal size characters. The `` is a font selector given + previously by `\font` primitive. +* \i scriptfont `\scriptfont=` declares math-family font `` as + `` for script size. +* \i scriptscriptfont `\scriptscriptfont=` declares math-family font `` as + `` for script-in-script size. +\enditems + +Unicode values can be set in \XeTeX/ and \LuaTeX/: + +\begitems +* \*\*\*\i Umathcode `\Umathcode=` sets + the math-code for a character given by its Unicode . The math-code is + presented by three independent numbers. +* \*\*\*\i Umathchardef `\Umathchardef=` + declares `` as a math object with the given math-code. +\enditems + +The scalable parentheses used after `\left`, `\right`, `\middle` must have +its delimiter-code ``. It is a +24bit number. When the hexadecimal form `"` of this +number is used then it gives +math-family font number `` and slot `` for basic size (typically +a normal text font) and +math-family font number `` and slot `` for the first successor of +\"parentheses chain" implemented in the font (typically a special font). + +\begitems +* \i delcode `\delcode=` sets the delimiter-code for the + ASCII character ``. +* \*\*\*\i Udelcode `\Udelcode=` sets the + delimiter-code for the Unicode character `` when a Unicode math font is + loaded. The font must implement the \"parentheses chain" at the `` + directly, we needn't to distinguish the basic size and the first + successor. +\enditems + +\noindent{\bf Commands for using math-codes directly in math mode} + +\begitems +* \i mathchar `\mathchar` prints a math object given by math-code. +* \*\*\*\i Umathchar `\Umathchar` + prints a math object given by math-code. +* \i mathaccent `\mathaccent` prints an accent above + `` given by its math-code. The `` can be single math + object or `{}`. +* \*\*\*\i Umathaccent `\Umathaccent` + creates an accent over `` given by its math-code. The accent is + stretchable (relative to the width of the ``) by default and if + the font implements the \"accents chain" at the ``. The optional + `` is `fixed` (do not stretch the accent) or `bottom` (place + the accent to the bottom of the ``). +* \i delimiter `\delimiter` prints a given delimiter, can be used after + `\left`, `\right`, `\middle`. The `` can have seven hexadecimal + digits, first of them is class, others give normal ``. The class + is used if the `\delimiter` doesn't follow `\left`, `\right`, `\middle`. +* \*\*\*\i Udelimiter `\Udelimiter` behaves as + a character with given delimiter-code (after `\left`, `\right`) or as + a normal math character with its `` (in other cases). +* \i radical `\radical` creates radical symbol over + ``. The `` is interpreted as ``, i.e.\ the + first font must include the basic size and the second font must implement + the \"radicals chain". +* \*\*\*\i Uradical `\Uradical` creates radical + symbol over ``. The Unicode math font must implement the + \"radicals chain" at the ``. +\enditems + \sec[plain] Summary of plain \TeX/ macros \noindent{\bf Allocators} @@ -2092,7 +2213,7 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. `\ifsoemthing` which behaves like other `\if`\code{*} primitive commands. \enditems -\noindent{\bf Vertical skips} +\goodbreak\noindent{\bf Vertical skips} \begitems * \x`\bigskip` does \x`\vskip` by one line, \x`\medskip` does `\vskip` by @@ -2190,10 +2311,18 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. * \x`\raggedright` sets the paragraph shape with the ragged right margin. \x`\raggedbottom` sets the page-setting shape with the ragged bottoms. + +* \i phantom `\phantom{}` prints empty box with dimensions like + `\hbox{}`. \i vphantom `\vphantom{}`, \i hphantom + `\hphantom{}` does the same but the result of `\vphantom` sets its + width to zero, the result of `\hphantom` sets its height plus depth to zero. + \i smash `\smash{}` prints `\hbox{}` but height plus depth is + set to zero. In math mode, these commands keep the current math style. + \enditems \noindent{\bf Floating objects} - +\par\nobreak\medskip\nobreak \begitems * \i footnote `\footnote{}`\z`{}` creates a footnote with given `` and \z``. @@ -2258,6 +2387,10 @@ If it is~a~Lua\TeX/ only command then three *** are prefixed. \x`\leqalignno` does the same as `\eqalignno` but `` is put to the left margin. } +* \i mathpalette `\mathpalette\macro{}` runs + `\macro