带有自动结束句号的脚注无法与额外词汇表配合使用

带有自动结束句号的脚注无法与额外词汇表配合使用

我在使用脚注和使用 glossaries-extra 包时遇到了一些问题。我正在使用一个解决方案(看这里) 在每个句子末尾添加一个句号\footnote{}(是的,我必须使用\footnote{}而不是\footcite{}因为我必须在脚注中添加一些文本),大多数时候它都能正常工作。但是当我\gls{}在脚注中使用以句号结尾的缩写 ( ) 时,它不起作用。我会得到两个句号。我不知道如何解决这个问题。希望有人能帮助我。(我有一个类似的问题,但使用 acro 包[看这里]

梅威瑟:

\documentclass[paper=a4,fontsize=12pt]{scrbook}
\KOMAoptions{twoside=false}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\usepackage[german=guillemets]{csquotes}
\usepackage[hidelinks]{hyperref}
\usepackage[style=german-legal-book]{biblatex}
\setmainfont{ebgaramond}[]
\usepackage[style=long,nogroupskip,nonumberlist]{glossaries-extra}
\setabbreviationstyle{short-nolong}
\glssetcategoryattribute{abbreviation}{noshortplural}{true}
\glssetcategoryattribute{abbreviationdot}{discardperiod}{true}
%
\newabbreviation[%
     description={mit weiteren/m Nachweisen/Nachweis},%Darstellung der longform im Abkürzungsverzeichnis
     category=abbreviationdot,%
     longplural={mit weiteren Nachweisen},%
     shortplural=m.~w.~N.,
     sort={mwN},%
     ]%
     {mwN}%key
     {m.~w.~N.}%shortform
     {mit weiterem Nachweis}%longform
%
%automatic final period in footnote
\makeatletter%
\long\def\@makefntext#1{%
   \parindent 1em\noindent \hb@xt@ 1.8em{\hss\@makefnmark}#1%
   \ifnum\the\spacefactor<3000
     \ifnum\the\spacefactor=\blx@sf@period
     \else
     .%
     \fi
   \fi}
\makeatother
%
\begin{document}
There are no two dots at the end of sentence \gls{mwN}.\footnote{And here in the footnote is a dot at the end of the sentence}
Here is a dot.\footnote{But here, I only want one dot not two: \gls{mwN}}
\end{document}

答案1

我找到了一个似乎可行的解决方案。它基于此问题

梅威瑟:

\documentclass[paper=a4,fontsize=12pt] {scrbook}
\KOMAoptions{twoside=false}
\usepackage[ngerman]{babel}
\usepackage{fontspec}
\usepackage[german=guillemets]{csquotes}
\usepackage[hidelinks]{hyperref}
\usepackage[style=german-legal-book]{biblatex}
\setmainfont{ebgaramond}[]
\usepackage[style=long,nogroupskip,nonumberlist]{glossaries-extra}
\usepackage{xpatch}
\setabbreviationstyle{short-nolong}
\glssetcategoryattribute{abbreviation}{noshortplural}{true}
\glssetcategoryattribute{abbreviationdot}{discardperiod}{true}

\makeatletter
\newcommand{\addperiod}{\blx@imc@addperiod}  
\makeatother

\makeatletter
\protected\def\blx@imc@addperiod{%
  \ifnum\blx@spacefactor=999
    \@%
  \fi
  \blx@addpunct{period}%
  \ifnum\blx@spacefactor=\blx@sf@dot
    \spacefactor\blx@sf@period
  \fi}

\makeatother
%automatic final period in footnote
\makeatletter%
\long\def\@makefntext#1{%
  \parindent 2em%
  \hangindent = 1.7em%
  \hangafter = 1%
  \noindent %
  \hb@xt@ 1.6em{\hss\@makefnmark\hspace{0,1 cm}}#1%\parindent 1em\noindent \hb@xt@ 1.8em{\hss\@makefnmark}#1        \makebox[0.5em][l]
  \ifnum\the\spacefactor<3000
    \ifnum\the\spacefactor=\blx@sf@period
    \else
    .%
    \fi
  \fi}
\makeatother

\newabbreviation[%
    description={mit weiteren/m Nachweisen/Nachweis},%Darstellung der longform im Abkürzungsverzeichnis
    category=abbreviationdot,%
    longplural={mit weiteren Nachweisen},%
    shortplural=m.~w.~N\addperiod,
    sort={mwN},%
    ]%
    {mwN}%key
    {m.~w.~N\addperiod}%shortform
    {mit weiterem Nachweis}%longform
%
\begin{document}

There are no two dots at the end of sentence \gls{mwN}.\footnote{And here in the footnote is a dot at the end of the sentence}

Here is a dot.\footnote{But here, I only want one dot not two: \gls{mwN}}

\end{document}

相关内容