# Numbering of linguex \ag. starts erroneously with a dot

I try to number my examples with numbers and letters. Unfortunately the numbering starts only from the second point with a.) but the first example is only a dot. After some experiments with taking out other packages, I nailed down the tipa package that seems to cause the trouble. Here's my code:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{linguex}
\usepackage{float}
\usepackage{tipa} % <- TIPA seems to cause the troubles
\usepackage{longtable}
\usepackage{multirow}
\usepackage{graphicx}
\begin{document}

% ... Many other examples here

\ex. \ag. Ambe-in. \\
swim-1SG.IPFV\\
''I swam.''
\bg. Amben-an-an. \\
swim-IRR-1SG.PFV \\
''I will swim.''
\cg. Ambe-od-in.\\
swim-DUR-1SG.IPFV\\
''I am swimming.''
\dg. Amben-a.\\
swim-1SG.IMP\\
''Let me swim!''

\end{document}


This is what I get:

What can I do to start the numbering with a.) ?

• I can't reproduce the output. Your code runs fine for me. Apr 7, 2021 at 8:00
• Please, make an example that shows the behavior, because the output from the given code is as expected. There is possibly some conflict of packages or a redefinition of important commands. Apr 7, 2021 at 10:18
• I was able to reproduce the error in another document by adding all the packages I actually use. (I've updated the code above with all the packages). By taking out one after another it seems that the tipa package is causing the trouble. I guess that \a. is also defined in tipa. Has anyone a clue about what to do?
– Alex
Apr 7, 2021 at 12:15

The linguex package redefines \a, \b, \c and \d. The first does not cause real problems, the other three instead do, because they are important commands in LaTeX and should never be redefined. The package tries to be smart, but if used in combination with tipa the smartness fails.

\documentclass{article}
\usepackage{linguex}
\NewCommandCopy{\linguexb}{\b}
\NewCommandCopy{\linguexc}{\c}
\NewCommandCopy{\linguexd}{\d}
\usepackage{tipa}
\usepackage{etoolbox}

\apptocmd{\Exformat}{%
\RenewCommandCopy{\b}{\linguexb}%
\RenewCommandCopy{\c}{\linguexc}%
\RenewCommandCopy{\d}{\linguexd}%
}{}{}

\begin{document}

% ... Many other examples here
\ex. \ag. Ambe-in. \\
swim-1SG.IPFV\\
''I swam.''
\bg. Amben-an-an. \\
swim-IRR-1SG.PFV \\
''I will swim.''
\cg. Ambe-od-in.\\
swim-DUR-1SG.IPFV\\
''I am swimming.''
\dg. Amben-a.\\
swim-1SG.IMP\\
''Let me swim!''

\end{document}


This way, the commands \b, \c and \d get the meaning expected by linguex only inside the argument to \ex.

The \ag command in linguex calls \a, which in turn calls \b. In tipa the command \b is redefined.

A solution is to store the original \b from linguex in another macro with a different name (for example \lgxb), and then patch the \a command to use the new macro instead of \b. Obviously you need to store the original definition before you load tipa, otherwise the command is already redefined.

MWE:

\documentclass{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage{etoolbox}
\usepackage{linguex}
\let\lgxb\b
\patchcmd{\a}{\b}{\lgxb}{\typeout{patch ok}}{\typeout{patch failed}}
\usepackage{float}
\usepackage{tipa} % <- TIPA seems to cause the troubles
\usepackage{longtable}
\usepackage{multirow}
\usepackage{graphicx}
\begin{document}
% ... Many other examples here
\ex. \ag. Ambe-in. \\
swim-1SG.IPFV\\
''I swam.''
\bg. Amben-an-an. \\
swim-IRR-1SG.PFV \\
''I will swim.''
\cg. Ambe-od-in.\\
swim-DUR-1SG.IPFV\\
''I am swimming.''
\dg. Amben-a.\\
swim-1SG.IMP\\
''Let me swim!''

\end{document}


Result: