Quiero crear mi propio comando para solucionar hyperref
la incompatibilidad footnotes
interna tabularx
. No puedo usar hyperfootnotes=false
la opción para hyperref
.
Parece que estoy a medio camino de conseguir lo que quiero, pero no tengo suficiente experiencia en LaTeX.
Los problemas son:
- Las notas a pie de página se muestran tres veces en lugar de una.
- La numeración está mal.
- Faltan enlaces.
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}\\[1ex]%
}{%
&\makebox[1ex]{}{\bf #2}\\%
}
}
\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}