summaryrefslogtreecommitdiff
path: root/tex/context/base/strc-not.mkvi
diff options
context:
space:
mode:
Diffstat (limited to 'tex/context/base/strc-not.mkvi')
-rw-r--r--tex/context/base/strc-not.mkvi631
1 files changed, 354 insertions, 277 deletions
diff --git a/tex/context/base/strc-not.mkvi b/tex/context/base/strc-not.mkvi
index 0a57ed878..0a89edf3d 100644
--- a/tex/context/base/strc-not.mkvi
+++ b/tex/context/base/strc-not.mkvi
@@ -21,10 +21,6 @@
% todo: see if we can now use \insertpenalties (>0 == some left)
-\ifdefined\v!notation \else \def\v!notation {notation} \fi
-\ifdefined\v!endnote \else \def\v!endnote {endnote} \fi
-\ifdefined\c!symbolcommand \else \def\c!symbolcommand{symbolcommand} \fi
-
\ifdefined\dotagsetnotesymbol \else \let\dotagsetnotesymbol\relax \fi
\unexpanded\def\unvboxed {\ifvmode\unvbox \else\box \fi} % will change or used more often
@@ -73,8 +69,6 @@
\let\setupnotations\setupnotation
-% \unexpanded\def\lowllap#1{\low{\llap{#1}}}
-
\definesymbol[\v!note:\v!previouspage][\llap{\low{\symbol[\v!previouspage]}}]
\definesymbol[\v!note:\v!nextpage ][\llap{\low{\symbol[\v!nextpage ]}}]
@@ -123,29 +117,26 @@
\c!state=\v!start,
\c!levels=3]
-% mostly the same as enumersations but we want to keep them
-% isolated and at some point we might differentiate
-
-% to be considered:
-%
-% \let\??construction\??notation
-%
-% with push/pop (also at definition time)
-
-\unexpanded\def\strc_define_commands_notation#1#2#3% current level parent
- {\doifelsenothing{#3}
- {\normalexpanded{\defineconstruction[#1][\s!handler=\v!notation,\c!level=#2]}%
- \setevalue{\??notation#1:\s!parent}{\??notation}}%
- {\normalexpanded{\defineconstruction[#1][#3][\s!handler=\v!notation,\c!level=#2]}%
- \setevalue{\??notation#1:\s!parent}{\??notation#3}}%
- \setuevalue{\e!next #1}{\strc_notations_next }%
- \setuevalue{\c!reset#1}{\strc_notations_reset }%
- %setuevalue{\c!set #1}{\strc_notations_set }%
-% \setuevalue {#1}{\strc_notations_command{\currentnotation}}%
-% \setuevalue{\e!start#1}{\strc_notations_start {\currentnotation}{#1}}%
- \setuevalue {#1}{\strc_notations_command{#1}}%
- \setuevalue{\e!start#1}{\strc_notations_start {#1}{#1}}% okay?
- \setuevalue{\e!stop #1}{\strc_notations_stop }}
+%D The code here is mostly the same as enumersations but we want to keep them
+%D isolated and at some point we might differentiate.
+
+% \installcorenamespace{noteclass}
+
+\unexpanded\def\strc_define_commands_notation#tag#level#parent%
+ {\doifelsenothing{#parent}
+ {\normalexpanded{\defineconstruction[#tag][\s!handler=\v!notation,\c!level=#level]}%
+ \setevalue{\??notation#tag:\s!parent}{\??notation}}%
+ {\normalexpanded{\defineconstruction[#tag][#parent][\s!handler=\v!notation,\c!level=#level]}%
+ \setevalue{\??note#tag:\s!parent}{\??note#parent}% see later for \s!note
+ \setevalue{\??notation#tag:\s!parent}{\??notation#parent}}%
+ \setuevalue{\e!next #tag}{\strc_notations_next }%
+ \setuevalue{\c!reset#tag}{\strc_notations_reset }%
+ %setuevalue{\c!set #tag}{\strc_notations_set }%
+ %setuevalue {#tag}{\strc_notations_command{\currentnotation}}%
+ %setuevalue{\e!start#tag}{\strc_notations_start {\currentnotation}{#tag}}%
+ \setuevalue {#tag}{\strc_notations_command{#tag}}%
+ \setuevalue{\e!start#tag}{\strc_notations_start {#tag}{#tag}}% okay?
+ \setuevalue{\e!stop #tag}{\strc_notations_stop }}
\appendtoks
\ifx\currentnotationparent\empty
@@ -179,23 +170,23 @@
\ifx\p_counter\empty %
\let\p_counter\currentnotation
\fi
-% \doifcounterelse\p_counter\donothing{\strc_enumerations_define_counter\p_counter}%
-% \letnotationparameter\s!counter\p_counter
-% \strc_enumerations_setup_counter\currentnotation
\doifcounterelse\p_counter\donothing{\strc_notes_define_counter\p_counter}%
\letnotationparameter\s!counter\p_counter
\strc_notes_setup_counter\currentnotation
\to \everydefinenotation
-\setvalue{\??constructioninitializer\v!notation}%
+\let\p_strc_constructions_title \empty
+\let\p_strc_constructions_number\empty
+
+\unexpanded\setvalue{\??constructioninitializer\v!notation}%
{\let\currentnotation \currentconstruction
\let\constructionparameter \notationparameter
\let\detokenizedconstructionparameter\detokenizednotationparameter
\let\letconstructionparameter \letnotationparameter
\let\useconstructionstyleandcolor \usenotationstyleandcolor
\let\setupcurrentconstruction \setupcurrentnotation
- \edef\p_number{\constructionparameter\c!number}%
- \ifx\p_number\v!yes
+ \edef\p_strc_constructions_number{\constructionparameter\c!number}%
+ \ifx\p_strc_constructions_number\v!yes
\settrue\c_strc_constructions_number_state
\iftrialtypesetting
\strc_counters_save\currentconstructionnumber
@@ -204,14 +195,14 @@
\else
\setfalse\c_strc_constructions_number_state
\fi
- \edef\p_title{\constructionparameter\c!title}%
- \ifx\p_title\v!yes
+ \edef\p_strc_constructions_title{\constructionparameter\c!title}%
+ \ifx\p_strc_constructions_title\v!yes
\settrue\c_strc_constructions_title_state
\else
\setfalse\c_strc_constructions_title_state
\fi}
-\setvalue{\??constructionfinalizer\v!notation}%
+\unexpanded\setvalue{\??constructionfinalizer\v!notation}%
{\ifconditional\c_strc_constructions_number_state
\iftrialtypesetting
\strc_counters_restore\currentconstructionnumber
@@ -232,58 +223,58 @@
\let\strc_notations_reset\strc_enumerations_reset
%let\strc_notations_set \strc_enumerations_set
-\unexpanded\def\strc_notations_command#1%
+\unexpanded\def\strc_notations_command#tag%
{\begingroup
- \edef\currentnote{#1}%
- \strc_constructions_initialize{#1}%
+ \edef\currentnote{#tag}%
+ \strc_constructions_initialize{#tag}%
\strc_notes_synchronize
\ifnotesenabled
\strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel
\fi
\doifnextoptionalelse\strc_notations_command_yes\strc_notations_command_nop}
-\unexpanded\def\strc_notations_command_nop#1%
- {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#1},\c!bookmark=,\c!list=][]%
+\unexpanded\def\strc_notations_command_nop#title%
+ {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#title},\c!bookmark=,\c!list=][]%
\csname\??constructionnotehandler\currentconstructionhandler\endcsname
\strc_constructions_finalize
\normalexpanded{\endgroup\noteparameter\c!next}}
-\unexpanded\def\strc_notations_command_yes[#1]%
- {\doifassignmentelse{#1}\strc_notations_command_assignment\strc_notations_command_argument[#1]}
+\unexpanded\def\strc_notations_command_yes[#optional]%
+ {\doifassignmentelse{#optional}\strc_notations_command_assignment\strc_notations_command_argument[#optional]}
-\unexpanded\def\strc_notations_command_assignment[#1]%
- {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#1][]%
+\unexpanded\def\strc_notations_command_assignment[#settings]%
+ {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference=,\c!title=,\c!bookmark=,\c!list=,#settings][]%
\csname\??constructionnotehandler\currentconstructionhandler\endcsname
\strc_constructions_finalize
\normalexpanded{\endgroup\noteparameter\c!next}}
-\unexpanded\def\strc_notations_command_argument[#1]#2%
- {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=][]%
+\unexpanded\def\strc_notations_command_argument[#reference]#title%
+ {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference={#reference},\c!title={#title},\c!bookmark=,\c!list=][]%
\csname\??constructionnotehandler\currentconstructionhandler\endcsname
\strc_constructions_finalize
\normalexpanded{\endgroup\noteparameter\c!next}}
-\unexpanded\def\strc_notations_start#1#2%
+\unexpanded\def\strc_notations_start#tag#stoptag%
{\begingroup
- \edef\currentnote{#1}%
- \strc_constructions_initialize{#1}%
+ \edef\currentnote{#tag}%
+ \strc_constructions_initialize{#tag}%
\strc_notes_synchronize
\ifnotesenabled
\strc_counters_increment_sub\currentconstructionnumber\currentconstructionlevel
\fi
\normalexpanded % not that efficient but also not that frequently used
- {\def\noexpand\strc_pickup_yes[##1]##2\csname\e!stop#2\endcsname{\strc_notations_command_yes[##1]{##2}}%
- \def\noexpand\strc_pickup_nop ##1\csname\e!stop#2\endcsname{\strc_notations_command_nop {##1}}}%
+ {\def\noexpand\strc_pickup_yes[##1]##2\csname\e!stop#stoptag\endcsname{\strc_notations_command_yes[##1]{##2}}%
+ \def\noexpand\strc_pickup_nop ##1\csname\e!stop#stoptag\endcsname{\strc_notations_command_nop {##1}}}%
\doifnextoptionalelse\strc_pickup_yes\strc_pickup_nop}
-\unexpanded\def\strc_notations_start_yes[#1]#2%
- {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference={#1},\c!title={#2},\c!bookmark=,\c!list=][]%
+\unexpanded\def\strc_notations_start_yes[#reference]#title%
+ {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference={#reference},\c!title={#title},\c!bookmark=,\c!list=][]%
\csname\??constructionnotehandler\currentconstructionhandler\endcsname
\strc_constructions_finalize
\normalexpanded{\endgroup\noteparameter\c!next}}
-\unexpanded\def\strc_notations_start_nop#1%
- {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#1},\c!bookmark=,\c!list=][]%
+\unexpanded\def\strc_notations_start_nop#title%
+ {\strc_constructions_register[\c!label={\descriptionparameter\c!text},\c!reference=,\c!title={#title},\c!bookmark=,\c!list=][]%
\csname\??constructionnotehandler\currentconstructionhandler\endcsname
\strc_constructions_finalize
\normalexpanded{\endgroup\noteparameter\c!next}}
@@ -296,10 +287,10 @@
%D level of indirectness. This way notations don't bark on undefined
%D macros when used in combination.
-\setvalue{\??constructionnotehandler\v!notation}%
+\unexpanded\setvalue{\??constructionnotehandler\v!notation}%
{\csname\??constructionnotehandler\currentconstructionhandler:\constructionparameter\c!type\endcsname}
-\setvalue{\??constructionnotehandler\v!notation:}% empty case
+\unexpanded\setvalue{\??constructionnotehandler\v!notation:}% empty case
{[\currentconstructionhandler:\currentconstruction]}
%D Here is a simple renderer for notes
@@ -371,51 +362,65 @@
%D Insertions are part of notes.
-\installcorenamespace{noteinsertion}
-
-\def\currentnoteins{\csname\??noteinsertion\currentnote\endcsname}
+% \installcorenamespace{noteinsertion}
+
+\def\currentnoteinsertion {\noteparameter\s!insert}
+\def\currentnoteinsertionnumber{\namedinsertionnumber{\noteparameter\s!insert}}
+
+% \appendtoks
+% \doifinsertionelse\currentnote
+% \donothing
+% {\defineinsertion[\currentnote]% could be an option
+% \normalexpanded{\t_strc_notes{\the\t_strc_notes\noexpand\strc_notes_process_list{\currentnote}}}}%
+% \letnoteparameter\s!insert\currentnote
+% \ctxcommand{definenote("\currentnote","insert",\number\currentnoteinsertionnumber)}%
+% \ifx\currentnoteparent\empty
+% \definenotation[\currentnote][\c!type=\v!note]%
+% \else
+% \definenotation[\currentnote][\currentnoteparent][\c!type=\v!note]%
+% \fi
+% \to \everydefinenote
\appendtoks
- \ifcsname\??noteinsertion\currentnote\endcsname\else
- \expandafter\installinsertion\csname\??noteinsertion\currentnote\endcsname\relax
- \normalexpanded{\t_strc_notes{\the\t_strc_notes\noexpand\strc_notes_process_list{\currentnote}}}%
- \fi
- \ctxlua{structures.notes.define("\currentnote","insert",\number\currentnoteins)}%
\ifx\currentnoteparent\empty
+ \doifinsertionelse\currentnote
+ \donothing
+ {\defineinsertion[\currentnote]% could be an option
+ \normalexpanded{\t_strc_notes{\the\t_strc_notes\noexpand\strc_notes_process_list{\currentnote}}}}%
+ \letnoteparameter\s!insert\currentnote
\definenotation[\currentnote][\c!type=\v!note]%
\else
+ \setexpandednoteparameter\s!insert{\namednoteparameter\currentnoteparent\s!insert}%
\definenotation[\currentnote][\currentnoteparent][\c!type=\v!note]%
\fi
+ \ctxcommand{definenote("\currentnote","insert",\number\currentnoteinsertionnumber)}%
\to \everydefinenote
-% maybe we will share this at some point
-
-%%%%%%%%%%% BEGIN TODO (SEE ENUMERATIONS) %%%%%%%%%%%%%%%
+% maybe we will share this at some point:
\newtoks\everysetupnotecounter
\let\v_strc_note_counter_name\empty
-\def\strc_notes_setup_counter#1%
- {\edef\v_strc_note_counter_name{#1}% only used in the token list
+\def\strc_notes_setup_counter#tag%
+ {\edef\v_strc_note_counter_name{#tag}% only used in the token list
\the\everysetupnotecounter}
-\def\strc_notes_define_counter#1% todo: fast inheritance (was mainparameter
- {\definecounter[#1]%
- \strc_notes_setup_counter{#1}}
+\def\strc_notes_define_counter#tag% todo: fast inheritance (was mainparameter
+ {\definecounter[#tag]%
+ \strc_notes_setup_counter{#tag}}
\appendtoks
\strc_counter_setup_using_parameter\v_strc_note_counter_name\notationparameter
\to \everysetupnotecounter
\appendtoks
- \strc_notes_setup_counter\currentnotation
+ \ifx\currentnotation\empty \else
+ \strc_notes_setup_counter\currentnotation
+ \fi
\to \everysetupnotation
-%%%%%%%%%%% END TODO (SEE ENUMERATIONS) %%%%%%%%%%%%%%%
-
-% \setvalue{\??constructionstarthandler\v!notation}%
-% {\csname\??constructionstarthandler\v!construction\endcsname}
+% so far
%expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!enumeration\endcsname
\expandafter\let\csname\??constructionstarthandler \v!notation\expandafter\endcsname\csname\??constructionstarthandler \v!construction\endcsname % no par mess
@@ -423,35 +428,42 @@
\expandafter\let\csname\??constructioncommandhandler\v!notation\expandafter\endcsname\csname\??constructioncommandhandler\v!enumeration \endcsname
\expandafter\let\csname\??constructiontexthandler \v!notation\expandafter\endcsname\csname\??constructiontexthandler \v!enumeration \endcsname
-\setvalue{\??constructionmainhandler\v!notation}#1%
+\unexpanded\setvalue{\??constructionmainhandler\v!notation}#following%
{\iftrialtypesetting \else
\begingroup
\currentconstructionsynchronize
\attribute\destinationattribute\currentconstructionattribute\relax % todo, whole text
\signalcharacter
\endgroup
- \fi#1}
+ \fi#following}
-\setvalue{\??constructionnotehandler\v!notation:\v!note}% in the running text
+\unexpanded\setvalue{\??constructionnotehandler\v!notation:\v!note}% in the running text
{\ifnotesenabled
- \let\currentnote\currentconstructionmain % do be done elsewhere
+ % do be done elsewhere
+ %
+ %let\currentnote\currentconstructionmain
+ \let\currentnote\currentconstruction % else wrong inheritance
+ %
\iftrialtypesetting
\strc_notes_inject_dummy
\else
\begingroup
- \edef\currentnotenumber{\ctxlua{structures.notes.store("\currentnote",\currentconstructionlistentry)}}%
+ \edef\currentnotenumber{\ctxcommand{storenote("\currentnote",\currentconstructionlistentry)}}%
\settrue\processingnote
\ifconditional\c_strc_notes_skip
- \globallet\lastnotesymbol\strc_notes_inject_symbol
+ \globallet\lastnotesymbol\strc_notes_inject_symbol_nop
+ \ifconditional\c_strc_notes_delayed
+ \strc_notes_inject_symbol_snc
+ \fi
\else
\iftypesettinglines % otherwise problems with \type <crlf> {xxx}
\ignorelines % makes footnotes work in \startlines ... \stoplines
\fi
\ifconditional\c_strc_notes_symbol
- \strc_notes_inject_symbol
+ \strc_notes_inject_symbol_yes
\else
\unskip\unskip
- \globallet\lastnotesymbol\strc_notes_inject_symbol
+ \globallet\lastnotesymbol\strc_notes_inject_symbol_yes
\fi
\fi
\ifconditional\postponingnotes % todo: per note class
@@ -514,7 +526,7 @@
\endcsname}
\setvalue{\??noteinteractioninline\v!yes}%
- {\strc_references_get_simple_page_reference{page(\ctxlua{structures.notes.getnumberpage("\currentnote",\currentnotenumber)})}%
+ {\strc_references_get_simple_page_reference{page(\ctxcommand{notenumberpage("\currentnote",\currentnotenumber)})}%
\edef\strc_notes_get_reference_attribute_symbol{attr\referenceattribute\currentreferenceattribute}%
\let \strc_notes_set_style_color_inline \strc_notes_set_style_color_inline_yes}
@@ -531,8 +543,10 @@
\expandafter\let\csname\??noteinteractioninline\v!number\expandafter\endcsname\csname\??noteinteractioninline\v!yes\endcsname
\expandafter\let\csname\??noteinteractioninline\v!text \expandafter\endcsname\csname\??noteinteractioninline\v!yes\endcsname
+% page(...) : we could have a dedicated one
+
\setvalue{\??noteinteractiondisplay\v!yes}%
- {\strc_references_get_simple_page_reference{page(\ctxlua{structures.notes.getsymbolpage("\currentnote",\currentnotenumber)})}%
+ {\strc_references_get_simple_page_reference{page(\ctxcommand{notesymbolpage("\currentnote",\currentnotenumber)})}%
\edef\strc_notes_set_reference_attribute_number{\attribute\referenceattribute\currentreferenceattribute}%
\let \strc_notes_set_reference_attribute_text \donothing
\let \strc_notes_set_destination_attribute_text\donothing
@@ -545,7 +559,7 @@
\let\strc_notes_set_style_color_display \strc_notes_set_style_color_display_nop}
\setvalue{\??noteinteractiondisplay\v!all}%
- {\strc_references_get_simple_page_reference{page(\ctxlua{structures.notes.getsymbolpage("\currentnote",\currentnotenumber)})}%
+ {\strc_references_get_simple_page_reference{page(\ctxcommand{notesymbolpage("\currentnote",\currentnotenumber)})}%
\edef\strc_notes_set_reference_attribute_text {\attribute\referenceattribute\currentreferenceattribute}%
%\strc_references_set_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}%
\strc_references_set_simple_page_reference{note:\currentnote:\currentnotenumber}%
@@ -554,7 +568,7 @@
\let \strc_notes_set_style_color_display \strc_notes_set_style_color_display_yes}
\setvalue{\??noteinteractiondisplay\v!text}%
- {\strc_references_get_simple_page_reference{page(\ctxlua{structures.notes.getsymbolpage("\currentnote",\currentnotenumber)})}%
+ {\strc_references_get_simple_page_reference{page(\ctxcommand{notesymbolpage("\currentnote",\currentnotenumber)})}%
\edef\strc_notes_set_reference_attribute_text {\attribute\referenceattribute\currentreferenceattribute}%
%\strc_references_set_simple_page_reference{note:\cldcontext{structures.notes.internalid("\currentnote",\currentnotenumber)}}%
\strc_references_set_simple_page_reference{note:\currentnote:\currentnotenumber}%
@@ -567,19 +581,19 @@
\let\strc_notes_set_style_color_inline_nop \usenotestyleandcolor
\let\strc_notes_set_style_color_display_nop\usenotationstyleandcolor
-\unexpanded\def\strc_notes_set_style_color_inline_yes#1#2%
- {\usenotestyleandcolor#1#2%
+\unexpanded\def\strc_notes_set_style_color_inline_yes#style#color%
+ {\usenotestyleandcolor#style#color%
\iflocation\strc_notes_set_style_color_special\fi}
-\unexpanded\def\strc_notes_set_style_color_display_yes#1#2%
- {\usenotationstyleandcolor#1#2%
+\unexpanded\def\strc_notes_set_style_color_display_yes#style#color%
+ {\usenotationstyleandcolor#style#color%
\iflocation\strc_notes_set_style_color_special\fi}
\def\strc_notes_set_style_color_special
{\iftrialtypesetting
% keep
\else\ifx\currentcolorparameter\empty
- \scratchcounter\ctxlua{structures.notes.deltapage("\currentnote",\currentnotenumber)}\relax % todo calculate once
+ \scratchcounter\ctxcommand{notedeltapage("\currentnote",\currentnotenumber)}\relax % todo calculate once
\setlocationcolorspecified\scratchcounter
\fi\fi}
@@ -598,7 +612,7 @@
% in mkii the pointer only showed up in pagewise notes
\unexpanded\def\strc_notes_inject_pointer % todo calculate once
- {\ifcase\ctxlua{structures.notes.deltapage("\currentnote",\currentnotenumber)}\relax
+ {\ifcase\ctxcommand{notedeltapage("\currentnote",\currentnotenumber)}\relax
% unknown
\or
% same page
@@ -610,10 +624,19 @@
\unexpanded\def\strc_notes_register_note_page % called more often than needed
{\iftrialtypesetting \else
- \normalexpanded{\noexpand\ctxlatelua{structures.notes.setsymbolpage("\currentnote",\currentnotenumber)}}%
+ \normalexpanded{\noexpand\ctxlatecommand{setnotesymbolpage("\currentnote",\currentnotenumber)}}%
\fi}
-\unexpanded\def\strc_notes_inject_symbol
+\unexpanded\def\strc_notes_inject_symbol_yes
+ {\strc_notes_inject_symbol_indeed\conditionaltrue}
+
+\unexpanded\def\strc_notes_inject_symbol_nop
+ {\strc_notes_inject_symbol_indeed\conditionalfalse}
+
+\unexpanded\def\strc_notes_inject_symbol_snc
+ {\currentconstructionsynchronize} % this flushes the data to the list
+
+\unexpanded\def\strc_notes_inject_symbol_indeed#synchronize%
{\removeunwantedspaces
\doifitalicelse\/\donothing % Charles IV \footnote{the fourth}
\ifdim\lastkern=\notesignal
@@ -622,7 +645,9 @@
\fi
\nobreak
\begingroup
- \currentconstructionsynchronize % this flushes the data to the list
+ \ifconditional#synchronize\relax
+ \strc_notes_inject_symbol_snc % this flushes the data to the list
+ \fi
\strc_notes_register_note_page % this registers the symbol page number (late)
\strc_notes_interaction_check_inline
\strc_notes_set_style_color_inline\c!textstyle\c!textcolor
@@ -646,7 +671,7 @@
\strc_notes_inject_separator
\fi
\nobreak
- \hbox to .5em{}%
+ \hbox to .5\emwidth{}%
\globallet\lastnotesymbol\relax}
\unexpanded\def\strc_notes_inject_separator % patch by WS due to request on list
@@ -751,8 +776,8 @@
\let\strc_notes_process_list\gobbleoneargument
-\unexpanded\def\strc_notes_process#1% argument is a \macro that uses \currentnote
- {\def\strc_notes_process_list##1{\edef\currentnote{##1}\let\currentdescription\currentnote#1}%
+\unexpanded\def\strc_notes_process#action% argument is a \macro that uses \currentnote
+ {\def\strc_notes_process_list##1{\edef\currentnote{##1}\let\currentdescription\currentnote#action}%
\the\t_strc_notes}
\newtoks\everychecknote % just before a note is typeset
@@ -805,8 +830,8 @@
{\letcurrentnoterulecommand\relax % so we default to nothing
\processcommacommand[\noteparameter\c!rule]\strc_notes_set_rule_step}
-\def\strc_notes_set_rule_step#1%
- {\csname\??noterule\ifcsname\??noterule#1\endcsname#1\else\s!unknown\fi\endcsname}
+\def\strc_notes_set_rule_step#alternative%
+ {\csname\??noterule\ifcsname\??noterule#alternative\endcsname#alternative\else\s!unknown\fi\endcsname}
\setvalue{\??noterule\v!command}{\letcurrentnoterulecommand\currentnoterulecommandcommand}
\setvalue{\??noterule \v!on}{\letcurrentnoterulecommand\currentnoterulecommandnormal}
@@ -857,7 +882,7 @@
\ifx\p_factor\empty \else
\ifnum\p_factor<\zerocount \else
% \global
- \count\currentnoteins\p_factor % new: global
+ \count\currentnoteinsertionnumber\p_factor % new: global
\fi
\fi}
@@ -869,50 +894,81 @@
\installcorenamespace{notelocationvariant}
\installcorenamespace{notepositionvariant}
-\installcorenamespace{notedelayed}
+\installcorenamespace{notedelayedvariant}
\installcorenamespace{notelocation}
\newconditional\c_strc_notes_delayed
-\setvalue{\??notelocation\v!page }{\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_page}
-\setvalue{\??notelocation\v!columns }{\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_columns}
-\setvalue{\??notelocation\v!lastcolumn }{\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_lastcolumn}
-\setvalue{\??notelocation\v!firstcolumn}{\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_firstcolumn}
-\setvalue{\??notelocation\v!none }{\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_none}
-\setvalue{\??notelocation\v!text }{\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_text}
+\unexpanded\def\strc_notes_set_delayed_yes{\settrue \c_strc_notes_delayed}
+\unexpanded\def\strc_notes_set_delayed_nop{\setfalse\c_strc_notes_delayed}
+
+\setvalue{\??notelocation\v!page }{\letvalue{\??notedelayedvariant \currentnote}\strc_notes_set_delayed_nop
+ \letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_page}
+\setvalue{\??notelocation\v!columns }{\letvalue{\??notedelayedvariant \currentnote}\strc_notes_set_delayed_nop
+ \letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_columns}
+\setvalue{\??notelocation\v!lastcolumn }{\letvalue{\??notedelayedvariant \currentnote}\strc_notes_set_delayed_nop
+ \letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_lastcolumn}
+\setvalue{\??notelocation\v!firstcolumn}{\letvalue{\??notedelayedvariant \currentnote}\strc_notes_set_delayed_nop
+ \letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_firstcolumn}
+\setvalue{\??notelocation\v!none }{\letvalue{\??notedelayedvariant \currentnote}\strc_notes_set_delayed_yes
+ \letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_none}
+\setvalue{\??notelocation\v!text }{\letvalue{\??notedelayedvariant \currentnote}\strc_notes_set_delayed_yes
+ \letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_text}
\setvalue{\??notelocation\v!high }{\letvalue{\??notepositionvariant\currentnote}\strc_notes_set_position_high}
\setvalue{\??notelocation\v!bottom }{\letvalue{\??notepositionvariant\currentnote}\strc_notes_set_position_bottom}
-\letvalue{\??notedelayed\v!page }\setfalse
-\letvalue{\??notedelayed\v!columns }\setfalse
-\letvalue{\??notedelayed\v!lastcolumn }\setfalse
-\letvalue{\??notedelayed\v!firstcolumn }\setfalse
-\letvalue{\??notedelayed\v!none }\settrue
-\letvalue{\??notedelayed\v!text }\settrue
+\setvalue{\??notedelayedvariant \??notedelayedvariant }{\strc_notes_set_delayed_nop} % not let
+\setvalue{\??notepositionvariant\??notepositionvariant}{\strc_notes_set_position_bottom} % not let
+\setvalue{\??notelocationvariant\??notelocationvariant}{\strc_notes_set_location_page} % not let
\unexpanded\def\strc_notes_set_delayed
- {\ifcsname\??notedelayed\currentnote\endcsname
- \csname\??notedelayed\currentnote\endcsname\c_strc_notes_delayed
- \else
- \setfalse\c_strc_notes_delayed
- \fi}
+ {\csname\??notedelayedvariant
+ \ifcsname\??notedelayedvariant\currentnote\endcsname
+ \currentnote
+ \else
+ \??notedelayedvariant
+ \fi
+ \endcsname}
+
+% \let\strc_notes_set_delayed_yes\truecondition
+% \let\strc_notes_set_delayed_nop\falsecondition
+%
+% \def\c_strc_notes_delayed
+% {\csname\??notedelayedvariant
+% \ifcsname\??notedelayedvariant\currentnote\endcsname
+% \currentnote
+% \else
+% \??notedelayedvariant
+% \fi
+% \endcsname}
+
+\unexpanded\def\strc_notes_set_position
+ {\csname\??notepositionvariant
+ \ifcsname\??notepositionvariant\currentnote\endcsname
+ \currentnote
+ \else
+ \??notepositionvariant
+ \fi
+ \endcsname}
\unexpanded\def\strc_notes_set_location
- {\letvalue{\??notelocationvariant\currentnote}\strc_notes_set_location_page
- \letvalue{\??notepositionvariant\currentnote}\strc_notes_set_position_bottom
- \setfalse\c_strc_notes_delayed
- \normalexpanded{\rawprocesscommalist[\noteparameter\c!location]\strc_notes_set_location_step}}
-
-\unexpanded\def\strc_notes_set_location_step#1%
- {\ifcsname\??notelocation#1\endcsname
- \csname\??notelocation#1\endcsname
- \fi
- \ifcsname\??notedelayed#1\endcsname
- \csname\??notedelayed#1\endcsname\c_strc_notes_delayed
- \fi}
+ {\csname\??notelocationvariant
+ \ifcsname\??notelocationvariant\currentnote\endcsname
+ \currentnote
+ \else
+ \??notelocationvariant
+ \fi
+ \endcsname}
+
+\unexpanded\def\strc_notes_set_variants
+ {\normalexpanded{\rawprocesscommalist[\noteparameter\c!location]\strc_notes_set_location_step}}
+
+\unexpanded\def\strc_notes_set_location_step#alternative% the insert related one
+ {\ifcsname\??notelocation#alternative\endcsname\csname\??notelocation#alternative\endcsname\fi}
\appendtoks
- \strc_notes_set_location
+ \strc_notes_set_variants
+ \strc_notes_set_delayed
\to \everysynchronizenote
\newskip \s_strc_notes_distance % we need to implement stretch
@@ -940,9 +996,10 @@
{\setfalse\c_strc_notes_delayed
\strc_notes_set_distance
\strc_notes_set_columns
- \global\count\currentnoteins\numexpr\plusthousand/\c_strc_notes_columns\relax
- \global\dimen\currentnoteins\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
- \global\skip \currentnoteins\s_strc_notes_distance}
+ \page_inserts_set_location\currentnoteinsertion\v!page % \setupinsertion[\currentnote][\c!location=\v!page]%
+ \global\count\currentnoteinsertionnumber\numexpr\plusthousand/\c_strc_notes_columns\relax
+ \global\dimen\currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
+ \global\skip \currentnoteinsertionnumber\s_strc_notes_distance}
\def\strc_notes_set_location_columns
{\setfalse\c_strc_notes_delayed
@@ -951,33 +1008,38 @@
\ifnum\currentnofcolumns=\zerocount
\c_strc_notes_columns\plusone
\fi
- \global\count\currentnoteins\numexpr\plusthousand/\c_strc_notes_columns\relax
- \global\dimen\currentnoteins\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
- \global\skip \currentnoteins\s_strc_notes_distance}
+ \page_inserts_set_location\currentnoteinsertion\v!columns % \setupinsertion[\currentnote][\c!location=\v!columns]%
+ \global\count\currentnoteinsertionnumber\numexpr\plusthousand/\c_strc_notes_columns\relax
+ \global\dimen\currentnoteinsertionnumber\ifnotelimit\dimexpr\noteparameter\c!height*\c_strc_notes_columns\relax\else\maxdimen\fi
+ \global\skip \currentnoteinsertionnumber\s_strc_notes_distance}
-\def\strc_notes_set_location_firstcolumn
+\def\strc_notes_set_location_somecolumn#whatcolumn%
{\setfalse\c_strc_notes_delayed
\strc_notes_set_distance
\strc_notes_set_columns
- \global\count\currentnoteins\plusthousand
- \global\dimen\currentnoteins\ifnotelimit\noteparameter\c!height\else\maxdimen\fi
- \global\skip \currentnoteins\s_strc_notes_distance}
+ \page_inserts_set_location\currentnoteinsertion#whatcolumn% \setupinsertion[\currentnote][\c!location=#whatcolumn]%
+ \global\count\currentnoteinsertionnumber\plusthousand
+ \global\dimen\currentnoteinsertionnumber\ifnotelimit\noteparameter\c!height\else\maxdimen\fi
+ \global\skip \currentnoteinsertionnumber\s_strc_notes_distance}
-\let\strc_notes_set_location_lastcolumn\strc_notes_set_location_firstcolumn
+\def\strc_notes_set_location_firstcolumn{\strc_notes_set_location_somecolumn\v!firstcolumn}
+\def\strc_notes_set_location_lastcolumn {\strc_notes_set_location_somecolumn\v!lastcolumn }
\def\strc_notes_set_location_text % we don't use inserts anyway (e.g. endnotes)
{\settrue\c_strc_notes_delayed
- \ctxlua{structures.notes.setstate("\currentnote","store")}%
- \global\dimen\currentnoteins\maxdimen
- \global\count\currentnoteins\zerocount
- \global\skip \currentnoteins\zeropoint}
+ \ctxcommand{setnotestate("\currentnote","store")}%
+ \page_inserts_set_location\currentnoteinsertion\v!text % \setupinsertion[\currentnote][\c!location=\v!text]%
+ \global\count\currentnoteinsertionnumber\zerocount
+ \global\dimen\currentnoteinsertionnumber\maxdimen
+ \global\skip \currentnoteinsertionnumber\zeropoint}
\let\strc_notes_set_location_none\strc_notes_set_location_text
\def\strc_notes_set_properties
{\strc_notes_set_columns
\strc_notes_set_distance
- \csname\??notelocationvariant\currentnote\endcsname}
+ \strc_notes_set_location
+ \strc_notes_set_delayed}
\let\strc_notes_set_position_high\relax
@@ -993,8 +1055,8 @@
\newconditional\c_notes_bottom_present
\def\strc_notes_check_if_bottom_present_indeed % in otr !
- {\ifvoid\currentnoteins\else
- \csname\??notepositionvariant\currentnote\endcsname
+ {\ifvoid\currentnoteinsertionnumber\else
+ \strc_notes_set_position
\fi}
\def\strc_notes_check_if_bottom_present_step
@@ -1105,39 +1167,39 @@
\newconditional\c_strc_notes_symbol \settrue\c_strc_notes_symbol % not used
\newconditional\c_strc_notes_skip
- \unexpanded\def\setnote [#1]{\getvalue{#1}}
- \unexpanded\def\setnotetext[#1]{\global\settrue\c_strc_notes_skip\getvalue{#1}}
+\unexpanded\def\setnote [#tag]{\getvalue{#tag}}
+\unexpanded\def\setnotetext[#tag]{\global\settrue\c_strc_notes_skip\getvalue{#tag}}
-\unexpanded\def\handlenoteinsert#1#2% tg, id
+\unexpanded\def\handlenoteinsert#tag#id%
{\begingroup
- \edef\currentnote{#1}%
- \strc_constructions_initialize{#1}%
+ \edef\currentnote{#tag}%
+ \strc_constructions_initialize{#tag}%
\strc_notes_synchronize
\the\everybeforenoteinsert
- \insert\currentnoteins\bgroup
+ \insert\currentnoteinsertionnumber\bgroup
\the\everyinsidenoteinsert\relax
\doprocesslocalsetups{\noteparameter\c!setups}% experimental
\doifelse{\noteparameter\c!paragraph}\v!yes
{\nointerlineskip
\startvboxtohbox
- \handlenoteitself{#1}{#2}%
+ \handlenoteitself{#tag}{#id}%
% add some slack
\stopvboxtohbox}
- {\handlenoteitself{#1}{#2}}%
+ {\handlenoteitself{#tag}{#id}}%
\egroup
\the\everyafternoteinsert
\endgroup}
-\unexpanded\def\betweennoteitself#1% tg
- {\edef\currentnote{#1}%
+\unexpanded\def\betweennoteitself#tag%
+ {\edef\currentnote{#tag}%
\doif{\noteparameter\c!paragraph}\v!yes\strc_notes_between_paragraphs}
-\unexpanded\def\handlenoteitself#1#2% tg, id
- {\edef\currentnotenumber{#2}%
- \edef\currentnote{#1}%
- \strc_constructions_initialize{#1}%
+\unexpanded\def\handlenoteitself#tag#id%
+ {\edef\currentnotenumber{#id}%
+ \edef\currentnote{#tag}%
+ \strc_constructions_initialize{#tag}%
\strc_notes_synchronize
- \edef\currentconstructionlistentry{\ctxlua{tex.write(structures.notes.listindex("#1",#2))}}% index in list cache
+ \edef\currentconstructionlistentry{\ctxcommand{notelistindex("\currentnote",#id)}}% index in list cache
% as we can have collected notes (e.g. in tables) we need to recover
% \currentdescriptionattribute and \currentdescriptionsynchronize
%
@@ -1157,7 +1219,7 @@
% \endgroup
}
-\unexpanded\def\strc_notes_inject_text
+\unexpanded\def\strc_notes_inject_text % hm main?
{\ctxcommand{savedlisttitle("\currentconstructionmain",\currentconstructionlistentry)}}
\let\startpushnote\relax
@@ -1216,14 +1278,14 @@
\def\strc_notes_place_inserts
{\strc_notes_set_delayed % \strc_notes_synchronize % we need to know if it's delayed
\ifconditional\c_strc_notes_delayed \else
- \ifdim\ht\currentnoteins>\zeropoint % or a faster delayed test
+ \ifdim\ht\currentnoteinsertionnumber>\zeropoint % or a faster delayed test
\strc_notes_place_inserts_indeed
\fi
\fi}
\def\strc_notes_place_inserts_indeed
{\relax
- \ifdim\ht\currentnoteins>\zeropoint
+ \ifdim\ht\currentnoteinsertionnumber>\zeropoint
\endgraf
\ifvmode
\whitespace
@@ -1271,13 +1333,11 @@
\fi}
\def\strc_notes_flush_inserts_normal
- {%\iftrialtypesetting\copy\else\box\fi\currentnoteins
- \strc_notes_flush_global
+ {\strc_notes_flush_global
\obeydepth} % (a) added , since split footnotes will not align properly
\def\strc_notes_flush_inserts_columns
{\startsimplecolumns[\c!distance=\noteparameter\c!columndistance,\c!n=\noteparameter\c!n,\c!width=\noteparameter\c!width]%
- %\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins % compare with local
\strc_notes_flush_global
\stopsimplecolumns}
@@ -1293,18 +1353,15 @@
{\doifelse{\noteparameter\c!paragraph}\v!yes
{\vbox
{\beginofshapebox
- \iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins
+ \iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber
\endofshapebox
- %\doreshapebox{\box\shapebox}{}{}{}% get rid of penalties etc
\let\strc_notes_between_paragraphs_indeed\strc_notes_between_paragraphs_first % shape works reverse
\doreshapebox
{\hbox{\unhbox\shapebox\strc_notes_between_paragraphs_indeed}}
- {}%
- {}%
- {}% get rid of penalties etc
+ \donothing \donothing \donothing % get rid of penalties etc
\innerflushshapebox
\convertvboxtohbox}}
- {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteins}}
+ {\iftrialtypesetting\unvcopied\else\unvboxed\fi\currentnoteinsertionnumber}}
%D Supporting end notes is surprisingly easy. Even better, we
%D can combine this feature with solving the common \TEX\
@@ -1338,21 +1395,21 @@
% we need a proper state: normal, postponing, flushing
-\def\postponenotes
+\unexpanded\def\postponenotes
{\ifconditional\postponingnotes\else
\global\settrue\postponingnotes
\global\let\flushnotes\doflushnotes
- \ctxlua{structures.notes.postpone()}%
+ \ctxcommand{postponenotes()}%
\fi}
\let\flushnotes\relax
-\def\doflushnotes
+\unexpanded\def\doflushnotes
{\ifconditional\postponingnotes
\begingroup
\let\flushnotes \relax
\let\postponenotes\relax
- \ctxlua{structures.notes.flushpostponed()}% this also resets the states !
+ \ctxcommand{flushpostponednotes()}% this also resets the states !
\global\setfalse\postponednote
\global\setfalse\postponingnotes
\global\let\flushnotes\relax
@@ -1382,8 +1439,8 @@
\unexpanded\def\startlocalnotes
{\dosingleempty\strc_notes_local_start}
-\def\strc_notes_local_start[#1]%
- {\def\localnoteslist{#1}%
+\def\strc_notes_local_start[#list]% grouping ? (we used to have a second argument ... settings)
+ {\def\localnoteslist{#list}%
\settrue\inlocalnotes
\processcommacommand[\localnoteslist]\strc_notes_local_start_step}
@@ -1391,29 +1448,35 @@
{\processcommacommand[\localnoteslist]\strc_notes_local_stop_step
\setfalse\inlocalnotes}
-\def\strc_notes_local_start_step#1%
- {\doifnot{\noteparameter\c!continue}\v!yes
- {\strc_counters_save{#1}%
- \strc_counters_reset{#1}}%
- \ctxlua{structures.notes.save("#1","store")}}
+\let\p_strc_notes_continue\empty
-\def\strc_notes_local_stop_step#1%
- {\doifnot{\noteparameter\c!continue}\v!yes
- {\strc_counters_restore{#1}}%
- \ctxlua{structures.notes.restore("#1")}}
+\def\strc_notes_local_start_step#tag%
+ {\p_strc_notes_continue{\noteparameter\c!continue}%
+ \ifx\p_strc_notes_continue\v!yes \else
+ \strc_counters_save{#tag}%
+ \strc_counters_reset{#tag}%
+ \fi
+ \ctxcommand{savenote("#tag","store")}}
+
+\def\strc_notes_local_stop_step#tag%
+ {\p_strc_notes_continue{\noteparameter\c!continue}%
+ \ifx\p_strc_notes_continue\v!yes \else
+ \strc_counters_restore{#tag}%
+ \fi
+ \ctxcommand{restorenote("#tag")}}
\unexpanded\def\placelocalnotes
{\dodoubleempty\strc_notes_local_place}
-\def\strc_notes_local_place[#1][#2]%
- {\doif{\ctxlua{structures.notes.getstate("#1")}}{store}{\strc_notes_local_place_indeed{#2}{#1}}}
+\def\strc_notes_local_place[#tag][#settings]%
+ {\doif{\ctxcommand{getnotestate("#tag")}}{store}{\strc_notes_local_place_indeed{#settings}{#tag}}}
-\def\strc_notes_local_place_indeed#1#2% settings note
+\def\strc_notes_local_place_indeed#settings#tag%
{\begingroup
- \edef\currentnote{#2}% is already set?
+ \edef\currentnote{#tag}% is already set?
\the\everyplacelocalnotes
% beware, we cannot trust setting \currentnote here
- \setupcurrentnote[\c!width=\v!fit,\c!height=\v!fit,\c!strut=\v!no,\c!offset=\v!overlay,#1]% we only need a selective one
+ \setupcurrentnote[#settings]% later we set height etc for framed
\strc_notes_place_local_alternative
\strc_notes_set_properties % restore globals (if needed)
\endgroup
@@ -1460,19 +1523,19 @@
\unexpanded\def\placenotes
{\dodoubleempty\strc_notes_place}
-\def\strc_notes_place[#1][#2]%
- {\processcommalist[#1]{\strc_notes_place_indeed{#2}}}
+\def\strc_notes_place[#list][#settings]%
+ {\processcommalist[#list]{\strc_notes_place_indeed{#settings}}}
-\def\strc_notes_place_indeed#1#2% settings note
- {\edef\currentnote{#2}% grouping ?
- \doifelse{\ctxlua{structures.notes.getstate("#2")}}{store}
+\def\strc_notes_place_indeed#settings#tag% settings note
+ {\edef\currentnote{#tag}% grouping ?
+ \doifelse{\ctxcommand{getnotestate("#tag")}}{store}
\strc_notes_local_place_indeed
\strc_notes_global_place_indeed
- {#1}{#2}}
+ {#settings}{#tag}}
-\def\strc_notes_global_place_indeed#1#2%
+\def\strc_notes_global_place_indeed#settings#tag%
{\begingroup
- \setupnote[#2][#1]%
+ \setupnote[#tag][#settings]%
\strc_notes_place_inserts
\endgroup
\the\everysetupnote} % to be checked .. synchronize
@@ -1481,11 +1544,11 @@
\installcorenamespace{notealternative}
-\unexpanded\def\installnotealternative#1#2%
- {\setvalue{\??notealternative#1}{#2}}
+\unexpanded\def\installnotealternative#alternative#command%
+ {\setvalue{\??notealternative#alternative}{#command}}
-\unexpanded\def\doifnotescollected#1%
- {\ctxlua{structures.notes.doifcontent("#1")}}
+\unexpanded\def\doifnotescollected#tag%
+ {\ctxcommand{doifnotecontent("#tag")}}
\def\strc_notes_place_local_alternative % will be a setup (wrapper)
{\doifnotescollected\currentnote
@@ -1512,8 +1575,7 @@
% setups ?
-% \def\flushlocalnotes#1{\ctxlua{structures.notes.flush("#1","store")}}
-\def\flushlocalnotes#1{\ctxlua{structures.notes.flush("#1","store","\noteparameter\c!criterium")}}
+\def\flushlocalnotes#tag{\ctxcommand{flushnotes("#tag","store","\noteparameter\c!criterium")}}
\installnotealternative \v!none
{\flushlocalnotes\currentnote}
@@ -1569,58 +1631,62 @@
\strc_notes_process\strc_notes_check_presence}
\def\strc_notes_check_presence
- {\ifdim\ht\currentnoteins>\zeropoint
+ {\ifdim\ht\currentnoteinsertionnumber>\zeropoint
\notespresenttrue
\fi}
%D \macros
%D {fakenotes}
- % used in page-mul
+ % used in page-mul
+
+ \ifdefined\currentnofcolumns\else \def\currentnofcolumns{\nofcolumns} \fi
- \ifdefined\currentnofcolumns\else \def\currentnofcolumns{\@@kln} \fi
+ \unexpanded\def\fakenotes
+ {\ifhmode\endgraf\fi\ifvmode
+ \calculatetotalclevernoteheight
+ \ifdim\totalnoteheight>\zeropoint \kern\totalnoteheight \fi
+ \fi}
- \unexpanded\def\fakenotes
- {\ifhmode\endgraf\fi\ifvmode
- \calculatetotalclevernoteheight
- \ifdim\totalnoteheight>\zeropoint \kern\totalnoteheight \fi
- \fi}
+ \unexpanded\def\fakepagenotes
+ {\ifhmode\endgraf\fi\ifvmode
+ \calculatetotalpagenoteheight
+ \ifdim\totalnoteheight>\zeropoint \kern\totalnoteheight \fi
+ \fi}
- \unexpanded\def\fakepagenotes
- {\ifhmode\endgraf\fi\ifvmode
- \calculatetotalpagenoteheight
- \ifdim\totalnoteheight>\zeropoint \kern\totalnoteheight \fi
- \fi}
+ % used in page-not but not yet ok
- \newdimen\totalnoteheight
+ \newdimen\totalnoteheight
- \def\doaddtototalnoteheight#1%
- {\ifdim\ht#1>\zeropoint
- \ifcase\count#1\else
- % todo: divide by count
- \advance\totalnoteheight\ht #1%
- \advance\totalnoteheight\skip#1%
- \fi
- \fi}
+ \unexpanded\def\additionaltotalnoteheight#insert% temp hacks anyway
+ {\dimexpr
+ \ifdim\ht#insert>\zeropoint
+ \ifcase\count#insert %
+ \zeropoint
+ \else % todo: divide by count
+ \ht#insert+\skip#insert% hm, no stretch but a dimen anyway
+ \fi
+ \else
+ \zeropoint
+ \fi
+ \relax}
- \def\docalculatetotalnoteheight
- {\ifcase\c_strc_notes_page_location % tricky here ! ! ! to be sorted out ! ! !
- \doaddtototalnoteheight\currentnoteins
- \else
- % \doaddtototalnoteheight\currentbackupnoteins
- \fi}
+ \def\docalculatetotalnoteheight
+ {\ifcase\c_strc_notes_page_location % tricky here ! ! ! to be sorted out ! ! !
+ \advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\currentnoteinsertionnumber}%
+ \fi}
- \def\docalculatetotalclevernoteheight
- {\ifcase\c_strc_notes_page_location \else % tricky here ! ! ! to be sorted out ! ! !
- \doaddtototalnoteheight\currentnoteins
- \fi}
+ \def\docalculatetotalclevernoteheight
+ {\ifcase\c_strc_notes_page_location \else % tricky here ! ! ! to be sorted out ! ! !
+ \advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\currentnoteinsertionnumber}%
+ \fi}
- \def\docalculatetotalpagenoteheight
- {\doaddtototalnoteheight\currentnoteins}
+ \def\docalculatetotalpagenoteheight
+ {\advance\totalnoteheight\normalexpanded{\additionaltotalnoteheight\currentnoteinsertionnumber}}
- \def\calculatetotalnoteheight {\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalnoteheight}
- \def\calculatetotalclevernoteheight{\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalclevernoteheight}
- \def\calculatetotalpagenoteheight {\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalpagenoteheight}
+ \def\calculatetotalnoteheight {\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalnoteheight}
+ \def\calculatetotalclevernoteheight{\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalclevernoteheight}
+ \def\calculatetotalpagenoteheight {\totalnoteheight\zeropoint\strc_notes_process\docalculatetotalpagenoteheight}
%D Now how can this mechanism be hooked into \CONTEXT\ without
%D explictly postponing footnotes? The solution turned out to
@@ -1644,7 +1710,7 @@
%D \stoptyping
% \def\dosynchronizenotes
-% {\ifvoid\currentnoteins\else\insert\currentnoteins{\unvbox\currentnoteins}\fi}
+% {\ifvoid\currentnoteinsertionnumber\else\insert\currentnoteinsertionnumber{\unvbox\currentnoteinsertionnumber}\fi}
%
% \def\synchronizenotes
% {\strc_notes_process\dosynchronizenotes}
@@ -1679,8 +1745,19 @@
\unexpanded\def\startlocalfootnotes {\startlocalnotes [\v!footnote]} % alleen footnote
\unexpanded\def\stoplocalfootnotes {\stoplocalnotes }
-\def\strc_notes_place_footnotes [#1][#2]{\ifsecondargument\placenotes [#1][#2,\c!height=\textheight]\else\placenotes [#1]\fi}
-\def\strc_notes_place_local_footnotes[#1][#2]{\ifsecondargument\placelocalnotes[#1][#2,\c!height=\textheight]\else\placelocalnotes[#1]\fi}
+\def\strc_notes_place_footnotes[#list][#settings]%
+ {\ifsecondargument
+ \placenotes[#list][#settings,\c!height=\textheight]%
+ \else
+ \placenotes[#list][\c!height=\textheight]%
+ \fi}
+
+\def\strc_notes_place_local_footnotes[#list][#settings]%
+ {\ifsecondargument
+ \placelocalnotes[#list][#settings,\c!height=\textheight]%
+ \else
+ \placelocalnotes[#list][\c!height=\textheight]%
+ \fi}
%D Goodies:
%D
@@ -1690,7 +1767,7 @@
%D }
%D \stoptyping
-\def\doifnoteonsamepageelse[#1]{\ctxlua{structures.notes.doifonsamepageasprevious("#1")}}
+\def\doifnoteonsamepageelse[#tag]{\ctxcommand{doifnoteonsamepageasprevious("#tag")}}
%D New trickery:
@@ -1711,15 +1788,15 @@
\unexpanded\def\notesymbol
{\dodoubleempty\strc_notes_symbol}
-\def\strc_notes_symbol[#1][#2]%
+\def\strc_notes_symbol[#tag][#reference]%
{\dontleavehmode
\begingroup
- \edef\currentnote{#1}%
+ \edef\currentnote{#tag}%
\usenotestyleandcolor\c!textstyle\c!textcolor
\ifnotesenabled
\ifsecondargument
\unskip
- \noteparameter\c!textcommand{\in[#2]}% command here?
+ \noteparameter\c!textcommand{\in[#reference]}% command here?
\else
\noteparameter\c!textcommand\lastnotesymbol % check if command double
\fi
@@ -1729,30 +1806,30 @@
\unexpanded\def\note
{\dodoubleempty\strc_notes_note}
-\def\strc_notes_note[#1][#2]%
+\def\strc_notes_note[#tag][#reference]%
{\ifsecondargument
- \strc_notes_symbol[#1][#2]%
+ \strc_notes_symbol[#tag][#reference]%
\else
\secondargumenttrue
- \strc_notes_symbol[\v!footnote][#1]%
+ \strc_notes_symbol[\v!footnote][#tag]%
\fi}
% will be redone if needed
%
-% \def\ownnotesymbol#1% #1 gets number passed
-% {\executeifdefined{\??notesymbol\currentnote}\empty}
+% \def\ownnotesymbol#1% #1 gets number passed
+% {\executeifdefined{\??notesymbol\currentnote}\empty}
%
-% \unexpanded\def\setnotesymbol[#1]#2#3%
-% {\prewordbreak % prevent lookback
-% \setgvalue{\??notesymbol#1}{#3}
-% \strc_notes_inject_symbol}
+% \unexpanded\def\setnotesymbol[#1]#2#3%
+% {\prewordbreak % prevent lookback
+% \setgvalue{\??notesymbol#1}{#3}
+% \strc_notes_inject_symbol}
%
-% \unexpanded\def\ownnote[#1]#2#3#4%
-% {\setnotesymbol[#1]{#2}{#3}%
-% \setnotetext [#1]{#4}}
+% \unexpanded\def\ownnote[#1]#2#3#4%
+% {\setnotesymbol[#1]{#2}{#3}%
+% \setnotetext [#1]{#4}}
%
-% \defineconversion
-% [ownnote]
-% [\ownnotesymbol]
+% \defineconversion
+% [ownnote]
+% [\ownnotesymbol]
\protect \endinput