I am using the package gb4e for managing linguistics examples. I want two things:
- The examples should be numbered according to the chapter in which they appear, e.g. the first example of ch. 2 should be (2.1), etc.
- the examples in footnotes should be numbered with roman numbers ( (i), (ii), ...).
The way to achieve both results individually are described here and here respectively. However, if I try to use the two solutions together, only the footnote numbering works but the examples in the body of text go back to being numbered normally with no reference to the chapter, e.g. as (1), (2), etc...
I am probably missing something very stupid. Any advice on this?
Here's a minimal example:
\documentclass[a4paper,11pt]{report}
\usepackage{chngcntr}
\usepackage{etoolbox}
\usepackage{gb4e}
\noautomath
\counterwithin{xnumi}{chapter} % the chngcntr way (preferred)
\counterwithin{exx}{chapter} % reset example counter every chapter
\exewidth{(1.234)} % leave enough room for the example number
\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}
\chapter{Test}
This is a test.\footnote{Blabla \begin{exe}
\ex Some text.
\end{exe}}
\begin{exe}
\ex BlaBlaBla.
\end{exe}
\end{document}