footnotebackref 與使用 longtable 製作的術語表內腳註的連結已損壞

footnotebackref 與使用 longtable 製作的術語表內腳註的連結已損壞

我建立了一個術語表樣式(基於現有樣式)。它不像我之前的方法那樣有更嚴重的腳註問題。然而,一個與腳註相關的問題仍然存在。

  • 連結由footnotebackref連結到文件的開頭。預期的行為是連結回帶有腳註的術語表條目。

: 如何修復這些連結?

其他連結(例如從腳註標記到頁面底部的連結)可以正常工作。

例如,新的術語表樣式是基於,它比或樣式longtable更好地處理腳註。腳註文字和標記本身由tabularalttreehypergroupsepfootnotes,腳註文字出現在序言中,腳註標記出現在.bib要編譯的文件中bib2gls


請參閱最低工作範例。樣式本身也簡化了。

\documentclass[12pt]{book}
\usepackage{tocloft}                                    % for cftdotfill
\usepackage{array}                                      % m-type column in longtable
\usepackage{longtable}                                  % longtable for glossary
%\usepackage[symbol*, multiple]{footmisc}               % (In real document, used primarily for changing footnote style)
\usepackage[global]{sepfootnotes}                       % for separation of footnotemark and text but toward still using hyperlinks
\usepackage[hypertexnames=false]{hyperref}
\usepackage{footnotebackref}
\usepackage[a4paper,showframe]{geometry}                % testing for boundaries
\newgeometry{margin=2.5cm}

%% Footnotetexts %%
\sepfootnotecontent{A}{long fake name's footnote}
\sepfootnotecontent{B}{short fake name's footnote}
\sepfootnotecontent{C}{subentry fake name's footnote}
\sepfootnotecontent{D}{different fake name's footnote}

%%%%% FOR GLOSSSARY (Begins below) %%%%%
\usepackage[record, stylemods={default}]{glossaries-extra}                  % main glossary package
\GlsXtrLoadResources[src={entriesTest}, break-at={none}]                    % loading glossary file entriesTest.bib (for bib2gls)
\usepackage{glossary-longbooktabs}                                          % glossary longtable styles, commands etc

% Some basic formatting of glossary %
\def\myglsdefaultnamefmt#1{\textbf{#1}}
\def\myglsnavigationfmt#1{\myglsdefaultnamefmt{#1}}
\def\myglsnavigationfmtSpecial#1{{\hspace{5em}\Large\myglsdefaultnamefmt{#1}}}
\newcommand\mySpaceInGlsSub{2em}
%%

% Dots in glossary %
\renewcommand{\cftchapleader}{\cftdotfill{\cftsecdotsep}}
\renewcommand*\glspostdescription{\cftdotfill{\cftsecdotsep}}
%%

%% Actual glossary style definition is here %%
\makeatletter
\ifcsdef{@glsstyle@longragged3col}
{%
    \renewglossarystyle{longragged3col}{%
        \renewenvironment{theglossary}%
        {\renewcommand*{\arraystretch}{1.4}
            \setlength\LTleft{0pt}
            \setlength\LTright{0pt}
            \begin{longtable}{@{\extracolsep{\fill}}m{5cm}>{\raggedright}m{\dimexpr\textwidth-5cm-2\tabcolsep}@{}}}%
            {\end{longtable}}%
        \renewcommand*{\glossaryheader}{%
            \par
            \def\@gls@prevlevel{-1}%
            \hangindent0pt\relax
            \parindent0pt\relax
            \myglsnavigationfmt{\makebox[0pt]{\hspace{0.98\textwidth}\glsnavigation}}
            \glsgroupskip
            \glsgroupskip
        }%
        \renewcommand*{\glsgroupheading}[1]{%
            \glsxtrgetgrouptitle{##1}{\glsxtr@grptitle}%
            \glstreePreHeader{##1}{\glsxtr@grptitle}%
            \myglsnavigationfmtSpecial{\glsnavhypertarget{##1}{\glsxtr@grptitle\,\MakeLowercase{\glsxtr@grptitle}}}%
            \def\@gls@prevlevel{-1}%
            \hangindent0pt\relax
            \parindent0pt\relax
            \glsgroupskip
        }%
        \renewcommand{\glossentry}[2]{%
            \glsentryitem{##1}{\glossentryname{##1}} & \glossentrydesc{##1} \glspostdescription\ ##2\tabularnewline
        }%
        \renewcommand{\subglossentry}[3]{%
            \hspace{\mySpaceInGlsSub}\hangindent\mySpaceInGlsSub\glssubentryitem{##2}{\glossentryname{##2}} &
            \hspace{\mySpaceInGlsSub}\hangindent\mySpaceInGlsSub{\glossentrydesc{##2}}\glspostdescription\ ##3\tabularnewline
        }%
        \ifglsnogroupskip
        \renewcommand*{\glsgroupskip}{}%
        \else
        \renewcommand*{\glsgroupskip}{&\tabularnewline}%
        \fi
    }
}
\makeatother
%%%%
%%%%% FOR GLOSSSARY (Ends above) %%%%%

\begin{document}
    Lala.\footnote{test} \newpage
    \gls*{test-entry}
    \gls*{test-entryII}
    \gls*{test-entryIII}
    \gls*{test-entryIV}
    \gls*{test-entryV}
    \gls*{test-entryVI}
    \newcommand{\TitleOfGlossary}{Title of Glossary}
    \setcounter{footnote}{0}
    {\footnotesize\printunsrtglossary[type=main,style={longragged3col},title={\protect\Large\centering\TitleOfGlossary\pagestyle{empty}},toctitle=\TitleOfGlossary]}
\end{document}

輔助的entriesTest.bib

@entry{test-entry,
name={fake name\sepfootnote{A}, but with a longish text to make sure there is some text wrapping},
text={},
description={fictional description}
}

@entry{test-entryII,
name={fake name\sepfootnote{B}},
text={},
description={fictional description B}
}

@entry{test-entryIII,
parent={test-entryII},
name={fake subname that also spans multiple lines\sepfootnote{C}},
text={},
description={fictional description C}
}

@entry{test-entryIV,
name={different fake name},
text={},
description={fictional description D\sepfootnote{D}}
}

@entry{test-entryV,
name={f' yet another fake name with longer text indeed},
text={},
description={Am I indented properly?}
}

@entry{test-entryVI,
parent={test-entryV},
name={f' yet another fake subname with long text yes},
text={},
description={But am I indented properly? Especially when I am also line broken? What about my vertical spacing?}
}

帶有澄清註釋的輸出

帶有澄清註解的 MWE 輸出

相關內容