summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/luatex/optex/base/sections.opm
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/luatex/optex/base/sections.opm')
-rw-r--r--Master/texmf-dist/tex/luatex/optex/base/sections.opm52
1 files changed, 36 insertions, 16 deletions
diff --git a/Master/texmf-dist/tex/luatex/optex/base/sections.opm b/Master/texmf-dist/tex/luatex/optex/base/sections.opm
index 66dc9cd9e08..5e50fa3b9fe 100644
--- a/Master/texmf-dist/tex/luatex/optex/base/sections.opm
+++ b/Master/texmf-dist/tex/luatex/optex/base/sections.opm
@@ -1,6 +1,6 @@
%% This is part of the OpTeX project, see http://petr.olsak.net/optex
-\_codedecl \chap {Titles, chapters, sections, subsections <2020-03-28>} % preloaded in format
+\_codedecl \chap {Titles, chapters, sections, subsections <2021-02-09>} % preloaded in format
\_doc ---------------------------
We are using scaled fonts for titles
@@ -97,7 +97,8 @@
* `\_sectionlevel=1` -- chapters (used in `\chap`)
* `\_sectionlevel=2` -- sections (used in `\sec`)
* `\_sectionlevel=3` -- subsections (used in `\secc`)
- * `\_sectionlevel=4` -- subsubsections (unused by default)
+ * `\_sectionlevel=4` -- subsubsections (unused by default, see the
+ \ulink[http://petr.olsak.net/optex/optex-tricks.html\#seccc]{\OpTeX/ trick 0033})
\enditems
\_cod --------------------------
@@ -130,7 +131,6 @@
subsections <num>.<num>. On the other hand, if chapter is used in the
document then `\_chapnum>0` and sections have numbers` <num>.<num>`
and subsections have numbers `<num>.<num>.<num>`.
-
\_cod --------------------------
\_newcount \_chapnum % chapters
@@ -152,7 +152,6 @@
\_def \_thednum {(\_the\_dnum)}
\_def\_othe #1.{\_ifnum#1>0 \_the#1.\_fi}
-\_def\_incr #1{\_global\_advance#1by1 }
\_doc ----------------------------
The \`\notoc` and \`\nonum` prefixes are implemented by
@@ -204,12 +203,11 @@
\_doc ----------------------------
The \`\_printrefnum``[<pre>@<post>]` macro is used in `\_print*` macros.
- \nl
- The \`\_wtotoc` `{<level>}{<info>}{<ref-num>}{<title-text>}`
- macro expands its parameters and does \^`\_wref`.
Note that the `<tite-text>` is `\detokenize`d before `\_wref`, so the
problem of \"fragile macros" from old \LaTeX/ never occurs.
+ This fourth parameter is not delimited by `{...}` but by end of line.
+ This gives possibility to have unbalanced braces in inline verbatim in titles.
\_cod ----------------------------
\_def \_printrefnum [#1@#2]{\_leavevmode % we must be in horizontal mode
@@ -217,12 +215,20 @@
\_wlabel \_therefnum % references, if `\label[<label>]` is declared
\_ifnotoc \_else \_incr \_tocrefnum
\_dest[toc:\_the\_tocrefnum]%
- \_wtotoc{\_the\_sectionlevel}{\_secinfo}%
- {\_therefnum}{\_detokenize\_ea{\_savedtitle}}%
+ \_ewref\_Xtoc{{\_the\_sectionlevel}{\_secinfo}%
+ {\_therefnum}{\_theoutline}\_detokenize\_ea{\_savedtitle}}%
\_fi
+ \_gdef\_theoutline{}%
}
-\_def \_wtotoc #1#2#3#4{\_edef\_tmp{{#1}{#2}{#3}{#4}}\_ea\_wtotocA\_tmp}
-\_def \_wtotocA #1#2#3#4{\_wref\_Xtoc{{#1}{#2}{#3}#4}}
+
+ \_doc -----------------------------
+ \`\thisoutline``{<text>}` saves text to the \`\_theoutline` macro.
+ \^`\_printrefnum` uses it and removes it.
+ \_cod -----------------------------
+
+\_def\_theoutline{}
+\_def\_thisoutline#1{\_gdef\_theoutline{#1}}
+\_public \thisoutline ;
\_doc -----------------------------
The \`\_abovetitle``{<penaltyA>}{<skipA>}` and \`\_belowtitle``{<skipB>}` pair
@@ -256,7 +262,7 @@
\_def\_nbpar{{\_interlinepenalty=10000\_endgraf}}
-\_protected\_def\_nl{\_hfil\_break}
+\_protected\_def\_nl{\_unskip\_hfil\_break}
\_regmacro {\_def\_nl{\_unskip\_space}} {\_def\_nl{\_unskip\_space}} {\_def\_nl{ }}
\_regmacro {\_def\nl{\_unskip\_space}} {\_def\nl{\_unskip\_space}} {\_def\nl{ }}
@@ -321,7 +327,10 @@
\_public \secl ;
\_doc -----------------------------
- The \`\caption``/<letter>` uses `\_<letter>num` counter.
+ The \`\caption``/<letter>` increases `\_<letter>num` counter,
+ edefines \`\_thecapnum` as `\_the<letter>num` and
+ defines \`\_thecaptitle` as language-dependent word using \^`\_mtext`,
+ runs the `\_everycaption<letter>` tokens register.
The group opened by `\caption` is finalized by first `\par` from
an empty line or from `\vskip` or from `\endinsert`.
The `\_printcaption<letter>` is called, it starts with
@@ -350,9 +359,9 @@
They switch to horizontal mode and use `\_wlabel\_thecapnum` (in order to
make reference and hyperlink destination) a they can use:
\begitems
- * `\_thecaptitle` ... expands to the word Table or Figure (depending on
- the current language).
- * `\_thecapnum` ... expands to `\the<letter>num` (caption number).
+ * \^`\_thecaptitle` ... expands to the word Table or Figure (depending on
+ the current language).
+ * \^`\_thecapnum` ... expands to `\the<letter>num` (caption number).
\enditems
\_cod -----------------------------
@@ -363,6 +372,15 @@
\_let \_printcaptionf = \_printcaptiont % caption of figures = caption of tables
\_doc -----------------------------
+ If you want to declare a new type of `\caption` with independent counter,
+ you can use following lines, where `\caption/a` for Algorithms are
+ declared:
+ \begtt
+ \let\_printcaptiona = \_printcaptionf \let\_everycaptiona = \_everycaptionf
+ \newcount\_anum \addto\_secx {\_anum=0 }
+ \def\_theanum {\_othe\_chapnum.\_the\_secnum.\_the\_anum}
+ \sdef{_mt:a:en}{Algorithm} \sdef{_mt:a:cs}{Algoritmus} % + your language...
+ \endtt
The default format of `\caption` text is a paragraph in block narrower by
`\_iindent` and with the last line is centered. This setting is done by
the \`\_narrowlastlinecentered` macro.
@@ -432,6 +450,8 @@
\_endcode % -------------------------------------
+2021-02-09 \thisoutline implemented
+2021-01-26 \_nl: \unskip added
2021-01-11 \secl introduced
2021-01-05 \_thednum printed in text mode in its both occurences.
2020-04-28 \_secfonts etc: \_boldify is last.