![gb4e 示例在脚注中连续编号](https://linux22.com/image/356910/gb4e%20%E7%A4%BA%E4%BE%8B%E5%9C%A8%E8%84%9A%E6%B3%A8%E4%B8%AD%E8%BF%9E%E7%BB%AD%E7%BC%96%E5%8F%B7.png)
我用了这代码(不使用 chngcntr 包)以罗马字体对脚注中的语言示例进行编号。现在,我希望脚注中的示例编号是连续的,我不想在每个脚注中从 (i) 开始编号,而是计算脚注 (i)、(ii)、(iii) 等中示例的总数。我对 Latex 还不太熟悉,不知道该怎么做。
我的最小代码如下所示:
\documentclass[a4paper,11pt]{scrartcl}
\usepackage{etoolbox}
\usepackage{gb4e}
\makeatletter
\pretocmd{\@footnotetext}{
\@noftnotefalse\setcounter{fnx}{0}%
\renewcommand{\thexnumi}{\roman{xnumi}}
}{}{}
\apptocmd{\@footnotetext}{
\@noftnotetrue
\renewcommand{\thexnumi}{\arabic{xnumi}}
}{}{}
\@ifpackageloaded{bidi}{%
\pretocmd{\@LTRfootnotetext}{
\@noftnotefalse\setcounter{fnx}{0}%
\renewcommand{\thexnumi}{\roman{xnumi}}
}{}{}
\apptocmd{\@LTRfootnotetext}{
\@noftnotetrue
\renewcommand{\thexnumi}{\arabic{xnumi}}
}{}{}
}
\makeatother
\begin{document}
有人能给点建议吗?
答案1
这是略有不同的代码版本。如果您不需要bidi
RTL 语言的代码,则只需将其删除即可。
\documentclass[a4paper,11pt]{scrartcl}
\usepackage{etoolbox}
\usepackage{gb4e}
\makeatletter
\patchcmd{\@footnotetext}{\setcounter{fnx}{0}}{\renewcommand{\thexnumi}{\roman{xnumi}}}{}{}
\apptocmd{\@footnotetext}{
\@noftnotetrue
\renewcommand{\thexnumi}{\arabic{xnumi}}%
}{}{}
% If you’re not using a Right-to-Left language you don’t need this code
\@ifpackageloaded{bidi}{%
\patchcmd{\@LTRfootnotetext}{\setcounter{fnx}{0}}{\renewcommand{\thexnumi}{\roman{xnumi}}}{}{}
\apptocmd{\@LTRfootnotetext}{
\@noftnotetrue
\renewcommand{\thexnumi}{\arabic{xnumi}}%
}{}{}
} % end of RTL code
\makeatother
\begin{document}
Some text.\footnote{This is a footnote example.\begin{exe}\ex An example\end{exe}} Some more text.\footnote{This is another footnote example.\begin{exe}\ex Another example\end{exe}}
\end{document}