我创建了一个词汇表样式(基于现有样式)。它不会像我以前的方法那样存在更严重的脚注问题。然而,一个与脚注相关的问题仍然存在。
- 链接
footnotebackref
链接到文档的开头。预期的行为是使用脚注链接回词汇表条目。
问:如何修复这些链接?
其他链接(例如从脚注标记到页面底部的链接)可以正常运行。
新的词汇表样式基于longtable
,它处理脚注的效果比tabular
或alttreehypergroup
样式更好。脚注文本和标记本身由sepfootnotes
,其中脚注文本出现在序言中,脚注标记出现在.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?}
}
带澄清注释的输出