文档类“书籍”:如何防止编号示例在每一章重新开始

文档类“书籍”:如何防止编号示例在每一章重新开始

因此,我正在使用 来撰写我的论文(语言学)book documentclass。对于我的编号示例,我使用了linguex包。

   \documentclass[12pt, a4paper, oneside]{book}
      \usepackage{linguex}
   \begin{document}
      \chapter{This is chapter one}
       I have a nice sentence here:
       \ex. This is an example.
       And a nice additional example:
       \ex. This is another example.
       \chapter{This is chapter two}
       This is the most important example in the thesis and I will refer to it often!
      \ex.\label{important} This is a very important example.

      \chapter{This is chapter three}
      As you can see, \Next and \NNext are very different from \ref{important}.
     \ex. This is an example.
     \ex. This is another example.
   \end{document}

现在,编号示例的计数器会在每章开始时重置。因此,每章中的第一个示例现在编号为 (1)。这不是我想要的,因为有时我需要引用另一章的示例,然后不清楚我到底指的是哪个示例。第 3 章的输出现在如下所示。如您所见,引用变得令人困惑。

第 3 章的输出

有人知道如何修复/更改此问题吗?理想情况下,第三章应该是这样的:

如你所见,(4)和(5)与(3)有很大不同。

(4)这是一个例子。

(5)这是另一个例子。

我已阅读linguex手册但找不到任何解决方案的提示,并且在互联网上也无法找到答案。

答案1

您必须包含remreset允许从重置列表中删除计数器的包(使用命令\@removefromreset

负责的柜台人员被称为ExNo

\documentclass[12pt, a4paper, oneside]{book}
\usepackage{linguex}
\usepackage{remreset}
\makeatletter
\@removefromreset{ExNo}{chapter}
\makeatother

\begin{document}

\chapter{This is chapter one} I have a nice sentence here:

\ex. This is an example.

And a nice additional example: \ex. This is another example.

\chapter{This is chapter two} This is the most important example in the thesis and I will refer to it often! \ex.\label{important} This is a very important example.

\chapter{This is chapter three} As you can see, \Next and \NNext are very different from \ref{important}. \ex. This is an example.

\ex. This is another example.

\end{document}
\begin{document}

\chapter{Chapter One}

\ex. Ex. One

\ex. Ex. Two

\chapter{Chapter Two}

\ex. Ex. Three

\end{document}

我希望,每个章节中的子示例编号都应该重置?

答案2

您还可以使用\counterwithout{<counter>)(<block>}以下chngcntr包:

\documentclass[12pt, a4paper, oneside]{book}
\usepackage{linguex}
\usepackage{chngcntr}

\counterwithout{ExNo}{chapter}

\begin{document}

\chapter{This is chapter one} I have a nice sentence here:

\ex. This is an example.

And a nice additional example: \ex. This is another example.

\chapter{This is chapter two} This is the most important example in the thesis and I will refer to it often! \ex.\label{important} This is a very important example.

\chapter{This is chapter three} As you can see, \Next and \NNext are very different from \ref{important}. \ex. This is an example.

\ex. This is another example.

\end{document}

在此处输入图片描述

相关内容