# Changing example numbering with gb4e

I want to change the default behavior of gb4e for a small portion of the text. I have a series of modifications of an example that I want to be labelled as if they were subexamples. For example:

(3a) Blah blah

But (3a) is problematic and can be refined:

(3b) Refined blah blah

The example gets "refined" about six times.

First MWE:

\documentclass{article}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex\label{ex:1} Blah
\ex\label{ex:2} Blah
\ex\label{ex:3a} Blah blah
\end{exe}

But (\ref{ex:3a}) is problematic and can be refined:
\begin{exe}
\ex\label{ex:3b} Refined blah blah
\end{exe}

\end{document}


When I try to just override the label using gb4e's \exi command, the cross-referencing gets messed up:

\documentclass{article}
\usepackage{gb4e}
\begin{document}
\begin{exe}
\ex\label{ex:1} Blah
\ex\label{ex:2} Blah
\exi{(3a)}\label{ex:3a} Blah blah
\end{exe}

But (\ref{ex:3a}) is problematic and can be refined:
\begin{exe}
\exi{(3b)}\label{ex:3b} Refined blah blah
\end{exe}
\setcounter{exx}{3}
\end{document}


Instead of printing "(3a)" it prints "(2)".

How do I achieve what I'm looking for in a way that respects the counters and gets cross-referencing right?

Here's one way to do this. I've defined an \exs macro that works just like top level \ex except that it adds an arabic subexample. When you are done with a series of subexamples you must use the \finsub to reset the counters for the next regular (or sub-) examples.

\documentclass{article}
\usepackage{gb4e}
\newcounter{mysub}
\makeatletter
\newcommand{\finsub}{\setcounter{mysub}{0}\stepcounter{exx}}
\makeatother
\begin{document}

\begin{exe}
\ex Example 1 \label{ex:1}
\ex Example 2 \label{ex:2}
\exs Example 3a \label{ex:3a}
\end{exe}

But (\ref{ex:3a}) is problematic and can be refined:
\begin{exe}
\exs Refined example 3a\label{ex:3b}
\end{exe}

And if we think that (\ref{ex:3b}) is problematic we can redefine it again.

\begin{exe}
\exs{Redefined example 3a yet again}
\label{ex:3c}
\end{exe}
\finsub

\begin{exe}
\ex{ This example won't be redefined  }
\label{ex:4}
\end{exe}

The next examples are also going to be redefined
\begin{exe}
\exs{ Example 5a }
\label{ex:5a}
\end{exe}

\begin{exe}
\exs{ Example 5b }
\label{ex:5b}
\end{exe}

\end{document}