Cross-referencing on 2 kinds of end-footnotes (separated and with different coloured numbers)

In the beginning I used parnotes and endnotes to distinguish between the 2 seperated kinds of end-footnotes:

\documentclass{article}

\usepackage{changepage} % \begin{adjustwidth}{...cm}{...cm}

\usepackage[colorlinks=true,linkcolor=red]{hyperref} % colors endnotes red --- for hyperlinks --- hyperref permits use of color{blue}{...}
\usepackage{endnotes} % \endnote{...}
\input{hyperendnotes.sty} % LOADS (needs \usepackage{hyperref}) hyperendnotes.sty; which can be downloaded at
% https://github.com/bibliogum/latexamu/blob/master/hyperendnotes.sty

\def\enoteheading{} % endnotes without standard heading

\usepackage[breakwithin, roman]{parnotes} % parnotes

\makeatletter % needed for \renewcommand{...} and \patchcmd{...}
\renewcommand{\parnotemarkfmt}[1]{{{\color{blue}\PN@mark@set{#1}\hspace{0.5mm}}}} % color parnotes blue --- tweaks spacing --- adjusts size of parnotes to look like hyperendnotes (part 1)
\usepackage{etoolbox} % \patchcmd{...}
\patchcmd{\PN@parnote@real}
{\parnotemarkfmt{PN@t}}
{\textsuperscript{\hspace{1.23mm}\parnotemarkfmt{PN@t}\hspace{-0.67mm}}}
{}{} % <<< adjusts size of parnotes to look like hyperendnotes (part 2) --- thanks a lot for this part @egreg; at
% https://tex.stackexchange.com/questions/219000/a-question-about-using-a-renewcommand-to-adapt-a-package/219007#219007
\makeatother % needed for \renewcommand{...} and \patchcmd{...}

\begin{document}

\noindent Some text \parnote{A parnote} \parnote{Another parnote} \endnote{An endnote} \parnote{Another parnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \parnote{Another parnote} \parnote{Another parnote} \parnote{Another parnote} \parnote{Another parnote} \endnote{Another endnote} \parnote{Another parnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \endnote{Another endnote} \parnote{Another parnote} \endnote{Another endnote} \parnote{Another parnote} \parnote{Another parnote} \par
\noindent \textbf{Parnotes}
\parnotes
\textbf{Endnotes} \par
\begin{adjustwidth}{2.49mm}{0cm}
\theendnotes
\end{adjustwidth}

\end{document}


But that didn't get cross-referencing (clickable links) on the parnotes ...

Loading hyperendnotes.sty only puts clickable cross-referenced "links" on the \endnote{...}'s, but not on the \parnote{...}'s.

So user @cfr hinted at the enotez-package. I've found \usepackage{enotez} at least easier, since it doesn't require to load the extra hyperendnotes.sty any more.

In this second trial I only used endnotes (I dropped parnotes, since I wasn't able to get clickable hyperlinks on them.

In this second trial I only used endnotes (I dropped parnotes, since I wasn't able to get clickable hyperlinks on them.

• Attention: This second "grey box" of trial code requires to compile two times. (due to the enotez-package).

\documentclass{article}

\usepackage{enotez}
\DeclareInstance{enotez-list}{section}{paragraph}{heading={}}
\setenotez{backref=true, list-style=section, reset, split-title=\noindent}

\usepackage{hyperref}
\hypersetup{colorlinks=true}
\usepackage{biblatex}

\begin{document}

\hypersetup{linkcolor=red}

Som text here \endnote{Endnote}. \par
Some more text \endnote{Endnote} before the first call of \colorbox{gray!20}{\textbackslash printendnotes}.

\vspace{1em} \textbf{A first person's endnotes} \printendnotes \vspace{1em}

\setenotez{counter-format={roman}} \hypersetup{linkcolor=blue}

See? I can get clickable endnotes in two different colours, which is what I wanted. \endnote{Endnote}. \par {\large{But the problem is that ALL of the endnotes (of a certain colour) have to be grouped together and originate before the first \colorbox{gray!20}{\textbackslash printendnotes} and before ALL of the other endnotes (of another colour): there is no freedom to use the endnotes "interwoven", unfortunately.}} \endnote{Endnote}.

\vspace{1em} \textbf{A second person's endnotes} \printendnotes \vspace{2em}

\setenotez{counter-format={arabic}} \hypersetup{linkcolor=red}

You can get both footnote sections to truly follow each-other at the end of the document \endnote{Endnote} (which is what i wanted), by using a lot of \colorbox{gray!20}{\textbackslash vspace}'s (see the .tex-code below this line). But having to constantly adjust the \colorbox{gray!20}{\textbackslash vspace}'s doesn't seem very elegant at all. \endnote{Endnote}

\vspace{8.2em}% extra \vspace{...} to group the endnote sections together at the end of the .pdf

\vspace{1em} \textbf{A first person's endnotes} \printendnotes \vspace{1em}

\setenotez{counter-format={roman}} \hypersetup{linkcolor=blue}

\vspace{-15em}% extra \vspace{...} to group the endnote sections together at the end of the .pdf

See?\endnote{Endnote} Now the the sections are really together \endnote{Endnote} at the very end of the document. \par However: the {\large{origins of the two different types of endnotes still have to be grouped together, and cannot get interwoven, unfortunately.}}

\vspace{8em}% extra \vspace{...} to group the endnote sections together at the end of the .pdf

\vspace{1em} \textbf{A second person's endnotes} \printendnotes \vspace{1em}

\end{document}


But the different kinds of endnotes can no longer be interwoven.

There is no way to correctly code-label the different "types" of endnotes this way (without the parnotes). If "interwoven" the two "types" wouldn't be numbered and placed seperately at the bottom of the document.

So, in brief. Either one of the following could solve my problem.

Either:

• getting cross-references on parnotes.

Or (when working with cross-referencable endnotes):

• label the "type(-of-endnote)" (to have seperate numbering, colour and perhaps numerals) and have them printed seperately.

I started wondering whether or not a solution could be offered not using standard parnotes, endnotes or footnotes at all? But just have other code-labels to distinguish between two types of "notes", add some superscript, numbering, colouring (to "fake" endnotes). And then have them printed seperately? Perhaps (as a last resort) with biblatex?

I guess this "faking" or "defining footnotes autonomously" was done at the german Q-A-site texwelt: here or here. I'll post an english (slightly adapted) version below:

\documentclass{article}
\usepackage{xcolor}

%%%%%%%%%%%

\newcommand\newnotestype[2]{%
\newcounter{#1note}%
\expandafter\newwrite\csname the#1notes\endcsname
\expandafter\immediate\expandafter\openout\csname
the#1notes\endcsname=\jobname.#1\relax %
\expandafter\newcommand\csname  #1note\endcsname[1]{%
\stepcounter{#1note}%
{%
\tiny\textsuperscript\expandafter\textcolor{#2}{{%
\raisebox{1ex}{\hbox{\kern-0.0em\csname
the#1note\endcsname\kern-0.0em}}}}%
\expandafter\immediate\expandafter\write\csname the#1notes\endcsname%
{\csname the#1note\endcsname\ \unexpanded{##1 \par}}%
}}%

\expandafter\newcommand\csname display#1notes\endcsname[1]{%
\vspace{1\baselineskip}%
\expandafter\immediate\expandafter\closeout%
\csname the#1notes\endcsname%
\par\tiny\expandafter\textcolor{#2}{\textbf{##1}}\par%
\input\jobname.#1%
}}%

%%%%%%%%%%%

\newnotestype{first}{red}
\newnotestype{second}{blue}

%%%%%%%%%%%

\begin{document}

This is the test-text \firstnote{Endnote} \secondnote{Endnote} , some more \firstnote{Endnote} test-text, some more  \secondnote{Endnote} test-text \secondnote{Endnote}.

%%%%%%%%%%%

\displayfirstnotes{A first person's endnotes}
\displaysecondnotes{A second person's endnotes}

\end{document}


But again there is no more cross-referencing (clickable links) on any of the endnotes.

The simple \usepackage{hyperref} isn't working anymore, since the footnotes aren't actual "footnotes": they are "faked" to look like them.

So does anyone know of an elegant solution to get cross-referencing (clickable links) on these "objects"?

Some other question:

• This last (third) trial also colours the endnotes-headers, but not the endnote-numbers (at least not where the endnotes are printed). If anyone could get colour on the endnote-numbering there as well, that would be welcome.
• Also: this way, there no longer seems to be an easy way to switch from arabic numberals to roman (in general, and in particular for one "type" of endnote)?

Many thanks.

• Have you considered using endnotez which supports hyperref out-of-the-box? Also, have you read this? I don't know if that's the code you are using or not. – cfr Dec 22 '14 at 2:14
• I meant enotez. By the way, \bf was deprecated 20+ years ago. It is not a LaTeX-2e command. Use \bfseries or \textbf{} instead. – cfr Dec 22 '14 at 2:20
• @cfr; You referred to the post about hyperendnotes.sty. This is indeed the input I used in the first trial ("grey box" of code). However, I haven't in the second trial: there I fiddled around with the enotez-package because of your hint). Thanks for the notice about bold typesetting as well. – Vincent Mia Edie Verheyen Dec 22 '14 at 23:43
• One other thought: have you looked at eledmac? It is a package for typesetting critical editions. It can handle multiple series of endnotes or footnotes, and does hyperlinks. Note that I've never used it so I don't know whether all of this works well together in the way you desire, but I looked through the manual and I think it would be worth considering given that nobody has so far suggested an answer here. – cfr Dec 23 '14 at 2:38
• Or edmargin might be simpler. – cfr Dec 23 '14 at 3:04