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}

введите описание изображения здесь

Связанный контент