summaryrefslogtreecommitdiff
path: root/macros/latex/contrib/enotez
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
committerNorbert Preining <norbert@preining.info>2019-09-02 13:46:59 +0900
commite0c6872cf40896c7be36b11dcc744620f10adf1d (patch)
tree60335e10d2f4354b0674ec22d7b53f0f8abee672 /macros/latex/contrib/enotez
Initial commit
Diffstat (limited to 'macros/latex/contrib/enotez')
-rw-r--r--macros/latex/contrib/enotez/README31
-rw-r--r--macros/latex/contrib/enotez/enotez.sty991
-rw-r--r--macros/latex/contrib/enotez/enotez_en.pdfbin0 -> 458894 bytes
-rw-r--r--macros/latex/contrib/enotez/enotez_en.tex522
-rw-r--r--macros/latex/contrib/enotez/enotez_split_example.tex73
5 files changed, 1617 insertions, 0 deletions
diff --git a/macros/latex/contrib/enotez/README b/macros/latex/contrib/enotez/README
new file mode 100644
index 0000000000..ab82c111eb
--- /dev/null
+++ b/macros/latex/contrib/enotez/README
@@ -0,0 +1,31 @@
+--------------------------------------------------------------------------
+the ENOTEZ package v0.9a
+
+ Endnotes for LaTeX2e
+
+2017/04/24
+--------------------------------------------------------------------------
+Clemens Niederberger
+Web: https://bitbucket.org/cgnieder/enotez/
+E-Mail: contact@mychemistry.eu
+--------------------------------------------------------------------------
+Copyright 2012-2017 Clemens Niederberger
+
+This work may be distributed and/or modified under the
+conditions of the LaTeX Project Public License, either version 1.3
+of this license or (at your option) any later version.
+The latest version of this license is in
+ http://www.latex-project.org/lppl.txt
+and version 1.3 or later is part of all distributions of LaTeX
+version 2005/12/01 or later.
+
+This work has the LPPL maintenance status `maintained'.
+
+The Current Maintainer of this work is Clemens Niederberger.
+--------------------------------------------------------------------------
+The enotez package consists of the files
+ - enotez.sty, enotez_en.tex, enotez_en.pdf, README
+--------------------------------------------------------------------------
+If you have any ideas, questions, suggestions or bugs to report, please
+feel free to contact me.
+--------------------------------------------------------------------------
diff --git a/macros/latex/contrib/enotez/enotez.sty b/macros/latex/contrib/enotez/enotez.sty
new file mode 100644
index 0000000000..ba26561827
--- /dev/null
+++ b/macros/latex/contrib/enotez/enotez.sty
@@ -0,0 +1,991 @@
+% --------------------------------------------------------------------------
+% the ENOTEZ package
+%
+% Endnotes for LaTeX2e
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% Web: https://bitbucket.org/cgnieder/enotez/
+% E-Mail: contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% Copyright 2012-2017 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% --------------------------------------------------------------------------
+% The enotez package consists of the files
+% - enotez.sty, enotez_en.tex, enotez_en.pdf, README
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+\RequirePackage{ expl3 , xparse , l3keys2e , xtemplate , etoolbox , xpatch , scrlfile }
+\ProvidesExplPackage
+ {enotez}
+ {2017/04/24}
+ {0.9a}
+ {Endnotes for LaTeX2e}
+
+% --------------------------------------------------------------------------
+% messages
+% \msg_new:nnnn {enotez} {captions}
+% { Endnotes~might~not~work~in~captions. }
+% {
+% Endnotes~might~not~work~inside~captions.~You~might~try~to~use~the~caption~
+% package~if~you~encounter~problems~but~that's~not~a~promise~that~things~
+% will~work~then.
+% }
+
+\msg_new:nnnn {enotez} {deprecated}
+ { The~#1~`#2'~is~deprecated.~Use~`#3'~instead~\msg_line_context:. }
+ {
+ The~#1~`#2'~you~used~\msg_line_context: \c_space_tl is~deprecated~and~has~
+ been~replaced~by~`#3'.~Since~I~will~not~guarantee~that~#1~will~be~kept~
+ forever~I~encourage~you~to~switch.
+ }
+
+\cs_new:Npn \enotez_option_deprecated:nn #1#2
+ { \msg_warning:nnnnn {enotez} {deprecated} {option} {#1} {#2} }
+
+\cs_new:Npn \enotez_command_deprecated:NN #1#2
+ {
+ \msg_warning:nnnnn {enotez} {deprecated} {command}
+ { \token_to_str:N #1 } { \token_to_str:N #2 }
+ }
+
+% --------------------------------------------------------------------------
+% variants of kernel functions
+\cs_generate_variant:Nn \tl_if_eq:nnTF { Vn , nx }
+\cs_generate_variant:Nn \tl_if_eq:nnT { xx }
+
+% --------------------------------------------------------------------------
+% variables:
+\bool_new:N \l__enotez_print_note_bool
+\bool_new:N \l__enotez_reset_bool
+\bool_new:N \l__enotez_totoc_bool
+\bool_new:N \l__enotez_hyperref_bool
+\bool_new:N \l__enotez_hyperfootnotes_bool
+\bool_new:N \l__enotez_hyperbackref_bool
+\bool_new:N \l__enotez_split_bool
+% \bool_new:N \l__enotez_caption_patched_bool
+% \bool_new:N \l__enotez_koma_patched_bool
+% \bool_new:N \l__enotez_memoir_patched_bool
+\bool_new:N \l__enotez_disable_bool
+
+\tl_new:N \l__enotez_tmpa_tl
+\tl_new:N \l__enotez_tmpb_tl
+\tl_new:N \l__enotez_tmpc_tl
+\tl_new:N \l__enotez_change_tl
+\tl_new:N \l__enotez_totoc_tl
+\tl_new:N \l__enotez_list_name_tl
+\tl_set:Nn \l__enotez_list_name_tl {Notes}
+\tl_new:N \l__enotez_endnote_text_tl
+\tl_new:N \l__enotez_endnote_mark_tl
+\tl_new:N \l__enotez_list_instance_tl
+\tl_set:Nn \l__enotez_list_instance_tl {plain}
+\tl_new:N \l__enotez_split_tl
+\tl_new:N \l__enotez_splitted_list_sectioning_tl
+\tl_new:N \l__enotez_splitted_title_tl
+\tl_set:Nn \l__enotez_splitted_title_tl {Notes~for~<name>~<ref>}
+\tl_new:N \l__enotez_section_tl
+\tl_set:Nn \l__enotez_section_tl {section}
+\tl_new:N \l__enotez_chapter_tl
+\tl_set:Nn \l__enotez_chapter_tl {chapter}
+\tl_new:N \g__enotez_actual_sectioning_tl
+\tl_new:N \l__enotez_list_splitted_title_tl
+\tl_new:N \g__enotez_list_next_preamble_tl
+\tl_new:N \g__enotez_list_every_preamble_tl
+\tl_new:N \g__enotez_list_next_postamble_tl
+\tl_new:N \g__enotez_list_every_postamble_tl
+\tl_new:N \g__enotez_split_list_preamble_tl
+\tl_new:N \g__enotez_split_list_postamble_tl
+\tl_new:N \l__enotez_footnotes_tl
+
+\skip_new:N \l__enotez_list_preamble_skip
+\skip_new:N \l__enotez_list_postamble_skip
+\skip_set_eq:NN \l__enotez_list_preamble_skip \medskipamount
+\skip_set_eq:NN \l__enotez_list_postamble_skip \medskipamount
+
+\int_new:N \g__enotez_endnote_id_int
+\int_zero:N \g__enotez_endnote_id_int
+\int_new:N \g__enotez_endnote_mark_int
+\int_zero:N \g__enotez_endnote_mark_int
+\newcounter {endnote}
+\int_new:N \g__enotez_list_printed_int
+\int_zero:N \g__enotez_list_printed_int
+\int_new:N \l__enotez_tmpa_int
+
+\prop_new:N \g__enotez_endnote_text_prop
+\prop_new:N \g__enotez_endnote_mark_prop
+\prop_new:N \g__enotez_endnote_split_prop
+\prop_new:N \g__enotez_endnote_sect_prop
+\prop_new:N \g__enotez_endnote_sect_id_prop
+\prop_new:N \g__enotez_endnote_man_prop
+
+\cs_new_protected:Npn \enotez_nobreak: { \tex_penalty:D \c_ten_thousand }
+
+% --------------------------------------------------------------------------
+% options:
+\keys_define:nn {enotez}
+ {
+ backref .bool_set:N = \l__enotez_hyperbackref_bool ,
+ footnotes .bool_set:N = \l__enotez_footnotes_tl ,
+ list-name .tl_set:N = \l__enotez_list_name_tl ,
+ reset .bool_set:N = \l__enotez_reset_bool ,
+ % TODO: add symbols and other possible formats, use cntformats?
+ counter-format .choice: ,
+ counter-format / arabic .code:n = \cs_set:Npn \theendnote {\arabic{endnote}} ,
+ counter-format / alph .code:n = \cs_set:Npn \theendnote {\alph{endnote}} ,
+ counter-format / Alph .code:n = \cs_set:Npn \theendnote {\Alph{endnote}} ,
+ counter-format / roman .code:n = \cs_set:Npn \theendnote {\roman{endnote}} ,
+ counter-format / Roman .code:n = \cs_set:Npn \theendnote {\Roman{endnote}} ,
+ counter-format / symbols .code:n = \cs_set:Npn \theendnote {\fnsymbol{endnote}} ,
+ mark-format .code:n = \cs_set:Npn \enmarkstyle {#1} ,
+ mark-cs .code:n = \cs_set:Npn \enotezwritemark {#1} ,
+ totoc .choices:nn =
+ { section , chapter , false }
+ {
+ \tl_if_eq:VnTF \l_keys_choice_tl { false }
+ { \bool_set_false:N \l__enotez_totoc_bool }
+ {
+ \bool_set_true:N \l__enotez_totoc_bool
+ \tl_set_eq:NN \l__enotez_totoc_tl \l_keys_choice_tl
+ }
+ } ,
+ list-heading .code:n =
+ \cs_set:Npn \enotezlistheading ##1 {#1} ,
+ split .choices:nn =
+ { section , chapter , false }
+ {
+ \tl_if_eq:VnTF \l_keys_choice_tl { false }
+ { \bool_set_false:N \l__enotez_split_bool }
+ { \bool_set_true:N \l__enotez_split_bool }
+ \tl_set_eq:NN \l__enotez_split_tl \l_keys_choice_tl
+ } ,
+ split-sectioning .code:n =
+ \enotez_option_deprecated:nn { split-sectioning } { split-heading }
+ \cs_set:Npn \enotezsplitlistheading ##1 {#1}
+ \bool_set_true:N \l__enotez_splitted_list_heading_bool ,
+ split-heading .code:n =
+ \cs_set:Npn \enotezsplitlistheading ##1 {#1}
+ \bool_set_true:N \l__enotez_splitted_list_heading_bool ,
+ split-title .tl_set:N = \l__enotez_splitted_title_tl ,
+ list-style .tl_set:N = \l__enotez_list_instance_tl ,
+ list-preamble-skip .skip_set:N = \l__enotez_list_preamble_skip ,
+ list-postamble-skip .skip_set:N = \l__enotez_list_postamble_skip
+ }
+
+% --------------------------------------------------------------------------
+% typeset the actual mark:
+% #1: id
+% #2: mark
+\cs_new_protected:Npn \enotez_write_mark:nn #1#2
+ {
+ \bool_if:NTF \l__enotez_hyperfootnotes_bool
+ {
+ \enotezwritemark { \hyperlink {enz.#1} { \enmarkstyle #2 } }
+ \bool_if:NT \l__enotez_hyperbackref_bool
+ {
+ \box_move_up:nn {1em}
+ { \hbox:n { \hypertarget {enz.#1.backref} { } } }
+ }
+ }
+ { \enotezwritemark { \enmarkstyle #2 } }
+ }
+\cs_generate_variant:Nn \enotez_write_mark:nn {x}
+
+% the internal endnote:
+\cs_new_protected:Npn \enotez_endnote:nn #1#2
+ {
+ \enotez_endnote_mark:n {#1}
+ \enotez_endnote_text:nn {#1} {#2}
+ }
+
+\cs_new_protected:Npn \enotez_endnote_mark:n #1
+ {
+ \int_gincr:N \g__enotez_endnote_id_int
+ \quark_if_no_value:nTF {#1}
+ {
+ \stepcounter {endnote}% problem with option `reset'
+ % \show \theendnote
+ \cs_gset:cpx {@currentlabel} {\theendnote}
+ \enotez_write_mark:xn
+ { \int_use:N \g__enotez_endnote_id_int }
+ { \theendnote }
+ }
+ {
+ \cs_gset:cpn {@currentlabel} {#1}
+ % \cs_gset_eq:NN \theendnote \@currentlabel
+ \enotez_write_mark:xn { \int_use:N \g__enotez_endnote_id_int } {#1}
+ }
+ \bool_if:NT \l__enotez_disable_bool
+ {
+ \int_gdecr:N \g__enotez_endnote_id_int
+ \addtocounter {endnote} {-1}
+ }
+ }
+
+\cs_new_protected:Npn \enotez_disable:
+ { \bool_set_true:N \l__enotez_disable_bool }
+
+\NewDocumentCommand \enotezdisable {} { \enotez_disable: }
+
+\cs_new_protected:Npn \enotez_endnote_text:nn #1#2
+ {
+ \tl_set:Nn \l__enotez_tmpa_tl {chapter}
+ \quark_if_no_value:nTF {#1}
+ {
+ \bool_if:nTF
+ {
+ \l__enotez_split_bool
+ &&
+ \tl_if_eq_p:NN \l__enotez_split_tl \l__enotez_tmpa_tl
+ }
+ {
+ \enotez_save_note:xxxxxnn
+ { \int_use:N \g__enotez_endnote_id_int }
+ { \theendnote }
+ % { \int_use:N \g__enotez_endnote_mark_int }
+ { \int_use:N \g__enotez_list_printed_int }
+ { \thechapter }
+ { \int_eval:n { \value{chapter} } }
+ { a }
+ {#2}
+ }
+ {
+ \enotez_save_note:xxxxxnn
+ { \int_use:N \g__enotez_endnote_id_int }
+ { \theendnote }
+ % { \int_use:N \g__enotez_endnote_mark_int }
+ { \int_use:N \g__enotez_list_printed_int }
+ { \thesection }
+ { \int_eval:n { \value{section} } }
+ {a }
+ {#2}
+ }
+ }
+ {
+ \bool_if:nTF
+ {
+ \l__enotez_split_bool
+ &&
+ \tl_if_eq_p:NN \l__enotez_split_tl \l__enotez_tmpa_tl
+ }
+ {
+ \enotez_save_note:xnxxxnn
+ { \int_use:N \g__enotez_endnote_id_int }
+ {#1}
+ { \int_use:N \g__enotez_list_printed_int }
+ { \thechapter }
+ { \int_eval:n { \value{chapter} } }
+ { m }
+ {#2}
+ }
+ {
+ \enotez_save_note:xnxxxnn
+ { \int_use:N \g__enotez_endnote_id_int }
+ {#1}
+ { \int_use:N \g__enotez_list_printed_int }
+ { \thesection }
+ { \int_eval:n { \value{section} } }
+ { m }
+ {#2}
+ }
+ }
+ }
+
+% --------------------------------------------------------------------------
+% save the notes to the aux file:
+% #1: global id
+% #2: mark
+% #3: split id
+% #4: \thesection / \thechapter
+% #5: \value{section} / \value{chapter}
+% #6: a/m (automatic/manually)
+% #7: text
+\cs_new_protected:Npn \enotez_save_note:nnnnnnn #1#2#3#4#5#6#7
+ { \iow_now:Nn \@auxout { \enotez@note {#1} {#2} {#3} {#4} {#5} {#6} {#7} } }
+\cs_generate_variant:Nn \enotez_save_note:nnnnnnn { xxxxx , xnxxx }
+
+\cs_new_protected:Npn \enotez@note #1#2#3#4#5#6#7
+ {
+ \tl_gset:cn {enotez@#1@note} {#2}
+ \prop_gput:Nnn \g__enotez_endnote_mark_prop {#1} {#2}
+ \prop_gput:Nnn \g__enotez_endnote_split_prop {#1} {#3}
+ \prop_gput:Nnn \g__enotez_endnote_sect_prop {#1} {#4}
+ \prop_gput:Nnn \g__enotez_endnote_sect_id_prop {#1} {#5}
+ \prop_gput:Nnn \g__enotez_endnote_man_prop {#1} {#6}
+ \prop_gput:Nnn \g__enotez_endnote_text_prop {#1} {#7}
+ }
+
+% a try to check if a rerun is necessary:
+\AtEndDocument
+ {
+ \cs_set_protected:Npn \enotez@note #1#2#3#4#5#6#7
+ {
+ \tl_set:Nn \l__enotez_change_tl {#2}
+ \tl_if_eq:cNF {enotez@#1@note} \l__enotez_change_tl
+ {
+ \@latex@warning@no@line
+ { Endnotes~may~have~changed.~Rerun~to~get~them~right. }
+ }
+ }
+ }
+
+% --------------------------------------------------------------------------
+% the actual user command; I would use \NewDocumentCommand but that would
+% disable compatibility with `fnpct'
+\cs_new_protected:Npn \endnote
+ {
+ \enotez_nobreak:
+ \peek_meaning_ignore_spaces:NTF [
+ { \enotez_endnote_aux:w }
+ { \enotez_endnote:nn { \q_no_value } }
+ }
+
+\cs_new:Npn \enotez_endnote_aux:w [#1]#2
+ { \enotez_endnote:nn {#1} {#2} }
+
+\cs_new_protected:Npn \endnotemark
+ {
+ \peek_meaning_ignore_spaces:NTF [
+ { \enotez_endnote_mark_aux:w }
+ { \enotez_endnote_mark:n { \q_no_value } }
+ }
+
+\cs_new:Npn \enotez_endnote_mark_aux:w [#1]
+ { \enotez_endnote_mark:n {#1} }
+
+\cs_new_protected:Npn \endnotetext
+ {
+ \peek_meaning_ignore_spaces:NTF [
+ { \enotez_endnote_text_aux:w }
+ { \enotez_endnote_text:nn { \q_no_value } }
+ }
+
+\cs_new:Npn \enotez_endnote_text_aux:w [#1]#2
+ { \enotez_endnote_text:nn {#1} {#2} }
+
+% --------------------------------------------------------------------------
+% the list of notes
+\cs_if_exist:cTF { chapter }
+ { \cs_new:Npn \enotezlistheading { \chapter* } }
+ { \cs_new:Npn \enotezlistheading { \section* } }
+
+\tl_new:N \enotezsplitlistheading
+\bool_new:N \l__enotez_splitted_list_heading_bool
+% \cs_new:Npn \enotezsplitlistheading
+% { \use:c { \l__enotez_splitted_list_sectioning_tl } }
+
+\DeclareObjectType {enotez-list} {1}
+
+\DeclareTemplateInterface {enotez-list} {paragraph} {1}
+ {
+ heading : function 1 = \enotezlistheading{#1} ,
+ format : tokenlist = \footnotesize ,
+ number : function 1 = \enmark{#1} ,
+ number-format : tokenlist = \normalfont ,
+ notes-sep : length = .5\baselineskip ,
+ }
+
+\DeclareTemplateCode {enotez-list} {paragraph} {1}
+ {
+ heading = \enotez_list_heading:n ,
+ format = \l__enotez_list_format_tl ,
+ number = \enotez_list_number:n ,
+ number-format = \l__enotez_list_number_format_tl ,
+ notes-sep = \l__enotez_list_notes_sep_dim ,
+ }
+ {
+ \AssignTemplateKeys
+ \bool_if:NT \l__enotez_totoc_bool
+ {
+ \bool_if:NT \l__enotez_hyperref_bool { \phantomsection }
+ \addcontentsline {toc} { \l__enotez_totoc_tl } { \l__enotez_list_name_tl }
+ }
+ \enotez_list_heading:n { \l__enotez_list_name_tl }
+ \enotez_list_preamble:
+ \int_zero:N \l__enotez_tmpa_int
+ \int_do_while:nn { \l__enotez_tmpa_int <= \g__enotez_list_printed_int }
+ {
+ \prop_map_inline:Nn \g__enotez_endnote_mark_prop
+ {
+ \tl_if_eq:xxT
+ { \int_use:N \l__enotez_tmpa_int }
+ { \prop_item:Nn \g__enotez_endnote_split_prop { ##1 } }
+ {
+ \enotez_get_split_title:n { ##1 }
+ \enotez_get_note:nn {#1} { ##1 }
+ \bool_if:NT \l__enotez_print_note_bool
+ {
+ \par\noindent
+ \group_begin:
+ \tl_use:N \l__enotez_list_format_tl
+ \llap
+ {
+ \enotez_list_number:n
+ { \enotez_write_list_number:n { ##1 } }
+ \tl_use:N \c_space_tl
+ }
+ \tl_use:N \l__enotez_endnote_text_tl
+ \par
+ \group_end:
+ }
+ }
+ \par
+ \dim_compare:nT { \l__enotez_list_notes_sep_dim != 0pt }
+ { \addvspace { \l__enotez_list_notes_sep_dim } }
+ }
+ \int_incr:N \l__enotez_tmpa_int
+ }
+ \enotez_list_postamble:
+ }
+
+\DeclareTemplateInterface {enotez-list} {list} {1}
+ {
+ heading : function 1 = \enotezlistheading{#1} ,
+ format : tokenlist = \footnotesize ,
+ number : function 1 = \enmark{#1} ,
+ number-format : tokenlist = \normalfont ,
+ list-type : tokenlist = description ,
+ }
+
+\DeclareTemplateCode {enotez-list} {list} {1}
+ {
+ heading = \enotez_list_heading:n ,
+ format = \l__enotez_list_format_tl ,
+ number = \enotez_list_number:n ,
+ number-format = \l__enotez_list_number_format_tl ,
+ list-type = \l__enotez_list_type_tl
+ }
+ {
+ \AssignTemplateKeys
+ \bool_if:NT \l__enotez_totoc_bool
+ {
+ \bool_if:NT \l__enotez_hyperref_bool { \phantomsection }
+ \addcontentsline { toc } { \l__enotez_totoc_tl } { \l__enotez_list_name_tl }
+ }
+ \enotez_list_heading:n { \l__enotez_list_name_tl }
+ \enotez_list_preamble:
+ \int_zero:N \l__enotez_tmpa_int
+ \int_do_while:nn { \l__enotez_tmpa_int <= \g__enotez_list_printed_int }
+ {
+ \prop_map_inline:Nn \g__enotez_endnote_mark_prop
+ {
+ \tl_clear:N \l__enotez_tmpc_tl
+ \tl_if_eq:xxT
+ { \int_use:N \l__enotez_tmpa_int }
+ { \prop_item:Nn \g__enotez_endnote_split_prop { ##1 } }
+ { \tl_put_right:Nn \l__enotez_tmpc_tl { ##1 } }
+ \tl_if_blank:VF \l__enotez_tmpc_tl
+ {
+ \enotez_get_split_title:n { ##1 }
+ \group_begin:
+ \tl_use:N \l__enotez_list_format_tl
+ \begin{\l__enotez_list_type_tl}
+ }
+ \tl_if_eq:xxT
+ { \int_use:N \l__enotez_tmpa_int }
+ { \prop_item:Nn \g__enotez_endnote_split_prop { ##1 } }
+ {
+ \enotez_get_note:nn {#1} { ##1 }
+ \bool_if:NT \l__enotez_print_note_bool
+ {
+ \item
+ [
+ \enotez_list_number:n
+ { \enotez_write_list_number:n { ##1 } }
+ ]
+ \tl_use:N \l__enotez_endnote_text_tl
+ }
+ }
+ \tl_if_blank:VF \l__enotez_tmpc_tl
+ { \end{\l__enotez_list_type_tl} \group_end: }
+ }
+ \int_incr:N \l__enotez_tmpa_int
+ }
+ \enotez_list_postamble:
+ }
+
+% some default styles:
+\DeclareInstance {enotez-list} {plain} {paragraph } { }
+\DeclareInstance {enotez-list} {description} {list} { }
+\DeclareInstance {enotez-list} {itemize} {list} { list-type = itemize }
+
+% --------------------------------------------------------------------------
+% write the mark in the lists:
+\cs_new_protected:Npn \enotez_write_list_number:n #1
+ {
+ \bool_if:NT \l__enotez_hyperfootnotes_bool
+ { \box_move_up:nn {1em} { \hbox:n { \hypertarget {enz.#1} { } } } }
+ \tl_use:N \l__enotez_list_number_format_tl
+ \tl_if_eq:nxTF {a}
+ { \prop_item:Nn \g__enotez_endnote_man_prop {#1} }
+ {
+ \bool_if:nTF
+ { \l__enotez_hyperfootnotes_bool && \l__enotez_hyperbackref_bool }
+ {
+ \exp_args:Nnx
+ \hyperlink {enz.#1.backref}
+ { \exp_not:V \l__enotez_endnote_mark_tl }
+ }
+ { \prop_item:Nn \g__enotez_endnote_mark_prop {#1} }
+ }
+ {
+ \bool_if:nTF
+ { \l__enotez_hyperfootnotes_bool && \l__enotez_hyperbackref_bool }
+ {
+ \exp_args:Nnx
+ \hyperlink {enz.#1.backref}
+ { \exp_not:V \l__enotez_endnote_mark_tl }
+ }
+ { \tl_use:N \l__enotez_endnote_mark_tl }
+ }
+ }
+
+% --------------------------------------------------------------------------
+% determine which note's next:
+\cs_new_protected:Npn \enotez_get_note:nn #1#2
+ {
+ \bool_if:nTF {#1}
+ {
+ \prop_get:NnN \g__enotez_endnote_mark_prop {#2} \l__enotez_endnote_mark_tl
+ \prop_get:NnN \g__enotez_endnote_text_prop {#2} \l__enotez_endnote_text_tl
+ \bool_set_true:N \l__enotez_print_note_bool
+ }
+ {
+ \prop_get:NnN \g__enotez_endnote_split_prop {#2} \l__enotez_tmpa_tl
+ \bool_if:NTF \l__enotez_split_bool
+ {
+ \bool_set_true:N \l__enotez_print_note_bool
+ \tl_set:Nx \l__enotez_endnote_mark_tl
+ { \prop_item:Nn \g__enotez_endnote_mark_prop {#2} }
+ \tl_set:Nx \l__enotez_endnote_text_tl
+ { \prop_item:Nn \g__enotez_endnote_text_prop {#2} }
+ % \prop_gpop:NnN \g__enotez_endnote_mark_prop
+ % {#2}
+ % \l__enotez_endnote_mark_tl
+ % \prop_gpop:NnN \g__enotez_endnote_text_prop
+ % {#2}
+ % \l__enotez_endnote_text_tl
+ }
+ {
+ \int_compare:nTF { \l__enotez_tmpa_tl = \g__enotez_list_printed_int }
+ {
+ \bool_set_true:N \l__enotez_print_note_bool
+ \tl_set:Nx \l__enotez_endnote_mark_tl
+ { \prop_item:Nn \g__enotez_endnote_mark_prop {#2} }
+ \tl_set:Nx \l__enotez_endnote_text_tl
+ { \prop_item:Nn \g__enotez_endnote_text_prop {#2} }
+ % \prop_gpop:NnN \g__enotez_endnote_mark_prop
+ % {#2}
+ % \l__enotez_endnote_mark_tl
+ % \prop_gpop:NnN \g__enotez_endnote_text_prop
+ % {#2}
+ % \l__enotez_endnote_text_tl
+ \prop_gremove:Nn \g__enotez_endnote_split_prop {#2}
+ }
+ { \bool_set_false:N \l__enotez_print_note_bool }
+ }
+ }
+ }
+
+% --------------------------------------------------------------------------
+% the titles in between the splits:
+\prop_new:N \l__enotez_split_title_replacements_prop
+
+\cs_new:Npn \enotez_new_split_title_replacements:nn #1#2
+ { \prop_put:Nnn \l__enotez_split_title_replacements_prop {<#1>} {#2} }
+
+\NewDocumentCommand \NewSplitTitleTag {mm}
+ { \enotez_new_split_title_replacements:nn {#1} {#2} }
+
+\tl_new:N \l__enotez_replace_split_title_tag_tl
+% #1: tl var
+% #2: tag
+% #3: replacement
+\cs_new_protected:Npn \__enotez_replace_split_title_tag:Nnn #1#2#3
+ {
+ \tl_set:Nx \l__enotez_replace_split_title_tag_tl { \tl_to_str:n {<#2>} }
+ \tl_replace_all:NVn #1 \l__enotez_replace_split_title_tag_tl {#3}
+ \tl_set:Nx #1 { \tl_to_str:N #1 }
+ }
+\cs_generate_variant:Nn \tl_replace_all:Nnn { NV }
+\cs_generate_variant:Nn \__enotez_replace_split_title_tag:Nnn { NnV , Nnx }
+
+% #1: tl for current title
+% #2: title with tags
+% #3: id
+\cs_new_protected:Npn \enotez_read_splitted_title:Nnn #1#2#3
+ {
+ \group_begin:
+ % needs to be expanded, since it is \GetTranslation {...} :
+ \tl_set:Nf \l__enotez_tmpa_tl {#2}
+ % stringify:
+ \tl_set:Nx \l__enotez_tmpa_tl { \tl_to_str:N \l__enotez_tmpa_tl }
+ \prop_map_inline:Nn \l__enotez_split_title_replacements_prop
+ {
+ \tl_set:Nn \l__enotez_tmpb_tl {##1}
+ \tl_replace_all:NVn \l__enotez_tmpa_tl \l__enotez_tmpb_tl {##2}
+ }
+ \__enotez_replace_split_title_tag:NnV \l__enotez_tmpa_tl {name}
+ \g__enotez_actual_sectioning_tl
+ \__enotez_replace_split_title_tag:Nnx \l__enotez_tmpa_tl {ref}
+ { \prop_item:Nn \g__enotez_endnote_sect_prop {#3} }
+ \__enotez_replace_split_title_tag:Nnx \l__enotez_tmpa_tl {split-level-id}
+ { \prop_item:Nn \g__enotez_endnote_sect_id_prop {#3} }
+ % retokenize:
+ \tl_set_rescan:NnV \l__enotez_tmpa_tl { } \l__enotez_tmpa_tl
+ \tl_gset_eq:NN #1 \l__enotez_tmpa_tl
+ \group_end:
+ }
+\cs_generate_variant:Nn \enotez_read_splitted_title:Nnn { NV }
+\cs_generate_variant:Nn \tl_replace_all:Nnn { NVx }
+\cs_generate_variant:Nn \tl_set_rescan:Nnn { NnV }
+
+\cs_new_protected:Npn \enotez_first_upper:n #1
+ { \tl_upper_case:n { \tl_head:n {#1} } \tl_tail:n {#1} }
+\cs_generate_variant:Nn \enotez_first_upper:n { V }
+
+\tl_new:N \l__enotez_last_split_id_tl
+
+\cs_new_protected:Npn \enotez_get_split_title:n #1
+ {
+ \prop_get:NnN \g__enotez_endnote_split_prop {#1} \l__enotez_tmpa_tl
+ \bool_if:NT \l__enotez_split_bool
+ {
+ \tl_if_eq:NNF \l__enotez_tmpa_tl \l__enotez_last_split_id_tl
+ {
+ \tl_if_eq:VnTF \l__enotez_split_tl { section }
+ { \tl_gset:Nf \g__enotez_actual_sectioning_tl { \l__enotez_section_tl } }
+ { \tl_gset:Nf \g__enotez_actual_sectioning_tl { \l__enotez_chapter_tl } }
+ \enotez_read_splitted_title:NVn
+ \EnotezCurrentSplitTitle
+ \l__enotez_splitted_title_tl
+ {#1}
+ \enotez_split_list_preamble:
+ \bool_if:NTF \l__enotez_splitted_list_heading_bool
+ { \exp_args:No \enotezsplitlistheading }
+ {
+ \tl_if_eq:VnTF \l__enotez_split_tl { section }
+ { \exp_args:NNo \subsection* }
+ { \exp_args:NNo \section* }
+ }
+ { \EnotezCurrentSplitTitle }% this is the argument to the sectioning command
+ \enotez_split_list_postamble:
+ }
+ }
+ \prop_get:NnN \g__enotez_endnote_split_prop {#1} \l__enotez_last_split_id_tl
+ }
+
+% --------------------------------------------------------------------------
+% the marks in the list:
+\cs_new:Npn \enmark #1 { #1 . }
+
+% the marks in the text:
+\cs_new:Npn \enmarkstyle { }
+\cs_new_eq:NN \enotezwritemark \textsuperscript
+
+% --------------------------------------------------------------------------
+% internal printendnotes:
+\cs_new_protected:Npn \enotez_print_endnotes:nn #1#2
+ {
+ \enotez_if_endnotes:T
+ {
+ \tl_if_blank:nTF {#2}
+ { \UseInstance {enotez-list} { \l__enotez_list_instance_tl } }
+ { \UseInstance {enotez-list} {#2} }
+ {#1}
+ \bool_if:NF \l__enotez_split_bool
+ {
+ \bool_if:NT \l__enotez_reset_bool
+ {
+ \setcounter {endnote} {0}
+ % \int_gzero:N \g__enotez_endnote_mark_int
+ }
+ \int_gincr:N \g__enotez_list_printed_int
+ }
+ }
+ }
+
+\prg_new_conditional:Npnn \enotez_if_endnotes: {p,T,F,TF}
+ {
+ \int_compare:nTF { \value {endnote} > 0 }
+ { \prg_return_true: }
+ { \prg_return_false: }
+ }
+
+% the user command:
+\NewDocumentCommand \printendnotes { so }
+ {
+ \IfNoValueTF {#2}
+ {
+ \bool_if:NTF \l__enotez_split_bool
+ { \enotez_print_endnotes:nn { \BooleanFalse } { } }
+ { \enotez_print_endnotes:nn {#1} { } }
+ }
+ {
+ \bool_if:NTF \l__enotez_split_bool
+ { \enotez_print_endnotes:nn { \BooleanFalse } {#2} }
+ { \enotez_print_endnotes:nn {#1} {#2} }
+ }
+ }
+
+% --------------------------------------------------------------------------
+% preamble and postamble to the list:
+\cs_new_protected:Npn \enotez_list_preamble:
+ {
+ \tl_if_empty:NTF \g__enotez_list_next_preamble_tl
+ {
+ \tl_if_empty:NF \g__enotez_list_every_preamble_tl
+ {
+ \tl_use:N \g__enotez_list_every_preamble_tl
+ \par
+ \skip_vertical:N \l__enotez_list_preamble_skip
+ }
+ }
+ {
+ \tl_use:N \g__enotez_list_next_preamble_tl
+ \par
+ \skip_vertical:N \l__enotez_list_preamble_skip
+ }
+ \tl_gclear:N \g__enotez_list_next_preamble_tl
+ }
+
+\cs_new_protected:Npn \enotez_list_postamble:
+ {
+ \tl_if_empty:NTF \g__enotez_list_next_postamble_tl
+ {
+ \tl_if_empty:NF \g__enotez_list_every_postamble_tl
+ {
+ \par
+ \skip_vertical:N \l__enotez_list_postamble_skip
+ \tl_use:N \g__enotez_list_every_postamble_tl
+ }
+ }
+ {
+ \par
+ \skip_vertical:N \l__enotez_list_postamble_skip
+ \tl_use:N \g__enotez_list_next_postamble_tl
+ }
+ \tl_gclear:N \g__enotez_list_next_postamble_tl
+ }
+
+\cs_new_protected:Npn \enotez_set_next_preamble:n #1
+ { \tl_gset:Nn \g__enotez_list_next_preamble_tl {#1} }
+
+\cs_new_protected:Npn \enotez_set_every_preamble:n #1
+ { \tl_gset:Nn \g__enotez_list_every_preamble_tl {#1} }
+
+\cs_new_protected:Npn \enotez_set_next_postamble:n #1
+ { \tl_gset:Nn \g__enotez_list_next_postamble_tl {#1} }
+
+\cs_new_protected:Npn \enotez_set_every_postamble:n #1
+ { \tl_gset:Nn \g__enotez_list_every_postamble_tl {#1} }
+
+\NewDocumentCommand \AtNextEndnotesList {+m}
+ { \enotez_set_next_preamble:n {#1} }
+
+\NewDocumentCommand \AtEveryEndnotesList {+m}
+ { \enotez_set_every_preamble:n {#1} }
+
+\NewDocumentCommand \AfterNextEndnotesList {+m}
+ { \enotez_set_next_postamble:n {#1} }
+
+\NewDocumentCommand \AfterEveryEndnotesList {+m}
+ { \enotez_set_every_postamble:n {#1} }
+
+% --------------------------------------------------------------------------
+% preamble and postamble to the sub-headings in a splitted list:
+\cs_new_protected:Npn \enotez_split_list_preamble:
+ {
+ \tl_if_empty:NF \g__enotez_split_list_preamble_tl
+ {
+ \par
+ \tl_use:N \g__enotez_split_list_preamble_tl
+ }
+ }
+
+\cs_new_protected:Npn \enotez_split_list_postamble:
+ {
+ \tl_if_empty:NF \g__enotez_split_list_postamble_tl
+ {
+ \tl_use:N \g__enotez_split_list_postamble_tl
+ \par
+ }
+ }
+
+\cs_new_protected:Npn \enotez_set_every_split_preamble:n #1
+ { \tl_gset:Nn \g__enotez_split_list_preamble_tl {#1} }
+
+\cs_new_protected:Npn \enotez_set_every_split_postamble:n #1
+ { \tl_gset:Nn \g__enotez_split_list_postamble_tl {#1} }
+
+\NewDocumentCommand \AtEveryListSplit {+m}
+ { \enotez_set_every_split_preamble:n {#1} }
+
+\NewDocumentCommand \AfterEveryListSplit {+m}
+ { \enotez_set_every_split_postamble:n {#1} }
+
+\cs_new:Npn \EnotezCurrentSplitTitle {}
+
+% --------------------------------------------------------------------------
+% process the options:
+\ProcessKeysOptions {enotez}
+
+\AtBeginDocument
+ {
+ \bool_if:NT \l__enotez_split_bool
+ {
+ \tl_if_eq:VnTF \l__enotez_split_tl {section}
+ {
+ \tl_put_left:Nn \section
+ {
+ \int_gincr:N \g__enotez_list_printed_int
+ \bool_if:NT \l__enotez_reset_bool
+ {
+ \setcounter {endnote} {0}
+ % \int_gzero:N \g__enotez_endnote_mark_int
+ }
+ }
+ }
+ {
+ \tl_put_left:Nn \chapter
+ {
+ \int_gincr:N \g__enotez_list_printed_int
+ \bool_if:NT \l__enotez_reset_bool
+ {
+ \setcounter {endnote} {0}
+ % \int_gzero:N \g__enotez_endnote_mark_int
+ }
+ }
+ }
+ }
+ \@ifpackageloaded {hyperref}
+ {
+ \bool_set_true:N \l__enotez_hyperref_bool
+ \ifHy@hyperfootnotes
+ \bool_set_true:N \l__enotez_hyperfootnotes_bool
+ \else
+ \bool_set_false:N \l__enotez_hyperfootnotes_bool
+ \fi
+ }
+ {
+ \bool_set_false:N \l__enotez_hyperref_bool
+ \bool_set_false:N \l__enotez_hyperfootnotes_bool
+ }
+ }
+
+% --------------------------------------------------------------------------
+% the setup command:
+\NewDocumentCommand \setenotez {m}
+ { \keys_set:nn {enotez} {#1} }
+
+% --------------------------------------------------------------------------
+% language support
+\RequirePackage {translations}
+\DeclareTranslationFallback {enotez-title} {Notes}
+\DeclareTranslation {Catalan} {enotez-title} {Notes}
+\DeclareTranslation {Croatian} {enotez-title} {Bilje\v{s}ke}
+\DeclareTranslation {English} {enotez-title} {Notes}
+\DeclareTranslation {French} {enotez-title} {Remarques}
+\DeclareTranslation {German} {enotez-title} {Anmerkungen}
+\DeclareTranslation {Hungarian} {enotez-title} {Megjegyz\'{e}sek}
+\DeclareTranslation {Italian} {enotez-title} {Note}
+\DeclareTranslation {Spanish} {enotez-title} {Notas}
+\DeclareTranslation {Turkish} {enotez-title} {Notlar}
+
+\DeclareTranslationFallback {enotez-splitted-title} {Notes~for~<name>~<ref>}
+\DeclareTranslation {Catalan} {enotez-splitted-title} {Notes~del~<name>~<ref>}
+\DeclareTranslation {Croatian} {enotez-splitted-title} {Bilje\v{s}ke~uz~<name>~<ref>}
+\DeclareTranslation {English} {enotez-splitted-title} {Notes~for~<name>~<ref>}
+\DeclareTranslation {French} {enotez-splitted-title} {Remarques~aux~<name>~<ref>}
+\DeclareTranslation {German} {enotez-splitted-title} {Anmerkungen~zu~<name>~<ref>}
+\DeclareTranslation {Hungarian} {enotez-splitted-title} {Megjegyz\'{e}sek~a~<ref>.~<name>}
+\DeclareTranslation {Italian} {enotez-splitted-title} {Note~per~il~<name>~<ref>}
+\DeclareTranslation {Spanish} {enotez-splitted-title} {Notas~del~<name>~<ref>}
+\DeclareTranslation {Turkish} {enotez-splitted-title} {<name>~<ref>~notlar}
+
+\DeclareTranslationFallback {enotez-section} {section}
+\DeclareTranslation {Catalan} {enotez-section} {secci\'{o}}
+\DeclareTranslation {Croatian} {enotez-section} {odjeljak}
+\DeclareTranslation {English} {enotez-section} {section}
+\DeclareTranslation {French} {enotez-section} {section}
+\DeclareTranslation {German} {enotez-section} {Abschnitt}
+\DeclareTranslation {Hungarian} {enotez-section} {szakasz}
+\DeclareTranslation {Italian} {enotez-section} {sezione}
+\DeclareTranslation {Spanish} {enotez-section} {secci\'{o}n}
+\DeclareTranslation {Turkish} {enotez-section} {B\"{o}l\"{u}m}
+
+\DeclareTranslationFallback {enotez-chapter} {chapter}
+\DeclareTranslation {Catalan} {enotez-chapter} {cap\'{\i}tol}
+\DeclareTranslation {Croatian} {enotez-chapter} {poglavlje}
+\DeclareTranslation {English} {enotez-chapter} {chapter}
+\DeclareTranslation {French} {enotez-chapter} {chapitre}
+\DeclareTranslation {German} {enotez-chapter} {Kapitel}
+\DeclareTranslation {Hungarian} {enotez-chapter} {fejezet}
+\DeclareTranslation {Italian} {enotez-chapter} {capitolo}
+\DeclareTranslation {Spanish} {enotez-chapter} {cap\'{\i}tulo}
+\DeclareTranslation {Turkish} {enotez-chapter} {B\"{o}l\"{u}m}
+
+\tl_set:Nn \l__enotez_splitted_title_tl { \GetTranslation {enotez-splitted-title} }
+\tl_set:Nn \l__enotez_list_name_tl { \GetTranslation {enotez-title} }
+\tl_set:Nn \l__enotez_section_tl { \GetTranslation {enotez-section} }
+\tl_set:Nn \l__enotez_chapter_tl { \GetTranslation {enotez-chapter} }
+
+\tex_endinput:D
+% --------------------------------------------------------------------------
+% HISTORY:
+2012/07/03 v0.1 - first public version on bitbucket
+2012/07/05 v0.2 - added preliminary `split' option
+ - enable endnotes in captions with KOMA classes, `memoir' and
+ the `caption' package
+2012/07/06 v0.2a - made the splitted list titles customizable
+2012/07/07 v0.3 - list-building rewritten due to a design flaw
+2012/07/24 v0.3a - adapted to deprecated functions in l3kernel and l3packages,
+ removed debugging leftover
+2012/12/14 v0.3b - bug fix: works again when used with a KOMA class and an
+ endnote is used inside a caption
+2012/12/30 v0.4 - new options `mark-cs' and `mark-format', redefinable
+ commands \enmarkstyle and \enotezwritemark
+2012/01/18 v0.4a - added beginnings of internationalization -- this will need
+ help from users speaking the actual languages
+2013/03/12 v0.5 - \AtNextEndnotesList, \AtEveryEndnotesList
+ - use protected internal commands where appropriate
+ - fix wrong endnote marks when used with the `caption'
+ package
+2013/03/18 v0.5a - adapt to deprecated expl3 commands
+2013/04/06 v0.6 - \endnote sets \@currentlabel so endnotes can be referenced
+ with \label{} and \ref{}
+2013/05/01 v0.7 - new option `backref' adds links from the notes in the list
+ back to the notes in the text (needs `hyperref' loaded)
+ - new: \AtEveryListSplit, \AfterEveryListSplit,
+ \EnotezCurrentSplitTitle
+ - new option: `list-heading'
+2013/08/03 v0.7a - corrected bug: `reset=true' now works as it should
+ - added counter-format `symbols'
+2013/10/31 v0.7b - corrected bug: \acro_command_deprecated:NN should of course
+ be \enotez_command_deprecated:NN
+2014/02/04 v0.7c - added a missing \par to the `paragraph' template for the
+ list
+2015/06/24 v0.8 - bug fix in typesetting the split-headings
+ - new command \NewSplitTitleTag
+2015/07/29 v0.8a - adapt to deprecated choice selection in keys
+2016/01/07 v0.8b - \prop_get:Nn => \prop_item:Nn
+2016/11/08 v0.9 - fix issues #6, #7, and #8
+ - remove caption patching and add \endnotemark and \endnotetext
+2017/04/24 v0.9a - fix wrong format of number in list
+
+% --------------------------------------------------------------------------
+% TODO:
+- add \endnotemark and \endnotetext
+- make the headings obey the `totoc' option?
diff --git a/macros/latex/contrib/enotez/enotez_en.pdf b/macros/latex/contrib/enotez/enotez_en.pdf
new file mode 100644
index 0000000000..3ce61bdb72
--- /dev/null
+++ b/macros/latex/contrib/enotez/enotez_en.pdf
Binary files differ
diff --git a/macros/latex/contrib/enotez/enotez_en.tex b/macros/latex/contrib/enotez/enotez_en.tex
new file mode 100644
index 0000000000..85cf03b688
--- /dev/null
+++ b/macros/latex/contrib/enotez/enotez_en.tex
@@ -0,0 +1,522 @@
+% !arara: pdflatex
+% !arara: biber
+% arara: pdflatex
+% arara: pdflatex
+% --------------------------------------------------------------------------
+% the ENOTEZ package
+%
+% Endnotes for LaTeX2e
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% Web: http://www.mychemistry.eu/forums/forum/enotez/
+% E-Mail: contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% Copyright 2012-2017 Clemens Niederberger
+%
+% This work may be distributed and/or modified under the
+% conditions of the LaTeX Project Public License, either version 1.3
+% of this license or (at your option) any later version.
+% The latest version of this license is in
+% http://www.latex-project.org/lppl.txt
+% and version 1.3 or later is part of all distributions of LaTeX
+% version 2005/12/01 or later.
+%
+% This work has the LPPL maintenance status `maintained'.
+%
+% The Current Maintainer of this work is Clemens Niederberger.
+% --------------------------------------------------------------------------
+% The enotez package consists of the files
+% - enotez.sty, enotez_en.tex, enotez_en.pdf, README
+% --------------------------------------------------------------------------
+% If you have any ideas, questions, suggestions or bugs to report, please
+% feel free to contact me.
+% --------------------------------------------------------------------------
+\documentclass[load-preamble+]{cnltx-doc}
+\usepackage[utf8]{inputenc}
+\usepackage{enotez}
+
+\setcnltx{
+ package = enotez ,
+ info = {Endnotes for \LaTeXe} ,
+ authors = Clemens Niederberger ,
+ email = contact@mychemistry.eu ,
+ url = https://bitbucket.org/cgnieder/enotez/ ,
+ pre-output = \setfnpct{dont-mess-around} ,
+ add-cmds = {
+ @endnotemark,
+ endnote ,
+ endnotemark ,
+ endnotetext ,
+ enmark ,
+ enmarkstyle ,
+ enotezwritemark ,
+ NewSplitTitleTag ,
+ printendnotes ,
+ setenotez ,
+ splitendnotes ,
+ theendnote
+ } ,
+ add-silent-cmds = {
+ @currentlabel ,
+ appendix ,
+ cs ,
+ DeclareInstance ,
+ DeclareTemplateInterface ,
+ DeclareTranslation ,
+ kant
+ } ,
+ index-setup = {
+ othercode = \footnotesize ,
+ level = \addsec ,
+ % noclearpage
+ } ,
+ makeindex-setup = {
+ columns = 3 ,
+ columnsep = 1em
+ }
+}
+\setenotez{mark-cs=\textsu,backref}
+\DeclareInstance{enotez-list}{addsec}{paragraph}{heading=\addsec{#1}}
+
+\defbibheading{bibliography}{\addsec{References}}
+
+\usepackage{kantlipsum}
+\usepackage{enumitem}
+
+\begin{document}
+
+\section{Licence and Requirements}
+\license
+
+\enotez\ needs and loads the following packages:
+\bnd{l3kernel}~\cite{bnd:l3kernel}, \pkg{xparse}, \pkg{xtemplate} and
+\pkg{l3keys2e} from the \bnd{l3packages} bundle~\cite{bnd:l3packages},
+\pkg{xpatch}~\cite{pkg:xpatch}, \pkg{scrlfile} from the \KOMAScript\
+bundle~\cite{bnd:koma-script} and \pkg{translations}~\cite{pkg:translations}.
+
+\section{Motivation}
+\enotez\ is a new implementation of endnotes for \LaTeXe\ since the
+\pkg{endnotes} package~\cite{pkg:endnotes} has some deficiencies. Nested
+endnotes, for example, are not supported, neither is
+\pkg{hyperref}~\cite{pkg:hyperref}. The \pkg{sepfootnotes}
+package~\cite{pkg:sepfootnotes} also provides means for endnotes but actually
+has a different purpose: to separate input and usage both of footnotes and
+endnotes. So it might not be the best solution in every case\footnote{You
+ have to write the actual notes in the preamble or a separate file and
+ reference them in the text.}. It also does not allow nested endnotes.
+
+While \enotez\ worked in tests nicely with the
+\cls{memoir}~\cite{cls:memoir} class please keep in mind that
+\cls{memoir} provides its own endnote mechanism.
+
+\enotez\ enables nested endnotes properly and has another mechanism of
+customizing the list of endnotes which is easily extendable. One of the main
+features of \enotez\ is a split list of endnotes in which the notes are
+automatically separated by the sections or chapters they were set in, see
+section~\ref{sec:split} for more information.
+
+As an aside: \enotez\ is nicely compatible with the \pkg{fnpct}
+package~\cite{pkg:fnpct}. Version~0.2j or newer of \pkg{fnpct} automatically
+detects \enotez\ and adapts the \cs{endnote} command.
+
+
+\section{Usage}
+\subsection{Placing the Notes}
+The usage is simple: use \cs{endnote} in the text where you want to place the
+note mark.
+\begin{commands}
+ \command{endnote}[\oarg{mark}\marg{text}]
+ Add an endnote in the text.
+ \command{endnotemark}[\oarg{mark}]
+ \sinceversion{0.9}Add an endnotemark.
+ \command{endnotetext}[\marg{text}]
+ \sinceversion{0.9}Add text to an endnote placed with \cs{endnotemark}.
+\end{commands}
+\begin{example}
+ This is some text.\endnote{With an endnote.}
+\end{example}
+There's not really much more to it. It is possible to add a custom mark by
+using the optional argument but that shouldn't be needed too often.
+% \cs{endnote} works fine inside tables, minipages, floats and
+% captions\footnote{This has been tested with the standard classes,
+% \cls{memoir}, and the \cls{KOMA-Script} classes, with and without the
+% \pkg*{caption} package. If you're using another package that redefines
+% \cs*{caption} or are using another class it might not work. Before you
+% place a note in a caption you should re-think the idea anyway.}.
+Endnotes
+can also be nested.
+
+% Since this functionality seemed making a pair
+% \cs{endnotemark}/\cs{endnotetext} superfluous they are \emph{not} defined by
+% \enotez.
+\begin{example}
+ This is some text.\endnote{With another endnote.\endnote{This is a
+ nested\endnote{And another level deeper\ldots} endnote!}}
+ % uses package `kantlipsum' to produce dummy text:
+ Of course you can have several paragraphs\endnote{\kant[1-3]} in an endnote.
+\end{example}
+
+The marks of the endnotes in the running text are printed through the command
+\cs{enotezwritemark} which defaults to \cs*{textsuperscript}. Its argument
+contains the current mark which is preceded by \cs{enmarkstyle}. Both of
+these commands can be redefined of course to adapt to custom settings. This
+can also be done using options, see section~\ref{sec:options}. The mark of
+the endnote that has been set last is stored in % \cs{theendnote} and in
+\verbcode+\@currentlabel+.\sinceversion{0.6}
+
+% This could be used to define a command which writes a mark:
+% \begin{example}
+% % we cannot use \newcommand -- the command starts with \end...
+% \makeatletter
+% \def\endnotemark{\@ifnextchar[{\@endnotemark}{\@endnotemark[\theendnote]}}
+% \def\@endnotemark[#1]{\enotezwritemark{\enmarkstyle#1}}
+% \makeatother
+% Text\endnotemark
+% \end{example}
+% Please note that this definition \emph{does not} step the endnote counter but
+% either refers to the last number (no optional argument) or uses the one
+% provided in the optional argument.
+
+% \makeatletter
+% \def\endnotemark{\@ifnextchar[{\@endnotemark}{\@endnotemark[\theendnote]}}
+% \def\@endnotemark[#1]{\enotezwritemark{\enmarkstyle#1}}
+% \makeatother
+
+Endnotes can also be labelled and later be referred to:
+\begin{example}
+ The next endnote\endnote{This endnote gets a label.}\label{en:test} has
+ the number~\ref{en:test}. Let's now test
+ \cs{endnotemark}\endnotemark[\ref{en:test}].
+\end{example}
+
+\subsection{Printing the Notes}
+The notes are printed by using the command \cs{printendnotes}.
+\begin{commands}
+ \command{printendnotes}[\sarg\oarg{style}]
+ Print the list of endnotes. \meta{style} is one of the instances
+ explained in section~\ref{sec:customizing_the_list}.
+\end{commands}
+If used without argument it prints all notes set so far with
+\cs{endnote}. The current list will then be cleared. All endnotes set after
+it are stored again for the next usage of \cs{printendnotes}. The starred
+version will print \emph{all} endnotes but shouldn't be used more than once if
+you have nested endnotes.
+
+It may take several compilation runs until all notes are printed correctly.
+In a first run they are written to the \code{aux} file. In the second run
+they are available to \cs{printendnotes}. If you have nested endnotes they
+will be written to the \code{aux} file the first time they're printed with
+\cs{printendnotes} which means you might have to compile your file once more.
+If you change any of the endnotes or add another one you again will need at
+least two runs, maybe more. \enotez\ tries to warn you in these cases by
+invoking the warning
+\begin{flushleft}
+ \ttfamily
+ Endnotes may have changed. Rerun to get them right.
+\end{flushleft}
+but may not catch all cases.
+
+\enotez\ provides two commands that allow to set some kinds of preamble and
+postamble to a list, either to every list or only to the next one:
+\begin{commands}
+ \command{AtEveryEndnotesList}[\marg{text}]
+ \sinceversion{0.5}inserts \meta{text} between heading and the actual notes
+ every time \cs{printendnotes} is used.
+ \command{AtNextEndnotesList}[\marg{text}]
+ \sinceversion{0.5} inserts \meta{text} between heading and the actual
+ notes the next time \cs{printendnotes} is used. This overwrites a
+ possible preamble set with \cs{AtEveryEndnotesList} for this instance of
+ \cs{printendnotes}.
+ \command{AfterEveryEndnotesList}[\marg{text}]
+ \sinceversion{0.5} inserts \meta{text} after the notes list every time
+ \cs{printendnotes} is used.
+ \command{AfterNextEndnotesList}[\marg{text}]
+ \sinceversion{0.5} inserts \meta{text} after the notes list the next time
+ \cs{printendnotes} is used. This overwrites a possible postamble set with
+ \cs{AfterEveryEndnotesList} for this instance of \cs{printendnotes}.
+\end{commands}
+If something is inserted with one of these commands the inserted \meta{text}
+will be followed by a \cs*{par} and a vertical skip for the preamble. The
+postambles follow a \cs*{par} and a vertical skip. The skips can be set using
+an option, see section~\ref{sec:options}.
+
+\section{Options}\label{sec:options}
+\subsection{Package Options}
+\enotez\ has a few package options which should be pretty self-explanatory.
+They can be set either as package options with
+\cs*{usepackage}\oarg{options}\Marg{enotez} or with the setup command.
+\begin{commands}
+ \command{setenotez}[\marg{options}]
+ Setup command for setting \enotez' options.
+\end{commands}
+\begin{options}
+ \keyval{list-name}{list name}\Default{Notes}
+ The name of the notes list. This name is used for the heading of the
+ list.
+ \keybool{reset}\Default{false}
+ If set to \code{true} the notes numbers will start from 1 again after
+ \cs{printendnotes} has been invoked.
+ \keychoice{counter-format}{arabic,alph,Alph,roman,Roman,symbols}\Default{arabic}
+ Change the format of the endnote counter. Please be aware that there are
+ only 26 alphabetic counter symbols (options \code{alph} and \code{Alph}
+ and \emph{only 9} symbols (option \code{symbols}).
+ \keyval{mark-format}{code}\Default
+ Redefine \cs{enmarkstyle} to execute \meta{code}. This command is placed
+ directly before the endnote mark in the text.
+ \keyval{mark-cs}{command}\Default{\cs*{textsuperscript}}
+ Lets \cs{enotezwritemark} to be equal to \meta{command}. This command
+ is used to typeset the endnote marks in the text and should take one
+ argument.
+ \keybool{backref}\Default{false}\label{key:backref}
+ \sinceversion{0.7}If set to \code{true} and \pkg{hyperref} has been
+ loaded backlinks from the notes in the list to the marks in the text are
+ added.
+ \keychoice{totoc}{section,chapter,false}\Default{false}\label{key:totoc}
+ Add an entry to the table of contents.
+ \keyval{list-heading}{sectioning command including argument}
+ You can use this option to manually set the list heading command, \eg,
+ \keyis{list-heading}{\cs{chapter}\Marg{\#1}} for a numbered heading. The
+ default depends upon if the class you're using provides \cs*{chapter} or
+ not. It either uses \cs*{chapter}\sarg\ or \cs*{section}\sarg. You can
+ see that you have to refer to the actual heading with \code{\#1}.
+ \keyval{list-style}{style}\Default{plain}
+ Sets the default list style, see section~\ref{sec:customizing_the_list}
+ for details.
+ \keyval{list-preamble-skip}{skip}\Default{\cs*{medskipamount}}
+ \sinceversion{0.5}Sets the vertical skip (a rubber length) that is
+ inserted if a list preamble is inserted by using either
+ \cs{AtNextEndnotesList} or \cs{AtEveryEndnotesList}. It's default is set
+ equal to \cs*{medskipamount}.
+ \keyval{list-postamble-skip}{skip}\Default{\cs*{medskipamount}}
+ \sinceversion{0.5}Sets the vertical skip (a rubber length) that is
+ inserted if a list postamble is inserted by using either
+ \cs{AfterNextEndnotesList} or \cs{AfterEveryEndnotesList}. It's default
+ is set equal to \cs*{medskipamount}.
+\end{options}
+
+\subsection{Customizing the List}\label{sec:customizing_the_list}
+The list is typeset with \pkg{xtemplate}'s possibilities. \enotez\ declares
+the object \code{enotez-list} and two templates for it, the template
+\code{paragraph} and the template \code{list}.
+
+\subsubsection{The \code{paragraph} Template}
+The \code{paragraph} template's interface is defined as follows:
+\begin{sourcecode}
+ \DeclareTemplateInterface{enotez-list}{paragraph}{1}
+ {
+ % parameter : type = default
+ heading : function 1 = \section*{#1} ,
+ format : tokenlist = \footnotesize ,
+ number : function 1 = \enmark{#1} ,
+ number-format : tokenlist = \normalfont ,
+ notes-sep : length = .5\baselineskip ,
+ }
+\end{sourcecode}
+The parameters functions are these:
+\begin{description}[style=nextline]
+ \item[\code{heading}] The command with which the heading is typeset.
+ \item[\code{format}] The format of the whole list.
+ \item[\code{number}] The command that is used to typeset the numbers of the
+ notes. The command \cs{enmark} is explained soon.
+ \item[\code{numbers-format}] The format of the numbers.
+ \item[\code{notes-sep}] Additional space between the notes.
+\end{description}
+
+\enotez\ uses this template to define the instance \code{plain}:
+\begin{sourcecode}
+ \DeclareInstance{enotez-list}{plain}{paragraph}{}
+\end{sourcecode}
+This is the default style of the list.
+
+You can easily define your own instances, though:
+\begin{sourcecode}
+ \DeclareInstance{enotez-list}{custom}{paragraph}
+ {
+ heading = \chapter*{#1} ,
+ notes-sep = \baselineskip ,
+ format = \normalfont ,
+ number = \textsuperscript{#1}
+ }
+\end{sourcecode}
+This would use a chapter heading for the title, separate the notes with
+\cs*{baselineskip} and typeset them with \cs*{normalfont}. The numbers would
+be typeset with \cs*{textsuperscript}. You could now use it like this:
+\begin{sourcecode}
+ \printendnotes[custom]
+\end{sourcecode}
+
+If you wanted superscripted numbers, you could also redefine \cs{enmark}.
+\begin{commands}
+ \command{enmark}
+ this command is initially defined like this:
+ \verbcode=\newcommand*\enmark[1]{#1.}=
+\end{commands}
+
+\subsubsection{The \code{list} Template}
+The \code{list} template's interface is defined as follows:
+\begin{sourcecode}
+ \DeclareTemplateInterface{enotez-list}{list}{1}
+ {
+ % parameter : type = default
+ heading : function 1 = \section*{#1} ,
+ format : tokenlist = \footnotesize ,
+ number : function 1 = \enmark{#1} ,
+ number-format : tokenlist = \normalfont ,
+ list-type : tokenlist = description ,
+ }
+\end{sourcecode}
+This template uses a list to typeset the notes. As you can see the default
+list is a \code{description} list.
+
+\enotez\ defines two instances of this template:
+\begin{sourcecode}
+ \DeclareInstance{enotez-list}{description}{list}{}
+ \DeclareInstance{enotez-list}{itemize}{list}{list-type = itemize}
+\end{sourcecode}
+They're available through \cs{printendnotes}\Oarg{description} and
+\cs{printendnotes}\Oarg{itemize}, respectively.
+
+Again you can define your own instances using whatever list you want, possibly
+one defined with the power of \pkg{enumitem}.
+
+\section{Collect Notes Section-wise and Print List Stepwise}\label{sec:split}
+\emph{This feature is experimental and surely has some limitations. Please
+ let me know if something doesn't work as expected}.
+
+Not to be misunderstood: you can use \cs{printendnotes} as often as you like,
+possibly after each section. That is \emph{not} what is meant here. Let's
+suppose you are writing a book and have many endnotes in many chapters. It
+would be nice if the list of endnotes at the end of the book could be split
+into parts for each chapter. This section describes how you can achieve that
+with \enotez.
+
+First of all \enotez\ will rely on the fact that you use \cs{printendnotes}
+only \emph{once}! If you call it more times nobody knows what will
+happen\ldots
+
+You'll need to tell \enotez\ that you want to split the notes into groups.
+\begin{options}
+ \keychoice{split}{section,chapter,false}\Default{false}
+ Enable the automatic splitting.
+ \keyval{split-sectioning}{csname}\Default
+ \emph{This option is deprecated and may be dropped in future versions!}
+ The command that is used to display the titles between the splits. It
+ needs to be a command that takes one argument and should be entered
+ without the leading backslash. If the option is not used \enotez\ will
+ choose \code{subsection*} for \keyis{split}{section} and \code{section*}
+ for \keyis{split}{chapter}.
+ \keyval{split-heading}{sectioning command including argument}
+ \sinceversion{0.3}The command that is used to display the titles between
+ the splits. It is entered with argument and the actual title is referred
+ to with \code{\#1}, \eg,
+ \keyis{split-heading}{\cs*{subsection}\sarg\Marg{\#1}}. If the option is
+ not used \enotez\ will choose \cs*{subsection}\sarg\Marg{\#1} for
+ \keyis{split}{section} and \cs*{section}\sarg\Marg{\#1} for
+ \keyis{split}{chapter}.
+ \keyval{split-title}{tokenlist}\Default{Notes for <name> <ref>}
+ The title that will be inserted between the splits. \code{<name>} is
+ replaced by \code{section} for \keyis{split}{section} and \code{chapter}
+ for \keyis{split}{chapter}. \code{<ref>} is replaced by the corresponding
+ \cs*{thesection} or \cs*{thechapter}.
+\end{options}
+Set the \option{split} option:
+\begin{sourcecode}
+ \setenotez{split=section}
+\end{sourcecode}
+Well -- that's it, basically. You'll have to be careful, though: if you're
+having nested endnotes the nested ones appear first in the ``Notes'' section
+(or chapter, respectively). In this case you should have a numbered section
+title for the notes, presumably in the appendix. You'll need to create a new
+list style:
+\begin{sourcecode}
+ % preamble:
+ \usepackage{enotez}
+ \DeclareInstance{enotez-list}{section}{paragraph}{heading=\section{#1}}
+ \setenotez{list-style=section,split=section}
+ % document:
+ \appendix
+ \printendnotes
+\end{sourcecode}
+
+Please beware that the option \option{reset} also impacts here: the numbering
+will be reset for each section or chapter, depending on the choice you made
+for \option{split}.
+
+There are additional commands:
+\begin{commands}
+ \command{AtEveryListSplit}[\marg{code}]
+ Inserts\sinceversion{0.7} \meta{code} before each sub-heading in a
+ splitted list.
+ \command{AfterEveryListSplit}[\marg{code}]
+ Inserts\sinceversion{0.7} \meta{code} after each sub-heading in a splitted
+ list.
+ \command{EnotezCurrentSplitTitle}
+ Holds\sinceversion{0.7} the current sub-heading in a splitted list and may
+ be used in \cs{AtEveryListSplit} and \cs{AfterEveryListSplit}.
+ \command{NewSplitTitleTag}[\marg{tag}\marg{replacement}]
+ In\sinceversion{0.8} the sub-headings of a splitted list, the tags
+ \code{<ref>}, \code{<name>} and \code{<split-level-id>} can be used per
+ default. This command allows to define additional tags.
+\end{commands}
+
+The tags that can be used for setting the sub-headings of a splitted list have
+the following meaning:
+\begin{description}
+ \item[\code{<ref>}] The counter representation of the current section or
+ chapter, \ie, either the corresponding expansion of \cs*{thesection} or
+ \cs*{thechapter}, depending on the split-level.
+ \item[\code{<name>}] The name of the split-level, \ie, either ``section'' or
+ ``chapter'', depending on the split-level. This is language sensitive
+ (see section~\ref{sec:language-support}). The corresponding translation
+ ids are \code{enotez-section} and \code{enotez-chapter}, respectively.
+ \item[\code{<split-level-id>}] The number of the current section or chapter,
+ \ie, either the corresponding expansion of \verbcode+\arabic{section}+ or
+ \verbcode+\arabic{chapter}+, depending on the split-level.
+\end{description}
+The command \cs{NewSplitTitleTag} let's you define your own. You can use the
+three existing tags inside the replacement. Note that the \meta{tag} argument
+is input without opening \code{<} and closing \code{>}!
+\cs{NewSplitTitleTag}\Marg{own}\Marg{...} would define the tag \code{<own>}.
+
+\enotez\ comes with an example document for a split list which you should find
+in the same folder as this documentation.
+
+\section{Language Support}\label{sec:language-support}
+\enotez\ uses the \pkg{translations} package~\cite{pkg:translations} to
+translate language dependent strings. The advantage of this is that language
+settings with \pkg{babel}~\cite{pkg:babel} or
+\pkg{polyglossia}~\cite{pkg:polyglossia} are detected automatically. However,
+the available translations are somewhat limited due to my limited language
+knowledge. If you find missing or wrong translations you can try to add or
+correct them by adding the corresponding versions of the following lines to
+your preamble:
+\begin{sourcecode}
+ \DeclareTranslation{English}{enotez-title}{Notes}
+ % ``<name> <ref>'' is a placeholder for e.g. ``section 1'':
+ \DeclareTranslation{English}{enotez-splitted-title}{Notes for <name> <ref>}
+ \DeclareTranslation{English}{enotez-section}{section}
+ \DeclareTranslation{English}{enotez-chapter}{chapter}
+\end{sourcecode}
+If you like you can also drop me an email at
+\href{mailto:contact@mychemistry.eu}{contact@mychemistry.eu} and I'll add the
+correct translations to \enotez.
+
+\section{hyperref Support}
+If \pkg{hyperref} is loaded and you are using the option \option{totoc} (see
+page~\pageref{key:totoc}) the list title is linked via a \cs*{phantomsection}.
+
+If \pkg{hyperref} is used with \code{hyperfootnotes} set to \code{true} the
+endnote marks are linked to the respective entries in the
+list\changedversion{0.7}. If you also set \enotez' option \option{backref}
+(see page~\pageref{key:backref}) the notes in the list are themselves linked
+to the marks in the text.
+
+\AtNextEndnotesList{This is an example of a preamble to the list set with
+\cs{AtNextEndnotesList}.}
+\AfterEveryEndnotesList{\noindent This is an example of a postamble to the
+ list set with \cs{AfterEveryEndnotesList}. Note that it would have started
+ with a paragraph indent which was prevented here by using \cs*{noindent}.}
+\printendnotes[addsec]
+
+\end{document}
diff --git a/macros/latex/contrib/enotez/enotez_split_example.tex b/macros/latex/contrib/enotez/enotez_split_example.tex
new file mode 100644
index 0000000000..12740ede28
--- /dev/null
+++ b/macros/latex/contrib/enotez/enotez_split_example.tex
@@ -0,0 +1,73 @@
+\documentclass{article}
+% \documentclass{scrartcl}
+% \documentclass{memoir}
+\usepackage[english]{babel}
+% \usepackage{caption}
+\usepackage[T1]{fontenc}
+\usepackage{libertine}
+
+\usepackage{enotez}
+\usepackage{kantlipsum}
+
+\DeclareInstance{enotez-list}{section}{paragraph}{heading=\section{#1}}
+\setenotez{
+ split=section,
+ list-style=section,
+ reset,
+ backref
+% customize the titles in between, e.g.:
+% split-sectioning=addsec,
+% split-title=\par\noindent<name> <ref>:
+}
+
+\usepackage{fnpct}
+
+\usepackage{mwe}
+\usepackage[colorlinks]{hyperref}
+
+\begin{document}
+
+\tableofcontents
+
+\section{Test}
+Text\endnote{\kant[1]}. Text\endnote{\kant[2]}. Text\endnote{This time
+with a \textbf{nested}\multendnote{\kant[3];\kant[4]} endnote.}.
+Text\multendnote{\kant[5];\kant[6]}.
+
+\begin{figure}[htp]
+ \centering
+ \includegraphics[width=.4\linewidth]{example-image-a}
+ % \addtocounter{endnote}{-1} % <<< need this in memoir class and with
+ % `caption' package when using an endnote
+ % inside a caption
+ \caption[caption]{Some text\endnotemark.}
+ \endnotetext{An endnote with a nested endnote\endnote{\kant[7]} inside a
+ figure caption.}
+\end{figure}
+
+\appendix
+\printendnotes
+\end{document}
+
+\tableofcontents
+
+\section{Test}
+Text\endnote{\kant[1]}. Text\endnote{\kant[2]}. Text\endnote{This time
+with a \textbf{nested}\multendnote{\kant[3];\kant[4]} endnote.}.
+Text\multendnote{\kant[5];\kant[6]}.
+\begin{figure}[htp]
+ \centering
+ \includegraphics[width=.4\linewidth]{example-image-a}
+ \caption[caption]{Some text\endnote{An endnote with a nested endnote\endnote{\kant[7]}
+ inside a figure caption.}.}
+\end{figure}
+
+\section{Test}
+Text\endnote{\kant[8]}. Text\endnote{\kant[9]}. Text\endnote{This time
+with a \textbf{nested}\endnote{\kant[10]} endnote.}. Text\endnote{\kant[11]}.
+
+\appendix
+\printendnotes
+
+
+\end{document}