summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2019-09-30 21:49:53 +0000
committerKarl Berry <karl@freefriends.org>2019-09-30 21:49:53 +0000
commit0c7873f9ffd7192fe2ad9c08c8f3a42bb7b9d71b (patch)
tree54fcfa5ff33cef1be1bfadabe00b918ff4e2c476
parent745a8740b6e66be4383f1bc6a0326110abdf6a3b (diff)
enotez (30sep19)
git-svn-id: svn://tug.org/texlive/trunk@52225 c570f23f-e606-0410-a88d-b1316a301751
-rw-r--r--Master/texmf-dist/doc/latex/enotez/README6
-rw-r--r--Master/texmf-dist/doc/latex/enotez/enotez_en.pdfbin458894 -> 452442 bytes
-rw-r--r--Master/texmf-dist/doc/latex/enotez/enotez_en.tex66
-rw-r--r--Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex39
-rw-r--r--Master/texmf-dist/tex/latex/enotez/enotez.sty379
5 files changed, 268 insertions, 222 deletions
diff --git a/Master/texmf-dist/doc/latex/enotez/README b/Master/texmf-dist/doc/latex/enotez/README
index ab82c111eb8..73c54286bd4 100644
--- a/Master/texmf-dist/doc/latex/enotez/README
+++ b/Master/texmf-dist/doc/latex/enotez/README
@@ -1,15 +1,15 @@
--------------------------------------------------------------------------
-the ENOTEZ package v0.9a
+the ENOTEZ package v0.10
Endnotes for LaTeX2e
-2017/04/24
+2019/09/30
--------------------------------------------------------------------------
Clemens Niederberger
Web: https://bitbucket.org/cgnieder/enotez/
E-Mail: contact@mychemistry.eu
--------------------------------------------------------------------------
-Copyright 2012-2017 Clemens Niederberger
+Copyright 2012--2019 Clemens Niederberger
This work may be distributed and/or modified under the
conditions of the LaTeX Project Public License, either version 1.3
diff --git a/Master/texmf-dist/doc/latex/enotez/enotez_en.pdf b/Master/texmf-dist/doc/latex/enotez/enotez_en.pdf
index 3ce61bdb729..dfcd56e6cee 100644
--- a/Master/texmf-dist/doc/latex/enotez/enotez_en.pdf
+++ b/Master/texmf-dist/doc/latex/enotez/enotez_en.pdf
Binary files differ
diff --git a/Master/texmf-dist/doc/latex/enotez/enotez_en.tex b/Master/texmf-dist/doc/latex/enotez/enotez_en.tex
index 85cf03b688d..33d0149b381 100644
--- a/Master/texmf-dist/doc/latex/enotez/enotez_en.tex
+++ b/Master/texmf-dist/doc/latex/enotez/enotez_en.tex
@@ -12,7 +12,7 @@
% Web: http://www.mychemistry.eu/forums/forum/enotez/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
-% Copyright 2012-2017 Clemens Niederberger
+% Copyright 2012--2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -116,11 +116,6 @@ 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
@@ -132,24 +127,17 @@ note mark.
\sinceversion{0.9}Add an endnotemark.
\command{endnotetext}[\marg{text}]
\sinceversion{0.9}Add text to an endnote placed with \cs{endnotemark}.
+ % \command{refendnote}[\marg{label name}]
+ % \sinceversion{0.10}This command can be used to create an endnote mark by
+ % referencing an earlier endnote which has been marked with \cs*{label}.
\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
+using the optional argument but that shouldn't be needed too often. 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!}}
@@ -162,27 +150,9 @@ The marks of the endnotes in the running text are printed through the command
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
+the endnote that has been set last is stored 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
@@ -197,11 +167,12 @@ The notes are printed by using the command \cs{printendnotes}.
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.
+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. \emph{Unfortunately the starred version also does not work together
+ with the \option{split} option.}
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
@@ -244,8 +215,9 @@ 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.
+They can be set with the setup command\footnote{Earlier versions allowed to
+ use them as package options. This is not possible any more since
+ version~0.10.}.
\begin{commands}
\command{setenotez}[\marg{options}]
Setup command for setting \enotez' options.
@@ -272,8 +244,12 @@ They can be set either as package options with
\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.
+ \keychoice{totoc}{subsection,section,chapter,part,\default{auto},false}%
+ \Default{false}\label{key:totoc}
+ Add\changedversion{0.10} an entry to the table of contents. When used
+ with no value the value \code{auto} is chosen and \enotez\ tries to detect
+ the correct level by itself. If this fails the option will be ignored and
+ a warning is written to the log file.
\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
diff --git a/Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex b/Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex
index 12740ede289..7c58fa56dfa 100644
--- a/Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex
+++ b/Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex
@@ -1,3 +1,34 @@
+% --------------------------------------------------------------------------
+% the ENOTEZ package
+%
+% Endnotes for LaTeX2e
+%
+% --------------------------------------------------------------------------
+% Clemens Niederberger
+% Web: https://bitbucket.org/cgnieder/enotez/
+% E-Mail: contact@mychemistry.eu
+% --------------------------------------------------------------------------
+% Copyright 2012--2019 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{article}
% \documentclass{scrartcl}
% \documentclass{memoir}
@@ -9,11 +40,11 @@
\usepackage{enotez}
\usepackage{kantlipsum}
-\DeclareInstance{enotez-list}{section}{paragraph}{heading=\section{#1}}
+\DeclareInstance{enotez-list}{itemize}{list}{list-type=itemize,heading=\section{#1}}
\setenotez{
split=section,
list-style=section,
- reset,
+ % reset,
backref
% customize the titles in between, e.g.:
% split-sectioning=addsec,
@@ -46,7 +77,8 @@ Text\multendnote{\kant[5];\kant[6]}.
\end{figure}
\appendix
-\printendnotes
+\printendnotes[itemize]
+
\end{document}
\tableofcontents
@@ -69,5 +101,4 @@ with a \textbf{nested}\endnote{\kant[10]} endnote.}. Text\endnote{\kant[11]}.
\appendix
\printendnotes
-
\end{document}
diff --git a/Master/texmf-dist/tex/latex/enotez/enotez.sty b/Master/texmf-dist/tex/latex/enotez/enotez.sty
index ba26561827b..4e1738e74e7 100644
--- a/Master/texmf-dist/tex/latex/enotez/enotez.sty
+++ b/Master/texmf-dist/tex/latex/enotez/enotez.sty
@@ -8,7 +8,7 @@
% Web: https://bitbucket.org/cgnieder/enotez/
% E-Mail: contact@mychemistry.eu
% --------------------------------------------------------------------------
-% Copyright 2012-2017 Clemens Niederberger
+% Copyright 2012--2019 Clemens Niederberger
%
% This work may be distributed and/or modified under the
% conditions of the LaTeX Project Public License, either version 1.3
@@ -31,20 +31,12 @@
\RequirePackage{ expl3 , xparse , l3keys2e , xtemplate , etoolbox , xpatch , scrlfile }
\ProvidesExplPackage
{enotez}
- {2017/04/24}
- {0.9a}
+ {2019/09/30}
+ {0.10}
{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:. }
{
@@ -53,10 +45,17 @@
forever~I~encourage~you~to~switch.
}
-\cs_new:Npn \enotez_option_deprecated:nn #1#2
+\msg_new:nnn {enotez} {totoc}
+ {
+ You've~ set~ `totoc~ =~ auto'.~ However,~ I'm~ unbale~ to~ determine~ the~
+ toc~ level~ automatically.~ Please~ choose~ the~ level~ yourself.
+ }
+
+
+\cs_new_protected:Npn \enotez_option_deprecated:nn #1#2
{ \msg_warning:nnnnn {enotez} {deprecated} {option} {#1} {#2} }
-\cs_new:Npn \enotez_command_deprecated:NN #1#2
+\cs_new_protected:Npn \enotez_command_deprecated:NN #1#2
{
\msg_warning:nnnnn {enotez} {deprecated} {command}
{ \token_to_str:N #1 } { \token_to_str:N #2 }
@@ -65,7 +64,9 @@
% --------------------------------------------------------------------------
% variants of kernel functions
\cs_generate_variant:Nn \tl_if_eq:nnTF { Vn , nx }
-\cs_generate_variant:Nn \tl_if_eq:nnT { xx }
+\cs_generate_variant:Nn \tl_if_eq:nnT { xx , V }
+\cs_generate_variant:Nn \str_if_in:nnT { o }
+\cs_generate_variant:Nn \cs_set:Npn { cpV }
% --------------------------------------------------------------------------
% variables:
@@ -76,9 +77,6 @@
\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
@@ -88,7 +86,7 @@
\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 \g__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}
@@ -131,7 +129,18 @@
\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 }
+\seq_new:N \l__enotez_tmpa_seq
+\seq_new:N \l__enotez_sectioning_seq
+\seq_put_right:Nn \l__enotez_sectioning_seq {part}
+\seq_put_right:Nn \l__enotez_sectioning_seq {chapter}
+\seq_put_right:Nn \l__enotez_sectioning_seq {section}
+\seq_put_right:Nn \l__enotez_sectioning_seq {subsection}
+\seq_put_right:Nn \l__enotez_sectioning_seq {subsubsection}
+\seq_put_right:Nn \l__enotez_sectioning_seq {paragraph}
+
+\str_new:N \l__enotez_tmpa_str
+
+\cs_new_protected:Npn \enotez_nobreak: { \tex_penalty:D 10000 \scan_stop: }
% --------------------------------------------------------------------------
% options:
@@ -141,7 +150,6 @@
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}} ,
@@ -152,27 +160,28 @@
mark-format .code:n = \cs_set:Npn \enmarkstyle {#1} ,
mark-cs .code:n = \cs_set:Npn \enotezwritemark {#1} ,
totoc .choices:nn =
- { section , chapter , false }
+ { subsection , section , chapter , part , auto , false }
{
- \tl_if_eq:VnTF \l_keys_choice_tl { 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
}
} ,
+ totoc .default:n = auto ,
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 }
+ \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 }
+ \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 =
@@ -190,6 +199,7 @@
% #2: mark
\cs_new_protected:Npn \enotez_write_mark:nn #1#2
{
+ % but what if #2 is the reference to a different mark?
\bool_if:NTF \l__enotez_hyperfootnotes_bool
{
\enotezwritemark { \hyperlink {enz.#1} { \enmarkstyle #2 } }
@@ -203,6 +213,10 @@
}
\cs_generate_variant:Nn \enotez_write_mark:nn {x}
+% % #1: argument to \ref
+% \cs_new_protected:Npn \enotez_ref_note:n #1
+% { \enotezwritemark { \enmarkstyle { \ref {#1} } } }
+
% the internal endnote:
\cs_new_protected:Npn \enotez_endnote:nn #1#2
{
@@ -215,16 +229,13 @@
\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}
+ \refstepcounter {endnote}
\enotez_write_mark:xn
{ \int_use:N \g__enotez_endnote_id_int }
{ \theendnote }
}
{
- \cs_gset:cpn {@currentlabel} {#1}
- % \cs_gset_eq:NN \theendnote \@currentlabel
+ \cs_gset:cpn {@currentlabel} {\p@endnote#1}
\enotez_write_mark:xn { \int_use:N \g__enotez_endnote_id_int } {#1}
}
\bool_if:NT \l__enotez_disable_bool
@@ -254,22 +265,20 @@
\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 }
+ {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 }
+ {a}
{#2}
}
}
@@ -287,7 +296,7 @@
{ \int_use:N \g__enotez_list_printed_int }
{ \thechapter }
{ \int_eval:n { \value{chapter} } }
- { m }
+ {m}
{#2}
}
{
@@ -297,7 +306,7 @@
{ \int_use:N \g__enotez_list_printed_int }
{ \thesection }
{ \int_eval:n { \value{section} } }
- { m }
+ {m}
{#2}
}
}
@@ -313,7 +322,10 @@
% #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} } }
+ {
+ \legacy_if:nT {@filesw}
+ { \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
@@ -372,153 +384,188 @@
{ \enotez_endnote_text:nn { \q_no_value } }
}
+% \cs_new_protected:Npn \refendnote #1
+% { \enotez_ref_note:n {#1} }
+
\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_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 } }
+
+\cs_new_protected:Npn \enotez_set_totoc:
+ {
+ \bool_if:NT \l__enotez_totoc_bool
+ {
+ \bool_if:NT \l__enotez_hyperref_bool { \phantomsection }
+ \bool_set_false:N \l__enotez_tmpa_bool
+ \tl_if_eq:VnTF \l__enotez_totoc_tl {auto}
+ {
+ \seq_map_inline:Nn \l__enotez_sectioning_seq
+ {
+ \str_if_in:onT { \enotezlistheading{} } {##1}
+ {
+ \bool_set_true:N \l__enotez_tmpa_bool
+ \tl_set:Nn \l__enotez_totoc_tl {##1}
+ }
+ }
+ \bool_if:NF \l__enotez_tmpa_bool
+ {
+ \tl_set:Nn \l__enotez_totoc_tl {false}
+ \msg_warning:nn {enotez} {totoc}
+ }
+ }
+ { \bool_set_true:N \l__enotez_tmpa_bool }
+ \bool_if:NT \l__enotez_tmpa_bool
+ {
+ \addcontentsline
+ {toc}
+ { \l__enotez_totoc_tl }
+ { \l__enotez_list_name_tl }
+ }
+ }
+ }
+
+\cs_new_protected:Npn \enotez_build_print_list:nnnn #1#2#3#4
+ {
+ \int_zero:N \l__enotez_tmpa_int
+ \bool_if:nTF {#1}
+ {
+ \prop_map_inline:Nn \g__enotez_endnote_mark_prop
+ {
+ \enotez_get_note:nn {#1} {##1}
+ \bool_if:NT \l__enotez_print_note_bool {#3}
+ }
+ }
+ {
+ \int_do_while:nn { \l__enotez_tmpa_int <= \g__enotez_list_printed_int }
+ {
+ \seq_clear:N \l__enotez_tmpa_seq
+ \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} }
+ { \seq_put_right:Nn \l__enotez_tmpa_seq {##1} }
+ }
+ \seq_if_empty:NF \l__enotez_tmpa_seq
+ {
+ \enotez_get_split_title:x { \seq_item:Nn \l__enotez_tmpa_seq {1} }
+ #2
+ }
+ \seq_map_inline:Nn \l__enotez_tmpa_seq
+ {
+ \enotez_get_note:nn {#1} {##1}
+ \bool_if:NT \l__enotez_print_note_bool {#3}
+ }
+ \seq_if_empty:NF \l__enotez_tmpa_seq {#4}
+ \int_incr:N \l__enotez_tmpa_int
+ }
+ }
+ }
\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 ,
+ 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 ,
+ heading = \enotez_list_heading:n ,
format = \l__enotez_list_format_tl ,
- number = \enotez_list_number:n ,
+ number = \enotez_list_number:n ,
number-format = \l__enotez_list_number_format_tl ,
- notes-sep = \l__enotez_list_notes_sep_dim ,
+ 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_set_totoc:
\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
+ \enotez_build_print_list:nnnn {#1}
+ {}
+ {
+ \par\noindent
+ \group_begin:
+ \tl_use:N \l__enotez_list_format_tl
+ \hbox_overlap_left:n
{
- \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 } }
+ \enotez_list_number:n
+ { \enotez_write_list_number:n {##1} }
+ \tl_use:N \c_space_tl
}
- \int_incr:N \l__enotez_tmpa_int
- }
+ % \cs_set:cpn {@currentlabel}
+ % { \p@endnote \l__enotez_endnote_mark_tl }
+ \tl_use:N \g__enotez_endnote_text_tl
+ \par
+ \dim_compare:nT { \l__enotez_list_notes_sep_dim != 0pt }
+ { \addvspace { \l__enotez_list_notes_sep_dim } }
+ \group_end:
+ }
+ {}
\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 ,
+ 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 ,
+ heading = \enotez_list_heading:n ,
format = \l__enotez_list_format_tl ,
- number = \enotez_list_number:n ,
+ 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_set_totoc:
\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_build_print_list:nnnn {#1}
+ {
+ \group_begin:
+ \tl_use:N \l__enotez_list_format_tl
+ \begin{\l__enotez_list_type_tl}
+ }
+ {
+ \item
+ [
+ \enotez_list_number:n
+ { \enotez_write_list_number:n {##1} }
+ ]
+ % \cs_set:cpn {@currentlabel}
+ % { \p@endnote \l__enotez_endnote_mark_tl }
+ \tl_use:N \g__enotez_endnote_text_tl
+ }
+ {
+ \end{\l__enotez_list_type_tl}
+ \group_end:
+ }
\enotez_list_postamble:
}
% some default styles:
-\DeclareInstance {enotez-list} {plain} {paragraph } { }
-\DeclareInstance {enotez-list} {description} {list} { }
+\DeclareInstance {enotez-list} {plain} {paragraph } { }
+\DeclareInstance {enotez-list} {description} {list} { }
\DeclareInstance {enotez-list} {itemize} {list} { list-type = itemize }
% --------------------------------------------------------------------------
@@ -528,8 +575,7 @@
\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} }
+ \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 }
@@ -559,7 +605,10 @@
\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
+ \prop_get:NnN \g__enotez_endnote_text_prop {#2} \g__enotez_endnote_text_tl
+ \tl_gset_eq:NN
+ \g__enotez_endnote_text_tl
+ \g__enotez_endnote_text_tl
\bool_set_true:N \l__enotez_print_note_bool
}
{
@@ -569,14 +618,8 @@
\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
+ \tl_gset:Nx \g__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 }
@@ -584,14 +627,8 @@
\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
+ \tl_gset:Nx \g__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 }
@@ -676,7 +713,7 @@
\bool_if:NTF \l__enotez_splitted_list_heading_bool
{ \exp_args:No \enotezsplitlistheading }
{
- \tl_if_eq:VnTF \l__enotez_split_tl { section }
+ \tl_if_eq:VnTF \l__enotez_split_tl {section}
{ \exp_args:NNo \subsection* }
{ \exp_args:NNo \section* }
}
@@ -686,6 +723,7 @@
}
\prop_get:NnN \g__enotez_endnote_split_prop {#1} \l__enotez_last_split_id_tl
}
+\cs_generate_variant:Nn \enotez_get_split_title:n {x}
% --------------------------------------------------------------------------
% the marks in the list:
@@ -697,6 +735,8 @@
% --------------------------------------------------------------------------
% internal printendnotes:
+% #1: boolean
+% #2: list style
\cs_new_protected:Npn \enotez_print_endnotes:nn #1#2
{
\enotez_if_endnotes:T
@@ -708,30 +748,29 @@
\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
- }
+ { \setcounter {endnote} {0} }
\int_gincr:N \g__enotez_list_printed_int
}
+ \bool_if:NT \l__enotez_reset_bool
+ { \setcounter {endnote} {0} }
}
}
\prg_new_conditional:Npnn \enotez_if_endnotes: {p,T,F,TF}
{
- \int_compare:nTF { \value {endnote} > 0 }
+ \int_compare:nTF { \g__enotez_endnote_id_int > 0 }
{ \prg_return_true: }
{ \prg_return_false: }
}
% the user command:
-\NewDocumentCommand \printendnotes { so }
+\NewDocumentCommand \printendnotes {so}
{
\IfNoValueTF {#2}
{
\bool_if:NTF \l__enotez_split_bool
- { \enotez_print_endnotes:nn { \BooleanFalse } { } }
- { \enotez_print_endnotes:nn {#1} { } }
+ { \enotez_print_endnotes:nn { \BooleanFalse } { } }
+ { \enotez_print_endnotes:nn {#1} { } }
}
{
\bool_if:NTF \l__enotez_split_bool
@@ -839,8 +878,6 @@
\cs_new:Npn \EnotezCurrentSplitTitle {}
% --------------------------------------------------------------------------
-% process the options:
-\ProcessKeysOptions {enotez}
\AtBeginDocument
{
@@ -852,10 +889,7 @@
{
\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
- }
+ { \setcounter {endnote} {0} }
}
}
{
@@ -863,10 +897,7 @@
{
\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
- }
+ { \setcounter {endnote} {0} }
}
}
}
@@ -984,6 +1015,14 @@
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
+2019/09/30 v0.10 - fix issus #14
+ - don't allow package options any more
+ - implement issue #17: new choices for the totoc option:
+ `auto', `subsection' and `part'
+ - fix issue #18
+ - implement issue #13
+ % - new command \refendnote, fix issue #19
+ - implement issue #9
% --------------------------------------------------------------------------
% TODO: