Notas de rodapé dentro de tabularx com hiperref

Notas de rodapé dentro de tabularx com hiperref

Quero fazer meu próprio comando para lidar com hyperrefa incompatibilidade footnotesinside tabularx. Não consigo usar hyperfootnotes=falsea opção for hyperref.

Parece que estou a meio caminho de conseguir o que quero, mas não tenho experiência suficiente em LaTeX.

Os problemas são:

  1. As notas de rodapé são exibidas três vezes em vez de uma vez.
  2. A numeração está errada.
  3. Faltam links.

Código:

\documentclass{article}
\usepackage{tabularx}
\usepackage{xparse}
\usepackage{tikz}
\usetikzlibrary{arrows.meta}

\usepackage[%
%    hyperfootnotes=false,
]{hyperref} 

\newcommand\tikznode[3][]%
    {\tikz[remember picture,baseline=(#2.base)]
        \node[minimum size=0pt,inner sep=0pt,#1](#2){#3};%
    }


\begin{document}
Some text. This is the main text.\footnote{This is a footnote in the main text.}

\fbox{
    \begin{minipage}{\linewidth}
        This is a quotation with a footnote in it.\footnote{A footnote in the minipage} The footnote is numbered independently of the rest of the text\footnote{test}.
\end{minipage}
}

\fbox{
    \begin{minipage}[t]{\textwidth}
        \tikzstyle{every picture}+=[remember picture]
        \renewcommand{\arraystretch}{1.00}
        \newcounter{cntasterisk}
        \newcommand{\TypeAsterisk}{\stepcounter{cntasterisk}\tikznode{gw-\arabic{cntasterisk}}{*}}
        \newcounter{cntoption}
        \newcommand{\OptionAsterisk}[1]{\stepcounter{cntoption}\tikznode{op-\arabic{cntoption}}{#1}}
        \NewDocumentCommand{\TypeName}{sm}{%
            \IfBooleanTF{#1}{%
                {\bf #2}&\multicolumn{2}{l|}{}\\[1ex]%
            }{%
                {\bf #2}&\multicolumn{2}{l|}{}\\%
            }
        }
        \NewDocumentCommand{\OptName}{sm}{%
            \IfBooleanTF{#1}{%
                &\multicolumn{2}{l|}{\OptionAsterisk{\it #2:}}\\[1ex]%
            }{%
                &\multicolumn{2}{l|}{\OptionAsterisk\it #2:}\\%
            }
        }
        \NewDocumentCommand{\OptValue}{smm}{%
            \IfBooleanTF{#1}{%
                &\makebox[1ex]{}{\bf #2}&#3\\[1ex]%
            }{%
                &\makebox[1ex]{}{\bf #2}&#3\\%
            }
        }

        \newcommand\savedfootnotes{}        
        \newcommand\MyFootnote[1]{%
            \stepcounter{mpfootnote}$^\textrm{\scriptsize\thempfootnote}$
            \xdef\savedfootnotes%
            {\unexpanded\expandafter{\savedfootnotes}\noexpand\footnotetext{#1}}%
        }

         \begin{tabularx}{\textwidth}{|l<{\makebox[1em]{}}|l@{\makebox[2ex]{--}\makebox[1ex]{}}X|}
        \hline
        \TypeName{name\TypeAsterisk\TypeAsterisk\TypeAsterisk\TypeAsterisk}
        \hline
        \OptName{option 1}
        \hline
        \OptValue{V1}{vlaue 1}
        \hline
        \OptValue{V2}{vlaue 2\MyFootnote{whatever}}
        \hline
        \OptValue{V3}{vlaue 3\MyFootnote{anything}}
        \hline
        \OptName{option 2}
        \hline
        \OptValue{V4}{vlaue 4}
        \hline
        \OptValue{V5}{vlaue 5}
        \hline
        \OptName{option 3\MyFootnote{even more}}
        \hline
        \OptValue{V6}{vlaue 6}
        \hline
        \OptName{option 4}
        \hline
        \OptValue{X\textit{n}}{special}
        \hline
        \end{tabularx}

        \savedfootnotes

        \begin{tikzpicture}[overlay]
        \foreach \x in {1,...,\arabic{cntasterisk}} {%
            \draw [red, -{Stealth}, thick] (gw-\x) |- (op-\x);
            }
        \end{tikzpicture}

        text\footnote{text}

   \end{minipage}
}
\end{document}

insira a descrição da imagem aqui

informação relacionada