diff options
Diffstat (limited to 'macros/luatex/optex/base/fnotes.opm')
-rw-r--r-- | macros/luatex/optex/base/fnotes.opm | 67 |
1 files changed, 33 insertions, 34 deletions
diff --git a/macros/luatex/optex/base/fnotes.opm b/macros/luatex/optex/base/fnotes.opm index 219b2cf293..612b32a17d 100644 --- a/macros/luatex/optex/base/fnotes.opm +++ b/macros/luatex/optex/base/fnotes.opm @@ -1,25 +1,24 @@ -%% This is part of OpTeX project, see http://petr.olsak.net/optex +%% This is part of the OpTeX project, see http://petr.olsak.net/optex \_codedecl \fnote {Footnotes, marginal notes OpTeX <2020-05-26>} % loaded in format \_doc ----------------------------- - \`\_gfnotenum` is conter which counts footnotes globally in the document. - whole document, chapters, pages.\nl - \`\_lfnotenum` is counter which counts footnotes at each chapter from one. - It is used for local page footnote counters too.\nl + \`\_gfnotenum` is a counter which counts footnotes globally in the whole document.\nl + \`\_lfnotenum` is a counter which counts footnotes at each chapter from one. + It is used for local page footnote counters too.\nl \`\_ifpgfnote` says that footnote numbers are counted on each page from - one. We need to run `\openref` in such case.\nl - \`\fnotenum` is a macro which expands to footnote number counted in declared part.\nl + one. We need to run `\openref` in this case.\nl + \`\fnotenum` is a macro that expands to footnote number counted in declared part.\nl \`\fnotenumchapters` declares footnotes numbered in each chapter from one (default), \`\fnotenumglobal` declares footnotes numbered in whole - document from one and \`\fnotenumpages` declares footnotes numbered - at each page from one. + document from one and \`\fnotenumpages` declares footnotes numbered + at each page from one. \_cod ----------------------------- \_newcount\_gfnotenum \_gfnotenum=0 \_newcount\_lfnotenum -\_newifi \_ifpgfnote +\_newifi \_ifpgfnote \_def \_fnotenumglobal {\_def\_fnotenum{\_the\_gfnotenum}\_pgfnotefalse} \_def \_fnotenumchapters {\_def\_fnotenum{\_the\_lfnotenum}\_pgfnotefalse} \_def \_fnotenumpages {\_def\_fnotenum{\_trycs{_fn:\_the\_gfnotenum}{?}}\_pgfnotetrue} @@ -32,15 +31,15 @@ The \`\_printfnotemark` prints the footnote mark. You can re-define this macro if you want another design of footnotes. For example \begtt - \fnotenumpages - \def \_printfnotemark {\ifcase 0\fnotenum\or + \fnotenumpages + \def \_printfnotemark {\ifcase 0\fnotenum\or *\or**\or***\or$^\mathbox{†}$\or$^\mathbox{‡}$\or$^\mathbox{††}$\fi} \endtt - This code gives footnotes* and ** and*** and$^\mathbox{†}$ etc.\ + This code gives footnotes* and ** and*** and$^\mathbox{†}$ etc.\ and it supposes that there are no more than 6 footnotes at one page. If you want to distinguish between footnote marks in the text and in the front of - footnote itself, then you can define `\_printfnotemarkA` and `\_printfnotemarkB`. + the footnote itself, then you can define `\_printfnotemarkA` and `\_printfnotemarkB`. The \`\fnotelinks``<colorA><colorB>` implements the hyperlinked footnotes (from text to footnote and backward). @@ -50,7 +49,7 @@ \_def \_printfnotemarkA {\_printfnotemark} % footnote marks used in text \_def \_printfnotemarkB {\_printfnotemark} % footnote marks used in front of footnotes -\_def \_fnotelinks#1#2{% <inText color> <inFootnote color> +\_def \_fnotelinks#1#2{% <inText color> <inFootnote color> \_def\_printfnotemarkA{\_link[fnt:\_the\_gfnotenum]{\_localcolor#1}{\_printfnotemark}% \_dest[fnf:\_the\_gfnotenum]}% \_def\_printfnotemarkB{\_link[fnf:\_the\_gfnotenum]{\_localcolor#2}{\_printfnotemark}% @@ -59,7 +58,7 @@ \public \fnotelinks ; \_doc ---------------------------- - Each footnote saves the \`\_Xfnote` (without parameter) to the `.ref` + Each footnote saves the \`\_Xfnote` (without parameter) to the `.ref` file (if `\openref`). We can create the mapping from `<gfnotenum>` to`<pgfnotenum>` in the macro `\_fn:<fnotenum>`. Each \^`\_Xpage` macro sets the `\_lfnotenum` to zero. @@ -70,7 +69,7 @@ \_doc ---------------------------- The \`\fnote` `{<text>}` macro is simple, \`\fnotemark` and \^`\fnotetext` - does the real work. + does the real work. \_cod ---------------------------- \_def\_fnote{\_fnotemark1\_fnotetext} @@ -79,13 +78,13 @@ \_doc ---------------------------- The \`\fnotetext` calls \^`\_opfootnote` which is equivalent to plain \TeX/ \^`\vfootnote`. It creates new data to Insert \^`\footins`. The only - difference is that we are able to propagate a macro parameter into Insert group - before the text is printed (see section \ref[output]). + difference is that we can propagate a macro parameter into the Insert group + before the text is printed (see section \ref[output]). This propagated macro is \`\_fnset` which sets smaller fonts. - Note that \^`\vfootnote` and \^`\_opfootnote` does't read the text as a - parameter but during normal horizontal mode. This is reason why catcode - changes (for example in-line verbatim) can be used here. + Note that \^`\vfootnote` and \^`\_opfootnote` don't read the text as a + parameter but during the normal horizontal mode. This is the reason why catcode + changes (for example in-line verbatim) can be used here. \_cod ---------------------------- \_def\_fnotetext{\_incr\_gfnotenum \_incr\_lfnotenum % global increment @@ -106,9 +105,9 @@ margin at even pages. The `\mnote` macro saves its position to `.ref` file as \`\_Xmnote` without parameter. We define `\_mn:<mnotenum>` as `\right` or `\left` when the `.ref` file is read. - The `\ifnum 0`$\le$`0#2` trick returns true if `<pageno>` has numeric type and false - if it is non-numeric type (Roman numeral, for example). We prefer to use - `<pageno>`, but only if it has numeric type. We use `<gpageno>` in other cases. + The `\ifnum 0`$\le$`0#2` trick returns true if `<pageno>` has a numeric type and false + if it is a non-numeric type (Roman numeral, for example). We prefer to use + `<pageno>`, but only if it has the numeric type. We use `<gpageno>` in other cases. \_cod ----------------------------- \_newcount\_mnotenum \_mnotenum=0 % global counter of mnotes @@ -119,18 +118,18 @@ \_doc ----------------------------- User can declare \`\fixmnotes``\left` or \^`\fixmnotes``\right`. It defines - \`\_mnotesfixed` as `\_left` or `\_right` which declares the placement - of all marginal notes and such declaration has a precedence. + \`\_mnotesfixed` as `\_left` or `\_right` which declares the placement + of all marginal notes and such declaration has a precedence. \_cod ----------------------------- \_def \_fixmnotes #1{\_edef\_mnotesfixed{\_cs{_\_csstring #1}}} \_public \fixmnotes ; \_doc ----------------------------- - The \`\_mnoteD``{<text>}` macro sets the position the marginal note. + The \`\_mnoteD``{<text>}` macro sets the position of the marginal note. The outer box of marginal note has zero width and zero depth and it is appended after current line using `\vadjust` primitive or it is inverted to vertical mode - as a box with `\vskip-\baselineskip` followed. + as a box with `\vskip-\baselineskip` followed. \_cod ----------------------------- \_def\_mnote #1#{\_ifx^#1^\_else \_mnoteC#1\_end \_fi \_mnoteD} @@ -142,10 +141,10 @@ \_public \mnote ; \_doc ----------------------------- - The \`\mnoteskip` is a dimen which denotes the vertical shift of marginal - note from its normal position. Positive value means shift up, negative + The \`\mnoteskip` is a dimen value that denotes the vertical shift of marginal + note from its normal position. A positive value means shift up, negative down. The `\mnoteskip` register is set to zero - after the marginal note is printed. The new sytax `\mnote up<dimen>{<text>}` + after the marginal note is printed. The new syntax `\mnote up<dimen>{<text>}` is possible too, but public `\mnoteskip` is kept for backward compatibility. \_cod ----------------------------- @@ -160,7 +159,7 @@ \_long\_def\_mnoteA #1{\_incr\_mnotenum \_ifx\_mnotesfixed\_undefined - \_ifcsname _mn:\_the\_mnotenum \_endcsname + \_ifcsname _mn:\_the\_mnotenum \_endcsname \_edef\_mnotesfixed{\_cs{_mn:\_the\_mnotenum}}% \_else \_opwarning{unknown \_noexpand\mnote side. TeX me again}\_openref @@ -175,7 +174,7 @@ {\_the\_everymnote\_noindent#1\_endgraf}}% \_dp0=0pt \_box0 \_kern\_mnoteskip \_global\_mnoteskip=0pt}\_hss}% } -\_def \_lrmnote#1#2{\_ea\_ifx\_mnotesfixed\_left #1\_else #2\_fi} +\_def \_lrmnote#1#2{\_ea\_ifx\_mnotesfixed\_left #1\_else #2\_fi} \_doc ----------------------------- We don't want to process `\fnote`, `\fnotemark`, `\mnote` in TOC, headlines |