I am making a document with glosses (using package gb4e
) and sections. The glosses correspond to certain numbers within certain chapters, but these chapters do not correspond to the sections I'm using; those depend on a certain date. See the MWE.
How can I reset the glosses counter at places of my own liking. Until now I used the chngcntr
package with the command \counterwithin{exx}{section}
, but when the sections and 'chapters' (when the counter has to be reset) do not correspond, I'm getting into trouble.
Using a \section*
does not work, since the counter continues.
\documentclass{article}
\usepackage{gb4e}
\usepackage{chngcntr}
\counterwithin{exx}{section}
\begin{document}
\section{Yesterday}
\begin{center}{\scshape\large Chapter 1}\end{center}
\begin{exe}
\ex \gll This is a sentence we read yesterday\\
Este es una frase [nos] leer ayer\\
\section{Today}
\ex \gll This way the counter continues, but it isn't preferable either\\
Este manera el contador continuar, pero lo no.es preferible tampoco\\
\end{exe}
\begin{center}{\scshape\large Chapter 2}\end{center}
\begin{exe}
\ex \gll This.one should.be number 1 again\\
Este ser\'{i}a numero 1 de.nuevo\\
\end{exe}
\section{Tomorrow}
\begin{exe}
\ex \gll I want this to be number 2.\\
[yo] quere este a ser numero 2\\
\begin{center}{\scshape\large Chapter 3}\end{center}
\ex \gll And this is a 1.\\
Eta hau da bat 1\\
\end{exe}
\end{document}
As you can see, the \counterwithin{exx}{section}
is not at all handy here, but the first times the chapters and dates more or less corresponded.
\setcounter{exx}{0}
at appropriate points and that will reset the counter provided, I think, you are not in the middle of anexe
environment where it seems to have no effect. But I don't understand what you are doing with the fake chapters and sectioning. What is not preferable? Why not use real chapters? Why start a chapter within a section? I basically get a mess and I have very little idea how to clean it up.