Referência cruzada em 2 tipos de notas finais (separadas e com números de cores diferentes)

Referência cruzada em 2 tipos de notas finais (separadas e com números de cores diferentes)

No início usei notas parciais e notas finais para distinguir entre os dois tipos separados de notas finais:


\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}

Então eleseramseparados e "rotulados" perfeitamente (mesmo quando os 2 "tipos" de notas finais estão entrelaçados).

Mas issonãoobter referências cruzadas (links clicáveis) nas notas parnotes ...

O carregamento hyperendnotes.styapenas coloca "links" de referência cruzada clicáveis ​​nos \endnote{...}'s, mas não nos \parnote{...}'s.


Então o usuário @cfr sugeriu o enotez-package. Achei pelo menos mais fácil, já que não é mais \usepackage{enotez}necessário carregar o extra .hyperendnotes.sty

Neste segundo teste, usei apenas notas finais (descartei as notas parciais, pois não consegui obter hiperlinks clicáveis ​​nelas.


Neste segundo teste, usei apenas notas finais (descartei as notas parciais, pois não consegui obter hiperlinks clicáveis ​​nelas.

  • Atenção: Esta segunda "caixa cinza" do código de teste requer compilar duas vezes. (devido ao 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}

Agora aíéreferência cruzada (links clicáveis) em todas as notas finais!

Mas os diferentes tipos de notas finaisnão pode mais serentrelaçado.

Não há como rotular corretamente os diferentes "tipos" de notas finais dessa maneira (sem as notas parciais). Se estivessem "entrelaçados", os dois "tipos" não seriam numerados e colocados separadamente na parte inferior do documento.


Então, resumidamente. Qualquer um dos itens a seguir pode resolver meu problema.

Qualquer:

  • obter referências cruzadas em parnotes.

Ou (ao trabalhar com notas finais com referência cruzada):

  • rotule o "tipo (de nota final)" (para ter numeração, cor e talvez numerais separados) e imprima-os separadamente.

Comecei a me perguntar se uma solução poderia ou não ser oferecidanãousando notas padrão, notas finais ou notas de rodapé? Mas basta ter outros rótulos de código para distinguir entre dois tipos de "notas", adicionar alguns sobrescritos, numeração, cores (para notas finais "falsas"). E então imprimi-los separadamente? Talvez (como último recurso) com biblatex?

Eu acho que essa "falsificação" ou "definição de notas de rodapé de forma autônoma" foi feita no site alemão de controle de qualidade texwelt:aquiouaqui. Vou postar uma versão em inglês (ligeiramente adaptada) abaixo:

\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}

Agora, os diferentes tipos de notas finaispode serrotulado facilmente e entrelaçado novamente.

Mas novamente hánão maisreferência cruzada (links clicáveis) emqualquerdas notas finais.

O simples \usepackage{hyperref}não funciona mais, já que as notas de rodapé não são "notas de rodapé" reais: elas são "falsificadas" para se parecerem com elas.

Alguém conhece uma solução elegante para obter referências cruzadas (links clicáveis) nesses "objetos"?

Alguma outra pergunta:

  • Este último (terceiro) teste também colore os cabeçalhos das notas finais, masnãoos números das notas finais (pelo menos não onde as notas finais são impressas). Se alguém pudesse obter cores na numeração das notas finais também, seria bem-vindo.
  • Também: desta forma, hánão maisparece ser uma maneira fácil de mudar de algarismos arábicos para romanos (em geral, e em particular para um "tipo" de nota final)?

Muito obrigado.

informação relacionada