3

When I place an endnote inside tabularx like so

\documentclass[12pt]{book}

\usepackage{enotez}
\setenotez{reset=true,backref=true,totoc=chapter}

\usepackage{tabularx}

\usepackage{hyperref}

\begin{document}

\begin{tabularx}{\textwidth}{ l X }
Some text. & Some more text\endnote{Endnote text.} and some more text. \\
\end{tabularx}

\end{document}

the endnote number printed in the table skips ahead by two (in my case, from 6 to 8), and the printed endnotes list at the end of the chapter includes duplicates of the inserted endnote as those two added endnotes. The hyperlink (in my case) from the "8" printed in the table (tabularx) to the endnote in the list at the end of the chapter works fine, as does the hyperlink back from the list to the table. However, there are no endnotes in the text corresponding to the additional notes, (in my case) 6 and 7, in the endnotes list. And if I click the hyperlink from those additional endnotes in the list at the end of the chapter, it takes me to the beginning of the document.

Help is much appreciated.

  • Welcome! Have you checked the documentation for tabularx? I may be misremembering, but I thought it discussed this. EDIT: It has stuff about footnotes. Anyway, you presumably should be using \footnotetext etc. i.e. whatever the \endnote equivalent is? Anyway, David Carlisle will know if you just wait a bit. – cfr Sep 14 '16 at 2:55
2

You can patch \TX@trial to disable \endnote during the measuring phase of tabularx:

\documentclass[12pt]{book}

\usepackage{enotez}
\setenotez{reset=true,backref=true,totoc=chapter}

\usepackage{tabularx}

\usepackage{hyperref}

\usepackage{etoolbox}
\makeatletter
\patchcmd\TX@trial
  {\let\hbadness\@tempcnta}
  {\let\endnote\@firstofone\let\hbadness\@tempcnta}
  {}
  {}
\makeatother

\begin{document}

\begin{tabularx}{\textwidth}{ l X }
Some text. & Some more text\endnote{Endnote text.} and some more text. \\
\end{tabularx}

\end{document}
  • A better fix would probably be to just prevent the stepping of the internal integer during the trial phase or even resetting the the integers at the end of each trial circle so tabularx gets the correct width the contents of the cells will have afterwards… for the example given in the OP the above will suffice… – clemens Sep 14 '16 at 8:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.