diff options
-rw-r--r-- | Master/texmf-dist/doc/latex/enotez/README | 6 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/enotez/enotez_en.pdf | bin | 415444 -> 423164 bytes | |||
-rw-r--r-- | Master/texmf-dist/doc/latex/enotez/enotez_en.tex | 159 | ||||
-rw-r--r-- | Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex | 25 | ||||
-rw-r--r-- | Master/texmf-dist/tex/latex/enotez/enotez.sty | 651 |
5 files changed, 552 insertions, 289 deletions
diff --git a/Master/texmf-dist/doc/latex/enotez/README b/Master/texmf-dist/doc/latex/enotez/README index b31236b513e..1f2948b06b6 100644 --- a/Master/texmf-dist/doc/latex/enotez/README +++ b/Master/texmf-dist/doc/latex/enotez/README @@ -1,15 +1,15 @@ -------------------------------------------------------------------------- -the ENOTEZ package +the ENOTEZ package v0.5a Endnotes for LaTeX2e -2012/12/30 v0.4 +2013/03/18 -------------------------------------------------------------------------- Clemens Niederberger Web: https://bitbucket.org/cgnieder/enotez/ E-Mail: contact@mychemistry.eu -------------------------------------------------------------------------- -Copyright 2012 Clemens Niederberger +Copyright 2012-2013 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 Binary files differindex d12c08660cd..4fc79487da8 100644 --- a/Master/texmf-dist/doc/latex/enotez/enotez_en.pdf +++ b/Master/texmf-dist/doc/latex/enotez/enotez_en.pdf diff --git a/Master/texmf-dist/doc/latex/enotez/enotez_en.tex b/Master/texmf-dist/doc/latex/enotez/enotez_en.tex index a949b6cae48..f250b918129 100644 --- a/Master/texmf-dist/doc/latex/enotez/enotez_en.tex +++ b/Master/texmf-dist/doc/latex/enotez/enotez_en.tex @@ -1,7 +1,7 @@ % arara: pdflatex -% arara: makeindex: { sort: true, style: enotez_en.ist } -% arara: biber -% arara: pdflatex +% !arara: makeindex: { sort: true, style: enotez_en.ist } +% !arara: biber +% !arara: pdflatex % arara: pdflatex % -------------------------------------------------------------------------- % the ENOTEZ package @@ -13,7 +13,7 @@ % Web: https://bitbucket.org/cgnieder/enotez/ % E-Mail: contact@mychemistry.eu % -------------------------------------------------------------------------- -% Copyright 2011-2012 Clemens Niederberger +% Copyright 2011-2013 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -37,7 +37,7 @@ \docsetup{ pkg = enotez , code-box = { - backgroundcolor = gray!7!white , + backgroundcolor = gray!3!white , skipbelow = .6\baselineskip plus .5ex minus .5ex , skipabove = .6\baselineskip plus .5ex minus .5ex , roundcorner = 3pt , @@ -69,7 +69,8 @@ \DeclareInstance{enotez-list}{addsec}{paragraph}{heading=\addsec{#1}} % Layout: -% \usepackage{libertine} +\usepackage{libertinehologopatch} + \cnpkgusecolorscheme{friendly} \renewcommand*\othersectionlevelsformat[3]{% \textcolor{main}{#3\autodot}\enskip} @@ -81,18 +82,15 @@ \ChangeEmph{[}[,.02em]{]}[.055em,-.08em] \ChangeEmph{(}[-.01em,.04em]{)}[.04em,-.05em] -\ExplSyntaxOn -\NewDocumentCommand \Default {g} - { - \hfill\llap - { - \IfNoValueTF { #1 } - {(initially~empty)} - {Default:~\code{#1}} - } - \newline - } -\ExplSyntaxOff +\newcommand*\Default[1]{% + \hfill\llap + {% + \ifblank{#1}% + {(initially~empty)}% + {Default:~\code{#1}}% + }% + \newline +} \usepackage[backend=biber,style=alphabetic]{biblatex} \addbibresource{\jobname.bib} @@ -135,24 +133,43 @@ } \end{filecontents*} -\usepackage{makeidx} +\usepackage{imakeidx} \begin{filecontents*}{\jobname.ist} heading_prefix "{\\bfseries " heading_suffix "\\hfil}\\nopagebreak\n" headings_flag 1 - delim_0 "\\dotfill " - delim_1 "\\dotfill " - delim_2 "\\dotfill " - delim_r "\\textendash" + delim_0 "\\dotfill\\hyperpage{" + delim_1 "\\dotfill\\hyperpage{" + delim_2 "\\dotfill\\hyperpage{" + delim_r "}\\textendash\\hyperpage{" + delim_t "}" suffix_2p "\\nohyperpage{\\,f.}" suffix_3p "\\nohyperpage{\\,ff.}" \end{filecontents*} -\makeindex +\indexsetup{noclearpage,othercode=\footnotesize} +\makeindex[options={-s \jobname.ist},intoc,columns=3] \usepackage{kantlipsum} \usepackage{etoolbox} \AtBeginEnvironment{beispiel}{\setfnpct{dont-mess-around}} \usepackage{enumitem} + +\usepackage{marginnote,ragged2e} +\makeatletter +\providecommand*\sinceversion[1]{% + \@bsphack + \marginnote{% + \footnotesize\sffamily\RaggedRight + \textcolor{black!75}{Introduced in version~#1}}% + \@esphack} +\providecommand*\changedversion[1]{% + \@bsphack + \marginnote{% + \footnotesize\sffamily\RaggedRight + \textcolor{black!75}{Changed in version~#1}}% + \@esphack} +\makeatother + \begin{document} \section{Licence and Requirements} @@ -161,10 +178,8 @@ terms of the \LaTeX\ Project Public License, version 1.3 or later (\url{http://www.latex-project.org/lppl.txt}). The package has the status ``maintained.'' -\enotez needs and loads the following packages: \paket{expl3}, -\paket{xparse}, \paket{xtemplate} and \paket{l3keys2e}. If you're using -\paket{memoir}, a \paket[http://www.ctan.org/pkg/koma-script]{KOMA-Script} -class or the package \paket{caption} \enotez also needs and loads \paket{etoolbox}. +\enotez needs and loads the following packages: \paket{expl3}, \paket{xparse}, +\paket{xtemplate}, \paket{l3keys2e}, \paket{xpatch} and \paket{scrlfile}. \section{Motivation} \enotez is a new implementation of endnotes for \LaTeXe\ since the \paket{endnotes} @@ -176,21 +191,26 @@ 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 \klasse{memoir} class please keep +in mind that \klasse{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 \paket{fnpct} package% -\footnote{You'll have to use \cmd*{AdaptNote} for the time being, though.}. +As an aside: \enotez is nicely compatible with the \paket{fnpct} package. +Version~0.2j or newer of \paket{fnpct} automatically detects \enotez and adapts +the \cmd{endnote} command. \section{Usage} \subsection{Placing the Notes} The usage is simple: use \cmd{endnote} in the text where you want to place the note mark. \begin{beschreibung} - \befehl{endnote}[<mark>]{<text>} Add an endnote in the text. + \Befehl{endnote}[<mark>]{<text>}\newline + Add an endnote in the text. \end{beschreibung} \begin{beispiel} This is some text.\endnote{With an endnote.} @@ -198,23 +218,27 @@ note mark. 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. \cmd{endnote} works fine inside tables, minipages, floats and captions\footnote{This has been -tested with the standard classes, \paket*{memoir}, and the \paket*{KOMA-Script} +tested with the standard classes, \klasse{memoir}, and the \klasse{KOMA-Script} classes, with and without the \paket*{caption} package. If you're using another -package that redefines \cmd*{caption} it might not work.}. Endnotes can also be -nested. Since that seemed making a pair \cmd{endnotemark}/\cmd{endnotetext} +package that redefines \cmd*{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 \cmd{endnotemark}/\cmd{endnotetext} superfluous they are \emph{not} defined by \enotez. \begin{beispiel} This is some text.\endnote{With another endnote.\endnote{This is a nested\endnote{And another level deeper\ldots} endnote!}} - % uses package `kantlipsum': + % uses package `kantlipsum' to produce dummy text: Of course you can have several paragraphs\endnote{\kant[1-3]} in an endnote. \end{beispiel} \subsection{Printing the Notes} The notes are printed by using the command \cmd{printendnotes}. \begin{beschreibung} - \befehl{printendnotes}*[<style>] Print the list of endnotes. \code{<style>} is - one of the instances explained in section~\ref{ssec:customizing_the_list}. + \Befehl{printendnotes}*[<style>]\newline + Print the list of endnotes. \code{<style>} is one of the instances explained + in section~\ref{ssec:customizing_the_list}. \end{beschreibung} If used without argument it prints all notes set so far with \cmd{endnote}. The current list will then be cleared. All endnotes set after it are stored again @@ -228,17 +252,42 @@ available to \cmd{printendnotes}. If you have nested endnotes they will be writt to the \code{aux} file the first time they're printed with \cmd{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 \LaTeX's warning -\achtung{\code{Label(s) may have changed. Rerun to get cross-references right.}} +\enotez tries to warn you in these cases by invoking the warning +\achtung{\code{Endnotes may have changed. Rerun to get them right.}} but may not catch all cases. -\section{Options} +\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{beschreibung} + \Befehl{AtEveryEndnotesList}{<text>}\newline\sinceversion{0.5}% + inserts \code{<text>} between heading and the actual notes every time + \cmd{printendnotes} is used. + \Befehl{AtNextEndnotesList}{<text>}\newline\sinceversion{0.5}% + inserts \code{<text>} between heading and the actual notes the next time + \cmd{printendnotes} is used. This overwrites a possible preamble set with + \cmd{AtEveryEndnotesList} for this instance of \cmd{printendnotes}. + \Befehl{AfterEveryEndnotesList}{<text>}\newline\sinceversion{0.5}% + inserts \code{<text>} after the notes list every time \cmd{printendnotes} is + used. + \Befehl{AfterNextEndnotesList}{<text>}\newline\sinceversion{0.5}% + inserts \code{<text>} after the notes list the next time \cmd{printendnotes} + is used. This overwrites a possible postamble set with + \cmd{AfterEveryEndnotesList} for this instance of \cmd{printendnotes}. +\end{beschreibung} +If something is inserted with one of these commands the inserted \code{<text>} +will be followed by a \cmd{par} and a vertical skip for the preamble. The postambles +follow a \cmd{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 \verb=\usepackage[<options>]{enotez}= or with the setup command. \begin{beschreibung} - \befehl{setenotez}{<options>} Setup command for setting \enotez' options. + \Befehl{setenotez}{<options>}\newline + Setup command for setting \enotez' options. \Option{list-name}{<list name>}\Default{Notes} The name of the notes list. This name is used for the heading of the list. \Option{reset}{\default{true}|false}\Default{false} @@ -257,6 +306,14 @@ or with the setup command. \Option{list-style}{<style>}\Default{plain} Sets the default list style, see section \ref{ssec:customizing_the_list} for details. + \Option{list-preamble-skip}{<skip>}\Default{\cmd{medskipamount}}\sinceversion{0.5}% + Sets the vertical skip (a rubber length) that is inserted if a list preamble + is inserted by using either \cmd{AtNextEndnotesList} or \cmd{AtEveryEndnotesList}. + It's default is set equal to \cmd{medskipamount}. + \Option{list-postamble-skip}{<skip>}\Default{\cmd{medskipamount}}\sinceversion{0.5}% + Sets the vertical skip (a rubber length) that is inserted if a list postamble + is inserted by using either \cmd{AfterNextEndnotesList} or \cmd{AfterEveryEndnotesList}. + It's default is set equal to \cmd{medskipamount}. \end{beschreibung} \subsection{Customizing the List}\label{ssec:customizing_the_list} @@ -312,7 +369,8 @@ be typeset with \verb=\textsuperscript=. You could now use it like this: If you wanted superscripted numbers, you could also redefine \cmd{enmark}. \begin{beschreibung} - \befehl{enmark} is defined like this: \verb=\newcommand*\enmark[1]{#1.}= + \Befehl{enmark}\newline + is defined like this: \verb=\newcommand*\enmark[1]{#1.}= \end{beschreibung} \subsubsection{The \code{list} Template} @@ -343,7 +401,8 @@ Again you can define your own instances using whatever list you want, possibly one defined with the power of \paket{enumitem}. \section{Collect Notes Section-wise and Print List Stepwise}\label{sec:split} -\emph{This feature is experimental and has some limitations}. +\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 \cmd{printendnotes} as often as you like, possibly after each section. That is \emph{not} what is meant here. Let's @@ -365,9 +424,9 @@ You'll need to tell \enotez that you want to split the notes into groups. leading backslash. If the option is not used \enotez will choose \code{subsection*} for \key*{split}{section} and \code{section*} for \key*{split}{chapter}. - \Option{split-title}{<tokenlist>}\Default{Notes from <name> <ref>} + \Option{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 \key*{split}{section} and \code{Chapter} for + by \code{section} for \key*{split}{section} and \code{chapter} for \key*{split}{chapter}. \code{<ref>} is replaced by the corresponding \cmd*{thesection} or \cmd*{thechapter}. \end{beschreibung} @@ -404,11 +463,17 @@ p~\pageref{key:totoc}) the list title is linked via a \verb=\phantomsection=. If \paket{hyperref} is used with \code{hyperfootnotes} set to \code{true} the endnote marks are linked to the respective entries in the list. + +\AtNextEndnotesList{This is an example of a preamble to the list set with +\cmd{AtNextEndnotesList}.} +\AfterEveryEndnotesList{\noindent This is an example of a postamble to the list +set with \cmd{AfterEveryEndnotesList}. Note that it would have started with a +paragraph indent which was prevented here by using \cmd{noindent}.} \printendnotes[addsec] -{\EmbracOff\printbibliography} +\printbibliography -\setindexpreamble{Section titles are indicated \textbf{bold}, packages +\indexprologue{\noindent Section titles are indicated \textbf{bold}, packages \textsf{sans serif}, commands \code{\textbackslash\textcolor{code}{brown}} and options \textcolor{key}{\code{yellow}}.\par\bigskip} 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 13d1da6e65e..f84f22b8c60 100644 --- a/Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex +++ b/Master/texmf-dist/doc/latex/enotez/enotez_split_example.tex @@ -1,7 +1,8 @@ -\documentclass{scrartcl} -% \documentclass{memoir} +% \documentclass{scrartcl} +\documentclass{memoir} % \documentclass{article} -% \usepackage{caption} +\usepackage[english]{babel} +\usepackage{caption} \usepackage[T1]{fontenc} \usepackage{libertine} @@ -9,20 +10,28 @@ \usepackage{kantlipsum} \DeclareInstance{enotez-list}{section}{paragraph}{heading=\section{#1}} -\setenotez{split=section,list-style=section,reset} -% customize the titles in between, e.g.: \setenotez{ - split-sectioning=textbf, - split-title=\par\noindent<name> <ref>: + split=section, + list-style=section, + reset, +% customize the titles in between, e.g.: +% split-sectioning=addsec, +% split-title=\par\noindent<name> <ref>: } \usepackage{fnpct} -\AdaptNote\endnote\multendnote +% \AdaptNote\endnote\multendnote \usepackage{mwe} \usepackage[colorlinks]{hyperref} \begin{document} +\makeatletter +% \texttt{\meaning\@@makecaption} +\makeatother + +\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.}. diff --git a/Master/texmf-dist/tex/latex/enotez/enotez.sty b/Master/texmf-dist/tex/latex/enotez/enotez.sty index 10ea9a1bc5b..18430f8f35b 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 2011-2012 Clemens Niederberger +% Copyright 2011-2013 Clemens Niederberger % % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -28,51 +28,79 @@ % If you have any ideas, questions, suggestions or bugs to report, please % feel free to contact me. % -------------------------------------------------------------------------- -\RequirePackage{ expl3 , xparse , l3keys2e , xtemplate } +\RequirePackage{ expl3 , xparse , l3keys2e , xtemplate , etoolbox , xpatch , scrlfile } \ProvidesExplPackage {enotez} - {2012/12/30} - {0.4} + {2013/03/18} + {0.5a} {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. + } + +% -------------------------------------------------------------------------- % 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_split_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_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~from~<name>~<ref> } -\tl_new:N \l_enotez_list_splitted_title_tl - -\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 -\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_man_prop +\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_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 + +\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_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 \l__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 \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 +\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_man_prop % -------------------------------------------------------------------------- % options: @@ -81,35 +109,39 @@ \keys_define:nn { enotez } { - list-name .tl_set:N = \l_enotez_list_name_tl , - reset .bool_set:N = \l_enotez_reset_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_code:n = - \cs_set_eq:Nc \enotez_counter_format:n { int_to_ \l_keys_choice_tl :n } , + \cs_set_eq:Nc \enotez_counter_format:n { int_to_ \l_keys_choice_tl :n } , counter-format .generate_choices:n = - { arabic , alph , Alph , roman , Roman } , + { arabic , alph , Alph , roman , Roman } , mark-format .code:n = - \cs_set:Npn \enmarkstyle { #1 } , + \cs_set:Npn \enmarkstyle { #1 } , mark-cs .code:n = - \cs_set:Npn \enotezwritemark { #1 } , + \cs_set:Npn \enotezwritemark { #1 } , totoc .choice_code:n = \tl_if_eq:VnTF \l_keys_choice_tl { false } - { \bool_set_false:N \l_enotez_totoc_bool } + { \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 - } , + \bool_set_true:N \l__enotez_totoc_bool + \tl_set_eq:NN \l__enotez_totoc_tl \l_keys_choice_tl + } , totoc .generate_choices:n = - { section , chapter , false } , + { section , chapter , false } , split .choice_code:n = \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 , + { \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 .generate_choices:n = - { section , chapter , false } , - split-sectioning .tl_set:N = \l_enotez_splitted_list_sectioning_tl , - split-title .tl_set:N = \l_enotez_splitted_title_tl , - list-style .tl_set:N = \l_enotez_list_instance_tl , + { section , chapter , false } , + split-sectioning .tl_set:N = \l__enotez_splitted_list_sectioning_tl , + 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 } \cs_generate_variant:Nn \tl_if_eq:nnTF { Vn , nx } \cs_generate_variant:Nn \tl_if_eq:nnT { xx } @@ -120,7 +152,7 @@ % #2: mark \cs_new:Npn \enotez_write_mark:nn #1#2 { - \bool_if:NTF \l_enotez_hyperfootnotes_bool + \bool_if:NTF \l__enotez_hyperfootnotes_bool { \enotezwritemark { \hyperlink { enz.#1 } { \enmarkstyle #2 } } } { \enotezwritemark { \enmarkstyle #2 } } } @@ -128,54 +160,54 @@ % the internal endnote: \cs_new:Npn \enotez_endnote:nn #1#2 { - \int_gincr:N \g_enotez_endnote_id_int + \int_gincr:N \g__enotez_endnote_id_int \quark_if_no_value:nTF { #1 } { - \int_gincr:N \g_enotez_endnote_mark_int + \int_gincr:N \g__enotez_endnote_mark_int \enotez_write_mark:nn - { \int_use:N \g_enotez_endnote_id_int } - { \enotez_counter_format:V \g_enotez_endnote_mark_int } - \tl_set:Nn \l_tmpa_tl { chapter } + { \int_use:N \g__enotez_endnote_id_int } + { \enotez_counter_format:V \g__enotez_endnote_mark_int } + \tl_set:Nn \l__enotez_tmpa_tl { chapter } \bool_if:nTF - { \l_enotez_split_bool && \tl_if_eq_p:NN \l_enotez_split_tl \l_tmpa_tl } + { \l__enotez_split_bool && \tl_if_eq_p:NN \l__enotez_split_tl \l__enotez_tmpa_tl } { \enotez_save_note:xxxxnn - { \int_use:N \g_enotez_endnote_id_int } - { \int_use:N \g_enotez_endnote_mark_int } - { \int_use:N \g_enotez_list_printed_int } + { \int_use:N \g__enotez_endnote_id_int } + { \int_use:N \g__enotez_endnote_mark_int } + { \int_use:N \g__enotez_list_printed_int } { \thechapter } { a } { #2 } } { \enotez_save_note:xxxxnn - { \int_use:N \g_enotez_endnote_id_int } - { \int_use:N \g_enotez_endnote_mark_int } - { \int_use:N \g_enotez_list_printed_int } + { \int_use:N \g__enotez_endnote_id_int } + { \int_use:N \g__enotez_endnote_mark_int } + { \int_use:N \g__enotez_list_printed_int } { \thesection } { a } { #2 } } } { - \enotez_write_mark:nn { \int_use:N \g_enotez_endnote_id_int } { #1 } - \tl_set:Nn \l_tmpa_tl { chapter } + \enotez_write_mark:nn { \int_use:N \g__enotez_endnote_id_int } { #1 } + \tl_set:Nn \l__enotez_tmpa_tl { chapter } \bool_if:nTF - { \l_enotez_split_bool && \tl_if_eq_p:NN \l_enotez_split_tl \l_tmpa_tl } + { \l__enotez_split_bool && \tl_if_eq_p:NN \l__enotez_split_tl \l__enotez_tmpa_tl } { \enotez_save_note:xnxxnn - { \int_use:N \g_enotez_endnote_id_int } + { \int_use:N \g__enotez_endnote_id_int } { #1 } - { \int_use:N \g_enotez_list_printed_int } + { \int_use:N \g__enotez_list_printed_int } { \thechapter } { m } { #2 } } { \enotez_save_note:xnxxnn - { \int_use:N \g_enotez_endnote_id_int } + { \int_use:N \g__enotez_endnote_id_int } { #1 } - { \int_use:N \g_enotez_list_printed_int } + { \int_use:N \g__enotez_list_printed_int } { \thesection } { m } { #2 } @@ -185,72 +217,92 @@ % -------------------------------------------------------------------------- % in some cases caption making commands need to be patched. preparations: -\cs_new:Npn \enotez_tmp_endnote:nn {} +\cs_new:Npn \__enotez_tmp_endnote:nn {} -\cs_new:Npn \enotez_caption_endnote:nn #1#2 +\cs_new_protected:Npn \enotez_caption_endnote:nn #1#2 { \quark_if_no_value:nTF { #1 } { \enotez_write_mark:nn - { \int_use:N \g_enotez_endnote_id_int } - { \enotez_counter_format:V \g_enotez_endnote_mark_int } + { \int_use:N \g__enotez_endnote_id_int } + { \enotez_counter_format:V \g__enotez_endnote_mark_int } } - { \enotez_write_mark:nn { \int_use:N \g_enotez_endnote_id_int } { #1 } } + { \enotez_write_mark:nn { \int_use:N \g__enotez_endnote_id_int } { #1 } } } -\cs_new:Npn \enotez@koma@disable +\cs_new_protected:Npn \enotez@koma@disable { \cs_set_eq:NN \enotez_endnote:nn \enotez_caption_endnote:nn } -\cs_new:Npn \enotez@memoir@disable +\cs_new_protected:Npn \enotez@memoir@disable { - \cs_set_eq:NN \enotez_tmp_endnote:nn \enotez_endnote:nn + \cs_set_eq:NN \__enotez_tmp_endnote:nn \enotez_endnote:nn \cs_set_eq:NN \enotez_endnote:nn \enotez_caption_endnote:nn } -\cs_new:Npn \enotez@memoir@enable - { \cs_set_eq:NN \enotez_endnote:nn \enotez_tmp_endnote:nn } +\cs_new_protected:Npn \enotez@memoir@enable + { \cs_set_eq:NN \enotez_endnote:nn \__enotez_tmp_endnote:nn } -\cs_new:Npn \enotez@caption@disable +\cs_new_protected:Npn \enotez@caption@disable { - \patchcmd \caption@@make + \xpatchcmd \caption@@make { \caption@@@make } { \enotez@koma@disable\caption@@@make } - {}{} + { \bool_set_true:N \l__enotez_caption_patched_bool } + { \bool_set_false:N \l__enotez_caption_patched_bool } } % if we're in a KOMA class, \@@makecaption needs to be patched: -\AtBeginDocument +\cs_if_free:NF \KOMAClassName { - \@ifpackageloaded { caption } - { \RequirePackage { etoolbox } \enotez@caption@disable } - { - \cs_if_free:NF \KOMAClassName - { - \RequirePackage { etoolbox } - \patchcmd \@@makecaption - { \setlength{\@tempdima}{\cap@width} } - { \enotez@koma@disable\setlength{\@tempdima}{\cap@width} }{}{} - } - } + \xpatchcmd \@@makecaption + { \setlength{\@tempdima}{\cap@width} } + { \enotez@koma@disable\setlength{\@tempdima}{\cap@width} } + { \bool_set_true:N \l__enotez_koma_patched_bool } + { \bool_set_false:N \l__enotez_koma_patched_bool } + \AfterPackage+ { caption } { \enotez@caption@disable } } % if we're in memoir, \@makecaption needs to be patched: -\@ifclassloaded { memoir } +% TODO: fails when caption has been loaded, needs to be reworked +\AfterClass+ { memoir } { - \AtBeginDocument + \AtEndPreamble { - \@ifpackageloaded { caption } { } + \cs_if_exist:cF { ver@caption.sty } { - \RequirePackage { etoolbox } - \patchcmd \@makecaption + \xpatchcmd \@makecaption { \let\@contfnote\footnote } - { \enotez@memoir@disable\let\@contfnote\footnote }{}{} - \patchcmd \@makecaption + { \enotez@memoir@disable\let\@contfnote\footnote } + { \bool_set_true:N \l__enotez_memoir_patched_bool } + { \bool_set_false:N \l__enotez_memoir_patched_bool } + \xpatchcmd \@makecaption { \let\footnote\@contfnote } - { \enotez@memoir@enable\let\footnote\@contfnote }{}{} + { \enotez@memoir@enable\let\footnote\@contfnote } + { \bool_set_true:N \l__enotez_memoir_patched_bool } + { \bool_set_false:N \l__enotez_memoir_patched_bool } } } - }{} + } + +\AtBeginDocument + { + \bool_if:nT + { \cs_if_exist_p:c { ver@caption.sty } && !\l__enotez_caption_patched_bool } + { \AfterPackage+ { caption } { \enotez@caption@disable } } + \bool_if:nT + { + ( \cs_if_exist_p:c { ver@memoir.cls } && !\l__enotez_memoir_patched_bool ) + || + ( + !\cs_if_exist_p:c { ver@memoir.cls } && + \cs_if_exist_p:c { ver@caption.sty } && + !\l__enotez_caption_patched_bool + ) + || + ( \cs_if_exist_p:N \KOMAClassName && !\l__enotez_koma_patched_bool ) + } + { \msg_warning:nn { enotez } { captions } } + } % -------------------------------------------------------------------------- % save the notes to the aux file: @@ -260,28 +312,33 @@ % #4 section/chapter % #5 a/m (automatic/manually) % #6 text -\cs_new:Npn \enotez_save_note:nnnnnn #1#2#3#4#5#6 +\cs_new_protected:Npn \enotez_save_note:nnnnnn #1#2#3#4#5#6 { \iow_now:Nn \@auxout { \enotez@note { #1 } { #2 } { #3 } { #4 } { #5 } { #6 } } } \cs_generate_variant:Nn \enotez_save_note:nnnnnn { xxxxnn , xnxxnn } -\cs_new:Npn \enotez@note #1#2#3#4#5#6 +\cs_new_protected:Npn \enotez@note #1#2#3#4#5#6 { \expandafter \xdef \csname enotez@#1@note \endcsname { #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_man_prop { #1 } { #5 } - \prop_gput:Nnn \g_enotez_endnote_text_prop { #1 } { #6 } + \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_man_prop { #1 } { #5 } + \prop_gput:Nnn \g__enotez_endnote_text_prop { #1 } { #6 } } % a try to check if a rerun is necessary: +\tl_new:N \l__enotez_change_tl + \AtEndDocument { - \cs_set:Npn \enotez@note #1#2#3#4#5#6 + \cs_set_protected:Npn \enotez@note #1#2#3#4#5#6 { - \def\reserved@a{#2} - \expandafter\ifx\csname enotez@#1@note \endcsname\reserved@a\else - \@tempswatrue\fi + \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. } + } } } @@ -314,62 +371,64 @@ \DeclareTemplateCode { enotez-list } { paragraph } { 1 } { heading = \enotez_list_heading:n , - format = \l_enotez_list_format_tl , + 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 , + 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_totoc_bool { - \bool_if:NT \l_enotez_hyperref_bool { \phantomsection } - \addcontentsline { toc } { \l_enotez_totoc_tl } { \l_enotez_list_name_tl } + \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 } - \group_begin: - \tl_use:N \l_enotez_list_format_tl - \int_zero:N \l_enotez_tmpa_int - \int_do_while:nn { \l_enotez_tmpa_int <= \g_enotez_list_printed_int } + \enotez_list_heading:n { \l__enotez_list_name_tl } + \enotez_list_preamble: + \group_begin: + \tl_use:N \l__enotez_list_format_tl + \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 + \prop_map_inline:Nn \g__enotez_endnote_mark_prop { \tl_if_eq:xxT - { \int_use:N \l_enotez_tmpa_int } - { \prop_get:Nn \g_enotez_endnote_split_prop { ##1 } } + { \int_use:N \l__enotez_tmpa_int } + { \prop_get: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 + \bool_if:NT \l__enotez_print_note_bool { \par\noindent \llap { \enotez_list_number:n { - \bool_if:NT \l_enotez_hyperfootnotes_bool + \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_use:N \l__enotez_list_number_format_tl \tl_if_eq:nxTF { a } - { \prop_get:Nn \g_enotez_endnote_man_prop { ##1 } } - { \enotez_counter_format:V \l_enotez_endnote_mark_tl } - { \tl_use:N \l_enotez_endnote_mark_tl } + { \prop_get:Nn \g__enotez_endnote_man_prop { ##1 } } + { \enotez_counter_format:V \l__enotez_endnote_mark_tl } + { \tl_use:N \l__enotez_endnote_mark_tl } } \tl_use:N \c_space_tl } - \tl_use:N \l_enotez_endnote_text_tl + \tl_use:N \l__enotez_endnote_text_tl } } \par - \dim_compare:nT { \l_enotez_list_notes_sep_dim != 0pt } - { \addvspace { \l_enotez_list_notes_sep_dim } } + \dim_compare:nT { \l__enotez_list_notes_sep_dim != 0pt } + { \addvspace { \l__enotez_list_notes_sep_dim } } } - \int_incr:N \l_enotez_tmpa_int + \int_incr:N \l__enotez_tmpa_int } \group_end: + \enotez_list_postamble: } \DeclareTemplateInterface { enotez-list } { list } { 1 } @@ -384,67 +443,69 @@ \DeclareTemplateCode { enotez-list } { list } { 1 } { heading = \enotez_list_heading:n , - format = \l_enotez_list_format_tl , + 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 + 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_totoc_bool { - \bool_if:NT \l_enotez_hyperref_bool { \phantomsection } - \addcontentsline { toc } { \l_enotez_totoc_tl } { \l_enotez_list_name_tl } + \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_heading:n { \l__enotez_list_name_tl } + \enotez_list_preamble: \group_begin: - \tl_use:N \l_enotez_list_format_tl - \int_zero:N \l_enotez_tmpa_int - \int_do_while:nn { \l_enotez_tmpa_int <= \g_enotez_list_printed_int } + \tl_use:N \l__enotez_list_format_tl + \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 + \prop_map_inline:Nn \g__enotez_endnote_mark_prop { - \tl_clear:N \l_enotez_tmpc_tl + \tl_clear:N \l__enotez_tmpc_tl \tl_if_eq:xxT - { \int_use:N \l_enotez_tmpa_int } - { \prop_get:Nn \g_enotez_endnote_split_prop { ##1 } } - { \tl_put_right:Nn \l_enotez_tmpc_tl { ##1 } } - \tl_if_blank:VF \l_enotez_tmpc_tl + { \int_use:N \l__enotez_tmpa_int } + { \prop_get: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 } - \begin{\l_enotez_list_type_tl} + \begin{\l__enotez_list_type_tl} } \tl_if_eq:xxT - { \int_use:N \l_enotez_tmpa_int } - { \prop_get:Nn \g_enotez_endnote_split_prop { ##1 } } + { \int_use:N \l__enotez_tmpa_int } + { \prop_get:Nn \g__enotez_endnote_split_prop { ##1 } } { \enotez_get_note:nn { #1 } { ##1 } - \bool_if:NT \l_enotez_print_note_bool + \bool_if:NT \l__enotez_print_note_bool { \item [ \enotez_list_number:n { - \bool_if:NT \l_enotez_hyperfootnotes_bool + \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_use:N \l__enotez_list_number_format_tl \tl_if_eq:nxTF { a } - { \prop_get:Nn \g_enotez_endnote_man_prop { ##1 } } - { \enotez_counter_format:V \l_enotez_endnote_mark_tl } - { \tl_use:N \l_enotez_endnote_mark_tl } + { \prop_get:Nn \g__enotez_endnote_man_prop { ##1 } } + { \enotez_counter_format:V \l__enotez_endnote_mark_tl } + { \tl_use:N \l__enotez_endnote_mark_tl } } ] - \tl_use:N \l_enotez_endnote_text_tl + \tl_use:N \l__enotez_endnote_text_tl } } - \tl_if_blank:VF \l_enotez_tmpc_tl { \end{\l_enotez_list_type_tl} } + \tl_if_blank:VF \l__enotez_tmpc_tl { \end{\l__enotez_list_type_tl} } } - \int_incr:N \l_enotez_tmpa_int + \int_incr:N \l__enotez_tmpa_int } \group_end: + \enotez_list_postamble: } % some default styles: @@ -453,74 +514,78 @@ \DeclareInstance { enotez-list } { itemize } { list } { list-type = itemize } % the titles in between the splits: -\cs_new:Npn \enotez_read_splitted_title:nn #1#2 +\cs_new_protected:Npn \enotez_read_splitted_title:nn #1#2 { \group_begin: - \tl_set:Nn \l_tmpa_tl { #1 } - \tl_replace_all:Nnn \l_tmpa_tl { <name> } - { \enotez_first_upper:V \l_enotez_split_tl } - \tl_replace_all:Nnn \l_tmpa_tl { <ref> } - { \prop_get:Nn \g_enotez_endnote_sect_prop { #2 } } - \tl_use:N \l_tmpa_tl + \tl_set:Nn \l__enotez_tmpa_tl { #1 } + \tl_replace_all:Nnx \l__enotez_tmpa_tl { <name> } + { \l__enotez_actual_sectioning_tl } + \tl_replace_all:Nnx \l__enotez_tmpa_tl { <ref> } + { \prop_get:Nn \g__enotez_endnote_sect_prop { #2 } } + \tl_gset_eq:NN \l__enotez_tmpb_tl \l__enotez_tmpa_tl \group_end: } -\cs_generate_variant:Nn \enotez_read_splitted_title:nn { V } +\cs_generate_variant:Nn \enotez_read_splitted_title:nn { V , x } +\cs_generate_variant:Nn \tl_replace_all:Nnn { Nnx } -\cs_new:Npn \enotez_first_upper:n #1 +\cs_new_protected:Npn \enotez_first_upper:n #1 { \tl_to_uppercase:n { \tl_head:n { #1 } } \tl_tail:n { #1 } } \cs_generate_variant:Nn \enotez_first_upper:n { V } % determine which note's next: -\cs_new:Npn \enotez_get_note:nn #1#2 +\cs_new_protected:Npn \enotez_get_note:nn #1#2 { \IfBooleanTF { #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_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 + \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 - \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 + \bool_set_true:N \l__enotez_print_note_bool + \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 } + \int_compare:nTF { \l__enotez_tmpa_tl = \g__enotez_list_printed_int } { - \bool_set_true:N \l_enotez_print_note_bool - \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_gdel:Nn \g_enotez_endnote_split_prop { #2 } + \bool_set_true:N \l__enotez_print_note_bool + \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 } + { \bool_set_false:N \l__enotez_print_note_bool } } } } -\cs_new:Npn \enotez_get_split_title:n #1 +\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 + \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_tmpb_tl + \tl_if_eq:NNF \l__enotez_tmpa_tl \l__enotez_tmpb_tl { - \tl_if_blank:VTF \l_enotez_splitted_list_sectioning_tl + \tl_if_eq:VnTF \l__enotez_split_tl { section } + { \tl_set_eq:NN \l__enotez_actual_sectioning_tl \l__enotez_section_tl } + { \tl_set_eq:NN \l__enotez_actual_sectioning_tl \l__enotez_chapter_tl } + \enotez_read_splitted_title:xn + { \l__enotez_splitted_title_tl } + { #1 } + \tl_if_blank:VTF \l__enotez_splitted_list_sectioning_tl { - \tl_if_eq:VnTF \l_enotez_split_tl { section } + \tl_if_eq:VnTF \l__enotez_split_tl { section } { \subsection* } { \section* } } - { \use:c { \l_enotez_splitted_list_sectioning_tl } } - { - \enotez_read_splitted_title:Vn - \l_enotez_splitted_title_tl { #1 } - } + { \use:c { \l__enotez_splitted_list_sectioning_tl } } + { \exp_not:V \l__enotez_tmpb_tl } } } - \prop_get:NnN \g_enotez_endnote_split_prop { #1 } \l_enotez_tmpb_tl + \prop_get:NnN \g__enotez_endnote_split_prop { #1 } \l__enotez_tmpb_tl } % the marks in the list: @@ -531,66 +596,130 @@ \cs_new_eq:NN \enotezwritemark \textsuperscript % internal printendnotes: -\cs_new:Npn \enotez_print_endnotes:nn #1#2 +\cs_new_protected:Npn \enotez_print_endnotes:nn #1#2 { \IfNoValueTF { #2 } - { \UseInstance { enotez-list } { \l_enotez_list_instance_tl } } + { \UseInstance { enotez-list } { \l__enotez_list_instance_tl } } { \UseInstance { enotez-list } { #2 } } { #1 } - \bool_if:NF \l_enotez_split_bool + \bool_if:NF \l__enotez_split_bool { - \bool_if:NTF \l_enotez_reset_bool - { \int_gzero:N \g_enotez_endnote_mark_int } - \int_gincr:N \g_enotez_list_printed_int + \bool_if:NTF \l__enotez_reset_bool + { \int_gzero:N \g__enotez_endnote_mark_int } + \int_gincr:N \g__enotez_list_printed_int } } % the user command: \NewDocumentCommand \printendnotes { so } { - \bool_if:NTF \l_enotez_split_bool + \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 } } + +% -------------------------------------------------------------------------- % process the options: \ProcessKeysOptions { enotez } \AtBeginDocument { - \bool_if:NT \l_enotez_split_bool + \bool_if:NT \l__enotez_split_bool { - \tl_if_eq:VnTF \l_enotez_split_tl { section } + \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 - { \int_gzero:N \g_enotez_endnote_mark_int } + \int_gincr:N \g__enotez_list_printed_int + \bool_if:NT \l__enotez_reset_bool + { \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 - { \int_gzero:N \g_enotez_endnote_mark_int } + \int_gincr:N \g__enotez_list_printed_int + \bool_if:NT \l__enotez_reset_bool + { \int_gzero:N \g__enotez_endnote_mark_int } } } } \@ifpackageloaded { hyperref } { - \bool_set_true:N \l_enotez_hyperref_bool + \bool_set_true:N \l__enotez_hyperref_bool \ifHy@hyperfootnotes - \bool_set_true:N \l_enotez_hyperfootnotes_bool + \bool_set_true:N \l__enotez_hyperfootnotes_bool \else - \bool_set_false:N \l_enotez_hyperfootnotes_bool + \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 + \bool_set_false:N \l__enotez_hyperref_bool + \bool_set_false:N \l__enotez_hyperfootnotes_bool } } @@ -599,6 +728,58 @@ \NewDocumentCommand \setenotez { +m } { \keys_set:nn { enotez } { #1 } \ignorespaces } +% -------------------------------------------------------------------------- +% 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: @@ -614,7 +795,15 @@ 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 % -------------------------------------------------------------------------- % TODO: +- add \endnotemark and \endnotetext - make the headings obey the `totoc' option?
\ No newline at end of file |