diff options
author | Norbert Preining <norbert@preining.info> | 2020-04-11 03:09:12 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2020-04-11 03:09:12 +0000 |
commit | c2697fc286a1e2c94fd9968b76be6f4a6d2114cd (patch) | |
tree | 1dc2cfb07cb032740483dd8be7c74aff66b70352 /macros/latex/contrib/endnotes-hy | |
parent | 25111608e6aa05042b0c6f83009262e1973d7a45 (diff) |
CTAN sync 202004110309
Diffstat (limited to 'macros/latex/contrib/endnotes-hy')
-rw-r--r-- | macros/latex/contrib/endnotes-hy/README.md | 19 | ||||
-rw-r--r-- | macros/latex/contrib/endnotes-hy/docs/endnotes-hy.pdf | bin | 0 -> 252245 bytes | |||
-rw-r--r-- | macros/latex/contrib/endnotes-hy/endnotes-hy.dtx | 249 | ||||
-rw-r--r-- | macros/latex/contrib/endnotes-hy/endnotes-hy.ins | 60 | ||||
-rw-r--r-- | macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.pdf | bin | 0 -> 88245 bytes | |||
-rw-r--r-- | macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.tex | 81 |
6 files changed, 409 insertions, 0 deletions
diff --git a/macros/latex/contrib/endnotes-hy/README.md b/macros/latex/contrib/endnotes-hy/README.md new file mode 100644 index 0000000000..7ed5b175f5 --- /dev/null +++ b/macros/latex/contrib/endnotes-hy/README.md @@ -0,0 +1,19 @@ +The endnotes-hy package +Author: D. P. Story +Dated: 2020-04-08 + +This is a short package to support the creation of hypertext +links in support of the endnotes package. The package modifies +the syntax of the \endnote command: +\endnote*[<num>]{<text>}\label{<name>}. When the *-option is +used, no endnote mark is created, but the endnote itself is +written. The \label command appears at the end of the \endnote +and its arguments, rather than within the argument of the <text> +argument. + +Now, I simply must get back to my retirement. + +D. P. Story +www.acrotex.net +dpstory@uakron.edu +dpstory@acrotex.net diff --git a/macros/latex/contrib/endnotes-hy/docs/endnotes-hy.pdf b/macros/latex/contrib/endnotes-hy/docs/endnotes-hy.pdf Binary files differnew file mode 100644 index 0000000000..55299b7b59 --- /dev/null +++ b/macros/latex/contrib/endnotes-hy/docs/endnotes-hy.pdf diff --git a/macros/latex/contrib/endnotes-hy/endnotes-hy.dtx b/macros/latex/contrib/endnotes-hy/endnotes-hy.dtx new file mode 100644 index 0000000000..3f69d7a642 --- /dev/null +++ b/macros/latex/contrib/endnotes-hy/endnotes-hy.dtx @@ -0,0 +1,249 @@ +% \iffalse +% makeindex -s gglo.ist -o endnotes-hy.gls endnotes-hy.glo +% makeindex -s gind.ist -o endnotes-hy.ind endnotes-hy.idx +%<*copyright> +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% endnotes-hy.sty package, %% +%% Copyright (C) 2020 %% +%% dpstory@uakron.edu dpstory@acrotex.net %% +%% %% +%% This program can redistributed and/or modified under %% +%% the terms of the LaTeX Project Public License %% +%% Distributed from CTAN archives in directory %% +%% macros/latex/base/lppl.txt; either version 1.2 of the %% +%% License, or (at your option) any later version. %% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%</copyright> +%<package>\NeedsTeXFormat{LaTeX2e} +%<package>\ProvidesPackage{endnotes-hy} +%<package> [2020/04/08 v0.1 Enables hypertext links for endnotes] +%<*driver> +\documentclass{ltxdoc} +\usepackage[colorlinks,hyperindex=false,linktocpage,bookmarksnumbered]{hyperref} +\usepackage{calc} +\usepackage{endnotes-hy} +%\def\texorpdfstring#1#2{#1} +%\pdfstringdefDisableCommands{\let\\\textbackslash} +\OnlyDescription % comment out for implementation details +\EnableCrossrefs +\CodelineIndex +\RecordChanges +\gdef\brpr#1{\texttt{\char123\relax#1\char125\relax}} +\let\darg\brpr +\let\env\texttt +\let\opt\texttt +\let\app\textsf +\let\pkg\textsf +\def\EXCL{!} +\def\visispace{\symbol{32}} +\def\ameta#1{\ensuremath{\langle\textit{\texttt{#1}}\rangle}} +\def\meta#1{\textsl{\texttt{#1}}} +\def\SUB#1{\ensuremath{{}_{\mbox{\scriptsize\ttfamily#1}}}} +\def\CMD#1{\textbackslash#1} +\makeatletter +\renewcommand\theparagraph{\texorpdfstring{\protect\P\protect\ }{\textparagraph}} +\renewcommand\thesubparagraph{\texorpdfstring{\protect\P\protect\P\protect\ }{\textparagraph\textparagraph}} +\renewcommand{\section} + {\renewcommand{\@seccntformat}[1]{\thesection\quad}% + \@startsection {section}{1}{\z@}% + {-3.5ex \@plus -1ex \@minus -.2ex}% + {2.3ex \@plus.2ex}% + {\normalfont\Large\bfseries}} +\renewcommand{\paragraph} + {\renewcommand{\@seccntformat}[1]{\theparagraph\unskip\,}% + \@startsection{paragraph}{4}{0pt}{6pt}{-3pt}{\bfseries}} +\renewcommand{\subparagraph} + {\renewcommand{\@seccntformat}[1]{\thesubparagraph\unskip\,}% + \@startsection{subparagraph}{5}{\parindent}{6pt}{-3pt}{\bfseries}} +\makeatother +\newbox\enbox +\InputIfFileExists{aebdocfmt.def}{\PackageWarning{endnotes-hy}{Inputting aebdocfmt.def}} + {\def\IndexOpt{\DescribeMacro}\def\IndexKey{\DescribeMacro}\let\setupFullwidth\relax + \PackageInfo{endnotes-hy}{aebdocfmt.def cannot be found}} +\begin{document} +\addtolength{\marginparwidth}{3pt} + \GetFileInfo{endnotes-hy.sty} + \title{The \textsf{endnotes-hy} Package} + \author{D. P. Story\\ + Email: \texttt{dpstory@uakron.edu}} + \date{processed \today} + \maketitle +\setcounter{secnumdepth}{5} +\setcounter{tocdepth}{5} +\bgroup +\value{secnumdepth}=3 +\value{tocdepth}=3 + \tableofcontents +\egroup + \DocInput{endnotes-hy.dtx} +\IfFileExists{\jobname.ind}{\newpage\setupFullwidth\par\PrintIndex}{\paragraph*{Index} The index goes here. Execute + \begin{quote}\texttt{makeindex -s gind.ist -o endnotes-hy.ind endnotes-hy.idx}\end{quote} + on the command line and recompile + \texttt{endnotes-hy.dtx}.} +\IfFileExists{\jobname.gls}{\PrintChanges}{\paragraph*{Change History} The list of changes goes here. Execute + \begin{quote} + \texttt{makeindex -s gglo.ist -o endnotes-hy.gls endnotes-hy.glo} + \end{quote} + on the command line and recompile \texttt{endnotes-hy.dtx}.} +\end{document} +%</driver> +% \fi +% \MakeShortVerb{|} +% \InputIfFileExists{aebdonotindex.def}{\PackageInfo{web}{Inputting aebdonotindex.def}} +% {\PackageInfo{web}{cannot find aebdonotindex.def}} +% \begin{macrocode} +%<*package> +% \end{macrocode} +% \section{Introduction} +% This package is an extension of \href{https://ctan.org/pkg/endnotes}{\pkg{endnotes}}. +% \changes{v0.1}{2020/04/08}{First published version of this package.} +% +% \paragraph*{Background:} A colleague---a dedicated user of the +% \href{https://ctan.org/pkg/endnotes}{\pkg{endnotes}} package---complained to me +% (for some reason) that links created by \pkg{hyperref} do not point to the +% endnotes at the end of the file; for example, if we say +%\begin{quote}\ttfamily +% \string\endnote\darg{\string\label\darg{\ameta{name}}\ameta{text}} +%\end{quote} +% then any link, such as +% \cs{hyperref[\ameta{name}]\darg{endnote\string~\string\ref*\darg{\ameta{name}}}} jumps +% to the most recent anchor (\texttt{Doc-Start}, for example); no hypertext +% anchor is created where the endnote is inserted into the document. This short +% package is an attempt to rectify this problem. +% +%\paragraph*{Syntax:} +% The \cs{endnote} command has been modified to conform to the following syntax: +%\begin{quote} +% \cs{endnote*[\ameta{num}]\darg{\ameta{text}}\string\label\darg{\ameta{name}}} +%\end{quote} +% Refer to the documentation of the \href{https://ctan.org/pkg/endnotes}{\pkg{endnotes}} package for a description of the \cs{endnote} +% command and its \ameta{num} and \ameta{text} arguments. +% If the \texttt*-option (new syntax) is used, the endnote mark is not placed, but the endnote +% is written to the \texttt{ENT} file.\endnote*{An endnote created with \texttt*-option}\label{en:en*} +% Such a ``secret'' endnote can be referred to using standard \pkg{hyperref} commands, +% see the \autoref{en:en*} on page~\pageref{en:en*} for more information. The placement of the \cs{label} has +% changed for this package as well. To define an endnote label, place \cs{label\darg{name}} following +% the \cs{endnote} command, a more traditional location. This was done to get access to the \ameta{name}, if it exist. +% This enables the package to place a hypertext link around the endnote mark.\endnote{This is normal endnote}\label{en:normal} +% The optional \ameta{num} can be used +% to write special endnotes.{\def\theendnote{N\arabic{endnote}}\endnote[1]{This is special endnote}\label{en:specen}} +% As a side benefit to this new syntax, you can place verbatim text into an +% endnote.\setbox\enbox\hbox{\verb!%^$^&$%^&!}\edef\VertTxti{\unhbox\enbox}\endnote{Some verbatim text \VertTxti}\label{en:verb} +% If there is no \cs{label} following \cs{endnote}, no hypertext link is created.\endnote{No hypertext link created} +% +% \paragraph*{Note:} This package will work correctly without the \pkg{hyperref} package (of course, no links). +% The advantage of using \pkg{endnotes-hy} without \pkg{hyperref} is to use the extended syntax: +% \cs{endnote*[\ameta{num}]\darg{\ameta{text}}\string\label\darg{\ameta{name}}} +% +% \section{Required packages} +% +% \begin{macrocode} +\RequirePackage{endnotes} +% \end{macrocode} +% Require \pkg{etoolbox} because we redefine several commands using \cs{patchcmd}; this is not +% really necessary, we could have redefined the whole command instead. +% \begin{macrocode} +\RequirePackage{etoolbox} +% \end{macrocode} +% \section{Package code} +% We allow the author not to use \pkg{hyperref}; this enables the use of the extended +% syntax of the \cs{endnote} command. +% \begin{macrocode} +\newcommand\hyperref@nohy[2][]{#2} +\AtBeginDocument{\@ifundefined{hyperref}{\let\hyperref@en\hyperref@nohy + \let\phantomendnote\relax} + {\let\hyperref@en\hyperref}} +% \end{macrocode} +% \begin{macro}{\phantomendnote} +% The key is to create an hyperref anchor to reference; this definition is based on +% \cs{phantomsection} of \pkg{hyperref}. This is used internally. +% \begin{macrocode} +\def\phantomendnote{% + \Hy@MakeCurrentHrefAuto{endnote}% + \Hy@raisedlink + {\hyper@anchorstart{endnote.\@theenmark}\hyper@anchorend}} +\def\endnoteautorefname{endnote} +% \end{macrocode} +% \end{macro} +% Redefinition of \DescribeMacro{\theendnotes}\cs{theendnotes} +% \begin{macrocode} +\patchcmd{\theendnotes}{\enoteformat} + {\phantomendnote\def\@currentHref{endnote.\@theenmark}% + \enoteformat}{}{} +% \end{macrocode} +% Redefine \DescribeMacro\endnote\cs{endnote} to take an optional \texttt{*}, if this option is used, the mark does not appear +% in the text. This enables us to easily define an endnote and refer to it even with multiple paragraphs. +% I didn't like the syntax of inserting the \cs{label} within the argument of \cs{endnote}, this seems to have +% problems. The new syntax is as follows:\begin{quote} +% Syntax: \cs{endnote*[\ameta{num}]\darg{\ameta{text}}\string\label\darg{\ameta{name}}}\end{quote} +% This new syntax could be a problem if an author has already used \pkg{endnotes} and then converts +% to \pkg{endnotes-hy}. In \pkg{endnotes} the \texttt*-option is note defined and the \cs{label} +% command is typically placed within the argument of the \darg{\ameta{text}}. Labels would have to be moved +% to a position following \darg{\ameta{text}}. +% +% To obtain this syntax, we need several stages of parsing. The major problem is to get the +% label name in time to build a hyperref link around \cs{@endnotemark}. +% \begin{macrocode} +\newtoks\@entoks +\def\endnote{\let\@encurrlabelname\@empty + \@ifstar{\let\@noMrk1\endnote@i}{\let\@noMrk0\endnote@i}} +\def\endnote@i{\@ifnextchar[%] + {\@xendnote} + {\stepcounter{endnote}% + \protected@xdef\@theenmark{\theendnote}% +% \end{macrocode} +% We placed the \darg{text} argument into a token register, this removes +% that argument from the input stream, and allows us to see of the next token +% is \cs{label}, if so, we get the label name argument. +% \begin{macrocode} + \afterassignment\endnote@ii\@entoks}} +% \end{macrocode} +% If the next token is \cs{label}, get the label name with \cs{endnote@iii}, +% otherwise, move on to \cs{endnote@iv}, the final step. +% \begin{macrocode} +\def\endnote@ii{\@ifnextchar\label{\endnote@iii}{\endnote@iv}} +\def\endnote@iii\label#1{\def\@encurrlabelname{#1}\endnote@iv} +% \end{macrocode} +% If the flag \cs{@noMrk} is 0 (mark is typeset), and if there +% is a label name, we make an hypertext link. +% \begin{macrocode} +\def\endnote@iv{% + \if\@noMrk0\relax + \ifx\@encurrlabelname\@empty + \@endnotemark + \else + \hyperref@en[\@encurrlabelname]{\@endnotemark}% + \fi + \fi +% \end{macrocode} +% Finish by expanding \cs{@endnotetext} with its argument +% that was saved in the \cs{@entoks} register. +% \begin{macrocode} + \expandafter\@endnotetext\expandafter{\the\@entoks}} +% \end{macrocode} +% We patch into \DescribeMacro\@endnotetext\cs{@endnotetext} just after \verb~\def\next{#1}~. +% If there was a \cs{label}, we insert it back into the argument +% of \cs{endnote}. +% \begin{macrocode} +\patchcmd{\@endnotetext} + {\def\next{#1}} + {\ifx\@encurrlabelname\@empty + \def\next{#1}\else + \edef\x{\noexpand\label{\@encurrlabelname}}% + \expandafter\def\expandafter\next\expandafter{\x#1}\fi}{}{} +% \end{macrocode} +% If \cs{endnote} has an optional argument, the flow passes to +% \DescribeMacro\xendnote\cs{xendnote}. We replace +% \verb~\@endnotemark\@endnotetext~ by redirecting flow to +% to \cs{endnote@ii}, after saving the argument in \cs{@entoks}. +% \begin{macrocode} +\patchcmd{\@xendnote} + {\@endnotemark\@endnotetext} + {\afterassignment\endnote@ii\@entoks} + {}{} +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +%\theendnotes +%\Finale diff --git a/macros/latex/contrib/endnotes-hy/endnotes-hy.ins b/macros/latex/contrib/endnotes-hy/endnotes-hy.ins new file mode 100644 index 0000000000..b1104ffe1a --- /dev/null +++ b/macros/latex/contrib/endnotes-hy/endnotes-hy.ins @@ -0,0 +1,60 @@ +%% +%% This file will generate fast loadable files and documentation +%% driver files from the doc files in this package when run through +%% LaTeX or TeX. +%% +%% Copyright 1999-2012 D. P. Story +%% +%% This file is part of the `AcroTeX eDucation Bundle'. +%% ------------------------------------------- +%% +%% It may be distributed under the conditions of the LaTeX Project Public +%% License, either version 1.2 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.2 or later is part of all distributions of LaTeX +%% version 1999/12/01 or later. +%% +%% --------------- start of docstrip commands ------------------ +%% +\def\filedate{2020/04/08} +\def\batchfile{endnotes-hy.ins} + +\input docstrip +\ifx\generate\undefined + \Msg{**********************************************} + \Msg{*} + \Msg{* This installation requires docstrip} + \Msg{* version 2.4 or later.} + \Msg{*} + \Msg{* An older version of docstrip has been input} + \Msg{*} + \Msg{**********************************************} + \errhelp{Move or rename old docstrip.tex and get a newer one.} + \errmessage{Old docstrip in input path} + \batchmode + \csname @@end\endcsname\end +\fi + +\keepsilent +\askforoverwritefalse +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +\preamble +\endpreamble + +\generate +{% + \file{endnotes-hy.sty}{\from{endnotes-hy.dtx}{copyright,package}} +} + +\Msg{***************************************************************} +\Msg{*} +\Msg{* \space To finish the installation you have to copy the files } +\Msg{*} +\Msg{* \space *.sty, *.cfg and *.def into a directory searched by TeX} +\Msg{*} +\Msg{***************************************************************} + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +\endinput diff --git a/macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.pdf b/macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.pdf Binary files differnew file mode 100644 index 0000000000..abfbb86dee --- /dev/null +++ b/macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.pdf diff --git a/macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.tex b/macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.tex new file mode 100644 index 0000000000..ab523dfffe --- /dev/null +++ b/macros/latex/contrib/endnotes-hy/examples/exmpl-endnotes.tex @@ -0,0 +1,81 @@ +\documentclass{article} +\usepackage{xcolor} +\usepackage{endnotes-hy} + +\usepackage{hyperref} +\hypersetup{colorlinks,linkcolor=red} + +\usepackage{fancyvrb} + +\def\cs#1{\texttt{\char`\\#1}} + +% used to create verbatim endnotes +\newbox\enbox +\setbox\enbox\hbox{\verb!%^$^&$%^&!} +\edef\VertTxti{\unhbox\enbox} + +% Use to get indentation in multi-paragraph endnotes +\def\enPAR{\par\hskip15pt} + +\makeatletter +% the use of \everypar is to get proper alignment of the left margin +% in multi-paragraph endnotes. +\def\enoteformat{% + \rightskip\z@ \leftskip\z@ \parindent=1.8em + \everypar{\hangindent=\parindent \hangafter=1}% + \leavevmode\llap{\makeenmark}} +\makeatother + +% Modify how the endnote mark looks at the end. +\patchcmd{\theendnotes} + {\makeatletter} + {\makeatletter + \renewcommand\makeenmark{\textbf{\theenmark{}.} }} + {}{} + +\usepackage{lipsum} + +\begin{document} + +%\show\enoteformat + +\section{Making endnotes clickable}\label{MkClk} + +The new syntax for the \cs{endnote} command is, +\begin{Verbatim}[xleftmargin=15pt] +\endnote*[<num>]{<note-text>}\label{<name>} +\end{Verbatim} +The use of \texttt* causes the endnote mark not to appear. If \verb!\label{<name>}! appears, +a hypertext links is created pointing to the placement of the endnote at the end of the document. + +\begin{itemize} + +\item Some beginning text.\endnote{My endnote text.}\label{judy} + +\item Refer to endnote.\endnote{Tom Terrific!}\label{tom} + +\item Another method is to use the \texttt*-form and use +\verb~\autoref~\endnote*{Alex-tastic!}\label{alex} to display +the reference to \autoref{alex}. + +\item Now make another endnote.\endnote{Kira's endnote is a very long one. + Kira's endnote is a very long one. Kira's endnote is a very long one.\enPAR + Kira's endnote is a very long one. Kira's endnote is a very long one. + Kira's endnote is a very long one.}\label{kira} + +\item This is an endnote with two paragraphs\endnote*{Don is good.\par Tom is better.}\label{multipar} in endnote~\ref{multipar}. + +\item Here, we try \verb!\Nameref!, \verb~\nameref~, \verb~\autoref~: \Nameref{tom}, \nameref{tom}, \autoref{tom}. + +\item This is a specially number endnote.{\def\theendnote{N\arabic{endnote}}\endnote[1]{A special end note, verbatim: \VertTxti.}\label{cusNum}} + +\item We reference endnote\endnote{Don's endnote is here!}\label{don} on page~\pageref{don}. + +\end{itemize} +\lipsum[1] + +\newpage + +\theendnotes + +\end{document} |