Documentclass「book」:如何防止編號範例從每一章開始

Documentclass「book」:如何防止編號範例從每一章開始

所以,我正在寫我的論文(語言學)來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}

在此輸入影像描述

相關內容